#include <cmath>
#include <sigc++/bind.h>
+#include "canvas/canvas.h"
+
#include "pbd/error.h"
#include "pbd/basename.h"
#include "pbd/fastlog.h"
#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"
#include "rc_option_editor.h"
#include "time_info_box.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
using namespace std;
using namespace ARDOUR;
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::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"));
#define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale()))
+static
+bool drag_failed (const Glib::RefPtr<Gdk::DragContext>& context, DragResult result, Tabbable* tab)
+{
+ if (result == Gtk::DRAG_RESULT_NO_TARGET) {
+ tab->detach ();
+ return true;
+ }
+ return false;
+}
+
void
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 */
}
}
-