try using top-menu-bar buttons and not notebook tabs to control window visibility
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 17 Nov 2015 22:49:27 +0000 (17:49 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 22 Feb 2016 20:31:25 +0000 (15:31 -0500)
gtk2_ardour/ardour_ui2.cc
gtk2_ardour/ardour_ui_dependents.cc
gtk2_ardour/ardour_ui_dialogs.cc
gtk2_ardour/ardour_ui_ed.cc

index 9aa03eb60206496e08aa5ae51fd506a32738e310..2623cc8ca952fd1d2bf25c23f6bd471b22689dfc 100644 (file)
@@ -104,31 +104,6 @@ ARDOUR_UI::tabs_button_event (GdkEventButton* ev)
        return false;
 }
 
-void
-ARDOUR_UI::tabs_page_removed (Gtk::Widget*, guint)
-{
-       if (_tabs.get_n_pages() == 1) {
-               _tabs.set_show_tabs (false);
-       } else {
-               _tabs.set_show_tabs (true);
-       }
-}
-
-void
-ARDOUR_UI::tabs_page_added (Gtk::Widget*, guint)
-{
-       if (_tabs.get_n_pages() == 1) {
-               _tabs.set_show_tabs (false);
-       } else {
-               _tabs.set_show_tabs (true);
-       }
-}
-
-void
-ARDOUR_UI::tabs_switch (GtkNotebookPage*, guint page_number)
-{
-}
-
 void
 ARDOUR_UI::setup_tooltips ()
 {
index e7f46db83de531974c8bbb8c5c25392fda4f35cd..afcecd3f4fddc55b19b1aa1acc69e8adc64c2b70 100644 (file)
@@ -368,9 +368,7 @@ ARDOUR_UI::setup_windows ()
        _main_window.show_all ();
        setup_toplevel_window (_main_window, "", this);
 
-       _tabs.signal_switch_page().connect (sigc::mem_fun (*this, &ARDOUR_UI::tabs_switch));
-       _tabs.signal_page_removed().connect (sigc::mem_fun (*this, &ARDOUR_UI::tabs_page_removed));
-       _tabs.signal_page_added().connect (sigc::mem_fun (*this, &ARDOUR_UI::tabs_page_added));
+       _tabs.set_show_tabs (false);
 
        /* It would be nice if Gtkmm had wrapped this rather than just
         * deprecating the old set_window_creation_hook() method, but oh well...
index e42c532995416cba12a76e18927fa0b1cf0376bc..8a51d833083bcd65758d413b5d147a28491614c6 100644 (file)
@@ -375,7 +375,7 @@ ARDOUR_UI::tabbable_state_change (Tabbable& t)
        if (t.tabbed()) {
 
                insensitive_action_names.push_back (string_compose ("attach-%1", downcased_name));
-               insensitive_action_names.push_back (string_compose ("show-%1", downcased_name));
+               sensitive_action_names.push_back (string_compose ("show-%1", downcased_name));
                sensitive_action_names.push_back (string_compose ("detach-%1", downcased_name));
                sensitive_action_names.push_back (string_compose ("hide-%1", downcased_name));
 
@@ -389,7 +389,7 @@ ARDOUR_UI::tabbable_state_change (Tabbable& t)
        } else if (t.window_visible()) {
 
                insensitive_action_names.push_back (string_compose ("detach-%1", downcased_name));
-               insensitive_action_names.push_back (string_compose ("show-%1", downcased_name));
+               sensitive_action_names.push_back (string_compose ("show-%1", downcased_name));
                sensitive_action_names.push_back (string_compose ("attach-%1", downcased_name));
                sensitive_action_names.push_back (string_compose ("hide-%1", downcased_name));
 
index a0836f41d71da717b6009db4f5e08b1d08f187cd..a07b943433a7ad485a41ebefada173dd1eaecc38 100644 (file)
@@ -113,7 +113,7 @@ ARDOUR_UI::install_actions ()
        global_actions.register_action (main_menu_actions, X_("PrefsMenu"), _("Preferences"));
        global_actions.register_action (main_menu_actions, X_("DetachMenu"), _("Detach"));
        global_actions.register_action (main_menu_actions, X_("Help"), _("Help"));
-       global_actions.register_action (main_menu_actions, X_("KeyMouseActions"), _("Misc. Shortcuts"));
+       global_actions.register_action (main_menu_actions, X_("KeyMouseActions"), _("Misc. Shortcuts"));
        global_actions.register_action (main_menu_actions, X_("AudioFileFormat"), _("Audio File Format"));
        global_actions.register_action (main_menu_actions, X_("AudioFileFormatHeader"), _("File Type"));
        global_actions.register_action (main_menu_actions, X_("AudioFileFormatData"), _("Sample Format"));
@@ -222,9 +222,9 @@ ARDOUR_UI::install_actions ()
        global_actions.register_action (common_actions, X_("Quit"), _("Quit"), (hide_return (sigc::mem_fun(*this, &ARDOUR_UI::finish))));
        global_actions.register_action (common_actions, X_("Hide"), _("Hide"), sigc::mem_fun (*this, &ARDOUR_UI::hide_application));
 
-       global_actions.register_action (common_actions, X_("show-editor"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), editor));
-       global_actions.register_action (common_actions, X_("show-mixer"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), mixer));
-       global_actions.register_action (common_actions, X_("show-preferences"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), rc_option_editor));
+       global_actions.register_toggle_action (common_actions, X_("show-editor"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), editor));
+       global_actions.register_toggle_action (common_actions, X_("show-mixer"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), mixer));
+       global_actions.register_toggle_action (common_actions, X_("show-preferences"), _("Show"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::show_tabbable), rc_option_editor));
 
        global_actions.register_action (common_actions, X_("hide-editor"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), editor));
        global_actions.register_action (common_actions, X_("hide-mixer"), _("Hide"), sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::hide_tabbable), mixer));
@@ -499,6 +499,16 @@ if (Profile->get_mixbus())
        global_actions.register_action (midi_actions, X_("panic"), _("Panic"), sigc::mem_fun(*this, &ARDOUR_UI::midi_panic));
 }
 
+static
+bool drag_failed (const Glib::RefPtr<Gdk::DragContext>& context, DragResult result, Tabbable* tab)
+{
+       if (result == Gtk::DRAG_RESULT_NO_TARGET) {
+               tab->detach ();
+               return true;
+       }
+       return false;
+}
+
 void
 ARDOUR_UI::build_menu_bar ()
 {
@@ -538,15 +548,41 @@ ARDOUR_UI::build_menu_bar ()
        format_label.set_use_markup ();
 
 #ifndef TOP_MENUBAR
-       menu_hbox.pack_start (*menu_bar, false, false);
+       menu_hbox.pack_start (*menu_bar, false, false);
 #else
        use_menubar_as_top_menubar ();
 #endif
 
+       ArdourButton* editor_button = manage (new ArdourButton (S_("Window|Editor")));
+       ArdourButton* mixer_button = manage (new ArdourButton (S_("Window|Mixer")));
+       ArdourButton* prefs_button = manage (new ArdourButton (S_("Window|Preferences")));
+       Gtk::HBox*   window_button_box = manage (new Gtk::HBox);
+
+       std::vector<TargetEntry> drag_target_entries;
+       drag_target_entries.push_back (TargetEntry ("tabbable"));
+       editor_button->drag_source_set (drag_target_entries);
+       editor_button->drag_source_set_icon (Gtkmm2ext::pixbuf_from_string (S_("Window|Editor"),
+                                                                           Pango::FontDescription ("Sans 12"),
+                                                                           40, 20,
+                                                                           Gdk::Color ("red")));
+
+       editor_button->signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), editor));
+
+       editor_button->set_related_action (ActionManager::get_action (X_("Common"), X_("show-editor")));
+       editor_button->set_name (X_("page switch button"));
+       mixer_button->set_related_action (ActionManager::get_action (X_("Common"), X_("show-mixer")));
+       mixer_button->set_name (X_("page switch button"));
+
+       window_button_box->pack_start (*editor_button, false, false);
+       window_button_box->pack_start (*mixer_button, false, false);
+       window_button_box->pack_start (*prefs_button, false, false);
+
+       menu_hbox.pack_start (*window_button_box, false, false, 20);
+
        bool wall_clock = false;
        bool disk_space = false;
 
-       if (!Profile->get_small_screen()) {
+       if (!Profile->get_small_screen()) {
 #ifndef __APPLE__
                // OSX provides its own wallclock, thank you very much
                wall_clock = true;
@@ -554,6 +590,7 @@ ARDOUR_UI::build_menu_bar ()
                disk_space = true;
        }
 
+
        hbox->pack_end (error_alert_button, false, false, 2);
 
        hbox->pack_end (wall_clock_label, false, false, 2);