Make sure at least one position change event is emitted after
authorCarl Hetherington <cth@carlh.net>
Fri, 26 Apr 2019 21:31:24 +0000 (22:31 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 26 Apr 2019 21:31:24 +0000 (22:31 +0100)
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
src/lib/content.h
src/wx/timeline.cc
src/wx/timeline.h

index ca76b01a6c8ad627f851fa7503c2eb9e18eaaa85..2ca029d5ae321d9b4f8019b4ac2d031383f70192 100644 (file)
@@ -211,7 +211,7 @@ Content::signal_change (ChangeType c, int p)
 }
 
 void
-Content::set_position (shared_ptr<const Film> film, DCPTime p)
+Content::set_position (shared_ptr<const Film> film, DCPTime p, bool force_emit)
 {
        /* video and audio content can modify its position */
 
@@ -227,7 +227,7 @@ Content::set_position (shared_ptr<const Film> film, DCPTime p)
 
        {
                boost::mutex::scoped_lock lm (_mutex);
-               if (p == _position) {
+               if (p == _position && !force_emit) {
                        cc.abort ();
                        return;
                }
index 96359fadb5fa256d67a1ce51f948ad00cf633269..4c1d55765b6d07484e57455926ab6885b661580c 100644 (file)
@@ -135,7 +135,7 @@ public:
                return _digest;
        }
 
-       void set_position (boost::shared_ptr<const Film> film, DCPTime);
+       void set_position (boost::shared_ptr<const Film> 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.
index 1c1da708e44dcc81bbd10515751bff1f982c739d..de5f05ae78ae09703e4541876bab31fb4d8e46fe 100644 (file)
@@ -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<DCPTime>& 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);
 }
index 89fd941790b5265ea5d0ad5a2bc605c586488c3f..a7f34586305875dc6ce14261d2a9949d3d540505 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2019 Carl Hetherington <cth@carlh.net>
 
     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 ();