Add 'delta edit cursor' option to primary and secondary clocks. When in this mode...
authorDoug McLain <doug@nostar.net>
Mon, 14 May 2007 02:48:28 +0000 (02:48 +0000)
committerDoug McLain <doug@nostar.net>
Mon, 14 May 2007 02:48:28 +0000 (02:48 +0000)
git-svn-id: svn://localhost/ardour2/trunk@1838 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour.colors
gtk2_ardour/ardour.menus
gtk2_ardour/ardour2_ui.rc
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui2.cc
gtk2_ardour/ardour_ui_ed.cc
gtk2_ardour/ardour_ui_options.cc
gtk2_ardour/audio_clock.cc
gtk2_ardour/audio_clock.h
libs/ardour/ardour/configuration_vars.h

index 0bc9565c8ae4f95a41b43900b8c972ae0ac90697..181896589fd4e25af3b8cfd646e37704ce296eb0 100644 (file)
@@ -105,6 +105,6 @@ cTrimHandleLockedStart 0.92 0.06 0.06 0.16
 cTrimHandleLockedEnd 0.92 0.06 0.06 0.16
 cTrimHandleStart 0.10 0.00 1.00 0.27
 cTrimHandleEnd 0.10 0.00 1.00 0.27
-cEditCursor    0.00 0.00 1.00 1.00
-cPlayHead      1.00 0.00 0.00 1.00
+cPlayHead 1.00 0.00 0.00 1.00
+cEditCursor 0.00 0.00 1.00 1.00
 
index 635def7794d224895f141d78d9b07ea13dcdbda9..2c40704e4e819dc8d58a4e1798b698a395c3dd27 100644 (file)
                <menuitem action='StopTransportAtEndOfSession'/>
                <menuitem action='GainReduceFastTransport'/>
               <separator/>
+                               <menuitem action='PrimaryClockDeltaEditCursor'/>
+                               <menuitem action='SecondaryClockDeltaEditCursor'/>
+                       <separator/>
          </menu>
         <menu name='Help' action='Help'>
             <menuitem action='About'/>
index 82da69ebf575a5abdc31a865be0961df499c5b41..d16e8fbe20bb64110832963f8e44af0f8f450e3e 100644 (file)
@@ -85,6 +85,7 @@ style "time_axis_view_item_name"
 
 style "default_base" = "medium_text"
 {
+  
   GtkWidget::cursor_color =  {1.0, 1.0, 1.0 }
   GtkButton::default_border = { 0, 0, 0, 0 }
   GtkButton::default_outside_border = { 0, 0, 0, 0 }
@@ -144,7 +145,7 @@ style "transport_base" = "medium_bold_text"
 /*
 style "black_mackie_menu_bar"
 {
-  font_name = "sans bold 9"
+  font_name = "sans bold 8"
   fg[NORMAL] = { 1.0, 1.0, 1.0 }
   bg[NORMAL] = { 0, 0, 0 }
 }
@@ -664,6 +665,11 @@ style "transport_clock_display"
        bg[ACTIVE] = { 0.0, 0.0, 0.0 }
 }
 
+style "transport_clock_display_delta" = "transport_clock_display"
+{
+       fg[NORMAL] = { 0.30, 0.30, 1.0 }
+}
+
 style "tempo_meter_clock_display"
 {
        font_name = "sans 7"
@@ -1282,6 +1288,8 @@ widget "*BigClockNonRecording" style:highest "non_recording_big_clock_display"
 widget "*BigClockRecording" style:highest "recording_big_clock_display"
 widget "*TransportClockDisplay" style:highest "transport_clock_display"
 widget "*SecondaryClockDisplay" style:highest "transport_clock_display"
+widget "*TransportClockDisplayDelta" style:highest "transport_clock_display_delta"
+widget "*SecondaryClockDisplayDelta" style:highest "transport_clock_display_delta"
 widget "*AudioClockFramesUpperInfo" style:highest "tempo_meter_clock_display"
 widget "*AudioClockFramesLowerInfo" style:highest "tempo_meter_clock_display"
 widget "*AudioClockSMPTEUpperInfo" style:highest "tempo_meter_clock_display"
index a38196d642c6bf3194c3b9a1d0198a1012674b99..e3c476a854708caf585950357345d5d68a567b0b 100644 (file)
@@ -94,7 +94,7 @@ ARDOUR_UI *ARDOUR_UI::theArdourUI = 0;
 sigc::signal<void,bool> ARDOUR_UI::Blink;
 sigc::signal<void>      ARDOUR_UI::RapidScreenUpdate;
 sigc::signal<void>      ARDOUR_UI::SuperRapidScreenUpdate;
-sigc::signal<void,nframes_t> ARDOUR_UI::Clock;
+sigc::signal<void,nframes_t, bool, nframes_t> ARDOUR_UI::Clock;
 
 ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], string rcfile)
 
@@ -1520,7 +1520,7 @@ void
 ARDOUR_UI::update_clocks ()
 {
        if (!editor || !editor->dragging_playhead()) {
-               Clock (session->audible_frame()); /* EMIT_SIGNAL */
+               Clock (session->audible_frame(), false, editor->edit_cursor_position(false)); /* EMIT_SIGNAL */
        }
 }
 
