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);
121 ARDOUR_UI::transport_stopped ()
123 stop_button.set_active (true);
125 roll_button.set_active (false);
126 play_selection_button.set_active (false);
127 auto_loop_button.set_active (false);
130 shuttle_box.queue_draw ();
132 update_disk_space ();
135 static const double SHUTTLE_FRACT_SPEED1=0.48412291827; /* derived from A1,A2 */
138 ARDOUR_UI::transport_rolling ()
140 stop_button.set_active (false);
141 if (session->get_play_range()) {
143 play_selection_button.set_active (true);
144 roll_button.set_active (false);
145 auto_loop_button.set_active (false);
147 } else if (session->get_auto_loop ()) {
149 auto_loop_button.set_active (true);
150 play_selection_button.set_active (false);
151 roll_button.set_active (false);
155 roll_button.set_active (true);
156 play_selection_button.set_active (false);
157 auto_loop_button.set_active (false);
160 /* reset shuttle controller */
162 shuttle_fract = SHUTTLE_FRACT_SPEED1; /* speed = 1.0, believe it or not */
163 shuttle_box.queue_draw ();
167 ARDOUR_UI::transport_rewinding ()
169 stop_button.set_active(false);
170 roll_button.set_active (true);
171 play_selection_button.set_active (false);
172 auto_loop_button.set_active (false);
176 ARDOUR_UI::transport_forwarding ()
178 stop_button.set_active (false);
179 roll_button.set_active (true);
180 play_selection_button.set_active (false);
181 auto_loop_button.set_active (false);
185 ARDOUR_UI::setup_transport ()
187 transport_tearoff = manage (new TearOff (transport_tearoff_hbox));
188 transport_tearoff->set_name ("TransportBase");
190 transport_hbox.pack_start (*transport_tearoff, true, false);
192 transport_base.set_name ("TransportBase");
193 transport_base.add (transport_hbox);
195 transport_frame.set_shadow_type (SHADOW_OUT);
196 transport_frame.set_name ("BaseFrame");
197 transport_frame.add (transport_base);
199 transport_tearoff->Detach.connect (bind (mem_fun(*this, &ARDOUR_UI::detach_tearoff), static_cast<Box*>(&top_packer),
200 static_cast<Widget*>(&transport_frame)));
201 transport_tearoff->Attach.connect (bind (mem_fun(*this, &ARDOUR_UI::reattach_tearoff), static_cast<Box*> (&top_packer),
202 static_cast<Widget*> (&transport_frame), 1));
203 transport_tearoff->Hidden.connect (bind (mem_fun(*this, &ARDOUR_UI::detach_tearoff), static_cast<Box*>(&top_packer),
204 static_cast<Widget*>(&transport_frame)));
205 transport_tearoff->Visible.connect (bind (mem_fun(*this, &ARDOUR_UI::reattach_tearoff), static_cast<Box*> (&top_packer),
206 static_cast<Widget*> (&transport_frame), 1));
208 shuttle_box.set_name ("TransportButton");
209 goto_start_button.set_name ("TransportButton");
210 goto_end_button.set_name ("TransportButton");
211 roll_button.set_name ("TransportButton");
212 stop_button.set_name ("TransportButton");
213 play_selection_button.set_name ("TransportButton");
214 rec_button.set_name ("TransportRecButton");
215 auto_loop_button.set_name ("TransportButton");
216 auto_return_button.set_name ("TransportButton");
217 auto_play_button.set_name ("TransportButton");
218 auto_input_button.set_name ("TransportButton");
219 punch_in_button.set_name ("TransportButton");
220 punch_out_button.set_name ("TransportButton");
221 click_button.set_name ("TransportButton");
222 time_master_button.set_name ("TransportButton");
224 vector<Gdk::Color> colors;
227 /* record button has 3 color states, so we set 2 extra here */
228 set_color(c, rgba_from_style ("TransportRecButton", 0xff, 0, 0, 0, "bg", Gtk::STATE_PRELIGHT, false ));
229 colors.push_back (c);
231 set_color(c, rgba_from_style ("TransportRecButton", 0xff, 0, 0, 0, "bg", Gtk::STATE_ACTIVE, false ));
232 colors.push_back (c);
234 rec_button.set_colors (colors);
237 /* other buttons get 2 color states, so add one here */
238 set_color(c, rgba_from_style ("TransportButton", 0x7f, 0xff, 0x7f, 0, "bg", Gtk::STATE_ACTIVE, false ));
239 colors.push_back (c);
241 stop_button.set_colors (colors);
242 roll_button.set_colors (colors);
243 auto_loop_button.set_colors (colors);
244 play_selection_button.set_colors (colors);
245 goto_start_button.set_colors (colors);
246 goto_end_button.set_colors (colors);
250 stop_button.set_active (true);
252 w = manage (new Image (Stock::MEDIA_PREVIOUS, ICON_SIZE_BUTTON));
254 goto_start_button.add (*w);
255 w = manage (new Image (Stock::MEDIA_NEXT, ICON_SIZE_BUTTON));
257 goto_end_button.add (*w);
258 w = manage (new Image (Stock::MEDIA_PLAY, ICON_SIZE_BUTTON));
260 roll_button.add (*w);
261 w = manage (new Image (Stock::MEDIA_STOP, ICON_SIZE_BUTTON));
263 stop_button.add (*w);
264 w = manage (new Image (Stock::MEDIA_PLAY, ICON_SIZE_BUTTON));
266 play_selection_button.add (*w);
267 w = manage (new Image (Stock::MEDIA_RECORD, ICON_SIZE_BUTTON));
270 w = manage (new Image (get_xpm("loop.xpm")));
272 auto_loop_button.add (*w);
276 act = ActionManager::get_action (X_("Transport"), X_("Stop"));
277 act->connect_proxy (stop_button);
278 act = ActionManager::get_action (X_("Transport"), X_("Roll"));
279 act->connect_proxy (roll_button);
280 act = ActionManager::get_action (X_("Transport"), X_("Record"));
281 act->connect_proxy (rec_button);
282 act = ActionManager::get_action (X_("Transport"), X_("GotoStart"));
283 act->connect_proxy (goto_start_button);
284 act = ActionManager::get_action (X_("Transport"), X_("GotoEnd"));
285 act->connect_proxy (goto_end_button);
286 act = ActionManager::get_action (X_("Transport"), X_("Loop"));
287 act->connect_proxy (auto_loop_button);
288 act = ActionManager::get_action (X_("Transport"), X_("PlaySelection"));
289 act->connect_proxy (play_selection_button);
290 act = ActionManager::get_action (X_("Transport"), X_("ToggleTimeMaster"));
291 act->connect_proxy (time_master_button);
293 ARDOUR_UI::instance()->tooltips().set_tip (roll_button, _("Play from playhead"));
294 ARDOUR_UI::instance()->tooltips().set_tip (stop_button, _("Stop playback"));
295 ARDOUR_UI::instance()->tooltips().set_tip (play_selection_button, _("Play range/selection"));
296 ARDOUR_UI::instance()->tooltips().set_tip (goto_start_button, _("Go to start of session"));
297 ARDOUR_UI::instance()->tooltips().set_tip (goto_end_button, _("Go to end of session"));
298 ARDOUR_UI::instance()->tooltips().set_tip (auto_loop_button, _("Play loop range"));
299 ARDOUR_UI::instance()->tooltips().set_tip (auto_return_button, _("Return to last playback start when stopped"));
300 ARDOUR_UI::instance()->tooltips().set_tip (auto_play_button, _("Start playback after any locate"));
301 ARDOUR_UI::instance()->tooltips().set_tip (auto_input_button, _("Be sensible about input monitoring"));
302 ARDOUR_UI::instance()->tooltips().set_tip (punch_in_button, _("Start recording at auto-punch start"));
303 ARDOUR_UI::instance()->tooltips().set_tip (punch_out_button, _("Stop recording at auto-punch end"));
304 ARDOUR_UI::instance()->tooltips().set_tip (click_button, _("Enable/Disable audio click"));
305 ARDOUR_UI::instance()->tooltips().set_tip (sync_option_combo, _("Positional sync source"));
306 ARDOUR_UI::instance()->tooltips().set_tip (time_master_button, _("Does Ardour control the time?"));
307 ARDOUR_UI::instance()->tooltips().set_tip (shuttle_box, _("Shuttle speed control"));
308 ARDOUR_UI::instance()->tooltips().set_tip (shuttle_units_button, _("Select semitones or %%-age for speed display"));
309 ARDOUR_UI::instance()->tooltips().set_tip (speed_display_box, _("Current transport speed"));
311 shuttle_box.set_flags (CAN_FOCUS);
312 shuttle_box.add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::POINTER_MOTION_MASK);
313 shuttle_box.set_size_request (100, 15);
315 shuttle_box.signal_button_press_event().connect (mem_fun(*this, &ARDOUR_UI::shuttle_box_button_press));
316 shuttle_box.signal_button_release_event().connect (mem_fun(*this, &ARDOUR_UI::shuttle_box_button_release));
317 shuttle_box.signal_motion_notify_event().connect (mem_fun(*this, &ARDOUR_UI::shuttle_box_motion));
318 shuttle_box.signal_expose_event().connect (mem_fun(*this, &ARDOUR_UI::shuttle_box_expose));
322 ARDOUR_UI::Clock.connect (bind (mem_fun (primary_clock, &AudioClock::set), false));
323 ARDOUR_UI::Clock.connect (bind (mem_fun (secondary_clock, &AudioClock::set), false));
325 primary_clock.set_mode (AudioClock::SMPTE);
326 secondary_clock.set_mode (AudioClock::BBT);
328 primary_clock.ValueChanged.connect (mem_fun(*this, &ARDOUR_UI::primary_clock_value_changed));
329 secondary_clock.ValueChanged.connect (mem_fun(*this, &ARDOUR_UI::secondary_clock_value_changed));
331 ARDOUR_UI::instance()->tooltips().set_tip (primary_clock, _("Primary clock"));
332 ARDOUR_UI::instance()->tooltips().set_tip (secondary_clock, _("secondary clock"));
334 ActionManager::get_action ("Transport", "ToggleAutoReturn")->connect_proxy (auto_return_button);
335 ActionManager::get_action ("Transport", "ToggleAutoPlay")->connect_proxy (auto_play_button);
336 ActionManager::get_action ("Transport", "ToggleAutoInput")->connect_proxy (auto_input_button);
337 ActionManager::get_action ("Transport", "ToggleClick")->connect_proxy (click_button);
338 ActionManager::get_action ("Transport", "TogglePunchIn")->connect_proxy (punch_in_button);
339 ActionManager::get_action ("Transport", "TogglePunchOut")->connect_proxy (punch_out_button);
341 preroll_button.unset_flags (CAN_FOCUS);
342 preroll_button.set_events (preroll_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
343 preroll_button.set_name ("TransportButton");
345 postroll_button.unset_flags (CAN_FOCUS);
346 postroll_button.set_events (postroll_button.get_events() & ~(Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK));
347 postroll_button.set_name ("TransportButton");
349 preroll_clock.set_mode (AudioClock::MinSec);
350 preroll_clock.set_name ("TransportClockDisplay");
351 postroll_clock.set_mode (AudioClock::MinSec);
352 postroll_clock.set_name ("TransportClockDisplay");
356 /* CANNOT bind these to clicked or toggled, must use pressed or released */
358 solo_alert_button.set_name ("TransportSoloAlert");
359 solo_alert_button.signal_pressed().connect (mem_fun(*this,&ARDOUR_UI::solo_alert_toggle));
360 auditioning_alert_button.set_name ("TransportAuditioningAlert");
361 auditioning_alert_button.signal_pressed().connect (mem_fun(*this,&ARDOUR_UI::audition_alert_toggle));
363 alert_box.pack_start (solo_alert_button);
364 alert_box.pack_start (auditioning_alert_button);
366 transport_tearoff_hbox.set_border_width (5);
368 transport_tearoff_hbox.pack_start (goto_start_button, false, false);
369 transport_tearoff_hbox.pack_start (goto_end_button, false, false);
371 Frame* sframe = manage (new Frame);
372 VBox* svbox = manage (new VBox);
373 HBox* shbox = manage (new HBox);
375 sframe->set_shadow_type (SHADOW_IN);
376 sframe->add (shuttle_box);
378 shuttle_box.set_name (X_("ShuttleControl"));
380 speed_display_box.add (speed_display_label);
381 speed_display_box.set_name (X_("ShuttleDisplay"));
383 shuttle_units_button.set_name (X_("ShuttleButton"));
384 shuttle_units_button.signal_clicked().connect (mem_fun(*this, &ARDOUR_UI::shuttle_unit_clicked));
386 shuttle_style_button.set_name (X_("ShuttleButton"));
388 vector<string> shuttle_strings;
389 shuttle_strings.push_back (_("sprung"));
390 shuttle_strings.push_back (_("wheel"));
391 set_popdown_strings (shuttle_style_button, shuttle_strings);
392 shuttle_style_button.signal_changed().connect (mem_fun (*this, &ARDOUR_UI::shuttle_style_changed));
394 Frame* sdframe = manage (new Frame);
396 sdframe->set_shadow_type (SHADOW_IN);
397 sdframe->add (speed_display_box);
400 sync_option_combo.set_active_text (positional_sync_strings.front());
401 sync_option_combo.signal_changed().connect (mem_fun (*this, &ARDOUR_UI::sync_option_changed));
403 shbox->pack_start (*sdframe, false, false);
404 shbox->pack_start (shuttle_units_button, true, true);
405 shbox->pack_start (shuttle_style_button, false, false);
407 svbox->pack_start (*sframe, false, false);
408 svbox->pack_start (*shbox, false, false);
410 transport_tearoff_hbox.pack_start (*svbox, false, false, 5);
412 transport_tearoff_hbox.pack_start (auto_loop_button, false, false);
413 transport_tearoff_hbox.pack_start (play_selection_button, false, false);
414 transport_tearoff_hbox.pack_start (roll_button, false, false);
415 transport_tearoff_hbox.pack_start (stop_button, false, false);
416 transport_tearoff_hbox.pack_start (rec_button, false, false, 10);
418 transport_tearoff_hbox.pack_start (primary_clock, false, false, 5);
419 transport_tearoff_hbox.pack_start (secondary_clock, false, false, 5);
421 transport_tearoff_hbox.pack_start (sync_option_combo, false, false);
422 transport_tearoff_hbox.pack_start (time_master_button, false, false);
423 transport_tearoff_hbox.pack_start (punch_in_button, false, false);
424 transport_tearoff_hbox.pack_start (punch_out_button, false, false);
425 transport_tearoff_hbox.pack_start (auto_input_button, false, false);
426 transport_tearoff_hbox.pack_start (auto_return_button, false, false);
427 transport_tearoff_hbox.pack_start (auto_play_button, false, false);
428 transport_tearoff_hbox.pack_start (click_button, false, false);
432 set_transport_sensitivity (false);
434 // transport_tearoff_hbox.pack_start (preroll_button, false, false);
435 // transport_tearoff_hbox.pack_start (preroll_clock, false, false);
437 // transport_tearoff_hbox.pack_start (postroll_button, false, false);
438 // transport_tearoff_hbox.pack_start (postroll_clock, false, false);
440 transport_tearoff_hbox.pack_start (alert_box, false, false, 5);
444 ARDOUR_UI::setup_clock ()
446 ARDOUR_UI::Clock.connect (bind (mem_fun (big_clock, &AudioClock::set), false));
448 big_clock_window = new Window (WINDOW_TOPLEVEL);
450 big_clock_window->set_border_width (0);
451 big_clock_window->add (big_clock);
452 big_clock_window->set_title (_("ardour: clock"));
453 big_clock_window->set_type_hint (Gdk::WINDOW_TYPE_HINT_MENU);
454 big_clock_window->signal_realize().connect (bind (sigc::ptr_fun (set_decoration), big_clock_window, (Gdk::DECOR_BORDER|Gdk::DECOR_RESIZEH)));
455 big_clock_window->signal_unmap().connect (bind (sigc::ptr_fun(&ActionManager::uncheck_toggleaction), X_("<Actions>/Common/ToggleBigClock")));
457 manage_window (*big_clock_window);
461 ARDOUR_UI::manage_window (Window& win)
463 win.signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), &win));
464 win.signal_enter_notify_event().connect (bind (mem_fun (Keyboard::the_keyboard(), &Keyboard::enter_window), &win));
465 win.signal_leave_notify_event().connect (bind (mem_fun (Keyboard::the_keyboard(), &Keyboard::leave_window), &win));
469 ARDOUR_UI::detach_tearoff (Box* b, Widget* w)
471 // editor->ensure_float (transport_tearoff->tearoff_window());
476 ARDOUR_UI::reattach_tearoff (Box* b, Widget* w, int32_t n)
479 b->reorder_child (*w, n);
483 ARDOUR_UI::soloing_changed (bool onoff)
485 if (solo_alert_button.get_active() != onoff) {
486 solo_alert_button.set_active (onoff);
491 ARDOUR_UI::_auditioning_changed (bool onoff)
493 if (auditioning_alert_button.get_active() != onoff) {
494 auditioning_alert_button.set_active (onoff);
495 set_transport_sensitivity (!onoff);
500 ARDOUR_UI::auditioning_changed (bool onoff)
502 Gtkmm2ext::UI::instance()->call_slot(bind (mem_fun(*this, &ARDOUR_UI::_auditioning_changed), onoff));
506 ARDOUR_UI::audition_alert_toggle ()
509 session->cancel_audition();
514 ARDOUR_UI::solo_alert_toggle ()
517 session->set_all_solo (!session->soloing());
522 ARDOUR_UI::solo_blink (bool onoff)
528 if (session->soloing()) {
530 solo_alert_button.set_state (STATE_ACTIVE);
532 solo_alert_button.set_state (STATE_NORMAL);
535 solo_alert_button.set_active (false);
536 solo_alert_button.set_state (STATE_NORMAL);
541 ARDOUR_UI::audition_blink (bool onoff)
547 if (session->is_auditioning()) {
549 auditioning_alert_button.set_state (STATE_ACTIVE);
551 auditioning_alert_button.set_state (STATE_NORMAL);
554 auditioning_alert_button.set_active (false);
555 auditioning_alert_button.set_state (STATE_NORMAL);
561 ARDOUR_UI::shuttle_box_button_press (GdkEventButton* ev)
567 switch (ev->button) {
569 shuttle_box.add_modal_grab ();
570 shuttle_grabbed = true;
571 mouse_shuttle (ev->x, true);
584 ARDOUR_UI::shuttle_box_button_release (GdkEventButton* ev)
590 switch (ev->button) {
592 mouse_shuttle (ev->x, true);
593 shuttle_grabbed = false;
594 shuttle_box.remove_modal_grab ();
595 if (shuttle_behaviour == Sprung) {
596 shuttle_fract = SHUTTLE_FRACT_SPEED1;
597 session->request_transport_speed (1.0);
598 shuttle_box.queue_draw ();
603 if (session->transport_rolling()) {
604 shuttle_fract = SHUTTLE_FRACT_SPEED1;
605 session->request_transport_speed (1.0);
609 shuttle_box.queue_draw ();
616 shuttle_fract += 0.005;
619 shuttle_fract -= 0.005;
623 use_shuttle_fract (true);
629 ARDOUR_UI::shuttle_box_motion (GdkEventMotion* ev)
631 if (!session || !shuttle_grabbed) {
635 return mouse_shuttle (ev->x, false);
639 ARDOUR_UI::mouse_shuttle (double x, bool force)
641 double half_width = shuttle_box.get_width() / 2.0;
642 double distance = x - half_width;
645 distance = min (distance, half_width);
647 distance = max (distance, -half_width);
650 shuttle_fract = distance / half_width;
651 use_shuttle_fract (force);
656 ARDOUR_UI::use_shuttle_fract (bool force)
661 /* do not attempt to submit a motion-driven transport speed request
662 more than once per process cycle.
665 gettimeofday (&now, 0);
666 timersub (&now, &last_shuttle_request, &diff);
668 if (!force && (diff.tv_usec + (diff.tv_sec * 1000000)) < engine->usecs_per_cycle()) {
672 last_shuttle_request = now;
674 bool neg = (shuttle_fract < 0.0);
676 double fract = 1 - sqrt (1 - (shuttle_fract * shuttle_fract)); // Formula A1
682 session->request_transport_speed (8.0 * fract); // Formula A2
683 shuttle_box.queue_draw ();
687 ARDOUR_UI::shuttle_box_expose (GdkEventExpose* event)
690 Glib::RefPtr<Gdk::Window> win (shuttle_box.get_window());
692 /* redraw the background */
694 win->draw_rectangle (shuttle_box.get_style()->get_bg_gc (shuttle_box.get_state()),
696 event->area.x, event->area.y,
697 event->area.width, event->area.height);
700 x = (gint) floor ((shuttle_box.get_width() / 2.0) + (0.5 * (shuttle_box.get_width() * shuttle_fract)));
704 win->draw_line (shuttle_box.get_style()->get_fg_gc (shuttle_box.get_state()),
708 shuttle_box.get_height());
713 ARDOUR_UI::shuttle_unit_clicked ()
715 if (shuttle_unit_menu == 0) {
716 shuttle_unit_menu = dynamic_cast<Menu*> (ActionManager::get_widget ("/ShuttleUnitPopup"));
718 shuttle_unit_menu->popup (1, 0);
722 ARDOUR_UI::set_shuttle_units (ShuttleUnits u)
724 switch ((shuttle_units = u)) {
726 static_cast<Label*>(shuttle_units_button.get_child())->set_text ("% ");
729 static_cast<Label*>(shuttle_units_button.get_child())->set_text (_("st"));
735 ARDOUR_UI::shuttle_style_changed ()
737 ustring str = shuttle_style_button.get_active_text ();
739 if (str == _("sprung")) {
740 set_shuttle_behaviour (Sprung);
741 } else if (str == _("wheel")) {
742 set_shuttle_behaviour (Wheel);
748 ARDOUR_UI::set_shuttle_behaviour (ShuttleBehaviour b)
750 switch ((shuttle_behaviour = b)) {
752 shuttle_style_button.set_active_text (_("sprung"));
754 shuttle_box.queue_draw ();
756 if (session->transport_rolling()) {
757 shuttle_fract = SHUTTLE_FRACT_SPEED1;
758 session->request_transport_speed (1.0);
763 shuttle_style_button.set_active_text (_("wheel"));
769 ARDOUR_UI::update_speed_display ()
772 if (last_speed_displayed != 0) {
773 speed_display_label.set_text (_("stopped"));
774 last_speed_displayed = 0;
780 float x = session->transport_speed ();
782 if (x != last_speed_displayed) {
785 if (shuttle_units == Percentage) {
786 snprintf (buf, sizeof (buf), "%.4f", x);
789 snprintf (buf, sizeof (buf), "< %.1f", 12.0 * fast_log2 (-x));
791 snprintf (buf, sizeof (buf), "> %.1f", 12.0 * fast_log2 (x));
794 speed_display_label.set_text (buf);
796 speed_display_label.set_text (_("stopped"));
799 last_speed_displayed = x;
804 ARDOUR_UI::set_transport_sensitivity (bool yn)
806 ActionManager::set_sensitive (ActionManager::transport_sensitive_actions, yn);
807 shuttle_box.set_sensitive (yn);
811 ARDOUR_UI::editor_realized ()
813 set_size_request_to_display_given_text (speed_display_box, _("stopped"), 2, 2);
814 /* XXX: this should really be saved in instant.xml or something similar and restored from there */
815 shuttle_style_button.set_active_text (_("sprung"));
816 const guint32 FUDGE = 20; // Combo's are stupid - they steal space from the entry for the button
817 set_size_request_to_display_given_text (shuttle_style_button, _("sprung"), 2+FUDGE, 10);
821 ARDOUR_UI::sync_option_changed ()
829 which = sync_option_combo.get_active_text();
831 if (which == positional_sync_strings[Session::None]) {
832 session->request_slave_source (Session::None);
833 } else if (which == positional_sync_strings[Session::MTC]) {
834 session->request_slave_source (Session::MTC);
835 } else if (which == positional_sync_strings[Session::JACK]) {
836 session->request_slave_source (Session::JACK);
841 ARDOUR_UI::maximise_editing_space ()
847 transport_tearoff->set_visible (false);
848 editor->maximise_editing_space ();
852 ARDOUR_UI::restore_editing_space ()
858 transport_tearoff->set_visible (true);
859 editor->restore_editing_space ();