1{
2 ***************************************************************************
3 *                                                                         *
4 *   This source is free software; you can redistribute it and/or modify   *
5 *   it under the terms of the GNU General Public License as published by  *
6 *   the Free Software Foundation; either version 2 of the License, or     *
7 *   (at your option) any later version.                                   *
8 *                                                                         *
9 *   This code is distributed in the hope that it will be useful, but      *
10 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
11 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
12 *   General Public License for more details.                              *
13 *                                                                         *
14 *   A copy of the GNU General Public License is available on the World    *
15 *   Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also      *
16 *   obtain it by writing to the Free Software Foundation,                 *
17 *   Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1335, USA.   *
18 *                                                                         *
19 ***************************************************************************
20
21  Author: Mattias Gaertner
22
23  Abstract:
24    Contains classes to store key-command relationships, can update
25    TSynEditKeyStrokes and provides a dialog for editing a single
26    commandkey.
27}
28unit KeyMapping;
29
30{$mode objfpc}{$H+}
31
32interface
33
34uses
35  Classes, SysUtils, contnrs, Laz_AVL_Tree,
36  // LCL
37  Forms, LCLType, LCLProc,
38  // LazUtils
39  Laz2_XMLCfg,
40  // SynEdit
41  SynEditKeyCmds, SynPluginTemplateEdit, SynPluginSyncroEdit, SynPluginMultiCaret,
42  // IdeIntf
43  IDECommands,
44  // IDE
45  LazarusIDEStrConsts, Debugger;
46
47type
48  TKeyMapScheme = (
49    kmsLazarus,
50    kmsClassic,
51    kmsMacOSXApple,
52    kmsMacOSXLaz,
53    kmsDefaultToMac,
54    kmsCustom
55    );
56
57const
58  KeyMapSchemeNames: array[TKeyMapScheme] of string = (
59    'default',
60    'Classic',
61    'MacOSXApple',
62    'MacOSXLaz',
63    'WindowsToMacOSX',
64    'Custom'
65    );
66
67  (* SynEdit Plugins
68     Offsets for the fixed ec... commands, defined in IDECommands
69     Used in EditorOptions
70  *)
71  ecIdePTmplOffset      = ecSynPTmplEdNextCell - ecIdePTmplEdNextCell;
72  ecIdePTmplOutOffset   = ecSynPTmplEdNextCell - ecIdePTmplEdOutNextCell;
73  ecIdePSyncroOffset    = ecSynPSyncroEdNextCell - ecIdePSyncroEdNextCell;
74  ecIdePSyncroOutOffset = ecSynPSyncroEdNextCell - ecIdePSyncroEdOutNextCell;
75  ecIdePSyncroSelOffset = ecSynPSyncroEdStart    - ecIdePSyncroEdSelStart;
76
77type
78  //---------------------------------------------------------------------------
79  // TKeyCommandCategory is used to divide the key commands in handy packets
80  TKeyCommandCategory = class(TIDECommandCategory)
81  public
82    procedure Clear; override;
83    procedure Delete(Index: Integer); override;
84    constructor Create(const AName, ADescription: string;
85                       TheScope: TIDECommandScope);
86  end;
87
88  //---------------------------------------------------------------------------
89  // class for storing the keys of a single command (key-command relationship)
90
91  { TKeyCommandRelation }
92
93  TKeyCommandRelation = class(TIDECommand)
94  private
95    FSkipSaving: Boolean;
96    procedure SetSingle(NewKeyA: word; NewShiftA: TShiftState;
97                        NewKeyB: word; NewShiftB: TShiftState);
98    procedure SetSingle(NewKeyA: word; NewShiftA: TShiftState);
99    procedure SetCombo(NewKey1A: word; NewShift1A: TShiftState;
100                       NewKey1B: word; NewShift1B: TShiftState;
101                       NewKey2A: word; NewShift2A: TShiftState;
102                       NewKey2B: word; NewShift2B: TShiftState);
103    procedure SetCombo(NewKey1A: word; NewShift1A: TShiftState;
104                       NewKey1B: word; NewShift1B: TShiftState);
105    procedure MapShortcut(AScheme: TKeyMapScheme);
106    procedure GetDefaultKeyForCommand;
107    procedure GetDefaultKeyForWindowsScheme(AUseMetaKey: boolean=false);
108    procedure GetDefaultKeyForClassicScheme;
109    procedure GetDefaultKeyForMacOSXScheme;
110    procedure GetDefaultKeyForMacOSXLazScheme;
111  protected
112    procedure Init; override;
113  public
114    function GetLocalizedName: string; override;
115    property SkipSaving: Boolean read FSkipSaving write FSkipSaving;
116  end;
117
118
119  { TKeyStrokeList
120    Specialized and optimized container for max. 3 TSynEditKeyStrokes }
121
122  TKeyStrokeList = class
123  private
124    KeyStroke1: TSynEditKeyStroke;
125    KeyStroke2: TSynEditKeyStroke;
126    KeyStroke3: TSynEditKeyStroke;
127    FCount: Integer;    // Can be max. 3.
128    function GetItem(Index: Integer): TSynEditKeyStroke;
129    procedure PutItem(Index: Integer; AValue: TSynEditKeyStroke);
130  public
131    procedure Add(aKeyStroke: TSynEditKeyStroke);
132    property Items[Index: Integer]: TSynEditKeyStroke read GetItem write PutItem; default;
133    property Count: integer read FCount;
134  end;
135
136
137  { TLoadedKeyCommand
138    Used to keep shortcuts for unknown commands.
139    A command can be unknown, if it is currently not registered, e.g.
140    because the user started an IDE without the package that registered the command.
141    When an IDE with the package is started the shortcut is restored. }
142
143  TLoadedKeyCommand = class
144  public
145    Name: string;
146    ShortcutA: TIDEShortCut;
147    DefaultShortcutA: TIDEShortCut;
148    ShortcutB: TIDEShortCut;
149    DefaultShortcutB: TIDEShortCut;
150    function IsShortcutADefault: boolean;
151    function IsShortcutBDefault: boolean;
152    function AsString: string;
153  end;
154
155  //---------------------------------------------------------------------------
156  // class for a list of key - command relations
157
158  { TKeyCommandRelationList }
159
160  TKeyCommandRelationList = class(TIDECommands)
161  private
162    fLastKey: TIDEShortCut; // for multiple key commands
163    fRelations: TFPList;    // list of TKeyCommandRelation
164    fCategories: TFPList;   // list of TKeyCommandCategory
165    fExtToolCount: integer;
166    fLoadedKeyCommands: TAvlTree; // tree of TLoadedKeyCommand sorted for name
167    fCmdRelCache: TAvlTree; // cache for TKeyCommandRelation sorted for command
168    function AddRelation(CmdRel: TKeyCommandRelation): Integer;
169    function GetRelation(Index: integer): TKeyCommandRelation;
170    function GetRelationCount: integer;
171    function AddCategory(const Name, Description: string;
172                         TheScope: TIDECommandScope): integer;
173    function SetKeyCommandToLoadedValues(Cmd: TKeyCommandRelation): TLoadedKeyCommand;
174    function AddDefault(Category: TIDECommandCategory;
175                        const Name, LocalizedName: string; Command: word):integer;
176    procedure SetExtToolCount(NewCount: integer);
177  protected
178    function GetCategory(Index: integer): TIDECommandCategory; override;
179  public
180    constructor Create;
181    destructor Destroy; override;
182    procedure DefineCommandCategories;
183    procedure Clear;
184    function Count: integer;
185    function CategoryCount: integer; override;
186    function Find(Key: TIDEShortCut; IDEWindowClass: TCustomFormClass): TKeyCommandRelation;
187    function FindIDECommand(ACommand:word): TIDECommand; override;
188    function FindByCommand(ACommand:word): TKeyCommandRelation;
189    function FindCategoryByName(const CategoryName: string): TIDECommandCategory; override;
190    function FindCommandByName(const CommandName: string): TIDECommand; override;
191    function FindCommandsByShortCut(const ShortCutMask: TIDEShortCut;
192      IDEWindowClass: TCustomFormClass = nil): TFPList; override;
193    function RemoveShortCut(ShortCutMask: TIDEShortCut;
194      IDEWindowClass: TCustomFormClass = nil): Integer; override;
195    function TranslateKey(Key: word; Shift: TShiftState;
196      IDEWindowClass: TCustomFormClass; UseLastKey: boolean = true): word;
197    function IndexOf(ARelation: TKeyCommandRelation): integer;
198    function CommandToShortCut(ACommand: word): TShortCut;
199    function LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: String):boolean;
200    function SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: String):boolean;
201    procedure AssignTo(ASynEditKeyStrokes: TSynEditKeyStrokes;
202                       IDEWindowClass: TCustomFormClass;
203                       ACommandOffsetOffset: Integer = 0);
204    procedure Assign(List: TKeyCommandRelationList);
205    procedure LoadScheme(const SchemeName: string);
206    function CreateUniqueCategoryName(const AName: string): string;
207    function CreateUniqueCommandName(const AName: string): string;
208    function CreateNewCommandID: word;
209    function CreateCategory({%H-}Parent: TIDECommandCategory;
210                            const AName, Description: string;
211                            Scope: TIDECommandScope = nil): TIDECommandCategory; override;
212    function CreateCommand(Category: TIDECommandCategory;
213                           const AName, Description: string;
214                           const TheShortcutA, TheShortcutB: TIDEShortCut;
215                           const OnExecuteMethod: TNotifyEvent = nil;
216                           const OnExecuteProc: TNotifyProcedure = nil
217                           ): TIDECommand; override;
218    procedure RemoveCommand(ACommand: TIDECommand);
219  public
220    property ExtToolCount: integer read fExtToolCount write SetExtToolCount;// in menu
221    property Relations[Index:integer]: TKeyCommandRelation read GetRelation; default;
222    property RelationCount:integer read GetRelationCount;
223  end;
224
225function IDEShortCutEmpty(const Key: TIDEShortCut): boolean;
226function KeyAndShiftStateToEditorKeyString(const Key: TIDEShortCut): String;
227function EditorCommandToDescriptionString(cmd: word): String;
228
229function KeySchemeNameToSchemeType(const SchemeName: string): TKeyMapScheme;
230
231function ShiftStateToCfgStr(Shift: TShiftState): string;
232function KeyValuesToCfgStr(const ShortcutA, ShortcutB: TIDEShortCut): string;
233function KeyValuesToCaptionStr(const ShortcutA, ShortcutB: TIDEShortCut;
234  Brackets: Char = '['): String;
235function CfgStrToShiftState(const s: string): TShiftState;
236
237function CompareLoadedKeyCommands(Data1, Data2: Pointer): integer;
238function CompareNameWithLoadedKeyCommand(NameAsAnsiString, Key: Pointer): integer;
239
240
241implementation
242
243const
244  KeyMappingFormatVersion = 6;
245
246function KeySchemeNameToSchemeType(const SchemeName: string): TKeyMapScheme;
247begin
248  if SchemeName='' then
249    exit(kmsLazarus);
250  for Result:=Low(TKeyMapScheme) to High(TKeyMapScheme) do begin
251    if CompareText(SchemeName,KeyMapSchemeNames[Result])=0 then
252      exit;
253  end;
254  Result:=kmsCustom;
255end;
256
257function ShiftStateToCfgStr(Shift:TShiftState):string;
258var i:integer;
259begin
260  i:=0;
261  if ssCtrl in Shift then inc(i,1);
262  if ssShift in Shift then inc(i,2);
263  if ssAlt in Shift then inc(i,4);
264  if ssMeta in Shift then inc(i,8);
265  if ssSuper in Shift then inc(i,16);
266  Result:=IntToStr(i);
267end;
268
269function KeyValuesToCfgStr(const ShortcutA, ShortcutB: TIDEShortCut): string;
270begin
271  Result:=IntToStr(ShortcutA.Key1) + ',' + ShiftStateToCfgStr(ShortcutA.Shift1) + ',' +
272          IntToStr(ShortcutA.Key2) + ',' + ShiftStateToCfgStr(ShortcutA.Shift2) + ',' +
273          IntToStr(ShortcutB.Key1) + ',' + ShiftStateToCfgStr(ShortcutB.Shift1) + ',' +
274          IntToStr(ShortcutB.Key2) + ',' + ShiftStateToCfgStr(ShortcutB.Shift2);
275end;
276
277function CfgStrToShiftState(const s: string): TShiftState;
278var
279  i: LongInt;
280begin
281  Result:=[];
282  i:=StrToIntDef(s,0);
283  if (i and 1)<>0 then include(Result,ssCtrl);
284  if (i and 2)<>0 then include(Result,ssShift);
285  if (i and 4)<>0 then include(Result,ssAlt);
286  if (i and 8)<>0 then include(Result,ssMeta);
287  if (i and 16)<>0 then include(Result,ssSuper);
288end;
289
290// Compare functions for fCmdRelCache
291function CompareCmdRels(Data1, Data2: Pointer): integer;
292var
293  Key1: TKeyCommandRelation absolute Data1;
294  Key2: TKeyCommandRelation absolute Data2;
295begin
296  Result:=Key1.Command - Key2.Command;
297end;
298
299function CompareCmdWithCmdRel(aCommand, Key: Pointer): integer;
300var
301  Cmd1, Cmd2: PtrInt;
302  CmdRel: TKeyCommandRelation absolute Key;
303begin
304  {%H-}Pointer(Cmd1):=aCommand;
305  Cmd2:=CmdRel.Command;
306  Result:=Cmd1-Cmd2;
307end;
308
309// Compare functions for fLoadedKeyCommands
310function CompareLoadedKeyCommands(Data1, Data2: Pointer): integer;
311var
312  Key1: TLoadedKeyCommand absolute Data1;
313  Key2: TLoadedKeyCommand absolute Data2;
314begin
315  Result:=SysUtils.CompareText(Key1.Name,Key2.Name);
316end;
317
318function CompareNameWithLoadedKeyCommand(NameAsAnsiString, Key: Pointer): integer;
319var
320  Name: string;
321  LoadedKey: TLoadedKeyCommand absolute Key;
322begin
323  Pointer(Name):=NameAsAnsiString;
324  Result:=SysUtils.CompareText(Name,LoadedKey.Name);
325  Pointer(Name):=nil;
326end;
327
328function EditorCommandToDescriptionString(cmd: word): String;
329begin
330  case cmd of
331    ecNone                    : Result:= dlgEnvNone;
332    ecLeft                    : Result:= srkmecKeyMapLeft;
333    ecRight                   : Result:= srkmecKeyMapRight;
334    ecUp                      : Result:= lisUp;
335    ecDown                    : Result:= lisDown;
336    ecWordLeft                : Result:= srkmecWordLeft;
337    ecWordRight               : Result:= srkmecWordRight;
338    ecWordEndLeft             : Result:= srkmecWordEndLeft;
339    ecWordEndRight            : Result:= srkmecWordEndRight;
340    ecHalfWordLeft            : Result:= srkmecHalfWordLeft;
341    ecHalfWordRight           : Result:= srkmecHalfWordRight;
342    ecSmartWordLeft           : Result:= srkmecSmartWordLeft;
343    ecSmartWordRight          : Result:= srkmecSmartWordRight;
344    ecLineStart               : Result:= srkmecLineStart;
345    ecLineEnd                 : Result:= srkmecLineEnd;
346    ecPageUp                  : Result:= srkmecPageUp;
347    ecPageDown                : Result:= srkmecPageDown;
348    ecPageLeft                : Result:= srkmecPageLeft;
349    ecPageRight               : Result:= srkmecPageRight;
350    ecPageTop                 : Result:= srkmecPageTop;
351    ecPageBottom              : Result:= srkmecPageBottom;
352    ecEditorTop               : Result:= srkmecEditorTop;
353    ecEditorBottom            : Result:= srkmecEditorBottom;
354    ecGotoXY                  : Result:= srkmecGotoXY;
355    ecLineTextStart           : Result:= srkmecLineTextStart;
356    ecStickySelection         : Result:= srkmecSelSticky;
357    ecStickySelectionCol      : Result:= srkmecSelStickyCol;
358    ecStickySelectionLine     : Result:= srkmecSelStickyLine;
359    ecStickySelectionStop     : Result:= srkmecSelStickyStop;
360    ecSelLeft                 : Result:= srkmecSelLeft;
361    ecSelRight                : Result:= srkmecSelRight;
362    ecSelUp                   : Result:= srkmecSelUp;
363    ecSelDown                 : Result:= srkmecSelDown;
364    ecSelWordLeft             : Result:= srkmecSelWordLeft;
365    ecSelWordRight            : Result:= srkmecSelWordRight;
366    ecSelWordEndLeft          : Result:= srkmecSelWordEndLeft;
367    ecSelWordEndRight         : Result:= srkmecSelWordEndRight;
368    ecSelHalfWordLeft         : Result:= srkmecSelHalfWordLeft;
369    ecSelHalfWordRight        : Result:= srkmecSelHalfWordRight;
370    ecSelSmartWordLeft        : Result:= srkmecSelSmartWordLeft;
371    ecSelSmartWordRight       : Result:= srkmecSelSmartWordRight;
372    ecSelLineStart            : Result:= srkmecSelLineStart;
373    ecSelLineEnd              : Result:= srkmecSelLineEnd;
374    ecSelPageUp               : Result:= srkmecSelPageUp;
375    ecSelPageDown             : Result:= srkmecSelPageDown;
376    ecSelPageLeft             : Result:= srkmecSelPageLeft;
377    ecSelPageRight            : Result:= srkmecSelPageRight;
378    ecSelPageTop              : Result:= srkmecSelPageTop;
379    ecSelPageBottom           : Result:= srkmecSelPageBottom;
380    ecSelEditorTop            : Result:= srkmecSelEditorTop;
381    ecSelEditorBottom         : Result:= srkmecSelEditorBottom;
382    ecSelLineTextStart        : Result:= srkmecSelLineTextStart;
383    ecColSelUp                : Result:= srkmecColSelUp;
384    ecColSelDown              : Result:= srkmecColSelDown;
385    ecColSelLeft              : Result:= srkmecColSelLeft;
386    ecColSelRight             : Result:= srkmecColSelRight;
387    ecColSelWordLeft          : Result:= srkmecColSelWordLeft;
388    ecColSelWordRight         : Result:= srkmecColSelWordRight;
389    ecColSelPageDown          : Result:= srkmecColSelPageDown;
390    ecColSelPageBottom        : Result:= srkmecColSelPageBottom;
391    ecColSelPageUp            : Result:= srkmecColSelPageUp;
392    ecColSelPageTop           : Result:= srkmecColSelPageTop;
393    ecColSelLineStart         : Result:= srkmecColSelLineStart;
394    ecColSelLineEnd           : Result:= srkmecColSelLineEnd;
395    ecColSelEditorTop         : Result:= srkmecColSelEditorTop;
396    ecColSelEditorBottom      : Result:= srkmecColSelEditorBottom;
397    ecColSelLineTextStart     : Result:= srkmecColSelLineTextStart;
398    ecSelGotoXY               : Result:= srkmecSelGotoXY;
399    ecSelectAll               : Result:= srkmecSelectAll;
400    ecDeleteLastChar          : Result:= srkmecDeleteLastChar;
401    ecDeleteChar              : Result:= srkmecDeleteChar;
402    ecDeleteWord              : Result:= srkmecDeleteWord;
403    ecDeleteLastWord          : Result:= srkmecDeleteLastWord;
404    ecDeleteBOL               : Result:= srkmecDeleteBOL;
405    ecDeleteEOL               : Result:= srkmecDeleteEOL;
406    ecDeleteLine              : Result:= srkmecDeleteLine;
407    ecClearAll                : Result:= srkmecClearAll;
408    ecLineBreak               : Result:= srkmecLineBreak;
409    ecInsertLine              : Result:= srkmecInsertLine;
410    ecChar                    : Result:= srkmecChar;
411    ecImeStr                  : Result:= srkmecImeStr;
412    ecUndo                    : Result:= lisUndo;
413    ecRedo                    : Result:= lisRedo;
414    ecCut                     : Result:= srkmecCut;
415    ecCopy                    : Result:= srkmecCopy;
416    ecPaste                   : Result:= srkmecPaste;
417    ecCopyAdd                 : Result:= srkmecCopyAdd;
418    ecCutAdd                  : Result:= srkmecCutAdd;
419    ecCopyCurrentLine         : Result:= srkmecCopyCurrentLine;
420    ecCopyAddCurrentLine      : Result:= srkmecCopyAddCurrentLine;
421    ecCutCurrentLine          : Result:= srkmecCutCurrentLine;
422    ecCutAddCurrentLine       : Result:= srkmecCutAddCurrentLine;
423    ecMoveLineUp              : Result:= srkmecMoveLineUp;
424    ecMoveLineDown            : Result:= srkmecMoveLineDown;
425    ecDuplicateLine           : Result:= srkmecDuplicateLine;
426    ecMoveSelectUp            : Result:= srkmecMoveSelectUp;
427    ecMoveSelectDown          : Result:= srkmecMoveSelectDown;
428    ecMoveSelectLeft          : Result:= srkmecMoveSelectLeft;
429    ecMoveSelectRight         : Result:= srkmecMoveSelectRight;
430    ecDuplicateSelection      : Result:= srkmecDuplicateSelection;
431    ecMultiPaste              : Result:= srkmecMultiPaste;
432    ecScrollUp                : Result:= srkmecScrollUp;
433    ecScrollDown              : Result:= srkmecScrollDown;
434    ecScrollLeft              : Result:= srkmecScrollLeft;
435    ecScrollRight             : Result:= srkmecScrollRight;
436    ecInsertMode              : Result:= srkmecInsertMode;
437    ecOverwriteMode           : Result:= srkmecOverwriteMode;
438    ecToggleMode              : Result:= srkmecToggleMode;
439    ecBlockIndent             : Result:= srkmecBlockIndent;
440    ecBlockUnindent           : Result:= srkmecBlockUnindent;
441    ecTab                     : Result:= lisTab;
442    ecShiftTab                : Result:= srkmecShiftTab;
443    ecMatchBracket            : Result:= srkmecMatchBracket;
444    ecNormalSelect            : Result:= srkmecNormalSelect;
445    ecColumnSelect            : Result:= srkmecColumnSelect;
446    ecLineSelect              : Result:= srkmecLineSelect;
447    ecAutoCompletion          : Result:= srkmecAutoCompletion;
448    ecSetFreeBookmark         : Result:= srkmecSetFreeBookmark;
449    ecClearBookmarkForFile    : Result:= srkmecClearBookmarkForFile;
450    ecClearAllBookmark        : Result:= srkmecClearAllBookmark;
451    ecPrevBookmark            : Result:= srkmecPrevBookmark;
452    ecNextBookmark            : Result:= srkmecNextBookmark;
453    ecGotoMarker0 ..
454    ecGotoMarker9             : Result:= Format(srkmecGotoMarker,[cmd-ecGotoMarker0]);
455    ecSetMarker0 ..
456    ecSetMarker9              : Result:= Format(srkmecSetMarker,[cmd-ecSetMarker0]);
457    ecToggleMarker0 ..
458    ecToggleMarker9           : Result:= Format(srkmecToggleMarker,[cmd-ecToggleMarker0]);
459    ecGotoBookmarks           : Result:= uemGotoBookmarks;
460    ecToggleBookmarks         : Result:= uemToggleBookmarks;
461    ecBlockSetBegin   : Result := srkmecBlockSetBegin;
462    ecBlockSetEnd     : Result := srkmecBlockSetEnd;
463    ecBlockToggleHide : Result := srkmecBlockToggleHide;
464    ecBlockHide       : Result := srkmecBlockHide;
465    ecBlockShow       : Result := srkmecBlockShow;
466    ecBlockMove       : Result := srkmecBlockMove;
467    ecBlockCopy       : Result := srkmecBlockCopy;
468    ecBlockDelete     : Result := srkmecBlockDelete;
469    ecBlockGotoBegin  : Result := srkmecBlockGotoBegin;
470    ecBlockGotoEnd    : Result := srkmecBlockGotoEnd;
471
472    ecZoomOut         : Result := srkmecZoomOut;
473    ecZoomIn          : Result := srkmecZoomIn;
474    ecZoomNorm        : Result := dlfMouseSimpleButtonZoomReset;
475
476    // multi caret
477    ecPluginMultiCaretSetCaret          : Result := srkmecPluginMultiCaretSetCaret;
478    ecPluginMultiCaretUnsetCaret        : Result := srkmecPluginMultiCaretUnsetCaret;
479    ecPluginMultiCaretToggleCaret       : Result := srkmecPluginMultiCaretToggleCaret;
480    ecPluginMultiCaretClearAll          : Result := srkmecPluginMultiCaretClearAll;
481
482    ecPluginMultiCaretModeCancelOnMove  : Result := srkmecPluginMultiCaretModeCancelOnMove;
483    ecPluginMultiCaretModeMoveAll       : Result := srkmecPluginMultiCaretModeMoveAll;
484
485
486    // sourcenotebook
487    ecNextEditor              : Result:= srkmecNextEditor;
488    ecPrevEditor              : Result:= srkmecPrevEditor;
489    ecPrevEditorInHistory     : Result:= srkmecPrevEditorInHistory;
490    ecNextEditorInHistory     : Result:= srkmecNextEditorInHistory;
491    ecMoveEditorLeft          : Result:= srkmecMoveEditorLeft;
492    ecMoveEditorRight         : Result:= srkmecMoveEditorRight;
493    ecMoveEditorLeftmost      : Result:= srkmecMoveEditorLeftmost;
494    ecMoveEditorRightmost     : Result:= srkmecMoveEditorRightmost;
495    ecToggleBreakPoint        : Result:= srkmecToggleBreakPoint;
496    ecToggleBreakPointEnabled : Result:= srkmecToggleBreakPointEnabled;
497    ecRemoveBreakPoint        : Result:= srkmecRemoveBreakPoint;
498
499    ecNextSharedEditor:        Result := srkmecNextSharedEditor;
500    ecPrevSharedEditor:        Result := srkmecPrevSharedEditor;
501    ecNextWindow:              Result := srkmecNextWindow;
502    ecPrevWindow:              Result := srkmecPrevWindow;
503    ecMoveEditorNextWindow:    Result := srkmecMoveEditorNextWindow;
504    ecMoveEditorPrevWindow:    Result := srkmecMoveEditorPrevWindow;
505    ecMoveEditorNewWindow:     Result := srkmecMoveEditorNewWindow;
506    ecCopyEditorNextWindow:    Result := srkmecCopyEditorNextWindow;
507    ecCopyEditorPrevWindow:    Result := srkmecCopyEditorPrevWindow;
508    ecCopyEditorNewWindow:     Result := srkmecCopyEditorNewWindow;
509
510    ecLockEditor:              Result := srkmecLockEditor;
511
512    ecGotoEditor1..
513    ecGotoEditor0             : Result:= Format(srkmecGotoEditor,[cmd-ecGotoEditor1]);
514    EcFoldLevel1..
515    EcFoldLevel9             : Result:= Format(srkmEcFoldLevel,[cmd-EcFoldLevel1]);
516    EcFoldLevel0             : Result:= srkmecUnFoldAll;
517    EcFoldCurrent            : Result:= srkmecFoldCurrent;
518    EcUnFoldCurrent          : Result:= srkmecUnFoldCurrent;
519    EcToggleMarkupWord       : Result := srkmecToggleMarkupWord;
520
521    // file menu
522    ecNew                     : Result:= lisMenuNewOther;
523    ecNewUnit                 : Result:= lisMenuNewUnit;
524    ecNewForm                 : Result:= lisMenuNewForm;
525    ecOpen                    : Result:= lisMenuOpen;
526    ecOpenUnit                : Result:= lisMenuOpenUnit;
527    ecOpenRecent              : Result:= lisKMOpenRecent;
528    ecRevert                  : Result:= lisMenuRevert;
529    ecSave                    : Result:= lisSave;
530    ecSaveAs                  : Result:= lisMenuSaveAs;
531    ecSaveAll                 : Result:= lisSaveAll;
532    ecClose                   : Result:= lisClose;
533    ecCloseAll                : Result:= lisMenuCloseAll;
534    ecCloseOtherTabs          : Result:= uemCloseOtherPages;
535    ecCloseRightTabs          : Result:= uemCloseOtherPagesRight;
536    ecCleanDirectory          : Result:= lisMenuCleanDirectory;
537    ecRestart                 : Result:= lisRestart;
538    ecQuit                    : Result:= lisQuit;
539
540    // edit menu
541    ecSelectionUpperCase      : Result:= lisMenuUpperCaseSelection;
542    ecSelectionLowerCase      : Result:= lisMenuLowerCaseSelection;
543    ecSelectionSwapCase       : Result:= lisMenuSwapCaseSelection;
544    ecSelectionTabs2Spaces    : Result:= srkmecSelectionTabs2Spaces;
545    ecSelectionEnclose        : Result:= lisMenuEncloseSelection;
546    ecSelectionComment        : Result:= lisMenuCommentSelection;
547    ecSelectionUncomment      : Result:= lisMenuUncommentSelection;
548    ecToggleComment           : Result:= lisMenuToggleComment;
549    ecSelectionEncloseIFDEF   : Result:= lisMenuEncloseInIFDEF;
550    ecSelectionSort           : Result:= lisMenuSortSelection;
551    ecSelectionBreakLines     : Result:= lisMenuBeakLinesInSelection;
552    ecSelectToBrace           : Result:= lisMenuSelectToBrace;
553    ecSelectCodeBlock         : Result:= lisMenuSelectCodeBlock;
554    ecSelectWord              : Result:= lisMenuSelectWord;
555    ecSelectLine              : Result:= lisMenuSelectLine;
556    ecSelectParagraph         : Result:= lisMenuSelectParagraph;
557    ecInsertCharacter         : Result:= srkmecInsertCharacter;
558    ecInsertGPLNotice         : Result:= srkmecInsertGPLNotice;
559    ecInsertGPLNoticeTranslated: Result:= srkmecInsertGPLNoticeTranslated;
560    ecInsertLGPLNotice        : Result:= srkmecInsertLGPLNotice;
561    ecInsertLGPLNoticeTranslated: Result:= srkmecInsertLGPLNoticeTranlated;
562    ecInsertModifiedLGPLNotice: Result:= srkmecInsertModifiedLGPLNotice;
563    ecInsertModifiedLGPLNoticeTranslated: Result:= srkmecInsertModifiedLGPLNoticeTranslated;
564    ecInsertMITNotice         : Result:= srkmecInsertMITNotice;
565    ecInsertMITNoticeTranslated: Result:= srkmecInsertMITNoticeTranslated;
566    ecInsertUserName          : Result:= srkmecInsertUserName;
567    ecInsertDateTime          : Result:= srkmecInsertDateTime;
568    ecInsertChangeLogEntry    : Result:= srkmecInsertChangeLogEntry;
569    ecInsertCVSAuthor         : Result:= srkmecInsertCVSAuthor;
570    ecInsertCVSDate           : Result:= srkmecInsertCVSDate;
571    ecInsertCVSHeader         : Result:= srkmecInsertCVSHeader;
572    ecInsertCVSID             : Result:= srkmecInsertCVSID;
573    ecInsertCVSLog            : Result:= srkmecInsertCVSLog;
574    ecInsertCVSName           : Result:= srkmecInsertCVSName;
575    ecInsertCVSRevision       : Result:= srkmecInsertCVSRevision;
576    ecInsertCVSSource         : Result:= srkmecInsertCVSSource;
577    ecInsertGUID              : Result:= srkmecInsertGUID;
578    ecInsertFilename          : Result:= srkmecInsertFilename;
579
580    // search menu
581    ecFind                    : Result:= srkmecFind;
582    ecFindNext                : Result:= srkmecFindNext;
583    ecFindPrevious            : Result:= srkmecFindPrevious;
584    ecFindInFiles             : Result:= srkmecFindInFiles;
585    ecReplace                 : Result:= srkmecReplace;
586    ecIncrementalFind         : Result:= lisMenuIncrementalFind;
587    ecFindProcedureDefinition : Result:= srkmecFindProcedureDefinition;
588    ecFindProcedureMethod     : Result:= srkmecFindProcedureMethod;
589    ecGotoLineNumber          : Result:= srkmecGotoLineNumber;
590    ecFindNextWordOccurrence  : Result:= srkmecFindNextWordOccurrence;
591    ecFindPrevWordOccurrence  : Result:= srkmecFindPrevWordOccurrence;
592    ecJumpBack                : Result:= lisMenuJumpBack;
593    ecJumpForward             : Result:= lisMenuJumpForward;
594    ecAddJumpPoint            : Result:= srkmecAddJumpPoint;
595    ecJumpToNextError         : Result:= lisMenuJumpToNextError;
596    ecJumpToPrevError         : Result:= lisMenuJumpToPrevError;
597    ecGotoIncludeDirective    : Result:= srkmecGotoIncludeDirective;
598    ecJumpToSection           : Result:= lisMenuJumpTo;
599    ecJumpToInterface         : Result:= lisMenuJumpToInterface;
600    ecJumpToInterfaceUses     : Result:= lisMenuJumpToInterfaceUses;
601    ecJumpToImplementation    : Result:= lisMenuJumpToImplementation;
602    ecJumpToImplementationUses: Result:= lisMenuJumpToImplementationUses;
603    ecJumpToInitialization    : Result:= lisMenuJumpToInitialization;
604    ecJumpToProcedureHeader   : Result:= lisMenuJumpToProcedureHeader;
605    ecJumpToProcedureBegin    : Result:= lisMenuJumpToProcedureBegin;
606    ecOpenFileAtCursor        : Result:= srkmecOpenFileAtCursor;
607    ecProcedureList           : Result:= lisPListProcedureList;
608
609    // view menu
610    ecToggleFormUnit          : Result:= srkmecToggleFormUnit;
611    ecToggleObjectInsp        : Result:= srkmecToggleObjectInsp;
612    ecToggleSourceEditor      : Result:= srkmecToggleSourceEditor;
613    ecToggleCodeExpl          : Result:= srkmecToggleCodeExpl;
614    ecToggleFPDocEditor       : Result:= srkmecToggleFPDocEditor;
615    ecToggleMessages          : Result:= srkmecToggleMessages;
616    ecToggleSearchResults     : Result:= srkmecToggleSearchResults;
617    ecToggleWatches           : Result:= srkmecToggleWatches;
618    ecToggleBreakPoints       : Result:= srkmecToggleBreakPoints;
619    ecToggleDebuggerOut       : Result:= srkmecToggleDebuggerOut;
620    ecToggleLocals            : Result:= srkmecToggleLocals;
621    ecViewThreads             : Result:= srkmecViewThreads;
622    ecViewPseudoTerminal      : Result:= srkmecViewPseudoTerminal;
623    ecToggleCallStack         : Result:= srkmecToggleCallStack;
624    ecToggleRegisters         : Result:= srkmecToggleRegisters;
625    ecToggleAssembler         : Result:= srkmecToggleAssembler;
626    ecViewHistory             : Result:= srkmecViewHistory;
627    ecViewUnitDependencies    : Result:= srkmecViewUnitDependencies;
628    ecViewUnitInfo            : Result:= srkmecViewUnitInfo;
629    ecViewAnchorEditor        : Result:= srkmecViewAnchorEditor;
630    ecViewTabOrder            : Result:= srkmecViewTabOrder;
631    ecToggleCodeBrowser       : Result:= srkmecToggleCodeBrowser;
632    ecToggleRestrictionBrowser: Result:= srkmecToggleRestrictionBrowser;
633    ecViewComponents          : Result:= srkmecViewComponents;
634    ecViewMacroList           : Result:= srkmecViewEditorMacros;
635    ecViewJumpHistory         : Result:= lisMenuViewJumpHistory;
636    ecToggleCompPalette       : Result:= srkmecToggleCompPalette;
637    ecToggleIDESpeedBtns      : Result:= srkmecToggleIDESpeedBtns;
638
639    // codetools
640    ecWordCompletion          : Result:= srkmecWordCompletion;
641    ecCompleteCode            : Result:= lisMenuCompleteCode;
642    ecCompleteCodeInteractive : Result:= lisMenuCompleteCodeInteractive;
643    ecIdentCompletion         : Result:= dlgedidcomlet;
644    ecShowCodeContext         : Result:= srkmecShowCodeContext;
645    ecExtractProc             : Result:= srkmecExtractProc;
646    ecFindIdentifierRefs      : Result:= srkmecFindIdentifierRefs;
647    ecFindUsedUnitRefs        : Result:= lisMenuFindReferencesOfUsedUnit;
648    ecRenameIdentifier        : Result:= srkmecRenameIdentifier;
649    ecInvertAssignment        : Result:= srkmecInvertAssignment;
650    ecSyntaxCheck             : Result:= srkmecSyntaxCheck;
651    ecGuessUnclosedBlock      : Result:= lismenuguessunclosedblock;
652    ecGuessMisplacedIFDEF     : Result:= srkmecGuessMisplacedIFDEF;
653    ecConvertDFM2LFM          : Result:= lismenuConvertDFMToLFM;
654    ecCheckLFM                : Result:= lisMenuCheckLFM;
655    ecConvertDelphiUnit       : Result:= lisMenuConvertDelphiUnit;
656    ecConvertDelphiProject    : Result:= lisMenuConvertDelphiProject;
657    ecConvertDelphiPackage    : Result:= lisMenuConvertDelphiPackage;
658    ecConvertEncoding         : Result:= lisMenuConvertEncoding;
659    ecFindDeclaration         : Result:= srkmecFindDeclaration;
660    ecFindBlockOtherEnd       : Result:= srkmecFindBlockOtherEnd;
661    ecFindBlockStart          : Result:= srkmecFindBlockStart;
662    ecShowAbstractMethods     : Result:= srkmecShowAbstractMethods;
663    ecRemoveEmptyMethods      : Result:= srkmecRemoveEmptyMethods;
664    ecRemoveUnusedUnits       : Result:= srkmecRemoveUnusedUnits;
665    ecUseUnit                 : Result:= lisUseUnit;
666    ecFindOverloads           : Result:= srkmecFindOverloads;
667
668    // project (menu string resource)
669    ecNewProject              : Result:= lisMenuNewProject;
670    ecNewProjectFromFile      : Result:= lisMenuNewProjectFromFile;
671    ecOpenProject             : Result:= lisMenuOpenProject;
672    ecOpenRecentProject       : Result:= lisMenuOpenRecentProject;
673    ecCloseProject            : Result:= lisMenuCloseProject;
674    ecSaveProject             : Result:= lisMenuSaveProject;
675    ecSaveProjectAs           : Result:= lisMenuSaveProjectAs;
676    ecProjectResaveFormsWithI18n: Result:= lisMenuResaveFormsWithI18n;
677    ecPublishProject          : Result:= lisMenuPublishProject;
678    ecProjectInspector        : Result:= lisMenuProjectInspector;
679    ecAddCurUnitToProj        : Result:= lisMenuAddToProject;
680    ecRemoveFromProj          : Result:= lisMenuRemoveFromProject;
681    ecViewProjectUnits        : Result:= srkmecViewUnits;
682    ecViewProjectForms        : Result:= srkmecViewForms;
683    ecViewProjectSource       : Result:= lisMenuViewProjectSource;
684    ecProjectOptions          : Result:= lisMenuProjectOptions;
685    ecProjectChangeBuildMode  : Result:= lisChangeBuildMode;
686
687    // run menu (menu string resource)
688    ecCompile                 : Result:= srkmecCompile;
689    ecBuild                   : Result:= srkmecBuild;
690    ecQuickCompile            : Result:= srkmecQuickCompile;
691    ecCleanUpAndBuild         : Result:= srkmecCleanUpAndBuild;
692    ecBuildManyModes          : Result:= srkmecBuildManyModes;
693    ecAbortBuild              : Result:= srkmecAbortBuild;
694    ecRunWithoutDebugging     : Result:= srkmecRunWithoutDebugging;
695    ecRun                     : Result:= srkmecRun;
696    ecPause                   : Result:= srkmecPause;
697    ecShowExecutionPoint      : Result:= srkmecShowExecutionPoint;
698    ecStepInto                : Result:= lisMenuStepInto;
699    ecStepOver                : Result:= lisMenuStepOver;
700    ecStepIntoInstr           : Result:= lisMenuStepIntoInstr;
701    ecStepOverInstr           : Result:= lisMenuStepOverInstr;
702    ecStepIntoContext         : Result:= lisMenuStepIntoContext;
703    ecStepOverContext         : Result:= lisMenuStepOverContext;
704    ecStepOut                 : Result:= lisMenuStepOut;
705    ecAttach                  : Result:= srkmecAttach;
706    ecDetach                  : Result:= srkmecDetach;
707    ecStepToCursor             : Result:= lisMenuStepToCursor;
708    ecRunToCursor             : Result:= lisMenuRunToCursor;
709    ecStopProgram             : Result:= srkmecStopProgram;
710    ecResetDebugger           : Result:= srkmecResetDebugger;
711    ecRunParameters           : Result:= srkmecRunParameters;
712    ecBuildFile               : Result:= srkmecBuildFile;
713    ecRunFile                 : Result:= srkmecRunFile;
714    ecConfigBuildFile         : Result:= srkmecConfigBuildFile;
715    ecInspect                 : Result:= srkmecInspect;
716    ecEvaluate                : Result:= srkmecEvaluate;
717    ecAddWatch                : Result:= srkmecAddWatch;
718    ecAddBpSource             : Result:= srkmecAddBpSource;
719    ecAddBpAddress            : Result:= srkmecAddBpAddress;
720    ecAddBpDataWatch          : Result:= srkmecAddBpWatchPoint;
721
722    // components menu
723    ecNewPackage              : Result:= lisKMNewPackage;
724    ecOpenPackage             : Result:= lisMenuOpenPackage;
725    ecOpenPackageFile         : Result:= lisMenuOpenPackageFile;
726    ecOpenPackageOfCurUnit    : Result:= lisMenuOpenPackageOfCurUnit;
727    ecOpenRecentPackage       : Result:= lisMenuOpenRecentPkg;
728    ecAddCurFileToPkg         : Result:= lisMenuAddCurFileToPkg;
729    ecNewPkgComponent         : Result:= lisMenuPkgNewPackageComponent;
730    ecPackageGraph            : Result:= lisMenuPackageGraph;
731    ecPackageLinks            : Result:= lisMenuPackageLinks;
732    ecEditInstallPkgs         : Result:= lisMenuEditInstallPkgs;
733    ecConfigCustomComps       : Result:= lisMenuConfigCustomComps;
734
735    // tools menu
736    ecEnvironmentOptions      : Result:= srkmecEnvironmentOptions;
737    ecRescanFPCSrcDir         : Result:= lisMenuRescanFPCSourceDirectory;
738    ecEditCodeTemplates       : Result:= lisMenuEditCodeTemplates;
739    ecCodeToolsDefinesEd      : Result:= lisKMCodeToolsDefinesEditor;
740    ecManageDesktops          : Result:= lisDesktops;
741
742    ecExtToolSettings         : Result:= srkmecExtToolSettings;
743    ecManageExamples          : Result:= lisMenuExampleProjects;
744    ecConfigBuildLazarus      : Result:= lismenuconfigurebuildlazarus;
745    ecBuildLazarus            : Result:= srkmecBuildLazarus;
746    ecExtToolFirst
747    ..ecExtToolLast           : Result:= Format(srkmecExtTool,[cmd-ecExtToolFirst+1]);
748    ecMakeResourceString      : Result:= srkmecMakeResourceString;
749    ecDiff                    : Result:= srkmecDiff;
750
751    // window menu
752    ecManageSourceEditors     : Result:= lisSourceEditorWindowManager;
753
754    // help menu
755    ecAboutLazarus            : Result:= lisAboutLazarus;
756    ecOnlineHelp              : Result:= lisMenuOnlineHelp;
757    ecContextHelp             : Result:= lisMenuContextHelp;
758    ecEditContextHelp         : Result:= lisMenuEditContextHelp;
759    ecReportingBug            : Result:= srkmecReportingBug;
760    ecFocusHint               : Result:= lisFocusHint;
761    ecSmartHint               : Result:= lisMenuShowSmartHint;
762
763    // desginer
764    ecDesignerCopy            : Result:= lisDsgCopyComponents;
765    ecDesignerCut             : Result:= lisDsgCutComponents;
766    ecDesignerPaste           : Result:= lisDsgPasteComponents;
767    ecDesignerSelectParent    : Result:= lisDsgSelectParentComponent;
768    ecDesignerMoveToFront     : Result:= lisDsgOrderMoveToFront;
769    ecDesignerMoveToBack      : Result:= lisDsgOrderMoveToBack;
770    ecDesignerForwardOne      : Result:= lisDsgOrderForwardOne;
771    ecDesignerBackOne         : Result:= lisDsgOrderBackOne;
772
773    // macro
774    ecSynMacroRecord          : Result:= srkmecSynMacroRecord;
775    ecSynMacroPlay            : Result:= srkmecSynMacroPlay;
776
777    // Edit template
778    ecIdePTmplEdNextCell:                Result := srkmecSynPTmplEdNextCell;
779    ecIdePTmplEdNextCellSel:             Result := srkmecSynPTmplEdNextCellSel;
780    ecIdePTmplEdNextCellRotate:          Result := srkmecSynPTmplEdNextCellRotate;
781    ecIdePTmplEdNextCellSelRotate:       Result := srkmecSynPTmplEdNextCellSelRotate;
782    ecIdePTmplEdPrevCell:                Result := srkmecSynPTmplEdPrevCell;
783    ecIdePTmplEdPrevCellSel:             Result := srkmecSynPTmplEdPrevCellSel;
784    ecIdePTmplEdNextFirstCell:           Result := srkmecSynPTmplEdNextFirstCell;
785    ecIdePTmplEdNextFirstCellSel:        Result := srkmecSynPTmplEdNextFirstCellSel;
786    ecIdePTmplEdNextFirstCellRotate:     Result := srkmecSynPTmplEdNextFirstCellRotate;
787    ecIdePTmplEdNextFirstCellSelRotate:  Result := srkmecSynPTmplEdNextFirstCellSelRotate;
788    ecIdePTmplEdPrevFirstCell:           Result := srkmecSynPTmplEdPrevFirstCell;
789    ecIdePTmplEdPrevFirstCellSel:        Result := srkmecSynPTmplEdPrevFirstCellSel;
790    ecIdePTmplEdCellHome:                Result := srkmecSynPTmplEdCellHome;
791    ecIdePTmplEdCellEnd:                 Result := srkmecSynPTmplEdCellEnd;
792    ecIdePTmplEdCellSelect:              Result := srkmecSynPTmplEdCellSelect;
793    ecIdePTmplEdFinish:                  Result := srkmecSynPTmplEdFinish;
794    ecIdePTmplEdEscape:                  Result := srkmecSynPTmplEdEscape;
795    // Edit template
796    ecIdePTmplEdOutNextCell:                Result := srkmecSynPTmplEdNextCell;
797    ecIdePTmplEdOutNextCellSel:             Result := srkmecSynPTmplEdNextCellSel;
798    ecIdePTmplEdOutNextCellRotate:          Result := srkmecSynPTmplEdNextCellRotate;
799    ecIdePTmplEdOutNextCellSelRotate:       Result := srkmecSynPTmplEdNextCellSelRotate;
800    ecIdePTmplEdOutPrevCell:                Result := srkmecSynPTmplEdPrevCell;
801    ecIdePTmplEdOutPrevCellSel:             Result := srkmecSynPTmplEdPrevCellSel;
802    ecIdePTmplEdOutNextFirstCell:           Result := srkmecSynPTmplEdNextFirstCell;
803    ecIdePTmplEdOutNextFirstCellSel:        Result := srkmecSynPTmplEdNextFirstCellSel;
804    ecIdePTmplEdOutNextFirstCellRotate:     Result := srkmecSynPTmplEdNextFirstCellRotate;
805    ecIdePTmplEdOutNextFirstCellSelRotate:  Result := srkmecSynPTmplEdNextFirstCellSelRotate;
806    ecIdePTmplEdOutPrevFirstCell:           Result := srkmecSynPTmplEdPrevFirstCell;
807    ecIdePTmplEdOutPrevFirstCellSel:        Result := srkmecSynPTmplEdPrevFirstCellSel;
808    ecIdePTmplEdOutCellHome:                Result := srkmecSynPTmplEdCellHome;
809    ecIdePTmplEdOutCellEnd:                 Result := srkmecSynPTmplEdCellEnd;
810    ecIdePTmplEdOutCellSelect:              Result := srkmecSynPTmplEdCellSelect;
811    ecIdePTmplEdOutFinish:                  Result := srkmecSynPTmplEdFinish;
812    ecIdePTmplEdOutEscape:                  Result := srkmecSynPTmplEdEscape;
813    // SyncroEdit
814    ecIdePSyncroEdNextCell:              Result := srkmecSynPSyncroEdNextCell;
815    ecIdePSyncroEdNextCellSel:           Result := srkmecSynPSyncroEdNextCellSel;
816    ecIdePSyncroEdPrevCell:              Result := srkmecSynPSyncroEdPrevCell;
817    ecIdePSyncroEdPrevCellSel:           Result := srkmecSynPSyncroEdPrevCellSel;
818    ecIdePSyncroEdNextFirstCell:         Result := srkmecSynPSyncroEdNextFirstCell;
819    ecIdePSyncroEdNextFirstCellSel:      Result := srkmecSynPSyncroEdNextFirstCellSel;
820    ecIdePSyncroEdPrevFirstCell:         Result := srkmecSynPSyncroEdPrevFirstCell;
821    ecIdePSyncroEdPrevFirstCellSel:      Result := srkmecSynPSyncroEdPrevFirstCellSel;
822    ecIdePSyncroEdCellHome:              Result := srkmecSynPSyncroEdCellHome;
823    ecIdePSyncroEdCellEnd:               Result := srkmecSynPSyncroEdCellEnd;
824    ecIdePSyncroEdCellSelect:            Result := srkmecSynPSyncroEdCellSelect;
825    ecIdePSyncroEdEscape:                Result := srkmecSynPSyncroEdEscape;
826    // SyncroEdit
827    ecIdePSyncroEdOutNextCell:              Result := srkmecSynPSyncroEdNextCell;
828    ecIdePSyncroEdOutNextCellSel:           Result := srkmecSynPSyncroEdNextCellSel;
829    ecIdePSyncroEdOutPrevCell:              Result := srkmecSynPSyncroEdPrevCell;
830    ecIdePSyncroEdOutPrevCellSel:           Result := srkmecSynPSyncroEdPrevCellSel;
831    ecIdePSyncroEdOutNextFirstCell:         Result := srkmecSynPSyncroEdNextFirstCell;
832    ecIdePSyncroEdOutNextFirstCellSel:      Result := srkmecSynPSyncroEdNextFirstCellSel;
833    ecIdePSyncroEdOutPrevFirstCell:         Result := srkmecSynPSyncroEdPrevFirstCell;
834    ecIdePSyncroEdOutPrevFirstCellSel:      Result := srkmecSynPSyncroEdPrevFirstCellSel;
835    ecIdePSyncroEdOutCellHome:              Result := srkmecSynPSyncroEdCellHome;
836    ecIdePSyncroEdOutCellEnd:               Result := srkmecSynPSyncroEdCellEnd;
837    ecIdePSyncroEdOutCellSelect:            Result := srkmecSynPSyncroEdCellSelect;
838    ecIdePSyncroEdOutEscape:                Result := srkmecSynPSyncroEdEscape;
839    // SyncroEdit, during selection
840    ecIdePSyncroEdSelStart:            Result := srkmecSynPSyncroEdStart;
841
842    else
843      begin
844        Result:= srkmecunknown;
845
846      end;
847  end;
848end;
849
850function KeyValuesToCaptionStr(const ShortcutA, ShortcutB: TIDEShortCut;
851  Brackets: Char): String;
852  function AddBrakets(S: String): String;
853  begin
854    if Brackets = '[' then
855      Result := '[' + S + ']'
856    else if Brackets = '(' then
857      Result := '(' + S + ')'
858    else if Brackets > #0 then
859      Result := Brackets + S + Brackets
860    else
861      Result := S;
862  end;
863begin
864  Result := '';
865  if (ShortcutA.Key1 = VK_UNKNOWN) and (ShortcutB.Key1 = VK_UNKNOWN) then
866    Result := Result{ + lisNone2 }
867  else
868  if (ShortcutA.Key1 = VK_UNKNOWN) then
869    Result := Result + AddBrakets(KeyAndShiftStateToEditorKeyString(ShortcutB))
870  else
871  if (ShortcutB.Key1 = VK_UNKNOWN) then
872    Result := Result + AddBrakets(KeyAndShiftStateToEditorKeyString(ShortcutA))
873  else
874    Result := Result + AddBrakets(KeyAndShiftStateToEditorKeyString(ShortcutA))
875                     + '  '+lisOr+'  ' +
876                       AddBrakets(KeyAndShiftStateToEditorKeyString(ShortcutB));
877end;
878
879function IDEShortCutEmpty(const Key: TIDEShortCut): boolean;
880begin
881  Result:=(Key.Key1=VK_UNKNOWN) and (Key.Key2=VK_UNKNOWN);
882end;
883
884function KeyAndShiftStateToEditorKeyString(const Key: TIDEShortCut): String;
885begin
886  Result := KeyAndShiftStateToKeyString(Key.Key1, Key.Shift1);
887  if (Key.Key2 <> VK_UNKNOWN) then
888    Result := Result + ', ' + KeyAndShiftStateToKeyString(Key.Key2, Key.Shift2);
889end;
890
891{ TKeyStrokeList }
892
893procedure TKeyStrokeList.Add(aKeyStroke: TSynEditKeyStroke);
894begin
895  case FCount of
896    0: begin KeyStroke1 := aKeyStroke; Inc(FCount); end;
897    1: begin KeyStroke2 := aKeyStroke; Inc(FCount); end;
898    2: begin KeyStroke3 := aKeyStroke; Inc(FCount); end;
899    3: raise Exception.Create('TKeyStrokePair supports only 3 items');
900  end;
901end;
902
903function TKeyStrokeList.GetItem(Index: Integer): TSynEditKeyStroke;
904begin
905  if Index >= FCount then
906    raise Exception.Create('TKeyStrokePair: Index out of bounds!');
907  case Index of
908    0: Result := KeyStroke1;
909    1: Result := KeyStroke2;
910    2: Result := KeyStroke3;
911    else Result := Nil;
912  end;
913end;
914
915procedure TKeyStrokeList.PutItem(Index: Integer; AValue: TSynEditKeyStroke);
916begin
917  if Index >= FCount then
918    raise Exception.Create('TKeyStrokePair: Index out of bounds!');
919  case Index of
920    0: KeyStroke1 := AValue;
921    1: KeyStroke2 := AValue;
922    2: KeyStroke3 := AValue;
923  end;
924end;
925
926{ TKeyCommandRelation }
927
928procedure TKeyCommandRelation.SetSingle(NewKeyA: word; NewShiftA: TShiftState;
929                                        NewKeyB: word; NewShiftB: TShiftState);
930begin
931  ShortcutA:=IDEShortCut(NewKeyA,NewShiftA,VK_UNKNOWN,[]);
932  ShortcutB:=IDEShortCut(NewKeyB,NewShiftB,VK_UNKNOWN,[]);
933end;
934
935procedure TKeyCommandRelation.SetSingle(NewKeyA: word; NewShiftA: TShiftState);
936begin
937  SetSingle(NewKeyA,NewShiftA,VK_UNKNOWN,[]);
938end;
939
940procedure TKeyCommandRelation.SetCombo(NewKey1A: word; NewShift1A: TShiftState;
941                                       NewKey1B: word; NewShift1B: TShiftState;
942                                       NewKey2A: word; NewShift2A: TShiftState;
943                                       NewKey2B: word; NewShift2B: TShiftState);
944begin
945  ShortcutA:=IDEShortCut(NewKey1A,NewShift1A,NewKey1B,NewShift1B);
946  ShortcutB:=IDEShortCut(NewKey2A,NewShift2A,NewKey2B,NewShift2B);
947end;
948
949procedure TKeyCommandRelation.SetCombo(NewKey1A: word; NewShift1A: TShiftState;
950                                       NewKey1B: word; NewShift1B: TShiftState);
951begin
952  SetCombo(NewKey1A,NewShift1A,NewKey1B,NewShift1B,VK_UNKNOWN,[],VK_UNKNOWN,[]);
953end;
954
955procedure TKeyCommandRelation.MapShortcut(AScheme: TKeyMapScheme);
956begin
957  case AScheme of
958    kmsLazarus: GetDefaultKeyForCommand;
959    kmsClassic: GetDefaultKeyForClassicScheme;
960    kmsMacOSXApple: GetDefaultKeyForMacOSXScheme;
961    kmsMacOSXLaz: GetDefaultKeyForMacOSXLazScheme;
962    kmsDefaultToMac: GetDefaultKeyForWindowsScheme(true);
963    kmsCustom: ;
964  end;
965end;
966
967function TKeyCommandRelation.GetLocalizedName: string;
968begin
969  Result:=inherited GetLocalizedName;
970  if Result='' then begin
971    Result:=EditorCommandToDescriptionString(Command);
972    if Result=srkmecunknown then
973      Result:=Name;
974  end;
975end;
976
977procedure TKeyCommandRelation.GetDefaultKeyForCommand;
978begin
979  {$IFDEF Darwin}
980  GetDefaultKeyForMacOSXScheme;
981  {$ELSE}
982  GetDefaultKeyForWindowsScheme;
983  {$ENDIF}
984end;
985
986procedure TKeyCommandRelation.GetDefaultKeyForWindowsScheme(AUseMetaKey: boolean=false);
987var
988  XCtrl: TShiftStateEnum;
989begin
990  if AUseMetaKey then
991    XCtrl:=ssMeta
992  else
993    XCtrl:=ssCtrl;
994
995  case Command of
996  // moving
997  ecLeft:                SetSingle(VK_LEFT,[]);
998  ecRight:               SetSingle(VK_RIGHT,[]);
999  ecUp:                  SetSingle(VK_UP,[]);
1000  ecDown:                SetSingle(VK_DOWN,[]);
1001  ecWordLeft:            SetSingle(VK_LEFT,[XCtrl]);
1002  ecWordRight:           SetSingle(VK_RIGHT,[XCtrl]); // WS c
1003  ecLineStart:           SetSingle(VK_HOME,[]);
1004  ecLineEnd:             SetSingle(VK_END,[]);
1005  ecPageUp:              SetSingle(VK_PRIOR,[]); // ,VK_R,[XCtrl],VK_UNKNOWN,[]);
1006  ecPageDown:            SetSingle(VK_NEXT,[]); // ,VK_W,[XCtrl],VK_UNKNOWN,[]);
1007  ecPageLeft:            SetSingle(VK_UNKNOWN,[]);
1008  ecPageRight:           SetSingle(VK_UNKNOWN,[]);
1009  ecPageTop:             SetSingle(VK_PRIOR,[XCtrl]);
1010  ecPageBottom:          SetSingle(VK_NEXT,[XCtrl]);
1011  ecEditorTop:           SetSingle(VK_HOME,[XCtrl]);
1012  ecEditorBottom:        SetSingle(VK_END,[XCtrl]);
1013  ecScrollUp:            SetSingle(VK_UP,[XCtrl]);
1014  ecScrollDown:          SetSingle(VK_DOWN,[XCtrl]);
1015  ecScrollLeft:          SetSingle(VK_UNKNOWN,[]);
1016  ecScrollRight:         SetSingle(VK_UNKNOWN,[]);
1017
1018  // selection
1019  ecSelLeft:             SetSingle(VK_LEFT,[ssShift]);
1020  ecSelRight:            SetSingle(VK_RIGHT,[ssShift]);
1021  ecSelUp:               SetSingle(VK_UP,[ssShift]);
1022  ecSelDown:             SetSingle(VK_DOWN,[ssShift]);
1023  ecCopy:                SetSingle(VK_C,[XCtrl],         VK_Insert,[XCtrl]);
1024  ecCut:                 SetSingle(VK_X,[XCtrl],         VK_Delete,[ssShift]);
1025  ecPaste:               SetSingle(VK_V,[XCtrl],         VK_Insert,[ssShift]);
1026
1027  ecCopyAdd:             SetSingle(VK_C,[XCtrl, ssAlt]);
1028  ecCutAdd:              SetSingle(VK_X,[XCtrl, ssAlt]);
1029  ecCopyCurrentLine:     SetSingle(VK_Y,[ssAlt]);
1030  ecCopyAddCurrentLine:  SetSingle(VK_Y,[ssAlt, ssShift]);
1031  ecCutCurrentLine:      SetSingle(VK_D,[ssAlt]);
1032  ecCutAddCurrentLine:   SetSingle(VK_D,[ssAlt, ssShift]);
1033
1034  ecMoveLineUp:          SetSingle(VK_UP,[XCtrl, ssShift, ssAlt]);
1035  ecMoveLineDown:        SetSingle(VK_DOWN,[XCtrl, ssShift, ssAlt]);
1036  ecDuplicateLine:       SetSingle(VK_INSERT,[XCtrl, ssShift, ssAlt]);
1037  ecMoveSelectUp:        SetSingle(VK_NUMPAD8,[XCtrl, ssAlt]);
1038  ecMoveSelectDown:      SetSingle(VK_NUMPAD2,[XCtrl, ssAlt]);
1039  ecMoveSelectLeft:      SetSingle(VK_NUMPAD4,[XCtrl, ssAlt]);
1040  ecMoveSelectRight:     SetSingle(VK_NUMPAD6,[XCtrl, ssAlt]);
1041  ecDuplicateSelection:  SetSingle(VK_NUMPAD0,[XCtrl, ssAlt]);
1042
1043  ecMultiPaste:          SetSingle(VK_UNKNOWN,[]);
1044  ecNormalSelect:        SetSingle(VK_UNKNOWN,[]);
1045  ecColumnSelect:        SetSingle(VK_UNKNOWN,[]);
1046  ecLineSelect:          SetSingle(VK_UNKNOWN,[]);
1047  ecSelWordLeft:         SetSingle(VK_LEFT,[XCtrl,ssShift]);
1048  ecSelWordRight:        SetSingle(VK_RIGHT,[XCtrl,ssShift]);
1049  ecSelLineStart:        SetSingle(VK_HOME,[ssShift]);
1050  ecSelLineEnd:          SetSingle(VK_END,[ssShift]);
1051  ecSelPageTop:          SetSingle(VK_PRIOR,[ssShift,XCtrl]);
1052  ecSelPageBottom:       SetSingle(VK_NEXT,[ssShift,XCtrl]);
1053  ecSelEditorTop:        SetSingle(VK_HOME,[ssShift,XCtrl]);
1054  ecSelEditorBottom:     SetSingle(VK_END,[ssShift,XCtrl]);
1055  ecSelectAll:           SetSingle(VK_A,[XCtrl]);
1056  ecSelectToBrace:       SetSingle(VK_UNKNOWN,[]);
1057  ecSelectCodeBlock:     SetSingle(VK_UNKNOWN,[]);
1058  ecSelectWord:          SetCombo(VK_K,[XCtrl],VK_T,[]);
1059  ecSelectLine:          SetCombo(VK_K,[XCtrl],VK_L,[]);
1060  ecSelectParagraph:     SetSingle(VK_UNKNOWN,[]);
1061  ecSelectionUpperCase:  SetCombo(VK_K,[XCtrl],VK_N,[]);
1062  ecSelectionLowerCase:  SetCombo(VK_K,[XCtrl],VK_O,[]);
1063  ecSelectionSwapCase:   SetCombo(VK_K,[XCtrl],VK_P,[]);
1064  ecSelectionTabs2Spaces:SetSingle(VK_UNKNOWN,[]);
1065  ecSelectionEnclose:    SetSingle(VK_N,[ssShift,XCtrl]);
1066  ecSelectionComment:    SetSingle(VK_V,[ssShift,XCtrl]);
1067  ecSelectionUncomment:  SetSingle(VK_U,[ssShift,XCtrl]);
1068  ecToggleComment:       SetSingle(VK_OEM_2,[XCtrl]);
1069  ecSelectionEncloseIFDEF:SetSingle(VK_D,[ssShift,XCtrl]);
1070  ecSelectionSort:       SetSingle(VK_UNKNOWN,[]);
1071  ecSelectionBreakLines: SetSingle(VK_UNKNOWN,[]);
1072
1073  ecStickySelection:     SetCombo(VK_K,[XCtrl],VK_S,[]);
1074  ecStickySelectionCol:  SetCombo(VK_K,[XCtrl],VK_S,[ssAlt]);
1075  ecStickySelectionStop: SetCombo(VK_K,[XCtrl],VK_E,[]);
1076
1077  ecBlockSetBegin:       SetCombo(VK_K,[XCtrl],VK_B,[]);
1078  ecBlockSetEnd:         SetCombo(VK_K,[XCtrl],VK_K,[]);
1079  ecBlockToggleHide:     SetCombo(VK_K,[XCtrl],VK_H,[]);
1080  ecBlockHide:           SetCombo(VK_UNKNOWN,[],VK_UNKNOWN,[]);
1081  ecBlockShow:           SetCombo(VK_UNKNOWN,[],VK_UNKNOWN,[]);
1082  ecBlockMove:           SetCombo(VK_K,[XCtrl],VK_V,[]);
1083  ecBlockCopy:           SetCombo(VK_K,[XCtrl],VK_C,[]);
1084  ecBlockDelete:         SetCombo(VK_K,[XCtrl],VK_Y,[]);
1085  ecBlockGotoBegin:      SetCombo(VK_Q,[XCtrl],VK_B,[]);
1086  ecBlockGotoEnd:        SetCombo(VK_Q,[XCtrl],VK_K,[]);
1087
1088  // column mode selection
1089  ecColSelUp:            SetSingle(VK_UP,[ssAlt,ssShift]);
1090  ecColSelDown:          SetSingle(VK_DOWN,[ssAlt,ssShift]);
1091  ecColSelLeft:          SetSingle(VK_LEFT,[ssAlt,ssShift]);
1092  ecColSelRight:         SetSingle(VK_RIGHT,[ssAlt,ssShift]);
1093  ecColSelPageDown:      SetSingle(VK_NEXT,[ssAlt,ssShift]);
1094  ecColSelPageBottom:    SetSingle(VK_NEXT,[ssAlt,ssShift,XCtrl]);
1095  ecColSelPageUp:        SetSingle(VK_PRIOR,[ssAlt,ssShift]);
1096  ecColSelPageTop:       SetSingle(VK_PRIOR,[ssAlt,ssShift,XCtrl]);
1097  ecColSelLineStart:     SetSingle(VK_HOME,[ssAlt,ssShift]);
1098  ecColSelLineEnd:       SetSingle(VK_END,[ssAlt,ssShift]);
1099  ecColSelEditorTop:     SetSingle(VK_HOME,[ssAlt,ssShift,XCtrl]);
1100  ecColSelEditorBottom:  SetSingle(VK_END,[ssAlt,ssShift,XCtrl]);
1101
1102  // multi caret
1103  ecPluginMultiCaretSetCaret:    SetSingle(VK_INSERT,[ssShift, XCtrl]);
1104  ecPluginMultiCaretUnsetCaret:  SetSingle(VK_DELETE,[ssShift, XCtrl]);
1105  //ecPluginMultiCaretToggleCaret: SetSingle(VK_INSERT,[ssShift, XCtrl]);
1106  ecPluginMultiCaretClearAll:    SetSingle(VK_ESCAPE,[ssShift, ssCtrl], VK_ESCAPE,[]);
1107
1108  ecPluginMultiCaretModeCancelOnMove:  SetCombo(VK_Q,[ssShift, XCtrl], VK_X,[ssShift, XCtrl]);
1109  ecPluginMultiCaretModeMoveAll:       SetCombo(VK_Q,[ssShift, XCtrl], VK_M,[ssShift, XCtrl]);
1110
1111  // editing
1112  ecBlockIndent:         SetCombo(VK_I,[XCtrl],VK_UNKNOWN,[], VK_K,[XCtrl],VK_I,[]);
1113  ecBlockUnindent:       SetCombo(VK_U,[XCtrl],VK_UNKNOWN,[], VK_K,[XCtrl],VK_U,[]);
1114  ecDeleteLastChar:      SetSingle(VK_BACK,[], VK_BACK,[ssShift]); // ctrl H used for scroll window.
1115  ecDeleteChar:          SetSingle(VK_DELETE,[]); // ctrl G conflicts with GO
1116  ecDeleteWord:          SetSingle(VK_T,[XCtrl], VK_DELETE,[XCtrl]);
1117  ecDeleteLastWord:      SetSingle(VK_BACK,[XCtrl]);
1118  ecDeleteBOL:           SetSingle(VK_UNKNOWN,[]);
1119  ecDeleteEOL:           SetCombo(VK_Y,[XCtrl,ssShift],VK_UNKNOWN,[], VK_Q,[XCtrl],VK_Y,[]);
1120  ecDeleteLine:          SetSingle(VK_Y,[XCtrl]);
1121  ecClearAll:            SetSingle(VK_UNKNOWN,[]);
1122  ecLineBreak:           SetSingle(VK_RETURN,[]);
1123  ecInsertLine:          SetSingle(VK_N,[XCtrl]);
1124  ecInsertCharacter:     SetSingle(VK_M,[ssShift,XCtrl]);
1125  ecInsertGPLNotice:     SetSingle(VK_UNKNOWN,[]);
1126  ecInsertLGPLNotice:    SetSingle(VK_UNKNOWN,[]);
1127  ecInsertModifiedLGPLNotice:SetSingle(VK_UNKNOWN,[]);
1128  ecInsertMITNotice:     SetSingle(VK_UNKNOWN,[]);
1129  ecInsertUserName:      SetSingle(VK_UNKNOWN,[]);
1130  ecInsertDateTime:      SetSingle(VK_UNKNOWN,[]);
1131  ecInsertChangeLogEntry:SetSingle(VK_UNKNOWN,[]);
1132  ecInsertCVSAuthor:     SetSingle(VK_UNKNOWN,[]);
1133  ecInsertCVSDate:       SetSingle(VK_UNKNOWN,[]);
1134  ecInsertCVSHeader:     SetSingle(VK_UNKNOWN,[]);
1135  ecInsertCVSID:         SetSingle(VK_UNKNOWN,[]);
1136  ecInsertCVSLog:        SetSingle(VK_UNKNOWN,[]);
1137  ecInsertCVSName:       SetSingle(VK_UNKNOWN,[]);
1138  ecInsertCVSRevision:   SetSingle(VK_UNKNOWN,[]);
1139  ecInsertCVSSource:     SetSingle(VK_UNKNOWN,[]);
1140  ecInsertGUID:          SetSingle(VK_G,[XCtrl,ssShift]);
1141  ecInsertFilename:      SetSingle(VK_UNKNOWN,[]);
1142
1143  // command commands
1144  ecUndo:                SetSingle(VK_Z,[XCtrl]);
1145  ecRedo:                SetSingle(VK_Z,[XCtrl,ssShift]);
1146
1147  // search & replace
1148  ecMatchBracket:        SetSingle(VK_UNKNOWN,[]);
1149  ecFind:                SetCombo(VK_F,[XCtrl],VK_UNKNOWN,[], VK_Q,[XCtrl],VK_F,[]);
1150  ecFindNext:            SetSingle(VK_F3,[],                   VK_L,[XCtrl]);
1151  ecFindPrevious:        SetSingle(VK_F3,[ssShift]);
1152  ecFindInFiles:         SetSingle(VK_F,[XCtrl,ssShift]);
1153  ecReplace:             SetCombo(VK_R,[XCtrl],VK_UNKNOWN,[], VK_Q,[XCtrl],VK_A,[]);
1154  ecIncrementalFind:     SetSingle(VK_E,[XCtrl]);
1155  ecGotoLineNumber:      SetCombo(VK_G,[XCtrl],VK_UNKNOWN,[], VK_Q,[XCtrl],VK_G,[]);
1156  ecFindNextWordOccurrence:SetSingle(VK_UNKNOWN,[]);
1157  ecFindPrevWordOccurrence:SetSingle(VK_UNKNOWN,[]);
1158  ecJumpBack:            SetSingle(VK_H,[XCtrl],VK_LEFT,[ssAlt]);
1159  ecJumpForward:         SetSingle(VK_H,[XCtrl,ssShift],VK_RIGHT,[ssAlt]);
1160  ecAddJumpPoint:        SetSingle(VK_UNKNOWN,[]);
1161  ecJumpToPrevError:     SetSingle(VK_F8,[XCtrl, ssShift]);
1162  ecJumpToNextError:     SetSingle(VK_F8,[XCtrl]);
1163  ecOpenFileAtCursor:    SetSingle(VK_RETURN,[XCtrl]);
1164  ecProcedureList:       SetSingle(VK_G,[ssAlt]);
1165
1166  // marker
1167  ecSetFreeBookmark:     SetSingle(VK_UNKNOWN,[]);
1168  ecClearBookmarkForFile:SetSingle(VK_UNKNOWN,[]);
1169  ecClearAllBookmark:    SetSingle(VK_UNKNOWN,[]);
1170  ecPrevBookmark:        SetSingle(VK_UNKNOWN,[]);
1171  ecNextBookmark:        SetSingle(VK_UNKNOWN,[]);
1172  ecGotoMarker0:         SetCombo(VK_0,[XCtrl],VK_UNKNOWN,[], VK_Q,[XCtrl],VK_0,[]);
1173  ecGotoMarker1:         SetCombo(VK_1,[XCtrl],VK_UNKNOWN,[], VK_Q,[XCtrl],VK_1,[]);
1174  ecGotoMarker2:         SetCombo(VK_2,[XCtrl],VK_UNKNOWN,[], VK_Q,[XCtrl],VK_2,[]);
1175  ecGotoMarker3:         SetCombo(VK_3,[XCtrl],VK_UNKNOWN,[], VK_Q,[XCtrl],VK_3,[]);
1176  ecGotoMarker4:         SetCombo(VK_4,[XCtrl],VK_UNKNOWN,[], VK_Q,[XCtrl],VK_4,[]);
1177  ecGotoMarker5:         SetCombo(VK_5,[XCtrl],VK_UNKNOWN,[], VK_Q,[XCtrl],VK_5,[]);
1178  ecGotoMarker6:         SetCombo(VK_6,[XCtrl],VK_UNKNOWN,[], VK_Q,[XCtrl],VK_6,[]);
1179  ecGotoMarker7:         SetCombo(VK_7,[XCtrl],VK_UNKNOWN,[], VK_Q,[XCtrl],VK_7,[]);
1180  ecGotoMarker8:         SetCombo(VK_8,[XCtrl],VK_UNKNOWN,[], VK_Q,[XCtrl],VK_8,[]);
1181  ecGotoMarker9:         SetCombo(VK_9,[XCtrl],VK_UNKNOWN,[], VK_Q,[XCtrl],VK_9,[]);
1182  ecToggleMarker0:       SetCombo(VK_0,[ssShift,XCtrl],VK_UNKNOWN,[], VK_K,[XCtrl],VK_0,[]);
1183  ecToggleMarker1:       SetCombo(VK_1,[ssShift,XCtrl],VK_UNKNOWN,[], VK_K,[XCtrl],VK_1,[]);
1184  ecToggleMarker2:       SetCombo(VK_2,[ssShift,XCtrl],VK_UNKNOWN,[], VK_K,[XCtrl],VK_2,[]);
1185  ecToggleMarker3:       SetCombo(VK_3,[ssShift,XCtrl],VK_UNKNOWN,[], VK_K,[XCtrl],VK_3,[]);
1186  ecToggleMarker4:       SetCombo(VK_4,[ssShift,XCtrl],VK_UNKNOWN,[], VK_K,[XCtrl],VK_4,[]);
1187  ecToggleMarker5:       SetCombo(VK_5,[ssShift,XCtrl],VK_UNKNOWN,[], VK_K,[XCtrl],VK_5,[]);
1188  ecToggleMarker6:       SetCombo(VK_6,[ssShift,XCtrl],VK_UNKNOWN,[], VK_K,[XCtrl],VK_6,[]);
1189  ecToggleMarker7:       SetCombo(VK_7,[ssShift,XCtrl],VK_UNKNOWN,[], VK_K,[XCtrl],VK_7,[]);
1190  ecToggleMarker8:       SetCombo(VK_8,[ssShift,XCtrl],VK_UNKNOWN,[], VK_K,[XCtrl],VK_8,[]);
1191  ecToggleMarker9:       SetCombo(VK_9,[ssShift,XCtrl],VK_UNKNOWN,[], VK_K,[XCtrl],VK_9,[]);
1192  ecSetMarker0:          SetSingle(VK_UNKNOWN,[]);
1193  ecSetMarker1:          SetSingle(VK_UNKNOWN,[]);
1194  ecSetMarker2:          SetSingle(VK_UNKNOWN,[]);
1195  ecSetMarker3:          SetSingle(VK_UNKNOWN,[]);
1196  ecSetMarker4:          SetSingle(VK_UNKNOWN,[]);
1197  ecSetMarker5:          SetSingle(VK_UNKNOWN,[]);
1198  ecSetMarker6:          SetSingle(VK_UNKNOWN,[]);
1199  ecSetMarker7:          SetSingle(VK_UNKNOWN,[]);
1200  ecSetMarker8:          SetSingle(VK_UNKNOWN,[]);
1201  ecSetMarker9:          SetSingle(VK_UNKNOWN,[]);
1202  ecGotoBookmarks:       SetSingle(VK_B,[ssCtrl]);
1203  ecToggleBookmarks:     SetSingle(VK_B,[ssCtrl,ssShift]);
1204
1205  // codetools
1206  ecAutoCompletion:      SetSingle(VK_J,[XCtrl]);
1207  ecWordCompletion:      SetSingle(VK_W,[XCtrl]);
1208  ecCompleteCode:        SetSingle(VK_C,[XCtrl,ssShift]);
1209  ecCompleteCodeInteractive: SetSingle(VK_X,[XCtrl,ssShift]);
1210  ecIdentCompletion:     SetSingle(VK_SPACE,[XCtrl]);
1211  ecShowCodeContext:     SetSingle(VK_SPACE,[XCtrl,ssShift]);
1212  ecExtractProc:         SetSingle(VK_UNKNOWN,[]);
1213  ecFindIdentifierRefs:  SetSingle(VK_I,[XCtrl,ssShift]);
1214  ecFindUsedUnitRefs:    SetSingle(VK_UNKNOWN,[]);
1215  ecRenameIdentifier:    SetSingle(VK_F2,[],        VK_E,[ssShift,XCtrl]);
1216  ecInvertAssignment:    SetSingle(VK_UNKNOWN,[]);
1217  ecSyntaxCheck:         SetSingle(VK_UNKNOWN,[]);
1218  ecGuessUnclosedBlock:  SetSingle(VK_UNKNOWN,[]);
1219  ecGuessMisplacedIFDEF: SetSingle(VK_UNKNOWN,[]);
1220  ecConvertDFM2LFM:      SetSingle(VK_UNKNOWN,[]);
1221  ecCheckLFM:            SetSingle(VK_UNKNOWN,[]);
1222  ecConvertDelphiUnit:   SetSingle(VK_UNKNOWN,[]);
1223  ecConvertDelphiProject:SetSingle(VK_UNKNOWN,[]);
1224  ecConvertDelphiPackage:SetSingle(VK_UNKNOWN,[]);
1225  ecConvertEncoding:     SetSingle(VK_UNKNOWN,[]);
1226  ecFindProcedureDefinition:SetSingle(VK_UP,[ssShift,XCtrl]);
1227  ecFindProcedureMethod: SetSingle(VK_DOWN,[ssShift,XCtrl]);
1228  ecFindDeclaration:     SetSingle(VK_UP,[ssAlt]);
1229  ecFindBlockOtherEnd:   SetCombo(VK_Q,[XCtrl],VK_O,[]);
1230  ecFindBlockStart:      SetCombo(VK_Q,[XCtrl],VK_M,[]);
1231  ecGotoIncludeDirective:SetSingle(VK_UNKNOWN,[]);
1232  ecShowAbstractMethods: SetSingle(VK_UNKNOWN,[]);
1233  ecRemoveEmptyMethods:  SetSingle(VK_UNKNOWN,[]);
1234  ecRemoveUnusedUnits:   SetSingle(VK_UNKNOWN,[]);
1235  ecUseUnit:             SetSingle(VK_F11,[ssAlt]);
1236  ecFindOverloads:       SetSingle(VK_UNKNOWN,[]);
1237
1238  // source notebook
1239  ecNextEditor:          SetSingle(VK_TAB,[XCtrl]);
1240  ecPrevEditor:          SetSingle(VK_TAB,[ssShift,XCtrl]);
1241  ecPrevEditorInHistory: SetSingle(VK_OEM_3,[XCtrl]);//~
1242  ecNextEditorInHistory: SetSingle(VK_OEM_3,[ssShift,XCtrl]);//~
1243  ecResetDebugger:       SetSingle(VK_UNKNOWN,[]);
1244  ecToggleBreakPoint:    SetSingle(VK_F5,[]);
1245  ecToggleBreakPointEnabled:    SetSingle(VK_F5,[ssShift, XCtrl]);
1246  ecMoveEditorLeft:      SetSingle(VK_UNKNOWN,[]);
1247  ecMoveEditorRight:     SetSingle(VK_UNKNOWN,[]);
1248  ecMoveEditorLeftmost:  SetSingle(VK_UNKNOWN,[]);
1249  ecMoveEditorRightmost: SetSingle(VK_UNKNOWN,[]);
1250
1251  ecNextSharedEditor:    SetSingle(VK_UNKNOWN,[]);
1252  ecPrevSharedEditor:    SetSingle(VK_UNKNOWN,[]);
1253  ecNextWindow:          SetSingle(VK_UNKNOWN,[]);
1254  ecPrevWindow:          SetSingle(VK_UNKNOWN,[]);
1255  ecMoveEditorNextWindow:SetSingle(VK_UNKNOWN,[]);
1256  ecMoveEditorPrevWindow:SetSingle(VK_UNKNOWN,[]);
1257  ecMoveEditorNewWindow: SetSingle(VK_UNKNOWN,[]);
1258  ecCopyEditorNextWindow:SetSingle(VK_UNKNOWN,[]);
1259  ecCopyEditorPrevWindow:SetSingle(VK_UNKNOWN,[]);
1260  ecCopyEditorNewWindow: SetSingle(VK_UNKNOWN,[]);
1261
1262  ecGotoEditor1:         SetSingle(VK_1,[ssAlt]);
1263  ecGotoEditor2:         SetSingle(VK_2,[ssAlt]);
1264  ecGotoEditor3:         SetSingle(VK_3,[ssAlt]);
1265  ecGotoEditor4:         SetSingle(VK_4,[ssAlt]);
1266  ecGotoEditor5:         SetSingle(VK_5,[ssAlt]);
1267  ecGotoEditor6:         SetSingle(VK_6,[ssAlt]);
1268  ecGotoEditor7:         SetSingle(VK_7,[ssAlt]);
1269  ecGotoEditor8:         SetSingle(VK_8,[ssAlt]);
1270  ecGotoEditor9:         SetSingle(VK_9,[ssAlt]);
1271  ecGotoEditor0:         SetSingle(VK_0,[ssAlt]);
1272
1273  ecLockEditor:          SetSingle(VK_UNKNOWN,[]);
1274
1275  EcFoldLevel1:          SetSingle(VK_1,[ssAlt,ssShift]);
1276  EcFoldLevel2:          SetSingle(VK_2,[ssAlt,ssShift]);
1277  EcFoldLevel3:          SetSingle(VK_3,[ssAlt,ssShift]);
1278  EcFoldLevel4:          SetSingle(VK_4,[ssAlt,ssShift]);
1279  EcFoldLevel5:          SetSingle(VK_5,[ssAlt,ssShift]);
1280  EcFoldLevel6:          SetSingle(VK_6,[ssAlt,ssShift]);
1281  EcFoldLevel7:          SetSingle(VK_7,[ssAlt,ssShift]);
1282  EcFoldLevel8:          SetSingle(VK_8,[ssAlt,ssShift]);
1283  EcFoldLevel9:          SetSingle(VK_9,[ssAlt,ssShift]);
1284  EcFoldLevel0:          SetSingle(VK_0,[ssAlt,ssShift]);
1285  EcFoldCurrent:         SetSingle(VK_OEM_MINUS,[ssAlt,ssShift]);
1286  EcUnFoldCurrent:       SetSingle(VK_OEM_PLUS,[ssAlt,ssShift]);
1287  EcToggleMarkupWord:    SetSingle(VK_M,[ssAlt]);
1288
1289  // file menu
1290  ecNew:                 SetSingle(VK_UNKNOWN,[]);
1291  ecNewUnit:             SetSingle(VK_UNKNOWN,[]);
1292  ecNewForm:             SetSingle(VK_UNKNOWN,[]);
1293  ecOpen:                SetSingle(VK_O,[XCtrl]);
1294  ecOpenUnit:            SetSingle(VK_F12,[ssAlt]);
1295  ecRevert:              SetSingle(VK_UNKNOWN,[]);
1296  ecSave:                SetSingle(VK_S,[XCtrl]);
1297  ecSaveAs:              SetSingle(VK_UNKNOWN,[]);
1298  ecSaveAll:             SetSingle(VK_S,[XCtrl,ssShift]);
1299  ecClose:               SetSingle(VK_F4,[XCtrl]);
1300  ecCloseAll:            SetSingle(VK_UNKNOWN,[]);
1301  ecCloseOtherTabs:      SetSingle(VK_UNKNOWN,[]);
1302  ecCloseRightTabs:      SetSingle(VK_UNKNOWN,[]);
1303  ecCleanDirectory:      SetSingle(VK_UNKNOWN,[]);
1304  ecRestart:             SetSingle(VK_UNKNOWN,[]);
1305  ecQuit:                SetSingle(VK_UNKNOWN,[]);
1306
1307  // view menu
1308  ecToggleObjectInsp:    SetSingle(VK_F11,[]);
1309  ecToggleSourceEditor:  SetSingle(VK_UNKNOWN,[]);
1310  ecToggleCodeExpl:      SetSingle(VK_UNKNOWN,[]);
1311  ecToggleFPDocEditor:   SetSingle(VK_UNKNOWN,[]);
1312  ecToggleMessages:      SetSingle(VK_UNKNOWN,[]);
1313  ecViewComponents:      SetSingle(VK_P,[XCtrl,ssAlt]);
1314  ecViewJumpHistory:     SetSingle(VK_J,[XCtrl,ssAlt]);
1315  ecToggleSearchResults: SetSingle(VK_F,[XCtrl,ssAlt]);
1316  ecToggleWatches:       SetSingle(VK_W,[XCtrl,ssAlt]);
1317  ecToggleBreakPoints:   SetSingle(VK_B,[XCtrl,ssAlt]);
1318  ecToggleLocals:        SetSingle(VK_L,[XCtrl,ssAlt],     VK_L,[XCtrl,ssShift]);
1319  ecViewPseudoTerminal: if HasConsoleSupport then SetSingle(VK_O,[XCtrl,ssAlt]);
1320  ecViewThreads:         SetSingle(VK_T,[XCtrl,ssAlt]);
1321  ecToggleCallStack:     SetSingle(VK_S,[XCtrl,ssAlt]);
1322  ecToggleRegisters:     SetSingle(VK_R,[XCtrl,ssAlt]);
1323  ecToggleAssembler:     SetSingle(VK_D,[XCtrl,ssAlt]);
1324  ecToggleDebugEvents:   SetSingle(VK_V,[XCtrl,ssAlt]);
1325  ecToggleDebuggerOut:   SetSingle(VK_UNKNOWN,[]);
1326  ecViewHistory:         SetSingle(VK_H,[XCtrl,ssAlt]);
1327  ecViewUnitDependencies:SetSingle(VK_UNKNOWN,[]);
1328  ecViewUnitInfo:        SetSingle(VK_UNKNOWN,[]);
1329  ecToggleFormUnit:      SetSingle(VK_F12,[]);
1330  ecViewAnchorEditor:    SetSingle(VK_UNKNOWN,[]);
1331  ecToggleCodeBrowser:   SetSingle(VK_UNKNOWN,[]);
1332  ecToggleRestrictionBrowser:SetSingle(VK_UNKNOWN,[]);
1333  ecToggleCompPalette:   SetSingle(VK_UNKNOWN,[]);
1334  ecToggleIDESpeedBtns:  SetSingle(VK_UNKNOWN,[]);
1335
1336  // project menu
1337  ecNewProject:          SetSingle(VK_UNKNOWN,[]);
1338  ecNewProjectFromFile:  SetSingle(VK_UNKNOWN,[]);
1339  ecOpenProject:         SetSingle(VK_F11,[XCtrl]);
1340  ecCloseProject:        SetSingle(VK_UNKNOWN,[]);
1341  ecSaveProject:         SetSingle(VK_UNKNOWN,[]);
1342  ecSaveProjectAs:       SetSingle(VK_UNKNOWN,[]);
1343  ecProjectResaveFormsWithI18n: SetSingle(VK_UNKNOWN,[]);
1344  ecPublishProject:      SetSingle(VK_UNKNOWN,[]);
1345  ecProjectInspector:    SetSingle(VK_UNKNOWN,[]);
1346  ecAddCurUnitToProj:    SetSingle(VK_F11,[ssShift]);
1347  ecRemoveFromProj:      SetSingle(VK_UNKNOWN,[]);
1348  ecViewProjectUnits:    SetSingle(VK_F12,[XCtrl]);
1349  ecViewProjectForms:    SetSingle(VK_F12,[ssShift]);
1350  ecViewProjectSource:   SetSingle(VK_UNKNOWN,[]);
1351  ecProjectOptions:      SetSingle(VK_F11,[ssShift,XCtrl]);
1352  ecProjectChangeBuildMode:SetSingle(VK_UNKNOWN,[]);
1353
1354  // run menu
1355  ecCompile:             SetSingle(VK_F9,[XCtrl]);
1356  ecBuild:               SetSingle(VK_F9,[ssShift]);
1357  ecQuickCompile:        SetSingle(VK_UNKNOWN,[]);
1358  ecCleanUpAndBuild:     SetSingle(VK_UNKNOWN,[]);
1359  ecBuildManyModes:      SetSingle(VK_UNKNOWN,[]);
1360  ecAbortBuild:          SetSingle(VK_UNKNOWN,[]);
1361  ecRunWithoutDebugging: SetSingle(VK_F9, [XCtrl, ssShift]);
1362  ecRun:                 SetSingle(VK_F9,[]);
1363  ecPause:               SetSingle(VK_UNKNOWN,[]);
1364  ecShowExecutionPoint:  SetSingle(VK_UNKNOWN,[]);
1365  ecStepInto:            SetSingle(VK_F7,[]);
1366  ecStepOver:            SetSingle(VK_F8,[]);
1367  ecStepIntoInstr:       SetSingle(VK_F7,[ssAlt]);
1368  ecStepOverInstr:       SetSingle(VK_F8,[ssAlt]);
1369  ecStepOut:             SetSingle(VK_F8,[ssShift]);
1370  ecStepToCursor:         SetSingle(VK_F4,[]);
1371  ecStopProgram:         SetSingle(VK_F2,[XCtrl]);
1372  ecRemoveBreakPoint:    SetSingle(VK_UNKNOWN,[]);
1373  ecRunParameters:       SetSingle(VK_UNKNOWN,[]);
1374  ecBuildFile:           SetSingle(VK_UNKNOWN,[]);
1375  ecRunFile:             SetSingle(VK_UNKNOWN,[]);
1376  ecConfigBuildFile:     SetSingle(VK_UNKNOWN,[]);
1377  ecInspect:             SetSingle(VK_F5,[ssAlt]);
1378  ecEvaluate:            SetSingle(VK_F7,[XCtrl]);
1379  ecAddWatch:            SetSingle(VK_F5,[XCtrl]);
1380  ecAddBpSource:         SetSingle(VK_UNKNOWN,[]);
1381  ecAddBpAddress:        SetSingle(VK_UNKNOWN,[]);
1382  ecAddBpDataWatch:      SetSingle(VK_F5,[ssShift]);
1383
1384  // components menu
1385  ecNewPackage:          SetSingle(VK_UNKNOWN,[]);
1386  ecOpenPackage:         SetSingle(VK_UNKNOWN,[]);
1387  ecOpenPackageFile:     SetSingle(VK_UNKNOWN,[]);
1388  ecOpenPackageOfCurUnit:SetSingle(VK_UNKNOWN,[]);
1389  ecAddCurFileToPkg:     SetSingle(VK_UNKNOWN,[]);
1390  ecNewPkgComponent:     SetSingle(VK_UNKNOWN,[]);
1391  ecPackageGraph:        SetSingle(VK_UNKNOWN,[]);
1392  ecPackageLinks:        SetSingle(VK_UNKNOWN,[]);
1393  ecEditInstallPkgs:     SetSingle(VK_UNKNOWN,[]);
1394  ecConfigCustomComps:   SetSingle(VK_UNKNOWN,[]);
1395
1396  // tools menu
1397  ecEnvironmentOptions:  SetSingle(VK_O,[ssShift,XCtrl]);
1398  ecRescanFPCSrcDir:     SetSingle(VK_UNKNOWN,[]);
1399  ecEditCodeTemplates:   SetSingle(VK_UNKNOWN,[]);
1400  ecCodeToolsDefinesEd:  SetSingle(VK_UNKNOWN,[]);
1401
1402  ecExtToolSettings:     SetSingle(VK_UNKNOWN,[]);
1403  ecManageExamples:      SetSingle(VK_UNKNOWN,[]);
1404  ecBuildLazarus:        SetSingle(VK_UNKNOWN,[]);
1405  ecConfigBuildLazarus:  SetSingle(VK_UNKNOWN,[]);
1406  ecMakeResourceString:  SetSingle(VK_UNKNOWN,[]);
1407  ecDiff:                SetSingle(VK_UNKNOWN,[]);
1408
1409  // window menu
1410  ecManageSourceEditors:       SetSingle(VK_W,[ssShift,XCtrl]);
1411
1412  // help menu
1413  ecAboutLazarus:        SetSingle(VK_UNKNOWN,[]);
1414  ecOnlineHelp:          SetSingle(VK_UNKNOWN,[]);
1415  ecContextHelp:         SetSingle(VK_F1,[]);
1416  ecEditContextHelp:     SetSingle(VK_F1,[ssShift,XCtrl]);
1417  ecReportingBug:        SetSingle(VK_UNKNOWN,[]);
1418  ecFocusHint:           SetSingle(VK_UNKNOWN,[]);
1419
1420  // designer
1421  ecDesignerCopy:        SetSingle(VK_C,[XCtrl],   VK_Insert,[XCtrl]);
1422  ecDesignerCut:         SetSingle(VK_X,[XCtrl],   VK_Delete,[ssShift]);
1423  ecDesignerPaste:       SetSingle(VK_V,[XCtrl],   VK_Insert,[ssShift]);
1424  ecDesignerSelectParent:SetSingle(VK_ESCAPE,[]);
1425  ecDesignerMoveToFront: SetSingle(VK_PRIOR,[ssShift]);
1426  ecDesignerMoveToBack:  SetSingle(VK_NEXT,[ssShift]);
1427  ecDesignerForwardOne:  SetSingle(VK_PRIOR,[XCtrl]);
1428  ecDesignerBackOne:     SetSingle(VK_NEXT,[XCtrl]);
1429  ecDesignerToggleNonVisComps: SetSingle(VK_UNKNOWN,[]);
1430
1431  // macro
1432  ecSynMacroRecord:      SetSingle(VK_R,[ssShift, XCtrl]);
1433  ecSynMacroPlay:        SetSingle(VK_P,[ssShift, XCtrl]);
1434
1435  ecIdePTmplEdNextCell:         SetSingle(VK_RIGHT,[XCtrl]);
1436  ecIdePTmplEdNextCellSel:      SetSingle(VK_TAB,[]);
1437  ecIdePTmplEdNextCellRotate:   SetSingle(VK_UNKNOWN,[]);
1438  ecIdePTmplEdNextCellSelRotate:SetSingle(VK_UNKNOWN,[]);
1439  ecIdePTmplEdPrevCell:         SetSingle(VK_LEFT,[XCtrl]);
1440  ecIdePTmplEdPrevCellSel:      SetSingle(VK_TAB,[ssShift]);
1441  ecIdePTmplEdCellHome:         SetSingle(VK_HOME,[]);
1442  ecIdePTmplEdCellEnd:          SetSingle(VK_END,[]);
1443  ecIdePTmplEdCellSelect:       SetSingle(VK_A,[XCtrl]);
1444  ecIdePTmplEdFinish:           SetSingle(VK_RETURN,[]);
1445  ecIdePTmplEdEscape:           SetSingle(VK_ESCAPE,[]);
1446  // Edit template
1447  ecIdePTmplEdOutNextCell:         SetSingle(VK_RIGHT,[XCtrl]);
1448  ecIdePTmplEdOutNextCellSel:      SetSingle(VK_TAB,[]);
1449  ecIdePTmplEdOutNextCellRotate:   SetSingle(VK_UNKNOWN,[]);
1450  ecIdePTmplEdOutNextCellSelRotate:SetSingle(VK_UNKNOWN,[]);
1451  ecIdePTmplEdOutPrevCell:         SetSingle(VK_LEFT,[XCtrl]);
1452  ecIdePTmplEdOutPrevCellSel:      SetSingle(VK_TAB,[ssShift]);
1453  ecIdePTmplEdOutCellHome:         SetSingle(VK_UNKNOWN,[]);
1454  ecIdePTmplEdOutCellEnd:          SetSingle(VK_UNKNOWN,[]);
1455  ecIdePTmplEdOutCellSelect:       SetSingle(VK_UNKNOWN,[]);
1456  ecIdePTmplEdOutFinish:           SetSingle(VK_RETURN,[]);
1457  ecIdePTmplEdOutEscape:           SetSingle(VK_ESCAPE,[]);
1458  // SyncroEdit
1459  ecIdePSyncroEdNextCell:       SetSingle(VK_RIGHT,[XCtrl]);
1460  ecIdePSyncroEdNextCellSel:    SetSingle(VK_TAB,[]);
1461  ecIdePSyncroEdPrevCell:       SetSingle(VK_LEFT,[XCtrl]);
1462  ecIdePSyncroEdPrevCellSel:    SetSingle(VK_TAB,[ssShift]);
1463  ecIdePSyncroEdCellHome:       SetSingle(VK_HOME,[]);
1464  ecIdePSyncroEdCellEnd:        SetSingle(VK_END,[]);
1465  ecIdePSyncroEdCellSelect:     SetSingle(VK_A,[XCtrl]);
1466  ecIdePSyncroEdEscape:         SetSingle(VK_ESCAPE,[]);
1467  // SyncroEdit
1468  ecIdePSyncroEdOutNextCell:       SetSingle(VK_RIGHT,[XCtrl]);
1469  ecIdePSyncroEdOutNextCellSel:    SetSingle(VK_TAB,[]);
1470  ecIdePSyncroEdOutPrevCell:       SetSingle(VK_LEFT,[XCtrl]);
1471  ecIdePSyncroEdOutPrevCellSel:    SetSingle(VK_TAB,[ssShift]);
1472  ecIdePSyncroEdOutCellHome:       SetSingle(VK_UNKNOWN,[]);
1473  ecIdePSyncroEdOutCellEnd:        SetSingle(VK_UNKNOWN,[]);
1474  ecIdePSyncroEdOutCellSelect:     SetSingle(VK_UNKNOWN,[]);
1475  ecIdePSyncroEdOutEscape:         SetSingle(VK_ESCAPE,[]);
1476  // SyncroEdit, during selection
1477  ecIdePSyncroEdSelStart:          SetSingle(VK_J,[XCtrl]);
1478
1479  else
1480    begin
1481      SetSingle(VK_UNKNOWN,[],VK_UNKNOWN,[]);
1482        // Edit template
1483    end;
1484  end;
1485end;
1486
1487procedure TKeyCommandRelation.GetDefaultKeyForClassicScheme;
1488begin
1489  GetDefaultKeyForWindowsScheme;
1490
1491  case Command of
1492  // moving
1493  ecLeft:                SetSingle(VK_S,[ssCtrl], VK_LEFT,[]);
1494  ecRight:               SetSingle(VK_D,[ssCtrl], VK_RIGHT,[]);
1495  ecUp:                  SetSingle(VK_E,[ssCtrl], VK_UP,[]);
1496  ecDown:                SetSingle(VK_X,[ssCtrl], VK_DOWN,[]);
1497  ecWordLeft:            SetSingle(VK_A,[ssCtrl], VK_LEFT,[ssCtrl]);
1498  ecWordRight:           SetSingle(VK_F,[ssCtrl], VK_RIGHT,[ssCtrl]);
1499  ecLineStart:           SetCombo(VK_Q,[ssCtrl],VK_S,[],   VK_HOME,[],VK_UNKNOWN,[]);
1500  ecLineEnd:             SetCombo(VK_Q,[ssCtrl],VK_D,[],   VK_END,[],VK_UNKNOWN,[]);
1501  ecPageUp:              SetSingle(VK_R,[ssCtrl], VK_PRIOR,[]);
1502  ecPageDown:            SetSingle(VK_C,[ssCtrl], VK_NEXT,[]);
1503  // Paragraph Down: VK_B, [ssCtrl]
1504  ecPageLeft:            SetSingle(VK_UNKNOWN,[]);
1505  ecPageRight:           SetSingle(VK_UNKNOWN,[]);
1506  ecPageTop:             SetCombo(VK_Q,[ssCtrl],VK_E,[],   VK_HOME,[ssCtrl],VK_UNKNOWN,[]);
1507  ecPageBottom:          SetCombo(VK_Q,[ssCtrl],VK_X,[],   VK_END,[ssCtrl],VK_UNKNOWN,[]);
1508  ecEditorTop:           SetCombo(VK_Q,[ssCtrl],VK_R,[],   VK_PRIOR,[ssCtrl],VK_UNKNOWN,[]);
1509  ecEditorBottom:        SetCombo(VK_Q,[ssCtrl],VK_C,[],   VK_NEXT,[ssCtrl],VK_UNKNOWN,[]);
1510  ecScrollUp:            SetSingle(VK_W,[ssCtrl], VK_UP,[ssCtrl]);
1511  ecScrollDown:          SetSingle(VK_Z,[ssCtrl], VK_DOWN,[ssCtrl]);
1512  ecScrollLeft:          SetSingle(VK_UNKNOWN,[]);
1513  ecScrollRight:         SetSingle(VK_UNKNOWN,[]);
1514
1515  // selection
1516  ecSelLeft:             SetSingle(VK_LEFT,[ssShift]);
1517  ecSelRight:            SetSingle(VK_RIGHT,[ssShift]);
1518  ecSelUp:               SetSingle(VK_UP,[ssShift]);
1519  ecSelDown:             SetSingle(VK_DOWN,[ssShift]);
1520  ecCopy:                SetSingle(VK_Insert,[ssCtrl]);
1521  ecCut:                 SetSingle(VK_Delete,[ssShift]);
1522  ecPaste:               SetSingle(VK_Insert,[ssShift]);
1523  ecMultiPaste:          SetSingle(VK_UNKNOWN,[]);
1524  ecNormalSelect:        SetCombo(VK_O,[ssCtrl],VK_K,[]);
1525  ecColumnSelect:        SetCombo(VK_O,[ssCtrl],VK_C,[]);
1526  ecLineSelect:          SetCombo(VK_K,[ssCtrl],VK_L,[]);
1527  ecSelWordLeft:         SetSingle(VK_LEFT,[ssCtrl,ssShift]);
1528  ecSelWordRight:        SetSingle(VK_RIGHT,[ssCtrl,ssShift]);
1529  ecSelLineStart:        SetSingle(VK_HOME,[ssShift]);
1530  ecSelLineEnd:          SetSingle(VK_END,[ssShift]);
1531  ecSelPageTop:          SetSingle(VK_HOME,[ssShift,ssCtrl]);
1532  ecSelPageBottom:       SetSingle(VK_END,[ssShift,ssCtrl]);
1533  ecSelEditorTop:        SetSingle(VK_PRIOR,[ssShift,ssCtrl]);
1534  ecSelEditorBottom:     SetSingle(VK_NEXT,[ssShift,ssCtrl]);
1535  ecSelectAll:           SetSingle(VK_UNKNOWN,[]);
1536  ecSelectToBrace:       SetSingle(VK_UNKNOWN,[]);
1537  ecSelectCodeBlock:     SetSingle(VK_UNKNOWN,[]);
1538  ecSelectWord:          SetCombo(VK_K,[ssCtrl],VK_T,[]);
1539  ecSelectLine:          SetCombo(VK_O,[ssCtrl],VK_L,[]);
1540  ecSelectParagraph:     SetSingle(VK_UNKNOWN,[]);
1541  ecSelectionUpperCase:  SetCombo(VK_K,[ssCtrl],VK_N,[]);
1542  ecSelectionLowerCase:  SetCombo(VK_K,[ssCtrl],VK_O,[]);
1543  ecSelectionSwapCase:   SetCombo(VK_K,[SSCtrl],VK_P,[]);
1544  ecSelectionTabs2Spaces:SetSingle(VK_UNKNOWN,[]);
1545  ecSelectionEnclose:    SetSingle(VK_UNKNOWN,[]);
1546  ecSelectionComment:    SetSingle(VK_UNKNOWN,[]);
1547  ecSelectionUncomment:  SetSingle(VK_UNKNOWN,[]);
1548  ecToggleComment:       SetSingle(VK_OEM_2,[ssCtrl]);
1549  ecSelectionEncloseIFDEF:SetSingle(VK_D,[ssShift,ssCtrl]);
1550  ecSelectionSort:       SetSingle(VK_UNKNOWN,[]);
1551  ecSelectionBreakLines: SetSingle(VK_UNKNOWN,[]);
1552
1553  ecBlockSetBegin:       SetCombo(VK_K,[ssCtrl],VK_B,[]);
1554  ecBlockSetEnd:         SetCombo(VK_K,[ssCtrl],VK_K,[]);
1555  ecBlockToggleHide:     SetCombo(VK_K,[ssCtrl],VK_H,[]);
1556  ecBlockHide:           SetSingle(VK_UNKNOWN,[]);
1557  ecBlockShow:           SetSingle(VK_UNKNOWN,[]);
1558  ecBlockMove:           SetCombo(VK_K,[ssCtrl],VK_V,[]);
1559  ecBlockCopy:           SetCombo(VK_K,[ssCtrl],VK_C,[]);
1560  ecBlockDelete:         SetCombo(VK_K,[ssCtrl],VK_Y,[]);
1561  ecBlockGotoBegin:      SetCombo(VK_Q,[ssCtrl],VK_B,[]);
1562  ecBlockGotoEnd:        SetCombo(VK_Q,[ssCtrl],VK_K,[]);
1563
1564  // column mode selection
1565  ecColSelUp:            SetSingle(VK_UP,   [ssAlt,ssShift]);
1566  ecColSelDown:          SetSingle(VK_DOWN, [ssAlt,ssShift]);
1567  ecColSelLeft:          SetSingle(VK_LEFT, [ssAlt,ssShift]);
1568  ecColSelRight:         SetSingle(VK_RIGHT,[ssAlt,ssShift]);
1569  ecColSelPageDown:      SetSingle(VK_NEXT, [ssAlt,ssShift]);
1570  ecColSelPageBottom:    SetSingle(VK_NEXT, [ssAlt,ssShift,ssCtrl]);
1571  ecColSelPageUp:        SetSingle(VK_PRIOR,[ssAlt,ssShift]);
1572  ecColSelPageTop:       SetSingle(VK_PRIOR,[ssAlt,ssShift,ssCtrl]);
1573  ecColSelLineStart:     SetSingle(VK_HOME, [ssAlt,ssShift]);
1574  ecColSelLineEnd:       SetSingle(VK_END,  [ssAlt,ssShift]);
1575  ecColSelEditorTop:     SetSingle(VK_HOME, [ssAlt,ssShift,ssCtrl]);
1576  ecColSelEditorBottom:  SetSingle(VK_END,  [ssAlt,ssShift,ssCtrl]);
1577
1578  // multi caret
1579  ecPluginMultiCaretSetCaret:    SetSingle(VK_INSERT,[ssShift, ssCtrl]);
1580  ecPluginMultiCaretUnsetCaret:  SetSingle(VK_DELETE,[ssShift, ssCtrl]);
1581  //ecPluginMultiCaretToggleCaret: SetSingle(VK_INSERT,[ssShift, ssCtrl]);
1582  ecPluginMultiCaretClearAll:    SetSingle(VK_ESCAPE,[ssShift, ssCtrl], VK_ESCAPE,[]);
1583
1584  ecPluginMultiCaretModeCancelOnMove:  SetCombo(VK_Q,[ssShift, ssCtrl], VK_X,[ssShift, ssCtrl]);
1585  ecPluginMultiCaretModeMoveAll:       SetCombo(VK_Q,[ssShift, ssCtrl], VK_M,[ssShift, ssCtrl]);
1586
1587  // editing
1588  ecInsertMode:          SetSingle(VK_V,[ssCtrl],    VK_INSERT,[]);
1589  ecBlockIndent:         SetCombo(VK_K,[ssCtrl],VK_I,[]);
1590  ecBlockUnindent:       SetCombo(VK_K,[ssCtrl],VK_U,[]);
1591  ecDeleteLastChar:      SetSingle(VK_H,[ssCtrl],    VK_BACK,[]);
1592  ecDeleteChar:          SetSingle(VK_G,[ssCtrl],    VK_DELETE,[]);
1593  ecDeleteWord:          SetSingle(VK_T,[ssCtrl]);
1594  ecDeleteLastWord:      SetSingle(VK_BACK,[ssCtrl]);
1595  ecDeleteBOL:           SetCombo(VK_Q,[ssCtrl],VK_H,[]);
1596  ecDeleteEOL:           SetCombo(VK_Q,[ssCtrl],VK_Y,[]);
1597  ecDeleteLine:          SetSingle(VK_Y,[ssCtrl]);
1598  ecClearAll:            SetSingle(VK_UNKNOWN,[]);
1599  ecLineBreak:           SetSingle(VK_RETURN,[],     VK_M,[ssCtrl]);
1600  ecInsertLine:          SetSingle(VK_N,[ssCtrl]);
1601  ecInsertCharacter:     SetSingle(VK_UNKNOWN,[]);
1602  // all insert text snippet keys have no default key
1603
1604  // command commands
1605  ecUndo:                SetSingle(VK_BACK,[ssALT],  VK_U,[ssCtrl]);
1606  ecRedo:                SetSingle(VK_BACK,[ssALT,ssShift]);
1607
1608  // search & replace
1609  ecMatchBracket:        SetSingle(VK_UNKNOWN,[]);
1610  ecFind:                SetCombo(VK_Q,[SSCtrl],VK_F,[]);
1611  ecFindNext:            SetSingle(VK_L,[ssCtrl]);
1612  ecFindPrevious:        SetSingle(VK_UNKNOWN,[]);
1613  ecFindInFiles:         SetSingle(VK_UNKNOWN,[]);
1614  ecReplace:             SetCombo(VK_Q,[SSCtrl],VK_A,[]);
1615  ecIncrementalFind:     SetSingle(VK_UNKNOWN,[]);
1616  ecGotoLineNumber:      SetCombo(VK_Q,[ssCtrl],VK_G,[]);
1617  ecFindNextWordOccurrence:SetSingle(VK_UNKNOWN,[]);
1618  ecFindPrevWordOccurrence:SetSingle(VK_UNKNOWN,[]);
1619  ecJumpBack:            SetSingle(VK_B,[ssCtrl]);
1620  ecJumpForward:         SetSingle(VK_B,[ssShift,ssCtrl]);
1621  ecAddJumpPoint:        SetSingle(VK_UNKNOWN,[]);
1622  ecJumpToPrevError:     SetSingle(VK_F7,[ssShift,ssAlt]);
1623  ecJumpToNextError:     SetSingle(VK_F8,[ssShift,ssAlt]);
1624  ecOpenFileAtCursor:    SetSingle(VK_RETURN,[ssCtrl]);
1625
1626  // marker
1627  ecSetFreeBookmark:     SetSingle(VK_UNKNOWN,[]);
1628  ecClearBookmarkForFile:SetSingle(VK_UNKNOWN,[]);
1629  ecClearAllBookmark:    SetSingle(VK_UNKNOWN,[]);
1630  ecPrevBookmark:        SetSingle(VK_UNKNOWN,[]);
1631  ecNextBookmark:        SetSingle(VK_UNKNOWN,[]);
1632  ecGotoMarker0:         SetCombo(VK_Q,[ssCtrl],VK_0,[]);
1633  ecGotoMarker1:         SetCombo(VK_Q,[ssCtrl],VK_1,[]);
1634  ecGotoMarker2:         SetCombo(VK_Q,[ssCtrl],VK_2,[]);
1635  ecGotoMarker3:         SetCombo(VK_Q,[ssCtrl],VK_3,[]);
1636  ecGotoMarker4:         SetCombo(VK_Q,[ssCtrl],VK_4,[]);
1637  ecGotoMarker5:         SetCombo(VK_Q,[ssCtrl],VK_5,[]);
1638  ecGotoMarker6:         SetCombo(VK_Q,[ssCtrl],VK_6,[]);
1639  ecGotoMarker7:         SetCombo(VK_Q,[ssCtrl],VK_7,[]);
1640  ecGotoMarker8:         SetCombo(VK_Q,[ssCtrl],VK_8,[]);
1641  ecGotoMarker9:         SetCombo(VK_Q,[ssCtrl],VK_9,[]);
1642  ecSetMarker0..ecSetMarker9: SetSingle(VK_UNKNOWN,[]);
1643  ecToggleMarker0:       SetCombo(VK_K,[ssCtrl],VK_0,[]);
1644  ecToggleMarker1:       SetCombo(VK_K,[ssCtrl],VK_1,[]);
1645  ecToggleMarker2:       SetCombo(VK_K,[ssCtrl],VK_2,[]);
1646  ecToggleMarker3:       SetCombo(VK_K,[ssCtrl],VK_3,[]);
1647  ecToggleMarker4:       SetCombo(VK_K,[ssCtrl],VK_4,[]);
1648  ecToggleMarker5:       SetCombo(VK_K,[ssCtrl],VK_5,[]);
1649  ecToggleMarker6:       SetCombo(VK_K,[ssCtrl],VK_6,[]);
1650  ecToggleMarker7:       SetCombo(VK_K,[ssCtrl],VK_7,[]);
1651  ecToggleMarker8:       SetCombo(VK_K,[ssCtrl],VK_8,[]);
1652  ecToggleMarker9:       SetCombo(VK_K,[ssCtrl],VK_9,[]);
1653
1654  // codetools
1655  ecAutoCompletion:      SetSingle(VK_J,[ssCtrl]);
1656  ecWordCompletion:      SetSingle(VK_W,[ssShift,ssCtrl]);
1657  ecCompleteCode:        SetSingle(VK_C,[ssShift,ssCtrl]);
1658  ecCompleteCodeInteractive: SetSingle(VK_X,[ssCtrl,ssShift]);
1659  ecIdentCompletion:     SetSingle(VK_UNKNOWN,[]);
1660  ecShowCodeContext:     SetSingle(VK_SPACE,[ssShift,ssCtrl]);
1661  ecExtractProc:         SetSingle(VK_UNKNOWN,[]);
1662  ecFindIdentifierRefs:  SetSingle(VK_UNKNOWN,[]);
1663  ecFindUsedUnitRefs:    SetSingle(VK_UNKNOWN,[]);
1664  ecRenameIdentifier:    SetSingle(VK_E,[ssShift,ssCtrl]);
1665  ecInvertAssignment:    SetSingle(VK_UNKNOWN,[]);
1666  ecSyntaxCheck:         SetSingle(VK_UNKNOWN,[]);
1667  ecGuessUnclosedBlock:  SetSingle(VK_UNKNOWN,[]);
1668  ecGuessMisplacedIFDEF: SetSingle(VK_UNKNOWN,[]);
1669  ecConvertDFM2LFM:      SetSingle(VK_UNKNOWN,[]);
1670  ecCheckLFM:            SetSingle(VK_UNKNOWN,[]);
1671  ecConvertDelphiUnit:   SetSingle(VK_UNKNOWN,[]);
1672  ecConvertDelphiProject:SetSingle(VK_UNKNOWN,[]);
1673  ecConvertDelphiPackage:SetSingle(VK_UNKNOWN,[]);
1674  ecConvertEncoding:     SetSingle(VK_UNKNOWN,[]);
1675  ecFindProcedureDefinition:SetSingle(VK_UP,[ssShift,SSCtrl]);
1676  ecFindProcedureMethod: SetSingle(VK_DOWN,[ssShift,SSCtrl]);
1677  ecFindDeclaration:     SetSingle(VK_UNKNOWN,[]);
1678  ecFindBlockOtherEnd:   SetCombo(VK_Q,[ssCtrl],VK_O,[]);
1679  ecFindBlockStart:      SetCombo(VK_Q,[ssCtrl],VK_M,[]);
1680  ecGotoIncludeDirective:SetSingle(VK_UNKNOWN,[]);
1681  ecShowAbstractMethods: SetSingle(VK_UNKNOWN,[]);
1682  ecRemoveEmptyMethods:  SetSingle(VK_UNKNOWN,[]);
1683
1684  // source notebook
1685  ecNextEditor:          SetSingle(VK_F6,[],         VK_TAB,[ssCtrl]);
1686  ecPrevEditor:          SetSingle(VK_F6,[ssShift],  VK_TAB,[ssShift,ssCtrl]);
1687  ecPrevEditorInHistory: SetSingle(VK_OEM_3,[ssCtrl]);//~
1688  ecNextEditorInHistory: SetSingle(VK_OEM_3,[ssShift,ssCtrl]);//~
1689  ecResetDebugger:       SetSingle(VK_UNKNOWN,[]);
1690  ecToggleBreakPoint:    SetSingle(VK_UNKNOWN,[]);
1691  ecToggleBreakPointEnabled:    SetSingle(VK_UNKNOWN,[]);
1692  ecMoveEditorLeft:      SetSingle(VK_UNKNOWN,[]);
1693  ecMoveEditorRight:     SetSingle(VK_UNKNOWN,[]);
1694  ecMoveEditorLeftmost:  SetSingle(VK_UNKNOWN,[]);
1695  ecMoveEditorRightmost: SetSingle(VK_UNKNOWN,[]);
1696
1697  ecNextSharedEditor:    SetSingle(VK_UNKNOWN,[]);
1698  ecPrevSharedEditor:    SetSingle(VK_UNKNOWN,[]);
1699  ecNextWindow:          SetSingle(VK_UNKNOWN,[]);
1700  ecPrevWindow:          SetSingle(VK_UNKNOWN,[]);
1701  ecMoveEditorNextWindow:SetSingle(VK_UNKNOWN,[]);
1702  ecMoveEditorPrevWindow:SetSingle(VK_UNKNOWN,[]);
1703  ecMoveEditorNewWindow: SetSingle(VK_UNKNOWN,[]);
1704  ecCopyEditorNextWindow:SetSingle(VK_UNKNOWN,[]);
1705  ecCopyEditorPrevWindow:SetSingle(VK_UNKNOWN,[]);
1706  ecCopyEditorNewWindow: SetSingle(VK_UNKNOWN,[]);
1707
1708  ecGotoEditor1:         SetSingle(VK_1,[ssAlt]);
1709  ecGotoEditor2:         SetSingle(VK_2,[ssAlt]);
1710  ecGotoEditor3:         SetSingle(VK_3,[ssAlt]);
1711  ecGotoEditor4:         SetSingle(VK_4,[ssAlt]);
1712  ecGotoEditor5:         SetSingle(VK_5,[ssAlt]);
1713  ecGotoEditor6:         SetSingle(VK_6,[ssAlt]);
1714  ecGotoEditor7:         SetSingle(VK_7,[ssAlt]);
1715  ecGotoEditor8:         SetSingle(VK_8,[ssAlt]);
1716  ecGotoEditor9:         SetSingle(VK_9,[ssAlt]);
1717  ecGotoEditor0:         SetSingle(VK_0,[ssAlt]);
1718
1719  ecLockEditor:          SetSingle(VK_UNKNOWN,[]);
1720
1721  EcFoldLevel1:          SetSingle(VK_1,[ssAlt,ssShift]);
1722  EcFoldLevel2:          SetSingle(VK_2,[ssAlt,ssShift]);
1723  EcFoldLevel3:          SetSingle(VK_3,[ssAlt,ssShift]);
1724  EcFoldLevel4:          SetSingle(VK_4,[ssAlt,ssShift]);
1725  EcFoldLevel5:          SetSingle(VK_5,[ssAlt,ssShift]);
1726  EcFoldLevel6:          SetSingle(VK_6,[ssAlt,ssShift]);
1727  EcFoldLevel7:          SetSingle(VK_7,[ssAlt,ssShift]);
1728  EcFoldLevel8:          SetSingle(VK_8,[ssAlt,ssShift]);
1729  EcFoldLevel9:          SetSingle(VK_9,[ssAlt,ssShift]);
1730  EcFoldLevel0:          SetSingle(VK_0,[ssAlt,ssShift]);
1731  EcFoldCurrent:         SetSingle(VK_OEM_PLUS,[ssAlt,ssShift]);
1732  EcUnFoldCurrent:       SetSingle(VK_OEM_MINUS,[ssAlt,ssShift]);
1733  EcToggleMarkupWord:    SetSingle(VK_M,[ssAlt]);
1734  ecGotoBookmarks:       SetSingle(VK_B,[ssCtrl]);
1735  ecToggleBookmarks:     SetSingle(VK_B,[ssCtrl,ssShift]);
1736
1737  // file menu
1738  ecNew:                 SetSingle(VK_UNKNOWN,[]);
1739  ecNewUnit:             SetSingle(VK_UNKNOWN,[]);
1740  ecNewForm:             SetSingle(VK_UNKNOWN,[]);
1741  ecOpen:                SetSingle(VK_F3,[]);
1742  ecOpenUnit:            SetSingle(VK_F12,[ssAlt]);
1743  ecRevert:              SetSingle(VK_UNKNOWN,[]);
1744  ecSave:                SetSingle(VK_F2,[]);
1745  ecSaveAs:              SetSingle(VK_UNKNOWN,[]);
1746  ecSaveAll:             SetSingle(VK_F2,[ssShift]);
1747  ecClose:               SetSingle(VK_F3,[ssAlt]);
1748  ecCloseAll:            SetSingle(VK_UNKNOWN,[]);
1749  ecCloseOtherTabs:      SetSingle(VK_UNKNOWN,[]);
1750  ecCloseRightTabs:      SetSingle(VK_UNKNOWN,[]);
1751  ecCleanDirectory:      SetSingle(VK_UNKNOWN,[]);
1752  ecRestart:             SetSingle(VK_UNKNOWN,[]);
1753  ecQuit:                SetSingle(VK_X,[ssAlt]);
1754
1755  // view menu
1756  ecToggleObjectInsp:    SetSingle(VK_F11,[]);
1757  ecToggleSourceEditor:  SetSingle(VK_UNKNOWN,[]);
1758  ecToggleCodeExpl:      SetSingle(VK_UNKNOWN,[]);
1759  ecToggleFPDocEditor:   SetSingle(VK_UNKNOWN,[]);
1760  ecToggleMessages:      SetSingle(VK_UNKNOWN,[]);
1761  ecViewComponents:      SetSingle(VK_UNKNOWN,[]);
1762  ecViewJumpHistory:     SetSingle(VK_UNKNOWN,[]);
1763  ecToggleSearchResults: SetSingle(VK_UNKNOWN,[]);
1764  ecToggleWatches:       SetSingle(VK_UNKNOWN,[]);
1765  ecToggleBreakPoints:   SetSingle(VK_F8,[ssCtrl]);
1766  ecToggleLocals:        SetSingle(VK_UNKNOWN,[]);
1767  ecToggleCallStack:     SetSingle(VK_F3,[ssCtrl]);
1768  ecToggleRegisters:     SetSingle(VK_UNKNOWN,[]);
1769  ecToggleAssembler:     SetSingle(VK_UNKNOWN,[]);
1770  ecToggleDebugEvents:   SetSingle(VK_UNKNOWN,[]);
1771  ecToggleDebuggerOut:   SetSingle(VK_UNKNOWN,[]);
1772  ecViewUnitDependencies:SetSingle(VK_UNKNOWN,[]);
1773  ecViewUnitInfo:        SetSingle(VK_UNKNOWN,[]);
1774  ecToggleFormUnit:      SetSingle(VK_F12,[]);
1775  ecViewAnchorEditor:    SetSingle(VK_UNKNOWN,[]);
1776  ecToggleCodeBrowser:   SetSingle(VK_UNKNOWN,[]);
1777  ecToggleRestrictionBrowser:SetSingle(VK_UNKNOWN,[]);
1778  ecToggleCompPalette:   SetSingle(VK_UNKNOWN,[]);
1779  ecToggleIDESpeedBtns:  SetSingle(VK_UNKNOWN,[]);
1780
1781  // project menu
1782  ecNewProject:          SetSingle(VK_UNKNOWN,[]);
1783  ecNewProjectFromFile:  SetSingle(VK_UNKNOWN,[]);
1784  ecOpenProject:         SetSingle(VK_F11,[ssCtrl]);
1785  ecCloseProject:        SetSingle(VK_UNKNOWN,[]);
1786  ecSaveProject:         SetSingle(VK_UNKNOWN,[]);
1787  ecSaveProjectAs:       SetSingle(VK_UNKNOWN,[]);
1788  ecProjectResaveFormsWithI18n: SetSingle(VK_UNKNOWN,[]);
1789  ecPublishProject:      SetSingle(VK_UNKNOWN,[]);
1790  ecProjectInspector:    SetSingle(VK_UNKNOWN,[]);
1791  ecAddCurUnitToProj:    SetSingle(VK_F11,[ssShift]);
1792  ecRemoveFromProj:      SetSingle(VK_UNKNOWN,[]);
1793  ecViewProjectUnits:    SetSingle(VK_F12,[ssCtrl]);
1794  ecViewProjectForms:    SetSingle(VK_F12,[ssShift]);
1795  ecViewProjectSource:   SetSingle(VK_UNKNOWN,[]);
1796  ecProjectOptions:      SetSingle(VK_F11,[ssShift,ssCtrl]);
1797  ecProjectChangeBuildMode:SetSingle(VK_UNKNOWN,[]);
1798
1799  // run menu
1800  ecCompile:             SetSingle(VK_F9,[ssCtrl]);
1801  ecBuild:               SetSingle(VK_F9,[ssShift]);
1802  ecQuickCompile:        SetSingle(VK_UNKNOWN,[]);
1803  ecCleanUpAndBuild:     SetSingle(VK_UNKNOWN,[]);
1804  ecBuildManyModes:      SetSingle(VK_UNKNOWN,[]);
1805  ecAbortBuild:          SetSingle(VK_UNKNOWN,[]);
1806  ecRunWithoutDebugging: SetSingle(VK_F9,[ssCtrl, ssShift]);
1807  ecRun:                 SetSingle(VK_F9,[]);
1808  ecPause:               SetSingle(VK_UNKNOWN,[]);
1809  ecShowExecutionPoint:  SetSingle(VK_UNKNOWN,[]);
1810  ecStepInto:            SetSingle(VK_F7,[]);
1811  ecStepOver:            SetSingle(VK_F8,[]);
1812  ecStepIntoInstr:       SetSingle(VK_F7,[ssAlt]);
1813  ecStepOverInstr:       SetSingle(VK_F8,[ssAlt]);
1814  ecStepOut:             SetSingle(VK_F8,[ssShift]);
1815  ecStepToCursor:         SetSingle(VK_F4,[]);
1816  ecStopProgram:         SetSingle(VK_F2,[ssCtrl]);
1817  ecRemoveBreakPoint:    SetSingle(VK_UNKNOWN,[]);
1818  ecRunParameters:       SetSingle(VK_UNKNOWN,[]);
1819  ecBuildFile:           SetSingle(VK_UNKNOWN,[]);
1820  ecRunFile:             SetSingle(VK_UNKNOWN,[]);
1821  ecConfigBuildFile:     SetSingle(VK_UNKNOWN,[]);
1822  ecInspect:             SetSingle(VK_UNKNOWN,[]);
1823  ecEvaluate:            SetSingle(VK_F4,[ssCtrl]);
1824  ecAddWatch:            SetSingle(VK_F7,[ssCtrl]);
1825  ecAddBpSource:         SetSingle(VK_UNKNOWN,[]);
1826  ecAddBpAddress:        SetSingle(VK_UNKNOWN,[]);
1827  ecAddBpDataWatch:      SetSingle(VK_UNKNOWN,[]);
1828
1829  // components menu
1830  ecNewPackage:          SetSingle(VK_UNKNOWN,[]);
1831  ecOpenPackage:         SetSingle(VK_UNKNOWN,[]);
1832  ecOpenPackageFile:     SetSingle(VK_UNKNOWN,[]);
1833  ecOpenPackageOfCurUnit:SetSingle(VK_UNKNOWN,[]);
1834  ecAddCurFileToPkg:     SetSingle(VK_UNKNOWN,[]);
1835  ecNewPkgComponent:     SetSingle(VK_UNKNOWN,[]);
1836  ecPackageGraph:        SetSingle(VK_UNKNOWN,[]);
1837  ecPackageLinks:        SetSingle(VK_UNKNOWN,[]);
1838  ecEditInstallPkgs:     SetSingle(VK_UNKNOWN,[]);
1839  ecConfigCustomComps:   SetSingle(VK_UNKNOWN,[]);
1840
1841  // tools menu
1842  ecEnvironmentOptions:  SetSingle(VK_O,[ssShift,ssCtrl]);
1843  ecRescanFPCSrcDir:     SetSingle(VK_UNKNOWN,[]);
1844  ecEditCodeTemplates:   SetSingle(VK_UNKNOWN,[]);
1845  ecCodeToolsDefinesEd:  SetSingle(VK_UNKNOWN,[]);
1846
1847  ecExtToolSettings:     SetSingle(VK_UNKNOWN,[]);
1848  ecManageExamples:      SetSingle(VK_UNKNOWN,[]);
1849  ecBuildLazarus:        SetSingle(VK_UNKNOWN,[]);
1850  ecConfigBuildLazarus:  SetSingle(VK_UNKNOWN,[]);
1851  ecMakeResourceString:  SetSingle(VK_UNKNOWN,[]);
1852  ecDiff:                SetSingle(VK_UNKNOWN,[]);
1853
1854  // window menu
1855  ecManageSourceEditors:       SetSingle(VK_UNKNOWN,[]);
1856
1857  // help menu
1858  ecAboutLazarus:        SetSingle(VK_UNKNOWN,[]);
1859  ecOnlineHelp:          SetSingle(VK_UNKNOWN,[]);
1860  ecContextHelp:         SetSingle(VK_F1,[ssCtrl]);
1861  ecEditContextHelp:     SetSingle(VK_F1,[ssCtrl,ssShift]);
1862  ecReportingBug:        SetSingle(VK_UNKNOWN,[]);
1863  ecFocusHint:           SetSingle(VK_UNKNOWN,[]);
1864
1865  // designer
1866  ecDesignerCopy:        SetSingle(VK_C,[ssCtrl],    VK_Insert,[ssCtrl]);
1867  ecDesignerCut:         SetSingle(VK_X,[ssCtrl],    VK_Delete,[ssShift]);
1868  ecDesignerPaste:       SetSingle(VK_V,[ssCtrl],    VK_Insert,[ssShift]);
1869  ecDesignerSelectParent:SetSingle(VK_ESCAPE,[]);
1870  ecDesignerMoveToFront: SetSingle(VK_PRIOR,[ssShift]);
1871  ecDesignerMoveToBack:  SetSingle(VK_NEXT,[ssShift]);
1872  ecDesignerForwardOne:  SetSingle(VK_PRIOR,[ssCtrl]);
1873  ecDesignerBackOne:     SetSingle(VK_NEXT,[ssCtrl]);
1874  ecDesignerToggleNonVisComps: SetSingle(VK_UNKNOWN,[]);
1875
1876  // macro
1877  ecSynMacroRecord:      SetSingle(VK_R,[ssShift, ssCtrl]);
1878  ecSynMacroPlay:        SetSingle(VK_P,[ssShift, ssCtrl]);
1879
1880  // Edit template
1881  ecIdePTmplEdNextCell:         SetSingle(VK_RIGHT,[ssCtrl]);
1882  ecIdePTmplEdNextCellSel:      SetSingle(VK_TAB,[]);
1883  ecIdePTmplEdNextCellRotate:   SetSingle(VK_UNKNOWN,[]);
1884  ecIdePTmplEdNextCellSelRotate:SetSingle(VK_UNKNOWN,[]);
1885  ecIdePTmplEdPrevCell:         SetSingle(VK_LEFT,[ssCtrl]);
1886  ecIdePTmplEdPrevCellSel:      SetSingle(VK_TAB,[ssShift]);
1887  ecIdePTmplEdCellHome:         SetSingle(VK_HOME,[]);
1888  ecIdePTmplEdCellEnd:          SetSingle(VK_END,[]);
1889  ecIdePTmplEdCellSelect:       SetSingle(VK_A,[ssCtrl]);
1890  ecIdePTmplEdFinish:           SetSingle(VK_RETURN,[]);
1891  ecIdePTmplEdEscape:           SetSingle(VK_ESCAPE,[]);
1892  // Edit template
1893  ecIdePTmplEdOutNextCell:         SetSingle(VK_RIGHT,[ssCtrl]);
1894  ecIdePTmplEdOutNextCellSel:      SetSingle(VK_TAB,[]);
1895  ecIdePTmplEdOutNextCellRotate:   SetSingle(VK_UNKNOWN,[]);
1896  ecIdePTmplEdOutNextCellSelRotate:SetSingle(VK_UNKNOWN,[]);
1897  ecIdePTmplEdOutPrevCell:         SetSingle(VK_LEFT,[ssCtrl]);
1898  ecIdePTmplEdOutPrevCellSel:      SetSingle(VK_TAB,[ssShift]);
1899  ecIdePTmplEdOutCellHome:         SetSingle(VK_UNKNOWN,[]);
1900  ecIdePTmplEdOutCellEnd:          SetSingle(VK_UNKNOWN,[]);
1901  ecIdePTmplEdOutCellSelect:       SetSingle(VK_UNKNOWN,[]);
1902  ecIdePTmplEdOutFinish:           SetSingle(VK_RETURN,[]);
1903  ecIdePTmplEdOutEscape:           SetSingle(VK_ESCAPE,[]);
1904  // SyncroEdit
1905  ecIdePSyncroEdNextCell:       SetSingle(VK_RIGHT,[ssCtrl]);
1906  ecIdePSyncroEdNextCellSel:    SetSingle(VK_TAB,[]);
1907  ecIdePSyncroEdPrevCell:       SetSingle(VK_LEFT,[ssCtrl]);
1908  ecIdePSyncroEdPrevCellSel:    SetSingle(VK_TAB,[ssShift]);
1909  ecIdePSyncroEdCellHome:       SetSingle(VK_HOME,[]);
1910  ecIdePSyncroEdCellEnd:        SetSingle(VK_END,[]);
1911  ecIdePSyncroEdCellSelect:     SetSingle(VK_A,[ssCtrl]);
1912  ecIdePSyncroEdEscape:         SetSingle(VK_ESCAPE,[]);
1913  // SyncroEdit
1914  ecIdePSyncroEdOutNextCell:       SetSingle(VK_RIGHT,[ssCtrl]);
1915  ecIdePSyncroEdOutNextCellSel:    SetSingle(VK_TAB,[]);
1916  ecIdePSyncroEdOutPrevCell:       SetSingle(VK_LEFT,[ssCtrl]);
1917  ecIdePSyncroEdOutPrevCellSel:    SetSingle(VK_TAB,[ssShift]);
1918  ecIdePSyncroEdOutCellHome:       SetSingle(VK_UNKNOWN,[]);
1919  ecIdePSyncroEdOutCellEnd:        SetSingle(VK_UNKNOWN,[]);
1920  ecIdePSyncroEdOutCellSelect:     SetSingle(VK_UNKNOWN,[]);
1921  ecIdePSyncroEdOutEscape:         SetSingle(VK_ESCAPE,[]);
1922  // SyncroEdit, during selection
1923  ecIdePSyncroEdSelStart:          SetSingle(VK_J,[ssCtrl]);
1924
1925  else
1926    begin
1927      SetSingle(VK_UNKNOWN,[],VK_UNKNOWN,[]);
1928    end;
1929  end;
1930(*//F1                      Topic Search
1931//Ctrl+F1                Topic Search
1932  ecNextEditor: SetSingle(VK_F6,[]);
1933  ecPrevEditor: SetSingle(VK_F6,[ssShift]);
1934  ecWordLeft:   SetSingle(VK_A,[ssCtrl],VK_LEFT,[ssCtrl]);
1935  ecPageDown:   SetSingle(VK_C,[ssCtrl],VK_NEXT,[]);
1936//Ctrl+D                 Moves the cursor right one column, accounting for the
1937//autoindent setting
1938//Ctrl+E                 Moves the cursor up one line
1939//Ctrl+F                 Moves one word right
1940//Ctrl+G                 Deletes the character to the right of the cursor
1941//Ctrl+H                 Deletes the character to the left of the cursor
1942//Ctrl+I                  Inserts a tab
1943//Ctrl+L                 Search|Search Again
1944//Ctrl+N                 Inserts a new line
1945//Ctrl+P                 Causes next character to be interpreted as an ASCII
1946//sequence
1947//Ctrl+R                 Moves up one screen
1948//Ctrl+S                 Moves the cursor left one column, accounting for the
1949//autoindent setting
1950//Ctrl+T                 Deletes a word
1951//Ctrl+V                 Turns insert mode on/off
1952//Ctrl+W                Moves down one screen
1953//Ctrl+X                 Moves the cursor down one line
1954//Ctrl+Y                 Deletes a line
1955//Ctrl+Z                 Moves the cursor up one line
1956//Ctrl+Shift+S          Performs an incremental search
1957
1958//Block commands:
1959//---------------
1960//Ctrl+K+B      Marks the beginning of a block
1961//Ctrl+K+C      Copies a selected block
1962//Ctrl+K+H      Hides/shows a selected block
1963//Ctrl+K+I       Indents a block by the amount specified in the Block Indent
1964//combo box on the General page of the Editor Options dialog box.
1965//Ctrl+K+K      Marks the end of a block
1966//Ctrl+K+L       Marks the current line as a block
1967//Ctrl+K+N      Changes a block to uppercase
1968//Ctrl+K+O      Changes a block to lowercase
1969//Ctrl+K+P      Prints selected block
1970//Ctrl+K+R      Reads a block from a file
1971//Ctrl+K+T       Marks a word as a block
1972//Ctrl+K+U      Outdents a block by the amount specified in the Block Indent
1973//combo box on the General page of the Editor Options dialog box.
1974//Ctrl+K+V      Moves a selected block
1975//Ctrl+K+W      Writes a selected block to a file
1976//Ctrl+K+Y      Deletes a selected block
1977//Ctrl+O+C      Turns on column blocking
1978//Ctrl+O+I       Marks an inclusive block
1979//Ctrl+O+K      Turns off column blocking
1980//Ctrl+O+L      Marks a line as a block
1981//Shift+Alt+arrow Selects column-oriented blocks
1982//Click+Alt+mousemv Selects column-oriented blocks
1983//Ctrl+Q+B      Moves to the beginning of a block
1984//Ctrl+Q+K      Moves to the end of a block
1985
1986//Miscellaneous commands:
1987//-----------------------
1988//Ctrl+K+D      Accesses the menu bar
1989//Ctrl+K+E       Changes a word to lowercase
1990//Ctrl+K+F       Changes a word to uppercase
1991//Ctrl+K+S      File|Save (Default and IDE Classic only)
1992//Ctrl+Q+A      Search|Replace
1993//Ctrl+Q+F      Search|Find
1994//Ctrl+Q+Y      Deletes to the end of a line
1995//Ctrl+Q+[       Finds the matching delimiter (forward)
1996//Ctrl+Q+Ctrl+[ Finds the matching delimiter (forward)
1997//Ctrl+Q+]       Finds the matching delimiter (backward)
1998//Ctrl+Q+Ctrl+] Finds the matching delimiter (backward)
1999//Ctrl+O+A      Open file at cursor
2000//Ctrl+O+B      Browse symbol at cursor (Delphi only)
2001//Alt+right arrow  For code browsing
2002//Alt +left arrow For code browsing
2003//Ctrl+O+G      Search|Go to line number
2004//Ctrl+O+O      Inserts compiler options and directives
2005//Ctrl+O+U      Toggles case
2006//Bookmark commands:
2007//------------------
2008//Shortcut       Action
2009//Ctrl+K+0       Sets bookmark 0
2010//Ctrl+K+1       Sets bookmark 1
2011//Ctrl+K+2       Sets bookmark 2
2012//Ctrl+K+3       Sets bookmark 3
2013//Ctrl+K+4       Sets bookmark 4
2014//Ctrl+K+5       Sets bookmark 5
2015//Ctrl+K+6       Sets bookmark 6
2016//Ctrl+K+7       Sets bookmark 7
2017//Ctrl+K+8       Sets bookmark 8
2018//Ctrl+K+9       Sets bookmark 9
2019//Ctrl+K+Ctrl+0 Sets bookmark 0
2020//Ctrl+K+Ctrl+1 Sets bookmark 1
2021//Ctrl+K+Ctrl+2 Sets bookmark 2
2022//Ctrl+K+Ctrl+3 Sets bookmark 3
2023//Ctrl+K+Ctrl+4 Sets bookmark 4
2024//Ctrl+K+Ctrl+5 Sets bookmark 5
2025//Ctrl+K+Ctrl+6 Sets bookmark 6
2026//Ctrl+K+Ctrl+7 Sets bookmark 7
2027//Ctrl+K+Ctrl+8 Sets bookmark 8
2028//Ctrl+K+Ctrl+9 Sets bookmark 9
2029//Ctrl+Q+0       Goes to bookmark 0
2030//Ctrl+Q+1       Goes to bookmark 1
2031//Ctrl+Q+2       Goes to bookmark 2
2032//Ctrl+Q+3       Goes to bookmark 3
2033//Ctrl+Q+4       Goes to bookmark 4
2034//Ctrl+Q+5       Goes to bookmark 5
2035//Ctrl+Q+6       Goes to bookmark 6
2036//Ctrl+Q+7       Goes to bookmark 7
2037//Ctrl+Q+8       Goes to bookmark 8
2038//Ctrl+Q+9       Goes to bookmark 9
2039//Ctrl+Q+Ctrl+0 Goes to bookmark 0
2040//Ctrl+Q+Ctrl+1 Goes to bookmark 1
2041//Ctrl+Q+Ctrl+2 Goes to bookmark 2
2042//Ctrl+Q+Ctrl+3 Goes to bookmark 3
2043//Ctrl+Q+Ctrl+4 Goes to bookmark 4
2044//Ctrl+Q+Ctrl+5 Goes to bookmark 5
2045//Ctrl+Q+Ctrl+6 Goes to bookmark 6
2046//Ctrl+Q+Ctrl+7 Goes to bookmark 7
2047//Ctrl+Q+Ctrl+8 Goes to bookmark 8
2048//Ctrl+Q+Ctrl+9 Goes to bookmark 9
2049//Cursor movement:
2050//----------------
2051//Ctrl+Q+B      Moves to the beginning of a block
2052//Ctrl+Q+C      Moves to end of a file
2053//Ctrl+Q+D      Moves to the end of a line
2054//Ctrl+Q+E      Moves the cursor to the top of the window
2055//Ctrl+Q+K      Moves to the end of a block
2056//Ctrl+Q+P      Moves to previous position
2057//Ctrl+Q+R      Moves to the beginning of a file
2058//Ctrl+Q+S      Moves to the beginning of a line
2059//Ctrl+Q+T      Moves the viewing editor so that the current line is placed at
2060//the top of the window
2061//Ctrl+Q+U      Moves the viewing editor so that the current line is placed at
2062//the bottom of the window, if possible
2063//Ctrl+Q+X      Moves the cursor to the bottom of the window
2064//System keys:
2065//------------
2066
2067//F1              Displays context-sensitive Help
2068//F2              File|Save
2069//F3              File|Open
2070//F4              Run to Cursor
2071//F5              Zooms window
2072//F6              Displays the next page
2073//F7              Run|Trace Into
2074//F8              Run|Step Over
2075//F9              Run|Run
2076//F11             View|Object Inspector
2077//F12             View|Toggle Form/Unit
2078//Alt+0           View|Window List
2079//Alt+F2          View|CPU
2080//Alt+F3          File|Close
2081//Alt+F7          Displays previous error in Message view
2082//Alt+F8          Displays next error in Message view
2083//Alt+F11        File|Use Unit (Delphi)
2084//Alt+F11        File|Include Unit Hdr (C++)
2085//Alt+F12        Displays the Code editor
2086//Alt+X           File|Exit
2087//Alt+right arrow  For code browsing forward
2088//Alt +left arrow For code browsing backward
2089//Alt +up arrow  For code browsing Ctrl-click on identifier
2090//Alt+Page Down Goes to the next tab
2091//Alt+Page Up   Goes to the previous tab
2092//Ctrl+F1        Topic Search
2093//Ctrl+F2        Run|Program Reset
2094//Ctrl+F3        View|Call Stack
2095//Ctrl+F6        Open Source/Header file (C++)
2096//Ctrl+F7        Add Watch at Cursor
2097//Ctrl+F8        Toggle Breakpoint
2098//Ctrl+F9        Project|Compile project (Delphi)
2099//Ctrl+F9        Project|Make project (C++)
2100//Ctrl+F11       File|Open Project
2101//Ctrl+F12       View|Units
2102//Shift+F7       Run|Trace To Next Source Line
2103//Shift+F11      Project|Add To Project
2104//Shift+F12      View|Forms
2105//Ctrl+D         Descends item (replaces Inspector window)
2106//Ctrl+N         Opens a new Inspector window
2107//Ctrl+S          Incremental search
2108//Ctrl+T          Displays the Type Cast dialog
2109  else
2110    GetDefaultKeyForCommand(Command,TheKeyA,TheKeyB);
2111  end;
2112*)
2113end;
2114
2115procedure TKeyCommandRelation.GetDefaultKeyForMacOSXScheme;
2116begin
2117  case Command of
2118  // moving
2119  ecLeft:                SetSingle(VK_LEFT,[]);
2120  ecRight:               SetSingle(VK_RIGHT,[]);
2121  ecUp:                  SetSingle(VK_UP,[]);
2122  ecDown:                SetSingle(VK_DOWN,[]);
2123  ecWordLeft:            SetSingle(VK_LEFT,[ssAlt]);
2124  ecWordRight:           SetSingle(VK_RIGHT,[ssAlt]);
2125  ecLineStart:           SetSingle(VK_LEFT,[ssMeta]);
2126  ecLineEnd:             SetSingle(VK_RIGHT,[ssMeta]);
2127  ecPageUp:              SetSingle(VK_PRIOR,[]);
2128  ecPageDown:            SetSingle(VK_NEXT,[]);
2129  ecPageLeft:            SetSingle(VK_UNKNOWN,[]);
2130  ecPageRight:           SetSingle(VK_UNKNOWN,[]);
2131  ecPageTop:             SetSingle(VK_PRIOR,[ssAlt]);
2132  ecPageBottom:          SetSingle(VK_END,[ssAlt]);
2133  ecEditorTop:           SetSingle(VK_HOME,[],       VK_UP,[ssMeta]);
2134  ecEditorBottom:        SetSingle(VK_END,[],        VK_DOWN,[ssMeta]);
2135  ecScrollUp:            SetSingle(VK_UP,[ssCtrl]);
2136  ecScrollDown:          SetSingle(VK_DOWN,[ssCtrl]);
2137  ecScrollLeft:          SetSingle(VK_UNKNOWN,[]);
2138  ecScrollRight:         SetSingle(VK_UNKNOWN,[]);
2139
2140  // selection
2141  ecSelLeft:             SetSingle(VK_LEFT,[ssShift]);
2142  ecSelRight:            SetSingle(VK_RIGHT,[ssShift]);
2143  ecSelUp:               SetSingle(VK_UP,[ssShift]);
2144  ecSelDown:             SetSingle(VK_DOWN,[ssShift]);
2145  ecCopy:                SetSingle(VK_C,[ssMeta],    VK_Insert,[ssCtrl]);
2146  ecCut:                 SetSingle(VK_X,[ssMeta],    VK_Delete,[ssShift]);
2147  ecPaste:               SetSingle(VK_V,[ssMeta],    VK_Insert,[ssShift]);
2148  ecMultiPaste:          SetSingle(VK_UNKNOWN,[]);
2149  ecNormalSelect:        SetSingle(VK_UNKNOWN,[]);
2150  ecColumnSelect:        SetSingle(VK_UNKNOWN,[]);
2151  ecLineSelect:          SetSingle(VK_UNKNOWN,[]);
2152  ecSelWordLeft:         SetSingle(VK_LEFT,[ssAlt,ssShift]);
2153  ecSelWordRight:        SetSingle(VK_RIGHT,[ssAlt,ssShift]);
2154  ecSelLineStart:        SetSingle(VK_LEFT,[ssMeta,ssShift]);
2155  ecSelLineEnd:          SetSingle(VK_RIGHT,[ssMeta,ssShift]);
2156  ecSelPageTop:          SetSingle(VK_PRIOR,[ssAlt,ssShift]);
2157  ecSelPageBottom:       SetSingle(VK_NEXT,[ssAlt,ssShift]);
2158  ecSelEditorTop:        SetSingle(VK_HOME,[ssShift]);
2159  ecSelEditorBottom:     SetSingle(VK_END,[ssShift]);
2160  ecSelectAll:           SetSingle(VK_A,[ssMeta]);
2161  ecSelectToBrace:       SetSingle(VK_UNKNOWN,[]);
2162  ecSelectCodeBlock:     SetSingle(VK_UNKNOWN,[]);
2163  ecSelectWord:          SetCombo(VK_K,[SSCtrl],VK_T,[]);
2164  ecSelectLine:          SetCombo(VK_K,[SSCtrl],VK_L,[]);
2165  ecSelectParagraph:     SetSingle(VK_UNKNOWN,[]);
2166  ecSelectionUpperCase:  SetCombo(VK_K,[SSCtrl],VK_N,[]);
2167  ecSelectionLowerCase:  SetCombo(VK_K,[SSCtrl],VK_O,[]);
2168  ecSelectionSwapCase:   SetCombo(VK_K,[SSCtrl],VK_P,[]);
2169  ecSelectionTabs2Spaces:SetSingle(VK_UNKNOWN,[]);
2170  ecSelectionEnclose:    SetSingle(VK_UNKNOWN,[]);
2171  ecSelectionComment:    SetSingle(VK_UNKNOWN,[]);
2172  ecSelectionUncomment:  SetSingle(VK_UNKNOWN,[]);
2173  ecToggleComment:       SetSingle(VK_OEM_2,[ssCtrl]);
2174  ecSelectionEncloseIFDEF:SetSingle(VK_D,[ssShift,ssCtrl]);
2175  ecSelectionSort:       SetSingle(VK_UNKNOWN,[]);
2176  ecSelectionBreakLines: SetSingle(VK_UNKNOWN,[]);
2177
2178  ecStickySelection:     SetCombo(VK_K,[ssCtrl],VK_S,[]);
2179  ecStickySelectionCol:  SetCombo(VK_K,[ssCtrl],VK_S,[ssAlt]);
2180  ecStickySelectionStop: SetCombo(VK_K,[ssCtrl],VK_E,[]);
2181
2182  ecBlockSetBegin:       SetCombo(VK_K,[ssCtrl],VK_B,[]);
2183  ecBlockSetEnd:         SetCombo(VK_K,[ssCtrl],VK_K,[]);
2184  ecBlockToggleHide:     SetCombo(VK_K,[ssCtrl],VK_H,[]);
2185  ecBlockHide:           SetCombo(VK_UNKNOWN,[],VK_UNKNOWN,[]);
2186  ecBlockShow:           SetCombo(VK_UNKNOWN,[],VK_UNKNOWN,[]);
2187  ecBlockMove:           SetCombo(VK_K,[ssCtrl],VK_V,[]);
2188  ecBlockCopy:           SetCombo(VK_K,[ssCtrl],VK_C,[]);
2189  ecBlockDelete:         SetCombo(VK_K,[ssCtrl],VK_Y,[]);
2190  ecBlockGotoBegin:      SetCombo(VK_Q,[ssCtrl],VK_B,[]);
2191  ecBlockGotoEnd:        SetCombo(VK_Q,[ssCtrl],VK_K,[]);
2192
2193// column mode selection
2194  ecColSelUp:            SetSingle(VK_UP,[ssAlt,ssShift]);
2195  ecColSelDown:          SetSingle(VK_DOWN,[ssAlt,ssShift]);
2196  ecColSelLeft:          SetSingle(VK_UNKNOWN,[]); // VK_LEFT,[ssAlt,ssShift] conflicts.
2197  ecColSelRight:         SetSingle(VK_UNKNOWN,[]); // VK_RIGHT,[ssAlt,ssShift] conflicts.
2198  ecColSelPageDown:      SetSingle(VK_UNKNOWN,[]); // VK_NEXT,[ssAlt,ssShift] conflicts.
2199  ecColSelPageBottom:    SetSingle(VK_NEXT,[ssAlt,ssShift,ssCtrl]);
2200  ecColSelPageUp:        SetSingle(VK_UNKNOWN,[]); // VK_PRIOR,[ssAlt,ssShift] conflicts.
2201  ecColSelPageTop:       SetSingle(VK_PRIOR,[ssAlt,ssShift,ssCtrl]);
2202  ecColSelLineStart:     SetSingle(VK_HOME,[ssAlt,ssShift]);
2203  ecColSelLineEnd:       SetSingle(VK_END,[ssAlt,ssShift]);
2204  ecColSelEditorTop:     SetSingle(VK_HOME,[ssAlt,ssShift,ssCtrl]);
2205  ecColSelEditorBottom:  SetSingle(VK_END,[ssAlt,ssShift,ssCtrl]);
2206
2207  // multi caret
2208  ecPluginMultiCaretSetCaret:    SetSingle(VK_INSERT,[ssShift, ssCtrl]);
2209  ecPluginMultiCaretUnsetCaret:  SetSingle(VK_DELETE,[ssShift, ssCtrl]);
2210  //ecPluginMultiCaretToggleCaret: SetSingle(VK_INSERT,[ssShift, ssCtrl]);
2211  ecPluginMultiCaretClearAll:    SetSingle(VK_ESCAPE,[ssShift, ssCtrl], VK_ESCAPE,[]);
2212
2213  ecPluginMultiCaretModeCancelOnMove:  SetCombo(VK_Q,[ssShift, ssCtrl], VK_X,[ssShift, ssCtrl]);
2214  ecPluginMultiCaretModeMoveAll:       SetCombo(VK_Q,[ssShift, ssCtrl], VK_M,[ssShift, ssCtrl]);
2215
2216  // editing
2217  ecBlockIndent:         SetCombo(VK_I,[ssCtrl],VK_UNKNOWN,[],  VK_K,[SSCtrl],VK_I,[]);
2218  ecBlockUnindent:       SetCombo(VK_U,[ssCtrl],VK_UNKNOWN,[],  VK_K,[SSCtrl],VK_U,[]);
2219  ecDeleteLastChar:      SetSingle(VK_BACK,[],       VK_BACK,[ssShift]); // ctrl H used for scroll window.
2220  ecDeleteChar:          SetSingle(VK_DELETE,[]); // ctrl G conflicts with GO
2221  ecDeleteWord:          SetSingle(VK_DELETE,[ssAlt]);
2222  ecDeleteLastWord:      SetSingle(VK_BACK,[ssCtrl]);
2223  ecDeleteBOL:           SetSingle(VK_BACK,[ssMeta]);
2224  ecDeleteEOL:           SetSingle(VK_DELETE,[ssMeta]);
2225  ecDeleteLine:          SetSingle(VK_Y,[ssCtrl]);
2226  ecClearAll:            SetSingle(VK_UNKNOWN,[]);
2227  ecLineBreak:           SetSingle(VK_RETURN,[]);
2228  ecInsertLine:          SetSingle(VK_N,[ssShift,ssMeta]);
2229  ecInsertCharacter:     SetSingle(VK_UNKNOWN,[]);
2230  ecInsertGUID:          SetSingle(VK_G,[ssCtrl,ssShift]);
2231  // Note: all insert text snippet keys have no default key
2232
2233  // command commands
2234  ecUndo:                SetSingle(VK_Z,[ssMeta]);
2235  ecRedo:                SetSingle(VK_Z,[ssMeta,ssShift]);
2236
2237  // search & replace
2238  ecMatchBracket:        SetSingle(VK_UNKNOWN,[]);
2239  ecFind:                SetSingle(VK_F,[ssMeta]);
2240  ecFindNext:            SetSingle(VK_G,[ssMeta]);
2241  ecFindPrevious:        SetSingle(VK_G,[ssShift,ssMeta]);
2242  ecFindInFiles:         SetSingle(VK_F,[ssMeta,ssShift]);
2243  ecReplace:             SetSingle(VK_UNKNOWN,[]);
2244  ecIncrementalFind:     SetSingle(VK_E,[ssMeta]);
2245  ecGotoLineNumber:      SetSingle(VK_L,[ssMeta]);
2246  ecFindNextWordOccurrence:SetSingle(VK_UNKNOWN,[]);
2247  ecFindPrevWordOccurrence:SetSingle(VK_UNKNOWN,[]);
2248  ecJumpBack:            SetSingle(VK_H,[ssCtrl]);
2249  ecJumpForward:         SetSingle(VK_H,[ssCtrl,ssShift]);
2250  ecAddJumpPoint:        SetSingle(VK_UNKNOWN,[]);
2251  ecJumpToPrevError:     SetSingle(VK_ADD,[ssMeta,ssShift]);
2252  ecJumpToNextError:     SetSingle(VK_ADD,[ssMeta]);
2253  ecOpenFileAtCursor:    SetSingle(VK_RETURN,[ssCtrl]);
2254  ecProcedureList:       SetSingle(VK_G,[ssAlt]);
2255
2256  // marker
2257  ecSetFreeBookmark:     SetSingle(VK_UNKNOWN,[]);
2258  ecClearBookmarkForFile:SetSingle(VK_UNKNOWN,[]);
2259  ecClearAllBookmark:    SetSingle(VK_UNKNOWN,[]);
2260  ecPrevBookmark:        SetSingle(VK_UNKNOWN,[]);
2261  ecNextBookmark:        SetSingle(VK_UNKNOWN,[]);
2262  ecGotoMarker0:         SetSingle(VK_0,[ssCtrl]);
2263  ecGotoMarker1:         SetSingle(VK_1,[ssCtrl]);
2264  ecGotoMarker2:         SetSingle(VK_2,[ssCtrl]);
2265  ecGotoMarker3:         SetSingle(VK_3,[ssCtrl]);
2266  ecGotoMarker4:         SetSingle(VK_4,[ssCtrl]);
2267  ecGotoMarker5:         SetSingle(VK_5,[ssCtrl]);
2268  ecGotoMarker6:         SetSingle(VK_6,[ssCtrl]);
2269  ecGotoMarker7:         SetSingle(VK_7,[ssCtrl]);
2270  ecGotoMarker8:         SetSingle(VK_8,[ssCtrl]);
2271  ecGotoMarker9:         SetSingle(VK_9,[ssCtrl]);
2272  ecToggleMarker0:       SetCombo(VK_0,[ssShift,ssCtrl],VK_UNKNOWN,[], VK_K,[SSCtrl],VK_0,[]);
2273  ecToggleMarker1:       SetCombo(VK_1,[ssShift,ssCtrl],VK_UNKNOWN,[], VK_K,[SSCtrl],VK_1,[]);
2274  ecToggleMarker2:       SetCombo(VK_2,[ssShift,ssCtrl],VK_UNKNOWN,[], VK_K,[SSCtrl],VK_2,[]);
2275  ecToggleMarker3:       SetCombo(VK_3,[ssShift,ssCtrl],VK_UNKNOWN,[], VK_K,[SSCtrl],VK_3,[]);
2276  ecToggleMarker4:       SetCombo(VK_4,[ssShift,ssCtrl],VK_UNKNOWN,[], VK_K,[SSCtrl],VK_4,[]);
2277  ecToggleMarker5:       SetCombo(VK_5,[ssShift,ssCtrl],VK_UNKNOWN,[], VK_K,[SSCtrl],VK_5,[]);
2278  ecToggleMarker6:       SetCombo(VK_6,[ssShift,ssCtrl],VK_UNKNOWN,[], VK_K,[SSCtrl],VK_6,[]);
2279  ecToggleMarker7:       SetCombo(VK_7,[ssShift,ssCtrl],VK_UNKNOWN,[], VK_K,[SSCtrl],VK_7,[]);
2280  ecToggleMarker8:       SetCombo(VK_8,[ssShift,ssCtrl],VK_UNKNOWN,[], VK_K,[SSCtrl],VK_8,[]);
2281  ecToggleMarker9:       SetCombo(VK_9,[ssShift,ssCtrl],VK_UNKNOWN,[], VK_K,[SSCtrl],VK_9,[]);
2282  ecSetMarker0..ecSetMarker9: SetSingle(VK_UNKNOWN,[]);
2283
2284  // codetools
2285  ecAutoCompletion:      SetSingle(VK_J,[ssMeta]);
2286  ecWordCompletion:      SetSingle(VK_SPACE,[ssCtrl,ssAlt]);
2287  ecCompleteCode:        SetSingle(VK_C,[ssCtrl,ssShift]);
2288  ecCompleteCodeInteractive: SetSingle(VK_X,[ssCtrl,ssShift]);
2289  ecIdentCompletion:     SetSingle(VK_SPACE,[ssCtrl]);
2290  ecShowCodeContext:     SetSingle(VK_SPACE,[ssCtrl,ssShift]);
2291  ecExtractProc:         SetSingle(VK_UNKNOWN,[]);
2292  ecFindIdentifierRefs:  SetSingle(VK_UNKNOWN,[]);
2293  ecFindUsedUnitRefs:    SetSingle(VK_UNKNOWN,[]);
2294  ecRenameIdentifier:    SetSingle(VK_E,[ssMeta,ssShift]);
2295  ecInvertAssignment:    SetSingle(VK_UNKNOWN,[]);
2296  ecSyntaxCheck:         SetSingle(VK_UNKNOWN,[]);
2297  ecGuessUnclosedBlock:  SetSingle(VK_UNKNOWN,[]);
2298  ecGuessMisplacedIFDEF: SetSingle(VK_UNKNOWN,[]);
2299  ecConvertDFM2LFM:      SetSingle(VK_UNKNOWN,[]);
2300  ecCheckLFM:            SetSingle(VK_UNKNOWN,[]);
2301  ecConvertDelphiUnit:   SetSingle(VK_UNKNOWN,[]);
2302  ecConvertDelphiProject:SetSingle(VK_UNKNOWN,[]);
2303  ecConvertDelphiPackage:SetSingle(VK_UNKNOWN,[]);
2304  ecConvertEncoding:     SetSingle(VK_UNKNOWN,[]);
2305  ecFindProcedureDefinition:SetSingle(VK_UP,[ssShift,SSCtrl]);
2306  ecFindProcedureMethod: SetSingle(VK_DOWN,[ssShift,SSCtrl]);
2307  ecFindDeclaration:     SetSingle(VK_UP,[ssAlt]);
2308  ecFindBlockOtherEnd:   SetSingle(VK_UNKNOWN,[]);
2309  ecFindBlockStart:      SetSingle(VK_UNKNOWN,[]);
2310  ecGotoIncludeDirective:SetSingle(VK_UNKNOWN,[]);
2311  ecShowAbstractMethods: SetSingle(VK_UNKNOWN,[]);
2312  ecRemoveEmptyMethods:  SetSingle(VK_UNKNOWN,[]);
2313
2314  // source notebook
2315  ecNextEditor:          SetSingle(VK_RIGHT,[ssMeta,ssAlt]);
2316  ecPrevEditor:          SetSingle(VK_LEFT,[ssMeta,ssAlt]);
2317  ecResetDebugger:       SetSingle(VK_UNKNOWN,[]);
2318  ecToggleBreakPoint:    SetSingle(VK_P,[ssCtrl]);
2319  ecToggleBreakPointEnabled:    SetSingle(VK_UNKNOWN,[]);
2320  ecMoveEditorLeft:      SetSingle(VK_UNKNOWN,[]);
2321  ecMoveEditorRight:     SetSingle(VK_UNKNOWN,[]);
2322  ecMoveEditorLeftmost:  SetSingle(VK_UNKNOWN,[]);
2323  ecMoveEditorRightmost: SetSingle(VK_UNKNOWN,[]);
2324
2325  ecNextSharedEditor:    SetSingle(VK_UNKNOWN,[]);
2326  ecPrevSharedEditor:    SetSingle(VK_UNKNOWN,[]);
2327  ecNextWindow:          SetSingle(VK_UNKNOWN,[]);
2328  ecPrevWindow:          SetSingle(VK_UNKNOWN,[]);
2329  ecMoveEditorNextWindow:SetSingle(VK_UNKNOWN,[]);
2330  ecMoveEditorPrevWindow:SetSingle(VK_UNKNOWN,[]);
2331  ecMoveEditorNewWindow: SetSingle(VK_UNKNOWN,[]);
2332  ecCopyEditorNextWindow:SetSingle(VK_UNKNOWN,[]);
2333  ecCopyEditorPrevWindow:SetSingle(VK_UNKNOWN,[]);
2334  ecCopyEditorNewWindow: SetSingle(VK_UNKNOWN,[]);
2335
2336  ecGotoEditor1:         SetSingle(VK_UNKNOWN,[]);
2337  ecGotoEditor2:         SetSingle(VK_UNKNOWN,[]);
2338  ecGotoEditor3:         SetSingle(VK_UNKNOWN,[]);
2339  ecGotoEditor4:         SetSingle(VK_UNKNOWN,[]);
2340  ecGotoEditor5:         SetSingle(VK_UNKNOWN,[]);
2341  ecGotoEditor6:         SetSingle(VK_UNKNOWN,[]);
2342  ecGotoEditor7:         SetSingle(VK_UNKNOWN,[]);
2343  ecGotoEditor8:         SetSingle(VK_UNKNOWN,[]);
2344  ecGotoEditor9:         SetSingle(VK_UNKNOWN,[]);
2345  ecGotoEditor0:         SetSingle(VK_UNKNOWN,[]);
2346
2347  ecLockEditor:          SetSingle(VK_UNKNOWN,[]);
2348
2349  (*
2350  EcFoldLevel1:          SetSingle(VK_1,[ssMeta,ssShift]);
2351  EcFoldLevel2:          SetSingle(VK_2,[ssMeta,ssShift]);
2352  EcFoldLevel3:          SetSingle(VK_3,[ssMeta,ssShift]);
2353  EcFoldLevel4:          SetSingle(VK_4,[ssMeta,ssShift]);
2354  EcFoldLevel5:          SetSingle(VK_5,[ssMeta,ssShift]);
2355  EcFoldLevel6:          SetSingle(VK_6,[ssMeta,ssShift]);
2356  EcFoldLevel7:          SetSingle(VK_7,[ssMeta,ssShift]);
2357  EcFoldLevel8:          SetSingle(VK_8,[ssMeta,ssShift]);
2358  EcFoldLevel9:          SetSingle(VK_9,[ssMeta,ssShift]);
2359  EcFoldLevel0:          SetSingle(VK_0,[ssMeta,ssShift]);
2360  EcFoldCurrent:         SetSingle(VK_OEM_PLUS,[ssMeta,ssShift]);
2361  EcUnFoldCurrent:       SetSingle(VK_OEM_MINUS,[ssMeta,ssShift]);
2362  EcToggleMarkupWord:    SetSingle(VK_M,[ssMeta]);
2363  *)
2364
2365  ecGotoBookmarks:       SetSingle(VK_UNKNOWN,[]);
2366  ecToggleBookmarks:     SetSingle(VK_UNKNOWN,[]);
2367
2368  // file menu
2369  ecNew:                 SetSingle(VK_N,[ssMeta]);
2370  ecNewUnit:             SetSingle(VK_UNKNOWN,[]);
2371  ecNewForm:             SetSingle(VK_UNKNOWN,[]);
2372  ecOpen:                SetSingle(VK_O,[ssMeta]);
2373  ecOpenUnit:            SetSingle(VK_F12,[ssAlt]);
2374  ecRevert:              SetSingle(VK_UNKNOWN,[]);
2375  ecSave:                SetSingle(VK_S,[ssMeta]);
2376  ecSaveAs:              SetSingle(VK_S,[ssMeta,ssShift]);
2377  ecSaveAll:             SetSingle(VK_S,[ssMeta,ssAlt]);
2378  ecClose:               SetSingle(VK_W,[ssMeta],VK_W,[ssMeta,ssShift]);
2379  ecCloseAll:            SetSingle(VK_UNKNOWN,[]);
2380  ecCloseOtherTabs:      SetSingle(VK_UNKNOWN,[]);
2381  ecCloseRightTabs:      SetSingle(VK_UNKNOWN,[]);
2382  ecCleanDirectory:      SetSingle(VK_UNKNOWN,[]);
2383  ecRestart:             SetSingle(VK_UNKNOWN,[]);
2384  ecQuit:                SetSingle(VK_UNKNOWN,[]);
2385
2386  // view menu
2387  ecToggleObjectInsp:    SetSingle(VK_I,[ssAlt,ssMeta]);
2388  ecToggleSourceEditor:  SetSingle(VK_UNKNOWN,[]);
2389  ecToggleCodeExpl:      SetSingle(VK_UNKNOWN,[]);
2390  ecToggleFPDocEditor:   SetSingle(VK_UNKNOWN,[]);
2391  ecToggleMessages:      SetSingle(VK_UNKNOWN,[]);
2392  ecViewComponents:      SetSingle(VK_UNKNOWN,[]);
2393  ecViewJumpHistory:     SetSingle(VK_UNKNOWN,[]);
2394  ecToggleSearchResults: SetSingle(VK_F,[ssCtrl,ssAlt]);
2395  ecToggleWatches:       SetSingle(VK_W,[ssCtrl,ssAlt]);
2396  ecToggleBreakPoints:   SetSingle(VK_B,[ssCtrl,ssAlt]);
2397  ecToggleLocals:        SetSingle(VK_L,[ssCtrl,ssAlt],     VK_L,[ssCtrl,ssShift]);
2398  ecViewPseudoTerminal: if HasConsoleSupport then SetSingle(VK_O,[ssCtrl,ssAlt]);
2399  ecViewThreads:         SetSingle(VK_T,[ssCtrl,ssAlt]);
2400  ecToggleCallStack:     SetSingle(VK_S,[ssCtrl,ssAlt]);
2401  ecToggleRegisters:     SetSingle(VK_R,[ssCtrl,ssAlt]);
2402  ecToggleAssembler:     SetSingle(VK_D,[ssCtrl,ssAlt]);
2403  ecToggleDebugEvents:   SetSingle(VK_V,[ssCtrl,ssAlt]);
2404  ecToggleDebuggerOut:   SetSingle(VK_UNKNOWN,[]);
2405  ecViewHistory:         SetSingle(VK_H,[ssCtrl,ssAlt]);
2406  ecViewUnitDependencies:SetSingle(VK_UNKNOWN,[]);
2407  ecViewUnitInfo:        SetSingle(VK_UNKNOWN,[]);
2408  ecToggleFormUnit:      SetSingle(VK_F,[ssMeta,ssAlt]);
2409  ecViewAnchorEditor:    SetSingle(VK_UNKNOWN,[]);
2410  ecToggleCodeBrowser:   SetSingle(VK_UNKNOWN,[]);
2411  ecToggleRestrictionBrowser:SetSingle(VK_UNKNOWN,[]);
2412  ecToggleCompPalette:   SetSingle(VK_UNKNOWN,[]);
2413  ecToggleIDESpeedBtns:  SetSingle(VK_UNKNOWN,[]);
2414
2415  // project menu
2416  ecNewProject:          SetSingle(VK_UNKNOWN,[]);
2417  ecNewProjectFromFile:  SetSingle(VK_UNKNOWN,[]);
2418  ecOpenProject:         SetSingle(VK_UNKNOWN,[]);
2419  ecCloseProject:        SetSingle(VK_UNKNOWN,[]);
2420  ecSaveProject:         SetSingle(VK_UNKNOWN,[]);
2421  ecSaveProjectAs:       SetSingle(VK_UNKNOWN,[]);
2422  ecProjectResaveFormsWithI18n: SetSingle(VK_UNKNOWN,[]);
2423  ecPublishProject:      SetSingle(VK_UNKNOWN,[]);
2424  ecProjectInspector:    SetSingle(VK_UNKNOWN,[]);
2425  ecAddCurUnitToProj:    SetSingle(VK_A,[ssAlt,ssMeta]);
2426  ecRemoveFromProj:      SetSingle(VK_UNKNOWN,[]);
2427  ecViewProjectUnits:    SetSingle(VK_U,[ssCtrl,ssAlt]);
2428  ecViewProjectForms:    SetSingle(VK_U,[ssShift,ssCtrl]);
2429  ecViewProjectSource:   SetSingle(VK_UNKNOWN,[]);
2430  ecProjectOptions:      SetSingle(VK_UNKNOWN,[]);
2431  ecProjectChangeBuildMode:SetSingle(VK_UNKNOWN,[]);
2432
2433  // run menu
2434  ecCompile:             SetSingle(VK_B,[ssMeta]);
2435  ecBuild:               SetSingle(VK_UNKNOWN,[]);
2436  ecQuickCompile:        SetSingle(VK_UNKNOWN,[]);
2437  ecCleanUpAndBuild:     SetSingle(VK_UNKNOWN,[]);
2438  ecBuildManyModes:      SetSingle(VK_UNKNOWN,[]);
2439  ecAbortBuild:          SetSingle(VK_UNKNOWN,[]);
2440  ecRunWithoutDebugging: SetSingle(VK_R,[ssMeta, ssCtrl]);
2441  ecRun:                 SetSingle(VK_R,[ssMeta]);
2442  ecPause:               SetSingle(VK_UNKNOWN,[]);
2443  ecShowExecutionPoint:  SetSingle(VK_UNKNOWN,[]);
2444  ecStepInto:            SetSingle(VK_R,[ssMeta,ssAlt]);
2445  ecStepOver:            SetSingle(VK_R,[ssMeta,ssShift]);
2446  ecStepOut:             SetSingle(VK_T,[ssMeta,ssShift]);
2447  ecStepToCursor:         SetSingle(VK_UNKNOWN,[]);
2448  ecStopProgram:         SetSingle(VK_RETURN,[ssShift,ssMeta]);
2449  ecRemoveBreakPoint:    SetSingle(VK_UNKNOWN,[]);
2450  ecRunParameters:       SetSingle(VK_UNKNOWN,[]);
2451  ecBuildFile:           SetSingle(VK_UNKNOWN,[]);
2452  ecRunFile:             SetSingle(VK_UNKNOWN,[]);
2453  ecConfigBuildFile:     SetSingle(VK_UNKNOWN,[]);
2454  ecInspect:             SetSingle(VK_UNKNOWN,[]);
2455  ecEvaluate:            SetSingle(VK_E,[ssCtrl,ssShift]);
2456  ecAddWatch:            SetSingle(VK_UNKNOWN,[]);
2457  ecAddBpSource:         SetSingle(VK_UNKNOWN,[]);
2458  ecAddBpAddress:        SetSingle(VK_UNKNOWN,[]);
2459  ecAddBpDataWatch:      SetSingle(VK_UNKNOWN,[]);
2460
2461  // components menu
2462  ecNewPackage:          SetSingle(VK_UNKNOWN,[]);
2463  ecOpenPackage:         SetSingle(VK_UNKNOWN,[]);
2464  ecOpenPackageFile:     SetSingle(VK_UNKNOWN,[]);
2465  ecOpenPackageOfCurUnit:SetSingle(VK_UNKNOWN,[]);
2466  ecAddCurFileToPkg:     SetSingle(VK_UNKNOWN,[]);
2467  ecNewPkgComponent:     SetSingle(VK_UNKNOWN,[]);
2468  ecPackageGraph:        SetSingle(VK_UNKNOWN,[]);
2469  ecPackageLinks:        SetSingle(VK_UNKNOWN,[]);
2470  ecEditInstallPkgs:     SetSingle(VK_UNKNOWN,[]);
2471  ecConfigCustomComps:   SetSingle(VK_UNKNOWN,[]);
2472
2473  // tools menu
2474  ecEnvironmentOptions:  SetSingle(VK_LCL_COMMA,[ssMeta]); // Cmd-semicolon
2475  ecRescanFPCSrcDir:     SetSingle(VK_UNKNOWN,[]);
2476  ecEditCodeTemplates:   SetSingle(VK_UNKNOWN,[]);
2477  ecCodeToolsDefinesEd:  SetSingle(VK_UNKNOWN,[]);
2478
2479  ecExtToolSettings:     SetSingle(VK_UNKNOWN,[]);
2480  ecManageExamples:      SetSingle(VK_UNKNOWN,[]);
2481  ecBuildLazarus:        SetSingle(VK_UNKNOWN,[]);
2482  ecConfigBuildLazarus:  SetSingle(VK_UNKNOWN,[]);
2483  ecMakeResourceString:  SetSingle(VK_UNKNOWN,[]);
2484  ecDiff:                SetSingle(VK_UNKNOWN,[]);
2485
2486  // window menu
2487  ecManageSourceEditors:       SetSingle(VK_W,[ssShift,ssCtrl]);
2488
2489  // help menu
2490  ecAboutLazarus:        SetSingle(VK_UNKNOWN,[]);
2491  ecOnlineHelp:          SetSingle(VK_UNKNOWN,[]);
2492  ecContextHelp:         SetSingle(VK_F1,[],VK_HELP,[]);
2493  ecEditContextHelp:     SetSingle(VK_F1,[ssShift,ssCtrl], VK_HELP,[ssCtrl]);
2494  ecReportingBug:        SetSingle(VK_UNKNOWN,[]);
2495  ecFocusHint:           SetSingle(VK_UNKNOWN,[]);
2496  ecSmartHint:           SetSingle(VK_UNKNOWN,[]);
2497
2498  // designer
2499  ecDesignerCopy:        SetSingle(VK_C,[ssMeta]);
2500  ecDesignerCut:         SetSingle(VK_X,[ssMeta]);
2501  ecDesignerPaste:       SetSingle(VK_V,[ssMeta]);
2502  ecDesignerSelectParent:SetSingle(VK_ESCAPE,[]);
2503  ecDesignerMoveToFront: SetSingle(VK_PRIOR,[ssShift]);
2504  ecDesignerMoveToBack:  SetSingle(VK_NEXT,[ssShift]);
2505  ecDesignerForwardOne:  SetSingle(VK_PRIOR,[ssMeta]);
2506  ecDesignerBackOne:     SetSingle(VK_NEXT,[ssMeta]);
2507  ecDesignerToggleNonVisComps: SetSingle(VK_UNKNOWN,[]);
2508
2509  // macro
2510  ecSynMacroRecord:      SetSingle(VK_R,[ssShift, ssCtrl]);
2511  ecSynMacroPlay:        SetSingle(VK_P,[ssShift, ssCtrl]);
2512
2513  // Edit template
2514  ecIdePTmplEdNextCell:         SetSingle(VK_RIGHT,[ssCtrl]);
2515  ecIdePTmplEdNextCellSel:      SetSingle(VK_TAB,[]);
2516  ecIdePTmplEdNextCellRotate:   SetSingle(VK_UNKNOWN,[]);
2517  ecIdePTmplEdNextCellSelRotate:SetSingle(VK_UNKNOWN,[]);
2518  ecIdePTmplEdPrevCell:         SetSingle(VK_LEFT,[ssCtrl]);
2519  ecIdePTmplEdPrevCellSel:      SetSingle(VK_TAB,[ssShift]);
2520  ecIdePTmplEdCellHome:         SetSingle(VK_HOME,[]);
2521  ecIdePTmplEdCellEnd:          SetSingle(VK_END,[]);
2522  ecIdePTmplEdCellSelect:       SetSingle(VK_A,[ssCtrl]);
2523  ecIdePTmplEdFinish:           SetSingle(VK_RETURN,[]);
2524  ecIdePTmplEdEscape:           SetSingle(VK_ESCAPE,[]);
2525  // Edit template
2526  ecIdePTmplEdOutNextCell:         SetSingle(VK_RIGHT,[ssCtrl]);
2527  ecIdePTmplEdOutNextCellSel:      SetSingle(VK_TAB,[]);
2528  ecIdePTmplEdOutNextCellRotate:   SetSingle(VK_UNKNOWN,[]);
2529  ecIdePTmplEdOutNextCellSelRotate:SetSingle(VK_UNKNOWN,[]);
2530  ecIdePTmplEdOutPrevCell:         SetSingle(VK_LEFT,[ssCtrl]);
2531  ecIdePTmplEdOutPrevCellSel:      SetSingle(VK_TAB,[ssShift]);
2532  ecIdePTmplEdOutCellHome:         SetSingle(VK_UNKNOWN,[]);
2533  ecIdePTmplEdOutCellEnd:          SetSingle(VK_UNKNOWN,[]);
2534  ecIdePTmplEdOutCellSelect:       SetSingle(VK_UNKNOWN,[]);
2535  ecIdePTmplEdOutFinish:           SetSingle(VK_RETURN,[]);
2536  ecIdePTmplEdOutEscape:           SetSingle(VK_ESCAPE,[]);
2537  // SyncroEdit
2538  ecIdePSyncroEdNextCell:       SetSingle(VK_RIGHT,[ssCtrl]);
2539  ecIdePSyncroEdNextCellSel:    SetSingle(VK_TAB,[]);
2540  ecIdePSyncroEdPrevCell:       SetSingle(VK_LEFT,[ssCtrl]);
2541  ecIdePSyncroEdPrevCellSel:    SetSingle(VK_TAB,[ssShift]);
2542  ecIdePSyncroEdCellHome:       SetSingle(VK_HOME,[]);
2543  ecIdePSyncroEdCellEnd:        SetSingle(VK_END,[]);
2544  ecIdePSyncroEdCellSelect:     SetSingle(VK_A,[ssCtrl]);
2545  ecIdePSyncroEdEscape:         SetSingle(VK_ESCAPE,[]);
2546  // SyncroEdit
2547  ecIdePSyncroEdOutNextCell:       SetSingle(VK_RIGHT,[ssCtrl]);
2548  ecIdePSyncroEdOutNextCellSel:    SetSingle(VK_TAB,[]);
2549  ecIdePSyncroEdOutPrevCell:       SetSingle(VK_LEFT,[ssCtrl]);
2550  ecIdePSyncroEdOutPrevCellSel:    SetSingle(VK_TAB,[ssShift]);
2551  ecIdePSyncroEdOutCellHome:       SetSingle(VK_UNKNOWN,[]);
2552  ecIdePSyncroEdOutCellEnd:        SetSingle(VK_UNKNOWN,[]);
2553  ecIdePSyncroEdOutCellSelect:     SetSingle(VK_UNKNOWN,[]);
2554  ecIdePSyncroEdOutEscape:         SetSingle(VK_ESCAPE,[]);
2555  // SyncroEdit, during selection
2556  ecIdePSyncroEdSelStart:          SetSingle(VK_J,[ssCtrl]);
2557
2558  else
2559    begin
2560      SetSingle(VK_UNKNOWN,[]);
2561    end;
2562  end;
2563end;
2564
2565procedure TKeyCommandRelation.GetDefaultKeyForMacOSXLazScheme;
2566begin
2567  { First default to standard Mac OS X scheme }
2568  GetDefaultKeyForMacOSXScheme;
2569
2570  { Now override some entries }
2571  case Command of
2572  // moving
2573  ecLeft:                SetSingle(VK_LEFT,[]);
2574  ecRight:               SetSingle(VK_RIGHT,[]);
2575  ecUp:                  SetSingle(VK_UP,[]);
2576  ecDown:                SetSingle(VK_DOWN,[]);
2577  ecLineStart:           SetSingle(VK_HOME,[],        VK_LEFT,[ssMeta]);
2578  ecLineEnd:             SetSingle(VK_END,[],         VK_RIGHT,[ssMeta]);
2579  ecEditorTop:           SetSingle(VK_UP,[ssMeta]);
2580  ecEditorBottom:        SetSingle(VK_DOWN,[ssMeta]);
2581
2582  // selection
2583  ecSelLeft:             SetSingle(VK_LEFT,[ssShift]);
2584  ecSelRight:            SetSingle(VK_RIGHT,[ssShift]);
2585  ecSelUp:               SetSingle(VK_UP,[ssShift]);
2586  ecSelDown:             SetSingle(VK_DOWN,[ssShift]);
2587  ecSelLineStart:        SetSingle(VK_HOME,[ssShift], VK_LEFT,[ssMeta,ssShift]);
2588  ecSelLineEnd:          SetSingle(VK_END,[ssShift],  VK_RIGHT,[ssMeta,ssShift]);
2589  ecSelEditorTop:        SetSingle(VK_HOME,[ssShift,ssCtrl]);
2590  ecSelEditorBottom:     SetSingle(VK_END,[ssShift,ssCtrl]);
2591
2592  // codetools
2593  ecRenameIdentifier:    SetSingle(VK_E,[ssShift,ssCtrl]);
2594
2595  // run menu
2596  ecCompile:             SetSingle(VK_F9,[ssCtrl],    VK_F9,[ssCtrl,ssMeta]);
2597  ecBuild:               SetSingle(VK_F9,[ssShift]);
2598  ecQuickCompile:        SetSingle(VK_UNKNOWN,[]);
2599  ecCleanUpAndBuild:     SetSingle(VK_UNKNOWN,[]);
2600  ecBuildManyModes:      SetSingle(VK_UNKNOWN,[]);
2601  ecAbortBuild:          SetSingle(VK_UNKNOWN,[]);
2602  ecRun:                 SetSingle(VK_F9,[],          VK_F9,[ssMeta]);
2603  ecPause:               SetSingle(VK_UNKNOWN,[]);
2604  ecShowExecutionPoint:  SetSingle(VK_UNKNOWN,[]);
2605  ecStepInto:            SetSingle(VK_F7,[],          VK_F7,[ssMeta]);
2606  ecStepOver:            SetSingle(VK_F8,[],          VK_F8,[ssMeta]);
2607  ecStepOut:             SetSingle(VK_F8,[ssShift],   VK_F8,[ssShift,ssMeta]);
2608  ecStepToCursor:         SetSingle(VK_F4,[],          VK_F4,[ssMeta]);
2609  ecStopProgram:         SetSingle(VK_F2,[ssCtrl],    VK_F2,[ssCtrl,ssMeta]);
2610  ecRemoveBreakPoint:    SetSingle(VK_UNKNOWN,[]);
2611  ecRunParameters:       SetSingle(VK_UNKNOWN,[]);
2612  ecBuildFile:           SetSingle(VK_UNKNOWN,[]);
2613  ecRunFile:             SetSingle(VK_UNKNOWN,[]);
2614  ecConfigBuildFile:     SetSingle(VK_UNKNOWN,[]);
2615  ecInspect:             SetSingle(VK_F5,[ssAlt]);
2616  ecEvaluate:            SetSingle(VK_F7,[ssCtrl],  VK_F7,[ssCtrl,ssMeta]);
2617  ecAddWatch:            SetSingle(VK_F5,[ssCtrl],  VK_F5,[ssCtrl,ssMeta]);
2618  ecAddBpSource:         SetSingle(VK_UNKNOWN,[]);
2619  ecAddBpAddress:        SetSingle(VK_UNKNOWN,[]);
2620  ecAddBpDataWatch:      SetSingle(VK_F5,[ssShift]);
2621  end;
2622end;
2623
2624procedure TKeyCommandRelation.Init;
2625begin
2626  inherited;
2627  FSkipSaving := False;
2628end;
2629
2630{ TKeyCommandRelationList }
2631
2632constructor TKeyCommandRelationList.Create;
2633begin
2634  inherited Create;
2635  FRelations:=TFPList.Create;
2636  fCategories:=TFPList.Create;
2637  fExtToolCount:=0;
2638  fLoadedKeyCommands:=TAvlTree.Create(@CompareLoadedKeyCommands);
2639  fCmdRelCache:=TAvlTree.Create(@CompareCmdRels);
2640end;
2641
2642destructor TKeyCommandRelationList.Destroy;
2643begin
2644  Clear;
2645  FRelations.Free;
2646  fCategories.Free;
2647  fCmdRelCache.Free;
2648  fLoadedKeyCommands.Free;
2649  inherited Destroy;
2650end;
2651
2652procedure TKeyCommandRelationList.DefineCommandCategories;
2653// Define a category for each command
2654
2655  function n(const s: string): string;
2656  begin
2657    Result:=StringReplace(s,'&','',[]);
2658  end;
2659
2660var
2661  C: TIDECommandCategory;
2662begin
2663  Clear;
2664  // moving
2665  C:=Categories[AddCategory('CursorMoving',srkmCatCursorMoving,IDECmdScopeSrcEditOnly)];
2666  AddDefault(C, 'Move cursor left', srkmecLeft, ecLeft);
2667  AddDefault(C, 'Move cursor right', srkmecRight, ecRight);
2668  AddDefault(C, 'Move cursor up', srkmecUp, ecUp);
2669  AddDefault(C, 'Move cursor down', srkmecDown, ecDown);
2670  AddDefault(C, 'Move cursor word left', srkmecWordLeft, ecWordLeft);
2671  AddDefault(C, 'Move cursor word right', srkmecWordRight, ecWordRight);
2672  AddDefault(C, 'Move cursor word end left', srkmecWordEndLeft, ecWordEndLeft);
2673  AddDefault(C, 'Move cursor word end right', srkmecWordEndRight, ecWordEndRight);
2674  AddDefault(C, 'Move cursor half word left', srkmecHalfWordLeft, ecHalfWordLeft);
2675  AddDefault(C, 'Move cursor half word right', srkmecHalfWordRight, ecHalfWordRight);
2676  AddDefault(C, 'Smart move cursor word left', srkmecSmartWordLeft, ecSmartWordLeft);
2677  AddDefault(C, 'Smart move cursor word right', srkmecSmartWordRight, ecSmartWordRight);
2678  AddDefault(C, 'Move cursor to line start', srkmecLineStart, ecLineStart);
2679  AddDefault(C, 'Move cursor to text start in line', srkmecLineTextStart, ecLineTextStart);
2680  AddDefault(C, 'Move cursor to line end', srkmecLineEnd, ecLineEnd);
2681  AddDefault(C, 'Move cursor up one page', srkmecPageUp, ecPageUp);
2682  AddDefault(C, 'Move cursor down one page', srkmecPageDown, ecPageDown);
2683  AddDefault(C, 'Move cursor left one page', srkmecPageLeft, ecPageLeft);
2684  AddDefault(C, 'Move cursor right one page', srkmecPageRight, ecPageRight);
2685  AddDefault(C, 'Move cursor to top of page', srkmecPageTop, ecPageTop);
2686  AddDefault(C, 'Move cursor to bottom of page', srkmecPageBottom, ecPageBottom);
2687  AddDefault(C, 'Move cursor to absolute beginning', srkmecEditorTop, ecEditorTop);
2688  AddDefault(C, 'Move cursor to absolute end', srkmecEditorBottom, ecEditorBottom);
2689  AddDefault(C, 'Scroll up one line', srkmecScrollUp, ecScrollUp);
2690  AddDefault(C, 'Scroll down one line', srkmecScrollDown, ecScrollDown);
2691  AddDefault(C, 'Scroll left one char', srkmecScrollLeft, ecScrollLeft);
2692  AddDefault(C, 'Scroll right one char', srkmecScrollRight, ecScrollRight);
2693
2694  // selection
2695  C:=Categories[AddCategory('Selection',srkmCatSelection, IDECmdScopeSrcEditOnly)];
2696  AddDefault(C, 'Select cursor left', srkmecSelLeft, ecSelLeft);
2697  AddDefault(C, 'Select cursor right', srkmecSelRight, ecSelRight);
2698  AddDefault(C, 'Select cursor up', srkmecSelUp, ecSelUp);
2699  AddDefault(C, 'Select cursor down', srkmecSelDown, ecSelDown);
2700
2701  AddDefault(C, 'Copy selection to clipboard', srkmecCopy, ecCopy);
2702  AddDefault(C, 'Cut selection to clipboard', srkmecCut, ecCut);
2703  AddDefault(C, 'Paste clipboard to current position', srkmecPaste, ecPaste);
2704  AddDefault(C, 'Paste clipboard (as columns) to current position', srkmecPasteAsColumns, ecPasteAsColumns);
2705  AddDefault(C, 'Copy - Add to Clipboard', srkmecCopyAdd, ecCopyAdd);
2706  AddDefault(C, 'Cut - Add to Clipboard', srkmecCutAdd, ecCutAdd);
2707  AddDefault(C, 'Copy current line', srkmecCopyCurrentLine, ecCopyCurrentLine);
2708  AddDefault(C, 'Copy current line - Add to Clipboard', srkmecCopyAddCurrentLine, ecCopyAddCurrentLine);
2709  AddDefault(C, 'Cut current line', srkmecCutCurrentLine, ecCutCurrentLine);
2710  AddDefault(C, 'Cut current line - Add to Clipboard', srkmecCutAddCurrentLine, ecCutAddCurrentLine);
2711  AddDefault(C, 'Multi paste clipboard to current position', srkmecMultiPaste, ecMultiPaste);
2712  AddDefault(C, 'Normal selection mode', srkmecNormalSelect, ecNormalSelect);
2713  AddDefault(C, 'Column selection mode', srkmecColumnSelect, ecColumnSelect);
2714  AddDefault(C, 'Line selection mode', srkmecLineSelect, ecLineSelect);
2715  AddDefault(C, 'Indent block', srkmecBlockIndent, ecBlockIndent);
2716  AddDefault(C, 'Unindent block', srkmecBlockUnindent, ecBlockUnindent);
2717  AddDefault(C, 'Uppercase selection', lisMenuUpperCaseSelection, ecSelectionUpperCase);
2718  AddDefault(C, 'Lowercase selection', lisMenuLowerCaseSelection, ecSelectionLowerCase);
2719  AddDefault(C, 'Swap case in selection', lisMenuSwapCaseSelection, ecSelectionSwapCase);
2720  AddDefault(C, 'Convert tabs to spaces in selection',
2721    srkmecSelectionTabs2Spaces, ecSelectionTabs2Spaces);
2722  AddDefault(C, 'Enclose selection', lisKMEncloseSelection, ecSelectionEnclose);
2723  AddDefault(C, 'Comment selection', lisMenuCommentSelection, ecSelectionComment);
2724  AddDefault(C, 'Uncomment selection', lisMenuUncommentSelection, ecSelectionUncomment);
2725  AddDefault(C, 'Toggle comment', lisMenuToggleComment, ecToggleComment);
2726  AddDefault(C, 'Sort selection', lisSortSelSortSelection, ecSelectionSort);
2727  AddDefault(C, 'Break Lines in selection', lisMenuBeakLinesInSelection, ecSelectionBreakLines);
2728  AddDefault(C, 'Select word left', lisKMSelectWordLeft, ecSelWordLeft);
2729  AddDefault(C, 'Select word right', lisKMSelectWordRight, ecSelWordRight);
2730  AddDefault(C, 'Select word end left', srkmecSelWordEndLeft, ecSelWordEndLeft);
2731  AddDefault(C, 'Select word end right', srkmecSelWordEndRight, ecSelWordEndRight);
2732  AddDefault(C, 'Select half word left', srkmecSelHalfWordLeft, ecSelHalfWordLeft);
2733  AddDefault(C, 'Select half word right', srkmecSelHalfWordRight, ecSelHalfWordRight);
2734  AddDefault(C, 'Smart select word left', srkmecSelSmartWordLeft, ecSelSmartWordLeft);
2735  AddDefault(C, 'Smart select word right', srkmecSelSmartWordRight, ecSelSmartWordRight);
2736  AddDefault(C, 'Select line start', lisKMSelectLineStart, ecSelLineStart);
2737  AddDefault(C, 'Select to text start in line', srkmecSelLineTextStart, ecSelLineTextStart);
2738  AddDefault(C, 'Select line end', lisKMSelectLineEnd, ecSelLineEnd);
2739  AddDefault(C, 'Select page top', lisKMSelectPageTop, ecSelPageTop);
2740  AddDefault(C, 'Select page bottom', lisKMSelectPageBottom, ecSelPageBottom);
2741  AddDefault(C, 'Select to absolute beginning', srkmecSelEditorTop, ecSelEditorTop);
2742  AddDefault(C, 'Select to absolute end', srkmecSelEditorBottom, ecSelEditorBottom);
2743  AddDefault(C, 'Select all', lisMenuSelectAll, ecSelectAll);
2744  AddDefault(C, 'Select to brace', lisMenuSelectToBrace, ecSelectToBrace);
2745  AddDefault(C, 'Select code block', lisMenuSelectCodeBlock, ecSelectCodeBlock);
2746  AddDefault(C, 'Select word', lisMenuSelectWord, ecSelectWord);
2747  AddDefault(C, 'Select line', lisMenuSelectLine, ecSelectLine);
2748  AddDefault(C, 'Select paragraph', lisMenuSelectParagraph, ecSelectParagraph);
2749  AddDefault(C, 'Toggle Current-Word highlight', srkmecToggleMarkupWord, EcToggleMarkupWord);
2750  AddDefault(C, 'Start sticky selecting', srkmecSelSticky, ecStickySelection);
2751  AddDefault(C, 'Start sticky selecting (Columns)', srkmecSelStickyCol, ecStickySelectionCol);
2752  AddDefault(C, 'Start sticky selecting (Line)', srkmecSelStickyLine, ecStickySelectionLine);
2753  AddDefault(C, 'Stop sticky selecting', srkmecSelStickyStop, ecStickySelectionStop);
2754
2755  // Persistent Block
2756  AddDefault(C, 'Set Block begin', srkmecBlockSetBegin, ecBlockSetBegin);
2757  AddDefault(C, 'Set Block End', srkmecBlockSetEnd, ecBlockSetEnd);
2758  AddDefault(C, 'Toggle Block', srkmecBlockToggleHide, ecBlockToggleHide);
2759  AddDefault(C, 'Hide Block', srkmecBlockHide, ecBlockHide);
2760  AddDefault(C, 'Show Block', srkmecBlockShow, ecBlockShow);
2761  AddDefault(C, 'Move Block', srkmecBlockMove, ecBlockMove);
2762  AddDefault(C, 'Copy Block', srkmecBlockCopy, ecBlockCopy);
2763  AddDefault(C, 'Delete Block', srkmecBlockDelete, ecBlockDelete);
2764  AddDefault(C, 'Goto Block Begin', srkmecBlockGotoBegin, ecBlockGotoBegin);
2765  AddDefault(C, 'Goto Block End', srkmecBlockGotoEnd, ecBlockGotoEnd);
2766
2767  // column mode selection
2768  C:=Categories[AddCategory('Column Selection',srkmCatColSelection,IDECmdScopeSrcEditOnly)];
2769  AddDefault(C, 'Column Select Up', srkmecColSelUp, ecColSelUp);
2770  AddDefault(C, 'Column Select Down', srkmecColSelDown, ecColSelDown);
2771  AddDefault(C, 'Column Select Left', srkmecColSelLeft, ecColSelLeft);
2772  AddDefault(C, 'Column Select Right', srkmecColSelRight, ecColSelRight);
2773  AddDefault(C, 'Column Select word left', srkmecColSelWordLeft, ecColSelWordLeft);
2774  AddDefault(C, 'Column Select word right', srkmecColSelWordRight, ecColSelWordRight);
2775  AddDefault(C, 'Column Select Page Down', srkmecColSelPageDown, ecColSelPageDown);
2776  AddDefault(C, 'Column Select Page Bottom', srkmecColSelPageBottom, ecColSelPageBottom);
2777  AddDefault(C, 'Column Select Page Up', srkmecColSelPageUp, ecColSelPageUp);
2778  AddDefault(C, 'Column Select Page Top', srkmecColSelPageTop, ecColSelPageTop);
2779  AddDefault(C, 'Column Select Line Start', srkmecColSelLineStart, ecColSelLineStart);
2780  AddDefault(C, 'Column Select to text start in line', srkmecColSelLineTextStart, ecColSelLineTextStart);
2781  AddDefault(C, 'Column Select Line End', srkmecColSelLineEnd, ecColSelLineEnd);
2782  AddDefault(C, 'Column Select to absolute beginning', srkmecColSelEditorTop, ecColSelEditorTop);
2783  AddDefault(C, 'Column Select to absolute end', srkmecColSelEditorBottom, ecColSelEditorBottom);
2784
2785  // multi caret
2786  C:=Categories[AddCategory('MultiCaret', srkmCatMultiCaret, IDECmdScopeSrcEditOnly)];
2787  AddDefault(C, 'Add extra caret', srkmecPluginMultiCaretSetCaret, ecPluginMultiCaretSetCaret);
2788  AddDefault(C, 'Remove extra caret', srkmecPluginMultiCaretUnsetCaret, ecPluginMultiCaretUnsetCaret);
2789  AddDefault(C, 'Toggle extra caret', srkmecPluginMultiCaretToggleCaret, ecPluginMultiCaretToggleCaret);
2790  AddDefault(C, 'Cursor keys clear all extra carets', srkmecPluginMultiCaretModeCancelOnMove, ecPluginMultiCaretModeCancelOnMove);
2791  AddDefault(C, 'Cursor keys move all extra carets', srkmecPluginMultiCaretModeMoveAll, ecPluginMultiCaretModeMoveAll);
2792  C:=Categories[AddCategory('MultiCaret', srkmCatMultiCaret, IDECmdScopeSrcEditOnlyMultiCaret)];
2793  AddDefault(C, 'Clear all extra carets', srkmecPluginMultiCaretClearAll, ecPluginMultiCaretClearAll);
2794
2795  // editing - without menu items in the IDE bar
2796  C:=Categories[AddCategory(CommandCategoryTextEditingName,srkmCatEditing,
2797                IDECmdScopeSrcEditOnly)];
2798  AddDefault(C, 'Delete last char', lisKMDeleteLastChar, ecDeleteLastChar);
2799  AddDefault(C, 'Delete char at cursor', srkmecDeletechar, ecDeleteChar);
2800  AddDefault(C, 'Delete to end of word', srkmecDeleteWord, ecDeleteWord);
2801  AddDefault(C, 'Delete to start of word', srkmecDeleteLastWord, ecDeleteLastWord);
2802  AddDefault(C, 'Delete to beginning of line', srkmecDeleteBOL, ecDeleteBOL);
2803  AddDefault(C, 'Delete to end of line', srkmecDeleteEOL, ecDeleteEOL);
2804  AddDefault(C, 'Delete current line', srkmecDeleteLine, ecDeleteLine);
2805  AddDefault(C, 'Delete whole text', srkmecClearAll, ecClearAll);
2806  AddDefault(C, 'Break line and move cursor', srkmecLineBreak, ecLineBreak);
2807  AddDefault(C, 'Break line, leave cursor', srkmecInsertLine, ecInsertLine);
2808  AddDefault(C, 'Move one line up', srkmecMoveLineUp, ecMoveLineUp);
2809  AddDefault(C, 'Move one line down', srkmecMoveLineDown, ecMoveLineDown);
2810  AddDefault(C, 'Move selection up', srkmecMoveSelectUp, ecMoveSelectUp);
2811  AddDefault(C, 'Move selection down', srkmecMoveSelectDown, ecMoveSelectDown);
2812  AddDefault(C, 'Move selection left', srkmecMoveSelectLeft, ecMoveSelectLeft);
2813  AddDefault(C, 'Move selection right', srkmecMoveSelectRight, ecMoveSelectRight);
2814  AddDefault(C, 'Duplicate line or lines in selection', srkmecDuplicateLine, ecDuplicateLine);
2815  AddDefault(C, 'Duplicate selection', srkmecDuplicateSelection, ecDuplicateSelection);
2816  AddDefault(C, 'Enclose in $IFDEF', lisEncloseInIFDEF, ecSelectionEncloseIFDEF);
2817  AddDefault(C, 'Insert from Character Map', lisMenuInsertCharacter, ecInsertCharacter);
2818  AddDefault(C, 'Insert GPL notice', srkmecInsertGPLNotice, ecInsertGPLNotice);
2819  AddDefault(C, 'Insert GPL notice translated', srkmecInsertGPLNoticeTranslated, ecInsertGPLNoticeTranslated);
2820  AddDefault(C, 'Insert LGPL notice', srkmecInsertLGPLNotice, ecInsertLGPLNotice);
2821  AddDefault(C, 'Insert LGPL notice translated', srkmecInsertLGPLNoticeTranlated, ecInsertLGPLNoticeTranslated);
2822  AddDefault(C, 'Insert modified LGPL notice', srkmecInsertModifiedLGPLNotice, ecInsertModifiedLGPLNotice);
2823  AddDefault(C, 'Insert modified LGPL notice translated', srkmecInsertModifiedLGPLNoticeTranslated, ecInsertModifiedLGPLNoticeTranslated);
2824  AddDefault(C, 'Insert MIT notice', srkmecInsertMITNotice, ecInsertMITNotice);
2825  AddDefault(C, 'Insert MIT notice translated', srkmecInsertMITNoticeTranslated, ecInsertMITNoticeTranslated);
2826  AddDefault(C, 'Insert username', lisKMInsertUsername, ecInsertUserName);
2827  AddDefault(C, 'Insert date and time', lisKMInsertDateAndTime, ecInsertDateTime);
2828  AddDefault(C, 'Insert ChangeLog entry', srkmecInsertChangeLogEntry, ecInsertChangeLogEntry);
2829  AddDefault(C, 'Insert CVS keyword Author', srkmecInsertCVSAuthor, ecInsertCVSAuthor);
2830  AddDefault(C, 'Insert CVS keyword Date', srkmecInsertCVSDate, ecInsertCVSDate);
2831  AddDefault(C, 'Insert CVS keyword Header', srkmecInsertCVSHeader, ecInsertCVSHeader);
2832  AddDefault(C, 'Insert CVS keyword ID', srkmecInsertCVSID, ecInsertCVSID);
2833  AddDefault(C, 'Insert CVS keyword Log', srkmecInsertCVSLog, ecInsertCVSLog);
2834  AddDefault(C, 'Insert CVS keyword Name', srkmecInsertCVSName, ecInsertCVSName);
2835  AddDefault(C, 'Insert CVS keyword Revision', srkmecInsertCVSRevision, ecInsertCVSRevision);
2836  AddDefault(C, 'Insert CVS keyword Source', srkmecInsertCVSSource, ecInsertCVSSource);
2837  AddDefault(C, 'Insert a GUID',srkmecInsertGUID, ecInsertGUID);
2838  AddDefault(C, 'Insert full Filename',srkmecInsertFilename, ecInsertFilename);
2839
2840  // command commands
2841  C:=Categories[AddCategory('CommandCommands',srkmCatCmdCmd,nil)];
2842  AddDefault(C, 'Undo', lisUndo, ecUndo);
2843  AddDefault(C, 'Redo', lisRedo, ecRedo);
2844
2845  // search & replace
2846  C:=Categories[AddCategory('SearchReplace',srkmCatSearchReplace,IDECmdScopeSrcEditOnly)];
2847  AddDefault(C, 'Go to matching bracket', srkmecMatchBracket, ecMatchBracket);
2848  AddDefault(C, 'Find text', srkmecFind, ecFind);
2849  AddDefault(C, 'Find next', srkmecFindNext, ecFindNext);
2850  AddDefault(C, 'Find previous', srkmecFindPrevious, ecFindPrevious);
2851  AddDefault(C, 'Find in files', srkmecFindInFiles, ecFindInFiles);
2852  AddDefault(C, 'Replace text', srkmecReplace, ecReplace);
2853  AddDefault(C, 'Find incremental', lisKMFindIncremental, ecIncrementalFind);
2854  AddDefault(C, 'Go to line number', srkmecGotoLineNumber, ecGotoLineNumber);
2855  AddDefault(C, 'Find next word occurrence', srkmecFindNextWordOccurrence, ecFindNextWordOccurrence);
2856  AddDefault(C, 'Find previous word occurrence', srkmecFindPrevWordOccurrence, ecFindPrevWordOccurrence);
2857  AddDefault(C, 'Jump back', lisMenuJumpBack, ecJumpBack);
2858  AddDefault(C, 'Jump forward', lisMenuJumpForward, ecJumpForward);
2859  AddDefault(C, 'Add jump point', srkmecAddJumpPoint, ecAddJumpPoint);
2860  AddDefault(C, 'View jump history', lisKMViewJumpHistory, ecViewJumpHistory);
2861  AddDefault(C, 'Jump to next error', lisMenuJumpToNextError, ecJumpToNextError);
2862  AddDefault(C, 'Jump to previous error', lisMenuJumpToPrevError, ecJumpToPrevError);
2863  AddDefault(C, 'Open file at cursor', srkmecOpenFileAtCursor, ecOpenFileAtCursor);
2864  AddDefault(C,'Procedure List ...',lisPListProcedureList,ecProcedureList);
2865
2866  // folding
2867  C:=Categories[AddCategory('Folding',srkmCatFold,IDECmdScopeSrcEditOnly)];
2868  AddDefault(C, 'Fold to Level 1',  Format(srkmEcFoldLevel,[1]), EcFoldLevel1);
2869  AddDefault(C, 'Fold to Level 2',  Format(srkmEcFoldLevel,[2]), EcFoldLevel2);
2870  AddDefault(C, 'Fold to Level 3',  Format(srkmEcFoldLevel,[3]), EcFoldLevel3);
2871  AddDefault(C, 'Fold to Level 4',  Format(srkmEcFoldLevel,[4]), EcFoldLevel4);
2872  AddDefault(C, 'Fold to Level 5',  Format(srkmEcFoldLevel,[5]), EcFoldLevel5);
2873  AddDefault(C, 'Fold to Level 6',  Format(srkmEcFoldLevel,[6]), EcFoldLevel6);
2874  AddDefault(C, 'Fold to Level 7',  Format(srkmEcFoldLevel,[7]), EcFoldLevel7);
2875  AddDefault(C, 'Fold to Level 8',  Format(srkmEcFoldLevel,[8]), EcFoldLevel8);
2876  AddDefault(C, 'Fold to Level 9',  Format(srkmEcFoldLevel,[9]), EcFoldLevel9);
2877  AddDefault(C, 'Unfold all', srkmecUnFoldAll, EcFoldLevel0);
2878  AddDefault(C, 'Fold at Cursor', srkmecFoldCurrent, EcFoldCurrent);
2879  AddDefault(C, 'Unfold at Cursor', srkmecUnFoldCurrent, EcUnFoldCurrent);
2880
2881  // marker - without menu items in the IDE bar
2882  C:=Categories[AddCategory('Marker',srkmCatMarker,IDECmdScopeSrcEditOnly)];
2883  AddDefault(C, 'Set free Bookmark', lisKMSetFreeBookmark, ecSetFreeBookmark);
2884  AddDefault(C, 'Clear Bookmarks for current file', srkmecClearBookmarkForFile, ecClearBookmarkForFile);
2885  AddDefault(C, 'Clear all Bookmarks', srkmecClearAllBookmark, ecClearAllBookmark);
2886  AddDefault(C, 'Previous Bookmark', srkmecPrevBookmark, ecPrevBookmark);
2887  AddDefault(C, 'Next Bookmark', srkmecNextBookmark, ecNextBookmark);
2888  AddDefault(C, 'Go to Bookmark...', uemGotoBookmarks, ecGotoBookmarks);
2889  AddDefault(C, 'Go to marker 0', lisKMGoToMarker0, ecGotoMarker0);
2890  AddDefault(C, 'Go to marker 1', lisKMGoToMarker1, ecGotoMarker1);
2891  AddDefault(C, 'Go to marker 2', lisKMGoToMarker2, ecGotoMarker2);
2892  AddDefault(C, 'Go to marker 3', lisKMGoToMarker3, ecGotoMarker3);
2893  AddDefault(C, 'Go to marker 4', lisKMGoToMarker4, ecGotoMarker4);
2894  AddDefault(C, 'Go to marker 5', lisKMGoToMarker5, ecGotoMarker5);
2895  AddDefault(C, 'Go to marker 6', lisKMGoToMarker6, ecGotoMarker6);
2896  AddDefault(C, 'Go to marker 7', lisKMGoToMarker7, ecGotoMarker7);
2897  AddDefault(C, 'Go to marker 8', lisKMGoToMarker8, ecGotoMarker8);
2898  AddDefault(C, 'Go to marker 9', lisKMGoToMarker9, ecGotoMarker9);
2899  AddDefault(C, 'Set marker 0', lisKMSetMarker0, ecSetMarker0);
2900  AddDefault(C, 'Set marker 1', lisKMSetMarker1, ecSetMarker1);
2901  AddDefault(C, 'Set marker 2', lisKMSetMarker2, ecSetMarker2);
2902  AddDefault(C, 'Set marker 3', lisKMSetMarker3, ecSetMarker3);
2903  AddDefault(C, 'Set marker 4', lisKMSetMarker4, ecSetMarker4);
2904  AddDefault(C, 'Set marker 5', lisKMSetMarker5, ecSetMarker5);
2905  AddDefault(C, 'Set marker 6', lisKMSetMarker6, ecSetMarker6);
2906  AddDefault(C, 'Set marker 7', lisKMSetMarker7, ecSetMarker7);
2907  AddDefault(C, 'Set marker 8', lisKMSetMarker8, ecSetMarker8);
2908  AddDefault(C, 'Set marker 9', lisKMSetMarker9, ecSetMarker9);
2909  AddDefault(C, 'Toggle Bookmark...', uemToggleBookmarks, ecToggleBookmarks);
2910  AddDefault(C, 'Toggle marker 0', lisKMToggleMarker0, ecToggleMarker0);
2911  AddDefault(C, 'Toggle marker 1', lisKMToggleMarker1, ecToggleMarker1);
2912  AddDefault(C, 'Toggle marker 2', lisKMToggleMarker2, ecToggleMarker2);
2913  AddDefault(C, 'Toggle marker 3', lisKMToggleMarker3, ecToggleMarker3);
2914  AddDefault(C, 'Toggle marker 4', lisKMToggleMarker4, ecToggleMarker4);
2915  AddDefault(C, 'Toggle marker 5', lisKMToggleMarker5, ecToggleMarker5);
2916  AddDefault(C, 'Toggle marker 6', lisKMToggleMarker6, ecToggleMarker6);
2917  AddDefault(C, 'Toggle marker 7', lisKMToggleMarker7, ecToggleMarker7);
2918  AddDefault(C, 'Toggle marker 8', lisKMToggleMarker8, ecToggleMarker8);
2919  AddDefault(C, 'Toggle marker 9', lisKMToggleMarker9, ecToggleMarker9);
2920
2921  // codetools
2922  C:=Categories[AddCategory(CommandCategoryCodeTools,srkmCatCodeTools,IDECmdScopeSrcEditOnly)];
2923  AddDefault(C, 'Code template completion', srkmecAutoCompletion, ecAutoCompletion);
2924  AddDefault(C, 'Word completion', srkmecWordCompletion, ecWordCompletion);
2925  AddDefault(C, 'Complete code', lisMenuCompleteCode, ecCompleteCode);
2926  AddDefault(C, 'Complete code (with dialog)', lisMenuCompleteCodeInteractive, ecCompleteCodeInteractive);
2927  AddDefault(C, 'Identifier completion', dlgEdIdComlet, ecIdentCompletion);
2928  AddDefault(C, 'Rename identifier', srkmecRenameIdentifier, ecRenameIdentifier);
2929  AddDefault(C, 'Find identifier references', srkmecFindIdentifierRefs, ecFindIdentifierRefs);
2930  AddDefault(C, 'Find references of used unit', lisMenuFindReferencesOfUsedUnit, ecFindUsedUnitRefs);
2931  AddDefault(C, 'Show code context', srkmecShowCodeContext, ecShowCodeContext);
2932  AddDefault(C, 'Extract proc', srkmecExtractProc, ecExtractProc);
2933  AddDefault(C, 'Invert assignment', srkmecInvertAssignment, ecInvertAssignment);
2934  AddDefault(C, 'Syntax check', srkmecSyntaxCheck, ecSyntaxCheck);
2935  AddDefault(C, 'Guess unclosed block', lisMenuGuessUnclosedBlock, ecGuessUnclosedBlock);
2936  AddDefault(C, 'Guess misplaced $IFDEF', srkmecGuessMisplacedIFDEF, ecGuessMisplacedIFDEF);
2937  AddDefault(C, 'Check LFM file in editor', lisMenuCheckLFM, ecCheckLFM);
2938  AddDefault(C, 'Find procedure definiton', srkmecFindProcedureDefinition, ecFindProcedureDefinition);
2939  AddDefault(C, 'Find procedure method', srkmecFindProcedureMethod, ecFindProcedureMethod);
2940  AddDefault(C, 'Find declaration', srkmecFindDeclaration, ecFindDeclaration);
2941  AddDefault(C, 'Find block other end', srkmecFindBlockOtherEnd, ecFindBlockOtherEnd);
2942  AddDefault(C, 'Find block start', srkmecFindBlockStart, ecFindBlockStart);
2943  AddDefault(C, 'Goto include directive', lisMenuGotoIncludeDirective, ecGotoIncludeDirective);
2944  AddDefault(C, 'Jump to Section', lisMenuJumpTo, ecJumpToSection);
2945  AddDefault(C, 'Jump to Interface', lisMenuJumpToInterface, ecJumpToInterface);
2946  AddDefault(C, 'Jump to Interface uses', lisMenuJumpToInterfaceUses, ecJumpToInterfaceUses);
2947  AddDefault(C, 'Jump to Implementation', lisMenuJumpToImplementation, ecJumpToImplementation);
2948  AddDefault(C, 'Jump to Implementation uses', lisMenuJumpToImplementationUses, ecJumpToImplementationUses);
2949  AddDefault(C, 'Jump to Initialization', lisMenuJumpToInitialization, ecJumpToInitialization);
2950  AddDefault(C, 'Jump to Procedure header', lisMenuJumpToProcedureHeader, ecJumpToProcedureHeader);
2951  AddDefault(C, 'Jump to Procedure begin', lisMenuJumpToProcedureBegin, ecJumpToProcedureBegin);
2952  AddDefault(C, 'Show abstract methods', srkmecShowAbstractMethods, ecShowAbstractMethods);
2953  AddDefault(C, 'Remove empty methods', srkmecRemoveEmptyMethods, ecRemoveEmptyMethods);
2954  AddDefault(C, 'Remove unused units', srkmecRemoveUnusedUnits, ecRemoveUnusedUnits);
2955  AddDefault(C, 'Add unit to uses section', lisUseUnit, ecUseUnit);
2956  {$IFDEF EnableFindOverloads}
2957  AddDefault(C, 'Find overloads', srkmecFindOverloads, ecFindOverloads);
2958  {$ENDIF}
2959  AddDefault(C, 'Make resource string', srkmecMakeResourceString, ecMakeResourceString);
2960
2961  // Macro editing
2962  C:=Categories[AddCategory('MacroRecording', srkmCatMacroRecording, IDECmdScopeSrcEditOnly)];
2963  AddDefault(C, 'Record Macro', srkmecSynMacroRecord, ecSynMacroRecord);
2964  AddDefault(C, 'Play Macro', srkmecSynMacroPlay, ecSynMacroPlay);
2965  AddDefault(C, 'View Editor Macros', srkmecViewEditorMacros, ecViewMacroList);
2966
2967  // Template editing
2968  C:=Categories[AddCategory('Edit Template', srkmCatTemplateEdit, IDECmdScopeSrcEditOnlyTmplEdit)];
2969  AddDefault(C, 'Edit Template Next Cell', srkmecSynPTmplEdNextCell, ecIdePTmplEdNextCell);
2970  AddDefault(C, 'Edit Template Next Cell (all selected)', srkmecSynPTmplEdNextCellSel, ecIdePTmplEdNextCellSel);
2971  AddDefault(C, 'Edit Template Next Cell (rotate)', srkmecSynPTmplEdNextCellRotate, ecIdePTmplEdNextCellRotate);
2972  AddDefault(C, 'Edit Template Next Cell (rotate / all selected)', srkmecSynPTmplEdNextCellSelRotate, ecIdePTmplEdNextCellSelRotate);
2973  AddDefault(C, 'Edit Template Previous Cell', srkmecSynPTmplEdPrevCell, ecIdePTmplEdPrevCell);
2974  AddDefault(C, 'Edit Template Previous Cell (all selected)', srkmecSynPTmplEdPrevCellSel, ecIdePTmplEdPrevCellSel);
2975  AddDefault(C, 'Edit Template Next First Cell', srkmecSynPTmplEdNextFirstCell, ecIdePTmplEdNextFirstCell);
2976  AddDefault(C, 'Edit Template Next First Cell (all selected)', srkmecSynPTmplEdNextFirstCellSel, ecIdePTmplEdNextFirstCellSel);
2977  AddDefault(C, 'Edit Template Next First Cell (rotate)', srkmecSynPTmplEdNextFirstCellRotate, ecIdePTmplEdNextFirstCellRotate);
2978  AddDefault(C, 'Edit Template Next First Cell (rotate / all selected)', srkmecSynPTmplEdNextFirstCellSelRotate, ecIdePTmplEdNextFirstCellSelRotate);
2979  AddDefault(C, 'Edit Template Previous First Cell', srkmecSynPTmplEdPrevFirstCell, ecIdePTmplEdPrevFirstCell);
2980  AddDefault(C, 'Edit Template Previous First Cell (all selected)', srkmecSynPTmplEdPrevFirstCellSel, ecIdePTmplEdPrevFirstCellSel);
2981  AddDefault(C, 'Edit Template Goto first pos in cell', srkmecSynPTmplEdCellHome, ecIdePTmplEdCellHome);
2982  AddDefault(C, 'Edit Template Goto last pos in cell', srkmecSynPTmplEdCellEnd, ecIdePTmplEdCellEnd);
2983  AddDefault(C, 'Edit Template Select cell', srkmecSynPTmplEdCellSelect, ecIdePTmplEdCellSelect);
2984  AddDefault(C, 'Edit Template Finish', srkmecSynPTmplEdFinish, ecIdePTmplEdFinish);
2985  AddDefault(C, 'Edit Template Escape', srkmecSynPTmplEdEscape, ecIdePTmplEdEscape);
2986
2987  // Template editing not in cell
2988  C:=Categories[AddCategory('Edit Template Off', srkmCatTemplateEditOff, IDECmdScopeSrcEditOnlyTmplEditOff)];
2989  AddDefault(C, 'Edit Template (off) Next Cell', srkmecSynPTmplEdNextCell, ecIdePTmplEdOutNextCell);
2990  AddDefault(C, 'Edit Template (off) Next Cell (all selected)', srkmecSynPTmplEdNextCellSel, ecIdePTmplEdOutNextCellSel);
2991  AddDefault(C, 'Edit Template (off) Next Cell (rotate)', srkmecSynPTmplEdNextCellRotate, ecIdePTmplEdOutNextCellRotate);
2992  AddDefault(C, 'Edit Template (off) Next Cell (rotate / all selected)', srkmecSynPTmplEdNextCellSelRotate, ecIdePTmplEdOutNextCellSelRotate);
2993  AddDefault(C, 'Edit Template (off) Previous Cell', srkmecSynPTmplEdPrevCell, ecIdePTmplEdOutPrevCell);
2994  AddDefault(C, 'Edit Template (off) Previous Cell (all selected)', srkmecSynPTmplEdPrevCellSel, ecIdePTmplEdOutPrevCellSel);
2995  AddDefault(C, 'Edit Template (off) Next First Cell', srkmecSynPTmplEdNextFirstCell, ecIdePTmplEdOutNextFirstCell);
2996  AddDefault(C, 'Edit Template (off) Next First Cell (all selected)', srkmecSynPTmplEdNextFirstCellSel, ecIdePTmplEdOutNextFirstCellSel);
2997  AddDefault(C, 'Edit Template (off) Next First Cell (rotate)', srkmecSynPTmplEdNextFirstCellRotate, ecIdePTmplEdOutNextFirstCellRotate);
2998  AddDefault(C, 'Edit Template (off) Next First Cell (rotate / all selected)', srkmecSynPTmplEdNextFirstCellSelRotate, ecIdePTmplEdOutNextFirstCellSelRotate);
2999  AddDefault(C, 'Edit Template (off) Previous First Cell', srkmecSynPTmplEdPrevFirstCell, ecIdePTmplEdOutPrevFirstCell);
3000  AddDefault(C, 'Edit Template (off) Previous First Cell (all selected)', srkmecSynPTmplEdPrevFirstCellSel, ecIdePTmplEdOutPrevFirstCellSel);
3001  AddDefault(C, 'Edit Template (off) Goto first pos in cell', srkmecSynPTmplEdCellHome, ecIdePTmplEdOutCellHome);
3002  AddDefault(C, 'Edit Template (off) Goto last pos in cell', srkmecSynPTmplEdCellEnd, ecIdePTmplEdOutCellEnd);
3003  AddDefault(C, 'Edit Template (off) Select cell', srkmecSynPTmplEdCellSelect, ecIdePTmplEdOutCellSelect);
3004  AddDefault(C, 'Edit Template (off) Finish', srkmecSynPTmplEdFinish, ecIdePTmplEdOutFinish);
3005  AddDefault(C, 'Edit Template (off) Escape', srkmecSynPTmplEdEscape, ecIdePTmplEdOutEscape);
3006
3007  // Syncro editing
3008  C:=Categories[AddCategory('Syncro Edit', srkmCatSyncroEdit, IDECmdScopeSrcEditOnlySyncroEdit)];
3009  AddDefault(C, 'Edit Syncro Next Cell', srkmecSynPSyncroEdNextCell, ecIdePSyncroEdNextCell);
3010  AddDefault(C, 'Edit Syncro Next Cell (all selected)', srkmecSynPSyncroEdNextCellSel, ecIdePSyncroEdNextCellSel);
3011  AddDefault(C, 'Edit Syncro Previous Cell', srkmecSynPSyncroEdPrevCell, ecIdePSyncroEdPrevCell);
3012  AddDefault(C, 'Edit Syncro Previous Cell (all selected)', srkmecSynPSyncroEdPrevCellSel, ecIdePSyncroEdPrevCellSel);
3013  AddDefault(C, 'Edit Syncro Next First Cell', srkmecSynPSyncroEdNextFirstCell, ecIdePSyncroEdNextFirstCell);
3014  AddDefault(C, 'Edit Syncro Next First Cell (all selected)', srkmecSynPSyncroEdNextFirstCellSel, ecIdePSyncroEdNextFirstCellSel);
3015  AddDefault(C, 'Edit Syncro First Previous Cell', srkmecSynPSyncroEdPrevFirstCell, ecIdePSyncroEdPrevFirstCell);
3016  AddDefault(C, 'Edit Syncro First Previous Cell (all selected)', srkmecSynPSyncroEdPrevFirstCellSel, ecIdePSyncroEdPrevFirstCellSel);
3017  AddDefault(C, 'Edit Syncro Goto first pos in cell', srkmecSynPSyncroEdCellHome, ecIdePSyncroEdCellHome);
3018  AddDefault(C, 'Edit Syncro Goto last pos in cell', srkmecSynPSyncroEdCellEnd, ecIdePSyncroEdCellEnd);
3019  AddDefault(C, 'Edit Syncro Select cell', srkmecSynPSyncroEdCellSelect, ecIdePSyncroEdCellSelect);
3020  AddDefault(C, 'Edit Syncro Escape', srkmecSynPSyncroEdEscape, ecIdePSyncroEdEscape);
3021
3022  // Syncro editing not in cell
3023  C:=Categories[AddCategory('Syncro Edit Off', srkmCatSyncroEditOff, IDECmdScopeSrcEditOnlySyncroEditOff)];
3024  AddDefault(C, 'Edit Syncro (off) Next Cell', srkmecSynPSyncroEdNextCell, ecIdePSyncroEdOutNextCell);
3025  AddDefault(C, 'Edit Syncro (off) Next Cell (all selected)', srkmecSynPSyncroEdNextCellSel, ecIdePSyncroEdOutNextCellSel);
3026  AddDefault(C, 'Edit Syncro (off) Previous Cell', srkmecSynPSyncroEdPrevCell, ecIdePSyncroEdOutPrevCell);
3027  AddDefault(C, 'Edit Syncro (off) Previous Cell (all selected)', srkmecSynPSyncroEdPrevCellSel, ecIdePSyncroEdOutPrevCellSel);
3028  AddDefault(C, 'Edit Syncro (off) Next First Cell', srkmecSynPSyncroEdNextFirstCell, ecIdePSyncroEdOutNextFirstCell);
3029  AddDefault(C, 'Edit Syncro (off) Next First Cell (all selected)', srkmecSynPSyncroEdNextFirstCellSel, ecIdePSyncroEdOutNextFirstCellSel);
3030  AddDefault(C, 'Edit Syncro (off) Previous First Cell', srkmecSynPSyncroEdPrevFirstCell, ecIdePSyncroEdOutPrevFirstCell);
3031  AddDefault(C, 'Edit Syncro (off) Previous First Cell (all selected)', srkmecSynPSyncroEdPrevFirstCellSel, ecIdePSyncroEdOutPrevFirstCellSel);
3032  AddDefault(C, 'Edit Syncro (off) Goto first pos in cell', srkmecSynPSyncroEdCellHome, ecIdePSyncroEdOutCellHome);
3033  AddDefault(C, 'Edit Syncro (off) Goto last pos in cell', srkmecSynPSyncroEdCellEnd, ecIdePSyncroEdOutCellEnd);
3034  AddDefault(C, 'Edit Syncro (off) Select cell', srkmecSynPSyncroEdCellSelect, ecIdePSyncroEdOutCellSelect);
3035  AddDefault(C, 'Edit Syncro (off) Escape', srkmecSynPSyncroEdEscape, ecIdePSyncroEdOutEscape);
3036
3037  // Syncro editing still selecting
3038  C:=Categories[AddCategory('Syncro Edit Sel', srkmCatSyncroEditSel, IDECmdScopeSrcEditOnlySyncroEditSel)];
3039  AddDefault(C, 'Edit Syncro (sel) Start', srkmecSynPSyncroEdStart, ecIdePSyncroEdSelStart);
3040
3041  // source notebook - without menu items in the IDE bar
3042  C:=Categories[AddCategory('SourceNotebook',srkmCatSrcNoteBook,IDECmdScopeSrcEditOnly)];
3043  AddDefault(C, 'Go to next editor', srkmecNextEditor, ecNextEditor);
3044  AddDefault(C, 'Go to prior editor', srkmecPrevEditor, ecPrevEditor);
3045  AddDefault(C, 'Go to previous editor in history', srkmecPrevEditorInHistory, ecPrevEditorInHistory);
3046  AddDefault(C, 'Go to next editor in history', srkmecNextEditorInHistory, ecNextEditorInHistory);
3047  AddDefault(C, 'Add break point', srkmecToggleBreakPoint, ecToggleBreakPoint);
3048  AddDefault(C, 'Enable/Disable break point', srkmecToggleBreakPointEnabled, ecToggleBreakPointEnabled);
3049  AddDefault(C, 'Remove break point', srkmecRemoveBreakPoint, ecRemoveBreakPoint);
3050  AddDefault(C, 'Move editor left', srkmecMoveEditorLeft, ecMoveEditorLeft);
3051  AddDefault(C, 'Move editor right', srkmecMoveEditorRight, ecMoveEditorRight);
3052  AddDefault(C, 'Move editor leftmost', srkmecMoveEditorLeftmost, ecMoveEditorLeftmost);
3053  AddDefault(C, 'Move editor rightmoust',  srkmecMoveEditorRightmost, ecMoveEditorRightmost);
3054  AddDefault(C, 'Go to source editor 1', lisKMGoToSourceEditor1, ecGotoEditor1);
3055  AddDefault(C, 'Go to source editor 2', lisKMGoToSourceEditor2, ecGotoEditor2);
3056  AddDefault(C, 'Go to source editor 3', lisKMGoToSourceEditor3, ecGotoEditor3);
3057  AddDefault(C, 'Go to source editor 4', lisKMGoToSourceEditor4, ecGotoEditor4);
3058  AddDefault(C, 'Go to source editor 5', lisKMGoToSourceEditor5, ecGotoEditor5);
3059  AddDefault(C, 'Go to source editor 6', lisKMGoToSourceEditor6, ecGotoEditor6);
3060  AddDefault(C, 'Go to source editor 7', lisKMGoToSourceEditor7, ecGotoEditor7);
3061  AddDefault(C, 'Go to source editor 8', lisKMGoToSourceEditor8, ecGotoEditor8);
3062  AddDefault(C, 'Go to source editor 9', lisKMGoToSourceEditor9, ecGotoEditor9);
3063  AddDefault(C, 'Go to source editor 10', lisKMGoToSourceEditor10, ecGotoEditor0);
3064
3065  AddDefault(C, 'Go to next shared editor', srkmecNextSharedEditor, ecNextSharedEditor);
3066  AddDefault(C, 'Go to prior shared editor', srkmecPrevSharedEditor, ecPrevSharedEditor);
3067  AddDefault(C, 'Go to next window', srkmecNextWindow, ecNextWindow);
3068  AddDefault(C, 'Go to prior window', srkmecPrevWindow, ecPrevWindow);
3069  AddDefault(C, 'Move to next window', srkmecMoveEditorNextWindow, ecMoveEditorNextWindow);
3070  AddDefault(C, 'Move to prior window', srkmecMoveEditorPrevWindow, ecMoveEditorPrevWindow);
3071  AddDefault(C, 'Move to new window', srkmecMoveEditorNewWindow, ecMoveEditorNewWindow);
3072  AddDefault(C, 'Copy to next window', srkmecCopyEditorNextWindow, ecCopyEditorNextWindow);
3073  AddDefault(C, 'Copy to prior window', srkmecCopyEditorPrevWindow, ecCopyEditorPrevWindow);
3074  AddDefault(C, 'Copy to new window', srkmecCopyEditorNewWindow, ecCopyEditorNewWindow);
3075
3076  AddDefault(C, 'Lock editor', srkmecLockEditor, ecLockEditor);
3077
3078  AddDefault(C, 'Zoom Reset', dlfMouseSimpleButtonZoomReset, ecZoomNorm);
3079  AddDefault(C, 'Zoom In', srkmecZoomIn, ecZoomIn);
3080  AddDefault(C, 'Zoom Out', srkmecZoomOut, ecZoomOut);
3081
3082  // file menu
3083  C:=Categories[AddCategory('FileMenu',srkmCatFileMenu,nil)];
3084  AddDefault(C, 'New', lisNew, ecNew);
3085  AddDefault(C, 'NewUnit', lisKMNewUnit, ecNewUnit);
3086  AddDefault(C, 'NewForm', lisMenuNewForm, ecNewForm);
3087  AddDefault(C, 'Open', lisOpen, ecOpen);
3088  AddDefault(C, 'OpenUnit', lisOpenUnit, ecOpenUnit);
3089  AddDefault(C, 'OpenRecent', lisKMOpenRecent, ecOpenRecent);
3090  AddDefault(C, 'Revert', lisMenuRevert, ecRevert);
3091  AddDefault(C, 'Save', lisSave, ecSave);
3092  AddDefault(C, 'SaveAs', lisKMSaveAs, ecSaveAs);
3093  AddDefault(C, 'SaveAll', lisKMSaveAll, ecSaveAll);
3094  AddDefault(C, 'Close', lisClose, ecClose);
3095  AddDefault(C, 'CloseAll', lisCloseAll, ecCloseAll);
3096  AddDefault(C, 'CloseAllOther', uemCloseOtherPagesPlain, ecCloseOtherTabs);
3097  AddDefault(C, 'CloseAllRight', uemCloseOtherPagesRightPlain, ecCloseRightTabs);
3098  AddDefault(C, 'Clean Directory', lisClDirCleanDirectory, ecCleanDirectory);
3099  AddDefault(C, 'Restart', lisRestart, ecRestart);
3100  AddDefault(C, 'Quit', lisQuit, ecQuit);
3101
3102  // view menu
3103  C:=Categories[AddCategory(CommandCategoryViewName,srkmCatViewMenu,nil)];
3104  AddDefault(C, 'Toggle view Object Inspector', lisKMToggleViewObjectInspector, ecToggleObjectInsp);
3105  AddDefault(C, 'Toggle view Source Editor', lisKMToggleViewSourceEditor, ecToggleSourceEditor);
3106  AddDefault(C, 'Toggle view Code Explorer', lisKMToggleViewCodeExplorer, ecToggleCodeExpl);
3107  AddDefault(C, 'Toggle view Code Browser', lisKMToggleViewCodeBrowser, ecToggleCodeBrowser);
3108  AddDefault(C, 'Toggle view Documentation Editor', lisKMToggleViewDocumentationEditor, ecToggleFPDocEditor);
3109  AddDefault(C, 'Toggle view Messages', lisKMToggleViewMessages, ecToggleMessages);
3110  AddDefault(C, 'View Components', srkmecViewComponents, ecViewComponents);
3111  AddDefault(C, 'Toggle view Search Results', lisKMToggleViewSearchResults, ecToggleSearchResults);
3112  AddDefault(C, 'Toggle view Watches', lisKMToggleViewWatches, ecToggleWatches);
3113  AddDefault(C, 'Toggle view Breakpoints', lisKMToggleViewBreakpoints, ecToggleBreakPoints);
3114  AddDefault(C, 'Toggle view Local Variables', lisKMToggleViewLocalVariables, ecToggleLocals);
3115  AddDefault(C, 'Toggle view Threads', lisKMToggleViewThreads, ecViewThreads);
3116  if HasConsoleSupport then
3117  AddDefault(C, 'Toggle view Terminal Output', lisKMToggleViewPseudoTerminal, ecViewPseudoTerminal);
3118  AddDefault(C, 'Toggle view Call Stack', lisKMToggleViewCallStack, ecToggleCallStack);
3119  AddDefault(C, 'Toggle view Registers', lisKMToggleViewRegisters, ecToggleRegisters);
3120  AddDefault(C, 'Toggle view Assembler', lisKMToggleViewAssembler, ecToggleAssembler);
3121  AddDefault(C, 'Toggle view Event Log', lisKMToggleViewDebugEvents, ecToggleDebugEvents);
3122  AddDefault(C, 'Toggle view Debugger Output', lisKMToggleViewDebuggerOutput, ecToggleDebuggerOut);
3123  AddDefault(C, 'Toggle view Debug History', lisKMToggleViewHistory, ecViewHistory);
3124  AddDefault(C, 'View Unit Dependencies', lisMenuViewUnitDependencies, ecViewUnitDependencies);
3125  AddDefault(C, 'View Unit Info', lisKMViewUnitInfo, ecViewUnitInfo);
3126  AddDefault(C, 'Toggle between Unit and Form', lisKMToggleBetweenUnitAndForm, ecToggleFormUnit);
3127  AddDefault(C, 'View Anchor Editor', lisMenuViewAnchorEditor, ecViewAnchorEditor);
3128  AddDefault(C, 'View Tab Order', lisMenuViewTabOrder, ecViewTabOrder);
3129  AddDefault(C, 'Toggle view component palette', lisKMToggleViewComponentPalette, ecToggleCompPalette);
3130  AddDefault(C, 'Toggle view IDE speed buttons', lisKMToggleViewIDESpeedButtons, ecToggleIDESpeedBtns);
3131
3132  // project menu
3133  C:=Categories[AddCategory('ProjectMenu',srkmCatProjectMenu,nil)];
3134  AddDefault(C, 'New project', lisKMNewProject, ecNewProject);
3135  AddDefault(C, 'New project from file', lisKMNewProjectFromFile, ecNewProjectFromFile);
3136  AddDefault(C, 'Open project', lisOpenProject2, ecOpenProject);
3137  AddDefault(C, 'Open recent project', lisKMOpenRecentProject, ecOpenRecentProject);
3138  AddDefault(C, 'Close project', lisKMCloseProject, ecCloseProject);
3139  AddDefault(C, 'Save project', lisKMSaveProject, ecSaveProject);
3140  AddDefault(C, 'Save project as', lisKMSaveProjectAs, ecSaveProjectAs);
3141  AddDefault(C, 'Resave forms with i18n', lisMenuResaveFormsWithI18n,
3142    ecProjectResaveFormsWithI18n);
3143  AddDefault(C, 'Publish project', lisKMPublishProject, ecPublishProject);
3144  AddDefault(C, 'Project Inspector', lisMenuProjectInspector, ecProjectInspector);
3145  AddDefault(C, 'Add editor file to Project', lisMenuAddToProject, ecAddCurUnitToProj);
3146  AddDefault(C, 'Remove active unit from project', lisKMRemoveActiveFileFromProject, ecRemoveFromProj);
3147  AddDefault(C, 'View Units', lisHintViewUnits, ecViewProjectUnits);
3148  AddDefault(C, 'View Forms', lisHintViewForms, ecViewProjectForms);
3149  AddDefault(C, 'View project source', lisKMViewProjectSource, ecViewProjectSource);
3150  AddDefault(C, 'View project options', lisKMViewProjectOptions, ecProjectOptions);
3151  AddDefault(C, 'Change build mode', lisChangeBuildMode, ecProjectChangeBuildMode);
3152
3153  // run menu
3154  C:=Categories[AddCategory('RunMenu',srkmCatRunMenu,nil)];
3155  AddDefault(C, 'Compile project/program', lisKMCompileProjectProgram, ecCompile);
3156  AddDefault(C, 'Build project/program', lisKMBuildProjectProgram, ecBuild);
3157  AddDefault(C, 'Quick compile, no linking', lisKMQuickCompileNoLinking, ecQuickCompile);
3158  AddDefault(C, 'Clean up and build', lisKMCleanUpAndBuild, ecCleanUpAndBuild);
3159  AddDefault(C, 'Build many modes', lisKMBuildManyModes, ecBuildManyModes);
3160  AddDefault(C, 'Abort building', lisKMAbortBuilding, ecAbortBuild);
3161  AddDefault(C, 'Run without debugging', lisMenuRunWithoutDebugging, ecRunWithoutDebugging);
3162  AddDefault(C, 'Run program', lisKMRunProgram, ecRun);
3163  AddDefault(C, 'Pause program', lisKMPauseProgram, ecPause);
3164  AddDefault(C, 'Show execution point', n(lisMenuShowExecutionPoint), ecShowExecutionPoint);
3165  AddDefault(C, 'Step into', n(lisMenuStepInto), ecStepInto);
3166  AddDefault(C, 'Step over', n(lisMenuStepOver), ecStepOver);
3167  AddDefault(C, 'Step into instr', lisMenuStepIntoInstr, ecStepIntoInstr);
3168  AddDefault(C, 'Step over instr', lisMenuStepOverInstr, ecStepOverInstr);
3169  AddDefault(C, 'Step into context', lisMenuStepIntoContext, ecStepIntoContext);
3170  AddDefault(C, 'Step over context', lisMenuStepOverContext, ecStepOverContext);
3171  AddDefault(C, 'Step out', n(lisMenuStepOut), ecStepOut);
3172  AddDefault(C, 'Step to cursor line', n(lisMenuStepToCursor), ecStepToCursor);
3173  AddDefault(C, 'Run to cursor line', n(lisMenuRunToCursor), ecRunToCursor);
3174  AddDefault(C, 'Stop program', lisKMStopProgram, ecStopProgram);
3175  AddDefault(C, 'Reset debugger', lisMenuResetDebugger, ecResetDebugger);
3176  AddDefault(C, 'Run parameters', dlgRunParameters, ecRunParameters);
3177  AddDefault(C, 'Attach to program', srkmecAttach, ecAttach);
3178  AddDefault(C, 'Detach from program', srkmecDetach, ecDetach);
3179  AddDefault(C, 'Build File', lisMenuBuildFile, ecBuildFile);
3180  AddDefault(C, 'Run File', lisMenuRunFile, ecRunFile);
3181  AddDefault(C, 'Config "Build File"', lisKMConfigBuildFile, ecConfigBuildFile);
3182  AddDefault(C, 'Inspect', lisKMInspect, ecInspect);
3183  AddDefault(C, 'Evaluate/Modify', lisKMEvaluateModify, ecEvaluate);
3184  AddDefault(C, 'Add watch', lisKMAddWatch, ecAddWatch);
3185  AddDefault(C, 'Add source breakpoint', lisKMAddBpSource, ecAddBpSource);
3186  AddDefault(C, 'Add address breakpoint', lisKMAddBpAddress, ecAddBpAddress);
3187  AddDefault(C, 'Add data watchpoint', lisKMAddBpWatchPoint, ecAddBpDataWatch);
3188
3189  // components menu
3190  C:=Categories[AddCategory('Components',srkmCatPackageMenu,nil)];
3191  AddDefault(C, 'New package', lisKMNewPackage, ecNewPackage);
3192  AddDefault(C, 'Open package', lisCompPalOpenPackage, ecOpenPackage);
3193  AddDefault(C, 'Open package file', lisKMOpenPackageFile, ecOpenPackageFile);
3194  AddDefault(C, 'Open recent package', lisKMOpenRecentPackage, ecOpenRecentPackage);
3195  AddDefault(C, 'Open package of current unit', lisMenuOpenPackageOfCurUnit, ecOpenPackageOfCurUnit);
3196  AddDefault(C, 'Add active unit to a package', lisMenuAddCurFileToPkg, ecAddCurFileToPkg);
3197  AddDefault(C, 'Add new component to a package', lisMenuPkgNewPackageComponent, ecNewPkgComponent);
3198  AddDefault(C, 'Package graph', lisMenuPackageGraph, ecPackageGraph);
3199  AddDefault(C, 'Package links', lisMenuPackageLinks, ecPackageLinks);
3200  AddDefault(C, 'Configure installed packages', lisInstallUninstallPackages, ecEditInstallPkgs);
3201  AddDefault(C, 'Configure custom components', lisKMConfigureCustomComponents, ecConfigCustomComps);
3202
3203  // tools menu
3204  C:=Categories[AddCategory(CommandCategoryToolMenuName,srkmCatToolMenu,nil)];
3205//  C:=Categories[AddCategory('EnvironmentMenu',srkmCatEnvMenu,nil)];
3206  AddDefault(C, 'General environment options', srkmecEnvironmentOptions, ecEnvironmentOptions);
3207  AddDefault(C, 'Rescan FPC source directory', lisMenuRescanFPCSourceDirectory, ecRescanFPCSrcDir);
3208  AddDefault(C, 'Edit Code Templates', lisKMEditCodeTemplates, ecEditCodeTemplates);
3209  AddDefault(C, 'CodeTools defines editor', lisKMCodeToolsDefinesEditor, ecCodeToolsDefinesEd);
3210  AddDefault(C, 'Manage desktops', dlgManageDesktops, ecManageDesktops);
3211
3212  AddDefault(C, 'External Tools settings', lisKMExternalToolsSettings, ecExtToolSettings);
3213  AddDefault(C, 'Example Projects', lisKMExampleProjects, ecManageExamples);
3214  AddDefault(C, 'Build Lazarus', lisMenuBuildLazarus, ecBuildLazarus);
3215  AddDefault(C, 'Configure "Build Lazarus"', lisConfigureBuildLazarus, ecConfigBuildLazarus);
3216  AddDefault(C, 'Diff editor files', lisKMDiffEditorFiles, ecDiff);
3217  AddDefault(C, 'Convert DFM file to LFM', lisKMConvertDFMFileToLFM, ecConvertDFM2LFM);
3218  AddDefault(C, 'Convert Delphi unit to Lazarus unit',
3219    lisKMConvertDelphiUnitToLazarusUnit, ecConvertDelphiUnit);
3220  AddDefault(C, 'Convert Delphi project to Lazarus project',
3221    lisKMConvertDelphiProjectToLazarusProject, ecConvertDelphiProject);
3222  AddDefault(C, 'Convert Delphi package to Lazarus package',
3223    lisKMConvertDelphiPackageToLazarusPackage, ecConvertDelphiPackage);
3224  AddDefault(C, 'Convert encoding', lisConvertEncodingOfProjectsPackages, ecConvertEncoding);
3225  // window menu
3226//  C:=Categories[AddCategory('WindowMenu',srkmCarWindowMenu,nil)];
3227  AddDefault(C, 'Editor Window Manager', lisSourceEditorWindowManager, ecManageSourceEditors);
3228
3229  // help menu
3230  C:=Categories[AddCategory('HelpMenu',srkmCarHelpMenu,nil)];
3231  AddDefault(C, 'About Lazarus', lisAboutLazarus, ecAboutLazarus);
3232  AddDefault(C, 'Online Help', lisMenuOnlineHelp, ecOnlineHelp);
3233  AddDefault(C, 'Context sensitive help', lisKMContextSensitiveHelp, ecContextHelp);
3234  AddDefault(C, 'Edit context sensitive help', lisKMEditContextSensitiveHelp, ecEditContextHelp);
3235  AddDefault(C, 'Reporting a bug', srkmecReportingBug, ecReportingBug);
3236  AddDefault(C, 'Focus hint', lisFocusHint, ecFocusHint);
3237  AddDefault(C, 'Context sensitive smart hint', lisMenuShowSmartHint, ecSmartHint);
3238
3239  // designer  - without menu items in the IDE bar (at least not directly)
3240  C:=Categories[AddCategory('Designer',lisKeyCatDesigner,IDECmdScopeDesignerOnly)];
3241  AddDefault(C, 'Copy selected Components to clipboard',
3242    lisKMCopySelectedComponentsToClipboard, ecDesignerCopy);
3243  AddDefault(C, 'Cut selected Components to clipboard',
3244    lisKMCutSelectedComponentsToClipboard, ecDesignerCut);
3245  AddDefault(C, 'Paste Components from clipboard',
3246    lisKMPasteComponentsFromClipboard, ecDesignerPaste);
3247  AddDefault(C, 'Select parent component', lisDsgSelectParentComponent, ecDesignerSelectParent);
3248  AddDefault(C, 'Move component to front', lisDsgOrderMoveToFront, ecDesignerMoveToFront);
3249  AddDefault(C, 'Move component to back', lisDsgOrderMoveToBack, ecDesignerMoveToBack);
3250  AddDefault(C, 'Move component one forward', lisDsgOrderForwardOne, ecDesignerForwardOne);
3251  AddDefault(C, 'Move component one back', lisDsgOrderBackOne, ecDesignerBackOne);
3252  AddDefault(C, 'Toggle showing non visual components',
3253    lisDsgToggleShowingNonVisualComponents, ecDesignerToggleNonVisComps);
3254
3255  // object inspector - without menu items in the IDE bar (at least no direct)
3256  C:=Categories[AddCategory('Object Inspector',lisKeyCatObjInspector,IDECmdScopeObjectInspectorOnly)];
3257
3258  // custom keys (for experts, task groups, dynamic menu items, etc)
3259  C:=Categories[AddCategory(CommandCategoryCustomName,lisKeyCatCustom,nil)];
3260end;
3261
3262procedure TKeyCommandRelationList.Clear;
3263var a:integer;
3264begin
3265  fLoadedKeyCommands.FreeAndClear;
3266  for a:=0 to FRelations.Count-1 do
3267    Relations[a].Free;
3268  FRelations.Clear;
3269  fCmdRelCache.Clear;
3270  for a:=0 to fCategories.Count-1 do
3271    Categories[a].Free;
3272  fCategories.Clear;
3273end;
3274
3275function TKeyCommandRelationList.AddRelation(CmdRel: TKeyCommandRelation): Integer;
3276begin
3277  Result := FRelations.Add(CmdRel);
3278  fCmdRelCache.Add(CmdRel);
3279end;
3280
3281function TKeyCommandRelationList.GetRelation(Index:integer):TKeyCommandRelation;
3282begin
3283  Assert((Index>=0) and (Index<Count), Format('[TKeyCommandRelationList.GetRelation] '
3284    + 'Index (%d) out of bounds. Count=%d', [Index, Count]));
3285  Result:= TKeyCommandRelation(FRelations[Index]);
3286end;
3287
3288function TKeyCommandRelationList.GetRelationCount:integer;
3289begin
3290  Result:=FRelations.Count;
3291end;
3292
3293function TKeyCommandRelationList.Count:integer;
3294begin
3295  Result:=FRelations.Count;
3296end;
3297
3298function TKeyCommandRelationList.SetKeyCommandToLoadedValues(Cmd: TKeyCommandRelation
3299  ): TLoadedKeyCommand;
3300var
3301  AVLNode: TAvlTreeNode;
3302begin
3303  AVLNode:=fLoadedKeyCommands.FindKey(Pointer(Cmd.Name),@CompareNameWithLoadedKeyCommand);
3304  if AVLNode=nil then begin
3305    // new key
3306    Result:=TLoadedKeyCommand.Create;
3307    Result.Name:=Cmd.Name;
3308    Result.DefaultShortcutA:=Cmd.ShortcutA;
3309    Result.DefaultShortcutB:=Cmd.ShortcutB;
3310    Result.ShortcutA:=Result.DefaultShortcutA;
3311    Result.ShortcutB:=Result.DefaultShortcutB;
3312    fLoadedKeyCommands.Add(Result);
3313  end else begin
3314    Result:=TLoadedKeyCommand(AVLNode.Data);
3315    Result.DefaultShortcutA:=Cmd.ShortcutA;
3316    Result.DefaultShortcutB:=Cmd.ShortcutB;
3317    // old key, values were loaded (key is registered after loading keymapping)
3318    Cmd.ShortcutA:=Result.ShortcutA;
3319    Cmd.ShortcutB:=Result.ShortcutB;
3320  end;
3321end;
3322
3323function TKeyCommandRelationList.AddDefault(Category: TIDECommandCategory;
3324  const Name, LocalizedName: string; Command: word): integer;
3325var
3326  CmdRel: TKeyCommandRelation;
3327begin
3328  CmdRel:=TKeyCommandRelation.Create(Category, Name, LocalizedName, Command);
3329  CmdRel.GetDefaultKeyForCommand;
3330  CmdRel.DefaultShortcutA:=CmdRel.ShortcutA;
3331  CmdRel.DefaultShortcutB:=CmdRel.ShortcutB;
3332  SetKeyCommandToLoadedValues(CmdRel);
3333  Result:=AddRelation(CmdRel);
3334end;
3335
3336procedure TKeyCommandRelationList.SetExtToolCount(NewCount: integer);
3337var
3338  i: integer;
3339  ExtToolCat: TIDECommandCategory;
3340  ExtToolRelation: TKeyCommandRelation;
3341  ToolLocalizedName: string;
3342  cmd: word;
3343  CmdRel: TKeyCommandRelation;
3344begin
3345  if NewCount=fExtToolCount then exit;
3346  //debugln(['TKeyCommandRelationList.SetExtToolCount NewCount=',NewCount,' fExtToolCount=',fExtToolCount]);
3347  ExtToolCat:=FindCategoryByName(CommandCategoryToolMenuName);
3348  //for i:=0 to ExtToolCat.Count-1 do
3349  //  debugln(['  ',i,'/',ExtToolCat.Count,' ',TKeyCommandRelation(ExtToolCat[i]).Name]);
3350  if NewCount>fExtToolCount then begin
3351    // increase available external tool commands
3352    while NewCount>fExtToolCount do begin
3353      ToolLocalizedName:=Format(srkmecExtTool,[fExtToolCount]);
3354      cmd:=ecExtToolFirst+fExtToolCount;
3355      CmdRel:=TKeyCommandRelation.Create(ExtToolCat,
3356        Format('External tool %d',[fExtToolCount]), // keep name untranslated
3357        ToolLocalizedName, cmd);
3358      AddRelation(CmdRel);
3359      inc(fExtToolCount);
3360    end;
3361  end else begin
3362    // decrease available external tool commands
3363    // Note: the commands are somewhere in the list, not neccesarily at the end
3364    i:=ExtToolCat.Count-1;
3365    while (i>=0) do begin
3366      if TObject(ExtToolCat[i]) is TKeyCommandRelation then begin
3367        ExtToolRelation:=TKeyCommandRelation(ExtToolCat[i]);
3368        cmd:=ExtToolRelation.Command;
3369        if (cmd>=ecExtToolFirst) and (cmd<=ecExtToolLast)
3370        and (cmd>=ecExtToolFirst+fExtToolCount) then begin
3371          fRelations.Remove(ExtToolRelation);
3372          fCmdRelCache.Remove(ExtToolRelation);
3373          ExtToolCat.Delete(i);
3374          dec(fExtToolCount);
3375        end;
3376      end;
3377      dec(i);
3378    end;
3379  end;
3380end;
3381
3382function TKeyCommandRelationList.LoadFromXMLConfig(
3383  XMLConfig:TXMLConfig; const Path: String):boolean;
3384var
3385  a,b,p:integer;
3386  FileVersion: integer;
3387  Name: String;
3388  NewValue: String;
3389
3390  function ReadNextInt:integer;
3391  begin
3392    Result:=0;
3393    while (p<=length(NewValue)) and (not (NewValue[p] in ['0'..'9']))
3394      do inc(p);
3395    while (p<=length(NewValue)) and (NewValue[p] in ['0'..'9'])
3396    and (Result<$10000) do begin
3397      Result:=Result*10+ord(NewValue[p])-ord('0');
3398      inc(p);
3399    end;
3400  end;
3401
3402  function IntToShiftState(i:integer):TShiftState;
3403  begin
3404    Result:=[];
3405    if (i and 1)>0 then Include(Result,ssCtrl);
3406    if (i and 2)>0 then Include(Result,ssShift);
3407    if (i and 4)>0 then Include(Result,ssAlt);
3408    if (i and 8)>0 then Include(Result,ssMeta);
3409    if (i and 16)>0 then Include(Result,ssSuper);
3410  end;
3411
3412  function OldKeyValuesToStr(const ShortcutA, ShortcutB: TIDEShortCut): string;
3413  begin
3414    Result:=IntToStr(ShortcutA.Key1) + ',' + ShiftStateToCfgStr(ShortcutA.Shift1) + ',' +
3415            IntToStr(ShortcutB.Key1) + ',' + ShiftStateToCfgStr(ShortcutB.Shift1);
3416  end;
3417
3418  function FixShift(Shift: TShiftState): TShiftState;
3419  begin
3420    Result:=Shift;
3421    {$IFDEF LCLcarbon}
3422    if (FileVersion<5) and (Result*[ssCtrl,ssMeta]=[ssCtrl]) then
3423      Result:=Result-[ssCtrl]+[ssMeta];
3424    {$ENDIF}
3425  end;
3426
3427  procedure Load(SubPath: string; out Key, DefaultKey: TIDEShortCut);
3428  begin
3429    DefaultKey:=CleanIDEShortCut;
3430    if XMLConfig.GetValue(SubPath+'Default',True) then begin
3431      Key:=CleanIDEShortCut;
3432    end else begin
3433      // not default
3434      key.Key1:=XMLConfig.GetValue(SubPath+'Key1',VK_UNKNOWN);
3435      key.Shift1:=CfgStrToShiftState(XMLConfig.GetValue(SubPath+'Shift1',''));
3436      key.Key2:=XMLConfig.GetValue(SubPath+'Key2',VK_UNKNOWN);
3437      key.Shift2:=CfgStrToShiftState(XMLConfig.GetValue(SubPath+'Shift2',''));
3438      if CompareIDEShortCuts(@Key,@CleanIDEShortCut)=0 then
3439        // this key is empty, mark it so that it differs from default
3440        key.Shift2:=[ssShift];
3441    end;
3442  end;
3443
3444// LoadFromXMLConfig
3445var
3446  Key1, Key2: word;
3447  Shift1, Shift2: TShiftState;
3448  Cnt: LongInt;
3449  SubPath: String;
3450  AVLNode: TAvlTreeNode;
3451  LoadedKey: TLoadedKeyCommand;
3452begin
3453  //debugln('TKeyCommandRelationList.LoadFromXMLConfig A ');
3454  FileVersion:=XMLConfig.GetValue(Path+'Version/Value',0);
3455  ExtToolCount:=XMLConfig.GetValue(Path+'ExternalToolCount/Value',0);
3456
3457  if FileVersion>5 then begin
3458    Cnt:=XMLConfig.GetValue(Path+'Count',0);
3459    // load all keys from the config, this may be more than the current relations
3460    // for example because the command is not yet registered.
3461    for a:=1 to Cnt do begin
3462      SubPath:=Path+'Item'+IntToStr(a)+'/';
3463      Name:=XMLConfig.GetValue(SubPath+'Name','');
3464      if Name='' then continue;
3465      AVLNode:=fLoadedKeyCommands.FindKey(Pointer(Name),
3466                                          @CompareNameWithLoadedKeyCommand);
3467      if AVLNode<>nil then begin
3468        LoadedKey:=TLoadedKeyCommand(AVLNode.Data);
3469      end else begin
3470        LoadedKey:=TLoadedKeyCommand.Create;
3471        LoadedKey.Name:=Name;
3472        fLoadedKeyCommands.Add(LoadedKey);
3473      end;
3474      Load(SubPath+'KeyA/',LoadedKey.ShortcutA,LoadedKey.DefaultShortcutA);
3475      Load(SubPath+'KeyB/',LoadedKey.ShortcutB,LoadedKey.DefaultShortcutB);
3476      //if Name='ShowUnitDictionary' then
3477      //  debugln(['TKeyCommandRelationList.LoadFromXMLConfig ',LoadedKey.AsString]);
3478    end;
3479    // apply
3480    for a:=0 to FRelations.Count-1 do begin
3481      Name:=Relations[a].Name;
3482      if Name='' then continue;
3483      AVLNode:=fLoadedKeyCommands.FindKey(Pointer(Name),
3484                                          @CompareNameWithLoadedKeyCommand);
3485      if AVLNode<>nil then begin
3486        // there is a value in the config
3487        LoadedKey:=TLoadedKeyCommand(AVLNode.Data);
3488        if LoadedKey.IsShortcutADefault then
3489          Relations[a].ShortcutA:=Relations[a].DefaultShortcutA
3490        else
3491          Relations[a].ShortcutA:=LoadedKey.ShortcutA;
3492        if LoadedKey.IsShortcutBDefault then
3493          Relations[a].ShortcutB:=Relations[a].DefaultShortcutB
3494        else
3495          Relations[a].ShortcutB:=LoadedKey.ShortcutB;
3496      end else begin
3497        // no value in config => use default
3498        Relations[a].ShortcutA:=Relations[a].DefaultShortcutA;
3499        Relations[a].ShortcutB:=Relations[a].DefaultShortcutB;
3500      end;
3501    end;
3502  end else begin
3503    // FileVersion<=5
3504    for a:=0 to FRelations.Count-1 do begin
3505      Name:=lowercase(Relations[a].Name);
3506      for b:=1 to length(Name) do
3507        if not (Name[b] in ['a'..'z','0'..'9']) then
3508          Name[b]:='_';
3509
3510      if FileVersion<2 then
3511        NewValue:=XMLConfig.GetValue(Path+Name,'')
3512      else
3513        NewValue:=XMLConfig.GetValue(Path+Name+'/Value','');
3514      //if Relations[a].Command=ecBlockIndent then debugln('  NewValue=',NewValue);
3515      if NewValue='' then begin
3516        Relations[a].ShortcutA:=Relations[a].DefaultShortcutA;
3517        Relations[a].ShortcutB:=Relations[a].DefaultShortcutB;
3518      end else begin
3519        p:=1;
3520        Key1:=word(ReadNextInt);
3521        Shift1:=FixShift(IntToShiftState(ReadNextInt));
3522        if FileVersion>2 then begin
3523          Key2:=word(ReadNextInt);
3524          Shift2:=FixShift(IntToShiftState(ReadNextInt));
3525        end else begin
3526          Key2:=VK_UNKNOWN;
3527          Shift2:=[];
3528        end;
3529        Relations[a].ShortcutA:=IDEShortCut(Key1, Shift1, Key2, Shift2);
3530
3531        Key1:=word(ReadNextInt);
3532        Shift1:=FixShift(IntToShiftState(ReadNextInt));
3533        if FileVersion>2 then begin
3534          Key2:=word(ReadNextInt);
3535          Shift2:=FixShift(IntToShiftState(ReadNextInt));
3536        end else begin
3537          Key2:=VK_UNKNOWN;
3538          Shift2:=[];
3539        end;
3540        Relations[a].ShortcutB:=IDEShortCut(Key1, Shift1, Key2, Shift2);
3541      end;
3542    end;
3543  end;
3544  Result:=true;
3545end;
3546
3547function TKeyCommandRelationList.SaveToXMLConfig(
3548  XMLConfig:TXMLConfig; const Path: String): boolean;
3549
3550  procedure Store(const SubPath: string; Key, DefaultKey: TIDEShortCut);
3551  var
3552    IsDefault: boolean;
3553    s: TShiftState;
3554  begin
3555    IsDefault:=CompareIDEShortCuts(@Key,@DefaultKey)=0;
3556    XMLConfig.SetDeleteValue(SubPath+'Default',IsDefault,True);
3557    if IsDefault then begin
3558      // clear values
3559      XMLConfig.SetDeleteValue(SubPath+'Key1',0,0);
3560      XMLConfig.SetDeleteValue(SubPath+'Shift1','','');
3561      XMLConfig.SetDeleteValue(SubPath+'Key2',0,0);
3562      XMLConfig.SetDeleteValue(SubPath+'Shift2','','');
3563    end else begin
3564      // store values
3565      XMLConfig.SetDeleteValue(SubPath+'Key1',key.Key1,VK_UNKNOWN);
3566      if key.Key1=VK_UNKNOWN then
3567        s:=[]
3568      else
3569        s:=key.Shift1;
3570      XMLConfig.SetDeleteValue(SubPath+'Shift1',ShiftStateToCfgStr(s),ShiftStateToCfgStr([]));
3571      XMLConfig.SetDeleteValue(SubPath+'Key2',key.Key2,VK_UNKNOWN);
3572      if key.Key2=VK_UNKNOWN then
3573        s:=[]
3574      else
3575        s:=key.Shift2;
3576      XMLConfig.SetDeleteValue(SubPath+'Shift2',ShiftStateToCfgStr(s),ShiftStateToCfgStr([]));
3577    end;
3578  end;
3579
3580var a: integer;
3581  Name: String;
3582  AVLNode: TAvlTreeNode;
3583  LoadedKey: TLoadedKeyCommand;
3584  Cnt: Integer;
3585  SubPath: String;
3586begin
3587  XMLConfig.SetValue(Path+'Version/Value',KeyMappingFormatVersion);
3588  XMLConfig.SetDeleteValue(Path+'ExternalToolCount/Value',ExtToolCount,0);
3589  // save shortcuts to fLoadedKeyCommands
3590  for a:=0 to FRelations.Count-1 do begin
3591    Name:=Relations[a].Name;
3592    if Name='' then continue;
3593    if Relations[a].SkipSaving then continue;
3594    AVLNode:=fLoadedKeyCommands.FindKey(Pointer(Name),
3595                                        @CompareNameWithLoadedKeyCommand);
3596    if AVLNode<>nil then begin
3597      LoadedKey:=TLoadedKeyCommand(AVLNode.Data);
3598    end else begin
3599      LoadedKey:=TLoadedKeyCommand.Create;
3600      LoadedKey.Name:=Name;
3601      fLoadedKeyCommands.Add(LoadedKey);
3602      LoadedKey.DefaultShortcutA:=Relations[a].DefaultShortcutA;
3603      LoadedKey.DefaultShortcutB:=Relations[a].DefaultShortcutB;
3604    end;
3605    LoadedKey.ShortcutA:=Relations[a].ShortcutA;
3606    LoadedKey.ShortcutB:=Relations[a].ShortcutB;
3607  end;
3608  // save keys to config (including the one that were read from the last config
3609  //                      and were not used)
3610  Cnt:=0;
3611  AVLNode:=fLoadedKeyCommands.FindLowest;
3612  while AVLNode<>nil do begin
3613    LoadedKey:=TLoadedKeyCommand(AVLNode.Data);
3614    if (not LoadedKey.IsShortcutADefault) or (not LoadedKey.IsShortcutBDefault)
3615    then begin
3616      inc(Cnt);
3617      //DebugLn(['TKeyCommandRelationList.SaveToXMLConfig CUSTOM ',LoadedKey.AsString]);
3618      SubPath:=Path+'Item'+IntToStr(Cnt)+'/';
3619      XMLConfig.SetValue(SubPath+'Name',LoadedKey.Name);
3620      Store(SubPath+'KeyA/',LoadedKey.ShortcutA,LoadedKey.DefaultShortcutA);
3621      Store(SubPath+'KeyB/',LoadedKey.ShortcutB,LoadedKey.DefaultShortcutB);
3622    end;
3623    AVLNode:=fLoadedKeyCommands.FindSuccessor(AVLNode);
3624  end;
3625  XMLConfig.SetDeleteValue(Path+'Count',Cnt,0);
3626  Result:=true;
3627end;
3628
3629function TKeyCommandRelationList.Find(Key: TIDEShortCut;
3630  IDEWindowClass: TCustomFormClass): TKeyCommandRelation;
3631var
3632  i:integer;
3633begin
3634  Result:=nil;
3635  //debugln(['TKeyCommandRelationList.Find START, IDEWindowClass=',DbgSName(IDEWindowClass),
3636  //         ', Key1=', Key.Key1, ', Key2=', Key.Key2]);
3637  //if IDEWindowClass=nil then RaiseGDBException('');
3638  if Key.Key1=VK_UNKNOWN then exit;
3639  for i:=0 to FRelations.Count-1 do
3640    with Relations[i] do begin
3641      //if Command=ecDesignerSelectParent then
3642      //  debugln('TKeyCommandRelationList.Find A ',Category.Scope.Name,' ',dbgsName(IDEWindowClass),
3643      //          ' ',dbgs(IDECmdScopeDesignerOnly.IDEWindowClassCount),
3644      //          ' ',dbgsName(IDECmdScopeDesignerOnly.IDEWindowClasses[0]));
3645      //debugln(['TKeyCommandRelationList.Find ',Name,' HasScope=',Category.Scope<>nil,
3646      //         ' ',KeyAndShiftStateToEditorKeyString(ShortcutA),
3647      //         ' ',KeyAndShiftStateToEditorKeyString(Key),
3648      //         ' ',(Category.Scope<>nil) and (not Category.Scope.HasIDEWindowClass(IDEWindowClass))]);
3649      //if (Category.Scope<>nil) and (Category.Scope.IDEWindowClassCount>0) then
3650      //  debugln(['TKeyCommandRelationList.Find ',DbgSName(Category.Scope.IDEWindowClasses[0]),
3651      //           ' ',DbgSName(IDEWindowClass)]);
3652      if (Category.Scope<>nil)
3653      and (not Category.Scope.HasIDEWindowClass(IDEWindowClass)) then continue;
3654      if ((ShortcutA.Key1=Key.Key1) and (ShortcutA.Shift1=Key.Shift1) and
3655          (ShortcutA.Key2=Key.Key2) and (ShortcutA.Shift2=Key.Shift2))
3656      or ((ShortcutB.Key1=Key.Key1) and (ShortcutB.Shift1=Key.Shift1) and
3657          (ShortcutB.Key2=Key.Key2) and (ShortcutB.Shift2=Key.Shift2)) then
3658      begin
3659        Result:=Relations[i];
3660        exit;
3661      end;
3662    end;
3663end;
3664
3665function TKeyCommandRelationList.FindIDECommand(ACommand: word): TIDECommand;
3666begin
3667  Result:=FindByCommand(ACommand);
3668end;
3669
3670function TKeyCommandRelationList.FindByCommand(ACommand: word): TKeyCommandRelation;
3671var
3672  AVLNode: TAvlTreeNode;
3673begin
3674  AVLNode:=fCmdRelCache.FindKey({%H-}Pointer(PtrUInt(ACommand)), @CompareCmdWithCmdRel);
3675  if Assigned(AVLNode) then
3676    Result:=TKeyCommandRelation(AVLNode.Data)
3677  else
3678    Result:=nil;
3679end;
3680
3681// Command compare functions for AvgLvlTree for fast lookup.
3682function CompareCmd(Data1, Data2: Pointer): integer;
3683var
3684  List1: TKeyStrokeList absolute Data1;
3685  List2: TKeyStrokeList absolute Data2;
3686  Cmd1, Cmd2: TSynEditorCommand;
3687begin
3688  Cmd1 := List1.KeyStroke1.Command;
3689  Cmd2 := List2.KeyStroke1.Command;
3690  if      Cmd1 > Cmd2 then Result:=-1
3691  else if Cmd1 < Cmd2 then Result:=1
3692  else Result:=0;
3693end;
3694
3695function CompareKeyCmd(Data1, Data2: Pointer): integer;
3696var
3697  Cmd: PtrUInt absolute Data1;
3698  List2: TKeyStrokeList absolute Data2;
3699  Cmd1, Cmd2: TSynEditorCommand;
3700begin
3701  Cmd1 := Cmd;
3702  Cmd2 := List2.KeyStroke1.Command;
3703  if      Cmd1 > Cmd2 then Result:=-1
3704  else if Cmd1 < Cmd2 then Result:=1
3705  else Result:=0;
3706end;
3707
3708procedure TKeyCommandRelationList.AssignTo(ASynEditKeyStrokes: TSynEditKeyStrokes;
3709  IDEWindowClass: TCustomFormClass; ACommandOffsetOffset: Integer = 0);
3710var
3711  Node: TAvlTreeNode;
3712  ccid: Word;
3713  CategoryMatches: Boolean;
3714  ToBeFreedKeys: TObjectList;
3715  SequentialWithCtrl: TFPList;
3716  SequentialWithoutCtrl: TFPList;
3717
3718  function ShiftConflict(aKey: TSynEditKeyStroke): Boolean;
3719  // This is called when first part of combo has Ctrl and 2nd part has Ctrl or nothing.
3720  //  Check if ignoring Ctrl in second part would create a conflict.
3721  var
3722    ConflictList: TFPList;
3723    psc: PIDEShortCut;
3724    i: integer;
3725  begin
3726    if aKey.Shift2 = [ssCtrl] then
3727      ConflictList := SequentialWithoutCtrl
3728    else
3729      ConflictList := SequentialWithCtrl;
3730    for i:=0 to ConflictList.Count-1 do begin
3731      psc:=ConflictList[i];
3732      if (psc^.Key1=aKey.Key) and (psc^.Key2=aKey.Key2) then
3733        Exit(True);        // Found
3734    end;
3735    Result := False;
3736  end;
3737
3738  procedure SetKeyCombo(aKey: TSynEditKeyStroke; aShortcut: PIDEShortCut);
3739  // Define a key for a command
3740  begin
3741    aKey.Key   :=aShortcut^.Key1;
3742    aKey.Shift :=aShortcut^.Shift1;
3743    aKey.Key2  :=aShortcut^.Key2;
3744    aKey.Shift2:=aShortcut^.Shift2;
3745    // Ignore the second Ctrl key in sequential combos unless both variations are defined.
3746    // For example "Ctrl-X, Y" and "Ctrl-X, Ctrl-Y" are then treated the same.
3747    if (aKey.Key2<>VK_UNKNOWN) and (aKey.Shift=[ssCtrl]) and (aKey.Shift2-[ssCtrl]=[])
3748    and not ShiftConflict(aKey) then begin
3749      aKey.ShiftMask2:=[ssCtrl];
3750      aKey.Shift2:=[];
3751    end
3752    else
3753      aKey.ShiftMask2:=[];
3754  end;
3755
3756  procedure UpdateOrAddKeyStroke(aOffset: integer; aShortcut: PIDEShortCut);
3757  // Update an existing KeyStroke or add a new one
3758  var
3759    Key: TSynEditKeyStroke;
3760    KeyList: TKeyStrokeList;
3761  begin
3762    if Assigned(Node) then
3763      KeyList:=TKeyStrokeList(Node.Data);
3764    if Assigned(Node) and (KeyList.FCount>aOffset) then begin
3765      Key:=KeyList[aOffset];       // Already defined -> update
3766      if CategoryMatches and (aShortcut^.Key1<>VK_UNKNOWN) then
3767        SetKeyCombo(Key, aShortcut)
3768      else
3769        ToBeFreedKeys.Add(Key);    // No shortcut -> delete from the collection
3770    end
3771    else if CategoryMatches and (aShortcut^.Key1<>VK_UNKNOWN) then begin
3772      Key:=ASynEditKeyStrokes.Add;                // Add a new key
3773      Key.Command:=ccid;
3774      SetKeyCombo(Key, aShortcut);
3775    end;
3776  end;
3777
3778  procedure SaveSequentialCtrl(aShortcut: PIDEShortCut);
3779  // Save the shortcut when it is a sequential combo and first modifier is Ctrl
3780  //  and second modifier is either Ctrl or nothing.
3781  begin
3782    if (aShortcut^.Shift1=[ssCtrl]) then begin
3783      if (aShortcut^.Shift2=[ssCtrl]) then   // Second modifier is Ctrl
3784        SequentialWithCtrl.Add(aShortcut)
3785      else if (aShortcut^.Shift2=[]) then    // No second modifier
3786        SequentialWithoutCtrl.Add(aShortcut);
3787    end;
3788  end;
3789
3790var
3791  i, j: integer;
3792  Key: TSynEditKeyStroke;
3793  KeyStrokesByCmds: TAvlTree;
3794  KeyList: TKeyStrokeList;
3795  CurRelation: TKeyCommandRelation;
3796  POUsed: Boolean;
3797  SameCmdKey: TSynEditKeyStroke;
3798begin
3799  (* ACommandOffsetOffset
3800     The IDE defines its own fixed value command-id for plugins.
3801     Map them to the plugin ID
3802     - ecIdePTmplEdOutNextCell and ecIdePTmplEdNextCell both map to ecSynPTmplEdNextCell
3803     - which maps to "ecPluginFirst + n", as many others.
3804     But the IDE requires unique values.
3805     The unique values in the plugin (+ KeyOffset) can not be used, as they are not at fixed numbers
3806  *)
3807  KeyStrokesByCmds:=TAvlTree.Create(@CompareCmd);
3808  ToBeFreedKeys:=TObjectList.Create;
3809  POUsed:=ASynEditKeyStrokes.UsePluginOffset;
3810  SequentialWithCtrl:=TFPList.Create;
3811  SequentialWithoutCtrl:=TFPList.Create;
3812  try
3813    ASynEditKeyStrokes.UsePluginOffset := False;
3814    // Save all SynEditKeyStrokes into a tree map for fast lookup, sorted by command.
3815    for i:=ASynEditKeyStrokes.Count-1 downto 0 do begin
3816      Key:=ASynEditKeyStrokes[i];
3817      Node:=KeyStrokesByCmds.FindKey({%H-}Pointer(Key.Command), @CompareKeyCmd);
3818      if Assigned(Node) then begin // Another key is already defined for this command
3819        KeyList:=TKeyStrokeList(Node.Data);
3820        if KeyList.FCount < 3 then
3821          KeyList.Add(Key)
3822        else begin
3823          DebugLn(['TKeyCommandRelationList.AssignTo: WARNING: fourth key for command ',EditorCommandToDescriptionString(Key.Command),':']);
3824          for j:=0 to KeyList.FCount-1 do begin
3825            SameCmdKey:=KeyList[j];
3826            debugln(['  ',j,'/',KeyList.FCount,' ',KeyAndShiftStateToKeyString(SameCmdKey.Key,SameCmdKey.Shift)]);
3827          end;
3828          debugln(['  ',4,'/',KeyList.FCount,' ',KeyAndShiftStateToKeyString(Key.Key,Key.Shift)]);
3829          Key.Free; // This deletes the key from TSynEditKeyStrokes container as well.
3830        end;
3831      end
3832      else begin
3833        KeyList:=TKeyStrokeList.Create;
3834        KeyList.Add(Key);
3835        KeyStrokesByCmds.Add(KeyList);
3836      end;
3837    end;
3838    // Cache sequential combos with and without Ctrl key.
3839    for i:=0 to FRelations.Count-1 do begin
3840      CurRelation:=Relations[i];
3841      SaveSequentialCtrl(@CurRelation.ShortcutA);
3842      SaveSequentialCtrl(@CurRelation.ShortcutB);
3843    end;
3844    // Iterate all KeyCommandRelations and copy / update them to SynEditKeyStrokes.
3845    for i:=0 to FRelations.Count-1 do begin
3846      CurRelation:=Relations[i];
3847      CategoryMatches:=(IDEWindowClass=nil)
3848                   or (CurRelation.Category.Scope=nil)
3849                    or CurRelation.Category.Scope.HasIDEWindowClass(IDEWindowClass);
3850      ccid:=CurRelation.Command;
3851      if (ccid >= ecFirstPlugin) and (ccid < ecLastPlugin) then
3852        ccid:=ccid+ACommandOffsetOffset;
3853      // Get SynEditKeyStrokes from the lookup tree
3854      Node:=KeyStrokesByCmds.FindKey({%H-}Pointer(ccid), @CompareKeyCmd);
3855      // First and second shortcuts for this command
3856      UpdateOrAddKeyStroke(0, @CurRelation.ShortcutA);
3857      UpdateOrAddKeyStroke(1, @CurRelation.ShortcutB);
3858    end;
3859  finally
3860    SequentialWithoutCtrl.Free;
3861    SequentialWithCtrl.Free;
3862    ToBeFreedKeys.Free;              // Free also Key objects.
3863    KeyStrokesByCmds.FreeAndClear;   // Free also KeyLists.
3864    KeyStrokesByCmds.Free;
3865    ASynEditKeyStrokes.UsePluginOffset:=POUsed;
3866  end;
3867end;
3868
3869procedure TKeyCommandRelationList.Assign(List: TKeyCommandRelationList);
3870var
3871  i: Integer;
3872  OtherCategory: TIDECommandCategory;
3873  OurCategory: TIDECommandCategory;
3874  OtherRelation: TKeyCommandRelation;
3875  OurRelation: TKeyCommandRelation;
3876begin
3877  // add/assign categories
3878  for i:=0 to List.CategoryCount-1 do begin
3879    OtherCategory:=List.Categories[i];
3880    OurCategory:=FindCategoryByName(OtherCategory.Name);
3881    if OurCategory<>nil then begin
3882      // assign
3883      OurCategory.Description:=OtherCategory.Description;
3884      OurCategory.Scope:=OtherCategory.Scope;
3885    end else begin
3886      //DebugLn('TKeyCommandRelationList.Assign Add new category: ',OtherCategory.Name);
3887      AddCategory(OtherCategory.Name,OtherCategory.Description,OtherCategory.Scope);
3888    end;
3889  end;
3890
3891  // add/assign keys
3892  for i:=0 to List.Count-1 do begin
3893    OtherRelation:=List.Relations[i];
3894    OurRelation:=TKeyCommandRelation(FindCommandByName(OtherRelation.Name));
3895    if OurRelation<>nil then begin
3896      // assign
3897      OurRelation.Assign(OtherRelation);
3898    end else begin
3899      // add
3900      //DebugLn('TKeyCommandRelationList.Assign Add new command: ',OtherRelation.Name);
3901      OurCategory:=FindCategoryByName(OtherRelation.Category.Name);
3902      OurRelation:=TKeyCommandRelation.Create(OtherRelation,OurCategory);
3903      AddRelation(OurRelation);
3904    end;
3905  end;
3906
3907  // delete unneeded keys
3908  for i:=0 to CategoryCount-1 do begin
3909    OurCategory:=Categories[i];
3910    OtherCategory:=List.FindCategoryByName(OurCategory.Name);
3911    if OtherCategory=nil then begin
3912      //DebugLn('TKeyCommandRelationList.Assign remove unneeded category: ',OurCategory.Name);
3913      OurCategory.Free;
3914    end;
3915  end;
3916
3917  // delete unneeded categories
3918  for i:=0 to Count-1 do begin
3919    OurRelation:=Relations[i];
3920    if List.FindCommandByName(OurRelation.Name)=nil then begin
3921      //DebugLn('TKeyCommandRelationList.Assign remove unneeded command: ',OurRelation.Name);
3922      OurRelation.Free;
3923    end;
3924  end;
3925
3926  // copy ExtToolCount
3927  fExtToolCount:=List.ExtToolCount;
3928end;
3929
3930procedure TKeyCommandRelationList.LoadScheme(const SchemeName: string);
3931var
3932  i: Integer;
3933  NewScheme: TKeyMapScheme;
3934begin
3935  NewScheme:=KeySchemeNameToSchemeType(SchemeName);
3936  for i:=0 to Count-1 do                  // set all keys to new scheme
3937    Relations[i].MapShortcut(NewScheme);
3938end;
3939
3940function TKeyCommandRelationList.CreateUniqueCategoryName(const AName: string): string;
3941begin
3942  Result:=AName;
3943  if FindCategoryByName(Result)=nil then exit;
3944  Result:=CreateFirstIdentifier(Result);
3945  while FindCategoryByName(Result)<>nil do
3946    Result:=CreateNextIdentifier(Result);
3947end;
3948
3949function TKeyCommandRelationList.CreateUniqueCommandName(const AName: string): string;
3950begin
3951  Result:=AName;
3952  if FindCommandByName(Result)=nil then exit;
3953  Result:=CreateFirstIdentifier(Result);
3954  while FindCommandByName(Result)<>nil do
3955    Result:=CreateNextIdentifier(Result);
3956end;
3957
3958function TKeyCommandRelationList.CreateNewCommandID: word;
3959begin
3960  Result:=ecLazarusLast;
3961  while FindByCommand(Result)<>nil do
3962    inc(Result);
3963end;
3964
3965function TKeyCommandRelationList.CreateCategory(Parent: TIDECommandCategory;
3966  const AName, Description: string; Scope: TIDECommandScope): TIDECommandCategory;
3967begin
3968  Result:=Categories[AddCategory(CreateUniqueCategoryName(AName),Description,Scope)];
3969end;
3970
3971function TKeyCommandRelationList.CreateCommand(Category: TIDECommandCategory; const AName,
3972  Description: string; const TheShortcutA, TheShortcutB: TIDEShortCut;
3973  const OnExecuteMethod: TNotifyEvent; const OnExecuteProc: TNotifyProcedure): TIDECommand;
3974var
3975  NewName: String;
3976  cmd: word;
3977  CmdRel: TKeyCommandRelation;
3978begin
3979  NewName:=CreateUniqueCommandName(AName);
3980  cmd:=CreateNewCommandID;
3981  CmdRel:=TKeyCommandRelation.Create(Category as TKeyCommandCategory,
3982                      NewName, Description, cmd,
3983                      TheShortcutA, TheShortcutB, OnExecuteMethod, OnExecuteProc);
3984  SetKeyCommandToLoadedValues(CmdRel);
3985  AddRelation(CmdRel);
3986  Result:=CmdRel;
3987end;
3988
3989procedure TKeyCommandRelationList.RemoveCommand(ACommand: TIDECommand);
3990begin
3991  fRelations.Remove(ACommand);
3992  fCmdRelCache.Remove(ACommand);
3993end;
3994
3995function TKeyCommandRelationList.GetCategory(Index: integer): TIDECommandCategory;
3996begin
3997  Result:=TIDECommandCategory(fCategories[Index]);
3998end;
3999
4000function TKeyCommandRelationList.CategoryCount: integer;
4001begin
4002  Result:=fCategories.Count;
4003end;
4004
4005function TKeyCommandRelationList.AddCategory(const Name, Description: string;
4006  TheScope: TIDECommandScope): integer;
4007begin
4008  Result:=fCategories.Add(TKeyCommandCategory.Create(Name,Description,TheScope));
4009end;
4010
4011function TKeyCommandRelationList.FindCategoryByName(const CategoryName: string): TIDECommandCategory;
4012var i: integer;
4013begin
4014  for i:=0 to CategoryCount-1 do
4015    if CategoryName=Categories[i].Name then
4016      Exit(Categories[i]);
4017  Result:=nil;
4018end;
4019
4020function TKeyCommandRelationList.FindCommandByName(const CommandName: string): TIDECommand;
4021var i: integer;
4022begin
4023  for i:=0 to RelationCount-1 do
4024    if CompareText(CommandName,Relations[i].Name)=0 then
4025      Exit(Relations[i]);
4026  Result:=nil;
4027end;
4028
4029function TKeyCommandRelationList.FindCommandsByShortCut(
4030  const ShortCutMask: TIDEShortCut; IDEWindowClass: TCustomFormClass): TFPList;
4031
4032  function KeyFits(const aShortCut: TIDEShortCut): boolean;
4033  begin
4034    if (ShortCutMask.Key1=VK_UNKNOWN) then
4035      exit(true); // fits all
4036    Result:=((aShortCut.Key1=ShortCutMask.Key1) and (aShortCut.Shift1=ShortCutMask.Shift1))
4037      and ((aShortCut.Key2=VK_UNKNOWN)
4038        or (ShortCutMask.Key2=VK_UNKNOWN)
4039        or ((aShortCut.Key2=ShortCutMask.Key2) and (aShortCut.Shift2=ShortCutMask.Shift2)));
4040  end;
4041
4042var
4043  i: Integer;
4044begin
4045  Result:=TFPList.Create;
4046  if (ShortCutMask.Key1<>VK_UNKNOWN)
4047  and (not IsValidIDECommandKey(ShortCutMask.Key1)) then
4048    exit;
4049  for i:=0 to FRelations.Count-1 do
4050    with Relations[i] do begin
4051      if (IDEWindowClass<>nil)
4052      and (Category.Scope<>nil)
4053      and (not Category.Scope.HasIDEWindowClass(IDEWindowClass)) then continue;
4054      if KeyFits(ShortcutA) or KeyFits(ShortcutB) then
4055        Result.Add(Relations[i]);
4056    end;
4057end;
4058
4059function TKeyCommandRelationList.RemoveShortCut(ShortCutMask: TIDEShortCut;
4060  IDEWindowClass: TCustomFormClass): Integer;
4061// Removes the given shortcut from every command. Returns the number deleted.
4062// An IDE extension package may want to use a reserved shortcut and remove it.
4063
4064  procedure CheckAndRemove(pShortCut: PIDEShortCut);
4065  begin
4066    if ((pShortCut^.Key1=ShortCutMask.Key1) and (pShortCut^.Shift1=ShortCutMask.Shift1))
4067      and ((pShortCut^.Key2=VK_UNKNOWN)
4068        or (ShortCutMask.Key2=VK_UNKNOWN)
4069        or ((pShortCut^.Key2=ShortCutMask.Key2) and (pShortCut^.Shift2=ShortCutMask.Shift2))) then
4070    begin
4071      pShortCut^.Key1:=VK_UNKNOWN;
4072      pShortCut^.Shift1:=[];
4073      pShortCut^.Key2:=VK_UNKNOWN;
4074      pShortCut^.Shift2:=[];
4075      Inc(Result);
4076    end;
4077  end;
4078
4079var
4080  i: Integer;
4081begin
4082  Result:=0;
4083  if ShortCutMask.Key1=VK_UNKNOWN then
4084    Exit;
4085  for i:=0 to FRelations.Count-1 do
4086    with Relations[i] do
4087      if (IDEWindowClass=nil) or (Category.Scope=nil)
4088      or Category.Scope.HasIDEWindowClass(IDEWindowClass) then
4089      begin
4090        CheckAndRemove(@ShortcutA);
4091        CheckAndRemove(@ShortcutB);
4092      end;
4093end;
4094
4095function TKeyCommandRelationList.TranslateKey(Key: word; Shift: TShiftState;
4096  IDEWindowClass: TCustomFormClass; UseLastKey: boolean): word;
4097{ If UseLastKey = true then only search for commmands with one key.
4098  If UseLastKey = false then search first for a command with a two keys
4099    combination (i.e. the last key plus this one)
4100    and then for a command with one key.
4101  If no command was found the key is stored in fLastKey.Key1.
4102}
4103var
4104  ARelation: TKeyCommandRelation;
4105begin
4106  //debugln(['TKeyCommandRelationList.TranslateKey ',DbgSName(IDEWindowClass)]);
4107  //if IDEWindowClass=nil then DumpStack;
4108  Result:=ecNone;
4109  if not IsValidIDECommandKey(Key) then
4110  begin
4111    //debugln(['TKeyCommandRelationList.TranslateKey ignoring ',dbgs(Key)]);
4112    exit;
4113  end;
4114  if UseLastKey and (fLastKey.Key1<>VK_UNKNOWN) then begin
4115    // the last key had no command
4116    // => try a two key combination command
4117    fLastKey.Key2 := Key;
4118    fLastKey.Shift2 := Shift;
4119    ARelation := Find(fLastKey,IDEWindowClass);
4120  end else begin
4121    ARelation := nil;
4122  end;
4123  if ARelation = nil then
4124  begin
4125    // search for a one key command
4126    fLastKey.Key1 := Key;
4127    fLastKey.Shift1 := Shift;
4128    fLastKey.Key2 := VK_UNKNOWN;
4129    fLastKey.Shift2 := [];
4130    ARelation := Find(fLastKey,IDEWindowClass);
4131  end;
4132  if ARelation<>nil then
4133  begin
4134    // the key has a command -> key was used => clear fLastKey
4135    fLastKey.Key1 := VK_UNKNOWN;
4136    fLastKey.Shift1 := [];
4137    fLastKey.Key2 := VK_UNKNOWN;
4138    fLastKey.Shift2 := [];
4139    Result:=ARelation.Command
4140  end;
4141end;
4142
4143function TKeyCommandRelationList.IndexOf(ARelation: TKeyCommandRelation): integer;
4144begin
4145  Result:=fRelations.IndexOf(ARelation);
4146end;
4147
4148function TKeyCommandRelationList.CommandToShortCut(ACommand: word): TShortCut;
4149var
4150  ARelation: TKeyCommandRelation;
4151begin
4152  ARelation:=FindByCommand(ACommand);
4153  if ARelation<>nil then
4154    Result:=ARelation.AsShortCut
4155  else
4156    Result:=VK_UNKNOWN;
4157end;
4158
4159{ TKeyCommandCategory }
4160
4161procedure TKeyCommandCategory.Clear;
4162begin
4163  fName:='';
4164  fDescription:='';
4165  inherited Clear;
4166end;
4167
4168procedure TKeyCommandCategory.Delete(Index: Integer);
4169begin
4170  TObject(Items[Index]).Free;
4171  inherited Delete(Index);
4172end;
4173
4174constructor TKeyCommandCategory.Create(const AName, ADescription: string;
4175  TheScope: TIDECommandScope);
4176begin
4177  inherited Create;
4178  FName:=AName;
4179  FDescription:=ADescription;
4180  FScope:=TheScope;
4181end;
4182
4183{ TLoadedKeyCommand }
4184
4185function TLoadedKeyCommand.IsShortcutADefault: boolean;
4186begin
4187  Result:=CompareIDEShortCuts(@ShortcutA,@DefaultShortcutA)=0;
4188end;
4189
4190function TLoadedKeyCommand.IsShortcutBDefault: boolean;
4191begin
4192  Result:=CompareIDEShortCuts(@ShortcutB,@DefaultShortcutB)=0;
4193end;
4194
4195function TLoadedKeyCommand.AsString: string;
4196begin
4197  Result:='Name="'+Name+'"'
4198    +' A='+KeyAndShiftStateToEditorKeyString(ShortcutA)
4199    +' DefA='+KeyAndShiftStateToEditorKeyString(DefaultShortcutA)
4200    +' B='+KeyAndShiftStateToEditorKeyString(ShortcutB)
4201    +' DefB='+KeyAndShiftStateToEditorKeyString(DefaultShortcutB)
4202    ;
4203end;
4204
4205initialization
4206  RegisterKeyCmdIdentProcs(@IdentToIDECommand,
4207                           @IDECommandToIdent);
4208
4209end.
4210
4211