From 3846dd867d5d155f08c7448c9d2b911f547ac41c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 30 Jun 2016 23:15:31 +0100 Subject: [PATCH] Make nudge buttons nudge further with modifiers (shift/control/shift+control). --- src/wx/film_viewer.cc | 32 ++++++++++++++++++++++++++------ src/wx/film_viewer.h | 5 +++-- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index 42ce7cd18..da980dafc 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -122,8 +122,8 @@ FilmViewer::FilmViewer (wxWindow* p) _slider->Bind (wxEVT_SCROLL_PAGEDOWN, boost::bind (&FilmViewer::slider_moved, this)); _play_button->Bind (wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, boost::bind (&FilmViewer::play_clicked, this)); _timer.Bind (wxEVT_TIMER, boost::bind (&FilmViewer::timer, this)); - _back_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmViewer::back_clicked, this)); - _forward_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&FilmViewer::forward_clicked, this)); + _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)); set_film (shared_ptr ()); @@ -448,10 +448,26 @@ FilmViewer::active_jobs_changed (optional j) _play_button->Enable (a); } +DCPTime +FilmViewer::nudge_amount (wxMouseEvent& ev) +{ + DCPTime amount = DCPTime::from_frames (1, _film->video_frame_rate ()); + + if (ev.ShiftDown() && !ev.ControlDown()) { + amount = DCPTime::from_seconds (1); + } else if (!ev.ShiftDown() && ev.ControlDown()) { + amount = DCPTime::from_seconds (10); + } else if (ev.ShiftDown() && ev.ControlDown()) { + amount = DCPTime::from_seconds (60); + } + + return amount; +} + void -FilmViewer::back_clicked () +FilmViewer::back_clicked (wxMouseEvent& ev) { - DCPTime p = _position - DCPTime::from_frames (1, _film->video_frame_rate ()); + DCPTime p = _position - nudge_amount (ev); if (p < DCPTime ()) { p = DCPTime (); } @@ -459,12 +475,14 @@ FilmViewer::back_clicked () get (p, true); update_position_label (); update_position_slider (); + + ev.Skip (); } void -FilmViewer::forward_clicked () +FilmViewer::forward_clicked (wxMouseEvent& ev) { - DCPTime p = _position + DCPTime::from_frames (1, _film->video_frame_rate ()); + DCPTime p = _position + nudge_amount (ev); if (p >= _film->length ()) { p = _position; } @@ -472,6 +490,8 @@ FilmViewer::forward_clicked () get (p, true); update_position_label (); update_position_slider (); + + ev.Skip (); } void diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h index 0bb22d422..c9f25fa65 100644 --- a/src/wx/film_viewer.h +++ b/src/wx/film_viewer.h @@ -61,8 +61,8 @@ private: void calculate_sizes (); void check_play_state (); void active_jobs_changed (boost::optional); - void back_clicked (); - void forward_clicked (); + void back_clicked (wxMouseEvent &); + void forward_clicked (wxMouseEvent &); void player_changed (bool); void update_position_label (); void update_position_slider (); @@ -70,6 +70,7 @@ private: void refresh_panel (); void setup_sensitivity (); void film_changed (Film::Property); + DCPTime nudge_amount (wxMouseEvent &); boost::shared_ptr _film; boost::shared_ptr _player; -- 2.30.2