From 3cb2f25d898acbc52ec3a94f67f86382cf6c39ef Mon Sep 17 00:00:00 2001 From: Colin Fletcher Date: Tue, 16 Jun 2015 16:18:23 +0100 Subject: Add 'accept on focus out' parameter (default false) to AudioClock If this parameter is passed as 'true', then edits to the clock will be accepted when the user clicks away from the clock, rather than unconditionally discarded as hitherto. --- gtk2_ardour/audio_clock.cc | 6 ++++-- gtk2_ardour/audio_clock.h | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 345f4f79c3..b64e54e95e 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -65,13 +65,15 @@ const double AudioClock::x_leading_padding = 6.0; #define TXTSPAN "" AudioClock::AudioClock (const string& clock_name, bool transient, const string& widget_name, - bool allow_edit, bool follows_playhead, bool duration, bool with_info) + bool allow_edit, bool follows_playhead, bool duration, bool with_info, + bool accept_on_focus_out) : ops_menu (0) , _name (clock_name) , is_transient (transient) , is_duration (duration) , editable (allow_edit) , _follows_playhead (follows_playhead) + , _accept_on_focus_out (accept_on_focus_out) , _off (false) , em_width (0) , _edit_by_click_field (false) @@ -1688,7 +1690,7 @@ AudioClock::on_focus_out_event (GdkEventFocus* ev) bool ret = CairoWidget::on_focus_out_event (ev); if (editing) { - end_edit (false); + end_edit (_accept_on_focus_out); } return ret; diff --git a/gtk2_ardour/audio_clock.h b/gtk2_ardour/audio_clock.h index 10a24cd3ac..2a49d3a1ec 100644 --- a/gtk2_ardour/audio_clock.h +++ b/gtk2_ardour/audio_clock.h @@ -50,7 +50,8 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr }; AudioClock (const std::string& clock_name, bool is_transient, const std::string& widget_name, - bool editable, bool follows_playhead, bool duration = false, bool with_info = false); + bool editable, bool follows_playhead, bool duration = false, bool with_info = false, + bool accept_on_focus_out = false); ~AudioClock (); Mode mode() const { return _mode; } @@ -122,6 +123,7 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr bool editable; /** true if this clock follows the playhead, meaning that certain operations are redundant */ bool _follows_playhead; + bool _accept_on_focus_out; bool _off; int em_width; bool _edit_by_click_field; -- cgit v1.2.3