hopefully get dynamic tabbable menu state right this time
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 23 Jul 2015 12:35:24 +0000 (08:35 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 22 Feb 2016 20:31:22 +0000 (15:31 -0500)
gtk2_ardour/ardour.menus.in
gtk2_ardour/ardour_ui2.cc
gtk2_ardour/ardour_ui_dependents.cc
gtk2_ardour/ardour_ui_ed.cc
gtk2_ardour/ardour_ui_mixer.cc
libs/gtkmm2ext/gtkmm2ext/tabbable.h
libs/gtkmm2ext/tabbable.cc

index 7c507c30f6e463f4ba6fcb6909030046f9b32556..24bd1793d663da3149ec304488a3c5e5764586b9 100644 (file)
         <menuitem action='set-tempo-from-edit-range'/>
       </menu>
       <menuitem action='set-mouse-mode-object-range'/>
-      <menuitem action='show-application-preferences'/>
+      <menuitem action='show-preferences'/>
     </menu>         
 
     <menu name='RegionMenu' action='RegionMenu'>
           <menuitem action='detach-mixer'/>
       </menu>
       <menu action='PrefsMenu'>
-          <menuitem action='show-application-preferences'/>
-          <menuitem action='hide-application-preferences'/>
-          <menuitem action='attach-application-preferences'/>
-          <menuitem action='detach-application-preferences'/>
+          <menuitem action='show-preferences'/>
+          <menuitem action='hide-preferences'/>
+          <menuitem action='attach-preferences'/>
+          <menuitem action='detach-preferences'/>
       </menu>
       <menuitem action='toggle-meterbridge'/>
       <separator/>
index db0f28a5669ef3b7333375653cd20a3c725db00f..059bcb88c8e47fccb0a08eec28e08671776e1b60 100644 (file)
@@ -98,9 +98,8 @@ ARDOUR_UI::setup_windows ()
        }
 
        rc_option_editor = new RCOptionEditor;
-       rc_option_editor->add_to_notebook (_tabs, _("Preferences"));
-       rc_option_editor->contents().show_all ();
        rc_option_editor->StateChange.connect (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_state_change));
+       rc_option_editor->add_to_notebook (_tabs, _("Preferences"));
        
        /* all other dialogs are created conditionally */
 
@@ -858,4 +857,5 @@ ARDOUR_UI::update_title ()
                WindowTitle title (Glib::get_application_name());
                _main_window.set_title (title.get_string());
        }
+
 }
index 4d5078785287fa148b7ef4a53107780043cc8c96..97c81f187af1a8142bea3f2fec6130e6776239c3 100644 (file)
@@ -40,6 +40,8 @@
 #include "splash.h"
 #include "route_params_ui.h"
 #include "opts.h"
+#include "utils.h"
+
 #include "i18n.h"
 
 using namespace Gtk;
@@ -61,8 +63,15 @@ ARDOUR_UI::we_have_dependents ()
        editor->setup_tooltips ();
        editor->UpdateAllTransportClocks.connect (sigc::mem_fun (*this, &ARDOUR_UI::update_transport_clocks));
 
-       editor->add_to_notebook (_tabs, _("Editor"));
-       mixer->add_to_notebook (_tabs, _("Mixer"));
+       /* catch up on tabbable state */
+
+       std::cerr << "Tab catch up\n";
+       
+       tabbable_state_change (*editor);
+       tabbable_state_change (*mixer);
+       tabbable_state_change (*rc_option_editor);
+       
+       std::cerr << "Tab catch done\n";
        
        /* all actions are defined */
 
@@ -71,6 +80,13 @@ ARDOUR_UI::we_have_dependents ()
 
        editor->track_mixer_selection ();
        mixer->track_editor_selection ();
+
+       /* catch up on parameters */
+       
+       boost::function<void (std::string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1));
+       Config->map_parameters (pc);
+
+       ARDOUR_UI_UTILS::reset_dpi ();
 }
 
 void
index 442ea1d97d54c44b12b457250e9a0bb4df632374..299a5d7d69e2f754c87ea0fef61baf7b64fe5291 100644 (file)
@@ -80,14 +80,13 @@ ARDOUR_UI::create_editor ()
        try {
                editor = new Editor ();
                editor->StateChange.connect (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_state_change));
+               editor->add_to_notebook (_tabs, _("Editor"));
        }
 
        catch (failed_constructor& err) {
                return -1;
        }
 
-       
-       editor->Realized.connect (sigc::mem_fun (*this, &ARDOUR_UI::editor_realized));
         editor->signal_event().connect (sigc::bind (sigc::ptr_fun (&Keyboard::catch_user_event_for_pre_dialog_focus), editor));
 
        return 0;
@@ -224,19 +223,19 @@ ARDOUR_UI::install_actions ()
 
        ActionManager::register_action (common_actions, X_("show-editor"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), editor));
        ActionManager::register_action (common_actions, X_("show-mixer"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), mixer));
-       ActionManager::register_action (common_actions, X_("show-application-preferences"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), rc_option_editor));
+       ActionManager::register_action (common_actions, X_("show-preferences"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), rc_option_editor));
 
        ActionManager::register_action (common_actions, X_("hide-editor"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), editor));
        ActionManager::register_action (common_actions, X_("hide-mixer"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), mixer));
