Give just one system tab rather than mono / stereo. Fix bundles-only mode of the...
[ardour.git] / gtk2_ardour / ardour_ui2.cc
index 57c3df4cdf2562271cd9e902cd6b440653121c05..b54fe9225a729c0e0003b728d3f6bfc97b9e4296 100644 (file)
@@ -127,65 +127,20 @@ ARDOUR_UI::display_message (const char *prefix, gint prefix_len, RefPtr<TextBuff
 #endif
 }
 
-void
-ARDOUR_UI::transport_stopped ()
-{
-       stop_button.set_visual_state (1);
-
-       roll_button.set_visual_state (0);
-       play_selection_button.set_visual_state (0);
-       auto_loop_button.set_visual_state (0);
-
-       shuttle_fract = 0;
-       shuttle_box.queue_draw ();
-
-       update_disk_space ();
-}
-
-void
-ARDOUR_UI::transport_rolling ()
+#if 0
+static bool
+null_crossing (GdkEventCrossing* /* ignored */)
 {
-       stop_button.set_visual_state (0);
-       if (session->get_play_range()) {
-               play_selection_button.set_visual_state (1);
-               roll_button.set_visual_state (0);
-               auto_loop_button.set_visual_state (0);
-
-       } else if (session->get_play_loop ()) {
-               auto_loop_button.set_visual_state (1);
-               play_selection_button.set_visual_state (0);
-               roll_button.set_visual_state (0);
-
-       } else {
-
-               roll_button.set_visual_state (1);
-               play_selection_button.set_visual_state (0);
-               auto_loop_button.set_visual_state (0);
-       }
-
-       /* reset shuttle controller */
-
-       shuttle_fract = SHUTTLE_FRACT_SPEED1;  /* speed = 1.0, believe it or not */
-       shuttle_box.queue_draw ();
-}
-
-void
-ARDOUR_UI::transport_rewinding ()
-{
-       stop_button.set_visual_state (0);
-       roll_button.set_visual_state (1);
-       play_selection_button.set_visual_state (0);
-       auto_loop_button.set_visual_state (0);
+       return true;
 }
 
-void
-ARDOUR_UI::transport_forwarding ()
+static void
+block_prelight (Gtk::Widget& w)
 {
-       stop_button.set_visual_state (0);
-       roll_button.set_visual_state (1);
-       play_selection_button.set_visual_state (0);
-       auto_loop_button.set_visual_state (0);
+       w.signal_enter_notify_event().connect (sigc::ptr_fun (null_crossing), false);
+       w.signal_leave_notify_event().connect (sigc::ptr_fun (null_crossing), false);
 }
+#endif
 
 void
 ARDOUR_UI::setup_transport ()
@@ -232,6 +187,7 @@ ARDOUR_UI::setup_transport ()
        punch_out_button.set_name ("TransportButton");
        click_button.set_name ("TransportButton");
        time_master_button.set_name ("TransportButton");
+       sync_button.set_name ("TransportSyncButton");
 
        stop_button.set_size_request(29, -1);
        roll_button.set_size_request(29, -1);
@@ -285,6 +241,8 @@ ARDOUR_UI::setup_transport ()
        act->connect_proxy (play_selection_button);
        act = ActionManager::get_action (X_("Transport"), X_("ToggleTimeMaster"));
        act->connect_proxy (time_master_button);
+       act = ActionManager::get_action (X_("Transport"), X_("ToggleExternalSync"));
+       act->connect_proxy (sync_button);
 
        ARDOUR_UI::instance()->tooltips().set_tip (roll_button, _("Play from playhead"));
        ARDOUR_UI::instance()->tooltips().set_tip (stop_button, _("Stop playback"));
@@ -299,12 +257,13 @@ ARDOUR_UI::setup_transport ()
        ARDOUR_UI::instance()->tooltips().set_tip (punch_in_button, _("Start recording at auto-punch start"));
        ARDOUR_UI::instance()->tooltips().set_tip (punch_out_button, _("Stop recording at auto-punch end"));
        ARDOUR_UI::instance()->tooltips().set_tip (click_button, _("Enable/Disable audio click"));
-       ARDOUR_UI::instance()->tooltips().set_tip (sync_option_combo, _("Positional sync source"));
+       ARDOUR_UI::instance()->tooltips().set_tip (sync_button, _("Enable/Disable external positional sync"));
        ARDOUR_UI::instance()->tooltips().set_tip (time_master_button, _("Does Ardour control the time?"));
        ARDOUR_UI::instance()->tooltips().set_tip (shuttle_box, _("Shuttle speed control"));
        ARDOUR_UI::instance()->tooltips().set_tip (shuttle_units_button, _("Select semitones or %%-age for speed display"));
        ARDOUR_UI::instance()->tooltips().set_tip (speed_display_box, _("Current transport speed"));
 
+
        shuttle_box.set_flags (CAN_FOCUS);
        shuttle_box.add_events (Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::BUTTON_PRESS_MASK|Gdk::POINTER_MOTION_MASK|Gdk::SCROLL_MASK);
        shuttle_box.set_size_request (100, 15);
@@ -391,11 +350,8 @@ ARDOUR_UI::setup_transport ()
        sdframe->set_shadow_type (SHADOW_IN);
        sdframe->add (speed_display_box);
 
-       mtc_port_changed ();
-       sync_option_combo.signal_changed().connect (mem_fun (*this, &ARDOUR_UI::sync_option_changed));
-       // 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);
+       /* translators: Egternal is "External" with a descender character */
+       set_size_request_to_display_given_text (sync_button, X_("Egternal"), 4, 10);
 
        shbox->pack_start (*sdframe, false, false);
        shbox->pack_start (shuttle_units_button, true, true);
@@ -422,7 +378,7 @@ ARDOUR_UI::setup_transport ()
 
        if (!Profile->get_sae()) {
                VBox* time_controls_box = manage (new VBox);
-               time_controls_box->pack_start (sync_option_combo, false, false);
+               time_controls_box->pack_start (sync_button, false, false);
                time_controls_box->pack_start (time_master_button, false, false);
                clock_box->pack_start (*time_controls_box, false, false, 1);
        }
@@ -545,6 +501,29 @@ ARDOUR_UI::solo_blink (bool onoff)
        }
 }
 
+void
+ARDOUR_UI::sync_blink (bool onoff)
+{
+       if (session == 0 || !session->config.get_external_sync()) {
+               /* internal sync */
+               sync_button.set_visual_state (0);
+               return;
+       }
+
+       if (!session->transport_locked()) {
+               /* not locked, so blink on and off according to the onoff argument */
+
+               if (onoff) {
+                       sync_button.set_visual_state (1); // "-active"
+               } else {
+                       sync_button.set_visual_state (0); // normal
+               }
+       } else {
+               /* locked */
+               sync_button.set_visual_state (1); // "-active"
+       }
+}
+
 void
 ARDOUR_UI::audition_blink (bool onoff)
 {
@@ -905,17 +884,6 @@ ARDOUR_UI::editor_realized ()
        reset_dpi ();
 }
 
-void
-ARDOUR_UI::sync_option_changed ()
-{
-       if (session) {
-               ustring txt = sync_option_combo.get_active_text ();
-               if (txt.length()) {
-                       session->request_slave_source (string_to_slave_source (txt));
-               }
-       }
-}
-
 void
 ARDOUR_UI::maximise_editing_space ()
 {