remove tab-related code for tabbed notebook, add tooltips to new buttons
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 19 Nov 2015 04:03:16 +0000 (23:03 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 22 Feb 2016 20:31:25 +0000 (15:31 -0500)
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui2.cc
gtk2_ardour/ardour_ui_dependents.cc
gtk2_ardour/ardour_ui_dialogs.cc
gtk2_ardour/ardour_ui_ed.cc
libs/gtkmm2ext/gtkmm2ext/tabbable.h
libs/gtkmm2ext/tabbable.cc

index e9236adda4181ea38de5c3c60b8e8f95ef75dbb2..d681394d842128e67f8e770daba0cfe09e6e0f6f 100644 (file)
@@ -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*);
index 2623cc8ca952fd1d2bf25c23f6bd471b22689dfc..4d05bca0d8d28a6c7ebdc9a74abb51d341f54a33 100644 (file)
@@ -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 ()
 {
index b194f3ca8943b80951b6932f5ba17456614d2265..90e2fd84280c942cf6da7a22f95c2ede60aafd6b 100644 (file)
@@ -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;
index 6fdd3d7ef7cfeb55f9084a651df4b2258fd074f7..d40195b303dc7fc831b85e528255152a5ea0ee94 100644 (file)
@@ -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);
                }
index 15b129ef89fd3d739731e0f0f55ec6ec1ceb8d35..a8900fd0285fd2507fac4a818fe2c4e5c20bcd22 100644 (file)
@@ -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);
index a622cf1ef177409da35c1e52400d1d196de21311..9df2800d97bf048fd9725f551e6fbd2874de9a27 100644 (file)
@@ -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 ();
index 4344f397491eb4cb289aa5e2668228c22e9c2e6a..928e501751c7be3e2b59a08743b88ded013cef48 100644 (file)
@@ -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 = &notebook;
-       _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.
         */