summaryrefslogtreecommitdiff
path: root/gtk2_ardour/audio_clock.cc
diff options
context:
space:
mode:
authorDoug McLain <doug@nostar.net>2007-05-14 02:48:28 +0000
committerDoug McLain <doug@nostar.net>2007-05-14 02:48:28 +0000
commit9383499ce675fe046b9143c0380fcbc7447b79cc (patch)
tree82c2b10b728a5c54dadad9e924e56c42caf328a5 /gtk2_ardour/audio_clock.cc
parent90f3128d73bc32288d8ce99e81255ea02f54ffbc (diff)
Add 'delta edit cursor' option to primary and secondary clocks. When in this mode, the clocks display the absolute difference between the playhead and the edit cursor
git-svn-id: svn://localhost/ardour2/trunk@1838 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/audio_clock.cc')
-rw-r--r--gtk2_ardour/audio_clock.cc30
1 files changed, 28 insertions, 2 deletions
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc
index 28505ab46d..a86b51d1fb 100644
--- a/gtk2_ardour/audio_clock.cc
+++ b/gtk2_ardour/audio_clock.cc
@@ -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);