summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-03-23 01:21:46 +0000
committerCarl Hetherington <cth@carlh.net>2018-03-23 01:21:46 +0000
commit83cc718cc4f38bc2a9cc8cd62ed570415c5ba289 (patch)
treee7dd1f7a17b86d6110b06fee3fa206a38edf1fc0
parente2361edc2fc2c07d6474bf5a7f76dc2a5b55ee81 (diff)
Arrows to go forward/back one frame.
-rw-r--r--ChangeLog4
-rw-r--r--src/tools/dcpomatic.cc24
-rw-r--r--src/wx/film_viewer.cc28
-rw-r--r--src/wx/film_viewer.h9
4 files changed, 51 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index a4855f297..d126e0fb5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
2018-03-23 Carl Hetherington <cth@carlh.net>
- * Add space shortcut to start/stop playback and
- Ctrl-T to open timeline (#1201).
+ * Add space shortcut to start/stop playback, arrows to go
+ back/forward one frame and Ctrl-T to open timeline (#1201).
2018-03-22 Carl Hetherington <cth@carlh.net>
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index 4d888b3fa..0fffe6cfc 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -220,7 +220,9 @@ enum {
ID_add_file,
ID_remove,
ID_start_stop,
- ID_timeline
+ ID_timeline,
+ ID_back_frame,
+ ID_forward_frame
};
class DOMFrame : public wxFrame
@@ -330,22 +332,26 @@ public:
overall_panel->SetSizer (main_sizer);
#ifdef __WXOSX__
- int accelerators = 5;
+ int accelerators = 7;
#else
- int accelerators = 4;
+ int accelerators = 6;
#endif
wxAcceleratorEntry* accel = new wxAcceleratorEntry[accelerators];
accel[0].Set (wxACCEL_CTRL, static_cast<int>('A'), ID_add_file);
accel[1].Set (wxACCEL_NORMAL, WXK_DELETE, ID_remove);
accel[2].Set (wxACCEL_NORMAL, WXK_SPACE, ID_start_stop);
accel[3].Set (wxACCEL_CTRL, static_cast<int>('T'), ID_timeline);
+ accel[4].Set (wxACCEL_NORMAL, WXK_LEFT, ID_back_frame);
+ accel[5].Set (wxACCEL_NORMAL, WXK_RIGHT, ID_forward_frame);
#ifdef __WXOSX__
- accel[4].Set (wxACCEL_CTRL, static_cast<int>('W'), wxID_EXIT);
+ accel[6].Set (wxACCEL_CTRL, static_cast<int>('W'), wxID_EXIT);
#endif
Bind (wxEVT_MENU, boost::bind (&ContentPanel::add_file_clicked, _film_editor->content_panel()), ID_add_file);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::remove_clicked, this, _1), ID_remove);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::start_stop_pressed, this), ID_start_stop);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::timeline_pressed, this), ID_timeline);
+ Bind (wxEVT_MENU, boost::bind (&DOMFrame::back_frame, this), ID_back_frame);
+ Bind (wxEVT_MENU, boost::bind (&DOMFrame::forward_frame, this), ID_forward_frame);
wxAcceleratorTable accel_table (accelerators, accel);
SetAcceleratorTable (accel_table);
delete[] accel;
@@ -1221,6 +1227,16 @@ private:
_film_editor->content_panel()->timeline_clicked ();
}
+ void back_frame ()
+ {
+ _film_viewer->back_frame ();
+ }
+
+ void forward_frame ()
+ {
+ _film_viewer->forward_frame ();
+ }
+
FilmEditor* _film_editor;
FilmViewer* _film_viewer;
VideoWaveformDialog* _video_waveform_dialog;
diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc
index 635a564c6..5cd09048c 100644
--- a/src/wx/film_viewer.cc
+++ b/src/wx/film_viewer.cc
@@ -580,7 +580,7 @@ FilmViewer::active_jobs_changed (optional<string> j)
}
DCPTime
-FilmViewer::nudge_amount (wxMouseEvent& ev)
+FilmViewer::nudge_amount (wxKeyboardState& ev)
{
DCPTime amount = one_video_frame ();
@@ -619,17 +619,35 @@ FilmViewer::rewind_clicked (wxMouseEvent& ev)
}
void
-FilmViewer::back_clicked (wxMouseEvent& ev)
+FilmViewer::back_frame ()
+{
+ if (!_film) {
+ return;
+ }
+
+ go_to (_video_position - one_video_frame());
+}
+
+void
+FilmViewer::forward_frame ()
+{
+ if (!_film) {
+ return;
+ }
+
+ go_to (_video_position + one_video_frame());
+}
+
+void
+FilmViewer::back_clicked (wxKeyboardState& ev)
{
go_to (_video_position - nudge_amount (ev));
- ev.Skip ();
}
void
-FilmViewer::forward_clicked (wxMouseEvent& ev)
+FilmViewer::forward_clicked (wxKeyboardState& ev)
{
go_to (_video_position + nudge_amount (ev));
- ev.Skip ();
}
void
diff --git a/src/wx/film_viewer.h b/src/wx/film_viewer.h
index 190396601..eed6c283d 100644
--- a/src/wx/film_viewer.h
+++ b/src/wx/film_viewer.h
@@ -72,6 +72,9 @@ public:
return _playing;
}
+ void back_frame ();
+ void forward_frame ();
+
int audio_callback (void* out, unsigned int frames);
boost::signals2::signal<void (boost::weak_ptr<PlayerVideo>)> ImageChanged;
@@ -87,8 +90,8 @@ private:
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 back_clicked (wxKeyboardState& s);
+ void forward_clicked (wxKeyboardState &);
void player_changed (int, bool);
void update_position_label ();
void update_position_slider ();
@@ -98,7 +101,7 @@ private:
void refresh_panel ();
void setup_sensitivity ();
void film_changed (Film::Property);
- DCPTime nudge_amount (wxMouseEvent &);
+ DCPTime nudge_amount (wxKeyboardState &);
void timecode_clicked ();
void frame_number_clicked ();
void go_to (DCPTime t);