Changeset 291 for trunk/UKeyBindings.pas
- Timestamp:
- Mar 2, 2021, 10:16:54 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UKeyBindings.pas
r290 r291 9 9 10 10 type 11 12 { TKeyBinding } 13 11 14 TKeyBinding = class 12 15 ShortName: string; 13 16 FullName: string; 14 17 ShortCut: TShortCut; 18 ShortCut2: TShortCut; 19 function Test(AShortCut: TShortCut): Boolean; 15 20 end; 16 21 … … 18 23 19 24 TKeyBindings = class(TFPGObjectList<TKeyBinding>) 20 function AddItem(const ShortName, FullName: string; ShortCut: TShortCut ): TKeyBinding; overload;21 function AddItem(const ShortName, FullName: string; ShortCutText: string ): TKeyBinding; overload;25 function AddItem(const ShortName, FullName: string; ShortCut: TShortCut; ShortCut2: TShortCut = 0): TKeyBinding; overload; 26 function AddItem(const ShortName, FullName: string; ShortCutText: string; ShortCutText2: string = ''): TKeyBinding; overload; 22 27 function Search(ShortName: string): TKeyBinding; 23 28 procedure LoadFromFile(FileName: string); … … 45 50 BStay: TKeyBinding; 46 51 BNoOrders: TKeyBinding; 52 BCancel: TKeyBinding; 53 BPillage: TKeyBinding; 54 BSelectTransport: TKeyBinding; 47 55 BTechTree: TKeyBinding; 48 56 BWait: TKeyBinding; 49 57 BJump: TKeyBinding; 58 BMapBtn0: TKeyBinding; 59 BMapBtn1: TKeyBinding; 60 BMapBtn4: TKeyBinding; 61 BMapBtn5: TKeyBinding; 62 BMapBtn6: TKeyBinding; 63 BSetDebugMap0: TKeyBinding; 64 BSetDebugMap1: TKeyBinding; 65 BSetDebugMap2: TKeyBinding; 66 BSetDebugMap3: TKeyBinding; 67 BSetDebugMap4: TKeyBinding; 68 BSetDebugMap5: TKeyBinding; 69 BSetDebugMap6: TKeyBinding; 70 BSetDebugMap7: TKeyBinding; 71 BSetDebugMap8: TKeyBinding; 72 BSetDebugMap9: TKeyBinding; 73 BDebugMap: TKeyBinding; 74 BLocCodes: TKeyBinding; 75 BLogDlg: TKeyBinding; 76 BNames: TKeyBinding; 77 BRun: TKeyBinding; 78 BTestMapRepaint: TKeyBinding; 79 BSetViewpoint0: TKeyBinding; 80 BSetViewpoint1: TKeyBinding; 81 BSetViewpoint2: TKeyBinding; 82 BSetViewpoint3: TKeyBinding; 83 BSetViewpoint4: TKeyBinding; 84 BSetViewpoint5: TKeyBinding; 85 BSetViewpoint6: TKeyBinding; 86 BSetViewpoint7: TKeyBinding; 87 BSetViewpoint8: TKeyBinding; 88 BSetViewpoint9: TKeyBinding; 89 BAirBase: TKeyBinding; 90 BBuildCity: TKeyBinding; 91 BEnhance: TKeyBinding; 92 BGoOn: TKeyBinding; 93 BHome: TKeyBinding; 94 BFarmClearIrrigation: TKeyBinding; 95 BLoad: TKeyBinding; 96 BAfforestMine: TKeyBinding; 97 BCanal: TKeyBinding; 98 BTrans: TKeyBinding; 99 BPollution: TKeyBinding; 100 BRailRoad: TKeyBinding; 101 BUnload: TKeyBinding; 102 BRecover: TKeyBinding; 103 BUtilize: TKeyBinding; 104 BMoveLeftDown: TKeyBinding; 105 BMoveDown: TKeyBinding; 106 BMoveRightDown: TKeyBinding; 107 BMoveRight: TKeyBinding; 108 BMoveRightUp: TKeyBinding; 109 BMoveUp: TKeyBinding; 110 BMoveLeftUp: TKeyBinding; 111 BMoveLeft: TKeyBinding; 50 112 51 113 52 114 implementation 53 115 116 { TKeyBinding } 117 118 function TKeyBinding.Test(AShortCut: TShortCut): Boolean; 119 begin 120 Result := (AShortCut = ShortCut) or (AShortCut = ShortCut2); 121 end; 122 54 123 { TKeyBindings } 55 124 56 function TKeyBindings.AddItem(const ShortName, FullName: string; ShortCut: TShortCut 57 ): TKeyBinding;125 function TKeyBindings.AddItem(const ShortName, FullName: string; ShortCut: TShortCut; 126 ShortCut2: TShortCut = 0): TKeyBinding; 58 127 begin 59 128 Result := TKeyBinding.Create; … … 61 130 Result.FullName := FullName; 62 131 Result.ShortCut := ShortCut; 132 Result.ShortCut2 := ShortCut2; 63 133 Add(Result); 64 134 end; 65 135 66 136 function TKeyBindings.AddItem(const ShortName, FullName: string; 67 ShortCutText: string): TKeyBinding; 68 begin 69 Result := AddItem(ShortName, FullName, TextToShortCut(ShortCutText)); 137 ShortCutText: string; ShortCutText2: string = ''): TKeyBinding; 138 begin 139 Result := AddItem(ShortName, FullName, TextToShortCut(ShortCutText), 140 TextToShortCut(ShortCutText2)); 70 141 end; 71 142 … … 141 212 BStay := AddItem('Stay', 'Stay', 'S'); 142 213 BNoOrders := AddItem('NoOrders', 'No orders', 'Space'); 214 BCancel := AddItem('Cancel', 'Cancel', 'Ctrl+C'); 215 BPillage := AddItem('Pillage', 'Pillage', 'Ctrl+P'); 216 BSelectTransport := AddItem('SelectTransport', 'Select transport', 'Ctrl+T'); 143 217 BTechTree := AddItem('TechTree', 'Tech tree', 'T'); 144 218 BWait := AddItem('Wait', 'Wait', 'W'); 145 219 BJump := AddItem('Jump', 'Jump 20 turns', 'Ctrl+J'); 220 BMapBtn0 := AddItem('MapButton1', 'Map button 1', '1'); 221 BMapBtn1 := AddItem('MapButton2', 'Map button 2', '2'); 222 BMapBtn4 := AddItem('MapButton3', 'Map button 3', '3'); 223 BMapBtn5 := AddItem('MapButton4', 'Map button 4', '4'); 224 BMapBtn6 := AddItem('MapButton5', 'Map button 5', '5'); 225 BSetDebugMap0 := AddItem('SetDebugMap0', 'Set debug map 0', '0'); 226 BSetDebugMap1 := AddItem('SetDebugMap1', 'Set debug map 1', '1'); 227 BSetDebugMap2 := AddItem('SetDebugMap2', 'Set debug map 2', '2'); 228 BSetDebugMap3 := AddItem('SetDebugMap3', 'Set debug map 3', '3'); 229 BSetDebugMap4 := AddItem('SetDebugMap4', 'Set debug map 4', '4'); 230 BSetDebugMap5 := AddItem('SetDebugMap5', 'Set debug map 5', '5'); 231 BSetDebugMap6 := AddItem('SetDebugMap6', 'Set debug map 6', '6'); 232 BSetDebugMap7 := AddItem('SetDebugMap7', 'Set debug map 7', '7'); 233 BSetDebugMap8 := AddItem('SetDebugMap8', 'Set debug map 8', '8'); 234 BSetDebugMap9 := AddItem('SetDebugMap9', 'Set debug map 9', '9'); 235 BDebugMap := AddItem('DebugMap', 'Debug map', 'Ctrl+K'); 236 BLocCodes := AddItem('LocCodes', 'Location codes', 'Ctrl+L'); 237 BLogDlg := AddItem('LogDlg', 'Log dialog', 'Ctrl+M'); 238 BNames := AddItem('ShowNames', 'Show names', 'Ctrl+N'); 239 BRun := AddItem('Run', 'Run', 'Ctrl+R'); 240 BTestMapRepaint := AddItem('TestMapRepaint', 'Test map reapaint', 'Ctrl+Space'); 241 BSetViewpoint0 := AddItem('SetViewpoint0', 'Set viewpoint 0', 'Ctrl+0'); 242 BSetViewpoint1 := AddItem('SetViewpoint1', 'Set viewpoint 1', 'Ctrl+1'); 243 BSetViewpoint2 := AddItem('SetViewpoint2', 'Set viewpoint 2', 'Ctrl+2'); 244 BSetViewpoint3 := AddItem('SetViewpoint3', 'Set viewpoint 3', 'Ctrl+3'); 245 BSetViewpoint4 := AddItem('SetViewpoint4', 'Set viewpoint', 'Ctrl+4'); 246 BSetViewpoint5 := AddItem('SetViewpoint0', 'Set viewpoint', 'Ctrl+5'); 247 BSetViewpoint6 := AddItem('SetViewpoint1', 'Set viewpoint', 'Ctrl+6'); 248 BSetViewpoint7 := AddItem('SetViewpoint2', 'Set viewpoint', 'Ctrl+7'); 249 BSetViewpoint8 := AddItem('SetViewpoint3', 'Set viewpoint', 'Ctrl+8'); 250 BSetViewpoint9 := AddItem('SetViewpoint4', 'Set viewpoint', 'Ctrl+9'); 251 BAirBase := AddItem('AirBase', 'Air base', 'A'); 252 BBuildCity := AddItem('BuildCity', 'Build city', 'B'); 253 BEnhance := AddItem('Enhance', 'Enhance', 'E'); 254 BGoOn := AddItem('GoOn', 'Go on', 'G'); 255 BHome := AddItem('Home', 'Home', 'H'); 256 BFarmClearIrrigation := AddItem('FarmClearIrrigation', 'Farm/Clear/Irrigation', 'I'); 257 BLoad := AddItem('Load', 'Load', 'L'); 258 BAfforestMine := AddItem('AfforestMine', 'Afforest/Mine', 'M'); 259 BCanal := AddItem('Canal', 'Canal', 'N'); 260 BTrans := AddItem('Trans', 'Trans', 'O'); 261 BPollution := AddItem('Pollution', 'Pollution', 'P'); 262 BRailRoad := AddItem('RailRoad', 'Rails/Road', 'R'); 263 BUnload := AddItem('Unload', 'Unload', 'U'); 264 BRecover := AddItem('Recover', 'Recover', 'V'); 265 BUtilize := AddItem('Utilize', 'Utilize', 'Z'); 266 BMoveLeftDown := AddItem('MoveLeftDown', 'Move unit left-down', 'Num1', 'End'); 267 BMoveDown := AddItem('MoveDown', 'Move unit down', 'Num2', 'Down'); 268 BMoveRightDown := AddItem('MoveRightDown', 'Move unit right-down', 'Num3', 'PgDn'); 269 BMoveRight := AddItem('MoveRight', 'Move unit right', 'Num6', 'Right'); 270 BMoveRightUp := AddItem('MoveRightUp', 'Move unit right-up', 'Num9', 'PgUp'); 271 BMoveUp := AddItem('MoveUp', 'Move unit up', 'Num8', 'Up'); 272 BMoveLeftUp := AddItem('MoveLeftUp', 'Move unit left-up', 'Num7', 'Home'); 273 BMoveLeft := AddItem('MoveLeft', 'Move unit left', 'Num4', 'Left'); 146 274 end; 147 275
Note:
See TracChangeset
for help on using the changeset viewer.