summaryrefslogtreecommitdiff
path: root/doc
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 /doc
parent924f4edb20d14bc697956254951fb87513cf2e19 (diff)
Add comments for shortcuts and extract them for the manual (#2073).
Diffstat (limited to 'doc')
-rw-r--r--doc/manual/Makefile7
-rw-r--r--doc/manual/dcpomatic.xml39
-rw-r--r--doc/manual/shortcuts.py40
3 files changed, 47 insertions, 39 deletions
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>
+""")
+