Proposal: new format for keeping settings and uikeys

Proposal: new format for keeping settings and uikeys

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
koshi
Lobby Developer
Posts: 1059
Joined: 14 Aug 2007, 16:15

Proposal: new format for keeping settings and uikeys

Post by koshi »

I was looking into writing a new uikyes editor and came across this: http://wxcode.sourceforge.net/components/keybinder/
Not only does it provide a cross-plattform way of grabbing key combos, but makes it also possible to store those (even in different profiles) in a plain text file via the wxFileConfig mechanism.

Possible structure (similar for settings file):

Code: Select all

nSelProfile=1
[keyprof0]
desc=Our primary keyprofile
name=Primary
action1=A dummy shortcut description|Ctrl+Shift+E
[keyprof1]
desc=Our primary keyprofile
name=Secondary
action1=A dummy shortcut description|Ctrl+h
Loading a shortcut would go something like this:

Code: Select all

commandString = ( Config->Load("keyprof0/action1","|DefaultCombo") ).AfterLast("|")
Benefits:
- only minor editing of wxKeybinder codebase gives suitable editor
- engine would only need one settings handler
- no more registry fiddling
- true per-user settings on linux, win, mac
- settings profiles in SpringSettings would be trivial to implement

Possible issues:
- the Keybinder seemingly has problems some keys (# + - on a german keyb)
- numpad keys result in strange chars
- engine would either need its own parser for the file or (better imo) depend on (or include) the neccessary wxWidgest sources

Side note: the neccesary libs are already in the win installer because SpringsSettings depends on them


IMO this should at least be pursued for the keeping of engine settings, because storing them in the registry on win is very user unfriendly.

Comments?
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Re: Proposal: new format for keeping settings and uikeys

Post by BrainDamage »

the completely new parser wouldn't be needed since spring's TDF format is basically identical with sole difference that termination char is ";" in TDF and "\n" in the format you proposed (ini file)
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Re: Proposal: new format for keeping settings and uikeys

Post by LordMatt »

Well, I have a very large uikeys.txt file that I would not like to have to remake by hand in a new setup, but other than that I don't see any downsides.
User avatar
koshi
Lobby Developer
Posts: 1059
Joined: 14 Aug 2007, 16:15

Re: Proposal: new format for keeping settings and uikeys

Post by koshi »

a little bash,sed,awk,regex magic could do the transformation for you
don't ask me though, i'm just throwing out buzz-words

as to the parser: the only thing that isn't changeable in the proposed format is the division in sections by [section/subsection] and the assignement of values with "option=value".
User avatar
Vadi
Posts: 446
Joined: 03 Jan 2008, 14:51

Re: Proposal: new format for keeping settings and uikeys

Post by Vadi »

If the only diff is ; and \n, then you can just do a regex search & replace in any text editor that supports it (I recommend Notepad++ on windows).
Jonanin
Posts: 107
Joined: 13 Jan 2008, 21:34

Re: Proposal: new format for keeping settings and uikeys

Post by Jonanin »

Sounds great, as long as it gets rid of the registry :? Will this add yet another dependency to Spring?
User avatar
koshi
Lobby Developer
Posts: 1059
Joined: 14 Aug 2007, 16:15

Re: Proposal: new format for keeping settings and uikeys

Post by koshi »

koshi wrote: - engine would either need its own parser for the file or (better imo) depend on (or include) the neccessary wxWidgest sources
BD wrote:the completely new parser wouldn't be needed since spring's TDF format is basically identical with sole difference that termination char is ";" in TDF and "\n" in the format you proposed (ini file)
No, it doesn't need to depend on wxWidgets, but it could.
User avatar
Michilus_nimbus
Posts: 634
Joined: 19 Nov 2004, 20:38

Re: Proposal: new format for keeping settings and uikeys

Post by Michilus_nimbus »

Why not use TDF for everything?
I think it's quite a nice format.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Proposal: new format for keeping settings and uikeys

Post by AF »

tdf or lua, its a pain having to mess around with masses of different file formats as it is. lets try and minimize syntactic spewage.
Post Reply

Return to “Engine”