summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-01-02 18:45:39 +0000
committerCarl Hetherington <cth@carlh.net>2018-01-02 18:45:39 +0000
commit76473252889949a02fa633daf2d40547142281ed (patch)
tree7e74a101864bd4f6fd70edc500230f08e7c811cd /src
parent34f6688dad9f6916f2d6ce1accba90e88e6efff4 (diff)
Add rewind-to-zero button to film viewer.
Diffstat (limited to 'src')
-rw-r--r--src/wx/film_viewer.cc12
-rw-r--r--src/wx/film_viewer.h2
2 files changed, 14 insertions, 0 deletions
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));
@@ -583,6 +587,13 @@ FilmViewer::go_to (DCPTime t)
}
void
+FilmViewer::rewind_clicked (wxMouseEvent& ev)
+{
+ go_to(DCPTime());
+ ev.Skip();
+}
+
+void
FilmViewer::back_clicked (wxMouseEvent& ev)
{
go_to (_video_position - nudge_amount (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<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;