/*
- 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.
, _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);
_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 ();
}
void
-Controls::position_changed ()
+Controls::update_position ()
{
if (!_slider_being_moved) {
update_position_label ();
void image_changed (boost::weak_ptr<PlayerVideo>);
void outline_content_changed ();
void eye_changed ();
- void position_changed ();
+ void update_position ();
void film_change (ChangeType, Film::Property);
typedef std::pair<boost::shared_ptr<dcp::CPL>, boost::filesystem::path> CPL;
ClosedCaptionsDialog* _closed_captions_dialog;
+ wxTimer _timer;
+
boost::signals2::scoped_connection _film_change_connection;
boost::signals2::scoped_connection _config_changed_connection;
};
if (!quick_refresh()) {
slow_refresh ();
}
- PositionChanged ();
}
void
if (!refreshed) {
slow_refresh ();
}
- PositionChanged ();
}
void
int time_until_next_frame () const;
boost::signals2::signal<void (boost::weak_ptr<PlayerVideo>)> ImageChanged;
- boost::signals2::signal<void ()> PositionChanged;
boost::signals2::signal<void (dcpomatic::DCPTime)> Started;
boost::signals2::signal<void (dcpomatic::DCPTime)> Stopped;
/** While playing back we reached the end of the film (emitted from GUI thread) */
}
display_player_video ();
- _viewer->PositionChanged ();
return true;
}
, _previous_button (new Button(this, "Previous"))
, _current_disable_timeline (false)
, _current_disable_next (false)
+ , _timer (this)
{
_button_sizer->Add (_previous_button, 0, wxEXPAND);
_button_sizer->Add (_play_button, 0, wxEXPAND);
_spl_view->Bind (wxEVT_LIST_ITEM_SELECTED, boost::bind(&SwaroopControls::spl_selection_changed, this));
_spl_view->Bind (wxEVT_LIST_ITEM_DESELECTED, boost::bind(&SwaroopControls::spl_selection_changed, this));
_viewer->Finished.connect (boost::bind(&SwaroopControls::viewer_finished, this));
- _viewer->PositionChanged.connect (boost::bind(&SwaroopControls::viewer_position_changed, this));
_refresh_spl_view->Bind (wxEVT_BUTTON, boost::bind(&SwaroopControls::update_playlist_directory, this));
_refresh_content_view->Bind (wxEVT_BUTTON, boost::bind(&ContentView::update, _content_view));
+ /* Write position every two minutes if we're playing */
+ Bind (wxEVT_TIMER, boost::bind(&SwaroopControls::write_position, this));
+ _timer.Start (2 * 60 * 1000, wxTIMER_CONTINUOUS);
+
_content_view->update ();
update_playlist_directory ();
}
void
-SwaroopControls::viewer_position_changed ()
+SwaroopControls::write_position ()
{
- /* Write position every two minutes if we're playing */
- if (!_selected_playlist || !_viewer->playing() || _viewer->position().get() % (2 * 60 * DCPTime::HZ)) {
+ if (!_selected_playlist || !_viewer->playing()) {
return;
}
void setup_sensitivity ();
void config_changed (int);
void viewer_finished ();
- void viewer_position_changed ();
+ void write_position ();
void reset_film ();
void update_current_content ();
bool can_do_previous ();
std::vector<SPL> _playlists;
boost::optional<int> _selected_playlist;
int _selected_playlist_position;
+
+ wxTimer _timer;
};
, _y_scroll_rate (16)
, _pixels_per_track (48)
, _first_resize (true)
+ , _timer (this)
{
#ifndef __WXOSX__
_labels_canvas->SetDoubleBuffered (true);
_film_changed_connection = film->Change.connect (bind (&Timeline::film_change, this, _1, _2));
_film_content_change_connection = film->ContentChange.connect (bind (&Timeline::film_content_change, this, _1, _3, _4));
- shared_ptr<FilmViewer> vp = viewer.lock ();
- DCPOMATIC_ASSERT (vp);
- _viewer_position_change_connection = vp->PositionChanged.connect (bind(&Timeline::position_change, this));
+ Bind (wxEVT_TIMER, boost::bind(&Timeline::update_playhead, this));
+ _timer.Start (200, wxTIMER_CONTINUOUS);
setup_scrollbars ();
_labels_canvas->ShowScrollbars (wxSHOW_SB_NEVER, wxSHOW_SB_NEVER);
}
void
-Timeline::position_change ()
+Timeline::update_playhead ()
{
Refresh ();
}
void set_pixels_per_second (double pps);
void set_pixels_per_track (int h);
void zoom_all ();
- void position_change ();
+ void update_playhead ();
boost::shared_ptr<TimelineView> event_to_view (wxMouseEvent &);
TimelineContentViewList selected_views () const;
int _y_scroll_rate;
int _pixels_per_track;
bool _first_resize;
+ wxTimer _timer;
static double const _minimum_pixels_per_second;
static int const _minimum_pixels_per_track;
boost::signals2::scoped_connection _film_changed_connection;
boost::signals2::scoped_connection _film_content_change_connection;
- boost::signals2::scoped_connection _viewer_position_change_connection;
};