Remove PositionChanged in favour of consumers having their own GUI-thread timers.
[dcpomatic.git] / src / wx / controls.cc
index b173b43ff6c68ac6bc9817414a7cb55baf112eb5..71af4e8cf28f53f7e1a09561616918a04aaf6d43 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2018-2019 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -67,6 +67,7 @@ Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool editor
        , _forward_button (new Button (this, wxT(">")))
        , _frame_number (new StaticText (this, wxT("")))
        , _timecode (new StaticText (this, wxT("")))
+       , _timer (this)
 {
        _v_sizer = new wxBoxSizer (wxVERTICAL);
        SetSizer (_v_sizer);
@@ -137,10 +138,12 @@ Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool editor
                _jump_to_selected->SetValue (Config::instance()->jump_to_selected ());
        }
 
-       _viewer->PositionChanged.connect (boost::bind(&Controls::position_changed, this));
        _viewer->Started.connect (boost::bind(&Controls::started, this));
        _viewer->Stopped.connect (boost::bind(&Controls::stopped, this));
 
+       Bind (wxEVT_TIMER, boost::bind(&Controls::update_position, this));
+       _timer.Start (80, wxTIMER_CONTINUOUS);
+
        set_film (_viewer->film());
 
        setup_sensitivity ();
@@ -172,7 +175,7 @@ Controls::stopped ()
 }
 
 void
-Controls::position_changed ()
+Controls::update_position ()
 {
        if (!_slider_being_moved) {
                update_position_label ();