hide tabs in main window when there's only 1 tab left.

This helps with space and also prevents tearing off the last tab
This commit is contained in:
Paul Davis 2015-07-09 12:54:09 -04:00
parent 552e995297
commit 77b6b25f2d
2 changed files with 24 additions and 0 deletions

View file

@ -825,6 +825,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
void grab_focus_after_dialog ();
void tabs_switch (GtkNotebookPage*, guint page_number);
void tabs_page_added (Gtk::Widget*, guint page_number);
void tabs_page_removed (Gtk::Widget*, guint page_number);
bool key_press_focus_accelerator_handler (Gtk::Window& window, GdkEventKey* ev, Gtkmm2ext::Bindings*);
};

View file

@ -149,6 +149,8 @@ ARDOUR_UI::setup_windows ()
rc_option_editor->contents().show_all ();
_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));
/* It would be nice if Gtkmm had wrapped this rather than just
* deprecating the old set_window_creation_hook() method, but oh well...
@ -158,6 +160,26 @@ ARDOUR_UI::setup_windows ()
return 0;
}
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)
{