make metering do the right thing if panner is bypassed
[ardour.git] / gtk2_ardour / ardour_ui2.cc
index 62b827d61a3c0dd426152f4e04a865055ee1b8a8..87d119bd4738a4d180b8d5f3bc8c83a10e0cce98 100644 (file)
 
 */
 
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#endif
+
 #include <fcntl.h>
 #include <signal.h>
 #include <unistd.h>
@@ -46,6 +50,9 @@
 #include "utils.h"
 #include "theme_manager.h"
 #include "midi_tracer.h"
+#include "global_port_matrix.h"
+#include "location_ui.h"
+#include "rc_option_editor.h"
 
 #include "i18n.h"
 
@@ -103,7 +110,6 @@ ARDOUR_UI::setup_windows ()
 
        editor->add_toplevel_controls (top_packer);
 
-       setup_clock ();
        setup_transport();
        build_menu_bar ();
 
@@ -130,7 +136,6 @@ ARDOUR_UI::setup_tooltips ()
        set_tip (punch_in_button, _("Start recording at auto-punch start"));
        set_tip (punch_out_button, _("Stop recording at auto-punch end"));
        set_tip (click_button, _("Enable/Disable audio click"));
-       set_tip (sync_button, _("Enable/Disable external positional sync"));
        set_tip (time_master_button, string_compose (_("Does %1 control the time?"), PROGRAM_NAME));
        set_tip (shuttle_box, _("Shuttle speed control"));
        set_tip (shuttle_units_button, _("Select semitones or %%-age for speed display"));
@@ -140,6 +145,8 @@ ARDOUR_UI::setup_tooltips ()
        set_tip (primary_clock, _("Primary Clock"));
        set_tip (secondary_clock, _("Secondary Clock"));
 
+       synchronize_sync_source_and_video_pullup ();
+
        editor->setup_tooltips ();
 }
 
@@ -163,7 +170,7 @@ ARDOUR_UI::status_bar_button_press (GdkEventButton* ev)
 void
 ARDOUR_UI::display_message (const char *prefix, gint prefix_len, RefPtr<TextBuffer::Tag> ptag, RefPtr<TextBuffer::Tag> mtag, const char *msg)
 {
-       ustring text;
+       string text;
 
        UI::display_message (prefix, prefix_len, ptag, mtag, msg);
 #ifdef TOP_MENUBAR
@@ -189,17 +196,17 @@ ARDOUR_UI::display_message (const char *prefix, gint prefix_len, RefPtr<TextBuff
 XMLNode*
 ARDOUR_UI::tearoff_settings (const char* name) const
 {
-        XMLNode* ui_node = Config->extra_xml(X_("UI"));
+       XMLNode* ui_node = Config->extra_xml(X_("UI"));
         
-        if (ui_node) {
-                XMLNode* tearoff_node = ui_node->child (X_("Tearoffs"));
-                if (tearoff_node) {
-                        XMLNode* mnode = tearoff_node->child (name);
-                        return mnode;
-                }
-        }
+       if (ui_node) {
+               XMLNode* tearoff_node = ui_node->child (X_("Tearoffs"));
+               if (tearoff_node) {
+                       XMLNode* mnode = tearoff_node->child (name);
+                       return mnode;
+               }
+       }
 
-        return 0;
+       return 0;
 }
 
 void
@@ -334,6 +341,8 @@ ARDOUR_UI::setup_transport ()
        ActionManager::get_action ("Transport", "TogglePunchIn")->connect_proxy (punch_in_button);
        ActionManager::get_action ("Transport", "TogglePunchOut")->connect_proxy (punch_out_button);
 
+       click_button.signal_button_press_event().connect (sigc::mem_fun (*this, &ARDOUR_UI::click_button_clicked), false);
+
        preroll_button.set_name ("TransportButton");
        postroll_button.set_name ("TransportButton");
 
@@ -464,10 +473,10 @@ ARDOUR_UI::setup_transport ()
                transport_tearoff_hbox.pack_end (*img, false, false, 6);
        }
 
-        XMLNode* tnode = tearoff_settings ("transport");
-        if (tnode) {
-                transport_tearoff->set_state (*tnode);
-        }
+       XMLNode* tnode = tearoff_settings ("transport");
+       if (tnode) {
+               transport_tearoff->set_state (*tnode);
+       }
 }
 
 void
