diff options
-rw-r--r-- | gtk2_ardour/ardour_ui.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui2.cc | 36 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_dependents.cc | 9 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_dialogs.cc | 4 | ||||
-rw-r--r-- | gtk2_ardour/ardour_ui_ed.cc | 12 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/tabbable.h | 3 | ||||
-rw-r--r-- | libs/gtkmm2ext/tabbable.cc | 30 |
7 files changed, 16 insertions, 80 deletions
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h index e9236adda4..d681394d84 100644 --- a/gtk2_ardour/ardour_ui.h +++ b/gtk2_ardour/ardour_ui.h @@ -372,8 +372,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr bool _initial_verbose_plugin_scan; bool first_time_engine_run; - bool tabs_button_event (GdkEventButton* ev); - void show_tabbable (Gtkmm2ext::Tabbable*); void hide_tabbable (Gtkmm2ext::Tabbable*); void detach_tabbable (Gtkmm2ext::Tabbable*); diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 2623cc8ca9..4d05bca0d8 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -68,42 +68,6 @@ using namespace Glib; using namespace ARDOUR_UI_UTILS; -bool -ARDOUR_UI::tabs_button_event (GdkEventButton* ev) -{ - std::vector<Widget*> children = _tabs.get_children(); - - for (std::vector<Widget*>::iterator w = children.begin(); w != children.end(); ++w) { - - Gtk::Widget* close_button = reinterpret_cast<Gtk::Widget*> ((*w)->get_data ("close-button")); - - if (close_button) { - - Gtk::Allocation alloc (close_button->get_allocation()); - int dx, dy; - - /* Allocation origin uses toplevel window coordinates; - * event origin uses _tabs-centric coordinate space, so - * translate before computing if event is inside the - * close button. - */ - - close_button->get_toplevel()->translate_coordinates (_tabs, alloc.get_x(), alloc.get_y(), dx, dy); - - if (ev->x >= dx && - ev->y >= dy && - ev->x < dx + alloc.get_width() && - ev->y < dy + alloc.get_height()) { - if (close_button->event ((GdkEvent*) ev)) { - return true; - } - } - } - } - - return false; -} - void ARDOUR_UI::setup_tooltips () { diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc index b194f3ca89..90e2fd8428 100644 --- a/gtk2_ardour/ardour_ui_dependents.cc +++ b/gtk2_ardour/ardour_ui_dependents.cc @@ -233,15 +233,6 @@ ARDOUR_UI::setup_windows () keyboard->setup_keybindings (); - /* we don't use a widget with its own window for the tab close button, - which makes it impossible to rely on GTK+ to generate signals for - events occuring "in" this widget. Instead, we pre-connect a - handler to the relevant events on the notebook and then check - to see if the event coordinates tell us that it occured "in" - the close button. - */ - _tabs.signal_button_press_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::tabs_button_event), false); - _tabs.signal_button_release_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::tabs_button_event), false); _tabs.signal_switch_page().connect (sigc::mem_fun (*this, &ARDOUR_UI::tabs_switch)); rc_option_editor = new RCOptionEditor; diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc index 6fdd3d7ef7..d40195b303 100644 --- a/gtk2_ardour/ardour_ui_dialogs.cc +++ b/gtk2_ardour/ardour_ui_dialogs.cc @@ -367,7 +367,7 @@ ARDOUR_UI::detach_tabbable (Tabbable* t) void ARDOUR_UI::tabs_switch (GtkNotebookPage*, guint page) { - if (page == _tabs.page_num (editor->contents())) { + if (page == (guint) _tabs.page_num (editor->contents())) { editor_visibility_button.set_active_state (Gtkmm2ext::ImplicitActive); if (mixer && (mixer->tabbed() || mixer->tabbed_by_default())) { mixer_visibility_button.set_active_state (Gtkmm2ext::Off); @@ -375,7 +375,7 @@ ARDOUR_UI::tabs_switch (GtkNotebookPage*, guint page) if (rc_option_editor && (rc_option_editor->tabbed() || rc_option_editor->tabbed_by_default())) { prefs_visibility_button.set_active_state (Gtkmm2ext::Off); } - } else if (page == _tabs.page_num (mixer->contents())) { + } else if (page == (guint) _tabs.page_num (mixer->contents())) { if (editor && (editor->tabbed() || editor->tabbed_by_default())) { editor_visibility_button.set_active_state (Gtkmm2ext::Off); } diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 15b129ef89..a8900fd028 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -587,6 +587,18 @@ ARDOUR_UI::build_menu_bar () prefs_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("show-preferences"))); prefs_visibility_button.set_name (X_("page switch button")); + Gtkmm2ext::UI::instance()->set_tip (editor_visibility_button, + string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n" + "To put the window back, use the Window > %1 > Attach menu action"), editor->name())); + + Gtkmm2ext::UI::instance()->set_tip (mixer_visibility_button, + string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n" + "To put the window back, use the Window > %1 > Attach menu action"), mixer->name())); + + Gtkmm2ext::UI::instance()->set_tip (prefs_visibility_button, + string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n" + "To put the window back, use the Window > %1 > Attach menu action"), rc_option_editor->name())); + window_button_box->pack_start (editor_visibility_button, false, false); window_button_box->pack_start (mixer_visibility_button, false, false); window_button_box->pack_start (prefs_visibility_button, false, false); diff --git a/libs/gtkmm2ext/gtkmm2ext/tabbable.h b/libs/gtkmm2ext/gtkmm2ext/tabbable.h index a622cf1ef1..9df2800d97 100644 --- a/libs/gtkmm2ext/gtkmm2ext/tabbable.h +++ b/libs/gtkmm2ext/gtkmm2ext/tabbable.h @@ -85,9 +85,6 @@ class LIBGTKMM2EXT_API Tabbable : public WindowProxy { Gtk::Notebook _own_notebook; Gtk::Notebook* _parent_notebook; std::string _tab_title; - Gtk::HBox _tab_box; - Gtk::Label _tab_label; - CairoIcon tab_close_image; bool tab_requested_by_state; void show_tab (); diff --git a/libs/gtkmm2ext/tabbable.cc b/libs/gtkmm2ext/tabbable.cc index 4344f39749..928e501751 100644 --- a/libs/gtkmm2ext/tabbable.cc +++ b/libs/gtkmm2ext/tabbable.cc @@ -39,18 +39,8 @@ Tabbable::Tabbable (Widget& w, const string& name) : WindowProxy (name) , _contents (w) , _parent_notebook (0) - , tab_close_image (ArdourIcon::CloseCross, 0xffffffff) , tab_requested_by_state (true) { - /* sizes will be scaled during rendering */ - tab_close_image.set_size_request (15,15); - - _tab_box.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK); - _tab_box.set_spacing (2); - _tab_box.pack_start (_tab_label, true, true); - _tab_box.pack_start (tab_close_image, false, false); - - tab_close_image.signal_button_release_event().connect (sigc::mem_fun (*this, &Tabbable::tab_close_clicked)); } Tabbable::~Tabbable () @@ -61,20 +51,10 @@ Tabbable::~Tabbable () } } -bool -Tabbable::tab_close_clicked (GdkEventButton*) -{ - hide_tab (); - return true; -} - void Tabbable::add_to_notebook (Notebook& notebook, const string& tab_title) { _parent_notebook = ¬ebook; - _tab_title = tab_title; - _tab_label.set_text (tab_title); - _tab_box.show_all (); if (tab_requested_by_state) { attach (); @@ -91,7 +71,7 @@ Tabbable::use_own_window (bool and_pack_it) if (parent) { parent->remove (_contents); } - _own_notebook.append_page (_contents, _tab_box); + _own_notebook.append_page (_contents); } return win; @@ -248,17 +228,11 @@ Tabbable::attach () _window->hide (); } - _parent_notebook->append_page (_contents, _tab_box); - _contents.set_data ("close-button", &tab_close_image); + _parent_notebook->append_page (_contents); _parent_notebook->set_tab_detachable (_contents); _parent_notebook->set_tab_reorderable (_contents); _parent_notebook->set_current_page (_parent_notebook->page_num (_contents)); - 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, use the Window > %1 > Attach menu action"), _tab_title)); - - /* have to force this on, which is semantically correct, since * the user has effectively asked for it. */ |