From 76473252889949a02fa633daf2d40547142281ed Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 2 Jan 2018 18:45:39 +0000 Subject: [PATCH] Add rewind-to-zero button to film viewer. --- ChangeLog | 2 ++ src/wx/film_viewer.cc | 12 ++++++++++++ src/wx/film_viewer.h | 2 ++ 3 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index 29054b6f5..72fdf6ea8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2018-01-02 Carl Hetherington + * Add rewind-to-zero button to player. + * Go back to zero when loading a new DCP into the player (#1152). * Fix generated ISDCF name with full-frame content (#1118). diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index a834a5344..0fb5058f3 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -80,6 +80,7 @@ FilmViewer::FilmViewer (wxWindow* p, bool outline_content, bool jump_to_selected , _right_eye (new wxRadioButton (this, wxID_ANY, _("Right eye"))) , _jump_to_selected (0) , _slider (new wxSlider (this, wxID_ANY, 0, 0, 4096)) + , _rewind_button (new wxButton (this, wxID_ANY, wxT("|<"))) , _back_button (new wxButton (this, wxID_ANY, wxT("<"))) , _forward_button (new wxButton (this, wxID_ANY, wxT(">"))) , _frame_number (new wxStaticText (this, wxID_ANY, wxT(""))) @@ -125,6 +126,7 @@ FilmViewer::FilmViewer (wxWindow* p, bool outline_content, bool jump_to_selected time_sizer->Add (_frame_number, 0, wxEXPAND); time_sizer->Add (_timecode, 0, wxEXPAND); + h_sizer->Add (_rewind_button, 0, wxALL, 2); h_sizer->Add (_back_button, 0, wxALL, 2); h_sizer->Add (time_sizer, 0, wxEXPAND); h_sizer->Add (_forward_button, 0, wxALL, 2); @@ -134,6 +136,7 @@ FilmViewer::FilmViewer (wxWindow* p, bool outline_content, bool jump_to_selected _v_sizer->Add (h_sizer, 0, wxEXPAND | wxALL, 6); _frame_number->SetMinSize (wxSize (84, -1)); + _rewind_button->SetMinSize (wxSize (32, -1)); _back_button->SetMinSize (wxSize (32, -1)); _forward_button->SetMinSize (wxSize (32, -1)); @@ -150,6 +153,7 @@ FilmViewer::FilmViewer (wxWindow* p, bool outline_content, bool jump_to_selected _slider->Bind (wxEVT_SCROLL_CHANGED, boost::bind (&FilmViewer::slider_moved, this, true)); _play_button->Bind (wxEVT_TOGGLEBUTTON, boost::bind (&FilmViewer::play_clicked, this)); _timer.Bind (wxEVT_TIMER, boost::bind (&FilmViewer::timer, this)); + _rewind_button->Bind (wxEVT_LEFT_DOWN, boost::bind (&FilmViewer::rewind_clicked, this, _1)); _back_button->Bind (wxEVT_LEFT_DOWN, boost::bind (&FilmViewer::back_clicked, this, _1)); _forward_button->Bind (wxEVT_LEFT_DOWN, boost::bind (&FilmViewer::forward_clicked, this, _1)); _frame_number->Bind (wxEVT_LEFT_DOWN, boost::bind (&FilmViewer::frame_number_clicked, this)); @@ -582,6 +586,13 @@ FilmViewer::go_to (DCPTime t) update_position_slider (); } +void +FilmViewer::rewind_clicked (wxMouseEvent& ev) +{ + go_to(DCPTime()); + ev.Skip(); +} + void FilmViewer::back_clicked (wxMouseEvent& ev) { @@ -620,6 +631,7 @@ FilmViewer::setup_sensitivity () bool const c = _film && !_film->content().empty (); _slider->Enable (c); + _rewind_button->Enable (c); _back_button->Enable (c); _forward_button->Enable (c); _play_button->Enable (c); diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index a96904882..50f7dd2cb 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -78,6 +78,7 @@ private: void calculate_sizes (); void check_play_state (); void active_jobs_changed (boost::optional); + void rewind_clicked (wxMouseEvent &); void back_clicked (wxMouseEvent &); void forward_clicked (wxMouseEvent &); void player_changed (bool); @@ -112,6 +113,7 @@ private: wxRadioButton* _right_eye; wxCheckBox* _jump_to_selected; wxSlider* _slider; + wxButton* _rewind_button; wxButton* _back_button; wxButton* _forward_button; wxStaticText* _frame_number; -- 2.30.2