Add rewind-to-zero button to film viewer.
authorCarl Hetherington <cth@carlh.net>
Tue, 2 Jan 2018 18:45:39 +0000 (18:45 +0000)
committerCarl Hetherington <cth@carlh.net>
Tue, 2 Jan 2018 18:45:39 +0000 (18:45 +0000)
ChangeLog
src/wx/film_viewer.cc
src/wx/film_viewer.h

index 29054b6f53b18eb83204c3124a2ce7d7e0c635c2..72fdf6ea833d281a0fc1abd197dd11318da77c31 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2018-01-02  Carl Hetherington  <cth@carlh.net>
 
+       * 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).
index a834a5344045587674e0d6c73ee288a8d4fca9c1..0fb5058f308b97477ec4e26875ff5287d28782d2 100644 (file)
@@ -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);
index a969048826494b3202dff30d6f6c76a7dbe69cba..50f7dd2cb2122e3d3446e5e0202dd8ac5b49e6c6 100644 (file)
@@ -78,6 +78,7 @@ private:
        void calculate_sizes ();
        void check_play_state ();
        void active_jobs_changed (boost::optional<std::string>);
+       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;