13
0

add suggestive tooltips for tabs; remove position argument for Tabbable since it isn't really usable

This commit is contained in:
Paul Davis 2015-07-09 13:27:39 -04:00
parent 39036cf20f
commit d84f655495
4 changed files with 16 additions and 9 deletions

View File

@ -145,7 +145,7 @@ ARDOUR_UI::setup_windows ()
setup_toplevel_window (_main_window, "", this);
rc_option_editor = new RCOptionEditor;
rc_option_editor->add_to_notebook (_tabs, _("Preferences"), 2);
rc_option_editor->add_to_notebook (_tabs, _("Preferences"));
rc_option_editor->contents().show_all ();
_tabs.signal_switch_page().connect (sigc::mem_fun (*this, &ARDOUR_UI::tabs_switch));

View File

@ -61,8 +61,8 @@ 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"), 1);
mixer->add_to_notebook (_tabs, _("Mixer"), 1);
editor->add_to_notebook (_tabs, _("Editor"));
mixer->add_to_notebook (_tabs, _("Mixer"));
/* all actions are defined */

View File

@ -39,7 +39,7 @@ class LIBGTKMM2EXT_API Tabbable : public WindowProxy {
Tabbable (Gtk::Widget&, const std::string&);
~Tabbable ();
void add_to_notebook (Gtk::Notebook& notebook, const std::string& tab_title, int position);
void add_to_notebook (Gtk::Notebook& notebook, const std::string& tab_title);
void show_tab ();
Gtk::Widget& contents() const { return _contents; }
@ -72,7 +72,6 @@ class LIBGTKMM2EXT_API Tabbable : public WindowProxy {
Gtk::Notebook _own_notebook;
Gtk::Notebook* _parent_notebook;
std::string _tab_title;
int _notebook_position;
};
}

View File

@ -22,6 +22,7 @@
#include <gtkmm/window.h>
#include "gtkmm2ext/tabbable.h"
#include "gtkmm2ext/gtk_ui.h"
#include "gtkmm2ext/visibility_tracker.h"
#include "i18n.h"
@ -45,15 +46,22 @@ Tabbable::~Tabbable ()
}
void
Tabbable::add_to_notebook (Notebook& notebook, const string& tab_title, int position)
Tabbable::add_to_notebook (Notebook& notebook, const string& tab_title)
{
notebook.insert_page (_contents, tab_title, position, false);
notebook.append_page (_contents, tab_title, false);
Gtk::Widget* tab_label = notebook.get_tab_label (_contents);
if (tab_label) {
Gtkmm2ext::UI::instance()->set_tip (*tab_label,
string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n"
"To put the window back, click on its \"close\" button"), tab_title));
}
notebook.set_tab_detachable (_contents);
notebook.set_tab_reorderable (_contents);
_parent_notebook = &notebook;
_tab_title = tab_title;
_notebook_position = position;
}
Window*
@ -181,7 +189,7 @@ Tabbable::delete_event_handler (GdkEventAny *ev)
if (_parent_notebook) {
_parent_notebook->insert_page (_contents, _tab_title, _notebook_position);
_parent_notebook->append_page (_contents, _tab_title);
_parent_notebook->set_tab_detachable (_contents);
_parent_notebook->set_tab_reorderable (_contents);
_parent_notebook->set_current_page (_parent_notebook->page_num (_contents));