Use std::string instead of PBD::sys::path in pbd/search_path.h, pbd/file_utils.h...
[ardour.git] / gtk2_ardour / ardour_ui_dependents.cc
index f7e6a89eb0d7e5b58d95f13527b7eb69b90db984..2b0e0df215eb32b8baf48b7c028b4842eeaa7c5f 100644 (file)
@@ -53,7 +53,9 @@ using namespace ARDOUR;
 void
 ARDOUR_UI::shutdown ()
 {
-       ui_config->save_state();
+       if (ui_config->dirty()) {
+               ui_config->save_state();
+       }
 }
 
 void
@@ -64,6 +66,9 @@ ARDOUR_UI::we_have_dependents ()
        keyboard->setup_keybindings ();
        editor->setup_tooltips ();
        editor->UpdateAllTransportClocks.connect (sigc::mem_fun (*this, &ARDOUR_UI::update_transport_clocks));
+
+       editor->track_mixer_selection ();
+       mixer->track_editor_selection ();
 }
 
 void
@@ -117,40 +122,36 @@ ARDOUR_UI::toggle_mixer_window ()
        }
 
        Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
-       
+
        if (tact->get_active()) {
                goto_mixer_window ();
        } else {
                mixer->hide ();
        }
-}      
+}
 
 void
 ARDOUR_UI::toggle_mixer_on_top ()
 {
-       Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer-on-top"));
-       if (!act) {
-               return;
-       }
-
-       Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
-       
-       if (tact->get_active()) {
+       /* Only called if the editor window received the shortcut key or if selected
+          from the editor window menu, so the mixer is definitely not on top, and
+          we can unconditionally make it so here.
+          
+          XXX this might not work so well where there is a global menu bar, e.g.
+          on OS X.
+       */
+
+       /* Toggle the mixer to `visible' if required */
+       Glib::RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
+       if (act) {
+               Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
 
-               /* Toggle the mixer to `visible' if required */
-               act = ActionManager::get_action (X_("Common"), X_("toggle-mixer"));
-               if (act) {
-                       tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
-       
-                       if (!tact->get_active()) {
-                               tact->set_active ();
-                       }
+               if (!tact->get_active()) {
+                       tact->set_active (true);
                }
-               
-               goto_mixer_window ();
-       } else {
-               goto_editor_window ();
        }
+       
+       goto_mixer_window ();
 }
 
 /** The main editor window has been closed */