summaryrefslogtreecommitdiff
path: root/gtk2_ardour/ardour_ui2.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-04-15 18:04:23 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-04-15 18:04:23 +0000
commit54d9f2f2d83af1f0f44579fe2ebf090e68259938 (patch)
tree44a61c36048be6edabeb5fc5461d47c95623f79f /gtk2_ardour/ardour_ui2.cc
parentece2bacb2c7d7f72b6a25a75760837efce0d5e30 (diff)
first half of the mega-by-hand-commit-by-commit merge from 2.X
git-svn-id: svn://localhost/ardour2/branches/3.0@4980 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/ardour_ui2.cc')
-rw-r--r--gtk2_ardour/ardour_ui2.cc46
1 files changed, 31 insertions, 15 deletions
diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc
index abc4163d5e..f2fb31ddbf 100644
--- a/gtk2_ardour/ardour_ui2.cc
+++ b/gtk2_ardour/ardour_ui2.cc
@@ -189,11 +189,6 @@ ARDOUR_UI::transport_forwarding ()
void
ARDOUR_UI::setup_transport ()
{
-#ifdef GTKOSX
- const guint32 FUDGE = 38; // Combo's are stupid - they steal space from the entry for the button
-#else
- const guint32 FUDGE = 24; // Combo's are stupid - they steal space from the entry for the button
-#endif
transport_tearoff = manage (new TearOff (transport_tearoff_hbox));
transport_tearoff->set_name ("TransportBase");
@@ -376,6 +371,7 @@ ARDOUR_UI::setup_transport ()
speed_display_box.add (speed_display_label);
speed_display_box.set_name (X_("ShuttleDisplay"));
+ set_size_request_to_display_given_text (speed_display_label, X_("> 24.0"), 2, 2);
shuttle_units_button.set_name (X_("ShuttleButton"));
shuttle_units_button.signal_clicked().connect (mem_fun(*this, &ARDOUR_UI::shuttle_unit_clicked));
@@ -385,8 +381,7 @@ ARDOUR_UI::setup_transport ()
vector<string> shuttle_strings;
shuttle_strings.push_back (_("sprung"));
shuttle_strings.push_back (_("wheel"));
- set_size_request_to_display_given_text (shuttle_style_button, shuttle_strings, 6+FUDGE, 10);
- set_popdown_strings (shuttle_style_button, shuttle_strings);
+ set_popdown_strings (shuttle_style_button, shuttle_strings, true);
shuttle_style_button.signal_changed().connect (mem_fun (*this, &ARDOUR_UI::shuttle_style_changed));
Frame* sdframe = manage (new Frame);
@@ -396,7 +391,9 @@ ARDOUR_UI::setup_transport ()
mtc_port_changed ();
sync_option_combo.signal_changed().connect (mem_fun (*this, &ARDOUR_UI::sync_option_changed));
- set_size_request_to_display_given_text (sync_option_combo, X_("Igternal"), 4+FUDGE, 10);
+ // XXX HOW TO USE set_popdown_strings() and combo_fudge with this when we don't know
+ // the real strings till later?
+ set_size_request_to_display_given_text (sync_option_combo, X_("Igternal"), 4+COMBO_FUDGE, 10);
shbox->pack_start (*sdframe, false, false);
shbox->pack_start (shuttle_units_button, true, true);
@@ -777,15 +774,33 @@ ARDOUR_UI::use_shuttle_fract (bool force)
last_shuttle_request = now;
- bool neg = (shuttle_fract < 0.0);
+ if (Config->get_shuttle_units() == Semitones) {
+
+ const double step = 1.0 / 24.0; // range is 24 semitones up & down
+ double semitones;
+ double speed;
+
+ semitones = round (shuttle_fract / step);
+ speed = pow (2.0, (semitones / 12.0));
+
+ session->request_transport_speed (speed);
+
+ } else {
+
+ bool neg;
+ double fract;
+
+ neg = (shuttle_fract < 0.0);
- double fract = 1 - sqrt (1 - (shuttle_fract * shuttle_fract)); // Formula A1
+ fract = 1 - sqrt (1 - (shuttle_fract * shuttle_fract)); // Formula A1
- if (neg) {
- fract = -fract;
+ if (neg) {
+ fract = -fract;
+ }
+
+ session->request_transport_speed (shuttle_max_speed * fract);
}
- session->request_transport_speed (shuttle_max_speed * fract); // Formula A2
shuttle_box.queue_draw ();
}
@@ -856,10 +871,11 @@ ARDOUR_UI::update_speed_display ()
if (Config->get_shuttle_units() == Percentage) {
snprintf (buf, sizeof (buf), "%.2f", x);
} else {
+
if (x < 0) {
- snprintf (buf, sizeof (buf), "< %.1f", 12.0 * fast_log2 (-x));
+ snprintf (buf, sizeof (buf), "< %d", (int) round (12.0 * fast_log2 (-x)));
} else {
- snprintf (buf, sizeof (buf), "> %.1f", 12.0 * fast_log2 (x));
+ snprintf (buf, sizeof (buf), "> %d", (int) round (12.0 * fast_log2 (x)));
}
}
speed_display_label.set_text (buf);