@@ -2654,8 +2654,17 @@ ARDOUR_UI::use_config ()
 void
 ARDOUR_UI::update_transport_clocks (nframes_t pos)
 {
-       primary_clock.set (pos);
-       secondary_clock.set (pos);
+       if (Config->get_primary_clock_delta_edit_cursor()) {
+               primary_clock.set (pos, false, editor->edit_cursor_position(false), 1);
+       } else {
+               primary_clock.set (pos, 0, true);
+       }
+
+       if (Config->get_secondary_clock_delta_edit_cursor()) {
+               secondary_clock.set (pos, false, editor->edit_cursor_position(false), 2);
+       } else {
+               secondary_clock.set (pos);
+       }
 
        if (big_clock_window) {
                big_clock.set (pos);
index d0c1e7194a1d117588be78d426858070e8f8da75..920cb97f44a51ec189794488ead3ab3b57bc4a80 100644 (file)
@@ -156,7 +156,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        static sigc::signal<void,bool> Blink;
        static sigc::signal<void>      RapidScreenUpdate;
        static sigc::signal<void>      SuperRapidScreenUpdate;
-       static sigc::signal<void,nframes_t> Clock;
+       static sigc::signal<void,nframes_t, bool, nframes_t> Clock;
 
        /* this is a helper function to centralize the (complex) logic for
           blinking rec-enable buttons.
@@ -690,6 +690,8 @@ class ARDOUR_UI : public Gtkmm2ext::UI
        void toggle_ShowSoloMutes();
        void toggle_LatchedRecordEnable ();
        void toggle_RegionEquivalentsOverlap ();
+       void toggle_PrimaryClockDeltaEditCursor ();
+       void toggle_SecondaryClockDeltaEditCursor ();
 
        void mtc_port_changed ();
        void map_solo_model ();
index f3e8b6e344ed3f124ab939d1c7a41ed4fe83ae6c..806ee8999e7ebde2fc2a9c1f6241217f36d2810d 100644 (file)
@@ -271,8 +271,8 @@ ARDOUR_UI::setup_transport ()
 
        /* clocks, etc. */
 
-       ARDOUR_UI::Clock.connect (bind (mem_fun (primary_clock, &AudioClock::set), false));
-       ARDOUR_UI::Clock.connect (bind (mem_fun (secondary_clock, &AudioClock::set), false));
+       ARDOUR_UI::Clock.connect (bind (mem_fun (primary_clock, &AudioClock::set), 1));
+       ARDOUR_UI::Clock.connect (bind (mem_fun (secondary_clock, &AudioClock::set), 2));
 
        primary_clock.ValueChanged.connect (mem_fun(*this, &ARDOUR_UI::primary_clock_value_changed));
        secondary_clock.ValueChanged.connect (mem_fun(*this, &ARDOUR_UI::secondary_clock_value_changed));
index 22ef689a0ba5a3bcc47c59c88f9ba6d696a6ded4..d4a7a183e4e0ede49941c17679de84ba60243367 100644 (file)
@@ -412,6 +412,8 @@ ARDOUR_UI::install_actions ()
        ActionManager::register_toggle_action (option_actions, X_("GainReduceFastTransport"), _("-12dB gain reduce ffwd/rewind"), mem_fun (*this, &ARDOUR_UI::toggle_GainReduceFastTransport));
        ActionManager::register_toggle_action (option_actions, X_("LatchedRecordEnable"), _("Rec-enable stays engaged at stop"), mem_fun (*this, &ARDOUR_UI::toggle_LatchedRecordEnable));
        ActionManager::register_toggle_action (option_actions, X_("RegionEquivalentsOverlap"), _("Region equivalents overlap"), mem_fun (*this, &ARDOUR_UI::toggle_RegionEquivalentsOverlap));
+       ActionManager::register_toggle_action (option_actions, X_("PrimaryClockDeltaEditCursor"), _("Primary Clock delta to edit cursor"), mem_fun (*this, &ARDOUR_UI::toggle_PrimaryClockDeltaEditCursor));
+       ActionManager::register_toggle_action (option_actions, X_("SecondaryClockDeltaEditCursor"), _("Secondary Clock delta to edit cursor"), mem_fun (*this, &ARDOUR_UI::toggle_SecondaryClockDeltaEditCursor));      
 
        act = ActionManager::register_toggle_action (option_actions, X_("DoNotRunPluginsWhileRecording"), _("Do not run plugins while recording"), mem_fun (*this, &ARDOUR_UI::toggle_DoNotRunPluginsWhileRecording));
        ActionManager::session_sensitive_actions.push_back (act);
index 34431aeafbe12c34370163c2a1f0dc8355621ce5..d456e30146517440314744a86d9cebe73fe8e813 100644 (file)
@@ -434,6 +434,18 @@ ARDOUR_UI::toggle_ShowSoloMutes()
        ActionManager::toggle_config_state ("options", "ShowSoloMutes", &Configuration::set_show_solo_mutes, &Configuration::get_show_solo_mutes);
 }
 
+void
+ARDOUR_UI::toggle_PrimaryClockDeltaEditCursor()
+{
+       ActionManager::toggle_config_state ("options", "PrimaryClockDeltaEditCursor", &Configuration::set_primary_clock_delta_edit_cursor, &Configuration::get_primary_clock_delta_edit_cursor);
+}
+
+void
+ARDOUR_UI::toggle_SecondaryClockDeltaEditCursor()
+{
+       ActionManager::toggle_config_state ("options", "SecondaryClockDeltaEditCursor", &Configuration::set_secondary_clock_delta_edit_cursor, &Configuration::get_secondary_clock_delta_edit_cursor);
+}
+
 void
 ARDOUR_UI::mtc_port_changed ()
 {
@@ -962,7 +974,11 @@ ARDOUR_UI::parameter_changed (const char* parameter_name)
                }
        } else if (PARAM_IS ("use-overlap-equivalency")) {
                ActionManager::map_some_state ("options", "RegionEquivalentsOverlap", &Configuration::get_use_overlap_equivalency);
-       }
+       } else if (PARAM_IS ("primary-clock-delta-edit-cursor")) {
+               ActionManager::map_some_state ("options",  "PrimaryClockDeltaEditCursor", &Configuration::get_primary_clock_delta_edit_cursor);
+       } else if (PARAM_IS ("secondary-clock-delta-edit-cursor")) {
+               ActionManager::map_some_state ("options",  "SecondaryClockDeltaEditCursor", &Configuration::get_secondary_clock_delta_edit_cursor);
+       } 
                           
 
 #undef PARAM_IS
