2 Copyright (C) 1999 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include "gtk2ardour-config.h"
31 #include <sigc++/bind.h>
32 #include "canvas/canvas.h"
34 #include "pbd/error.h"
35 #include "pbd/basename.h"
36 #include "pbd/fastlog.h"
38 #include "gtkmm2ext/cairocell.h"
39 #include "gtkmm2ext/utils.h"
40 #include "gtkmm2ext/click_box.h"
41 #include "gtkmm2ext/window_title.h"
43 #include "ardour/profile.h"
44 #include "ardour/session.h"
45 #include "ardour/types.h"
47 #include "ardour_ui.h"
49 #include "public_editor.h"
50 #include "audio_clock.h"
52 #include "main_clock.h"
55 #include "time_info_box.h"
56 #include "midi_tracer.h"
57 #include "global_port_matrix.h"
58 #include "location_ui.h"
59 #include "rc_option_editor.h"
64 using namespace ARDOUR;
66 using namespace Gtkmm2ext;
69 using namespace ARDOUR_UI_UTILS;
72 ARDOUR_UI::setup_tooltips ()
74 ArdourCanvas::Canvas::set_tooltip_timeout (Gtk::Settings::get_default()->property_gtk_tooltip_timeout ());
76 set_tip (roll_button, _("Play from playhead"));
77 set_tip (stop_button, _("Stop playback"));
78 set_tip (rec_button, _("Toggle record"));
79 set_tip (play_selection_button, _("Play range/selection"));
80 set_tip (goto_start_button, _("Go to start of session"));
81 set_tip (goto_end_button, _("Go to end of session"));
82 set_tip (auto_loop_button, _("Play loop range"));
83 set_tip (midi_panic_button, _("MIDI Panic\nSend note off and reset controller messages on all MIDI channels"));
84 set_tip (auto_return_button, _("Return to last playback start when stopped"));
85 set_tip (follow_edits_button, _("Playhead follows Range tool clicks, and Range selections"));
86 set_tip (auto_input_button, _("Track Input Monitoring automatically follows transport state"));
87 parameter_changed("click-gain");
88 set_tip (solo_alert_button, _("When active, something is soloed.\nClick to de-solo everything"));
89 set_tip (auditioning_alert_button, _("When active, auditioning is taking place.\nClick to stop the audition"));
90 set_tip (feedback_alert_button, _("When active, there is a feedback loop."));
91 set_tip (primary_clock, _("<b>Primary Clock</b> right-click to set display mode. Click to edit, click+drag a digit or mouse-over+scroll wheel to modify.\nText edits: right-to-left overwrite <tt>Esc</tt>: cancel; <tt>Enter</tt>: confirm; postfix the edit with '+' or '-' to enter delta times.\n"));
92 set_tip (secondary_clock, _("<b>Secondary Clock</b> right-click to set display mode. Click to edit, click+drag a digit or mouse-over+scroll wheel to modify.\nText edits: right-to-left overwrite <tt>Esc</tt>: cancel; <tt>Enter</tt>: confirm; postfix the edit with '+' or '-' to enter delta times.\n"));
93 set_tip (editor_meter_peak_display, _("Reset All Peak Indicators"));
94 set_tip (error_alert_button, _("Show Error Log and acknowledge warnings"));
96 synchronize_sync_source_and_video_pullup ();
98 editor->setup_tooltips ();
102 ARDOUR_UI::status_bar_button_press (GdkEventButton* ev)
104 bool handled = false;
106 switch (ev->button) {
108 status_bar_label.set_text ("");
119 ARDOUR_UI::display_message (const char *prefix, gint prefix_len, RefPtr<TextBuffer::Tag> ptag, RefPtr<TextBuffer::Tag> mtag, const char *msg)
123 UI::display_message (prefix, prefix_len, ptag, mtag, msg);
125 ArdourLogLevel ll = LogLevelNone;
127 if (strcmp (prefix, _("[ERROR]: ")) == 0) {
128 text = "<span color=\"red\" weight=\"bold\">";
130 } else if (strcmp (prefix, _("[WARNING]: ")) == 0) {
131 text = "<span color=\"yellow\" weight=\"bold\">";
132 ll = LogLevelWarning;
133 } else if (strcmp (prefix, _("[INFO]: ")) == 0) {
134 text = "<span color=\"green\" weight=\"bold\">";
137 text = "<span color=\"white\" weight=\"bold\">???";
140 _log_not_acknowledged = std::max(_log_not_acknowledged, ll);
147 status_bar_label.set_markup (text);
152 ARDOUR_UI::tearoff_settings (const char* name) const
154 XMLNode* ui_node = Config->extra_xml(X_("UI"));
157 XMLNode* tearoff_node = ui_node->child (X_("Tearoffs"));
159 XMLNode* mnode = tearoff_node->child (name);
167 #define PX_SCALE(px) std::max((float)px, rintf((float)px * UIConfiguration::instance().get_ui_scale()))
170 bool drag_failed (const Glib::RefPtr<Gdk::DragContext>& context, DragResult result, Tabbable* tab)
172 if (result == Gtk::DRAG_RESULT_NO_TARGET) {
180 ARDOUR_UI::repack_transport_hbox ()
183 if (time_info_box->get_parent()) {
184 transport_hbox.remove (*time_info_box);
186 if (UIConfiguration::instance().get_show_toolbar_selclock ()) {
187 transport_hbox.pack_start (*time_info_box, false, false);
188 time_info_box->show();
192 if (mini_timeline.get_parent()) {
193 transport_hbox.remove (mini_timeline);
195 if (UIConfiguration::instance().get_show_mini_timeline ()) {
196 transport_hbox.pack_start (mini_timeline, true, true);
197 mini_timeline.show();
201 if (meter_box.get_parent()) {
202 transport_hbox.remove (meter_box);
203 transport_hbox.remove (editor_meter_peak_display);
206 if (UIConfiguration::instance().get_show_editor_meter()) {
207 transport_hbox.pack_end (editor_meter_peak_display, false, false);
208 transport_hbox.pack_end (meter_box, false, false);
210 editor_meter_peak_display.show();
214 bool show_mon = UIConfiguration::instance().get_show_toolbar_monitoring ();
216 monitor_in_button.show ();
217 monitor_disk_button.show ();
218 auto_input_button.show ();
219 monitoring_spacer.show ();
221 monitor_in_button.hide ();
222 monitor_disk_button.hide ();
223 auto_input_button.hide ();
224 monitoring_spacer.hide ();
227 bool show_rec = UIConfiguration::instance().get_show_toolbar_recpunch ();
230 layered_label.show ();
231 punch_in_button.show ();
232 punch_out_button.show ();
233 layered_button.show ();
234 recpunch_spacer.show ();
237 layered_label.hide ();
238 punch_in_button.hide ();
239 punch_out_button.hide ();
240 layered_button.hide ();
241 recpunch_spacer.hide ();
247 ARDOUR_UI::update_clock_visibility ()
249 if (ARDOUR::Profile->get_small_screen()) {
252 if (UIConfiguration::instance().get_show_secondary_clock ()) {
253 secondary_clock->show();
254 secondary_clock->left_btn()->show();
255 secondary_clock->right_btn()->show();
256 if (secondary_clock_spacer) {
257 secondary_clock_spacer->show();
260 secondary_clock->hide();
261 secondary_clock->left_btn()->hide();
262 secondary_clock->right_btn()->hide();
263 if (secondary_clock_spacer) {
264 secondary_clock_spacer->hide();
270 ARDOUR_UI::transport_expose (GdkEventExpose* ev)
274 Gtk::Widget* window_parent;
275 Glib::RefPtr<Gdk::Window> win = Gtkmm2ext::window_to_draw_on (transport_table, &window_parent);
276 Glib::RefPtr<Gtk::Style> style = transport_table.get_style();
277 if (!win || !style) {
281 Cairo::RefPtr<Cairo::Context> cr = transport_table.get_window()->create_cairo_context ();
283 cr->rectangle (ev->area.x, ev->area.y, ev->area.width, ev->area.height);
286 transport_table.translate_coordinates (*window_parent, 0, 0, x0, y0);
288 cr->rectangle (x0, y0, transport_table.get_width(), transport_table.get_height());
289 Gdk::Color bg (style->get_bg (transport_table.get_state()));
290 cr->set_source_rgb (bg.get_red_p(), bg.get_green_p(), bg.get_blue_p());
293 static const int xmargin = 2;
294 static const int ymargin = 1;
296 /* draw box around record-options */
299 punch_label.translate_coordinates (transport_table, -xmargin, 0, xx, uu); // left
300 punch_out_button.translate_coordinates (transport_table, xmargin, 0, ww, uu); // right
301 ww += punch_out_button.get_width () - xx; // width
302 hh = transport_table.get_height() - 1;
304 Gtkmm2ext::rounded_rectangle (cr->cobj(), x0 + xx - 0.5, y0 + 0.5, ww + 1, hh, 6);
305 cr->set_source_rgb (0, 0, 0);
306 cr->set_line_width (1.0);
309 /* line to rec-enable */
311 rec_button.translate_coordinates (transport_table, -xmargin, 0, rx, uu); // top
312 int dx = rx + rec_button.get_width() - xx;
314 cr->move_to (x0 + xx, 1.5 + y0 + ymargin + round (punch_in_button.get_height () * .5));
315 cr->rel_line_to (dx, 0);
316 cr->set_line_width (2.0);
323 ARDOUR_UI::setup_transport ()
328 act = ActionManager::get_action ("Transport", "ToggleClick");
329 click_button.set_related_action (act);
330 click_button.signal_button_press_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::click_button_clicked), false);
331 click_button.signal_scroll_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::click_button_scroll), false);
333 act = ActionManager::get_action (X_("Transport"), X_("Stop"));
334 stop_button.set_related_action (act);
335 act = ActionManager::get_action (X_("Transport"), X_("Roll"));
336 roll_button.set_related_action (act);
337 act = ActionManager::get_action (X_("Transport"), X_("Record"));
338 rec_button.set_related_action (act);
339 act = ActionManager::get_action (X_("Transport"), X_("GotoStart"));
340 goto_start_button.set_related_action (act);
341 act = ActionManager::get_action (X_("Transport"), X_("GotoEnd"));
342 goto_end_button.set_related_action (act);
343 act = ActionManager::get_action (X_("Transport"), X_("Loop"));
344 auto_loop_button.set_related_action (act);
345 act = ActionManager::get_action (X_("Transport"), X_("PlaySelection"));
346 play_selection_button.set_related_action (act);
347 act = ActionManager::get_action (X_("MIDI"), X_("panic"));
348 midi_panic_button.set_related_action (act);
349 act = ActionManager::get_action (X_("Transport"), X_("ToggleExternalSync"));
351 sync_button.set_related_action (act);
352 sync_button.signal_button_press_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::sync_button_clicked), false);
354 sync_button.set_sizing_text (S_("LogestSync|M-Clk"));
356 /* CANNOT sigc::bind these to clicked or toggled, must use pressed or released */
357 act = ActionManager::get_action (X_("Main"), X_("cancel-solo"));
358 solo_alert_button.set_related_action (act);
359 auditioning_alert_button.signal_clicked.connect (sigc::mem_fun(*this,&ARDOUR_UI::audition_alert_clicked));
360 error_alert_button.signal_button_release_event().connect (sigc::mem_fun(*this,&ARDOUR_UI::error_alert_press), false);
361 act = ActionManager::get_action (X_("Editor"), X_("toggle-log-window"));
362 error_alert_button.set_related_action(act);
363 error_alert_button.set_fallthrough_to_parent(true);
365 layered_button.signal_clicked.connect (sigc::mem_fun(*this,&ARDOUR_UI::layered_button_clicked));
367 editor_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-editor-visibility")));
368 mixer_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-mixer-visibility")));
369 prefs_visibility_button.set_related_action (ActionManager::get_action (X_("Common"), X_("change-preferences-visibility")));
371 act = ActionManager::get_action ("Transport", "ToggleAutoReturn");
372 auto_return_button.set_related_action (act);
373 act = ActionManager::get_action (X_("Transport"), X_("ToggleFollowEdits"));
374 follow_edits_button.set_related_action (act);
375 act = ActionManager::get_action ("Transport", "ToggleAutoInput");
376 auto_input_button.set_related_action (act);
378 act = ActionManager::get_action ("Transport", "TogglePunchIn");
379 punch_in_button.set_related_action (act);
380 act = ActionManager::get_action ("Transport", "TogglePunchOut");
381 punch_out_button.set_related_action (act);
383 act = ActionManager::get_action ("Transport", "SessionMonitorIn");
384 monitor_in_button.set_related_action (act);
385 act = ActionManager::get_action ("Transport", "SessionMonitorDisk");
386 monitor_disk_button.set_related_action (act);
388 /* connect signals */
389 ARDOUR_UI::Clock.connect (sigc::mem_fun (primary_clock, &AudioClock::set));
390 ARDOUR_UI::Clock.connect (sigc::mem_fun (secondary_clock, &AudioClock::set));
392 primary_clock->ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::primary_clock_value_changed));
393 secondary_clock->ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::secondary_clock_value_changed));
394 big_clock->ValueChanged.connect (sigc::mem_fun(*this, &ARDOUR_UI::big_clock_value_changed));
396 editor_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), editor));
397 mixer_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), mixer));
398 prefs_visibility_button.signal_drag_failed().connect (sigc::bind (sigc::ptr_fun (drag_failed), rc_option_editor));
400 /* catch context clicks so that we can show a menu on these buttons */
402 editor_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("editor")), false);
403 mixer_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("mixer")), false);
404 prefs_visibility_button.signal_button_press_event().connect (sigc::bind (sigc::mem_fun (*this, &ARDOUR_UI::tabbable_visibility_button_press), X_("preferences")), false);
406 /* setup widget style/name */
408 auto_return_button.set_name ("transport option button");
409 follow_edits_button.set_name ("transport option button");
411 solo_alert_button.set_name ("rude solo");
412 auditioning_alert_button.set_name ("rude audition");
413 feedback_alert_button.set_name ("feedback alert");
414 error_alert_button.set_name ("error alert");
416 solo_alert_button.set_elements (ArdourButton::Element(ArdourButton::Body|ArdourButton::Text));
417 auditioning_alert_button.set_elements (ArdourButton::Element(ArdourButton::Body|ArdourButton::Text));
418 feedback_alert_button.set_elements (ArdourButton::Element(ArdourButton::Body|ArdourButton::Text));
420 solo_alert_button.set_layout_font (UIConfiguration::instance().get_SmallerFont());
421 auditioning_alert_button.set_layout_font (UIConfiguration::instance().get_SmallerFont());
422 feedback_alert_button.set_layout_font (UIConfiguration::instance().get_SmallerFont());
424 editor_visibility_button.set_name (X_("page switch button"));
425 mixer_visibility_button.set_name (X_("page switch button"));
426 prefs_visibility_button.set_name (X_("page switch button"));
428 punch_in_button.set_name ("punch button");
429 punch_out_button.set_name ("punch button");
430 layered_button.set_name (("layered button"));
432 monitor_in_button.set_name ("monitor button");
433 monitor_disk_button.set_name ("monitor button");
434 auto_input_button.set_name ("transport option button");
436 click_button.set_name ("transport button");
437 sync_button.set_name ("transport active option button");
439 /* and widget text */
440 auto_return_button.set_text(_("Auto Return"));
441 follow_edits_button.set_text(_("Follow Range"));
442 punch_in_button.set_text (_("In"));
443 punch_out_button.set_text (_("Out"));
444 layered_button.set_text (_("Non-Layered"));
446 monitor_in_button.set_text (_("All In"));
447 monitor_disk_button.set_text (_("All Disk"));
448 auto_input_button.set_text (_("Auto-Input"));
450 punch_label.set_text (_("Punch:"));
451 layered_label.set_text (_("Rec:"));
455 Gtkmm2ext::UI::instance()->set_tip (editor_visibility_button,
456 string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n"
457 "To re-attach the window, use the Window > %1 > Attach menu action"), editor->name()));
459 Gtkmm2ext::UI::instance()->set_tip (mixer_visibility_button,
460 string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n"
461 "To re-attach the window, use the Window > %1 > Attach menu action"), mixer->name()));
463 Gtkmm2ext::UI::instance()->set_tip (prefs_visibility_button,
464 string_compose (_("Drag this tab to the desktop to show %1 in its own window\n\n"
465 "To re-attach the window, use the Window > %1 > Attach menu action"), rc_option_editor->name()));
467 Gtkmm2ext::UI::instance()->set_tip (punch_in_button, _("Start recording at auto-punch start"));
468 Gtkmm2ext::UI::instance()->set_tip (punch_out_button, _("Stop recording at auto-punch end"));
470 Gtkmm2ext::UI::instance()->set_tip (monitor_in_button, _("Force all tracks to monitor Input, unless they are explicitly set to monitor Disk"));
471 Gtkmm2ext::UI::instance()->set_tip (monitor_disk_button, _("Force all tracks to monitor Disk playback, unless they are explicitly set to Input"));
475 click_button.set_icon (ArdourIcon::TransportMetronom);
476 goto_start_button.set_icon (ArdourIcon::TransportStart);
477 goto_end_button.set_icon (ArdourIcon::TransportEnd);
478 roll_button.set_icon (ArdourIcon::TransportPlay);
479 stop_button.set_icon (ArdourIcon::TransportStop);
480 play_selection_button.set_icon (ArdourIcon::TransportRange);
481 auto_loop_button.set_icon (ArdourIcon::TransportLoop);
482 rec_button.set_icon (ArdourIcon::RecButton);
483 midi_panic_button.set_icon (ArdourIcon::TransportPanic);
485 /* transport control size-group */
487 Glib::RefPtr<SizeGroup> transport_button_size_group = SizeGroup::create (SIZE_GROUP_BOTH);
488 transport_button_size_group->add_widget (goto_start_button);
489 transport_button_size_group->add_widget (goto_end_button);
490 transport_button_size_group->add_widget (auto_loop_button);
491 transport_button_size_group->add_widget (rec_button);
492 transport_button_size_group->add_widget (play_selection_button);
493 transport_button_size_group->add_widget (roll_button);
494 transport_button_size_group->add_widget (stop_button);
496 Glib::RefPtr<SizeGroup> punch_button_size_group = SizeGroup::create (Gtk::SIZE_GROUP_HORIZONTAL);
497 punch_button_size_group->add_widget (punch_in_button);
498 punch_button_size_group->add_widget (punch_out_button);
500 Glib::RefPtr<SizeGroup> monitor_button_size_group = SizeGroup::create (Gtk::SIZE_GROUP_HORIZONTAL);
501 monitor_button_size_group->add_widget (monitor_in_button);
502 monitor_button_size_group->add_widget (monitor_disk_button);
504 /* and now the layout... */
506 /* top level packing */
507 transport_table.set_spacings (0);
508 transport_table.set_row_spacings (4);
509 transport_table.set_border_width (2);
511 transport_frame.set_name ("TransportFrame");
512 transport_frame.set_shadow_type (Gtk::SHADOW_NONE);
514 /* An event box to hold the table. We use this because we want specific
515 control over the background color, and without this event box,
516 nothing inside the transport_frame actually draws a background. We
517 would therefore end up seeing the background of the parent widget,
518 which is probably some default color. Adding the EventBox adds a
519 widget that will draw the background, using a style based on
520 the parent, "TransportFrame".
522 Gtk::EventBox* ebox = manage (new Gtk::EventBox);
523 transport_frame.add (*ebox);
524 ebox->add (transport_table);
526 transport_table.signal_expose_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::transport_expose), false);
528 /* transport controls sub-group */
529 click_button.set_size_request (PX_SCALE(20), PX_SCALE(20));
531 HBox* tbox = manage (new HBox);
532 tbox->set_spacing (PX_SCALE(2));
534 tbox->pack_start (midi_panic_button, true, true, 0);
535 tbox->pack_start (click_button, true, true, 0);
536 tbox->pack_start (goto_start_button, true, true);
537 tbox->pack_start (goto_end_button, true, true);
538 tbox->pack_start (auto_loop_button, true, true);
539 tbox->pack_start (play_selection_button, true, true);
541 tbox->pack_start (roll_button, true, true);
542 tbox->pack_start (stop_button, true, true);
543 tbox->pack_start (rec_button, true, true, 3);
545 /* alert box sub-group */
546 VBox* alert_box = manage (new VBox);
547 alert_box->set_homogeneous (true);
548 alert_box->set_spacing (1);
549 alert_box->set_border_width (0);
550 alert_box->pack_start (solo_alert_button, true, false, 0);
551 alert_box->pack_start (auditioning_alert_button, true, false, 0);
552 alert_box->pack_start (feedback_alert_button, true, false, 0);
554 /* clock button size groups */
555 Glib::RefPtr<SizeGroup> button_height_size_group = SizeGroup::create (Gtk::SIZE_GROUP_VERTICAL);
556 button_height_size_group->add_widget (follow_edits_button);
557 button_height_size_group->add_widget (*primary_clock->left_btn());
558 button_height_size_group->add_widget (*primary_clock->right_btn());
559 button_height_size_group->add_widget (*secondary_clock->left_btn());
560 button_height_size_group->add_widget (*secondary_clock->right_btn());
562 button_height_size_group->add_widget (stop_button);
563 // button_height_size_group->add_widget (sync_button);
564 button_height_size_group->add_widget (auto_return_button);
567 button_height_size_group->add_widget (editor_visibility_button);
568 button_height_size_group->add_widget (mixer_visibility_button);
571 button_height_size_group->add_widget (punch_in_button);
572 button_height_size_group->add_widget (punch_out_button);
573 button_height_size_group->add_widget (layered_button);
575 //input monitoring section
576 button_height_size_group->add_widget (monitor_in_button);
577 button_height_size_group->add_widget (monitor_disk_button);
578 button_height_size_group->add_widget (auto_input_button);
580 Glib::RefPtr<SizeGroup> clock1_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL);
581 clock1_size_group->add_widget (*primary_clock->left_btn());
582 clock1_size_group->add_widget (*primary_clock->right_btn());
584 Glib::RefPtr<SizeGroup> clock2_size_group = SizeGroup::create (SIZE_GROUP_HORIZONTAL);
585 clock2_size_group->add_widget (*secondary_clock->left_btn());
586 clock2_size_group->add_widget (*secondary_clock->right_btn());
588 /* sub-layout for Sync | Shuttle (grow) */
589 HBox* ssbox = manage (new HBox);
590 ssbox->set_spacing (PX_SCALE(2));
591 ssbox->pack_start (sync_button, false, false, 0);
592 ssbox->pack_start (shuttle_box, true, true, 0);
593 ssbox->pack_start (*shuttle_box.info_button(), false, false, 0);
596 /* and the main table layout */
599 #define TCOL col, col + 1
601 transport_table.attach (*tbox, TCOL, 0, 1 , SHRINK, SHRINK, 0, 0);
602 transport_table.attach (*ssbox, TCOL, 1, 2 , FILL, SHRINK, 0, 0);
605 transport_table.attach (*(manage (new ArdourVSpacer ())), TCOL, 0, 2 , SHRINK, EXPAND|FILL, 3, 0);
608 transport_table.attach (punch_label, TCOL, 0, 1 , FILL, SHRINK, 3, 0);
609 transport_table.attach (layered_label, TCOL, 1, 2 , FILL, SHRINK, 3, 0);
612 transport_table.attach (punch_in_button, col, col + 1, 0, 1 , FILL, SHRINK, 2, 2);
613 transport_table.attach (punch_space, col + 1, col + 2, 0, 1 , FILL, SHRINK, 0, 2);
614 transport_table.attach (punch_out_button, col + 2, col + 3, 0, 1 , FILL, SHRINK, 2, 2);
615 transport_table.attach (layered_button, col, col + 3, 1, 2 , FILL, SHRINK, 2, 2);
618 transport_table.attach (recpunch_spacer, TCOL, 0, 2 , SHRINK, EXPAND|FILL, 3, 0);
621 transport_table.attach (auto_input_button, col, col + 3, 0, 1 , FILL, SHRINK, 2, 2);
622 transport_table.attach (monitor_in_button, col, col + 1, 1, 2 , FILL, SHRINK, 2, 2);
623 transport_table.attach (mon_space, col + 1, col + 2, 1, 2 , FILL, SHRINK, 2, 2);
624 transport_table.attach (monitor_disk_button, col + 2, col + 3, 1, 2 , FILL, SHRINK, 2, 2);
627 transport_table.attach (monitoring_spacer, TCOL, 0, 2 , SHRINK, EXPAND|FILL, 3, 0);
630 transport_table.attach (follow_edits_button, TCOL, 0, 1 , FILL, SHRINK, 2, 0);
631 transport_table.attach (auto_return_button, TCOL, 1, 2 , FILL, SHRINK, 2, 0);
634 transport_table.attach (*(manage (new ArdourVSpacer ())), TCOL, 0, 2 , SHRINK, EXPAND|FILL, 3, 0);
637 transport_table.attach (*primary_clock, col, col + 2, 0, 1 , FILL, SHRINK, 2, 0);
638 transport_table.attach (*primary_clock->left_btn(), col, col + 1, 1, 2 , FILL, SHRINK, 2, 0);
639 transport_table.attach (*primary_clock->right_btn(), col + 1, col + 2, 1, 2 , FILL, SHRINK, 2, 0);
642 transport_table.attach (*(manage (new ArdourVSpacer ())), TCOL, 0, 2 , SHRINK, EXPAND|FILL, 3, 0);
645 if (!ARDOUR::Profile->get_small_screen()) {
646 transport_table.attach (*secondary_clock, col, col + 2, 0, 1 , FILL, SHRINK, 2, 0);
647 transport_table.attach (*secondary_clock->left_btn(), col, col + 1, 1, 2 , FILL, SHRINK, 2, 0);
648 transport_table.attach (*secondary_clock->right_btn(), col + 1, col + 2, 1, 2 , FILL, SHRINK, 2, 0);
649 secondary_clock->set_no_show_all (true);
650 secondary_clock->left_btn()->set_no_show_all (true);
651 secondary_clock->right_btn()->set_no_show_all (true);
654 secondary_clock_spacer = manage (new ArdourVSpacer ());
655 transport_table.attach (*secondary_clock_spacer, TCOL, 0, 2 , SHRINK, EXPAND|FILL, 3, 0);
659 transport_table.attach (*alert_box, TCOL, 0, 2, SHRINK, EXPAND|FILL, 2, 0);
662 transport_table.attach (*(manage (new ArdourVSpacer ())), TCOL, 0, 2 , SHRINK, EXPAND|FILL, 3, 0);
665 /* editor-meter, mini-timeline and selection clock are options in the transport_hbox */
666 transport_hbox.set_spacing (3);
667 transport_table.attach (transport_hbox, TCOL, 0, 2, EXPAND|FILL, EXPAND|FILL, 2, 0);
670 /* lua script action buttons */
671 transport_table.attach (action_script_table, TCOL, 0, 2, SHRINK, EXPAND|FILL, 1, 0);
674 transport_table.attach (editor_visibility_button, TCOL, 0, 1 , FILL, SHRINK, 2, 0);
675 transport_table.attach (mixer_visibility_button, TCOL, 1, 2 , FILL, SHRINK, 2, 0);
678 repack_transport_hbox ();
679 update_clock_visibility ();
682 feedback_alert_button.set_sensitive (false);
683 feedback_alert_button.set_visual_state (Gtkmm2ext::NoVisualState);
684 auditioning_alert_button.set_sensitive (false);
685 auditioning_alert_button.set_visual_state (Gtkmm2ext::NoVisualState);
687 stop_button.set_active (true);
688 set_transport_sensitivity (false);
694 ARDOUR_UI::soloing_changed (bool onoff)
696 if (solo_alert_button.get_active() != onoff) {
697 solo_alert_button.set_active (onoff);
702 ARDOUR_UI::_auditioning_changed (bool onoff)
704 auditioning_alert_button.set_active (onoff);
705 auditioning_alert_button.set_sensitive (onoff);
707 auditioning_alert_button.set_visual_state (Gtkmm2ext::NoVisualState);
709 set_transport_sensitivity (!onoff);
713 ARDOUR_UI::auditioning_changed (bool onoff)
715 UI::instance()->call_slot (MISSING_INVALIDATOR, boost::bind (&ARDOUR_UI::_auditioning_changed, this, onoff));
719 ARDOUR_UI::audition_alert_clicked ()
722 _session->cancel_audition();
727 ARDOUR_UI::error_alert_press (GdkEventButton* ev)
729 bool do_toggle = true;
730 if (ev->button == 1) {
731 if (_log_not_acknowledged == LogLevelError) {
732 // just acknowledge the error, don't hide the log if it's already visible
733 RefPtr<Action> act = ActionManager::get_action (X_("Editor"), X_("toggle-log-window"));
734 Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::cast_dynamic (act);
735 if (tact && tact->get_active()) {
739 _log_not_acknowledged = LogLevelNone;
740 error_blink (false); // immediate acknowledge
742 // maybe fall through to to button toggle
747 ARDOUR_UI::layered_button_clicked ()
750 _session->config.set_layered_record_mode (!_session->config.get_layered_record_mode ());
755 ARDOUR_UI::solo_blink (bool onoff)
761 if (_session->soloing() || _session->listening()) {
763 solo_alert_button.set_active (true);
765 solo_alert_button.set_active (false);
768 solo_alert_button.set_active (false);
773 ARDOUR_UI::sync_blink (bool onoff)
775 if (_session == 0 || !_session->config.get_external_sync()) {
777 sync_button.set_active (false);
781 if (!_session->transport_locked()) {
782 /* not locked, so blink on and off according to the onoff argument */
785 sync_button.set_active (true);
787 sync_button.set_active (false);
791 sync_button.set_active (true);
796 ARDOUR_UI::audition_blink (bool onoff)
802 if (_session->is_auditioning()) {
804 auditioning_alert_button.set_active (true);
806 auditioning_alert_button.set_active (false);
809 auditioning_alert_button.set_active (false);
814 ARDOUR_UI::feedback_blink (bool onoff)
816 if (_feedback_exists) {
818 feedback_alert_button.set_active (true);
820 feedback_alert_button.set_active (false);
823 feedback_alert_button.set_active (false);
828 ARDOUR_UI::error_blink (bool onoff)
830 switch (_log_not_acknowledged) {
834 error_alert_button.set_custom_led_color(0xff0000ff); // bright red
836 error_alert_button.set_custom_led_color(0x880000ff); // dark red
839 case LogLevelWarning:
840 error_alert_button.set_custom_led_color(0xccaa00ff); // yellow
843 error_alert_button.set_custom_led_color(0x88cc00ff); // lime green
846 error_alert_button.set_custom_led_color(0x333333ff); // gray
854 ARDOUR_UI::set_transport_sensitivity (bool yn)
856 ActionManager::set_sensitive (ActionManager::transport_sensitive_actions, yn);
857 shuttle_box.set_sensitive (yn);
861 ARDOUR_UI::editor_realized ()
863 boost::function<void (string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1));
864 Config->map_parameters (pc);
866 UIConfiguration::instance().reset_dpi ();
870 ARDOUR_UI::maximise_editing_space ()
873 editor->maximise_editing_space ();
878 ARDOUR_UI::restore_editing_space ()
881 editor->restore_editing_space ();
886 ARDOUR_UI::show_ui_prefs ()
888 if (rc_option_editor) {
889 show_tabbable (rc_option_editor);
890 rc_option_editor->set_current_page (_("Appearance"));
895 ARDOUR_UI::click_button_clicked (GdkEventButton* ev)
897 if (ev->button != 3) {
898 /* this handler is just for button-3 clicks */
902 show_tabbable (rc_option_editor);
903 rc_option_editor->set_current_page (_("Metronome"));
908 ARDOUR_UI::click_button_scroll (GdkEventScroll* ev)
910 gain_t gain = Config->get_click_gain();
911 float gain_db = accurate_coefficient_to_dB (gain);
913 switch (ev->direction) {
915 case GDK_SCROLL_LEFT:
918 case GDK_SCROLL_DOWN:
919 case GDK_SCROLL_RIGHT:
923 gain_db = std::max (-60.f, gain_db);
924 gain = dB_to_coefficient (gain_db);
925 gain = std::min (gain, Config->get_max_gain());
926 Config->set_click_gain (gain);
931 ARDOUR_UI::sync_button_clicked (GdkEventButton* ev)
933 if (ev->button != 3) {
934 /* this handler is just for button-3 clicks */
938 show_tabbable (rc_option_editor);
939 rc_option_editor->set_current_page (_("Sync"));
944 ARDOUR_UI::toggle_follow_edits ()
946 RefPtr<Action> act = ActionManager::get_action (X_("Transport"), X_("ToggleFollowEdits"));
949 RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic (act);
952 UIConfiguration::instance().set_follow_edits (tact->get_active ());
956 ARDOUR_UI::update_title ()
959 bool dirty = _session->dirty();
963 if (_session->snap_name() != _session->name()) {
964 session_name = _session->snap_name();
966 session_name = _session->name();
970 session_name = "*" + session_name;
973 WindowTitle title (session_name);
974 title += Glib::get_application_name();
975 _main_window.set_title (title.get_string());
977 WindowTitle title (Glib::get_application_name());
978 _main_window.set_title (title.get_string());