From aafa1cc676b6bd4d333f0ff3a09e1effabf979c3 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 26 Apr 2019 22:31:24 +0100 Subject: [PATCH] Make sure at least one position change event is emitted after a timeline drag (with frequent=false), even if lots have been sent with frequent=true. Otherwise the code in the CHNAGE_TYPE_DONE branch of Butler::player_change never gets to seek (since frequent is true, it ignores the signal). Without the seek things go wrong. Believed to fix #1534. --- src/lib/content.cc | 4 ++-- src/lib/content.h | 2 +- src/wx/timeline.cc | 11 ++++++++--- src/wx/timeline.h | 4 ++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/lib/content.cc b/src/lib/content.cc index ca76b01a6..2ca029d5a 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -211,7 +211,7 @@ Content::signal_change (ChangeType c, int p) } void -Content::set_position (shared_ptr film, DCPTime p) +Content::set_position (shared_ptr film, DCPTime p, bool force_emit) { /* video and audio content can modify its position */ @@ -227,7 +227,7 @@ Content::set_position (shared_ptr film, DCPTime p) { boost::mutex::scoped_lock lm (_mutex); - if (p == _position) { + if (p == _position && !force_emit) { cc.abort (); return; } diff --git a/src/lib/content.h b/src/lib/content.h index 96359fadb..4c1d55765 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -135,7 +135,7 @@ public: return _digest; } - void set_position (boost::shared_ptr film, DCPTime); + void set_position (boost::shared_ptr film, DCPTime, bool force_emit = false); /** DCPTime that this content starts; i.e. the time that the first * bit of the content (trimmed or not) will happen. diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc index 1c1da708e..de5f05ae7 100644 --- a/src/wx/timeline.cc +++ b/src/wx/timeline.cc @@ -568,7 +568,12 @@ Timeline::left_up_select (wxMouseEvent& ev) } _content_panel->set_selection (selected_content ()); - set_position_from_event (ev); + /* Since we may have just set change signals back to `not-frequent', we have to + make sure this position change is signalled, even if the position value has + not changed since the last time it was set (with frequent=true). This is + a bit of a hack. + */ + set_position_from_event (ev, true); /* Clear up up the stuff we don't do during drag */ assign_tracks (); @@ -704,7 +709,7 @@ Timeline::maybe_snap (DCPTime a, DCPTime b, optional& nearest_distance) } void -Timeline::set_position_from_event (wxMouseEvent& ev) +Timeline::set_position_from_event (wxMouseEvent& ev, bool force_emit) { if (!_pixels_per_second) { return; @@ -763,7 +768,7 @@ Timeline::set_position_from_event (wxMouseEvent& ev) new_position = DCPTime (); } - _down_view->content()->set_position (film, new_position); + _down_view->content()->set_position (film, new_position, force_emit); film->set_sequence (false); } diff --git a/src/wx/timeline.h b/src/wx/timeline.h index 89fd94179..a7f345863 100644 --- a/src/wx/timeline.h +++ b/src/wx/timeline.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2018 Carl Hetherington + Copyright (C) 2013-2019 Carl Hetherington This file is part of DCP-o-matic. @@ -95,7 +95,7 @@ private: void film_content_change (ChangeType type, int, bool frequent); void resized (); void assign_tracks (); - void set_position_from_event (wxMouseEvent &); + void set_position_from_event (wxMouseEvent& ev, bool force_emit = false); void clear_selection (); void recreate_views (); void setup_scrollbars (); -- 2.30.2