index 28505ab46d6f06baa9770c43f37c12b7644a6549..a86b51d1fbc8401c8e30af22ae28820f1d432846 100644 (file)
@@ -77,6 +77,8 @@ AudioClock::AudioClock (std::string clock_name, bool transient, std::string widg
 {
        session = 0;
        last_when = 0;
+       last_pdelta = 0;
+       last_sdelta = 0;
        key_entry_state = 0;
        ops_menu = 0;
        dragging = false;
@@ -383,17 +385,41 @@ AudioClock::on_realize ()
 }
 
 void
-AudioClock::set (nframes_t when, bool force)
+AudioClock::set (nframes_t when, bool force, nframes_t offset, int which)
 {
 
        if ((!force && !is_visible()) || session == 0) {
                return;
        }
        
-       if (when == last_when && !force) {
+       if (when == last_when && !offset && !force) {
                return;
        }
 
+       bool pdelta = Config->get_primary_clock_delta_edit_cursor();
+       bool sdelta = Config->get_secondary_clock_delta_edit_cursor();
+
+       if (offset && which == 1 && pdelta) {
+               when = (when > offset) ? when - offset : offset - when;
+       } else if (offset && which == 2 && sdelta) {
+               when = (when > offset) ? when - offset : offset - when;
+       }
+
+       if (which == 1 && pdelta && !last_pdelta) {
+               cout << "set_widget_name() called" << endl;
+               set_widget_name("TransportClockDisplayDelta");
+               last_pdelta = true;
+       } else if (which == 1 && !pdelta && last_pdelta) {
+               set_widget_name("TransportClockDisplay");
+               last_pdelta = false;
+       } else if (which == 2  && sdelta && !last_sdelta) {
+               set_widget_name("SecondaryClockDisplayDelta");
+               last_sdelta = true;
+       } else if (which == 2 && !sdelta && last_sdelta) {
+               set_widget_name("SecondaryClockDisplay");
+               last_sdelta = false;
+       }
+
        switch (_mode) {
        case SMPTE:
                set_smpte (when, force);
index f0790dcbc8748e92e7c4ded609b729ba457c3c0f..d0c5afb658a957e3269459c261b65a81e94615d9 100644 (file)
@@ -46,7 +46,7 @@ class AudioClock : public Gtk::HBox
 
        Mode mode() const { return _mode; }
        
-       void set (nframes_t, bool force = false);
+       void set (nframes_t, bool force = false, nframes_t offset = 0, int which = 0);
        void set_mode (Mode);
        
        void set_widget_name (std::string);
@@ -149,6 +149,8 @@ class AudioClock : public Gtk::HBox
        Gtk::Frame     clock_frame;
 
        nframes_t last_when;
+       bool last_pdelta;
+       bool last_sdelta;
 
        uint32_t last_hrs;
        uint32_t last_mins;
index 395732e72701b47bad9b24080883136bd5bd255d..bed2af5f942a6c3573190ecc02dd08e3b390e20c 100644 (file)
@@ -112,6 +112,8 @@ CONFIG_VARIABLE (SlaveSource, slave_source, "slave-source", None)
 CONFIG_VARIABLE (ShuttleBehaviour, shuttle_behaviour, "shuttle-behaviour", Sprung)
 CONFIG_VARIABLE (ShuttleUnits, shuttle_units, "shuttle-units", Percentage)
 CONFIG_VARIABLE (bool, quieten_at_speed, "quieten-at-speed", true)
+CONFIG_VARIABLE (bool, primary_clock_delta_edit_cursor, "primary-clock-delta-edit-cursor", false)
+CONFIG_VARIABLE (bool, secondary_clock_delta_edit_cursor, "secondary-clock-delta-edit-cursor", false)
 
 /* timecode and sync */