Added defaultkeys.ini, which will allow us to sensible set default
shortcuts without having to hardcode that stuff
This commit is contained in:
parent
a91931c4e8
commit
ae23f6b468
6 changed files with 314 additions and 22 deletions
|
@ -3,6 +3,7 @@ all:
|
|||
mkdir -p ../build/games
|
||||
mkdir -p ../build/gl
|
||||
mkdir -p ../build/platform.game
|
||||
cp -vf ./defaultkeys.ini ../build/defaultkeys.ini
|
||||
cp -vf ./platform.game/default_build_menu.xml ../build/platform.game/default_build_menu.xml
|
||||
cp -vf ./games/platform.game ../build/games/platform.game
|
||||
cp -vf ./gl/lighting_DBS_omni_fp.glp ../build/gl/lighting_DBS_omni_fp.glp
|
||||
|
|
277
resources/defaultkeys.ini
Normal file
277
resources/defaultkeys.ini
Normal file
|
@ -0,0 +1,277 @@
|
|||
[Version]
|
||||
number=1.0-gtk-accelnames
|
||||
|
||||
[Commands]
|
||||
AddTag=
|
||||
ArbitraryRotation=
|
||||
ArbitraryScale=
|
||||
Brush3Sided=
|
||||
Brush4Sided=
|
||||
Brush5Sided=
|
||||
Brush6Sided=
|
||||
Brush7Sided=
|
||||
Brush8Sided=
|
||||
Brush9Sided=
|
||||
BrushCone=
|
||||
BrushPrism=
|
||||
BrushRock=
|
||||
BrushSphere=
|
||||
BuildMenuCustomize=
|
||||
CSGMakeHollow=
|
||||
CSGMakeRoom=
|
||||
CSGMerge=
|
||||
CSGSubtract=
|
||||
CameraAngleDown=
|
||||
CameraAngleUp=
|
||||
CameraBack=
|
||||
CameraDown=
|
||||
CameraForward=
|
||||
CameraFreeMoveBack=s
|
||||
CameraFreeMoveDown=c
|
||||
CameraFreeMoveForward=w
|
||||
CameraFreeMoveLeft=a
|
||||
CameraFreeMoveRight=d
|
||||
CameraFreeMoveUp=d
|
||||
CameraLeft=
|
||||
CameraRight=
|
||||
CameraSpeedDec=<Shift>KP_Subtract
|
||||
CameraSpeedInc=<Shift>KP_Add
|
||||
CameraStrafeLeft=comma
|
||||
CameraStrafeRight=period
|
||||
CameraUp=
|
||||
CapCurrentCurve=<Shift>c
|
||||
CenterView=End
|
||||
CenterXYView=<Primary><Shift>Tab
|
||||
ChooseBrushColor=
|
||||
ChooseCameraBackgroundColor=
|
||||
ChooseCameraSelectedBrushColor=
|
||||
ChooseClipperColor=
|
||||
ChooseGridBackgroundColor=
|
||||
ChooseGridBlockColor=
|
||||
ChooseGridMajorColor=
|
||||
ChooseGridMinorColor=
|
||||
ChooseGridTextColor=
|
||||
ChooseOrthoViewNameColor=
|
||||
ChooseSelectedBrushColor=
|
||||
ChooseSmallGridMajorColor=
|
||||
ChooseSmallGridMinorColor=
|
||||
ChooseTextureBackgroundColor=
|
||||
ClearPatchOverlays=
|
||||
ClipSelected=
|
||||
CloneSelection=
|
||||
CloneSelectionAndMakeUnique=
|
||||
ColorSchemeBlackAndGreen=
|
||||
ColorSchemeOriginal=
|
||||
ColorSchemeQER=
|
||||
ColorSchemeWS=
|
||||
ColorSchemeYdnar=
|
||||
ConnectSelection=
|
||||
Copy=
|
||||
CopyTag=
|
||||
CreateFuncGroup=
|
||||
CubicClipZoomIn=
|
||||
CubicClipZoomOut=
|
||||
CycleCapTexturePatch=
|
||||
DeleteSelection=Delete
|
||||
DeleteTag=
|
||||
DownFloor=
|
||||
DragEdges=
|
||||
DragFaces=
|
||||
DragVertices=
|
||||
EnableAlpha=
|
||||
EntityColor=
|
||||
EntityList=
|
||||
Exit=
|
||||
ExpandSelectionToEntities=
|
||||
ExportSelected=
|
||||
FaceCopyTexture=
|
||||
FacePasteTexture=
|
||||
FilterAreaportals=
|
||||
FilterBotClips=
|
||||
FilterCaulk=
|
||||
FilterClips=
|
||||
FilterClusterportals=
|
||||
FilterDecals=
|
||||
FilterDetails=
|
||||
FilterEntities=
|
||||
FilterFallback=
|
||||
FilterGroupBrushes=
|
||||
FilterHintsSkips=
|
||||
FilterLightgrid=
|
||||
FilterLights=
|
||||
FilterLiquids=
|
||||
FilterMissing=
|
||||
FilterModels=
|
||||
FilterPatches=
|
||||
FilterPaths=
|
||||
FilterStructural=
|
||||
FilterTranslucent=
|
||||
FilterTriggers=
|
||||
FilterWorldBrushes=
|
||||
FindBrush=
|
||||
FindReplaceTextures=
|
||||
FitTexture=
|
||||
FixedSize=
|
||||
FlipClip=
|
||||
GoToZero=
|
||||
GridDown=
|
||||
GridUp=
|
||||
GroupSelection=
|
||||
HideSelected=h
|
||||
HideUnselected=
|
||||
ImportMap=
|
||||
InvertCurve=
|
||||
InvertCurveTextureX=
|
||||
InvertCurveTextureY=
|
||||
InvertFilters=
|
||||
InvertSelection=
|
||||
KillConnectSelection=
|
||||
LookThroughCamera=
|
||||
LookThroughSelected=
|
||||
MakeDetail=<Primary>d
|
||||
MakeOverlayPatch=
|
||||
MakeStructural=
|
||||
MapInfo=
|
||||
MatrixTranspose=
|
||||
MirrorSelectionX=
|
||||
MirrorSelectionY=
|
||||
MirrorSelectionZ=
|
||||
MouseCreate=
|
||||
MouseCreateE=
|
||||
MouseCreateP=
|
||||
MouseDrag=
|
||||
MouseRotate=
|
||||
MouseSelect=
|
||||
MouseTranslate=
|
||||
MoveSelectionDOWN=
|
||||
MoveSelectionUP=
|
||||
NaturalizePatch=
|
||||
NewMap=
|
||||
NextLeakSpot=
|
||||
NextView=
|
||||
NormalizeColor=
|
||||
OpenMap=
|
||||
ParentSelection=
|
||||
Paste=
|
||||
PasteTag=
|
||||
PasteToCamera=
|
||||
PatchBevel=
|
||||
PatchCone=
|
||||
PatchCylinder=
|
||||
PatchDeleteFirstColumn=
|
||||
PatchDeleteFirstRow=
|
||||
PatchDeleteLastColumn=
|
||||
PatchDeleteLastRow=
|
||||
PatchDenseCylinder=
|
||||
PatchEndCap=
|
||||
PatchInsertAddColumn=
|
||||
PatchInsertAddRow=
|
||||
PatchInsertInsertColumn=
|
||||
PatchInsertInsertRow=
|
||||
PatchInspector=
|
||||
PatchSphere=
|
||||
PatchSquareBevel=
|
||||
PatchSquareCylinder=
|
||||
PatchSquareEndcap=
|
||||
PatchVeryDenseCylinder=
|
||||
PatchXactCone=
|
||||
PatchXactCylinder=
|
||||
PatchXactSphere=
|
||||
Preferences=
|
||||
PrevLeakSpot=
|
||||
ProjectSettings=
|
||||
RedisperseCols=
|
||||
RedisperseRows=
|
||||
Redo=<Primary>y
|
||||
RefreshReferences=
|
||||
RefreshShaders=
|
||||
RegionOff=
|
||||
RegionSetBrush=
|
||||
RegionSetSelection=
|
||||
RegionSetXY=
|
||||
RenameTag=
|
||||
ResetFilters=
|
||||
RotateSelectionX=
|
||||
RotateSelectionY=
|
||||
RotateSelectionZ=
|
||||
SaveMap=<Primary>s
|
||||
SaveMapAs=
|
||||
SaveRegion=
|
||||
SelectAllOfType=<Shift>a
|
||||
SelectInside=
|
||||
SelectNudgeDown=Down
|
||||
SelectNudgeLeft=Left
|
||||
SelectNudgeRight=Right
|
||||
SelectNudgeUp=Up
|
||||
SelectTouching=
|
||||
SetGrid0.125=
|
||||
SetGrid0.25=
|
||||
SetGrid0.5=
|
||||
SetGrid1=1
|
||||
SetGrid128=8
|
||||
SetGrid16=5
|
||||
SetGrid2=2
|
||||
SetGrid256=9
|
||||
SetGrid32=6
|
||||
SetGrid4=3
|
||||
SetGrid64=7
|
||||
SetGrid8=4
|
||||
ShaderInfo=
|
||||
ShowAllTextures=
|
||||
ShowAlpha=
|
||||
ShowAngles=
|
||||
ShowAxes=
|
||||
ShowBlocks=
|
||||
ShowCoordinates=
|
||||
ShowHidden=
|
||||
ShowInUse=
|
||||
ShowLighting=
|
||||
ShowNames=
|
||||
ShowStats=
|
||||
ShowUntagged=
|
||||
ShowWindowOutline=
|
||||
ShowWorkzone=
|
||||
SimplePatchMesh=
|
||||
SmoothCols=
|
||||
SmoothRows=
|
||||
SnapToGrid=
|
||||
SplitSelected=
|
||||
SurfaceInspector=
|
||||
TexRotateClock=
|
||||
TexRotateCounter=
|
||||
TexScaleDown=
|
||||
TexScaleLeft=
|
||||
TexScaleRight=
|
||||
TexScaleUp=
|
||||
TexShiftDown=
|
||||
TexShiftLeft=
|
||||
TexShiftRight=
|
||||
TexShiftUp=
|
||||
TogTexLock=
|
||||
ToggleCamera=
|
||||
ToggleClipper=
|
||||
ToggleCrosshairs=
|
||||
ToggleCubicClip=
|
||||
ToggleEntityInspector=
|
||||
ToggleExpansion=
|
||||
ToggleFrontView=
|
||||
ToggleGrid=0
|
||||
ToggleGridSnap=
|
||||
TogglePointfile=
|
||||
ToggleShowShaderlistOnly=
|
||||
ToggleShowShaders=
|
||||
ToggleSideView=
|
||||
ToggleSizePaint=
|
||||
ToggleTextures=
|
||||
ToggleView=
|
||||
UnSelectSelection=Escape
|
||||
Undo=<Primary>z
|
||||
UngroupSelection=
|
||||
UpFloor=
|
||||
ViewEntityInfo=
|
||||
ViewFront=
|
||||
ViewSide=
|
||||
ViewTop=
|
||||
Zoom100=
|
||||
ZoomIn=
|
||||
ZoomOut=
|
|
@ -598,22 +598,16 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
void LoadCommandMap(const char *path)
|
||||
void LoadCommandMap_ReadFile(const char *path)
|
||||
{
|
||||
StringOutputStream strINI(256);
|
||||
strINI << path << "shortcuts.ini";
|
||||
|
||||
FILE *f = fopen(strINI.c_str(), "r");
|
||||
if (f != 0) {
|
||||
fclose(f);
|
||||
globalOutputStream() << "loading custom shortcuts list from " << makeQuoted(strINI.c_str()) << "\n";
|
||||
globalOutputStream() << "loading custom shortcuts list from " << makeQuoted(path) << "\n";
|
||||
|
||||
Version version = version_parse(COMMANDS_VERSION);
|
||||
Version dataVersion = {0, 0};
|
||||
|
||||
{
|
||||
char value[1024];
|
||||
if (read_var(strINI.c_str(), "Version", "number", value)) {
|
||||
if (read_var(path, "Version", "number", value)) {
|
||||
dataVersion = version_parse(value);
|
||||
}
|
||||
}
|
||||
|
@ -621,14 +615,34 @@ void LoadCommandMap(const char *path)
|
|||
if (version_compatible(version, dataVersion)) {
|
||||
globalOutputStream() << "commands import: data version " << dataVersion
|
||||
<< " is compatible with code version " << version << "\n";
|
||||
ReadCommandMap visitor(strINI.c_str());
|
||||
ReadCommandMap visitor(path);
|
||||
GlobalShortcuts_foreach(visitor);
|
||||
globalOutputStream() << "parsed " << Unsigned(visitor.count()) << " custom shortcuts\n";
|
||||
} else {
|
||||
globalOutputStream() << "commands import: data version " << dataVersion
|
||||
<< " is not compatible with code version " << version << "\n";
|
||||
}
|
||||
} else {
|
||||
globalOutputStream() << "failed to load custom shortcuts from " << makeQuoted(strINI.c_str()) << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
void LoadCommandMap(const char *path, const char *defaultpath)
|
||||
{
|
||||
StringOutputStream strINI(256);
|
||||
StringOutputStream strDefault(256);
|
||||
strDefault << defaultpath << "defaultkeys.ini";
|
||||
strINI << path << "shortcuts.ini";
|
||||
|
||||
FILE *f = fopen(strINI.c_str(), "r");
|
||||
if (f != 0) {
|
||||
fclose(f);
|
||||
LoadCommandMap_ReadFile(strINI.c_str());
|
||||
} else {
|
||||
/* load the default */
|
||||
FILE *f = fopen(strDefault.c_str(), "r");
|
||||
if (f != 0) {
|
||||
fclose(f);
|
||||
LoadCommandMap_ReadFile(strDefault.c_str());
|
||||
} else {
|
||||
globalOutputStream() << "failed to load custom shortcuts from " << makeQuoted(strDefault.c_str()) << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ const KeyEvent &GlobalKeyEvents_find(const char *name);
|
|||
|
||||
void DoCommandListDlg();
|
||||
|
||||
void LoadCommandMap(const char *path);
|
||||
void LoadCommandMap(const char *path, const char* defaultpath);
|
||||
|
||||
void SaveCommandMap(const char *path);
|
||||
|
||||
|
|
10
src/main.cpp
10
src/main.cpp
|
@ -474,10 +474,12 @@ void remove_local_pid()
|
|||
|
||||
void user_shortcuts_init()
|
||||
{
|
||||
StringOutputStream path(256);
|
||||
path << SettingsPath_get() << g_pGameDescription->mGameFile.c_str() << '/';
|
||||
LoadCommandMap(path.c_str());
|
||||
SaveCommandMap(path.c_str());
|
||||
StringOutputStream shortpath(256);
|
||||
StringOutputStream path(256);
|
||||
shortpath << SettingsPath_get() << g_pGameDescription->mGameFile.c_str() << '/';
|
||||
|
||||
LoadCommandMap(shortpath.c_str(), SettingsPath_get());
|
||||
SaveCommandMap(shortpath.c_str());
|
||||
}
|
||||
|
||||
void user_shortcuts_save()
|
||||
|
|
|
@ -256,7 +256,7 @@ void setEnginePath(const char *path)
|
|||
|
||||
// App Path
|
||||
|
||||
CopiedString g_strAppPath; ///< holds the full path of the executable
|
||||
CopiedString g_strAppPath; //< holds the full path of the executable
|
||||
|
||||
const char *AppPath_get()
|
||||
{
|
||||
|
@ -529,9 +529,7 @@ void Radiant_Shutdown()
|
|||
g_gameToolsPathObservers.unrealise();
|
||||
|
||||
if (!g_preferences_globals.disable_ini) {
|
||||
globalOutputStream() << "Start writing prefs\n";
|
||||
Preferences_Save();
|
||||
globalOutputStream() << "Done prefs\n";
|
||||
}
|
||||
|
||||
Radiant_Destroy();
|
||||
|
@ -3226,7 +3224,7 @@ void MainFrame_Construct()
|
|||
Accelerator('X'));
|
||||
|
||||
GlobalToggles_insert("MouseTranslate", makeCallbackF(TranslateMode),
|
||||
ToggleItem::AddCallbackCaller(g_translatemode_button), Accelerator('W'));
|
||||
ToggleItem::AddCallbackCaller(g_translatemode_button));
|
||||
GlobalToggles_insert("MouseRotate", makeCallbackF(RotateMode), ToggleItem::AddCallbackCaller(g_rotatemode_button),
|
||||
Accelerator('R'));
|
||||
GlobalToggles_insert("MouseSelect", makeCallbackF(ScaleMode), ToggleItem::AddCallbackCaller(g_scalemode_button));
|
||||
|
|
Loading…
Reference in a new issue