try using top-menu-bar buttons and not notebook tabs to control window visibility

This commit is contained in:
Paul Davis 2015-11-17 17:49:27 -05:00
parent fa31454688
commit 47cf908998
4 changed files with 46 additions and 36 deletions

View 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 ()
{

View 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...

View 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));

View 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);