@@ -516,25 +525,25 @@ ARDOUR_UI::auditioning_changed (bool onoff)
 }
 
 bool
-ARDOUR_UI::audition_alert_press (GdkEventButton* ev)
+ARDOUR_UI::audition_alert_press (GdkEventButton*)
 {
        if (_session) {
                _session->cancel_audition();
        }
-        return true;
+       return true;
 }
 
 bool
-ARDOUR_UI::solo_alert_press (GdkEventButton* ev)
+ARDOUR_UI::solo_alert_press (GdkEventButton*)
 {
-        if (_session) {
-                if (_session->soloing()) {
-                        _session->set_solo (_session->get_routes(), false);
-                } else if (_session->listening()) {
-                        _session->set_listen (_session->get_routes(), false);
-                }
-        }
-        return true;
+       if (_session) {
+               if (_session->soloing()) {
+                       _session->set_solo (_session->get_routes(), false);
+               } else if (_session->listening()) {
+                       _session->set_listen (_session->get_routes(), false);
+               }
+       }
+       return true;
 }
 
 void
@@ -774,7 +783,7 @@ ARDOUR_UI::shuttle_box_motion (GdkEventMotion* ev)
 gint
 ARDOUR_UI::mouse_shuttle (double x, bool force)
 {
-       double half_width = shuttle_box.get_width() / 2.0;
+       double const half_width = shuttle_box.get_width() / 2.0;
        double distance = x - half_width;
 
        if (distance > 0) {
@@ -810,33 +819,28 @@ ARDOUR_UI::use_shuttle_fract (bool force)
 
        last_shuttle_request = now;
 
-       if (Config->get_shuttle_units() == Semitones) {
+       double speed = 0;
 
-               const double step = 1.0 / 24.0; // range is 24 semitones up & down
-               double semitones;
-               double speed;
+       if (Config->get_shuttle_units() == Semitones) {
 
-               semitones = round (shuttle_fract / step);
+               double const step = 1.0 / 24.0; // range is 24 semitones up & down
+               double const 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);
-
-               fract = 1 - sqrt (1 - (shuttle_fract * shuttle_fract)); // Formula A1
+               bool const neg = (shuttle_fract < 0.0);
+               double fract = 1 - sqrt (1 - (shuttle_fract * shuttle_fract)); // Formula A1
 
                if (neg) {
                        fract = -fract;
                }
 
-               _session->request_transport_speed (shuttle_max_speed * fract);
+               speed = shuttle_max_speed * fract;
        }
-
+       
+       _session->request_transport_speed_nonzero (speed);
+       
        shuttle_box.queue_draw ();
 }
 
@@ -878,7 +882,7 @@ ARDOUR_UI::shuttle_unit_clicked ()
 void
 ARDOUR_UI::shuttle_style_changed ()
 {
-       ustring str = shuttle_style_button.get_active_text ();
+       string str = shuttle_style_button.get_active_text ();
 
        if (str == _("sprung")) {
                Config->set_shuttle_behaviour (Sprung);
@@ -964,3 +968,21 @@ ARDOUR_UI::restore_editing_space ()
        transport_tearoff->set_visible (true);
        editor->restore_editing_space ();
 }
+
+bool
+ARDOUR_UI::click_button_clicked (GdkEventButton* ev)
+{
+       if (ev->button != 3) {
+               /* this handler is just for button-3 clicks */
+               return false;
+       }
+
+       RefPtr<Action> act = ActionManager::get_action (X_("Common"), X_("ToggleRCOptionsEditor"));
+       assert (act);
+
+       RefPtr<ToggleAction> tact = RefPtr<ToggleAction>::cast_dynamic (act);
+       tact->set_active ();
+
+       rc_option_editor->set_current_page (_("Misc"));
+       return true;
+}