-
- bool const neg = (shuttle_fract < 0.0);
- double fract = 1 - sqrt (1 - (shuttle_fract * shuttle_fract)); // Formula A1
-
- if (neg) {
- fract = -fract;
- }
-
- speed = shuttle_max_speed * fract;
- }
-
- _session->request_transport_speed_nonzero (speed);
-
- shuttle_box.queue_draw ();
-}
-
-gint
-ARDOUR_UI::shuttle_box_expose (GdkEventExpose* event)
-{
- gint x;
- Glib::RefPtr<Gdk::Window> win (shuttle_box.get_window());
-
- /* redraw the background */
-
- win->draw_rectangle (shuttle_box.get_style()->get_bg_gc (shuttle_box.get_state()),
- true,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
-
-
- x = (gint) floor ((shuttle_box.get_width() / 2.0) + (0.5 * (shuttle_box.get_width() * shuttle_fract)));
-
- /* draw line */
-
- win->draw_line (shuttle_box.get_style()->get_fg_gc (shuttle_box.get_state()),
- x,
- 0,
- x,
- shuttle_box.get_height());
- return true;
-}
-
-void
-ARDOUR_UI::shuttle_unit_clicked ()
-{
- if (shuttle_unit_menu == 0) {
- shuttle_unit_menu = dynamic_cast<Menu*> (ActionManager::get_widget ("/ShuttleUnitPopup"));
- }
- shuttle_unit_menu->popup (1, gtk_get_current_event_time());
-}
-
-void
-ARDOUR_UI::shuttle_style_changed ()
-{
- string str = shuttle_style_button.get_active_text ();
-
- if (str == _("sprung")) {
- Config->set_shuttle_behaviour (Sprung);
- } else if (str == _("wheel")) {
- Config->set_shuttle_behaviour (Wheel);
- }
-}
-
-void
-ARDOUR_UI::update_speed_display ()
-{
- if (!_session) {
- if (last_speed_displayed != 0) {
- speed_display_label.set_text (_("stop"));
- last_speed_displayed = 0;
- }
- return;
- }
-
- char buf[32];
- float x = _session->transport_speed ();
-
- if (x != last_speed_displayed) {
-
- if (x != 0) {
- if (Config->get_shuttle_units() == Percentage) {
- snprintf (buf, sizeof (buf), "%d", (int) round (x * 100));
- } else {
-
- if (x < 0) {
- snprintf (buf, sizeof (buf), "< %d", (int) round (12.0 * fast_log2 (-x)));
- } else {
- snprintf (buf, sizeof (buf), "> %d", (int) round (12.0 * fast_log2 (x)));
- }
- }
- speed_display_label.set_text (buf);
- } else {
- speed_display_label.set_text (_("stop"));
- }
-
- last_speed_displayed = x;