-       ActionManager::register_action (common_actions, X_("hide-application-preferences"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), rc_option_editor));
+       ActionManager::register_action (common_actions, X_("hide-preferences"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), rc_option_editor));
        
        ActionManager::register_action (common_actions, X_("attach-editor"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), editor));
        ActionManager::register_action (common_actions, X_("attach-mixer"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), mixer));
-       ActionManager::register_action (common_actions, X_("attach-application-preferences"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), rc_option_editor));
+       ActionManager::register_action (common_actions, X_("attach-preferences"), _("Attach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::attach_tabbable), rc_option_editor));
        
        ActionManager::register_action (common_actions, X_("detach-editor"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), editor));
        ActionManager::register_action (common_actions, X_("detach-mixer"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), mixer));
-       ActionManager::register_action (common_actions, X_("detach-application-preferences"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), rc_option_editor));
+       ActionManager::register_action (common_actions, X_("detach-preferences"), _("Detach"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::detach_tabbable), rc_option_editor));
 
        /* windows visibility actions */
 
index 6279f4c789439ecad791d644ad29747a33f56b56..a0b0519a26740507fcf1b319f60136c94b8f1e4c 100644 (file)
@@ -42,6 +42,7 @@ ARDOUR_UI::create_mixer ()
        try {
                mixer = Mixer_UI::instance ();
                mixer->StateChange.connect (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_state_change));
+               mixer->add_to_notebook (_tabs, _("Mixer"));
        }
 
        catch (failed_constructor& err) {
index 74a7b437dcbf6d0341772aec138f035c28db0321..b231a5c7b46ea02e55be5f5998dc0d6fd20ff8c0 100644 (file)
@@ -95,6 +95,8 @@ class LIBGTKMM2EXT_API Tabbable : public WindowProxy {
        void hide_tab ();
        void tab_close_clicked ();
        void show_own_window (bool and_pack_it);
+       void window_mapped ();
+       void window_unmapped ();
 };
 
 
index 97da6350509efa655391e33ab20ed78a54df97a0..3b99170a0a7da0bdfab6dffb58dc55da48f3ab0d 100644 (file)
@@ -40,7 +40,8 @@ Tabbable::Tabbable (Widget& w, const string& name)
        , tab_requested_by_state (true)
 {
        /* make the image about the same size as an actual X */
-       set_size_request_to_display_given_text (tab_close_image, "X", 0, 0);
+       tab_close_image.set_size_request (15,15);
+       // set_size_request_to_display_given_text (tab_close_image, "X", 0, 0);
        
        _tab_box.set_spacing (2);
        _tab_box.pack_start (_tab_label, true, true);
@@ -126,6 +127,9 @@ Tabbable::get (bool create)
        _own_notebook.show ();
        _own_notebook.set_show_tabs (false);
 
+       _window->signal_map().connect (sigc::mem_fun (*this, &Tabbable::window_mapped));
+       _window->signal_unmap().connect (sigc::mem_fun (*this, &Tabbable::window_unmapped));
+       
        /* do other window-related setup */
 
        setup ();
@@ -153,7 +157,6 @@ Tabbable::show_own_window (bool and_pack_it)
 
        _window->show_all ();
        _window->present ();
-       StateChange (*this);
 }
 
 Gtk::Notebook*
@@ -202,7 +205,6 @@ Tabbable::make_invisible ()
 {
        if (_window && (current_toplevel() == _window)) {
                _window->hide ();
-               StateChange (*this);
        } else {
                hide_tab ();
        }
@@ -297,10 +299,10 @@ Tabbable::show_tab ()
 {
        if (!window_visible() && _parent_notebook) {
                if (_contents.get_parent() == 0) {
+                       tab_requested_by_state = true;
                        add_to_notebook (*_parent_notebook, _tab_title);
                }
                _parent_notebook->set_current_page (_parent_notebook->page_num (_contents));
-               StateChange (*this);
        }
 }
 
@@ -319,7 +321,7 @@ Tabbable::xml_node_name()
 bool
 Tabbable::tabbed () const
 {
-       return _parent_notebook && (_parent_notebook->page_num (_contents) > 0);
+       return _parent_notebook && (_parent_notebook->page_num (_contents) >= 0);
 }
 
 XMLNode&
@@ -356,6 +358,12 @@ Tabbable::set_state (const XMLNode& node, int version)
        }
 
        if (tab_requested_by_state) {
+
+               std::cerr << name() << " pn " << _parent_notebook << std::endl;
+               if (_parent_notebook) {
+                       std::cerr << "\t page " << _parent_notebook->page_num (_contents) << std::endl;
+               }
+
                attach ();
        } else {
                /* this does nothing if not tabbed */
@@ -365,3 +373,15 @@ Tabbable::set_state (const XMLNode& node, int version)
        return ret;
 }
 
+void
+Tabbable::window_mapped ()
+{
+       StateChange (*this);
+}
+
+void
+Tabbable::window_unmapped ()
+{
+       StateChange (*this);
+}
+