summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-05-08 14:48:28 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-05-08 14:48:28 -0400
commitbebe2af95ad9999fdca719450dc2c70cfb849076 (patch)
tree2bf6f4bae48b72c4607751bf370cbb1f2ce70a15 /gtk2_ardour
parente1b0f1bd0b03c071d2b5987e4ab75ef059e32111 (diff)
parentcadfc2aee13e14af341dd68f33308a421820c855 (diff)
merge with master
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/actions.cc9
-rw-r--r--gtk2_ardour/actions.h1
-rw-r--r--gtk2_ardour/ardour.menus.in23
-rw-r--r--gtk2_ardour/ardour_dialog.cc30
-rw-r--r--gtk2_ardour/ardour_dialog.h7
-rw-r--r--gtk2_ardour/ardour_ui.cc49
-rw-r--r--gtk2_ardour/ardour_ui.h31
-rw-r--r--gtk2_ardour/ardour_ui2.cc8
-rw-r--r--gtk2_ardour/ardour_ui_dialogs.cc133
-rw-r--r--gtk2_ardour/ardour_ui_ed.cc19
-rw-r--r--gtk2_ardour/ardour_window.cc30
-rw-r--r--gtk2_ardour/ardour_window.h9
-rw-r--r--gtk2_ardour/big_clock_window.cc2
-rw-r--r--gtk2_ardour/editor.cc3
-rw-r--r--gtk2_ardour/editor.h3
-rw-r--r--gtk2_ardour/export_channel_selector.cc6
-rw-r--r--gtk2_ardour/processor_box.cc8
-rw-r--r--gtk2_ardour/processor_box.h2
-rw-r--r--gtk2_ardour/public_editor.cc1
-rw-r--r--gtk2_ardour/public_editor.h3
-rw-r--r--gtk2_ardour/theme_manager.cc23
-rw-r--r--gtk2_ardour/theme_manager.h3
-rw-r--r--gtk2_ardour/time_axis_view_item.cc2
-rw-r--r--gtk2_ardour/ui_config_vars.h1
-rw-r--r--gtk2_ardour/window_manager.cc122
-rw-r--r--gtk2_ardour/window_manager.h288
-rw-r--r--gtk2_ardour/wscript8
27 files changed, 535 insertions, 289 deletions
diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc
index 343dd20308..3b0133b535 100644
--- a/gtk2_ardour/actions.cc
+++ b/gtk2_ardour/actions.cc
@@ -63,13 +63,18 @@ vector<RefPtr<Gtk::Action> > ActionManager::jack_opposite_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::transport_sensitive_actions;
vector<RefPtr<Gtk::Action> > ActionManager::edit_point_in_region_sensitive_actions;
+static Glib::RefPtr<UIManager> ui_manager;
void
ActionManager::init ()
{
- std::string ui_file;
-
ui_manager = UIManager::create ();
+}
+
+void
+ActionManager::load_menus ()
+{
+ std::string ui_file;
find_file_in_search_path (ardour_config_search_path(), "ardour.menus", ui_file);
diff --git a/gtk2_ardour/actions.h b/gtk2_ardour/actions.h
index fd9af9992a..20c0532636 100644
--- a/gtk2_ardour/actions.h
+++ b/gtk2_ardour/actions.h
@@ -30,6 +30,7 @@ namespace ActionManager {
/* Ardour specific */
extern void init ();
+ extern void load_menus ();
extern std::vector<Glib::RefPtr<Gtk::Action> > session_sensitive_actions;
extern std::vector<Glib::RefPtr<Gtk::Action> > write_sensitive_actions;
diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in
index 5b10a4f2c2..632136c734 100644
--- a/gtk2_ardour/ardour.menus.in
+++ b/gtk2_ardour/ardour.menus.in
@@ -35,9 +35,10 @@
<menuitem action='addExistingAudioFiles'/>
<!--menuitem action='importFromSession'/-->
+#ifndef GTKOSX
<menuitem action='OpenVideo'/>
<menuitem action='CloseVideo'/>
-
+#endif
<menu name='Export' action='Export'>
<menuitem action='ExportAudio'/>
<menuitem action='StemExport'/>
@@ -47,16 +48,16 @@
<menuitem action='CleanupUnused'/>
<menuitem action='FlushWastebasket'/>
</menu>
-#ifndef GTKOSX
<separator/>
-#endif
<menuitem action='toggle-session-options-editor'/>
-#ifdef GTKOSX
- <menuitem action='toggle-rc-options-editor'/>
+#ifdef GTKOSX
<menuitem action='toggle-about'/>
+ <menuitem action='toggle-rc-options-editor'/>
#endif
+#ifndef GTKOSX
<separator/>
<menuitem action='Quit'/>
+#endif
</menu>
<menu name='Transport' action='Transport'>
@@ -281,7 +282,9 @@
<menuitem action='snap-regions-to-grid'/>
<menuitem action='toggle-region-lock'/>
<menuitem action='toggle-region-lock-style'/>
+#ifndef GTKOSX
<menuitem action='toggle-region-video-lock'/>
+#endif
<menuitem action='set-region-sync-position'/>
<menuitem action='remove-region-sync'/>
<menuitem action='nudge-forward'/>
@@ -434,7 +437,9 @@
<menuitem action="toggle-cd-marker-ruler"/>
<menuitem action="toggle-marker-ruler"/>
<separator/>
+#ifndef GTKOSX
<menuitem action="toggle-video-ruler"/>
+#endif
</menu>
<menu action="VideoMonitorMenu">
<menuitem action="zoom-vmon-100"/>
@@ -552,8 +557,10 @@
<menuitem action="toggle-marker-ruler"/>
<menuitem action="toggle-cd-marker-ruler"/>
<menuitem action="toggle-loop-punch-ruler"/>
- <separator/>
- <menuitem action="toggle-video-ruler"/>
+#ifndef GTKOSX
+ <separator/>
+ <menuitem action="toggle-video-ruler"/>
+#endif
</popup>
<popup name='ProcessorMenu'>
@@ -649,7 +656,9 @@
<menuitem action='naturalize-region'/>
<menuitem action='toggle-region-lock'/>
<menuitem action='toggle-region-lock-style'/>
+#ifndef GTKOSX
<menuitem action='toggle-region-video-lock'/>
+#endif
<menuitem action='snap-regions-to-grid'/>
<menuitem action='set-region-sync-position'/>
<menuitem action='remove-region-sync'/>
diff --git a/gtk2_ardour/ardour_dialog.cc b/gtk2_ardour/ardour_dialog.cc
index cd7d0fbd55..3690ee023b 100644
--- a/gtk2_ardour/ardour_dialog.cc
+++ b/gtk2_ardour/ardour_dialog.cc
@@ -26,6 +26,8 @@
#include "ardour_ui.h"
#include "keyboard.h"
#include "splash.h"
+#include "utils.h"
+#include "window_manager.h"
using namespace std;
using namespace Gtk;
@@ -33,6 +35,7 @@ using namespace Gtkmm2ext;
ArdourDialog::ArdourDialog (string title, bool modal, bool use_seperator)
: Dialog (title, modal, use_seperator)
+ , proxy (0)
, _splash_pushed (false)
{
init ();
@@ -56,6 +59,13 @@ ArdourDialog::~ArdourDialog ()
spl->pop_front();
}
}
+ WM::Manager::instance().remove (proxy);
+}
+
+bool
+ArdourDialog::on_key_press_event (GdkEventKey* ev)
+{
+ return relay_key_press (ev, this);
}
bool
@@ -94,10 +104,28 @@ ArdourDialog::on_show ()
}
}
+bool
+ArdourDialog::on_delete_event (GdkEventAny*)
+{
+ hide ();
+ return false;
+}
+
void
ArdourDialog::init ()
{
set_border_width (10);
- // set_type_hint (Gdk::WINDOW_TYPE_HINT_DIALOG);
+
+ set_type_hint (Gdk::WINDOW_TYPE_HINT_DIALOG);
+
+ Gtk::Window* parent = WM::Manager::instance().transient_parent();
+
+ if (parent) {
+ set_transient_for (*parent);
+ }
+
ARDOUR_UI::CloseAllDialogs.connect (sigc::bind (sigc::mem_fun (*this, &ArdourDialog::response), RESPONSE_CANCEL));
+
+ proxy = new WM::ProxyTemporary (get_title(), this);
+ WM::Manager::instance().register_window (proxy);
}
diff --git a/gtk2_ardour/ardour_dialog.h b/gtk2_ardour/ardour_dialog.h
index 041b62e1cd..d994c0a6d1 100644
--- a/gtk2_ardour/ardour_dialog.h
+++ b/gtk2_ardour/ardour_dialog.h
@@ -25,6 +25,10 @@
#include "ardour/session_handle.h"
+namespace WM {
+ class ProxyTemporary;
+}
+
/*
* This virtual parent class is so that each dialog box uses the
* same mechanism to declare its closing. It shares a common
@@ -40,10 +44,13 @@ class ArdourDialog : public Gtk::Dialog, public ARDOUR::SessionHandlePtr
bool on_enter_notify_event (GdkEventCrossing*);
bool on_leave_notify_event (GdkEventCrossing*);
+ bool on_delete_event (GdkEventAny*);
+ bool on_key_press_event (GdkEventKey*);
void on_unmap ();
void on_show ();
private:
+ WM::ProxyTemporary* proxy;
bool _splash_pushed;
void init ();
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 1d08d65215..4dcb4eb5fa 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -146,8 +146,9 @@ sigc::signal<void> ARDOUR_UI::CloseAllDialogs;
ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
: Gtkmm2ext::UI (PROGRAM_NAME, argcp, argvp)
-
+
, gui_object_state (new GUIObjectState)
+
, primary_clock (new MainClock (X_("primary"), false, X_("transport"), true, true, true, false, true))
, secondary_clock (new MainClock (X_("secondary"), false, X_("secondary"), true, true, false, false, true))
@@ -155,6 +156,14 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
, big_clock (new AudioClock (X_("bigclock"), false, "big", true, true, false, false))
+ /* start of private members */
+
+ , _startup (0)
+ , engine (0)
+ , nsm (0)
+ , _was_dirty (false)
+ , _mixer_on_top (false)
+
/* transport */
, roll_controllable (new TransportControllable ("transport roll", *this, TransportControllable::Roll))
@@ -197,7 +206,6 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
Gtkmm2ext::init(localedir);
splash = 0;
- _startup = 0;
if (theArdourUI == 0) {
theArdourUI = this;
@@ -311,7 +319,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
TimeAxisViewItem::set_constant_heights ();
- /* load up the UI manager */
+ /* Set this up so that our window proxies can register actions */
ActionManager::init ();
@@ -336,20 +344,20 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
midi_port_matrix.set_state (*ui_xml);
}
- WindowManager::instance().register_window (&theme_manager);
- WindowManager::instance().register_window (&key_editor);
- WindowManager::instance().register_window (&rc_option_editor);
- WindowManager::instance().register_window (&session_option_editor);
- WindowManager::instance().register_window (&speaker_config_window);
- WindowManager::instance().register_window (&about);
- WindowManager::instance().register_window (&add_route_dialog);
- WindowManager::instance().register_window (&add_video_dialog);
- WindowManager::instance().register_window (&route_params);
- WindowManager::instance().register_window (&bundle_manager);
- WindowManager::instance().register_window (&location_ui);
- WindowManager::instance().register_window (&big_clock_window);
- WindowManager::instance().register_window (&audio_port_matrix);
- WindowManager::instance().register_window (&midi_port_matrix);
+ WM::Manager::instance().register_window (&theme_manager);
+ WM::Manager::instance().register_window (&key_editor);
+ WM::Manager::instance().register_window (&rc_option_editor);
+ WM::Manager::instance().register_window (&session_option_editor);
+ WM::Manager::instance().register_window (&speaker_config_window);
+ WM::Manager::instance().register_window (&about);
+ WM::Manager::instance().register_window (&add_route_dialog);
+ WM::Manager::instance().register_window (&add_video_dialog);
+ WM::Manager::instance().register_window (&route_params);
+ WM::Manager::instance().register_window (&bundle_manager);
+ WM::Manager::instance().register_window (&location_ui);
+ WM::Manager::instance().register_window (&big_clock_window);
+ WM::Manager::instance().register_window (&audio_port_matrix);
+ WM::Manager::instance().register_window (&midi_port_matrix);
/* We need to instantiate the theme manager because it loads our
theme files. This should really change so that its window
@@ -418,6 +426,8 @@ ARDOUR_UI::post_engine ()
_tooltips.enable();
+ ActionManager::load_menus ();
+
if (setup_windows ()) {
throw failed_constructor ();
}
@@ -688,7 +698,6 @@ ARDOUR_UI::startup ()
app->ready ();
nsm_url = getenv ("NSM_URL");
- nsm = 0;
if (nsm_url) {
nsm = new NSM_Client;
@@ -746,7 +755,7 @@ ARDOUR_UI::startup ()
goto_editor_window ();
- WindowManager::instance().show_visible ();
+ WM::Manager::instance().show_visible ();
/* We have to do this here since goto_editor_window() ends up calling show_all() on the
* editor window, and we may want stuff to be hidden.
@@ -2329,7 +2338,7 @@ ARDOUR_UI::save_state (const string & name, bool switch_to_it)
{
XMLNode* node = new XMLNode (X_("UI"));
- WindowManager::instance().add_state (*node);
+ WM::Manager::instance().add_state (*node);
node->add_child_nocopy (gui_object_state->get_state());
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h
index c580209d4b..5d623a8731 100644
--- a/gtk2_ardour/ardour_ui.h
+++ b/gtk2_ardour/ardour_ui.h
@@ -300,6 +300,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
Gtk::Tooltips _tooltips;
NSM_Client *nsm;
bool _was_dirty;
+ bool _mixer_on_top;
void goto_editor_window ();
void goto_mixer_window ();
@@ -347,8 +348,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void start_clocking ();
void stop_clocking ();
- void manage_window (Gtk::Window&);
-
bool main_window_state_event_handler (GdkEventWindowState*, bool window_was_editor);
void update_transport_clocks (framepos_t pos);
@@ -572,23 +571,23 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
/* Dialogs that can be created via new<T> */
- WindowManager::Proxy<SpeakerDialog> speaker_config_window;
- WindowManager::Proxy<ThemeManager> theme_manager;
- WindowManager::Proxy<KeyEditor> key_editor;
- WindowManager::Proxy<RCOptionEditor> rc_option_editor;
- WindowManager::Proxy<AddRouteDialog> add_route_dialog;
- WindowManager::Proxy<About> about;
- WindowManager::Proxy<LocationUIWindow> location_ui;
- WindowManager::Proxy<RouteParams_UI> route_params;
+ WM::Proxy<SpeakerDialog> speaker_config_window;
+ WM::Proxy<ThemeManager> theme_manager;
+ WM::Proxy<KeyEditor> key_editor;
+ WM::Proxy<RCOptionEditor> rc_option_editor;
+ WM::Proxy<AddRouteDialog> add_route_dialog;
+ WM::Proxy<About> about;
+ WM::Proxy<LocationUIWindow> location_ui;
+ WM::Proxy<RouteParams_UI> route_params;
/* Windows/Dialogs that require a creator method */
- WindowManager::ProxyWithConstructor<SessionOptionEditor> session_option_editor;
- WindowManager::ProxyWithConstructor<AddVideoDialog> add_video_dialog;
- WindowManager::ProxyWithConstructor<BundleManager> bundle_manager;
- WindowManager::ProxyWithConstructor<BigClockWindow> big_clock_window;
- WindowManager::ProxyWithConstructor<GlobalPortMatrixWindow> audio_port_matrix;
- WindowManager::ProxyWithConstructor<GlobalPortMatrixWindow> midi_port_matrix;
+ WM::ProxyWithConstructor<SessionOptionEditor> session_option_editor;
+ WM::ProxyWithConstructor<AddVideoDialog> add_video_dialog;
+ WM::ProxyWithConstructor<BundleManager> bundle_manager;
+ WM::ProxyWithConstructor<BigClockWindow> big_clock_window;
+ WM::ProxyWithConstructor<GlobalPortMatrixWindow> audio_port_matrix;
+ WM::ProxyWithConstructor<GlobalPortMatrixWindow> midi_port_matrix;
/* creator methods */
diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc
index 348a87136f..76396e845d 100644
--- a/gtk2_ardour/ardour_ui2.cc
+++ b/gtk2_ardour/ardour_ui2.cc
@@ -429,14 +429,6 @@ ARDOUR_UI::setup_transport ()
}
void
-ARDOUR_UI::manage_window (Window& win)
-{
- win.signal_delete_event().connect (sigc::bind (sigc::ptr_fun (just_hide_it), &win));
- win.signal_enter_notify_event().connect (sigc::bind (sigc::mem_fun (Keyboard::the_keyboard(), &Keyboard::enter_window), &win));
- win.signal_leave_notify_event().connect (sigc::bind (sigc::mem_fun (Keyboard::the_keyboard(), &Keyboard::leave_window), &win));
-}
-
-void
ARDOUR_UI::detach_tearoff (Box* b, Widget* w)
{
// editor->ensure_float (transport_tearoff->tearoff_window());
diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc
index d43d1dbec6..3ff625a207 100644
--- a/gtk2_ardour/ardour_ui_dialogs.cc
+++ b/gtk2_ardour/ardour_ui_dialogs.cc
@@ -95,7 +95,7 @@ ARDOUR_UI::set_session (Session *s)
}
AutomationWatch::instance().set_session (s);
- WindowManager::instance().set_session (s);
+ WM::Manager::instance().set_session (s);
if (shuttle_box) {
shuttle_box->set_session (s);
@@ -268,19 +268,21 @@ ARDOUR_UI::goto_editor_window ()
editor->show_window ();
editor->present ();
- flush_pending ();
+ /* mixer should now be on top */
+ WM::Manager::instance().set_transient_for (editor);
+ _mixer_on_top = false;
}
void
ARDOUR_UI::goto_mixer_window ()
{
- if (!editor) {
- return;
- }
-
- Glib::RefPtr<Gdk::Window> win = editor->get_window ();
+ Glib::RefPtr<Gdk::Window> win;
Glib::RefPtr<Gdk::Screen> screen;
+ if (editor) {
+ win = editor->get_window ();
+ }
+
if (win) {
screen = win->get_screen();
} else {
@@ -295,10 +297,11 @@ ARDOUR_UI::goto_mixer_window ()
mixer->show_window ();
mixer->present ();
- flush_pending ();
+ /* mixer should now be on top */
+ WM::Manager::instance().set_transient_for (mixer);
+ _mixer_on_top = true;
}
-
void
ARDOUR_UI::toggle_mixer_window ()
{
@@ -319,49 +322,80 @@ ARDOUR_UI::toggle_mixer_window ()
void
ARDOUR_UI::toggle_editor_mixer ()
{
- if (editor && mixer) {
-
- if (editor->get_screen() != mixer->get_screen()) {
- // different screens, so don't do anything
- return;
- }
-
- /* See if they are obscuring each other */
-
- gint ex, ey, ew, eh;
- gint mx, my, mw, mh;
-
- editor->get_position (ex, ey);
- editor->get_size (ew, eh);
-
- mixer->get_position (mx, my);
- mixer->get_size (mw, mh);
-
- GdkRectangle e;
- GdkRectangle m;
- GdkRectangle r;
-
- e.x = ex;
- e.y = ey;
- e.width = ew;
- e.height = eh;
+ bool obscuring = false;
+ /* currently, if windows are on different
+ screens then we do nothing; but in the
+ future we may want to bring the window
+ to the front or something, so I'm leaving this
+ variable for future use
+ */
+ bool same_screen = true;
+
+ if (editor && mixer) {
- m.x = mx;
- m.y = my;
- m.width = mw;
- m.height = mh;
+ /* remeber: Screen != Monitor (Screen is a separately rendered
+ * continuous geometry that make include 1 or more monitors.
+ */
- if (!gdk_rectangle_intersect (&e, &m, &r)) {
- /* they do not intersect so do not toggle */
- return;
+ if (editor->get_screen() != mixer->get_screen() && (mixer->get_screen() != 0) && (editor->get_screen() != 0)) {
+ // different screens, so don't do anything
+ same_screen = false;
+ } else {
+ // they are on the same screen, see if they are obscuring each other
+
+ gint ex, ey, ew, eh;
+ gint mx, my, mw, mh;
+
+ editor->get_position (ex, ey);
+ editor->get_size (ew, eh);
+
+ mixer->get_position (mx, my);
+ mixer->get_size (mw, mh);
+
+ GdkRectangle e;
+ GdkRectangle m;
+ GdkRectangle r;
+
+ e.x = ex;
+ e.y = ey;
+ e.width = ew;
+ e.height = eh;
+
+ m.x = mx;
+ m.y = my;
+ m.width = mw;
+ m.height = mh;
+
+ if (gdk_rectangle_intersect (&e, &m, &r)) {
+ obscuring = true;
+ }
+ }
+ }
+
+ if (mixer && !mixer->not_visible() && mixer->property_has_toplevel_focus()) {
+ if (obscuring && same_screen) {
+ goto_editor_window();
+ }
+ } else if (editor && !editor->not_visible() && editor->property_has_toplevel_focus()) {
+ if (obscuring && same_screen) {
+ goto_mixer_window();
+ }
+ } else if (mixer && mixer->not_visible()) {
+ if (obscuring && same_screen) {
+ goto_mixer_window ();
+ }
+ } else if (editor && editor->not_visible()) {
+ if (obscuring && same_screen) {
+ goto_editor_window ();
+ }
+ } else if (obscuring && same_screen) {
+ //it's unclear what to do here, so just do the opposite of what we did last time (old behavior)
+ if (_mixer_on_top) {
+ goto_editor_window ();
+ } else {
+ goto_mixer_window ();
}
- }
-
- if (mixer && mixer->fully_visible()) {
- goto_editor_window ();
- } else {
- goto_mixer_window ();
- }
+ }
}
void
@@ -380,7 +414,6 @@ ARDOUR_UI::new_midi_tracer_window ()
if (i == _midi_tracer_windows.end()) {
/* all our MIDITracer windows are visible; make a new one */
MidiTracer* t = new MidiTracer ();
- manage_window (*t);
t->show_all ();
_midi_tracer_windows.push_back (t);
} else {
diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc
index 9d1e8c3d8a..941f1936d1 100644
--- a/gtk2_ardour/ardour_ui_ed.cc
+++ b/gtk2_ardour/ardour_ui_ed.cc
@@ -573,21 +573,28 @@ ARDOUR_UI::use_menubar_as_top_menubar ()
Gtk::Widget* widget;
Application* app = Application::instance ();
- /* Quit will be taken of separately */
+ /* the addresses ("/ui/Main...") used below are based on the menu definitions in the menus file
+ */
+
+ /* Quit will be taken care of separately */
if ((widget = ActionManager::get_widget ("/ui/Main/Session/Quit"))) {
widget->hide ();
}
+ /* Put items for About and Preferences into App menu (the
+ * ardour.menus.in file does not list them for OS X)
+ */
+
GtkApplicationMenuGroup* group = app->add_app_menu_group ();
- if ((widget = ActionManager::get_widget ("/ui/Main/Session/About"))) {
+ if ((widget = ActionManager::get_widget ("/ui/Main/Session/toggle-about"))) {
app->add_app_menu_item (group, dynamic_cast<MenuItem*>(widget));
- }
+ }
- if ((widget = ActionManager::get_widget ("/ui/Main/Session/ToggleRCOptionsEditor"))) {
+ if ((widget = ActionManager::get_widget ("/ui/Main/Session/toggle-rc-options-editor"))) {
app->add_app_menu_item (group, dynamic_cast<MenuItem*>(widget));
- }
+ }
app->set_menu_bar (*menu_bar);
}
@@ -612,7 +619,7 @@ ARDOUR_UI::save_ardour_state ()
/* Windows */
- WindowManager::instance().add_state (*window_node);
+ WM::Manager::instance().add_state (*window_node);
/* tearoffs */
diff --git a/gtk2_ardour/ardour_window.cc b/gtk2_ardour/ardour_window.cc
index f16032dc74..eb5b919b52 100644
--- a/gtk2_ardour/ardour_window.cc
+++ b/gtk2_ardour/ardour_window.cc
@@ -25,6 +25,7 @@
#include "ardour_window.h"
#include "ardour_ui.h"
#include "keyboard.h"
+#include "utils.h"
using namespace std;
using namespace Gtk;
@@ -50,6 +51,13 @@ ArdourWindow::ArdourWindow (Gtk::Window& parent, string /*title*/)
ArdourWindow::~ArdourWindow ()
{
+ WM::Manager::instance().remove (proxy);
+}
+
+bool
+ArdourWindow::on_key_press_event (GdkEventKey* ev)
+{
+ return relay_key_press (ev, this);
}
bool
@@ -73,6 +81,13 @@ ArdourWindow::on_unmap ()
Window::on_unmap ();
}
+bool
+ArdourWindow::on_delete_event (GdkEventAny*)
+{
+ hide ();
+ return false;
+}
+
void
ArdourWindow::init ()
{
@@ -88,8 +103,21 @@ ArdourWindow::init ()
vice versa.
*/
- set_type_hint (Gdk::WINDOW_TYPE_HINT_UTILITY);
+ if (ARDOUR_UI::instance()->config()->get_all_floating_windows_are_dialogs()) {
+ set_type_hint (Gdk::WINDOW_TYPE_HINT_DIALOG);
+ } else {
+ set_type_hint (Gdk::WINDOW_TYPE_HINT_UTILITY);
+ }
+ Gtk::Window* parent = WM::Manager::instance().transient_parent();
+
+ if (parent) {
+ set_transient_for (*parent);
+ }
+
ARDOUR_UI::CloseAllDialogs.connect (sigc::mem_fun (*this, &ArdourWindow::hide));
+
+ proxy = new WM::ProxyTemporary (get_title(), this);
+ WM::Manager::instance().register_window (proxy);
}
diff --git a/gtk2_ardour/ardour_window.h b/gtk2_ardour/ardour_window.h
index 3b8628d5a7..c90eb3c049 100644
--- a/gtk2_ardour/ardour_window.h
+++ b/gtk2_ardour/ardour_window.h
@@ -27,6 +27,10 @@
#include "ardour/session_handle.h"
+namespace WM {
+ class ProxyTemporary;
+}
+
/**
* This virtual parent class is so that each window uses the
* same mechanism to declare its closing. It shares a common
@@ -42,10 +46,13 @@ class ArdourWindow : public Gtk::Window, public ARDOUR::SessionHandlePtr, public
bool on_enter_notify_event (GdkEventCrossing*);
bool on_leave_notify_event (GdkEventCrossing*);
+ bool on_delete_event (GdkEventAny *);
+ bool on_key_press_event (GdkEventKey*);
void on_unmap ();
private:
- void init ();
+ WM::ProxyTemporary* proxy;
+ void init ();
};
#endif // __ardour_window_h__
diff --git a/gtk2_ardour/big_clock_window.cc b/gtk2_ardour/big_clock_window.cc
index 7a96293b05..5b369a68c1 100644
--- a/gtk2_ardour/big_clock_window.cc
+++ b/gtk2_ardour/big_clock_window.cc
@@ -53,6 +53,8 @@ BigClockWindow::BigClockWindow (AudioClock& c)
void
BigClockWindow::on_unmap ()
{
+ ArdourWindow::on_unmap ();
+
PublicEditor::instance().reset_focus ();
}
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index 33f23951b8..7f2533c909 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -229,8 +229,7 @@ pane_size_watcher (Paned* pane)
}
Editor::Editor ()
- : VisibilityTracker (*((Gtk::Window*) this))
- , _join_object_range_state (JOIN_OBJECT_RANGE_NONE)
+ : _join_object_range_state (JOIN_OBJECT_RANGE_NONE)
/* time display buttons */
, minsec_label (_("Mins:Secs"))
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index e7fcc11a3f..c43719b40d 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -37,7 +37,6 @@
#include "gtkmm2ext/dndtreeview.h"
#include "gtkmm2ext/stateful_button.h"
#include "gtkmm2ext/bindings.h"
-#include "gtkmm2ext/visibility_tracker.h"
#include "pbd/stateful.h"
#include "pbd/signals.h"
@@ -126,7 +125,7 @@ class TimeSelection;
class RegionLayeringOrderEditor;
class VerboseCursor;
-class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr, public Gtkmm2ext::VisibilityTracker
+class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARDOUR::SessionHandlePtr
{
public:
Editor ();
diff --git a/gtk2_ardour/export_channel_selector.cc b/gtk2_ardour/export_channel_selector.cc
index 6f32ae783e..10e3135b53 100644
--- a/gtk2_ardour/export_channel_selector.cc
+++ b/gtk2_ardour/export_channel_selector.cc
@@ -110,8 +110,10 @@ PortExportChannelSelector::fill_route_list ()
/* Add master bus and then everything else */
- ARDOUR::IO* master = _session->master_out()->output().get();
- channel_view.add_route (master);
+ if (_session->master_out()) {
+ ARDOUR::IO* master = _session->master_out()->output().get();
+ channel_view.add_route (master);
+ }
for (RouteList::iterator it = routes.begin(); it != routes.end(); ++it) {
if ((*it)->is_master () || (*it)->is_monitor ()) {
diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc
index 07bb0cadde..2782d2cff8 100644
--- a/gtk2_ardour/processor_box.cc
+++ b/gtk2_ardour/processor_box.cc
@@ -1378,7 +1378,7 @@ ProcessorBox::redisplay_processors ()
++j;
if (!(*i)->marked) {
- WindowManager::instance().remove (*i);
+ WM::Manager::instance().remove (*i);
delete *i;
_processor_window_info.erase (i);
}
@@ -1451,7 +1451,7 @@ ProcessorBox::maybe_add_processor_to_ui_list (boost::weak_ptr<Processor> w)
}
_processor_window_info.push_back (wp);
- WindowManager::instance().register_window (wp);
+ WM::Manager::instance().register_window (wp);
}
void
@@ -2624,7 +2624,7 @@ ProcessorBox::update_gui_object_state (ProcessorEntry* entry)
}
ProcessorWindowProxy::ProcessorWindowProxy (string const & name, ProcessorBox* box, boost::weak_ptr<Processor> processor)
- : WindowManager::ProxyBase (name, string())
+ : WM::ProxyBase (name, string())
, marked (false)
, _processor_box (box)
, _processor (processor)
@@ -2678,5 +2678,5 @@ ProcessorWindowProxy::toggle ()
drop_window ();
}
- WindowManager::ProxyBase::toggle ();
+ WM::ProxyBase::toggle ();
}
diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h
index 44d6a0ab6a..c279ffa917 100644
--- a/gtk2_ardour/processor_box.h
+++ b/gtk2_ardour/processor_box.h
@@ -75,7 +75,7 @@ namespace ARDOUR {
class ProcessorBox;
-class ProcessorWindowProxy : public WindowManager::ProxyBase
+class ProcessorWindowProxy : public WM::ProxyBase
{
public:
ProcessorWindowProxy (std::string const &, ProcessorBox *, boost::weak_ptr<ARDOUR::Processor>);
diff --git a/gtk2_ardour/public_editor.cc b/gtk2_ardour/public_editor.cc
index dc468e4a83..6c5d528e1e 100644
--- a/gtk2_ardour/public_editor.cc
+++ b/gtk2_ardour/public_editor.cc
@@ -30,6 +30,7 @@ sigc::signal<void> PublicEditor::DropDownKeys;
PublicEditor::PublicEditor ()
: Window (Gtk::WINDOW_TOPLEVEL)
+ , VisibilityTracker (*((Gtk::Window*)this))
{
}
diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h
index c76dd35196..909a6ffc65 100644
--- a/gtk2_ardour/public_editor.h
+++ b/gtk2_ardour/public_editor.h
@@ -40,6 +40,7 @@
#include "pbd/statefuldestructible.h"
#include "canvas/fwd.h"
+#include "gtkmm2ext/visibility_tracker.h"
#include "editing.h"
#include "selection.h"
@@ -98,7 +99,7 @@ using ARDOUR::framecnt_t;
* of PublicEditor need not be recompiled if private methods or member variables
* change.
*/
-class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
+class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, public Gtkmm2ext::VisibilityTracker {
public:
PublicEditor ();
virtual ~PublicEditor ();
diff --git a/gtk2_ardour/theme_manager.cc b/gtk2_ardour/theme_manager.cc
index b1e549f29e..cd2645ddf6 100644
--- a/gtk2_ardour/theme_manager.cc
+++ b/gtk2_ardour/theme_manager.cc
@@ -31,6 +31,7 @@
#include "gtkmm2ext/cell_renderer_color_selector.h"
#include "pbd/file_utils.h"
+#include "pbd/compose.h"
#include "ardour/filesystem_paths.h"
@@ -62,7 +63,7 @@ ThemeManager::ThemeManager()
, waveform_gradient_depth_label (_("Waveforms color gradient depth"))
, timeline_item_gradient_depth (0, 2.0, 0.1)
, timeline_item_gradient_depth_label (_("Timeline item gradient depth"))
-
+ , all_dialogs (_("All floating windows are dialogs"))
{
set_title (_("Theme Manager"));
@@ -97,6 +98,9 @@ ThemeManager::ThemeManager()
vbox->set_homogeneous (false);
vbox->pack_start (theme_selection_hbox, PACK_SHRINK);
vbox->pack_start (reset_button, PACK_SHRINK);
+#ifndef __APPLE__
+ vbox->pack_start (all_dialogs, PACK_SHRINK);
+#endif
vbox->pack_start (flat_buttons, PACK_SHRINK);
Gtk::HBox* hbox = Gtk::manage (new Gtk::HBox());
@@ -112,6 +116,9 @@ ThemeManager::ThemeManager()
vbox->pack_start (*hbox, PACK_SHRINK);
vbox->pack_start (scroller);
+
+ vbox->show_all ();
+
add (*vbox);
waveform_gradient_depth.set_update_policy (Gtk::UPDATE_DELAYED);
@@ -130,6 +137,12 @@ ThemeManager::ThemeManager()
flat_buttons.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_flat_buttons_toggled));
waveform_gradient_depth.signal_value_changed().connect (sigc::mem_fun (*this, &ThemeManager::on_waveform_gradient_depth_change));
timeline_item_gradient_depth.signal_value_changed().connect (sigc::mem_fun (*this, &ThemeManager::on_timeline_item_gradient_depth_change));
+ all_dialogs.signal_toggled().connect (sigc::mem_fun (*this, &ThemeManager::on_all_dialogs_toggled));
+
+ Gtkmm2ext::UI::instance()->set_tip (all_dialogs,
+ string_compose (_("Mark all floating windows to be type \"Dialog\" rather than using \"Utility\" for some.\n"
+ "This may help with some window managers. This requires a restart of %1 to take effect"),
+ PROGRAM_NAME));
set_size_request (-1, 400);
setup_theme ();
@@ -267,6 +280,13 @@ ThemeManager::on_flat_buttons_toggled ()
}
void
+ThemeManager::on_all_dialogs_toggled ()
+{
+ ARDOUR_UI::config()->set_all_floating_windows_are_dialogs (all_dialogs.get_active());
+ ARDOUR_UI::config()->set_dirty ();
+}
+
+void
ThemeManager::on_waveform_gradient_depth_change ()
{
double v = waveform_gradient_depth.get_value();
@@ -397,6 +417,7 @@ ThemeManager::setup_theme ()
flat_buttons.set_active (ARDOUR_UI::config()->get_flat_buttons());
waveform_gradient_depth.set_value (ARDOUR_UI::config()->get_waveform_gradient_depth());
timeline_item_gradient_depth.set_value (ARDOUR_UI::config()->get_timeline_item_gradient_depth());
+ all_dialogs.set_active (ARDOUR_UI::config()->get_all_floating_windows_are_dialogs());
load_rc_file(rcfile, false);
}
diff --git a/gtk2_ardour/theme_manager.h b/gtk2_ardour/theme_manager.h
index 8ce34ccd57..5751b34fb0 100644
--- a/gtk2_ardour/theme_manager.h
+++ b/gtk2_ardour/theme_manager.h
@@ -46,6 +46,7 @@ class ThemeManager : public ArdourWindow
void on_flat_buttons_toggled ();
void on_waveform_gradient_depth_change ();
void on_timeline_item_gradient_depth_change ();
+ void on_all_dialogs_toggled ();
private:
struct ColorDisplayModelColumns : public Gtk::TreeModel::ColumnRecord {
@@ -76,6 +77,8 @@ class ThemeManager : public ArdourWindow
Gtk::Label waveform_gradient_depth_label;
Gtk::HScale timeline_item_gradient_depth;
Gtk::Label timeline_item_gradient_depth_label;
+ Gtk::CheckButton all_dialogs;
+ Gtk::CheckButton gradient_waveforms;
bool button_press_event (GdkEventButton*);
};
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index b25ed5a934..ebda7312d4 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -265,7 +265,7 @@ TimeAxisViewItem::~TimeAxisViewItem()
}
bool
-TimeAxisViewItem::canvas_group_event (GdkEvent* ev)
+TimeAxisViewItem::canvas_group_event (GdkEvent* /*ev*/)
{
return false;
}
diff --git a/gtk2_ardour/ui_config_vars.h b/gtk2_ardour/ui_config_vars.h
index 9471c7a1eb..600d0b28fb 100644
--- a/gtk2_ardour/ui_config_vars.h
+++ b/gtk2_ardour/ui_config_vars.h
@@ -21,4 +21,5 @@ UI_CONFIG_VARIABLE(std::string, ui_rc_file, "ui-rc-file", "ardour3_ui_dark.rc")
UI_CONFIG_VARIABLE(bool, flat_buttons, "flat-buttons", false)
UI_CONFIG_VARIABLE(float, waveform_gradient_depth, "waveform-gradient-depth", 0.6)
UI_CONFIG_VARIABLE(float, timeline_item_gradient_depth, "timeline-item-gradient-depth", 1.3)
+UI_CONFIG_VARIABLE(bool, all_floating_windows_are_dialogs, "all-floating-windows-are-dialogs", false)
diff --git a/gtk2_ardour/window_manager.cc b/gtk2_ardour/window_manager.cc
index f50fe444a8..4a3d5f6ce4 100644
--- a/gtk2_ardour/window_manager.cc
+++ b/gtk2_ardour/window_manager.cc
@@ -25,29 +25,33 @@
#include "gtkmm2ext/visibility_tracker.h"
#include "actions.h"
+#include "ardour_dialog.h"
+#include "ardour_window.h"
#include "window_manager.h"
#include "i18n.h"
using std::string;
+using namespace WM;
-WindowManager* WindowManager::_instance = 0;
+Manager* Manager::_instance = 0;
-WindowManager&
-WindowManager::instance ()
+Manager&
+Manager::instance ()
{
if (!_instance) {
- _instance = new WindowManager;
+ _instance = new Manager;
}
return *_instance;
}
-WindowManager::WindowManager ()
+Manager::Manager ()
+ : current_transient_parent (0)
{
}
void
-WindowManager::register_window (ProxyBase* info)
+Manager::register_window (ProxyBase* info)
{
_windows.push_back (info);
@@ -59,12 +63,12 @@ WindowManager::register_window (ProxyBase* info)
}
info->set_action (ActionManager::register_action (window_actions, info->action_name().c_str(), info->menu_name().c_str(),
- sigc::bind (sigc::mem_fun (*this, &WindowManager::toggle_window), info)));
+ sigc::bind (sigc::mem_fun (*this, &Manager::toggle_window), info)));
}
}
void
-WindowManager::remove (const ProxyBase* info)
+Manager::remove (const ProxyBase* info)
{
for (Windows::iterator i = _windows.begin(); i != _windows.end(); ++i) {
if ((*i) == info) {
@@ -75,7 +79,7 @@ WindowManager::remove (const ProxyBase* info)
}
void
-WindowManager::toggle_window (ProxyBase* proxy)
+Manager::toggle_window (ProxyBase* proxy)
{
if (proxy) {
proxy->toggle ();
@@ -83,7 +87,7 @@ WindowManager::toggle_window (ProxyBase* proxy)
}
void
-WindowManager::show_visible() const
+Manager::show_visible() const
{
for (Windows::const_iterator i = _windows.begin(); i != _windows.end(); ++i) {
if ((*i)->visible()) {
@@ -94,15 +98,20 @@ WindowManager::show_visible() const
}
void
-WindowManager::add_state (XMLNode& root) const
+Manager::add_state (XMLNode& root) const
{
for (Windows::const_iterator i = _windows.begin(); i != _windows.end(); ++i) {
+ /* don't save state for temporary proxy windows
+ */
+ if (dynamic_cast<ProxyTemporary*> (*i)) {
+ continue;
+ }
root.add_child_nocopy ((*i)->get_state());
}
}
void
-WindowManager::set_session (ARDOUR::Session* s)
+Manager::set_session (ARDOUR::Session* s)
{
for (Windows::const_iterator i = _windows.begin(); i != _windows.end(); ++i) {
ARDOUR::SessionHandlePtr* sp = (*i)->session_handle ();
@@ -112,9 +121,34 @@ WindowManager::set_session (ARDOUR::Session* s)
}
}
-/*-----------------------*/
+void
+Manager::set_transient_for (Gtk::Window* parent)
+{
+#ifndef __APPLE__
+ if (parent) {
+ for (Windows::const_iterator i = _windows.begin(); i != _windows.end(); ++i) {
+ Gtk::Window* win = (*i)->get();
+ if (win) {
+ std::cerr << "marked " << win->get_title() << " as transient of " << parent->get_title() << std::endl;
+ win->set_transient_for (*parent);
+ }
+ }
+ } else {
+ for (Windows::const_iterator i = _windows.begin(); i != _windows.end(); ++i) {
+ Gtk::Window* win = (*i)->get();
+ if (win) {
+ gtk_window_set_transient_for (win->gobj(), 0);
+ }
+ }
+ }
+
+ current_transient_parent = parent;
+#endif
+}
+
+/*-------------------------*/
-WindowManager::ProxyBase::ProxyBase (const string& name, const std::string& menu_name)
+ProxyBase::ProxyBase (const string& name, const std::string& menu_name)
: _name (name)
, _menu_name (menu_name)
, _window (0)
@@ -127,7 +161,7 @@ WindowManager::ProxyBase::ProxyBase (const string& name, const std::string& menu
{
}
-WindowManager::ProxyBase::ProxyBase (const string& name, const std::string& menu_name, const XMLNode& node)
+ProxyBase::ProxyBase (const string& name, const std::string& menu_name, const XMLNode& node)
: _name (name)
, _menu_name (menu_name)
, _window (0)
@@ -141,13 +175,13 @@ WindowManager::ProxyBase::ProxyBase (const string& name, const std::string& menu
set_state (node);
}
-WindowManager::ProxyBase::~ProxyBase ()
+ProxyBase::~ProxyBase ()
{
delete vistracker;
}
void
-WindowManager::ProxyBase::set_state (const XMLNode& node)
+ProxyBase::set_state (const XMLNode& node)
{
XMLNodeList children = node.children ();
@@ -192,19 +226,19 @@ WindowManager::ProxyBase::set_state (const XMLNode& node)
}
void
-WindowManager::ProxyBase::set_action (Glib::RefPtr<Gtk::Action> act)
+ProxyBase::set_action (Glib::RefPtr<Gtk::Action> act)
{
_action = act;
}
std::string
-WindowManager::ProxyBase::action_name() const
+ProxyBase::action_name() const
{
return string_compose (X_("toggle-%1"), _name);
}
void
-WindowManager::ProxyBase::toggle()
+ProxyBase::toggle()
{
if (!_window) {
(void) get (true);
@@ -221,7 +255,7 @@ WindowManager::ProxyBase::toggle()
}
XMLNode&
-WindowManager::ProxyBase::get_state () const
+ProxyBase::get_state () const
{
XMLNode* node = new XMLNode (X_("Window"));
char buf[32];
@@ -252,7 +286,7 @@ WindowManager::ProxyBase::get_state () const
}
void
-WindowManager::ProxyBase::drop_window ()
+ProxyBase::drop_window ()
{
if (_window) {
_window->hide ();
@@ -264,7 +298,7 @@ WindowManager::ProxyBase::drop_window ()
}
void
-WindowManager::ProxyBase::use_window (Gtk::Window& win)
+ProxyBase::use_window (Gtk::Window& win)
{
drop_window ();
_window = &win;
@@ -272,12 +306,17 @@ WindowManager::ProxyBase::use_window (Gtk::Window& win)
}
void
-WindowManager::ProxyBase::setup ()
+ProxyBase::setup ()
{
assert (_window);
vistracker = new Gtkmm2ext::VisibilityTracker (*_window);
+ if (_width != -1 || _height != -1 || _x_off != -1 || _y_off != -1) {
+ /* cancel any mouse-based positioning */
+ _window->set_position (Gtk::WIN_POS_NONE);
+ }
+
if (_width != -1 && _height != -1) {
_window->set_default_size (_width, _height);
}
@@ -288,14 +327,14 @@ WindowManager::ProxyBase::setup ()
}
void
-WindowManager::ProxyBase::show ()
+ProxyBase::show ()
{
Gtk::Window* win = get (true);
win->show ();
}
void
-WindowManager::ProxyBase::maybe_show ()
+ProxyBase::maybe_show ()
{
if (_visible) {
show ();
@@ -303,7 +342,7 @@ WindowManager::ProxyBase::maybe_show ()
}
void
-WindowManager::ProxyBase::show_all ()
+ProxyBase::show_all ()
{
Gtk::Window* win = get (true);
win->show_all ();
@@ -311,15 +350,18 @@ WindowManager::ProxyBase::show_all ()
void
-WindowManager::ProxyBase::present ()
+ProxyBase::present ()
{
Gtk::Window* win = get (true);
win->show_all ();
win->present ();
+
+ /* turn off any mouse-based positioning */
+ _window->set_position (Gtk::WIN_POS_NONE);
}
void
-WindowManager::ProxyBase::hide ()
+ProxyBase::hide ()
{
Gtk::Window* win = get (false);
if (win) {
@@ -327,3 +369,25 @@ WindowManager::ProxyBase::hide ()
}
}
+/*-----------------------*/
+
+ProxyTemporary::ProxyTemporary (const string& name, Gtk::Window* win)
+ : ProxyBase (name, string())
+{
+ _window = win;
+}
+
+ProxyTemporary::~ProxyTemporary ()
+{
+}
+
+ARDOUR::SessionHandlePtr*
+ProxyTemporary::session_handle()
+{
+ /* may return null */
+ ArdourWindow* aw = dynamic_cast<ArdourWindow*> (_window);
+ if (aw) { return aw; }
+ ArdourDialog* ad = dynamic_cast<ArdourDialog*> (_window);
+ if (ad) { return ad; }
+ return 0;
+}
diff --git a/gtk2_ardour/window_manager.h b/gtk2_ardour/window_manager.h
index fb65a8d088..7138a95e7b 100644
--- a/gtk2_ardour/window_manager.h
+++ b/gtk2_ardour/window_manager.h
@@ -43,136 +43,15 @@ namespace ARDOUR {
class SessionHandlePtr;
}
-class WindowManager
-{
- public:
- static WindowManager& instance();
-
- class ProxyBase : public sigc::trackable {
- public:
- ProxyBase (const std::string& name, const std::string& menu_name);
- ProxyBase (const std::string& name, const std::string& menu_name, const XMLNode&);
- virtual ~ProxyBase();
-
- void show ();
- void show_all ();
- void hide ();
- void present ();
- void maybe_show ();
-
- bool visible() const { return _visible; }
- const std::string& name() const { return _name; }
- const std::string& menu_name() const { return _menu_name; }
-
- std::string action_name() const;
- void set_action (Glib::RefPtr<Gtk::Action>);
- Glib::RefPtr<Gtk::Action> action() const { return _action; };
-
- void drop_window ();
- void use_window (Gtk::Window&);
-
- virtual Gtk::Window* get (bool create = false) = 0;
-
- virtual void toggle ();
-
- void set_state (const XMLNode&);
- XMLNode& get_state () const;
-
- virtual ARDOUR::SessionHandlePtr* session_handle () = 0;
-
- operator bool() const { return _window != 0; }
+namespace WM {
- protected:
- std::string _name;
- std::string _menu_name;
- Glib::RefPtr<Gtk::Action> _action;
- Gtk::Window* _window;
- mutable bool _visible; ///< true if the window should be visible on startup
- mutable int _x_off; ///< x position
- mutable int _y_off; ///< y position
- mutable int _width; ///< width
- mutable int _height; ///< height
- Gtkmm2ext::VisibilityTracker* vistracker;
+class ProxyBase;
- void setup ();
- };
+class Manager
+{
+ public:
+ static Manager& instance();
- template<typename T>
- class ProxyWithConstructor: public ProxyBase {
- public:
- ProxyWithConstructor (const std::string& name, const std::string& menu_name, const boost::function<T*()>& c)
- : ProxyBase (name, menu_name) , creator (c) {}
-
- ProxyWithConstructor (const std::string& name, const std::string& menu_name, const boost::function<T*()>& c, const XMLNode* node)
- : ProxyBase (name, menu_name, node) , creator (c) {}
-
- Gtk::Window* get (bool create = false) {
- if (!_window) {
- if (!create) {
- return 0;
- }
-
- _window = creator ();
-
- if (_window) {
- setup ();
- }
- }
-
- return _window;
- }
-
- T* operator->() {
- return dynamic_cast<T*> (get (true));
- }
-
- ARDOUR::SessionHandlePtr* session_handle () {
- /* may return null */
- return dynamic_cast<T*> (_window);
- }
-
- private:
- boost::function<T*()> creator;
- };
-
- template<typename T>
- class Proxy : public ProxyBase {
- public:
- Proxy (const std::string& name, const std::string& menu_name)
- : ProxyBase (name, menu_name) {}
-
- Proxy (const std::string& name, const std::string& menu_name, const XMLNode* node)
- : ProxyBase (name, menu_name, node) {}
-
- Gtk::Window* get (bool create = false) {
- if (!_window) {
- if (!create) {
- return 0;
- }
-
- _window = new T ();
-
- if (_window) {
- setup ();
- }
- }
-
- return _window;
- }
-
- T* operator->() {
- /* make return null */
- return dynamic_cast<T*> (_window);
- }
-
- ARDOUR::SessionHandlePtr* session_handle () {
- return dynamic_cast<T*> (get());
- }
-
- private:
- boost::function<T*()> creator;
- };
-
void register_window (ProxyBase*);
void remove (const ProxyBase*);
void toggle_window (ProxyBase*);
@@ -180,15 +59,164 @@ class WindowManager
void set_session (ARDOUR::Session*);
void add_state (XMLNode&) const;
+ /* HACK HACK HACK */
+ void set_transient_for (Gtk::Window*);
+ Gtk::Window* transient_parent() const { return current_transient_parent; }
+
private:
typedef std::list<ProxyBase*> Windows;
Windows _windows;
Glib::RefPtr<Gtk::ActionGroup> window_actions;
+ Gtk::Window* current_transient_parent;
+
+ Manager();
+ ~Manager();
+
+ static Manager* _instance;
+};
+
+class ProxyBase : public sigc::trackable {
+ public:
+ ProxyBase (const std::string& name, const std::string& menu_name);
+ ProxyBase (const std::string& name, const std::string& menu_name, const XMLNode&);
+ virtual ~ProxyBase();
+
+ void show ();
+ void show_all ();
+ void hide ();
+ void present ();
+ void maybe_show ();
+
+ bool visible() const { return _visible; }
+ const std::string& name() const { return _name; }
+ const std::string& menu_name() const { return _menu_name; }
+
+ std::string action_name() const;
+ void set_action (Glib::RefPtr<Gtk::Action>);
+ Glib::RefPtr<Gtk::Action> action() const { return _action; };
+
+ void drop_window ();
+ void use_window (Gtk::Window&);
+
+ virtual Gtk::Window* get (bool create = false) = 0;
+
+ virtual void toggle ();
+
+ void set_state (const XMLNode&);
+ XMLNode& get_state () const;
+
+ virtual ARDOUR::SessionHandlePtr* session_handle () = 0;
+
+ operator bool() const { return _window != 0; }
+
+ protected:
+ std::string _name;
+ std::string _menu_name;
+ Glib::RefPtr<Gtk::Action> _action;
+ Gtk::Window* _window;
+ mutable bool _visible; ///< true if the window should be visible on startup
+ mutable int _x_off; ///< x position
+ mutable int _y_off; ///< y position
+ mutable int _width; ///< width
+ mutable int _height; ///< height
+ Gtkmm2ext::VisibilityTracker* vistracker;
+
+ void setup ();
+};
+
+class ProxyTemporary: public ProxyBase {
+ public:
+ ProxyTemporary (const std::string& name, Gtk::Window* win);
+ ~ProxyTemporary();
+
+ Gtk::Window* get (bool create = false) {
+ (void) create;
+ return _window;
+ }
+
+ Gtk::Window* operator->() {
+ return _window;
+ }
+
+ ARDOUR::SessionHandlePtr* session_handle ();
+};
+
+template<typename T>
+class ProxyWithConstructor: public ProxyBase {
+ public:
+ ProxyWithConstructor (const std::string& name, const std::string& menu_name, const boost::function<T*()>& c)
+ : ProxyBase (name, menu_name) , creator (c) {}
+
+ ProxyWithConstructor (const std::string& name, const std::string& menu_name, const boost::function<T*()>& c, const XMLNode* node)
+ : ProxyBase (name, menu_name, node) , creator (c) {}
+
+ Gtk::Window* get (bool create = false) {
+ if (!_window) {
+ if (!create) {
+ return 0;
+ }
+
+ _window = creator ();
+
+ if (_window) {
+ setup ();
+ }
+ }
+
+ return _window;
+ }
- WindowManager();
- ~WindowManager();
+ T* operator->() {
+ return dynamic_cast<T*> (get (true));
+ }
- static WindowManager* _instance;
+ ARDOUR::SessionHandlePtr* session_handle () {
+ /* may return null */
+ return dynamic_cast<T*> (_window);
+ }
+
+ private:
+ boost::function<T*()> creator;
};
+template<typename T>
+class Proxy : public ProxyBase {
+ public:
+ Proxy (const std::string& name, const std::string& menu_name)
+ : ProxyBase (name, menu_name) {}
+
+ Proxy (const std::string& name, const std::string& menu_name, const XMLNode* node)
+ : ProxyBase (name, menu_name, node) {}
+
+ Gtk::Window* get (bool create = false) {
+ if (!_window) {
+ if (!create) {
+ return 0;
+ }
+
+ _window = new T ();
+
+ if (_window) {
+ setup ();
+ }
+ }
+
+ return _window;
+ }
+
+ T* operator->() {
+ return dynamic_cast<T*> (get(true));
+ }
+
+ ARDOUR::SessionHandlePtr* session_handle () {
+ /* may return null */
+ return dynamic_cast<T*> (_window);
+ }
+
+ private:
+ boost::function<T*()> creator;
+};
+
+} /* namespace */
+
#endif /* __gtk2_ardour_window_manager_h__ */
diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript
index c473a4569b..b2260425ed 100644
--- a/gtk2_ardour/wscript
+++ b/gtk2_ardour/wscript
@@ -375,7 +375,7 @@ def build(bld):
'libtaglib',
'libcanvas'
]
- obj.target = 'ardour-3.0-vst.exe.so'
+ obj.target = 'ardour-' + bld.env['VERSION'] + '-vst.exe.so'
obj.includes = [ '../libs/fst', '.' ]
obj.linkflags = ['-mwindows', '-Wl,--export-dynamic']
obj.defines = ['_POSIX_SOURCE', 'USE_WS_PREFIX']
@@ -392,7 +392,7 @@ def build(bld):
# just the normal executable version of the GTK GUI
obj = bld(features = 'cxx c cxxprogram')
obj.source = gtk2_ardour_sources
- obj.target = 'ardour-3.0'
+ obj.target = 'ardour-' + bld.env['VERSION']
obj.includes = ['.']
# continue with setup of obj, which could be a shared library
@@ -466,8 +466,8 @@ def build(bld):
'DATADIR' : os.path.normpath(bld.env['DATADIR']),
'SYSCONFDIR' : os.path.normpath(bld.env['SYSCONFDIR']),
'LIBS' : 'build/libs',
- 'VERSION' : '3.0',
- 'EXECUTABLE' : 'build/gtk2_ardour/ardour-3.0'
+ 'VERSION' : bld.env['VERSION'],
+ 'EXECUTABLE' : 'build/gtk2_ardour/ardour-' + bld.env['VERSION']
}
def set_subst_dict(obj, dict):