X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fardour_ui2.cc;h=00a1bde046977aabdfdcf71c6c9c2bb67dd2827c;hb=1a7fd81f4095e3ee8cb42e63c232a51529412846;hp=3466a989868768226b025fa5d33b104e09cf4ec1;hpb=bc487bb4b02a9780938d6cf8528c888e59161aa9;p=ardour.git diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 3466a98986..00a1bde046 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -29,6 +29,8 @@ #include #include +#include "canvas/canvas.h" + #include "pbd/error.h" #include "pbd/basename.h" #include "pbd/fastlog.h" @@ -48,6 +50,7 @@ #include "audio_clock.h" #include "actions.h" #include "main_clock.h" +#include "mixer_ui.h" #include "utils.h" #include "theme_manager.h" #include "midi_tracer.h" @@ -57,7 +60,7 @@ #include "rc_option_editor.h" #include "time_info_box.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace std; using namespace ARDOUR; @@ -68,70 +71,11 @@ using namespace Glib; using namespace ARDOUR_UI_UTILS; -bool -ARDOUR_UI::tabs_button_event (GdkEventButton* ev) -{ - std::vector children = _tabs.get_children(); - - for (std::vector::iterator w = children.begin(); w != children.end(); ++w) { - - Gtk::Widget* close_button = reinterpret_cast ((*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::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 () { + ArdourCanvas::Canvas::set_tooltip_timeout (Gtk::Settings::get_default()->property_gtk_tooltip_timeout ()); + set_tip (roll_button, _("Play from playhead")); set_tip (stop_button, _("Stop playback")); set_tip (rec_button, _("Toggle record")); @@ -225,6 +169,16 @@ ARDOUR_UI::tearoff_settings (const char* name) const #define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale())) +static +bool drag_failed (const Glib::RefPtr& context, DragResult result, Tabbable* tab) +{ + if (result == Gtk::DRAG_RESULT_NO_TARGET) { + tab->detach (); + return true; + } + return false; +} + void ARDOUR_UI::setup_transport () { @@ -445,10 +399,43 @@ ARDOUR_UI::setup_transport () transport_hbox.pack_start (editor_meter_peak_display, false, false); } - if (Profile->get_sae()) { - Image* img = manage (new Image ((::get_icon (X_("sae"))))); - transport_hbox.pack_end (*img, false, false); - } + Gtk::VBox* window_button_box = manage (new Gtk::VBox); + + editor_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), editor)); + mixer_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), mixer)); + prefs_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), rc_option_editor)); + + /* catch context clicks so that we can show a menu on these buttons */ + + editor_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("editor")), false); + mixer_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("mixer")), false); + prefs_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("preferences")), false); + + editor_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-editor-visibility"))); + editor_visibility_button.set_name (X_("page switch button")); + mixer_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-mixer-visibility"))); + mixer_visibility_button.set_name (X_("page switch button")); + prefs_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-preferences-visibility"))); + 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, true, false); + window_button_box->pack_start (mixer_visibility_button, true, false); + window_button_box->pack_start (prefs_visibility_button, true, false); + + transport_hbox.pack_end (*window_button_box, false, false); + transport_hbox.pack_end (action_script_table, false, false); /* desensitize */ @@ -704,4 +691,3 @@ ARDOUR_UI::update_title () } } -