summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-06-30 23:15:31 +0100
committerCarl Hetherington <cth@carlh.net>2016-06-30 23:15:31 +0100
commit3846dd867d5d155f08c7448c9d2b911f547ac41c (patch)
tree139d78cb048f9ae412bcb05526e511451d0fd91d /src
parentc1bd561d0380f46fcd1cabe9816916a2742f465d (diff)
Make nudge buttons nudge further with modifiers (shift/control/shift+control).
Diffstat (limited to 'src')
-rw-r--r--src/wx/film_viewer.cc32
-rw-r--r--src/wx/film_viewer.h5
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<Film> ());
@@ -448,10 +448,26 @@ FilmViewer::active_jobs_changed (optional<string> 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<std::string>);
- 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> _film;
boost::shared_ptr<Player> _player;