Make editor route list rec button respect group settings.
[ardour.git] / gtk2_ardour / ardour_ui2.cc
index 47218e518b28d476b93ff3a63659b0d6b85d109d..92fadd198bae6c881ab8c0ddbe00bc06fb8c52af 100644 (file)
 #include <cmath>
 
 #include <sigc++/bind.h>
-#include <pbd/error.h>
-#include <pbd/basename.h>
-#include <pbd/fastlog.h>
+#include "pbd/error.h"
+#include "pbd/basename.h"
+#include "pbd/fastlog.h"
 #include <gtkmm2ext/utils.h>
 #include <gtkmm2ext/click_box.h>
 #include <gtkmm2ext/tearoff.h>
 
-#include <ardour/audioengine.h>
-#include <ardour/ardour.h>
-#include <ardour/profile.h>
-#include <ardour/route.h>
+#include "ardour/audioengine.h"
+#include "ardour/ardour.h"
+#include "ardour/profile.h"
+#include "ardour/route.h"
 
 #include "ardour_ui.h"
 #include "keyboard.h"
@@ -192,6 +192,10 @@ ARDOUR_UI::setup_transport ()
        transport_tearoff = manage (new TearOff (transport_tearoff_hbox));
        transport_tearoff->set_name ("TransportBase");
 
+       if (Profile->get_sae()) {
+               transport_tearoff->set_can_be_torn_off (false);
+       }
+
        transport_hbox.pack_start (*transport_tearoff, true, false);
 
        transport_base.set_name ("TransportBase");
@@ -367,16 +371,17 @@ 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));
        
-       shuttle_style_button.set_name (X_("ShuttleButton"));
+       shuttle_style_button.set_name (X_("ShuttleStyleButton"));
 
        vector<string> shuttle_strings;
        shuttle_strings.push_back (_("sprung"));
        shuttle_strings.push_back (_("wheel"));
-       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);
@@ -386,8 +391,9 @@ ARDOUR_UI::setup_transport ()
 
        mtc_port_changed ();
        sync_option_combo.signal_changed().connect (mem_fun (*this, &ARDOUR_UI::sync_option_changed));
-       const guint32 FUDGE = 25; // Combo's are stupid - they steal space from the entry for the button
-       set_size_request_to_display_given_text (sync_option_combo, X_("Igternal"), 2+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);
@@ -658,7 +664,7 @@ ARDOUR_UI::shuttle_box_button_release (GdkEventButton* ev)
                shuttle_grabbed = false;
                shuttle_box.remove_modal_grab ();
                if (Config->get_shuttle_behaviour() == Sprung) {
-                       if (Config->get_auto_play() || roll_button.get_visual_state()) {
+                       if (session->config.get_auto_play() || roll_button.get_visual_state()) {
                                shuttle_fract = SHUTTLE_FRACT_SPEED1;                           
                                session->request_transport_speed (1.0);
                                stop_button.set_visual_state (0);
@@ -768,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;
 
-       double fract = 1 - sqrt (1 - (shuttle_fract * shuttle_fract)); // Formula A1
+               semitones = round (shuttle_fract / step);
+               speed = pow (2.0, (semitones / 12.0));
+
+               session->request_transport_speed (speed);
+
+       } else {
 
-       if (neg) {
-               fract = -fract;
+               bool neg;
+               double fract;
+               
+               neg = (shuttle_fract < 0.0);
+
+               fract = 1 - sqrt (1 - (shuttle_fract * shuttle_fract)); // Formula A1
+
+               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 ();
 }
 
@@ -847,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);
@@ -875,9 +900,8 @@ ARDOUR_UI::editor_realized ()
        Config->map_parameters (mem_fun (*this, &ARDOUR_UI::parameter_changed));
 
        set_size_request_to_display_given_text (speed_display_box, _("-0.55"), 2, 2);
-       const guint32 FUDGE = 25; // Combo's are stupid - they steal space from the entry for the button
-       set_size_request_to_display_given_text (shuttle_style_button, _("sprung"), 2+FUDGE, 10);
-       reset_dpi();
+       cerr << "I commented out line line 889 in ardour_ui2.cc, because it made ardour crash somewhere in Gnome::Canvas::Text" << endl;
+       //reset_dpi();
 }
 
 void