From 605519009434e022b5f6bb5c59d074cfe4b5fe20 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 14 Nov 2012 00:15:54 +0000 Subject: improve negative [offset] TC entry * make mouse interaction work with negative TC * show minus-sign when edit is negative TODO: ?minus? sign indicator when text editing a negative TC. git-svn-id: svn://localhost/ardour2/branches/3.0@13488 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/audio_clock.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'gtk2_ardour/audio_clock.cc') diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 2a2cee60d3..4d75584f98 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -1373,6 +1373,9 @@ AudioClock::on_key_press_event (GdkEventKey* ev) case GDK_KP_Subtract: if (_negative_allowed && input_string.empty()) { edit_is_negative = true; + edit_string.replace(0,1,"-"); + _layout->set_text (edit_string); + queue_draw (); } else { end_edit_relative (false); } @@ -1440,6 +1443,15 @@ AudioClock::on_key_press_event (GdkEventKey* ev) highlight_length = merge_input_and_edit_string (); } + if (edit_is_negative) { + edit_string.replace(0,1,"-"); + } else { + /* TODO think about this case. + * The TC will be positive unless the edit is relative. + */ + edit_string.replace(0,1," "); + } + show_edit_status (highlight_length); _layout->set_text (edit_string); queue_draw (); @@ -1721,7 +1733,7 @@ AudioClock::on_scroll_event (GdkEventScroll *ev) frames *= 10; } - if ((double)current_time() - (double)frames < 0.0) { + if (!_negative_allowed && (double)current_time() - (double)frames < 0.0) { set (0, true); } else { set (current_time() - frames, true); -- cgit v1.2.3