mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-17 22:18:56 +00:00
Enrich the editor theme markup for hotkeys by adding a description= attribute.
A new script, data/tools/extractbindings, uses this to automatically generate an up-to-date list of editor keybindings in a form suitable for the wiki.
This commit is contained in:
parent
e33e9e4533
commit
a8cee73c12
@ -11,488 +11,365 @@
|
||||
[theme]
|
||||
name=editor
|
||||
|
||||
# description attributes are not used by the game engine;
|
||||
# they're here to enable generating a correct keybing list.
|
||||
# The following are canned bindings to be prepended to the list.
|
||||
|
||||
#! Arrow keys=Scroll (if map scrolling is enabled)
|
||||
#! Left click=On map: Paint foreground terrain. On right panel: select foreground terrain
|
||||
#! Right click=On map: Paint background terrain. On right panel: select background terrain
|
||||
#! shift-left click=Mark terrain
|
||||
#! shift-alt-left click=Mark connected terrain
|
||||
#! ctrl-left click=Select the terrain under the cursor as foreground terrain
|
||||
#! ctrl-right click=Select the terrain under the cursor as background terrain
|
||||
#! Click and drag marked terrain=Move the marked terrain
|
||||
|
||||
# Common key definitions
|
||||
[hotkey]
|
||||
command="zoomin"
|
||||
description="Zoom in"
|
||||
key="+"
|
||||
cmd=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="zoomout"
|
||||
description="Zoom out"
|
||||
key="-"
|
||||
cmd=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="zoomdefault"
|
||||
description="Zoom default"
|
||||
key="0"
|
||||
cmd=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="undo"
|
||||
description="Undo"
|
||||
key="u"
|
||||
cmd=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="redo"
|
||||
description="Redo"
|
||||
key="r"
|
||||
cmd=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="togglegrid"
|
||||
description="Toggle hex grid"
|
||||
key="g"
|
||||
#ifdef APPLE
|
||||
[hotkey]
|
||||
command="zoomin"
|
||||
key="+"
|
||||
cmd=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="undo"
|
||||
key="u"
|
||||
cmd=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="redo"
|
||||
key="r"
|
||||
cmd=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="zoomout"
|
||||
key="-"
|
||||
cmd=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="zoomdefault"
|
||||
key="0"
|
||||
cmd=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="togglegrid"
|
||||
key="g"
|
||||
cmd=yes
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="mousescroll"
|
||||
key="l"
|
||||
cmd=yes
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editsavemap"
|
||||
key="s"
|
||||
cmd=yes
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editsaveas"
|
||||
key="s"
|
||||
cmd=yes
|
||||
alt=yes
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editquit"
|
||||
key="q"
|
||||
cmd=yes
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editsetstartpos"
|
||||
key="t"
|
||||
cmd=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editnewmap"
|
||||
key="n"
|
||||
cmd=yes
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editloadmap"
|
||||
key="l"
|
||||
cmd=yes
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editfloodfill"
|
||||
key="f"
|
||||
cmd=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editfillselection"
|
||||
key="f"
|
||||
cmd=no
|
||||
alt=yes
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editrotateselection"
|
||||
key="r"
|
||||
cmd=no
|
||||
alt=no
|
||||
shift=yes
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editcut"
|
||||
key="x"
|
||||
cmd=yes
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editcopy"
|
||||
key="c"
|
||||
cmd=yes
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editpaste"
|
||||
key="v"
|
||||
cmd=yes
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editrevert"
|
||||
key="r"
|
||||
cmd=yes
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="preferences"
|
||||
key="p"
|
||||
cmd=yes
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editresize"
|
||||
key="r"
|
||||
cmd=yes
|
||||
alt=yes
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="fullscreen"
|
||||
key="f"
|
||||
cmd=yes
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editselectall"
|
||||
key="a"
|
||||
cmd=yes
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editflip"
|
||||
key="f"
|
||||
cmd=yes
|
||||
alt=yes
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editdraw"
|
||||
key="d"
|
||||
cmd=yes
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editrefresh"
|
||||
key="e"
|
||||
cmd=yes
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editupdate"
|
||||
key="b"
|
||||
cmd=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editautoupdate"
|
||||
key="t"
|
||||
cmd=yes
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="changelanguage"
|
||||
key="l"
|
||||
cmd=no
|
||||
alt=yes
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
#else
|
||||
[hotkey]
|
||||
command="zoomin"
|
||||
key="+"
|
||||
ctrl=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="undo"
|
||||
key="u"
|
||||
ctrl=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="redo"
|
||||
key="r"
|
||||
ctrl=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="zoomout"
|
||||
key="-"
|
||||
ctrl=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="zoomdefault"
|
||||
key="0"
|
||||
ctrl=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="togglegrid"
|
||||
key="g"
|
||||
ctrl=yes
|
||||
#endif
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="mousescroll"
|
||||
description="Toggle mouse scrolling"
|
||||
key="l"
|
||||
#ifdef APPLE
|
||||
cmd=yes
|
||||
#else
|
||||
ctrl=yes
|
||||
#endif
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editsavemap"
|
||||
description="Save map"
|
||||
key="s"
|
||||
#ifdef APPLE
|
||||
cmd=yes
|
||||
#else
|
||||
ctrl=yes
|
||||
#endif
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editsaveas"
|
||||
description="Save map as"
|
||||
key="s"
|
||||
#ifdef APPLE
|
||||
cmd=yes
|
||||
#else
|
||||
ctrl=yes
|
||||
#endif
|
||||
alt=yes
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editquit"
|
||||
description="Quit map editor"
|
||||
key="q"
|
||||
#ifdef APPLE
|
||||
cmd=yes
|
||||
#else
|
||||
ctrl=yes
|
||||
#endif
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editsetstartpos"
|
||||
description="Set the starting position of a player"
|
||||
key="t"
|
||||
ctrl=no
|
||||
cmd=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editnewmap"
|
||||
description="New map"
|
||||
key="n"
|
||||
#ifdef APPLE
|
||||
cmd=yes
|
||||
#else
|
||||
ctrl=yes
|
||||
#endif
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editloadmap"
|
||||
description="Load map from file"
|
||||
key="l"
|
||||
#ifdef APPLE
|
||||
cmd=yes
|
||||
#else
|
||||
ctrl=yes
|
||||
#endif
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editfloodfill"
|
||||
description="Flood fill with selected terrain"
|
||||
key="f"
|
||||
ctrl=no
|
||||
cmd=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editfillselection"
|
||||
description="Flood map selection with selected terrain"
|
||||
key="f"
|
||||
ctrl=no
|
||||
cmd=no
|
||||
alt=yes
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editrotateselection"
|
||||
description="Rotate selected map terrain"
|
||||
key="r"
|
||||
ctrl=no
|
||||
cmd=no
|
||||
alt=no
|
||||
shift=yes
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editcut"
|
||||
description="Cut selection from map"
|
||||
key="x"
|
||||
#ifdef APPLE
|
||||
cmd=yes
|
||||
#else
|
||||
ctrl=yes
|
||||
#endif
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editcopy"
|
||||
description="Copy selection from map"
|
||||
key="c"
|
||||
#ifdef APPLE
|
||||
cmd=yes
|
||||
#else
|
||||
ctrl=yes
|
||||
#endif
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editpaste"
|
||||
description="Paste selection to map"
|
||||
key="v"
|
||||
#ifdef APPLE
|
||||
cmd=yes
|
||||
#else
|
||||
ctrl=yes
|
||||
#endif
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editrevert"
|
||||
description="Revert map from file"
|
||||
key="r"
|
||||
#ifdef APPLE
|
||||
cmd=yes
|
||||
#else
|
||||
ctrl=yes
|
||||
#endif
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="preferences"
|
||||
description="Set map preferences"
|
||||
key="p"
|
||||
#ifdef APPLE
|
||||
cmd=yes
|
||||
#else
|
||||
ctrl=yes
|
||||
#endif
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editresize"
|
||||
description="Resize map"
|
||||
key="r"
|
||||
#ifdef APPLE
|
||||
cmd=yes
|
||||
#else
|
||||
ctrl=yes
|
||||
#endif
|
||||
alt=yes
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="fullscreen"
|
||||
description="Toggle fullscreen"
|
||||
key="f"
|
||||
#ifdef APPLE
|
||||
cmd=yes
|
||||
#else
|
||||
ctrl=yes
|
||||
#endif
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editselectall"
|
||||
description="Select entire map"
|
||||
key="a"
|
||||
#ifdef APPLE
|
||||
cmd=yes
|
||||
#else
|
||||
ctrl=yes
|
||||
#endif
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editflip"
|
||||
description="Flip the map"
|
||||
key="f"
|
||||
#ifdef APPLE
|
||||
cmd=yes
|
||||
#else
|
||||
ctrl=yes
|
||||
#endif
|
||||
alt=yes
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editdraw"
|
||||
description="Set draw mode"
|
||||
key="d"
|
||||
#ifdef APPLE
|
||||
cmd=yes
|
||||
#else
|
||||
ctrl=yes
|
||||
#endif
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editrefresh"
|
||||
description="Refresh map display"
|
||||
key="e"
|
||||
#ifdef APPLE
|
||||
cmd=yes
|
||||
#else
|
||||
ctrl=yes
|
||||
#endif
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editupdate"
|
||||
description="Redraw/update terrain transitions"
|
||||
key="b"
|
||||
ctrl=no
|
||||
cmd=no
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="editautoupdate"
|
||||
description="Delay terrain transitions"
|
||||
key="t"
|
||||
#ifdef APPLE
|
||||
cmd=yes
|
||||
#else
|
||||
ctrl=yes
|
||||
#endif
|
||||
alt=no
|
||||
shift=no
|
||||
[/hotkey]
|
||||
|
||||
[hotkey]
|
||||
command="changelanguage"
|
||||
description="Change editor language"
|
||||
key="l"
|
||||
ctrl=no
|
||||
cmd=no
|
||||
alt=yes
|
||||
shift=no
|
||||
[/hotkey]
|
||||
#endif
|
||||
|
||||
[resolution]
|
||||
#everywhere in here 1024x768 is seen as basic reference due to some hardcoded values
|
||||
|
@ -70,4 +70,8 @@ unchecked:
|
||||
|
||||
# Reindent the mainline content
|
||||
reindent:
|
||||
wmlindent --exclude=../../data/languages $(DATA)
|
||||
@./wmlindent --exclude=../../data/languages $(DATA)
|
||||
|
||||
# Extract a table of editor keybindings from the editor theme definition
|
||||
editor_bindings:
|
||||
@./extractbindings <../themes/editor.cfg
|
||||
|
48
data/tools/extractbindings
Executable file
48
data/tools/extractbindings
Executable file
@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Extract and format a list of bindings from a theme file.
|
||||
# Presently this generates a table suitable for wiki inclusion.
|
||||
|
||||
import sys
|
||||
|
||||
def report(tabcolumn, binding, description):
|
||||
"Reporter suitable for a wiki inclusion"
|
||||
print " %*s%s" % (tabcolumn, binding, description)
|
||||
|
||||
def strip(st):
|
||||
if st.startswith('"'):
|
||||
st = st[1:-1]
|
||||
return st
|
||||
|
||||
tabcolumn=-32
|
||||
|
||||
in_keydef = False
|
||||
entry = {}
|
||||
for line in sys.stdin:
|
||||
line=line.strip()
|
||||
if line.startswith("#!"):
|
||||
(key, explanation) = line.split("=")
|
||||
report(tabcolumn, key[3:], explanation)
|
||||
elif line.startswith("#"):
|
||||
continue
|
||||
elif line == "[hotkey]":
|
||||
in_keydef = True
|
||||
elif in_keydef:
|
||||
if line == "[/hotkey]":
|
||||
binding = ''
|
||||
# Presently we ignore the Mac command key
|
||||
for mod in ("ctrl", "alt", "shift"):
|
||||
if mod in entry and entry[mod] == 'yes':
|
||||
binding += mod + "-"
|
||||
binding += strip(entry['key'])
|
||||
report(tabcolumn, binding, strip(entry['description']))
|
||||
in_keydef = False
|
||||
entry = {}
|
||||
else:
|
||||
try:
|
||||
(key, value) = line.split("=")
|
||||
except ValueError:
|
||||
print >>sys.stderr, "Malformed line: %s" % `line`
|
||||
sys.exit(1)
|
||||
entry[key] = value
|
||||
|
Loading…
x
Reference in New Issue
Block a user