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.
28 #include <sigc++/bind.h>
29 #include <pbd/error.h>
30 #include <pbd/basename.h>
31 #include <pbd/fastlog.h>
32 #include <gtkmm2ext/pix.h>
33 #include <gtkmm2ext/utils.h>
34 #include <gtkmm2ext/click_box.h>
35 #include <gtkmm2ext/tearoff.h>
37 #include <ardour/audioengine.h>
38 #include <ardour/ardour.h>
39 #include <ardour/route.h>
41 #include "ardour_ui.h"
42 #include "public_editor.h"
43 #include "audio_clock.h"
50 using namespace ARDOUR;
51 using namespace Gtkmm2ext;
57 ARDOUR_UI::setup_windows ()
59 using namespace Menu_Helpers;
61 if (create_editor ()) {
62 error << _("UI: cannot setup editor") << endmsg;
66 if (create_mixer ()) {
67 error << _("UI: cannot setup mixer") << endmsg;
71 /* all other dialogs are created conditionally */
73 we_have_dependents ();
80 top_packer.pack_start (menu_bar_base, false, false);
81 top_packer.pack_start (transport_frame, false, false);
83 editor->add_toplevel_controls (top_packer);
89 ARDOUR_UI::setup_adjustables ()
91 adjuster_table.set_homogeneous (true);
93 online_control_strings.push_back (_("MMC + Local"));
94 online_control_strings.push_back (_("MMC"));
95 online_control_strings.push_back (_("Local"));
97 online_control_button = new GlobalClickBox ("CONTROL",
98 online_control_strings);
100 online_control_button->adjustment.signal_value_changed().connect(mem_fun(*this,&ARDOUR_UI::control_methods_adjusted));
102 mmc_id_strings.push_back ("1");
103 mmc_id_strings.push_back ("2");
104 mmc_id_strings.push_back ("3");
105 mmc_id_strings.push_back ("4");
106 mmc_id_strings.push_back ("5");
107 mmc_id_strings.push_back ("6");
108 mmc_id_strings.push_back ("7");
109 mmc_id_strings.push_back ("8");
110 mmc_id_strings.push_back ("9");
112 mmc_id_button = new GlobalClickBox (_("MMC ID"), mmc_id_strings);
114 mmc_id_button->adjustment.signal_value_changed().connect (mem_fun(*this,&ARDOUR_UI::mmc_device_id_adjusted));
116 adjuster_table.attach (*online_control_button, 0, 2, 1, 2, FILL|EXPAND, FILL, 5, 5);
117 adjuster_table.attach (*mmc_id_button, 2, 3, 1, 2, FILL, FILL, 5, 5);
120 static const gchar * loop_xpm[] = {
130 " ..+++.+++..+++.. ",
131 " ..++...++.....++..",
137 " ..++.....++...++..",
138 " ..+++..+++.+++.. ",
146 ARDOUR_UI::transport_stopped ()
148 stop_button.set_active (true);
150 roll_button.set_active (false);
151 play_selection_button.set_active (false);
152 auto_loop_button.set_active (false);
155 shuttle_box.queue_draw ();
157 update_disk_space ();
160 static const double SHUTTLE_FRACT_SPEED1=0.48412291827; /* derived from A1,A2 */
163 ARDOUR_UI::transport_rolling ()
165 stop_button.set_active (false);
166 if (session->get_play_range()) {
168 play_selection_button.set_active (true);
169 roll_button.set_active (false);
170 auto_loop_button.set_active (false);
172 } else if (session->get_auto_loop ()) {
174 auto_loop_button.set_active (true);
175 play_selection_button.set_active (false);
176 roll_button.set_active (false);
180 roll_button.set_active (true);
181 play_selection_button.set_active (false);
182 auto_loop_button.set_active (false);
185 /* reset shuttle controller */
187 shuttle_fract = SHUTTLE_FRACT_SPEED1; /* speed = 1.0, believe it or not */
188 shuttle_box.queue_draw ();
192 ARDOUR_UI::transport_rewinding ()
194 stop_button.set_active(false);
195 roll_button.set_active (true);
196 play_selection_button.set_active (false);
197 auto_loop_button.set_active (false);
201 ARDOUR_UI::transport_forwarding ()
203 stop_button.set_active (false);
204 roll_button.set_active (true);
205 play_selection_button.set_active (false);
206 auto_loop_button.set_active (false);
210 ARDOUR_UI::setup_transport ()
212 transport_tearoff = manage (new TearOff (transport_tearoff_hbox));
213 transport_tearoff->set_name ("TransportBase");
215 transport_hbox.pack_start (*transport_tearoff, true, false);
217 transport_base.set_name ("TransportBase");
218 transport_base.add (transport_hbox);
220 transport_frame.set_shadow_type (SHADOW_OUT);
221 transport_frame.set_name ("BaseFrame");
222 transport_frame.add (transport_base);
224 transport_tearoff->Detach.connect (bind (mem_fun(*this, &ARDOUR_UI::detach_tearoff), static_cast<Box*>(&top_packer),
225 static_cast<Widget*>(&transport_frame)));
226 transport_tearoff->Attach.connect (bind (mem_fun(*this, &ARDOUR_UI::reattach_tearoff), static_cast<Box*> (&top_packer),
227 static_cast<Widget*> (&transport_frame), 1));
229 shuttle_box.set_name ("TransportButton");
230 goto_start_button.set_name ("TransportButton");
231 goto_end_button.set_name ("TransportButton");
232 roll_button.set_name ("TransportButton");
233 stop_button.set_name ("TransportButton");
234 play_selection_button.set_name ("TransportButton");
235 rec_button.set_name ("TransportRecButton");
236 auto_loop_button.set_name ("TransportButton");
237 auto_return_button.set_name ("TransportButton");
238 auto_play_button.set_name ("TransportButton");
239 auto_input_button.set_name ("TransportButton");
240 punch_in_button.set_name ("TransportButton");
241 punch_out_button.set_name ("TransportButton");
242 click_button.set_name ("TransportButton");
243 time_master_button.set_name ("TransportButton");
245 vector<Gdk::Color> colors;
248 /* record button has 3 color states, so we set 2 extra here */
249 set_color(c, rgba_from_style ("TransportRecButton", 0xff, 0, 0, 0, "bg", Gtk::STATE_PRELIGHT, false ));
250 colors.push_back (c);
252 set_color(c, rgba_from_style ("TransportRecButton", 0xff, 0, 0, 0, "bg", Gtk::STATE_ACTIVE, false ));
253 colors.push_back (c);
255 rec_button.set_colors (colors);
258 /* other buttons get 2 color states, so add one here */
259 set_color(c, rgba_from_style ("TransportButton", 0x7f, 0xff, 0x7f, 0, "bg", Gtk::STATE_ACTIVE, false ));
260 colors.push_back (c);
262 stop_button.set_colors (colors);
263 roll_button.set_colors (colors);
264 auto_loop_button.set_colors (colors);
265 play_selection_button.set_colors (colors);
266 goto_start_button.set_colors (colors);
267 goto_end_button.set_colors (colors);
271 stop_button.set_active (true);
273 w = manage (new Image (Stock::MEDIA_PREVIOUS, ICON_SIZE_BUTTON));
275 goto_start_button.add (*w);
276 w = manage (new Image (Stock::MEDIA_NEXT, ICON_SIZE_BUTTON));
278 goto_end_button.add (*w);
279 w = manage (new Image (Stock::MEDIA_PLAY, ICON_SIZE_BUTTON));
281 roll_button.add (*w);
282 w = manage (new Image (Stock::MEDIA_STOP, ICON_SIZE_BUTTON));
284 stop_button.add (*w);
285 w = manage (new Image (Stock::MEDIA_PLAY, ICON_SIZE_BUTTON));
287 play_selection_button.add (*w);
288 w = manage (new Image (Stock::MEDIA_RECORD, ICON_SIZE_BUTTON));
291 w = manage (new Image (Gdk::Pixbuf::create_from_xpm_data(loop_xpm)));
293 auto_loop_button.add (*w);
297 act = ActionManager::get_action (X_("Transport"), X_("Stop"));
298 act->connect_proxy (stop_button);
299 act = ActionManager::get_action (X_("Transport"), X_("Roll"));
300 act->connect_proxy (roll_button);
301 act = ActionManager::get_action (X_("Transport"), X_("Record"));
302 act->connect_proxy (rec_button);
303 act = ActionManager::get_action (X_("Transport"), X_("GotoStart"));
304 act->connect_proxy (goto_start_button);
305 act = ActionManager::get_action (X_("Transport"), X_("GotoEnd"));
306 act->connect_proxy (goto_end_button);
307 act = ActionManager::get_action (X_("Transport"), X_("Loop"));
308 act->connect_proxy (auto_loop_button);
309 act = ActionManager::get_action (X_("Transport"), X_("PlaySelection"));
310 act->connect_proxy (play_selection_button);
311 act = ActionManager::get_action (X_("Transport"), X_("ToggleTimeMaster"));
312 act->connect_proxy (time_master_button);
314 ARDOUR_UI::instance()->tooltips().set_tip (roll_button, _("Play from playhead"));
315 ARDOUR_UI::instance()->tooltips().set_tip (stop_button, _("Stop playback"));
316 ARDOUR_UI::instance()->tooltips().set_tip (play_selection_button, _("Play range/selection"));
317 ARDOUR_UI::instance()->tooltips().set_tip (goto_start_button, _("Go to start of session"));
318 ARDOUR_UI::instance()->tooltips().set_tip (goto_end_button, _("Go to end of session"));
319 ARDOUR_UI::instance()->tooltips().set_tip (auto_loop_button, _("Play loop range"));
320 ARDOUR_UI::instance()->tooltips().set_tip (auto_return_button, _("Return to last playback start when stopped"));
321 ARDOUR_UI::instance()->tooltips().set_tip (auto_play_button, _("Start playback after any locate"));
322 ARDOUR_UI::instance()->tooltips().set_tip (auto_input_button, _("Be sensible about input monitoring"));
323 ARDOUR_UI::instance()->tooltips().set_tip (punch_in_button, _("Start recording at auto-punch start"));
324 ARDOUR_UI::instance()->tooltips().set_tip (punch_out_button, _("Stop recording at auto-punch end"));
325 ARDOUR_UI::instance()->tooltips().set_tip (click_button, _("Enable/Disable audio click"));
326 ARDOUR_UI::instance()->tooltips().set_tip (sync_option_combo, _("Positional sync source"));
327 ARDOUR_UI::instance()->tooltips().set_tip (time_master_button, _("Does Ardour control the time?"));
328 ARDOUR_UI::instance()->tooltips().set_tip (shuttle_box, _("Shuttle speed control"));
329 ARDOUR_UI::instance()->tooltips().set_tip (shuttle_units_button, _("Select semitones or %%-age for speed display"));
330 ARDOUR_UI::instance()->tooltips().set_tip (speed_display_box, _("Current transport speed"));
332 shuttle_box.set_flags (CAN_FOCUS);
333 shuttle_box.add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::POINTER_MOTION_MASK);
334 shuttle_box.set_size_request (100, 15);
336 shuttle_box.signal_button_press_event().connect (mem_fun(*this, &ARDOUR_UI::shuttle_box_button_press));
337 shuttle_box.signal_button_release_event().connect (mem_fun(*this, &ARDOUR_UI::shuttle_box_button_release));
338 shuttle_box.signal_motion_notify_event().connect (mem_fun(*this, &ARDOUR_UI::shuttle_box_motion));
339 shuttle_box.signal_expose_event().connect (mem_fun(*this, &ARDOUR_UI::shuttle_box_expose));
343 ARDOUR_UI::Clock.connect (bind (mem_fun (primary_clock, &AudioClock::set), false));
344 ARDOUR_UI::Clock.connect (bind (mem_fun (secondary_clock, &AudioClock::set), false));
346 primary_clock.set_mode (AudioClock::SMPTE);
347 secondary_clock.set_mode (AudioClock::BBT);
349 primary_clock.ValueChanged.connect (mem_fun(*this, &ARDOUR_UI::primary_clock_value_changed));
350 secondary_clock.ValueChanged.connect (mem_fun(*this, &ARDOUR_UI::secondary_clock_value_changed));
352 ARDOUR_UI::instance()->tooltips().set_tip (primary_clock, _("Primary clock"));
353 ARDOUR_UI::instance()->tooltips().set_tip (secondary_clock, _("secondary clock"));
355 ActionManager::get_action ("Transport", "ToggleAutoReturn")->connect_proxy (auto_return_button);
356 ActionManager::get_action ("Transport", "ToggleAutoPlay")->connect_proxy (auto_play_button);
357 ActionManager::get_action ("Transport", "ToggleAutoInput")->connect_proxy (auto_input_button);
358 ActionManager::get_action ("Transport", "ToggleClick")->connect_proxy (click_button);
359 ActionManager::get_action ("Transport", "TogglePunchIn")->connect_proxy (punch_in_button);
360 ActionManager::get_action ("Transport", "TogglePunchOut")->connect_proxy (punch_out_button);
362 preroll_button.unset_flags (CAN_FOCUS);
363 preroll_button.set_events (preroll_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
364 preroll_button.set_name ("TransportButton");
366 postroll_button.unset_flags (CAN_FOCUS);
367 postroll_button.set_events (postroll_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
368 postroll_button.set_name ("TransportButton");
370 preroll_clock.set_mode (AudioClock::MinSec);
371 preroll_clock.set_name ("TransportClockDisplay");
372 postroll_clock.set_mode (AudioClock::MinSec);
373 postroll_clock.set_name ("TransportClockDisplay");
377 /* CANNOT bind these to clicked or toggled, must use pressed or released */
379 solo_alert_button.set_name ("TransportSoloAlert");
380 solo_alert_button.signal_pressed().connect (mem_fun(*this,&ARDOUR_UI::solo_alert_toggle));
381 auditioning_alert_button.set_name ("TransportAuditioningAlert");
382 auditioning_alert_button.signal_pressed().connect (mem_fun(*this,&ARDOUR_UI::audition_alert_toggle));
384 alert_box.pack_start (solo_alert_button);
385 alert_box.pack_start (auditioning_alert_button);
387 transport_tearoff_hbox.set_border_width (5);
389 transport_tearoff_hbox.pack_start (goto_start_button, false, false);
390 transport_tearoff_hbox.pack_start (goto_end_button, false, false);
392 Frame* sframe = manage (new Frame);
393 VBox* svbox = manage (new VBox);
394 HBox* shbox = manage (new HBox);
396 sframe->set_shadow_type (SHADOW_IN);
397 sframe->add (shuttle_box);
399 shuttle_box.set_name (X_("ShuttleControl"));
401 speed_display_box.add (speed_display_label);
402 speed_display_box.set_name (X_("ShuttleDisplay"));
404 shuttle_units_button.set_name (X_("ShuttleButton"));
405 shuttle_units_button.signal_clicked().connect (mem_fun(*this, &ARDOUR_UI::shuttle_unit_clicked));
407 shuttle_style_button.set_name (X_("ShuttleButton"));
409 vector<string> shuttle_strings;
410 shuttle_strings.push_back (_("sprung"));
411 shuttle_strings.push_back (_("wheel"));
412 set_popdown_strings (shuttle_style_button, shuttle_strings);
413 shuttle_style_button.signal_changed().connect (mem_fun (*this, &ARDOUR_UI::shuttle_style_changed));
415 Frame* sdframe = manage (new Frame);
417 sdframe->set_shadow_type (SHADOW_IN);
418 sdframe->add (speed_display_box);
421 sync_option_combo.set_active_text (positional_sync_strings.front());
422 sync_option_combo.signal_changed().connect (mem_fun (*this, &ARDOUR_UI::sync_option_changed));
424 shbox->pack_start (*sdframe, false, false);
425 shbox->pack_start (shuttle_units_button, true, true);
426 shbox->pack_start (shuttle_style_button, false, false);
428 svbox->pack_start (*sframe, false, false);
429 svbox->pack_start (*shbox, false, false);
431 transport_tearoff_hbox.pack_start (*svbox, false, false, 5);
433 transport_tearoff_hbox.pack_start (auto_loop_button, false, false);
434 transport_tearoff_hbox.pack_start (play_selection_button, false, false);
435 transport_tearoff_hbox.pack_start (roll_button, false, false);
436 transport_tearoff_hbox.pack_start (stop_button, false, false);
437 transport_tearoff_hbox.pack_start (rec_button, false, false, 10);
439 transport_tearoff_hbox.pack_start (primary_clock, false, false, 5);
440 transport_tearoff_hbox.pack_start (secondary_clock, false, false, 5);
442 transport_tearoff_hbox.pack_start (sync_option_combo, false, false);
443 transport_tearoff_hbox.pack_start (time_master_button, false, false);
444 transport_tearoff_hbox.pack_start (punch_in_button, false, false);
445 transport_tearoff_hbox.pack_start (punch_out_button, false, false);
446 transport_tearoff_hbox.pack_start (auto_input_button, false, false);
447 transport_tearoff_hbox.pack_start (auto_return_button, false, false);
448 transport_tearoff_hbox.pack_start (auto_play_button, false, false);
449 transport_tearoff_hbox.pack_start (click_button, false, false);
453 set_transport_sensitivity (false);
455 // transport_tearoff_hbox.pack_start (preroll_button, false, false);
456 // transport_tearoff_hbox.pack_start (preroll_clock, false, false);
458 // transport_tearoff_hbox.pack_start (postroll_button, false, false);
459 // transport_tearoff_hbox.pack_start (postroll_clock, false, false);
461 transport_tearoff_hbox.pack_start (alert_box, false, false, 5);
465 ARDOUR_UI::setup_clock ()
467 ARDOUR_UI::Clock.connect (bind (mem_fun (big_clock, &AudioClock::set), false));
469 big_clock_window = new Window (WINDOW_TOPLEVEL);
471 big_clock_window->set_border_width (0);
472 big_clock_window->add (big_clock);
473 big_clock_window->set_title (_("ardour: clock"));
474 big_clock_window->set_type_hint (Gdk::WINDOW_TYPE_HINT_MENU);
475 big_clock_window->signal_realize().connect (bind (sigc::ptr_fun (set_decoration), big_clock_window, (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH)));
476 big_clock_window->signal_unmap().connect (bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleBigClock")));
478 manage_window (*big_clock_window);
482 ARDOUR_UI::manage_window (Window& win)
484 win.signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), &win));
485 win.signal_enter_notify_event().connect (bind (mem_fun (Keyboard::the_keyboard(), &Keyboard::enter_window), &win));
486 win.signal_leave_notify_event().connect (bind (mem_fun (Keyboard::the_keyboard(), &Keyboard::leave_window), &win));
490 ARDOUR_UI::detach_tearoff (Box* b, Widget* w)
492 // editor->ensure_float (transport_tearoff->tearoff_window());
497 ARDOUR_UI::reattach_tearoff (Box* b, Widget* w, int32_t n)
500 b->reorder_child (*w, n);
504 ARDOUR_UI::soloing_changed (bool onoff)
506 if (solo_alert_button.get_active() != onoff) {
507 solo_alert_button.set_active (onoff);
512 ARDOUR_UI::_auditioning_changed (bool onoff)
514 if (auditioning_alert_button.get_active() != onoff) {
515 auditioning_alert_button.set_active (onoff);
516 set_transport_sensitivity (!onoff);
521 ARDOUR_UI::auditioning_changed (bool onoff)
523 Gtkmm2ext::UI::instance()->call_slot(bind (mem_fun(*this, &ARDOUR_UI::_auditioning_changed), onoff));
527 ARDOUR_UI::audition_alert_toggle ()
530 session->cancel_audition();
535 ARDOUR_UI::solo_alert_toggle ()
538 session->set_all_solo (!session->soloing());
543 ARDOUR_UI::solo_blink (bool onoff)
549 if (session->soloing()) {
551 solo_alert_button.set_state (STATE_ACTIVE);
553 solo_alert_button.set_state (STATE_NORMAL);
556 solo_alert_button.set_active (false);
557 solo_alert_button.set_state (STATE_NORMAL);
562 ARDOUR_UI::audition_blink (bool onoff)
568 if (session->is_auditioning()) {
570 auditioning_alert_button.set_state (STATE_ACTIVE);
572 auditioning_alert_button.set_state (STATE_NORMAL);
575 auditioning_alert_button.set_active (false);
576 auditioning_alert_button.set_state (STATE_NORMAL);
582 ARDOUR_UI::shuttle_box_button_press (GdkEventButton* ev)
588 switch (ev->button) {
590 shuttle_box.add_modal_grab ();
591 shuttle_grabbed = true;
592 mouse_shuttle (ev->x, true);
605 ARDOUR_UI::shuttle_box_button_release (GdkEventButton* ev)
611 switch (ev->button) {
613 mouse_shuttle (ev->x, true);
614 shuttle_grabbed = false;
615 shuttle_box.remove_modal_grab ();
616 if (shuttle_behaviour == Sprung) {
617 shuttle_fract = SHUTTLE_FRACT_SPEED1;
618 session->request_transport_speed (1.0);
619 shuttle_box.queue_draw ();
624 if (session->transport_rolling()) {
625 shuttle_fract = SHUTTLE_FRACT_SPEED1;
626 session->request_transport_speed (1.0);
630 shuttle_box.queue_draw ();
637 shuttle_fract += 0.005;
640 shuttle_fract -= 0.005;
644 use_shuttle_fract (true);
650 ARDOUR_UI::shuttle_box_motion (GdkEventMotion* ev)
652 if (!session || !shuttle_grabbed) {
656 return mouse_shuttle (ev->x, false);
660 ARDOUR_UI::mouse_shuttle (double x, bool force)
662 double half_width = shuttle_box.get_width() / 2.0;
663 double distance = x - half_width;
666 distance = min (distance, half_width);
668 distance = max (distance, -half_width);
671 shuttle_fract = distance / half_width;
672 use_shuttle_fract (force);
677 ARDOUR_UI::use_shuttle_fract (bool force)
682 /* do not attempt to submit a motion-driven transport speed request
683 more than once per process cycle.
686 gettimeofday (&now, 0);
687 timersub (&now, &last_shuttle_request, &diff);
689 if (!force && (diff.tv_usec + (diff.tv_sec * 1000000)) < engine->usecs_per_cycle()) {
693 last_shuttle_request = now;
695 bool neg = (shuttle_fract < 0.0);
697 double fract = 1 - sqrt (1 - (shuttle_fract * shuttle_fract)); // Formula A1
703 session->request_transport_speed (8.0 * fract); // Formula A2
704 shuttle_box.queue_draw ();
708 ARDOUR_UI::shuttle_box_expose (GdkEventExpose* event)
711 Glib::RefPtr<Gdk::Window> win (shuttle_box.get_window());
713 /* redraw the background */
715 win->draw_rectangle (shuttle_box.get_style()->get_bg_gc (shuttle_box.get_state()),
717 event->area.x, event->area.y,
718 event->area.width, event->area.height);
721 x = (gint) floor ((shuttle_box.get_width() / 2.0) + (0.5 * (shuttle_box.get_width() * shuttle_fract)));
725 win->draw_line (shuttle_box.get_style()->get_fg_gc (shuttle_box.get_state()),
729 shuttle_box.get_height());
734 ARDOUR_UI::shuttle_unit_clicked ()
736 if (shuttle_unit_menu == 0) {
737 shuttle_unit_menu = dynamic_cast<Menu*> (ActionManager::get_widget ("/ShuttleUnitPopup"));
739 shuttle_unit_menu->popup (1, 0);
743 ARDOUR_UI::set_shuttle_units (ShuttleUnits u)
745 switch ((shuttle_units = u)) {
747 static_cast<Label*>(shuttle_units_button.get_child())->set_text ("% ");
750 static_cast<Label*>(shuttle_units_button.get_child())->set_text (_("st"));
756 ARDOUR_UI::shuttle_style_changed ()
758 ustring str = shuttle_style_button.get_active_text ();
760 if (str == _("sprung")) {
761 set_shuttle_behaviour (Sprung);
762 } else if (str == _("wheel")) {
763 set_shuttle_behaviour (Wheel);
769 ARDOUR_UI::set_shuttle_behaviour (ShuttleBehaviour b)
771 switch ((shuttle_behaviour = b)) {
773 shuttle_style_button.set_active_text (_("sprung"));
775 shuttle_box.queue_draw ();
777 if (session->transport_rolling()) {
778 shuttle_fract = SHUTTLE_FRACT_SPEED1;
779 session->request_transport_speed (1.0);
784 shuttle_style_button.set_active_text (_("wheel"));
790 ARDOUR_UI::update_speed_display ()
793 if (last_speed_displayed != 0) {
794 speed_display_label.set_text (_("stopped"));
795 last_speed_displayed = 0;
801 float x = session->transport_speed ();
803 if (x != last_speed_displayed) {
806 if (shuttle_units == Percentage) {
807 snprintf (buf, sizeof (buf), "%.4f", x);
810 snprintf (buf, sizeof (buf), "< %.1f", 12.0 * fast_log2 (-x));
812 snprintf (buf, sizeof (buf), "> %.1f", 12.0 * fast_log2 (x));
815 speed_display_label.set_text (buf);
817 speed_display_label.set_text (_("stopped"));
820 last_speed_displayed = x;
825 ARDOUR_UI::set_transport_sensitivity (bool yn)
827 ActionManager::set_sensitive (ActionManager::transport_sensitive_actions, yn);
828 shuttle_box.set_sensitive (yn);
832 ARDOUR_UI::editor_realized ()
834 set_size_request_to_display_given_text (speed_display_box, _("stopped"), 2, 2);
835 /* XXX: this should really be saved in instant.xml or something similar and restored from there */
836 shuttle_style_button.set_active_text (_("sprung"));
837 const guint32 FUDGE = 20; // Combo's are stupid - they steal space from the entry for the button
838 set_size_request_to_display_given_text (shuttle_style_button, _("sprung"), 2+FUDGE, 10);
842 ARDOUR_UI::sync_option_changed ()
850 which = sync_option_combo.get_active_text();
852 if (which == positional_sync_strings[Session::None]) {
853 session->request_slave_source (Session::None);
854 } else if (which == positional_sync_strings[Session::MTC]) {
855 session->request_slave_source (Session::MTC);
856 } else if (which == positional_sync_strings[Session::JACK]) {
857 session->request_slave_source (Session::JACK);