Fix erroneous skip when changing things and re-getting the current frame.
authorCarl Hetherington <cth@carlh.net>
Fri, 20 Jun 2014 22:23:07 +0000 (23:23 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 20 Jun 2014 22:23:07 +0000 (23:23 +0100)
src/wx/film_viewer.cc
src/wx/film_viewer.h

index c848fe09b6ffa5a3f99d52f17090e837bc8e9ce3..d84a0af340c31e413b6cd65bb68f1e40f22bdf4b 100644 (file)
@@ -63,6 +63,7 @@ FilmViewer::FilmViewer (shared_ptr<Film> f, wxWindow* p)
        , _frame_number (new wxStaticText (this, wxID_ANY, wxT("")))
        , _timecode (new wxStaticText (this, wxID_ANY, wxT("")))
        , _play_button (new wxToggleButton (this, wxID_ANY, _("Play")))
+       , _last_get_accurate (true)
 {
 #ifndef __WXOSX__
        _panel->SetDoubleBuffered (true);
@@ -140,7 +141,7 @@ FilmViewer::set_film (shared_ptr<Film> f)
        _player->Changed.connect (boost::bind (&FilmViewer::player_changed, this, _1));
 
        calculate_sizes ();
-       get (_position, true);
+       get (_position, _last_get_accurate);
 }
 
 void
@@ -163,6 +164,8 @@ FilmViewer::get (DCPTime p, bool accurate)
        set_position_text ();
        _panel->Refresh ();
        _panel->Update ();
+
+       _last_get_accurate = accurate;
 }
 
 void
@@ -234,7 +237,7 @@ FilmViewer::panel_sized (wxSizeEvent& ev)
        _panel_size.width = ev.GetSize().GetWidth();
        _panel_size.height = ev.GetSize().GetHeight();
        calculate_sizes ();
-       get (_position, true);
+       get (_position, _last_get_accurate);
 }
 
 void
@@ -362,5 +365,5 @@ FilmViewer::player_changed (bool frequent)
        }
 
        calculate_sizes ();
-       get (_position, true);
+       get (_position, _last_get_accurate);
 }
index 950758f61c9f401cd63e28a4473f013e8ab18785..c1c087a14d5d75c93a460585297c9619d1033968 100644 (file)
@@ -75,4 +75,9 @@ private:
        dcp::Size _out_size;
        /** Size of the panel that we have available */
        dcp::Size _panel_size;
+       /** true if the last call to ::get() was specified to be accurate;
+        *  this is used so that when re-fetching the current frame we
+        *  can get the same one that we got last time.
+        */
+       bool _last_get_accurate;
 };