summaryrefslogtreecommitdiff
path: root/src/tools/dcpomatic_player.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-03-23 00:28:40 +0000
committerCarl Hetherington <cth@carlh.net>2018-03-23 00:28:40 +0000
commit3c42365762079289499bdc25144bb90b2e3509c6 (patch)
tree95083e45412b54f018d907e75192c17c92d3680d /src/tools/dcpomatic_player.cc
parent7bc349aa8da5a046a9e1b0c08e3fc657c380386b (diff)
Add space shortcut to start/stop playback (#1201).
Diffstat (limited to 'src/tools/dcpomatic_player.cc')
-rw-r--r--src/tools/dcpomatic_player.cc28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/tools/dcpomatic_player.cc b/src/tools/dcpomatic_player.cc
index a765bd1d1..39826df1b 100644
--- a/src/tools/dcpomatic_player.cc
+++ b/src/tools/dcpomatic_player.cc
@@ -83,6 +83,8 @@ enum {
ID_help_report_a_problem,
ID_tools_verify,
ID_tools_check_for_updates,
+ /* IDs for shortcuts (with no associated menu item) */
+ ID_start_stop
};
class DOMFrame : public wxFrame
@@ -147,12 +149,21 @@ public:
overall_panel->SetSizer (main_sizer);
#ifdef __WXOSX__
- wxAcceleratorEntry* accel = new wxAcceleratorEntry[1];
- accel[0].Set(wxACCEL_CTRL, static_cast<int>('W'), ID_file_close);
- wxAcceleratorTable accel_table (1, accel);
+ int accelerators = 2;
+#else
+ int accelerators = 1;
+#endif
+
+ wxAcceleratorEntry* accel = new wxAcceleratorEntry[accelerators];
+ accel[0].Set(wxACCEL_NORMAL, WXK_SPACE, ID_start_stop);
+#ifdef __WXOSX__
+ accel[1].Set(wxACCEL_CTRL, static_cast<int>('W'), ID_file_close);
+#endif
+ wxAcceleratorTable accel_table (accelerators, accel);
SetAcceleratorTable (accel_table);
delete[] accel;
-#endif
+
+ Bind (wxEVT_MENU, boost::bind (&DOMFrame::start_stop_pressed, this), ID_start_stop);
UpdateChecker::instance()->StateChanged.connect (boost::bind (&DOMFrame::update_checker_state_changed, this));
}
@@ -553,6 +564,15 @@ private:
_view_cpl->Enable (static_cast<bool>(_film));
}
+ void start_stop_pressed ()
+ {
+ if (_viewer->playing()) {
+ _viewer->stop();
+ } else {
+ _viewer->start();
+ }
+ }
+
bool _update_news_requested;
PlayerInformation* _info;
wxPreferencesEditor* _config_dialog;