Skip to content

Commit 9009339

Browse files
committed
revamp controls menu
- use a scrollbar for the controls list, so the layout does not jump - use a smaller menu size that fits better with the mouse tab - replace the advanced tab with a new menu to look up and edit binds - this includes modifier actions as well - see also: http://redeclipse.net/forum/viewtopic.php?f=4&t=1040
1 parent d038165 commit 9009339

File tree

1 file changed

+100
-67
lines changed

1 file changed

+100
-67
lines changed

config/menus/options.cfg

Lines changed: 100 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,112 +1590,145 @@ newgui resetcontrols [
15901590
newgui options_controls [
15911591
guiheader "keys"
15921592
guicenter [
1593-
guilist [ guistrut 28 ]
1593+
// guilist [ guistrut 28 ]
15941594
guilist [
15951595
guistrut 0.5
1596-
guitext "click an action then press the desired keys you wish to bind (press ESC when finished):"
1596+
guitext "click a key field and press the desired keys to bind"
1597+
guitext " then press Esc to deselect the input field"
15971598
guistrut 1
15981599
guilist [
15991600
guitext "state:"
16001601
guistrut 1
1601-
loop i 4 [ guiradio (at $bindtypes $i) curbindtype $i; guistrut 1 ]
1602+
loop i 4 [ guiradio (at $bindtypes $i) curbindtype $i; guistrut 2 ]
16021603
//guicheckbox "show default bind if not found" curbindshow
1603-
guispring 1
1604-
guibutton "^frrestore default controls" [showgui resetcontrols]
16051604
]
16061605
guistrut 1
16071606
curbindsign = (at $bindcalls $curbindtype)
16081607
curbindcall = (concatword $curbindsign bind)
16091608
curbindacts = (concatword $curbindsign bindactions)
16101609
curbindtits = (concatword $curbindsign bindtitles)
16111610
curbindsrch = (concatword search $curbindsign binds)
1612-
guilooplistsplit n 2 $[@curbindacts] [
1611+
//guilooplistsplit n 2 $[@curbindacts] [
1612+
guiloopscrollbar i (listlen $[@curbindacts]) 10 50 [
1613+
n = (at $[@curbindacts] $i)
16131614
guilist [
1614-
guitext (tabify (concatword (at $[@curbindtits] $gli) " ") 5)
1615-
[newbinds@curbindsign@gli] = ([@curbindsrch] $n 0 "" "" " " " " @curbindshow)
1616-
guikeyfield [newbinds@curbindsign@gli] -24 [
1615+
guitext (concatword (at $[@curbindtits] $i) " ")
1616+
[newbinds@curbindsign@i] = ([@curbindsrch] $n 0 "" "" " " " " @curbindshow)
1617+
guispring
1618+
guikeyfield [newbinds@curbindsign@i] -24 [
16171619
oldbinds = ([@@curbindsrch] @n 0 "" "" " " " " @@curbindshow)
16181620
looplist j $oldbinds [echo @@curbindcall " " $j; @@curbindcall $j ""]
1619-
looplist j $[newbinds@@curbindsign@@gli] [echo @@curbindcall $j " " @@n; @@curbindcall $j [@@@n]]
1621+
looplist j $[newbinds@@curbindsign@@i] [echo @@curbindcall $j " " @@n; @@curbindcall $j [@@@n]]
16201622
]
16211623
]
1622-
] [ guistrut 2 ]
1624+
]// [ guistrut 2 ]
1625+
guistrut 0.5
1626+
guibutton "^frrestore all default key binds" [showgui resetcontrols]
16231627
]
16241628
]
16251629

16261630
guitab "mouse"
16271631
guicenter [
16281632
guilist [
16291633
guistrut 3
1634+
guistrut 50 1
16301635
guitext "mouse overall sensitivity"
1636+
guislider sensitivity 1 100
16311637
guistrut 1
16321638
guitext "mouse yaw sensitivity"
1639+
guislider yawsensitivity 1 100
16331640
guistrut 1
16341641
guitext "mouse pitch sensitivity"
1642+
guislider pitchsensitivity 1 100
16351643
guistrut 1
16361644
guicheckbox "invert y-axis" mouseinvert
1637-
]
1638-
guistrut 3
1639-
guilist [
1640-
guistrut 3
1641-
guistrut 50 1
1642-
guislider sensitivity 1 100
1643-
guistrut 1
1644-
guislider yawsensitivity 1 100
1645-
guistrut 1
1646-
guislider pitchsensitivity 1 100
1645+
guistrut 1.5
1646+
guitext "Tip: You may want to adjust your system settings"
1647+
guitext " for accelerated mouse movement."
16471648
]
16481649
]
16491650

16501651
guitab "advanced"
16511652
guivisibletab [
16521653
guistrut 1
1653-
guicenter [guitext "click an icon to view and edit the corresponding key bind via the console (cancel with Esc)" "textures/menu"]
1654-
guistrut 1
1655-
// keys as listed in config/keyref.cfg with some different ordering
1656-
guilooplistsplit curkey 5 [
1657-
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z SPACE BACKSPACE
1658-
0 1 2 3 4 5 6 7 8 9
1659-
F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
1660-
TAB RETURN ESCAPE
1661-
MOUSE1 MOUSE2 MOUSE3 MOUSE4 MOUSE5
1662-
UP DOWN RIGHT LEFT INSERT DELETE HOME END PAGEUP PAGEDOWN
1663-
KP0 KP1 KP2 KP3 KP4 KP5 KP6 KP7 KP8 KP9
1664-
KP_PERIOD KP_DIVIDE KP_MULTIPLY KP_MINUS KP_PLUS KP_ENTER KP_EQUALS
1665-
CLEAR PAUSE EXCLAIM QUOTEDBL HASH DOLLAR AMPERSAND QUOTE
1666-
LEFTPAREN RIGHTPAREN ASTERISK PLUS COMMA MINUS PERIOD SLASH
1667-
COLON SEMICOLON LESS EQUALS GREATER QUESTION AT LEFTBRACKET BACKSLASH RIGHTBRACKET CARET UNDERSCORE BACKQUOTE
1668-
NUMLOCK CAPSLOCK SCROLLOCK
1669-
RSHIFT LSHIFT RCTRL LCTRL RALT LALT RMETA LMETA LSUPER RSUPER
1670-
MODE COMPOSE HELP PRINT SYSREQ BREAK MENU POWER EURO UNDO
1671-
] [
1672-
guilist [
1673-
guistayopen [
1674-
curbindacts = (getbind $curkey)
1675-
guibody [guiimage "textures/player" [saycommand /bind @curkey "["@curbindacts"]"] 0.5 0 [] "" (? (stringlen $curbindacts) 0x66ff66 0x666666)] [] [] (? (stringlen $curbindacts) [guitooltip (getbind $curkey)])
1676-
guibody [guiimage "textures/editing" [saycommand /editbind @curkey "["(geteditbind @curkey)"]"] 0.5 0 [] "" (? (!=s (geteditbind $curkey) $curbindacts) 0xffff00 0x666666)] [] [] (? (!=s (geteditbind $curkey) $curbindacts) [guitooltip (geteditbind $curkey)])
1677-
guibody [guiimage "textures/spectator" [saycommand /specbind @curkey "["(getspecbind @curkey)"]"] 0.5 0 [] "" (? (!=s (getspecbind $curkey) $curbindacts) 0x00ffff 0x666666)] [] [] (? (!=s (getspecbind $curkey) $curbindacts) [guitooltip (getspecbind $curkey)])
1678-
guibody [guiimage "textures/waiting" [saycommand /waitbind @curkey "["(getwaitbind @curkey)"]"] 0.5 0 [] "" (? (!=s (getwaitbind $curkey) $curbindacts) 0xffaa00 0x666666)] [] [] (? (!=s (getwaitbind $curkey) $curbindacts) [guitooltip (getwaitbind $curkey)])
1679-
guitext $curkey
1680-
guistrut 3
1681-
]
1682-
]
1683-
]
1684-
guistrut 1
1685-
guilist [
1686-
guispring 1
1687-
guitext "default bind" "textures/player" -1 0x66ff66
1688-
guispring 1
1689-
guitext "editing bind" "textures/editing" -1 0xffff00
1690-
guispring 1
1691-
guitext "spectator bind" "textures/spectator" -1 0x00ffff
1692-
guispring 1
1693-
guitext "wait bind" "textures/waiting" -1 0xffaa00
1694-
guispring 1
1695-
guitext "gray icons: not in use" "" 0x666666
1696-
guispring 1
1697-
]
1654+
guitext "Use below field to select some keys or mouse buttons"
1655+
guikeyfield curkey -50 [] -1 0 "" "" 1
1656+
guitext "Press Esc to deselect the field. Be careful when editing binds."
1657+
// use the latest key pressed only
1658+
if (> (listlen $curkey) 1) [curkey = (at $curkey (- (listlen $curkey) 1))]
1659+
// guitext [binds for the latest key pressed: @curkey]
1660+
guistrut 1
1661+
guistrut 50 1
1662+
curbind = (getbind $curkey)
1663+
if $curkey [
1664+
if $curbind [
1665+
guibox 0x333333 0xffffff [
1666+
guibutton [regular bind for @curkey:] [saycommand /bind @curkey "["@curbind"]"]
1667+
guitext $curbind "" -1 -1 800
1668+
]
1669+
// look up universal delta
1670+
if (=s "universaldelta" (at $curbind 0)) [
1671+
guistrut 0.5
1672+
guibox 0x333333 0xffffff [
1673+
guitext "this implies the following scroll actions:"
1674+
looplist i [game spec wait edit dead] [
1675+
d = (format "delta_%1_0" $i)
1676+
if (getalias $d) [
1677+
guistrut 0.5
1678+
guibutton [@d =] [saycommand /@d = "["$@d"]"]
1679+
guitext $$d "" -1 -1 1200
1680+
]
1681+
]
1682+
guitext "and more actions with modifier keys"
1683+
]
1684+
]
1685+
// look up modifiers for universal delta
1686+
if (=s "domodifier" (at $curbind 0)) [
1687+
guistrut 0.5
1688+
guibox 0x333333 0xffffff [
1689+
guitext "this implies the following scroll actions:"
1690+
looplist i [game spec wait edit dead] [
1691+
d = (format "delta_%1_%2" $i (at $curbind 1))
1692+
if (getalias $d) [
1693+
guibutton [@d =] [saycommand /@d = "["$@d"]"]
1694+
guitext $$d "" -1 -1 1200
1695+
]
1696+
]
1697+
]
1698+
]
1699+
] [
1700+
guibutton [no regular bind on @curkey. Click here to add one.] [saycommand /bind @curkey "["]
1701+
]
1702+
guistrut 1
1703+
// same thing for other bind types, mainly editbinds
1704+
looplist i [edit spec wait] [
1705+
[curbind@i] = ([get@[i]bind] $curkey)
1706+
if (!=s $curbind $[curbind@i]) [
1707+
guibox 0x333333 0xffffff [
1708+
guibutton [@i bind for @curkey:] [saycommand /@[i]bind @curkey "["@[curbind@i]"]"]
1709+
guitext $[curbind@i] "" -1 -1 1200
1710+
]
1711+
// look up modifiers for universal delta
1712+
if (=s "domodifier" (at $[curbind@i] 0)) [
1713+
guistrut 0.5
1714+
guibox 0x333333 0xffffff [
1715+
guitext "this implies the following scroll actions:"
1716+
looplist j [game spec wait edit dead] [
1717+
d = (format "delta_%1_%2" $j (at $[curbind@i] 1))
1718+
if (getalias $d) [
1719+
guibutton [@d =] [saycommand /@d = "["$@d"]"]
1720+
guitext $$d "" -1 -1 1200
1721+
]
1722+
]
1723+
]
1724+
]
1725+
] [
1726+
guibutton [no @i bind on @curkey. Click here to add one.] [saycommand /@[i]bind @curkey "["]
1727+
]
1728+
guistrut 1
1729+
]
1730+
]
16981731
]
16991732
] [
1700-
if (= $guipasses 0) [ curbindtype = 0 ]
1733+
if (= $guipasses 0) [ curbindtype = 0; curkey = "" ]
17011734
]

0 commit comments

Comments
 (0)