summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2021-08-17 22:49:10 +0200
committerCarl Hetherington <cth@carlh.net>2021-08-17 22:49:10 +0200
commit3f047eef5b84c4212da865b5cdadb70076f07805 (patch)
tree30731e46b7e57416f22d6aece914c413ae826943
parent924f4edb20d14bc697956254951fb87513cf2e19 (diff)
Add comments for shortcuts and extract them for the manual (#2073).
-rw-r--r--.gitignore3
-rw-r--r--doc/manual/Makefile7
-rw-r--r--doc/manual/dcpomatic.xml39
-rw-r--r--doc/manual/shortcuts.py40
-rw-r--r--src/tools/dcpomatic.cc21
5 files changed, 69 insertions, 41 deletions
diff --git a/.gitignore b/.gitignore
index bf65ce2f7..cf539fc08 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,7 @@ doc/manual/html
doc/manual/pdf
doc/manual/extensions.ent
doc/manual/config.xml
+doc/manual/shortcuts.xml
doc/design/*.pdf
doc/design/*.log
doc/design/*.aux
@@ -43,4 +44,4 @@ src/wx/subscribers.cc
compile_commands.json
vim-lsp.log
-lock \ No newline at end of file
+lock
diff --git a/doc/manual/Makefile b/doc/manual/Makefile
index 6e2c12d41..d57dd2630 100644
--- a/doc/manual/Makefile
+++ b/doc/manual/Makefile
@@ -99,11 +99,16 @@ diagrams/%.pdf: diagrams/%.svg
config.xml: ../../src/lib/config.cc config.py
python3 config.py ../../src/lib/config.cc > config.xml
+SHORTCUTS := ../../src/tools/dcpomatic.cc
+
+shortcuts.xml: $(SHORTCUTS) shortcuts.py
+ python3 shortcuts.py $(SHORTCUTS) > $@
+
#
# HTML
#
-html: $(XML) config.xml dcpomatic-html.xsl extensions-html.ent dcpomatic.css dcpomatic_create.xml dcpomatic_cli.xml dcpomatic_kdm_cli.xml \
+html: $(XML) config.xml shortcuts.xml dcpomatic-html.xsl extensions-html.ent dcpomatic.css dcpomatic_create.xml dcpomatic_cli.xml dcpomatic_kdm_cli.xml \
$(subst .pdf,.png,$(addprefix html/screenshots/,$(SCREENSHOTS))) \
$(subst .svg,.png,$(addprefix diagrams/,$(DIAGRAMS))) \
diff --git a/doc/manual/dcpomatic.xml b/doc/manual/dcpomatic.xml
index 4fd17dd6d..797a49fe5 100644
--- a/doc/manual/dcpomatic.xml
+++ b/doc/manual/dcpomatic.xml
@@ -3779,44 +3779,7 @@ The full details of OV and VF files are discussed in <xref linkend="sec-overlay"
<!-- ============================================================== -->
<chapter>
<title>Keyboard shortcuts</title>
-
-<table id="keyboard-shortcuts">
- <title>Keyboard shortcuts</title>
- <tgroup cols='2' align='left' colsep='1' rowsep='1'>
- <thead>
- <row>
- <entry>Key</entry>
- <entry>Action</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry>Space</entry>
- <entry>Start / stop playback</entry>
- </row>
- <row>
- <entry>Delete</entry>
- <entry>Remove content from film</entry>
- </row>
- <row>
- <entry>Left arrow</entry>
- <entry>Move back one frame</entry>
- </row>
- <row>
- <entry>Right arrow</entry>
- <entry>Move forward one frame</entry>
- </row>
- <row>
- <entry>Ctrl+A</entry>
- <entry>Add file(s) to film</entry>
- </row>
- <row>
- <entry>Ctrl+T</entry>
- <entry>Open timeline window</entry>
- </row>
- </tbody>
- </tgroup>
-</table>
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="shortcuts.xml"/>
</chapter>
diff --git a/doc/manual/shortcuts.py b/doc/manual/shortcuts.py
new file mode 100644
index 000000000..a18786799
--- /dev/null
+++ b/doc/manual/shortcuts.py
@@ -0,0 +1,40 @@
+import sys
+
+shortcuts = []
+
+for filename in sys.argv[1:]:
+ with open(filename) as f:
+ for line in f:
+ line = line.strip();
+ if line.startswith('/* [Shortcut] '):
+ desc = line[14:-2].strip()
+ parts = desc.split(':')
+ shortcuts.append(desc.split(':'))
+
+shortcuts.sort(key=lambda x: x[0])
+
+print("""
+<table id="keyboard shortcuts">
+ <title>Keyboard shortcuts</title>
+ <tgroup cols='2' align='left' colsep='1' rowsep='1'>
+ <thead>
+ <row>
+ <entry>Key</entry>
+ <entry>Action</entry>
+ </row>
+ </thead>
+ <tbody>
+""")
+
+for s in shortcuts:
+ print(" <row>")
+ print(f" <entry>{s[0]}</entry>")
+ print(f" <entry>{s[1]}</entry>")
+ print(" </row>")
+
+print("""
+ </tbody>
+ </tgroup>
+</table>
+""")
+
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index 24c5bd5ec..ea3dc9a41 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -388,12 +388,18 @@ public:
#else
int accelerators = 6;
#endif
- wxAcceleratorEntry* accel = new wxAcceleratorEntry[accelerators];
+ auto accel = new wxAcceleratorEntry[accelerators];
+ /* [Shortcut] Ctrl+A:Add file(s) to the film */
accel[0].Set (wxACCEL_CTRL, static_cast<int>('A'), ID_add_file);
+ /* [Shortcut] Delete:Remove selected content from film */
accel[1].Set (wxACCEL_NORMAL, WXK_DELETE, ID_remove);
+ /* [Shortcut] Space:Start/stop playback */
accel[2].Set (wxACCEL_NORMAL, WXK_SPACE, ID_start_stop);
+ /* [Shortcut] Ctrl+T:Open timeline window */
accel[3].Set (wxACCEL_CTRL, static_cast<int>('T'), ID_timeline);
+ /* [Shortcut] Left arrow:Move back one frame */
accel[4].Set (wxACCEL_NORMAL, WXK_LEFT, ID_back_frame);
+ /* [Shortcut] Right arrow:Move forward one frame */
accel[5].Set (wxACCEL_NORMAL, WXK_RIGHT, ID_forward_frame);
#ifdef __WXOSX__
accel[6].Set (wxACCEL_CTRL, static_cast<int>('W'), ID_file_close);
@@ -1302,9 +1308,12 @@ private:
void setup_menu (wxMenuBar* m)
{
_file_menu = new wxMenu;
+ /* [Shortcut] Ctrl+N:New film */
add_item (_file_menu, _("New...\tCtrl-N"), ID_file_new, ALWAYS);
+ /* [Shortcut] Ctrl+O:Open existing film */
add_item (_file_menu, _("&Open...\tCtrl-O"), ID_file_open, ALWAYS);
_file_menu->AppendSeparator ();
+ /* [Shortcut] Ctrl+S:Save current film */
add_item (_file_menu, _("&Save\tCtrl-S"), ID_file_save, NEEDS_FILM);
_file_menu->AppendSeparator ();
add_item (_file_menu, _("Save as &template..."), ID_file_save_as_template, NEEDS_FILM);
@@ -1314,6 +1323,7 @@ private:
_history_position = _file_menu->GetMenuItems().GetCount();
_file_menu->AppendSeparator ();
+ /* [Shortcut] Ctrl+W:Close current film */
add_item (_file_menu, _("&Close\tCtrl-W"), ID_file_close, NEEDS_FILM);
#ifndef __WXOSX__
@@ -1327,26 +1337,35 @@ private:
#endif
auto edit = new wxMenu;
+ /* [Shortcut] Ctrl+C:Copy settings from currently selected content */
add_item (edit, _("Copy settings\tCtrl-C"), ID_edit_copy, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_SINGLE_SELECTED_CONTENT);
+ /* [Shortcut] Ctrl+V:Paste settings into currently selected content */
add_item (edit, _("Paste settings...\tCtrl-V"), ID_edit_paste, NEEDS_FILM | NOT_DURING_DCP_CREATION | NEEDS_SELECTED_CONTENT | NEEDS_CLIPBOARD);
edit->AppendSeparator ();
+ /* [Shortcut] Shift+Ctrl+A:Select all content */
add_item (edit, _("Select all\tShift-Ctrl-A"), ID_edit_select_all, NEEDS_FILM);
#ifdef __WXOSX__
add_item (_file_menu, _("&Preferences...\tCtrl-P"), wxID_PREFERENCES, ALWAYS);
#else
edit->AppendSeparator ();
+ /* [Shortcut] Ctrl+P:Open preferences window */
add_item (edit, _("&Preferences...\tCtrl-P"), wxID_PREFERENCES, ALWAYS);
#endif
auto jobs_menu = new wxMenu;
+ /* [Shortcut] Ctrl+M:Make DCP */
add_item (jobs_menu, _("&Make DCP\tCtrl-M"), ID_jobs_make_dcp, NEEDS_FILM | NOT_DURING_DCP_CREATION);
+ /* [Shortcut] Ctrl+B:Make DCP in the batch converter*/
add_item (jobs_menu, _("Make DCP in &batch converter\tCtrl-B"), ID_jobs_make_dcp_batch, NEEDS_FILM | NOT_DURING_DCP_CREATION);
jobs_menu->AppendSeparator ();
+ /* [Shortcut] Ctrl+K:Make KDMs */
add_item (jobs_menu, _("Make &KDMs...\tCtrl-K"), ID_jobs_make_kdms, NEEDS_FILM);
+ /* [Shortcut] Ctrl+D:Make DKDMs */
add_item (jobs_menu, _("Make &DKDMs...\tCtrl-D"), ID_jobs_make_dkdms, NEEDS_FILM);
add_item (jobs_menu, _("Make DKDM for DCP-o-matic..."), ID_jobs_make_self_dkdm, NEEDS_FILM | NEEDS_ENCRYPTION);
jobs_menu->AppendSeparator ();
+ /* [Shortcut] Ctrl+E:Export video file */
add_item (jobs_menu, _("Export video file...\tCtrl-E"), ID_jobs_export_video_file, NEEDS_FILM);
add_item (jobs_menu, _("Export subtitles..."), ID_jobs_export_subtitles, NEEDS_FILM);
jobs_menu->AppendSeparator ();