activated menuintf and idescopes

git-svn-id: trunk@7820 -
This commit is contained in:
mattias 2005-09-25 11:52:16 +00:00
parent f0028c6138
commit 418c53918e
17 changed files with 93 additions and 966 deletions

View File

@ -480,7 +480,7 @@ end;
procedure TAnchorDesigner.KeyUp(var Key: Word; Shift: TShiftState);
begin
inherited KeyUp(Key, Shift);
ExecuteIDEShortCut(Self,Key,Shift,{$IFDEF UseIDEScopes}nil{$ELSE}caMenuOnly{$ENDIF});
ExecuteIDEShortCut(Self,Key,Shift,nil);
end;
procedure TAnchorDesigner.FillComboBoxWithSiblings(AComboBox: TComboBox);

View File

@ -457,7 +457,7 @@ end;
procedure TCodeExplorerView.KeyUp(var Key: Word; Shift: TShiftState);
begin
inherited KeyUp(Key, Shift);
ExecuteIDEShortCut(Self,Key,Shift,{$IFDEF UseIDEScopes}nil{$ELSE}caMenuOnly{$ENDIF});
ExecuteIDEShortCut(Self,Key,Shift,nil);
end;
procedure TCodeExplorerView.BeginUpdate;

View File

@ -326,7 +326,8 @@ begin
else
TemplateSynEdit.Highlighter:=nil;
EditorOpts.GetSynEditSettings(TemplateSynEdit);
EditorOpts.KeyMap.AssignTo(TemplateSynEdit.KeyStrokes,{$IFDEF UseIDEScopes}TSourceEditorWindowInterface{$ELSE}[caSourceEditor]{$ENDIF});
EditorOpts.KeyMap.AssignTo(TemplateSynEdit.KeyStrokes,
TSourceEditorWindowInterface);
TemplateSynEdit.Gutter.Visible:=false;
// init SynAutoComplete

View File

@ -1751,7 +1751,7 @@ end;
function TCustomFormEditor.TranslateKeyToDesignerCommand(Key: word;
Shift: TShiftState): word;
begin
Result:=EditorOpts.KeyMap.TranslateKey(Key,Shift,{$IFDEF UseIDEScopes}TDesignerIDECommandForm{$ELSE}[caDesigner]{$ENDIF});
Result:=EditorOpts.KeyMap.TranslateKey(Key,Shift,TDesignerIDECommandForm);
end;
Function TCustomFormEditor.CreateComponentInterface(

View File

@ -1442,15 +1442,12 @@ end;
procedure TDebugManager.SetupMainBarShortCuts;
{$IFDEF UseMenuIntf}
function GetCommand(ACommand: word): TIDECommand;
begin
Result:=IDECommandList.FindIDECommand(ACommand);
end;
{$ENDIF}
begin
{$IFDEF UseMenuIntf}
with MainIDEBar do
begin
itmViewWatches.Command:=GetCommand(ecToggleWatches);
@ -1463,20 +1460,6 @@ begin
itmRunMenuEvaluate.Command:=GetCommand(ecEvaluate);
itmRunMenuAddWatch.Command:=GetCommand(ecAddWatch);
end;
{$ELSE}
with MainIDEBar, EditorOpts.KeyMap do
begin
itmViewWatches.ShortCut := CommandToShortCut(ecToggleWatches);
itmViewBreakpoints.ShortCut := CommandToShortCut(ecToggleBreakPoints);
itmViewDebugOutput.ShortCut := CommandToShortCut(ecToggleDebuggerOut);
itmViewLocals.ShortCut := CommandToShortCut(ecToggleLocals);
itmViewCallStack.ShortCut := CommandToShortCut(ecToggleCallStack);
itmRunMenuInspect.ShortCut := CommandToShortCut(ecInspect);
itmRunMenuEvaluate.ShortCut := CommandToShortCut(ecEvaluate);
itmRunMenuAddWatch.ShortCut := CommandToShortCut(ecAddWatch);
end;
{$ENDIF}
end;
procedure TDebugManager.UpdateButtonsAndMenuItems;

View File

@ -2065,7 +2065,7 @@ begin
ASynEdit.MaxUndo:=fUndoLimit;
GetSynEditSelectedColor(ASynEdit);
KeyMap.AssignTo(ASynEdit.KeyStrokes,{$IFDEF UseIDEScopes}TSourceEditorWindowInterface{$ELSE}[caSourceEditor]{$ENDIF});
KeyMap.AssignTo(ASynEdit.KeyStrokes,TSourceEditorWindowInterface);
end;
procedure TEditorOptions.SetSynEditSettings(ASynEdit:TSynEdit);
@ -2140,7 +2140,7 @@ begin
ASynEdit.ExtraLineSpacing:=fExtraLineSpacing;
ASynEdit.ReadOnly:=true;
KeyMap.AssignTo(ASynEdit.KeyStrokes,{$IFDEF UseIDEScopes}TSourceEditorWindowInterface{$ELSE}[caSourceEditor]{$ENDIF});
KeyMap.AssignTo(ASynEdit.KeyStrokes,TSourceEditorWindowInterface);
end;
@ -2234,7 +2234,7 @@ begin
if EditorOpts.UseSyntaxHighlight then
Highlighter:=PreviewSyn;
EditorOpts.GetSynEditSettings(PreviewEdits[a]);
EditingKeyMap.AssignTo(PreviewEdits[a].KeyStrokes,{$IFDEF UseIDEScopes}TSourceEditorWindowInterface{$ELSE}[caSourceEditor]{$ENDIF});
EditingKeyMap.AssignTo(PreviewEdits[a].KeyStrokes,TSourceEditorWindowInterface);
if a<>3 then
begin
Lines.Text:=EditorOpts.HighlighterList[CurLanguageID].SampleSource;
@ -2749,7 +2749,7 @@ begin
for i:=Low(PreviewEdits) to High(PreviewEdits) do
if PreviewEdits[i]<>nil then
EditingKeyMap.AssignTo(PreviewEdits[i].KeyStrokes,
{$IFDEF UseIDEScopes}TSourceEditorWindowInterface{$ELSE}[caSourceEditor]{$ENDIF});
TSourceEditorWindowInterface);
end;
end;
end;
@ -2808,9 +2808,7 @@ var Protocol:TStringList;
begin
Protocol:=TStringList.Create;
try
ErrorCount:=KeyStrokesConsistencyErrors(
{$IFDEF UseIDEScopes}EditingKeyMap{$ELSE}DisplayPreview.KeyStrokes{$ENDIF}
,Protocol, Index1, Index2);
ErrorCount:=KeyStrokesConsistencyErrors(EditingKeyMap,Protocol,Index1,Index2);
if ErrorCount>0 then begin
KeyMapErrorsForm:=TKeyMapErrorsForm.Create(nil);
try

View File

@ -279,8 +279,7 @@ type
procedure Clear; override;
procedure Delete(Index: Integer); override;
constructor Create(const AName, ADescription: string;
{$IFDEF UseIDEScopes}TheScope: TIDECommandScope
{$ELSE}TheAreas: TCommandAreas{$ENDIF});
TheScope: TIDECommandScope);
end;
//---------------------------------------------------------------------------
@ -305,8 +304,7 @@ type
function GetRelation(Index:integer):TKeyCommandRelation;
function GetRelationCount:integer;
function AddCategory(const Name, Description: string;
{$IFDEF UseIDEScopes}TheScope: TIDECommandScope
{$ELSE}TheAreas: TCommandAreas{$ENDIF}): integer;
TheScope: TIDECommandScope): integer;
function Add(Category: TKeyCommandCategory; const Name: string;
Command:word; const TheKeyA, TheKeyB: TIDEShortCut):integer;
function AddDefault(Category: TKeyCommandCategory; const Name: string;
@ -319,30 +317,25 @@ type
procedure Clear;
function Count: integer;
function CategoryCount: integer;
function Find(Key: TIDEShortCut;
{$IFDEF UseIDEScopes}IDEWindowClass: TCustomFormClass{$ELSE}Areas: TCommandAreas{$ENDIF}
): TKeyCommandRelation;
function Find(Key: TIDEShortCut; IDEWindowClass: TCustomFormClass
): TKeyCommandRelation;
function FindIDECommand(ACommand:word): TIDECommand; override;
function FindByCommand(ACommand:word): TKeyCommandRelation;
function FindCategoryByName(const CategoryName: string): TKeyCommandCategory;
function FindCommandByName(const CommandName: string): TKeyCommandRelation;
function TranslateKey(Key: word; Shift: TShiftState;
{$IFDEF UseIDEScopes}IDEWindowClass: TCustomFormClass{$ELSE}Areas: TCommandAreas{$ENDIF};
UseLastKey: boolean = true
): word;
IDEWindowClass: TCustomFormClass; UseLastKey: boolean = true): word;
function IndexOf(ARelation: TKeyCommandRelation): integer;
function CommandToShortCut(ACommand: word): TShortCut;
function LoadFromXMLConfig(XMLConfig:TXMLConfig; const Prefix: String):boolean;
function SaveToXMLConfig(XMLConfig:TXMLConfig; const Prefix: String):boolean;
procedure AssignTo(ASynEditKeyStrokes:TSynEditKeyStrokes;
{$IFDEF UseIDEScopes}IDEWindowClass: TCustomFormClass
{$ELSE}Areas: TCommandAreas{$ENDIF});
IDEWindowClass: TCustomFormClass);
procedure Assign(List: TKeyCommandRelationList);
procedure LoadScheme(const SchemeName: string);
function CreateUniqueCategoryName(const AName: string): string;
function CreateUniqueCommandName(const AName: string): string;
function CreateNewCommandID: word;
{$IFDEF UseIDEScopes}
function CreateCategory(Parent: TIDECommandCategory;
const AName, Description: string;
Scope: TIDECommandScope): TIDECommandCategory; override;
@ -350,7 +343,6 @@ type
const AName, Description: string;
const TheShortcutA, TheShortcutB: TIDEShortCut
): TIDECommand; override;
{$ENDIF}
public
property ExtToolCount: integer read fExtToolCount write SetExtToolCount;// in menu
property Relations[Index:integer]:TKeyCommandRelation read GetRelation; default;
@ -385,9 +377,7 @@ type
procedure ActivateGrabbing(AGrabbingKey: integer);
procedure DeactivateGrabbing;
procedure SetComboBox(AComboBox: TComboBox; const AValue: string);
function ResolveConflicts(Key: TIDEShortCut;
{$IFDEF UseIDEScopes}Scope: TIDECommandScope{$ELSE}Areas: TCommandAreas{$ENDIF}
): boolean;
function ResolveConflicts(Key: TIDEShortCut; Scope: TIDECommandScope): boolean;
public
constructor Create(TheOwner: TComponent); override;
KeyCommandRelationList: TKeyCommandRelationList;
@ -398,13 +388,8 @@ function KeyAndShiftStateToEditorKeyString(Key: word; ShiftState: TShiftState):
function KeyAndShiftStateToEditorKeyString(Key: TIDEShortCut): String;
function ShowKeyMappingEditForm(Index:integer;
AKeyCommandRelationList:TKeyCommandRelationList):TModalResult;
{$IFDEF UseIDEScopes}
function KeyStrokesConsistencyErrors(Keymap: TKeyCommandRelationList;
Protocol: TStrings; var Index1,Index2:integer):integer;
{$ELSE}
function KeyStrokesConsistencyErrors(ASynEditKeyStrokes:TSynEditKeyStrokes;
Protocol: TStrings; var Index1,Index2:integer):integer;
{$ENDIF}
function EditorCommandToDescriptionString(cmd: word): String;
function EditorCommandLocalizedName(cmd: word;
const DefaultName: string): string;
@ -1635,7 +1620,6 @@ begin
end;
end;
{$IFDEF UseIDEScopes}
function KeyStrokesConsistencyErrors(Keymap: TKeyCommandRelationList;
Protocol: TStrings; var Index1,Index2:integer):integer;
// 0 = ok, no errors
@ -1696,51 +1680,6 @@ begin
end;
end;
end;
{$ELSE}
function KeyStrokesConsistencyErrors(ASynEditKeyStrokes:TSynEditKeyStrokes;
Protocol: TStrings; var Index1,Index2:integer):integer;
// 0 = ok, no errors
// >0 number of errors found
var
a,b:integer;
Key1,Key2:TSynEditKeyStroke;
begin
Result:=0;
for a:=0 to ASynEditKeyStrokes.Count-1 do begin
Key1:=ASynEditKeyStrokes[a];
for b:=a+1 to ASynEditKeyStrokes.Count-1 do begin
Key2:=ASynEditKeyStrokes[b];
if (Key1.Key=VK_UNKNOWN)
or (Key1.Command=Key2.Command)
then
continue;
if ((Key1.Key=Key2.Key) and (Key1.Shift=Key2.Shift))
and ((Key1.Key2=Key2.Key2) and (Key1.Shift2=Key2.Shift2))
then begin
// consistency error
if Result=0 then begin
Index1:=a;
Index2:=b;
end;
inc(Result);
if Protocol<>nil then
begin
Protocol.Add(srkmConflic+IntToStr(Result));
Protocol.Add(srkmCommand1
+EditorCommandToDescriptionString(Key1.Command)+'"'
+'->'+KeyAndShiftStateToEditorKeyString(Key1.Key, Key1.Shift));
Protocol.Add(srkmConflicW);
Protocol.Add(srkmCommand2
+EditorCommandToDescriptionString(Key2.Command)+'"'
+'->'+KeyAndShiftStateToEditorKeyString(Key2.Key, Key2.Shift)
);
Protocol.Add('');
end;
end;
end;
end;
end;
{$ENDIF}
function KeyAndShiftStateToEditorKeyString(Key: word; ShiftState: TShiftState): AnsiString;
var
@ -2033,7 +1972,7 @@ begin
end;
if not ResolveConflicts(NewKeyA,
CurRelation.Category.{$IFDEF UseIDEScopes}Scope{$ELSE}Areas{$ENDIF}) then
CurRelation.Category.Scope) then
begin
debugln('TKeyMappingEditForm.OkButtonClick ResolveConflicts failed for key1');
exit;
@ -2067,8 +2006,7 @@ begin
NewKeyB.Key2:=VK_UNKNOWN;
NewKeyB.Shift2:=[];
end
else if not ResolveConflicts(NewKeyB,
CurRelation.Category.{$IFDEF UseIDEScopes}Scope{$ELSE}Areas{$ENDIF})
else if not ResolveConflicts(NewKeyB,CurRelation.Category.Scope)
then begin
debugln('TKeyMappingEditForm.OkButtonClick ResolveConflicts failed for key1');
exit;
@ -2135,8 +2073,7 @@ begin
end;
function TKeyMappingEditForm.ResolveConflicts(Key: TIDEShortCut;
{$IFDEF UseIDEScopes}Scope: TIDECommandScope{$ELSE}Areas: TCommandAreas{$ENDIF}
): boolean;
Scope: TIDECommandScope): boolean;
type
TConflictType = (ctNone,ctConflictKeyA,ctConflictKeyB);
var
@ -2162,12 +2099,8 @@ begin
begin
if (j=KeyIndex) then continue;
{$IFDEF UseIDEScopes}
if not Category.ScopeIntersects(Scope) then continue;
{$ELSE}
if (Category.Areas*Areas=[]) then continue;
{$ENDIF}
if ((Key.Key1=ShortcutA.Key1) and (Key.Shift1=ShortcutA.Shift1))
and (((Key.Key2=ShortcutA.Key2) and (Key.Shift2=ShortcutA.Shift2))
or (Key.Key2=VK_UNKNOWN) or (ShortcutA.Key2=VK_UNKNOWN))
@ -2284,7 +2217,7 @@ begin
// moving
C:=Categories[AddCategory('CursorMoving',srkmCatCursorMoving,
{$IFDEF UseIDEScopes}IDECmdScopeSrcEditOnly{$ELSE}caSrcEdit{$ENDIF})];
IDECmdScopeSrcEditOnly)];
AddDefault(C,'Move cursor word left',ecWordLeft);
AddDefault(C,'Move cursor word right',ecWordRight);
AddDefault(C,'Move cursor to line start',ecLineStart);
@ -2303,7 +2236,8 @@ begin
AddDefault(C,'Scroll right one char',ecScrollRight);
// selection
C:=Categories[AddCategory('Selection',srkmCatSelection,{$IFDEF UseIDEScopes}IDECmdScopeSrcEditOnly{$ELSE}caSrcEditOnly{$ENDIF})];
C:=Categories[AddCategory('Selection',srkmCatSelection,
IDECmdScopeSrcEditOnly)];
AddDefault(C,'Copy selection to clipboard',ecCopy);
AddDefault(C,'Cut selection to clipboard',ecCut);
AddDefault(C,'Paste clipboard to current position',ecPaste);
@ -2337,7 +2271,8 @@ begin
AddDefault(C,'Select paragraph',ecSelectParagraph);
// editing - without menu items in the IDE bar
C:=Categories[AddCategory('text editing commands',srkmCatEditing,{$IFDEF UseIDEScopes}IDECmdScopeSrcEditOnly{$ELSE}caSrcEditOnly{$ENDIF})];
C:=Categories[AddCategory('text editing commands',srkmCatEditing,
IDECmdScopeSrcEditOnly)];
AddDefault(C,'Delete last char',ecDeleteLastChar);
AddDefault(C,'Delete char at cursor',ecDeleteChar);
AddDefault(C,'Delete to end of word',ecDeleteWord);
@ -2364,12 +2299,13 @@ begin
AddDefault(C,'Insert CVS keyword Source',ecInsertCVSSource);
// command commands
C:=Categories[AddCategory('CommandCommands',srkmCatCmdCmd,{$IFDEF UseIDEScopes}nil{$ELSE}caAll{$ENDIF})];
C:=Categories[AddCategory('CommandCommands',srkmCatCmdCmd,nil)];
AddDefault(C,'Undo',ecUndo);
AddDefault(C,'Redo',ecRedo);
// search & replace
C:=Categories[AddCategory('SearchReplace',srkmCatSearchReplace,{$IFDEF UseIDEScopes}IDECmdScopeSrcEditOnly{$ELSE}caSrcEditOnly{$ENDIF})];
C:=Categories[AddCategory('SearchReplace',srkmCatSearchReplace,
IDECmdScopeSrcEditOnly)];
AddDefault(C,'Go to matching bracket',ecMatchBracket);
AddDefault(C,'Find text',ecFind);
AddDefault(C,'Find next',ecFindNext);
@ -2387,7 +2323,7 @@ begin
AddDefault(C,'Open file at cursor',ecOpenFileAtCursor);
// marker - without menu items in the IDE bar
C:=Categories[AddCategory('Marker',srkmCatMarker,{$IFDEF UseIDEScopes}IDECmdScopeSrcEdit{$ELSE}caSrcEdit{$ENDIF})];
C:=Categories[AddCategory('Marker',srkmCatMarker,IDECmdScopeSrcEdit)];
AddDefault(C,'Set free Bookmark',ecSetFreeBookmark);
AddDefault(C,'Previous Bookmark',ecPrevBookmark);
AddDefault(C,'Next Bookmark',ecNextBookmark);
@ -2413,7 +2349,7 @@ begin
AddDefault(C,'Set marker 9',ecSetMarker9);
// codetools
C:=Categories[AddCategory('CodeTools',srkmCatCodeTools,{$IFDEF UseIDEScopes}IDECmdScopeSrcEdit{$ELSE}caSrcEdit{$ENDIF})];
C:=Categories[AddCategory('CodeTools',srkmCatCodeTools,IDECmdScopeSrcEdit)];
AddDefault(C,'Code template completion',ecAutoCompletion);
AddDefault(C,'Word completion',ecWordCompletion);
AddDefault(C,'Complete code',ecCompleteCode);
@ -2434,7 +2370,8 @@ begin
AddDefault(C,'Goto include directive',ecGotoIncludeDirective);
// source notebook - without menu items in the IDE bar
C:=Categories[AddCategory('SourceNotebook',srkmCatSrcNoteBook,{$IFDEF UseIDEScopes}IDECmdScopeSrcEdit{$ELSE}caSrcEdit{$ENDIF})];
C:=Categories[AddCategory('SourceNotebook',srkmCatSrcNoteBook,
IDECmdScopeSrcEdit)];
AddDefault(C,'Go to next editor',ecNextEditor);
AddDefault(C,'Go to prior editor',ecPrevEditor);
AddDefault(C,'Add break point',ecAddBreakPoint);
@ -2453,7 +2390,7 @@ begin
AddDefault(C,'Go to source editor 10',ecGotoEditor0);
// file menu
C:=Categories[AddCategory('FileMenu',srkmCatFileMenu,{$IFDEF UseIDEScopes}nil{$ELSE}caAll{$ENDIF})];
C:=Categories[AddCategory('FileMenu',srkmCatFileMenu,nil)];
AddDefault(C,'New',ecNew);
AddDefault(C,'NewUnit',ecNewUnit);
AddDefault(C,'NewForm',ecNewForm);
@ -2469,7 +2406,7 @@ begin
AddDefault(C,'Quit',ecQuit);
// view menu
C:=Categories[AddCategory('ViewMenu',srkmCatViewMenu,{$IFDEF UseIDEScopes}nil{$ELSE}caAll{$ENDIF})];
C:=Categories[AddCategory('ViewMenu',srkmCatViewMenu,nil)];
AddDefault(C,'Toggle view Object Inspector',ecToggleObjectInsp);
AddDefault(C,'Toggle view Source Editor',ecToggleSourceEditor);
AddDefault(C,'Toggle view Code Explorer',ecToggleCodeExpl);
@ -2489,7 +2426,7 @@ begin
AddDefault(C,'View Anchor Editor',ecViewAnchorEditor);
// project menu
C:=Categories[AddCategory('ProjectMenu',srkmCatProjectMenu,{$IFDEF UseIDEScopes}nil{$ELSE}caAll{$ENDIF})];
C:=Categories[AddCategory('ProjectMenu',srkmCatProjectMenu,nil)];
AddDefault(C,'New project',ecNewProject);
AddDefault(C,'New project from file',ecNewProjectFromFile);
AddDefault(C,'Open project',ecOpenProject);
@ -2504,7 +2441,7 @@ begin
AddDefault(C,'View project options',ecProjectOptions);
// run menu
C:=Categories[AddCategory('RunMenu',srkmCatRunMenu,{$IFDEF UseIDEScopes}nil{$ELSE}caAll{$ENDIF})];
C:=Categories[AddCategory('RunMenu',srkmCatRunMenu,nil)];
AddDefault(C,'Build project/program',ecBuild);
AddDefault(C,'Build all files of project/program',ecBuildAll);
AddDefault(C,'Abort building',ecAbortBuild);
@ -2525,7 +2462,7 @@ begin
AddDefault(C,'Add watch',ecAddWatch);
// components menu
C:=Categories[AddCategory('Components',srkmCatComponentsMenu,{$IFDEF UseIDEScopes}nil{$ELSE}caAll{$ENDIF})];
C:=Categories[AddCategory('Components',srkmCatComponentsMenu,nil)];
AddDefault(C,'Open package',ecOpenPackage);
AddDefault(C,'Open package file',ecOpenPackageFile);
AddDefault(C,'Open package of current unit',ecOpenPackageOfCurUnit);
@ -2535,7 +2472,7 @@ begin
AddDefault(C,'Configure custom components',ecConfigCustomComps);
// tools menu
C:=Categories[AddCategory(KeyCategoryToolMenuName,srkmCatToolMenu,{$IFDEF UseIDEScopes}nil{$ELSE}caAll{$ENDIF})];
C:=Categories[AddCategory(KeyCategoryToolMenuName,srkmCatToolMenu,nil)];
AddDefault(C,'External Tools settings',ecExtToolSettings);
AddDefault(C,'Build Lazarus',ecBuildLazarus);
AddDefault(C,'Configure "Build Lazarus"',ecConfigBuildLazarus);
@ -2546,7 +2483,7 @@ begin
AddDefault(C,'Convert Delphi project to Lazarus project',ecConvertDelphiProject);
// environment menu
C:=Categories[AddCategory('EnvironmentMenu',srkmCatEnvMenu,{$IFDEF UseIDEScopes}nil{$ELSE}caAll{$ENDIF})];
C:=Categories[AddCategory('EnvironmentMenu',srkmCatEnvMenu,nil)];
AddDefault(C,'General environment options',ecEnvironmentOptions);
AddDefault(C,'Editor options',ecEditorOptions);
AddDefault(C,'Edit Code Templates',ecEditCodeTemplates);
@ -2555,14 +2492,14 @@ begin
AddDefault(C,'Rescan FPC source directory',ecRescanFPCSrcDir);
// help menu
C:=Categories[AddCategory('HelpMenu',srkmCarHelpMenu,{$IFDEF UseIDEScopes}nil{$ELSE}caAll{$ENDIF})];
C:=Categories[AddCategory('HelpMenu',srkmCarHelpMenu,nil)];
AddDefault(C,'About Lazarus',ecAboutLazarus);
AddDefault(C,'Online Help',ecOnlineHelp);
AddDefault(C,'Configure Help',ecConfigureHelp);
AddDefault(C,'Context sensitive help',ecContextHelp);
// designer - without menu items in the IDE bar (at least no direct)
C:=Categories[AddCategory('Designer',lisKeyCatDesigner,{$IFDEF UseIDEScopes}IDECmdScopeDesignerOnly{$ELSE}caDesignOnly{$ENDIF})];
C:=Categories[AddCategory('Designer',lisKeyCatDesigner,IDECmdScopeDesignerOnly)];
AddDefault(C,'Copy selected Components to clipboard',ecDesignerCopy);
AddDefault(C,'Cut selected Components to clipboard' ,ecDesignerCut);
AddDefault(C,'Paste Components from clipboard' ,ecDesignerPaste);
@ -2573,7 +2510,7 @@ begin
AddDefault(C,'Move component one back' ,ecDesignerBackOne);
// custom keys (for experts, task groups, dynamic menu items, etc)
C:=Categories[AddCategory(KeyCategoryCustomName,lisKeyCatCustom,{$IFDEF UseIDEScopes}nil{$ELSE}caAll{$ENDIF})];
C:=Categories[AddCategory(KeyCategoryCustomName,lisKeyCatCustom,nil)];
end;
procedure TKeyCommandRelationList.Clear;
@ -2770,20 +2707,15 @@ begin
end;
function TKeyCommandRelationList.Find(Key: TIDEShortCut;
{$IFDEF UseIDEScopes}IDEWindowClass: TCustomFormClass{$ELSE}Areas: TCommandAreas{$ENDIF}
): TKeyCommandRelation;
IDEWindowClass: TCustomFormClass): TKeyCommandRelation;
var
a:integer;
begin
Result:=nil;
if Key.Key1=VK_UNKNOWN then exit;
for a:=0 to FRelations.Count-1 do with Relations[a] do begin
{$IFDEF UseIDEScopes}
if (Category.Scope<>nil)
and (not Category.Scope.HasIDEWindowClass(IDEWindowClass)) then continue;
{$ELSE}
if Category.Areas*Areas=[] then continue;
{$ENDIF}
if ((ShortcutA.Key1=Key.Key1) and (ShortcutA.Shift1=Key.Shift1) and
(ShortcutA.Key2=Key.Key2) and (ShortcutA.Shift2=Key.Shift2))
or ((ShortcutB.Key1=Key.Key1) and (ShortcutB.Shift1=Key.Shift1) and
@ -2814,9 +2746,7 @@ begin
end;
procedure TKeyCommandRelationList.AssignTo(
ASynEditKeyStrokes: TSynEditKeyStrokes;
{$IFDEF UseIDEScopes}IDEWindowClass: TCustomFormClass{$ELSE}Areas: TCommandAreas{$ENDIF}
);
ASynEditKeyStrokes: TSynEditKeyStrokes; IDEWindowClass: TCustomFormClass);
var
a,b,MaxKeyCnt,KeyCnt:integer;
Key: TSynEditKeyStroke;
@ -2825,12 +2755,8 @@ begin
for a:=0 to FRelations.Count-1 do begin
CurRelation:=Relations[a];
if (CurRelation.ShortcutA.Key1=VK_UNKNOWN)
{$IFDEF UseIDEScopes}
or ((IDEWindowClass<>nil) and (CurRelation.Category.Scope<>nil)
and (not CurRelation.Category.Scope.HasIDEWindowClass(IDEWindowClass)))
{$ELSE}
or ((CurRelation.Category.Areas*Areas)=[])
{$ENDIF}
then
MaxKeyCnt:=0
else if CurRelation.ShortcutB.Key1=VK_UNKNOWN then
@ -2895,8 +2821,7 @@ begin
// copy categories
for i:=0 to List.CategoryCount-1 do begin
CurCategory:=List.Categories[i];
AddCategory(CurCategory.Name,CurCategory.Description,
CurCategory.{$IFDEF UseIDEScopes}Scope{$ELSE}Areas{$ENDIF});
AddCategory(CurCategory.Name,CurCategory.Description,CurCategory.Scope);
end;
// copy keys
@ -2959,7 +2884,6 @@ begin
while FindByCommand(Result)<>nil do inc(Result);
end;
{$IFDEF UseIDEScopes}
function TKeyCommandRelationList.CreateCategory(Parent: TIDECommandCategory;
const AName, Description: string; Scope: TIDECommandScope): TIDECommandCategory;
begin
@ -2976,7 +2900,6 @@ begin
CreateNewCommandID,TheShortcutA,TheShortcutB)];
Result.LocalizedName:=Description;
end;
{$ENDIF}
function TKeyCommandRelationList.GetCategory(Index: integer): TKeyCommandCategory;
begin
@ -2989,11 +2912,10 @@ begin
end;
function TKeyCommandRelationList.AddCategory(const Name, Description: string;
{$IFDEF UseIDEScopes}TheScope: TIDECommandScope
{$ELSE}TheAreas: TCommandAreas{$ENDIF}): integer;
TheScope: TIDECommandScope): integer;
begin
Result:=fCategories.Add(TKeyCommandCategory.Create(Name,Description,
{$IFDEF UseIDEScopes}TheScope{$ELSE}TheAreas{$ENDIF}));
TheScope));
end;
function TKeyCommandRelationList.FindCategoryByName(const CategoryName: string
@ -3021,9 +2943,7 @@ begin
end;
function TKeyCommandRelationList.TranslateKey(Key: word; Shift: TShiftState;
{$IFDEF UseIDEScopes}IDEWindowClass: TCustomFormClass{$ELSE}Areas: TCommandAreas{$ENDIF};
UseLastKey: boolean
): word;
IDEWindowClass: TCustomFormClass; UseLastKey: boolean): word;
{ If UseLastKey = true then only search for commmands with one key.
If UseLastKey = false then search first for a command with a two keys
combination (i.e. the last key plus this one)
@ -3038,7 +2958,7 @@ begin
// => try a two key combination command
fLastKey.Key2 := Key;
fLastKey.Shift2 := Shift;
ARelation := Find(fLastKey,{$IFDEF UseIDEScopes}IDEWindowClass{$ELSE}Areas{$ENDIF});
ARelation := Find(fLastKey,IDEWindowClass);
end else begin
ARelation := nil;
end;
@ -3049,7 +2969,7 @@ begin
fLastKey.Shift1 := Shift;
fLastKey.Key2 := VK_UNKNOWN;
fLastKey.Shift2 := [];
ARelation := Find(fLastKey,{$IFDEF UseIDEScopes}IDEWindowClass{$ELSE}Areas{$ENDIF});
ARelation := Find(fLastKey,IDEWindowClass);
end;
if ARelation<>nil then
begin
@ -3097,17 +3017,12 @@ begin
end;
constructor TKeyCommandCategory.Create(const AName, ADescription: string;
{$IFDEF UseIDEScopes}TheScope: TIDECommandScope
{$ELSE}TheAreas: TCommandAreas{$ENDIF});
TheScope: TIDECommandScope);
begin
inherited Create;
FName:=AName;
FDescription:=ADescription;
{$IFDEF UseIDEScopes}
FScope:=TheScope;
{$ELSE}
FAreas:=TheAreas;
{$ENDIF}
end;

View File

@ -291,8 +291,7 @@ type
var Handled: boolean);
procedure OnExecuteIDEShortCut(Sender: TObject;
var Key: word; Shift: TShiftState;
{$IFDEF UseIDEScopes}IDEWindowClass: TCustomFormClass
{$ELSE}TheAreas: TCommandAreas{$ENDIF});
IDEWindowClass: TCustomFormClass);
procedure OnExecuteIDECommand(Sender: TObject; Command: word);
// Environment options dialog events
@ -563,9 +562,6 @@ type
var Handled: boolean; Data: TObject);
public
{$IFNDEF UseMenuIntf}
CustomExtToolMenuSeparator: TMenuItem;
{$ENDIF}
CurDefinesCompilerFilename: String;
CurDefinesCompilerOptions: String;
class procedure ParseCmdLineOptions;
@ -1169,7 +1165,7 @@ end;
procedure TMainIDE.OIRemainingKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
OnExecuteIDEShortCut(Sender,Key,Shift,{$IFDEF UseIDEScopes}nil{$ELSE}caDesign{$ENDIF});
OnExecuteIDEShortCut(Sender,Key,Shift,nil);
end;
procedure TMainIDE.OIOnAddToFavourites(Sender: TObject);
@ -1940,9 +1936,6 @@ begin
itmToolBuildLazarus.OnClick := @mnuToolBuildLazarusClicked;
itmToolConfigureBuildLazarus.OnClick := @mnuToolConfigBuildLazClicked;
end;
{$IFNDEF UseMenuIntf}
CustomExtToolMenuSeparator:=nil;
{$ENDIF}
UpdateCustomToolsInMenu;
end;
@ -2082,7 +2075,7 @@ procedure TMainIDE.mnuOpenRecentClicked(Sender: TObject);
var
AFilename: string;
begin
AFileName:=ExpandFilename({$IFDEF UseMenuIntf}(Sender as TIDEMenuItem){$ELSE}TMenuItem(Sender){$ENDIF}.Caption);
AFileName:=ExpandFilename((Sender as TIDEMenuItem).Caption);
if DoOpenEditorFile(AFilename,-1,[ofAddToRecent])=mrOk then begin
UpdateEnvironment;
end else begin
@ -2392,20 +2385,12 @@ end;
procedure TMainIDE.OnExecuteIDEShortCut(Sender: TObject; var Key: word;
Shift: TShiftState;
{$IFDEF UseIDEScopes}IDEWindowClass: TCustomFormClass{$ELSE}TheAreas: TCommandAreas{$ENDIF});
IDEWindowClass: TCustomFormClass);
var
// CommandRelation: TKeyCommandRelation;
// Handled: Boolean;
Command: Word;
Handled: Boolean;
begin
// CommandRelation:=EditorOpts.KeyMap.Find(Key,Shift,Areas);
// if (CommandRelation=nil) or (CommandRelation.Command=ecNone) then exit;
// Handled:=false;
// OnProcessIDECommand(Sender,CommandRelation.Command,Handled);
// if Handled then Key:=VK_UNKNOWN;
//debugln('TMainIDE.OnExecuteIDEShortCut Key '+dbgs(Key)+' pressed');
Command := EditorOpts.KeyMap.TranslateKey(Key,Shift,{$IFDEF UseIDEScopes}IDEWindowClass{$ELSE}TheAreas{$ENDIF});
Command := EditorOpts.KeyMap.TranslateKey(Key,Shift,IDEWindowClass);
if (Command = ecNone) then exit;
Handled := false;
OnProcessIDECommand(Sender, Command, Handled);
@ -2782,8 +2767,8 @@ begin
finally
OpenDialog.Free;
end;
end else if Sender is {$IFDEF UseMenuIntf}TIDEMenuItem{$ELSE}TMenuItem{$ENDIF} then begin
AFileName:=ExpandFilename((Sender as {$IFDEF UseMenuIntf}TIDEMenuItem{$ELSE}TMenuItem{$ENDIF}).Caption);
end else if Sender is TIDEMenuItem then begin
AFileName:=ExpandFilename(TIDEMenuItem(Sender).Caption);
if DoOpenProjectFile(AFilename,[ofAddToRecent])=mrOk then begin
AddRecentProjectFileToEnvironment(AFilename);
end else begin
@ -3147,13 +3132,8 @@ procedure TMainIDE.mnuCustomExtToolClick(Sender: TObject);
var
Index: integer;
begin
{$IFDEF UseMenuIntf}
if not (Sender is TIDEMenuItem) then exit;
Index:=MainIDEBar.itmCustomTools.IndexOf(TIDEMenuItem(Sender))-1;
{$ELSE}
if CustomExtToolMenuSeparator=nil then exit;
Index:=TMenuItem(Sender).MenuIndex-CustomExtToolMenuSeparator.MenuIndex-1;
{$ENDIF}
if (Index<0) or (Index>=EnvironmentOptions.ExternalTools.Count) then exit;
DoRunExternalTool(Index);
end;
@ -7797,7 +7777,6 @@ var
ToolCount: integer;
procedure CreateToolMenuItems;
{$IFDEF UseMenuIntf}
var
Section: TIDEMenuSection;
begin
@ -7810,70 +7789,22 @@ var
while Section.Count-1>ToolCount do
Section[Section.Count-1].Free;
end;
{$ELSE}
var
CurMenuItem: TMenuItem;
LastIndex, FirstIndex, ExistingCount: integer;
begin
// add separator
if (ToolCount>0) and (CustomExtToolMenuSeparator=nil) then begin
CustomExtToolMenuSeparator:=CreateMenuSeparator;
MainIDEBar.mnuTools.Add(CustomExtToolMenuSeparator);
end;
// add enough menuitems
if CustomExtToolMenuSeparator=nil then exit;
FirstIndex:=CustomExtToolMenuSeparator.MenuIndex+1;
LastIndex:=FirstIndex;
while (LastIndex<MainIDEBar.mnuTools.Count)
and (MainIDEBar.mnuTools[LastIndex].Caption<>'-') do
inc(LastIndex);
ExistingCount:=LastIndex-FirstIndex;
while ExistingCount<ToolCount do begin
CurMenuItem := TMenuItem.Create(OwningComponent);
CurMenuItem.Name:='itmToolCustomExt'+IntToStr(ExistingCount);
CurMenuItem.Caption:=CurMenuItem.Name;
MainIDEBar.mnuTools.Insert(LastIndex,CurMenuItem);
inc(LastIndex);
inc(ExistingCount);
end;
// delete unneeded menuitems
while ExistingCount>ToolCount do begin
MainIDEBar.mnuTools[LastIndex-1].Free;
dec(LastIndex);
dec(ExistingCount);
end;
end;
{$ENDIF}
procedure SetToolMenuItems;
var
CurMenuItem: {$IFDEF UseMenuIntf}TIDEMenuItem{$ELSE}TMenuItem{$ENDIF};
CurMenuItem: TIDEMenuItem;
i, Index: integer;
ExtTool: TExternalToolOptions;
begin
{$IFDEF UseMenuIntf}
i:=1;
{$ELSE}
if CustomExtToolMenuSeparator=nil then exit;
i:=CustomExtToolMenuSeparator.MenuIndex+1;
{$ENDIF}
Index:=0;
while (i<MainIDEBar.{$IFDEF UseMenuIntf}itmCustomTools{$ELSE}mnuTools{$ENDIF}.Count) do begin
{$IFDEF UseMenuIntf}
while (i<MainIDEBar.itmCustomTools.Count) do begin
CurMenuItem:=MainIDEBar.itmCustomTools[i];
{$ELSE}
CurMenuItem:=MainIDEBar.mnuTools[i];
if CurMenuItem.Caption='-' then break;
{$ENDIF}
ExtTool:=EnvironmentOptions.ExternalTools[Index];
CurMenuItem.Caption:=ExtTool.Title;
{$IFDEF UseMenuIntf}
if CurMenuItem is TIDEMenuCommand then
TIDEMenuCommand(CurMenuItem).Command:=
EditorOpts.KeyMap.FindIDECommand(ecExtToolFirst+Index);
{$ELSE}
CurMenuItem.ShortCut:=ShortCut(ExtTool.Key,ExtTool.Shift);
{$ENDIF}
CurMenuItem.OnClick:=@mnuCustomExtToolClick;
inc(i);
inc(Index);

View File

@ -64,7 +64,6 @@ type
StepOverSpeedButton : TSpeedButton;
OpenFilePopUpMenu : TPopupMenu;
{$IFDEF UseMenuIntf}
// MainMenu
mnuMainMenu: TMainMenu;
@ -306,210 +305,6 @@ type
itmHelpConfigureHelp: TIDEMenuCommand;
itmInfoHelps: TIDEMenuSection;
itmHelpAboutLazarus: TIDEMenuCommand;
{$ELSE}
// MainMenu
mnuMain: TMainMenu;
mnuFile: TMenuItem;
mnuEdit: TMenuItem;
mnuSearch: TMenuItem;
mnuView: TMenuItem;
mnuProject: TMenuItem;
mnuRun: TMenuItem;
mnuComponents: TMenuItem;
mnuTools: TMenuItem;
mnuEnvironment: TMenuItem;
mnuWindows: TMenuItem;
mnuHelp: TMenuItem;
// file menu
itmFileNewUnit: TMenuItem;
itmFileNewForm: TMenuItem;
itmFileNewOther: TMenuItem;
itmFileOpen: TMenuItem;
itmFileRevert: TMenuItem;
itmFileRecentOpen: TMenuItem;
itmFileSave: TMenuItem;
itmFileSaveAs: TMenuItem;
itmFileSaveAll: TMenuItem;
itmFileClose: TMenuItem;
itmFileCloseAll: TMenuItem;
itmFileCleanDirectory: TMenuItem;
itmFileRestart: TMenuItem;
itmFileQuit: TMenuItem;
// edit menu
itmEditUndo: TMenuItem;
itmEditRedo: TMenuItem;
itmEditCut: TMenuItem;
itmEditCopy: TMenuItem;
itmEditPaste: TMenuItem;
itmEditIndentBlock: TMenuItem;
itmEditUnindentBlock: TMenuItem;
itmEditEncloseBlock: TMenuItem;
itmEditUpperCaseBlock: TMenuItem;
itmEditLowerCaseBlock: TMenuItem;
itmEditTabsToSpacesBlock: TMenuItem;
itmEditCommentBlock: TMenuItem;
itmEditUncommentBlock: TMenuItem;
itmEditConditionalBlock: TMenuItem;
itmEditSortBlock: TMenuItem;
itmEditSelectionBreakLines: TMenuItem;
itmEditSelect: TMenuItem;
itmEditSelectAll: TMenuItem;
itmEditSelectToBrace: TMenuItem;
itmEditSelectCodeBlock: TMenuItem;
itmEditSelectLine: TMenuItem;
itmEditSelectParagraph: TMenuItem;
itmEditInsertCharacter: TMenuItem;
itmEditInsertText: TMenuItem;
itmEditCompleteCode: TMenuItem;
itmEditExtractProc: TMenuItem;
itmEditInsertCVSKeyWord: TMenuItem;
itmEditInsertGeneral: TMenuItem;
itmEditInsertCVSAuthor: TMenuItem;
itmEditInsertCVSDate: TMenuItem;
itmEditInsertCVSHeader: TMenuItem;
itmEditInsertCVSID: TMenuItem;
itmEditInsertCVSLog: TMenuItem;
itmEditInsertCVSName: TMenuItem;
itmEditInsertCVSRevision: TMenuItem;
itmEditInsertCVSSource: TMenuItem;
itmEditInsertGPLNotice: TMenuItem;
itmEditInsertLGPLNotice: TMenuItem;
itmEditInsertUsername: TMenuItem;
itmEditInsertDateTime: TMenuItem;
itmEditInsertChangeLogEntry: TMenuItem;
// search menu
itmSearchFind: TMenuItem;
itmSearchFindNext: TMenuItem;
itmSearchFindPrevious: TMenuItem;
itmSearchFindInFiles: TMenuItem;
itmSearchFindIdentifierRefs: TMenuItem;
itmSearchReplace: TMenuItem;
itmSearchRenameIdentifier: TMenuItem;
itmIncrementalFind: TMenuItem;
itmGotoLine: TMenuItem;
itmJumpBack: TMenuItem;
itmJumpForward: TMenuItem;
itmAddJumpPoint: TMenuItem;
itmJumpHistory: TMenuItem;
itmJumpToNextError: TMenuItem;
itmJumpToPrevError: TMenuItem;
itmSetFreeBookmark: TMenuItem;
itmJumpToNextBookmark: TMenuItem;
itmJumpToPrevBookmark: TMenuItem;
itmFindBlockOtherEnd: TMenuItem;
itmFindBlockStart: TMenuItem;
itmFindDeclaration: TMenuItem;
itmOpenFileAtCursor: TMenuItem;
itmGotoIncludeDirective: TMenuItem;
// view menu
itmViewInspector: TMenuItem;
itmViewSourceEditor: TMenuItem;
itmViewCodeExplorer : TMenuItem;
itmViewLazDoc: TMenuItem; //DBlaszijk 5-sep-05
itmViewUnits : TMenuItem;
itmViewForms : TMenuItem;
itmViewUnitDependencies : TMenuItem;
itmViewUnitInfo: TMenuItem;
itmViewAnchorEditor : TMenuItem;
itmViewMessage : TMenuItem;
itmViewSearchResults : TMenuItem;
itmViewToggleFormUnit: TMenuItem;
itmViewDebugWindows: TMenuItem;
itmViewWatches: TMenuItem;
itmViewBreakpoints: TMenuItem;
itmViewLocals: TMenuItem;
itmViewCallStack: TMenuItem;
itmViewDebugOutput: TMenuItem;
// project menu
itmProjectNew: TMenuItem;
itmProjectNewFromFile: TMenuItem;
itmProjectOpen: TMenuItem;
itmProjectRecentOpen: TMenuItem;
itmProjectSave: TMenuItem;
itmProjectSaveAs: TMenuItem;
itmProjectPublish: TMenuItem;
itmProjectInspector: TMenuItem;
itmProjectAddTo: TMenuItem;
itmProjectRemoveFrom: TMenuItem;
itmProjectViewSource: TMenuItem;
itmProjectViewToDos: TMenuItem;
itmProjectOptions: TMenuItem;
itmProjectCompilerOptions: TMenuItem;
{$IFDEF TRANSLATESTRING}
itmProjectCreatePoFiles:TMenuItem;
itmProjectCollectPoFiles:TMenuItem;
{$ENDIF}
// run menu
itmRunMenuBuild: TMenuItem;
itmRunMenuBuildAll: TMenuItem;
itmRunMenuAbortBuild: TMenuItem;
itmRunMenuRun: TMenuItem;
itmRunMenuPause: TMenuItem;
itmRunMenuStepInto: TMenuItem;
itmRunMenuStepOver: TMenuItem;
itmRunMenuRunToCursor: TMenuItem;
itmRunMenuStop: TMenuItem;
itmRunMenuRunParameters: TMenuItem;
itmRunMenuResetDebugger: TMenuItem;
itmRunMenuBuildFile: TMenuItem;
itmRunMenuRunFile: TMenuItem;
itmRunMenuConfigBuildFile: TMenuItem;
itmRunMenuInspect: TMenuItem;
itmRunMenuEvaluate: TMenuItem;
itmRunMenuAddWatch: TMenuItem;
itmRunMenuAddBreakpoint: TMenuItem;
itmRunMenuAddBpSource: TMenuItem;
// components menu
itmPkgOpenPackage: TMenuItem;
itmPkgOpenPackageFile: TMenuItem;
itmPkgOpenPackageOfCurUnit: TMenuItem;
itmPkgOpenRecent: TMenuItem;
itmPkgAddCurUnitToPkg: TMenuItem;
itmPkgPkgGraph: TMenuItem;
itmPkgEditInstallPkgs: TMenuItem;
{$IFDEF CustomIDEComps}
itmCompsConfigCustomComps: TMenuItem;
{$ENDIF}
// tools menu
itmToolConfigure: TMenuItem;
itmToolSyntaxCheck: TMenuItem;
itmToolGuessUnclosedBlock: TMenuItem;
itmToolGuessMisplacedIFDEF: TMenuItem;
itmToolCheckLFM: TMenuItem;
itmToolConvertDelphiUnit: TMenuItem;
itmToolConvertDelphiProject: TMenuItem;
itmToolConvertDFMtoLFM: TMenuItem;
itmToolMakeResourceString: TMenuItem;
itmToolDiff: TMenuItem;
itmToolBuildLazarus: TMenuItem;
itmToolConfigureBuildLazarus: TMenuItem;
// environment menu
itmEnvGeneralOptions: TMenuItem;
itmEnvEditorOptions: TMenuItem;
itmEnvCodeTemplates: TMenuItem;
itmEnvDebuggerOptions: TMenuItem;
itmEnvCodeToolsOptions: TMenuItem;
itmEnvCodeToolsDefinesEditor: TMenuItem;
itmEnvRescanFPCSrcDir: TMenuItem;
// help menu
itmHelpAboutLazarus: TMenuItem;
itmHelpOnlineHelp: TMenuItem;
itmHelpConfigureHelp: TMenuItem;
{$ENDIF}
// component palette
ComponentNotebook : TNotebook;

View File

@ -82,7 +82,6 @@ type
OwningComponent: TComponent;
function CreateMenuSeparator : TMenuItem;
{$IFDEF UseMenuIntf}
procedure CreateMenuItem(Section: TIDEMenuSection;
var MenuItem: TIDEMenuCommand;
const MenuItemName, MenuItemCaption: String;
@ -96,18 +95,6 @@ type
const bmpName: String = '');
procedure CreateMainMenuItem(var Section: TIDEMenuSection;
const MenuItemName, MenuItemCaption: String);
{$ELSE}
procedure CreateMenuItem(MenuItemParent, MenuItem: TMenuItem;
const MenuItemName, MenuItemCaption: String);
procedure CreateMenuItem(MenuItemParent, MenuItem: TMenuItem;
const MenuItemName, MenuItemCaption: String;
const bmpName: String);
procedure CreateMenuItem(MenuItemParent, MenuItem: TMenuItem;
const MenuItemName, MenuItemCaption: String;
const bmpName: String; mnuEnabled: Boolean);
procedure CreateMainMenuItem(MainMenu: TMainMenu; var MenuItem: TMenuItem;
const MenuItemName, MenuItemCaption: String);
{$ENDIF}
procedure SetupMainMenu; virtual;
procedure SetupFileMenu; virtual;
procedure SetupEditMenu; virtual;
@ -168,9 +155,7 @@ type
): TModalResult; override;
procedure UpdateWindowsMenu; override;
procedure SetRecentSubMenu({$IFDEF UseMenuIntf}Section: TIDEMenuSection;
{$ELSE}Section: TMenuItem;{$ENDIF}
FileList: TStringList;
procedure SetRecentSubMenu(Section: TIDEMenuSection; FileList: TStringList;
OnClickEvent: TNotifyEvent); override;
function DoJumpToCodePosition(
@ -223,7 +208,8 @@ var
begin
i:=Screen.CustomFormCount-1;
while (i>=0) do begin
if Screen.CustomForms[i].Caption=(Sender as {$IFDEF UseMenuIntf}TIDEMenuCommand{$ELSE}TMenuItem{$ENDIF}).Caption then begin
if Screen.CustomForms[i].Caption=(Sender as TIDEMenuCommand).Caption then
begin
Screen.CustomForms[i].BringToFront;
break;
end;
@ -291,7 +277,6 @@ begin
Result.Caption := '-';
end;
{$IFDEF UseMenuIntf}
procedure TMainIDEBase.CreateMenuItem(Section: TIDEMenuSection;
var MenuItem: TIDEMenuCommand; const MenuItemName, MenuItemCaption: String;
const bmpName: String; mnuEnabled: Boolean);
@ -325,47 +310,9 @@ begin
Section:=RegisterIDESubMenu(MainIDEBar.mnuMain.GetPath,MenuItemName,
MenuItemCaption);
end;
{$ELSE}
procedure TMainIDEBase.CreateMenuItem(MenuItemParent, MenuItem: TMenuItem;
const MenuItemName, MenuItemCaption: String);
begin
CreateMenuItem(MenuItemParent,MenuItem,MenuItemName,MenuItemCaption,'');
end;
procedure TMainIDEBase.CreateMenuItem(MenuItemParent, MenuItem: TMenuItem;
const MenuItemName, MenuItemCaption: String; const bmpName: String);
begin
CreateMenuItem(MenuItemParent,MenuItem,MenuItemName,MenuItemCaption,bmpName,
true);
end;
procedure TMainIDEBase.CreateMenuItem(MenuItemParent, MenuItem: TMenuItem;
const MenuItemName, MenuItemCaption: String; const bmpName: String;
mnuEnabled: Boolean);
begin
MenuItem:=TMenuItem.Create(MainIDEBar);
MenuItem.Name:=MenuItemName;
MenuItem.Caption := MenuItemCaption;
if not mnuEnabled then
MenuItem.enabled:=mnuEnabled;
if bmpName<>'' then
MenuItem.Bitmap.LoadFromLazarusResource(bmpName);
MenuItemParent.Add(MenuItem);
end;
procedure TMainIDEBase.CreateMainMenuItem(MainMenu: TMainMenu;
var MenuItem: TMenuItem; const MenuItemName, MenuItemCaption: String);
begin
MenuItem:=TMenuItem.Create(MainIDEBar);
MenuItem.Name:=MenuItemName;
MenuItem.Caption := MenuItemCaption;
MainMenu.items.Add(MenuItem);
end;
{$ENDIF}
procedure TMainIDEBase.SetupMainMenu;
begin
{$IFDEF UseMenuIntf}
MainIDEBar.mnuMainMenu := TMainMenu.Create(MainIDEBar);
with MainIDEBar do begin
mnuMain:=RegisterIDEMenuRoot('IDEMainMenu',mnuMainMenu.Items);
@ -381,77 +328,39 @@ begin
CreateMainMenuItem(mnuWindows,'Windows',lisMenuWindows);
CreateMainMenuItem(mnuHelp,'Help',lisMenuHelp);
end;
{$ELSE}
MainIDEBar.mnuMain := TMainMenu.Create(MainIDEBar);
with MainIDEBar do begin
mnuMain.Name:='mnuMainMenu';
Menu := mnuMain;
CreateMainMenuItem(mnuMain,mnuFile,'mnuFile',lisMenuFile);
CreateMainMenuItem(mnuMain,mnuEdit,'mnuEdit',lisMenuEdit);
CreateMainMenuItem(mnuMain,mnuSearch,'mnuSearch',lisMenuSearch);
CreateMainMenuItem(mnuMain,mnuView,'mnuView',lisMenuView);
CreateMainMenuItem(mnuMain,mnuProject,'mnuProject',lisMenuProject);
CreateMainMenuItem(mnuMain,mnuRun,'mnuRun',lisMenuRun);
CreateMainMenuItem(mnuMain,mnuComponents,'mnuComponents',lisMenuComponents);
CreateMainMenuItem(mnuMain,mnuTools,'mnuTools',lisMenuTools);
CreateMainMenuItem(mnuMain,mnuEnvironment,'mnuEnvironment',lisMenuEnvironent);
CreateMainMenuItem(mnuMain,mnuWindows,'mnuWindows',lisMenuWindows);
CreateMainMenuItem(mnuMain,mnuHelp,'mnuHelp',lisMenuHelp);
end;
{$ENDIF}
end;
procedure TMainIDEBase.SetupFileMenu;
var
ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF};
ParentMI: TIDEMenuSection;
begin
with MainIDEBar do begin
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuFile,itmFileNew,'itmFileNew');
ParentMI:=itmFileNew;
{$ELSE}
ParentMI:=mnuFile;
{$ENDIF}
CreateMenuItem(ParentMI,itmFileNewUnit,'itmFileNewUnit',lisMenuNewUnit,'menu_new');
CreateMenuItem(ParentMI,itmFileNewForm,'itmFileNewForm',lisMenuNewForm,'menu_new');
CreateMenuItem(ParentMI,itmFileNewOther,'itmFileNewOther',lisMenuNewOther,'menu_new');
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuFile,itmFileOpenSave,'itmFileOpenSave');
ParentMI:=itmFileOpenSave;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmFileOpen,'itmFileOpen',lisMenuOpen,'menu_open');
CreateMenuItem(ParentMI,itmFileRevert,'itmFileRevert',lisMenuRevert,'menu_undo');
{$IFDEF UseMenuIntf}
CreateMenuSubSection(ParentMI,itmFileRecentOpen,'itmFileRecentOpen',lisMenuOpenRecent);
{$ELSE}
CreateMenuItem(ParentMI,itmFileRecentOpen,'itmFileRecentOpen',lisMenuOpenRecent);
{$ENDIF}
CreateMenuItem(ParentMI,itmFileSave,'itmFileSave',lisMenuSave,'menu_save');
CreateMenuItem(ParentMI,itmFileSaveAs,'itmFileSaveAs',lisMenuSaveAs,'menu_save');
CreateMenuItem(ParentMI,itmFileSaveAll,'itmFileSaveAll',lisMenuSaveAll,'menu_save');
CreateMenuItem(ParentMI,itmFileClose,'itmFileClose',lisMenuClose,'menu_close',false);
CreateMenuItem(ParentMI,itmFileCloseAll,'itmFileCloseAll',lisMenuCloseAll,'',false);
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuFile,itmFileDirectories,'itmFileDirectories');
ParentMI:=itmFileDirectories;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmFileCleanDirectory,'itmFileCleanDirectory',lisMenuCleanDirectory);
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuFile,itmFileIDEStart,'itmFileIDEStart');
ParentMI:=itmFileIDEStart;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmFileRestart,'itmFileRestart',lisMenuRestart);
CreateMenuItem(ParentMI,itmFileQuit,'itmFileQuit',lisMenuQuit);
@ -460,37 +369,25 @@ end;
procedure TMainIDEBase.SetupEditMenu;
var
ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF};
SubParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF};
SubSubParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF};
ParentMI: TIDEMenuSection;
SubParentMI: TIDEMenuSection;
SubSubParentMI: TIDEMenuSection;
begin
with MainIDEBar do begin
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuEdit,itmEditReUndo,'itmEditReUndo');
ParentMI:=itmEditReUndo;
{$ELSE}
ParentMI:=mnuEdit;
{$ENDIF}
CreateMenuItem(ParentMI,itmEditUndo,'itmEditUndo',lisMenuUndo,'menu_undo');
CreateMenuItem(ParentMI,itmEditRedo,'itmEditRedo',lisMenuRedo,'menu_redo');
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuEdit,itmEditClipboard,'itmEditClipboard');
ParentMI:=itmEditClipboard;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmEditCut,'itmEditCut',lisMenuCut,'menu_cut');
CreateMenuItem(ParentMI,itmEditCopy,'itmEditCopy',lisMenuCopy,'menu_copy');
CreateMenuItem(ParentMI,itmEditPaste,'itmEditPaste',lisMenuPaste,'menu_paste');
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuEdit,itmEditBlockIndentation,'itmEditBlockIndentation');
ParentMI:=itmEditBlockIndentation;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmEditIndentBlock,'itmEditIndentBlock',lisMenuIndentSelection,'menu_indent');
CreateMenuItem(ParentMI,itmEditUnindentBlock,'itmEditUnindentBlock',lisMenuUnindentSelection,'menu_unindent');
@ -500,23 +397,15 @@ begin
CreateMenuItem(ParentMI,itmEditConditionalBlock,'itmEditConditionalBlock',lisMenuConditionalSelection);
CreateMenuItem(ParentMI,itmEditSortBlock,'itmEditSortBlock',lisMenuSortSelection);
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuEdit,itmEditBlockCharConversion,'itmEditBlockCharConversion');
ParentMI:=itmEditBlockCharConversion;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmEditUpperCaseBlock,'itmEditUpperCaseBlock',lisMenuUpperCaseSelection);
CreateMenuItem(ParentMI,itmEditLowerCaseBlock,'itmEditLowerCaseBlock',lisMenuLowerCaseSelection);
CreateMenuItem(ParentMI,itmEditTabsToSpacesBlock,'itmEditTabsToSpacesBlock',lisMenuTabsToSpacesSelection);
CreateMenuItem(ParentMI,itmEditSelectionBreakLines,'itmEditSelectionBreakLines',lisMenuBeakLinesInSelection);
{$IFDEF UseMenuIntf}
CreateMenuSubSection(mnuEdit,itmEditSelect,'itmEditSelect',lisMenuSelect);
{$ELSE}
CreateMenuItem(ParentMI,itmEditSelect,'itmEditSelect',lisMenuSelect);
{$ENDIF}
begin
// select sub menu items
SubParentMI:=itmEditSelect;
@ -527,27 +416,15 @@ begin
CreateMenuItem(SubParentMI,itmEditSelectParagraph,'itmEditSelectParagraph',lisMenuSelectParagraph);
end;
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuEdit,itmEditInsertions,'itmEditInsertions');
ParentMI:=itmEditInsertions;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmEditInsertCharacter,'itmEditInsertCharacter',lisMenuInsertCharacter);
{$IFDEF UseMenuIntf}
CreateMenuSubSection(ParentMI,itmEditInsertText,'itmEditInsertText',lisMenuInsertText);
{$ELSE}
CreateMenuItem(ParentMI,itmEditInsertText,'itmEditInsertText',lisMenuInsertText);
{$ENDIF}
begin
// insert text sub menu items
SubParentMI:=itmEditInsertText;
{$IFDEF UseMenuIntf}
CreateMenuSubSection(SubParentMI,itmEditInsertCVSKeyWord,'itmEditInsertCVSKeyWord',lisMenuInsertCVSKeyword);
{$ELSE}
CreateMenuItem(SubParentMI,itmEditInsertCVSKeyWord,'itmEditInsertCVSKeyWord',lisMenuInsertCVSKeyword);
{$ENDIF}
begin
// insert CVS keyword sub menu items
SubSubParentMI:=itmEditInsertCVSKeyWord;
@ -561,11 +438,7 @@ begin
CreateMenuItem(SubSubParentMI,itmEditInsertCVSSource,'itmEditInsertCVSSource','Source');
end;
{$IFDEF UseMenuIntf}
CreateMenuSubSection(SubParentMI,itmEditInsertGeneral,'itmEditInsertGeneral',lisMenuInsertGeneral);
{$ELSE}
CreateMenuItem(SubParentMI,itmEditInsertGeneral,'itmEditInsertGeneral',lisMenuInsertGeneral);
{$ENDIF}
begin
// insert general text sub menu items
SubSubParentMI:=itmEditInsertGeneral;
@ -577,12 +450,8 @@ begin
end;
end;
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuEdit,itmEditMenuCodeTools,'itmEditMenuCodeTools');
ParentMI:=itmEditMenuCodeTools;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmEditCompleteCode,'itmEditCompleteCode',lisMenuCompleteCode);
CreateMenuItem(ParentMI,itmEditExtractProc,'itmEditExtractProc',lisMenuExtractProc);
@ -591,15 +460,11 @@ end;
procedure TMainIDEBase.SetupSearchMenu;
var
ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF};
ParentMI: TIDEMenuSection;
begin
with MainIDEBar do begin
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuSearch,itmSearchFindReplace,'itmSearchFindReplace');
ParentMI:=itmSearchFindReplace;
{$ELSE}
ParentMI:=mnuSearch;
{$ENDIF}
CreateMenuItem(ParentMI,itmSearchFind,'itmSearchFind',lisMenuFind);
CreateMenuItem(ParentMI,itmSearchFindNext,'itmSearchFindNext',lisMenuFindNext);
@ -609,12 +474,8 @@ begin
CreateMenuItem(ParentMI,itmIncrementalFind,'itmIncrementalFind',lisMenuIncrementalFind);
CreateMenuItem(ParentMI,itmGotoLine,'itmGotoLine',lisMenuGotoLine);
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuSearch,itmJumpings,'itmJumpings');
ParentMI:=itmJumpings;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmJumpBack,'itmJumpBack',lisMenuJumpBack);
CreateMenuItem(ParentMI,itmJumpForward,'itmJumpForward',lisMenuJumpForward);
@ -623,23 +484,15 @@ begin
CreateMenuItem(ParentMI,itmJumpToNextError,'itmJumpToNextError',lisMenuJumpToNextError);
CreateMenuItem(ParentMI,itmJumpToPrevError,'itmJumpToPrevError',lisMenuJumpToPrevError);
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuSearch,itmBookmarks,'itmBookmarks');
ParentMI:=itmBookmarks;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmSetFreeBookmark,'itmSetFreeBookmark',lisMenuSetFreeBookmark);
CreateMenuItem(ParentMI,itmJumpToNextBookmark,'itmJumpToNextBookmark',lisMenuJumpToNextBookmark);
CreateMenuItem(ParentMI,itmJumpToPrevBookmark,'itmJumpToPrevBookmark',lisMenuJumpToPrevBookmark);
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuSearch,itmCodeToolSearches,'itmCodeToolSearches');
ParentMI:=itmCodeToolSearches;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmFindBlockOtherEnd,'itmFindBlockOtherEnd',lisMenuFindBlockOtherEndOfCodeBlock);
CreateMenuItem(ParentMI,itmFindBlockStart,'itmFindBlockStart',lisMenuFindCodeBlockStart);
@ -653,27 +506,19 @@ end;
procedure TMainIDEBase.SetupViewMenu;
var
ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF};
ParentMI: TIDEMenuSection;
begin
with MainIDEBar do begin
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuView,itmViewMainWindows,'itmViewMainWindows');
ParentMI:=itmViewMainWindows;
{$ELSE}
ParentMI:=mnuView;
{$ENDIF}
CreateMenuItem(ParentMI,itmViewInspector,'itmViewInspector',lisMenuViewObjectInspector);
CreateMenuItem(ParentMI,itmViewSourceEditor,'itmViewSourceEditor',lisMenuViewSourceEditor);
CreateMenuItem(ParentMI,itmViewCodeExplorer,'itmViewCodeExplorer',lisMenuViewCodeExplorer);
CreateMenuItem(ParentMI,itmViewLazDoc,'itmViewLazDoc',lisMenuLazDoc); //DBlaszijk 5-sep-05
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuView,itmViewUnitWindows,'itmViewUnitWindows');
ParentMI:=itmViewUnitWindows;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmViewUnits,'itmViewUnits',lisMenuViewUnits);
CreateMenuItem(ParentMI,itmViewForms,'itmViewForms',lisMenuViewForms);
@ -681,21 +526,13 @@ begin
CreateMenuItem(ParentMI,itmViewUnitInfo,'itmViewUnitInfo',lisMenuViewUnitInfo);
CreateMenuItem(ParentMI,itmViewToggleFormUnit,'itmViewToggleFormUnit',lisMenuViewToggleFormUnit);
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuView,itmViewSecondaryWindows,'itmViewSecondaryWindows');
ParentMI:=itmViewSecondaryWindows;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmViewMessage,'itmViewMessage',lisMenuViewMessages);
CreateMenuItem(ParentMI,itmViewSearchResults,'itmViewSearchResults',lisMenuViewSearchResults);
CreateMenuItem(ParentMI,itmViewAnchorEditor,'itmViewAnchorEditor',lisMenuViewAnchorEditor);
{$IFDEF UseMenuIntf}
CreateMenuSubSection(ParentMI,itmViewDebugWindows,'itmViewDebugWindows',lisMenuDebugWindows,'menu_debugger');
{$ELSE}
CreateMenuItem(ParentMI,itmViewDebugWindows,'itmViewDebugWindows',lisMenuDebugWindows,'menu_debugger');
{$ENDIF}
begin
CreateMenuItem(itmViewDebugWindows,itmViewWatches,'itmViewWatches',lisMenuViewWatches,'menu_watches');
CreateMenuItem(itmViewDebugWindows,itmViewBreakPoints,'itmViewBreakPoints',lisMenuViewBreakPoints,'menu_breakpoints');
@ -708,74 +545,46 @@ end;
procedure TMainIDEBase.SetupProjectMenu;
var
ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF};
ParentMI: TIDEMenuSection;
begin
with MainIDEBar do begin
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuProject,itmProjectNewSection,'itmProjectNewSection');
ParentMI:=itmProjectNewSection;
{$ELSE}
ParentMI:=mnuProject;
{$ENDIF}
CreateMenuItem(ParentMI,itmProjectNew,'itmProjectNew',lisMenuNewProject);
CreateMenuItem(ParentMI,itmProjectNewFromFile,'itmProjectNewFromFile',lisMenuNewProjectFromFile);
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuProject,itmProjectOpenSection,'itmProjectOpenSection');
ParentMI:=itmProjectOpenSection;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmProjectOpen,'itmProjectOpen',lisMenuOpenProject,'menu_openproject');
{$IFDEF UseMenuIntf}
CreateMenuSubSection(ParentMI,itmProjectRecentOpen,'itmProjectRecentOpen',lisMenuOpenRecentProject);
{$ELSE}
CreateMenuItem(ParentMI,itmProjectRecentOpen,'itmProjectRecentOpen',lisMenuOpenRecentProject);
{$ENDIF}
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuProject,itmProjectSaveSection,'itmProjectSaveSection');
ParentMI:=itmProjectSaveSection;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmProjectSave,'itmProjectSave',lisMenuSaveProject);
CreateMenuItem(ParentMI,itmProjectSaveAs,'itmProjectSaveAs',lisMenuSaveProjectAs);
CreateMenuItem(ParentMI,itmProjectPublish,'itmProjectPublish',lisMenuPublishProject);
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuProject,itmProjectWindowSection,'itmProjectWindowSection');
ParentMI:=itmProjectWindowSection;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmProjectInspector,'itmProjectInspector',lisMenuProjectInspector,'menu_projectinspector');
CreateMenuItem(ParentMI,itmProjectOptions,'itmProjectOptions',lisMenuProjectOptions,'menu_projectoptions');
CreateMenuItem(ParentMI,itmProjectCompilerOptions,'itmProjectCompilerOptions',lisMenuCompilerOptions);
CreateMenuItem(ParentMI,itmProjectViewToDos,'itmProjectViewToDos',lisMenuViewProjectTodos);
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuProject,itmProjectAddRemoveSection,'itmProjectAddRemoveSection');
ParentMI:=itmProjectAddRemoveSection;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmProjectAddTo,'itmProjectAddTo',lisMenuAddToProject);
CreateMenuItem(ParentMI,itmProjectRemoveFrom,'itmProjectRemoveFrom',lisMenuRemoveFromProject);
CreateMenuItem(ParentMI,itmProjectViewSource,'itmProjectViewSource',lisMenuViewSource);
{$IFDEF TRANSLATESTRING}
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuProject,itmProjectPoFileSection,'itmProjectPoFileSection');
ParentMI:=itmProjectPoFileSection;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI, itmProjectCreatePoFiles,'itmProjectCreatePoFiles', lisMenuCreatePoFile);
CreateMenuItem(ParentMI, itmProjectCollectPoFiles, 'itmProjectCollectPoFiles', lisMenuCollectPoFil);
{$ENDIF}
@ -784,26 +593,18 @@ end;
procedure TMainIDEBase.SetupRunMenu;
var
ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF};
ParentMI: TIDEMenuSection;
begin
with MainIDEBar do begin
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuRun,itmRunBuilding,'itmRunBuilding');
ParentMI:=itmRunBuilding;
{$ELSE}
ParentMI:=mnuRun;
{$ENDIF}
CreateMenuItem(ParentMI,itmRunMenuBuild,'itmRunMenuBuild',lisMenuBuild,'menu_build');
CreateMenuItem(ParentMI,itmRunMenuBuildAll,'itmRunMenuBuildAll',lisMenuBuildAll,'menu_buildall');
CreateMenuItem(ParentMI,itmRunMenuAbortBuild,'itmRunMenuAbortBuild',lisMenuAbortBuild);
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuRun,itmRunnning,'itmRunnning');
ParentMI:=itmRunnning;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmRunMenuRun,'itmRunMenuRun',lisMenuProjectRun,'menu_run');
CreateMenuItem(ParentMI,itmRunMenuPause,'itmRunMenuPause',lisMenuPause,'menu_pause');
@ -814,81 +615,49 @@ begin
CreateMenuItem(ParentMI,itmRunMenuRunParameters,'itmRunMenuRunParameters',lisMenuRunParameters);
CreateMenuItem(ParentMI,itmRunMenuResetDebugger,'itmRunMenuResetDebugger',lisMenuResetDebugger);
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuRun,itmRunBuildingFile,'itmRunBuildingFile');
ParentMI:=itmRunBuildingFile;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmRunMenuBuildFile,'itmRunMenuBuildFile',lisMenuBuildFile);
CreateMenuItem(ParentMI,itmRunMenuRunFile,'itmRunMenuRunFile',lisMenuRunFile);
CreateMenuItem(ParentMI,itmRunMenuConfigBuildFile,'itmRunMenuConfigBuildFile',lisMenuConfigBuildFile);
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuRun,itmRunDebugging,'itmRunDebugging');
ParentMI:=itmRunDebugging;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmRunMenuInspect,'itmRunMenuInspect',lisMenuInspect, '', False);
CreateMenuItem(ParentMI,itmRunMenuEvaluate,'itmRunMenuEvaluate',lisMenuEvaluate, '', False);
CreateMenuItem(ParentMI,itmRunMenuAddWatch,'itmRunMenuAddWatch',lisMenuAddWatch, '', False);
{$IFDEF UseMenuIntf}
CreateMenuSubSection(ParentMI,itmRunMenuAddBreakpoint,'itmRunMenuAddBreakpoint',lisMenuAddBreakpoint, '');
{$ELSE}
CreateMenuItem(ParentMI,itmRunMenuAddBreakpoint,'itmRunMenuAddBreakpoint',lisMenuAddBreakpoint, '');
{$ENDIF}
CreateMenuItem(itmRunMenuAddBreakpoint,itmRunMenuAddBPSource,'itmRunMenuAdddBPSource',lisMenuAddBPSource, '', False);
end;
end;
procedure TMainIDEBase.SetupComponentsMenu;
var
ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF};
ParentMI: TIDEMenuSection;
begin
with MainIDEBar do begin
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuComponents,itmPkgOpening,'itmPkgOpening');
ParentMI:=itmPkgOpening;
{$ELSE}
ParentMI:=mnuComponents;
{$ENDIF}
CreateMenuItem(ParentMI,itmPkgOpenPackage,'itmPkgOpenPackage',lisMenuOpenPackage,'pkg_package');
CreateMenuItem(ParentMI,itmPkgOpenPackageFile,'itmPkgOpenPackageFile',lisMenuOpenPackageFile,'pkg_package');
CreateMenuItem(ParentMI,itmPkgOpenPackageOfCurUnit,'itmPkgOpenPackageOfCurUnit',lisMenuOpenPackageOfCurUnit,'pkg_package');
{$IFDEF UseMenuIntf}
CreateMenuSubSection(ParentMI,itmPkgOpenRecent,'itmPkgOpenRecent',lisMenuOpenRecentPkg,'pkg_package');
{$ELSE}
CreateMenuItem(ParentMI,itmPkgOpenRecent,'itmPkgOpenRecent',lisMenuOpenRecentPkg,'pkg_package');
{$ENDIF}
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuComponents,itmPkgUnits,'itmPkgUnits');
ParentMI:=itmPkgUnits;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmPkgAddCurUnitToPkg,'itmPkgAddCurUnitToPkg',lisMenuAddCurUnitToPkg,'pkg_addunittopackage');
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuComponents,itmPkgGraphSection,'itmPkgGraphSection');
ParentMI:=itmPkgGraphSection;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmPkgPkgGraph,'itmPkgPkgGraph',lisMenuPackageGraph,'pkg_packagegraph');
CreateMenuItem(ParentMI,itmPkgEditInstallPkgs,'itmPkgEditInstallPkgs',lisMenuEditInstallPkgs,'pkg_package_install');
{$IFDEF CustomIDEComps}
{$IFDEF UseMenuIntf}
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmCompsConfigCustomComps,'itmCompsConfigCustomComps',lisMenuConfigCustomComps);
{$ENDIF}
end;
@ -896,57 +665,37 @@ end;
procedure TMainIDEBase.SetupToolsMenu;
var
ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF};
ParentMI: TIDEMenuSection;
begin
with MainIDEBar do begin
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuTools,itmCustomTools,'itmCustomTools');
ParentMI:=itmCustomTools;
{$ELSE}
ParentMI:=mnuTools;
{$ENDIF}
CreateMenuItem(ParentMI,itmToolConfigure,'itmToolConfigure',lisMenuSettings);
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuTools,itmCodeToolChecks,'itmCodeToolChecks');
ParentMI:=itmCodeToolChecks;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmToolSyntaxCheck,'itmToolSyntaxCheck',lisMenuQuickSyntaxCheck);
CreateMenuItem(ParentMI,itmToolGuessUnclosedBlock,'itmToolGuessUnclosedBlock',lisMenuGuessUnclosedBlock);
CreateMenuItem(ParentMI,itmToolGuessMisplacedIFDEF,'itmToolGuessMisplacedIFDEF',lisMenuGuessMisplacedIFDEF);
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuTools,itmSecondaryTools,'itmSecondaryTools');
ParentMI:=itmSecondaryTools;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmToolMakeResourceString,'itmToolMakeResourceString',lisMenuMakeResourceString);
CreateMenuItem(ParentMI,itmToolDiff,'itmToolDiff',lisMenuDiff);
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuTools,itmDelphiConversion,'itmDelphiConversion');
ParentMI:=itmDelphiConversion;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmToolCheckLFM,'itmToolCheckLFM',lisMenuCheckLFM);
CreateMenuItem(ParentMI,itmToolConvertDelphiUnit,'itmToolConvertDelphiUnit',lisMenuConvertDelphiUnit);
CreateMenuItem(ParentMI,itmToolConvertDelphiProject,'itmToolConvertDelphiProject',lisMenuConvertDelphiProject);
CreateMenuItem(ParentMI,itmToolConvertDFMtoLFM,'itmToolConvertDFMtoLFM',lisMenuConvertDFMtoLFM);
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuTools,itmBuildingLazarus,'itmBuildingLazarus');
ParentMI:=itmBuildingLazarus;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmToolBuildLazarus,'itmToolBuildLazarus',lisMenuBuildLazarus,'menu_buildlazarus');
CreateMenuItem(ParentMI,itmToolConfigureBuildLazarus,'itmToolConfigureBuildLazarus',lisMenuConfigureBuildLazarus);
@ -955,15 +704,11 @@ end;
procedure TMainIDEBase.SetupEnvironmentMenu;
var
ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF};
ParentMI: TIDEMenuSection;
begin
with MainIDEBar do begin
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuEnvironment,itmOptionsDialogs,'itmOptionsDialogs');
ParentMI:=itmOptionsDialogs;
{$ELSE}
ParentMI:=mnuEnvironment;
{$ENDIF}
CreateMenuItem(ParentMI,itmEnvGeneralOptions,'itmEnvGeneralOptions',
lisMenuGeneralOptions,'menu_environmentoptions');
@ -979,12 +724,8 @@ begin
'itmEnvCodeToolsDefinesEditor',lisMenuCodeToolsDefinesEditor,
'menu_codetoolsdefineseditor');
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuEnvironment,itmIDECacheSection,'itmIDECacheSection');
ParentMI:=itmIDECacheSection;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmEnvRescanFPCSrcDir,'itmEnvRescanFPCSrcDir',
lisMenuRescanFPCSourceDirectory);
@ -998,27 +739,19 @@ end;
procedure TMainIDEBase.SetupHelpMenu;
var
ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF};
ParentMI: TIDEMenuSection;
begin
with MainIDEBar do begin
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuHelp,itmOnlineHelps,'itmOnlineHelps');
ParentMI:=itmOnlineHelps;
{$ELSE}
ParentMI:=mnuHelp;
{$ENDIF}
CreateMenuItem(ParentMI,itmHelpOnlineHelp,'itmHelpOnlineHelp',
lisMenuOnlineHelp);
CreateMenuItem(ParentMI,itmHelpConfigureHelp,'itmHelpConfigureHelp',
lisMenuConfigureHelp);
{$IFDEF UseMenuIntf}
CreateMenuSeparatorSection(mnuHelp,itmInfoHelps,'itmInfoHelps');
ParentMI:=itmInfoHelps;
{$ELSE}
ParentMI.Add(CreateMenuSeparator);
{$ENDIF}
CreateMenuItem(ParentMI,itmHelpAboutLazarus,'itmHelpAboutLazarus',
lisMenuAboutLazarus);
@ -1027,15 +760,12 @@ end;
procedure TMainIDEBase.LoadMenuShortCuts;
{$IFDEF UseMenuIntf}
function GetCommand(ACommand: word): TIDECommand;
begin
Result:=IDECommandList.FindIDECommand(ACommand);
end;
{$ENDIF}
begin
{$IFDEF UseMenuIntf}
with MainIDEBar do begin
// file menu
itmFileNewUnit.Command:=GetCommand(ecNewUnit);
@ -1199,171 +929,6 @@ begin
itmHelpOnlineHelp.Command:=GetCommand(ecOnlineHelp);
itmHelpConfigureHelp.Command:=GetCommand(ecConfigureHelp);
end;
{$ELSE}
with MainIDEBar, EditorOpts.KeyMap do begin
// file menu
itmFileNewUnit.ShortCut:=CommandToShortCut(ecNewUnit);
itmFileNewForm.ShortCut:=CommandToShortCut(ecNewForm);
itmFileNewOther.ShortCut:=CommandToShortCut(ecNew);
itmFileOpen.ShortCut:=CommandToShortCut(ecOpen);
itmFileRevert.ShortCut:=CommandToShortCut(ecRevert);
itmFileSave.ShortCut:=CommandToShortCut(ecSave);
itmFileSaveAs.ShortCut:=CommandToShortCut(ecSaveAs);
itmFileSaveAll.ShortCut:=CommandToShortCut(ecSaveAll);
itmFileClose.ShortCut:=CommandToShortCut(ecClose);
itmFileCloseAll.ShortCut:=CommandToShortCut(ecCloseAll);
itmFileCleanDirectory.ShortCut:=CommandToShortCut(ecCleanDirectory);
itmFileQuit.ShortCut:=CommandToShortCut(ecQuit);
itmFileQuit.ShortCut:=CommandToShortCut(ecQuit);
// edit menu
itmEditUndo.ShortCut:=CommandToShortCut(ecUndo);
itmEditRedo.ShortCut:=CommandToShortCut(ecRedo);
itmEditCut.ShortCut:=CommandToShortCut(ecCut);
itmEditCopy.ShortCut:=CommandToShortCut(ecCopy);
itmEditPaste.ShortCut:=CommandToShortCut(ecPaste);
itmEditIndentBlock.ShortCut:=CommandToShortCut(ecBlockIndent);
itmEditUnindentBlock.ShortCut:=CommandToShortCut(ecBlockUnindent);
itmEditEncloseBlock.ShortCut:=CommandToShortCut(ecSelectionEnclose);
itmEditUpperCaseBlock.ShortCut:=CommandToShortCut(ecSelectionUpperCase);
itmEditLowerCaseBlock.ShortCut:=CommandToShortCut(ecSelectionLowerCase);
itmEditTabsToSpacesBlock.ShortCut:=CommandToShortCut(ecSelectionTabs2Spaces);
itmEditCommentBlock.ShortCut:=CommandToShortCut(ecSelectionComment);
itmEditUncommentBlock.ShortCut:=CommandToShortCut(ecSelectionUncomment);
itmEditConditionalBlock.ShortCut:=CommandToShortCut(ecSelectionConditional);
itmEditSortBlock.ShortCut:=CommandToShortCut(ecSelectionSort);
itmEditSelectionBreakLines.ShortCut:=CommandToShortCut(ecSelectionBreakLines);
itmEditSelectAll.ShortCut:=CommandToShortCut(ecSelectAll);
itmEditSelectToBrace.ShortCut:=CommandToShortCut(ecSelectToBrace);
itmEditSelectCodeBlock.ShortCut:=CommandToShortCut(ecSelectCodeBlock);
itmEditSelectLine.ShortCut:=CommandToShortCut(ecSelectLine);
itmEditSelectParagraph.ShortCut:=CommandToShortCut(ecSelectParagraph);
itmEditCompleteCode.ShortCut:=CommandToShortCut(ecCompleteCode);
itmEditExtractProc.ShortCut:=CommandToShortCut(ecExtractProc);
itmEditInsertCVSAuthor.ShortCut:=CommandToShortCut(ecInsertCVSAuthor);
itmEditInsertCVSDate.ShortCut:=CommandToShortCut(ecInsertCVSDate);
itmEditInsertCVSHeader.ShortCut:=CommandToShortCut(ecInsertCVSHeader);
itmEditInsertCVSID.ShortCut:=CommandToShortCut(ecInsertCVSID);
itmEditInsertCVSLog.ShortCut:=CommandToShortCut(ecInsertCVSLog);
itmEditInsertCVSName.ShortCut:=CommandToShortCut(ecInsertCVSName);
itmEditInsertCVSRevision.ShortCut:=CommandToShortCut(ecInsertCVSRevision);
itmEditInsertCVSSource.ShortCut:=CommandToShortCut(ecInsertCVSSource);
itmEditInsertGPLNotice.ShortCut:=CommandToShortCut(ecInsertGPLNotice);
itmEditInsertLGPLNotice.ShortCut:=CommandToShortCut(ecInsertLGPLNotice);
itmEditInsertUsername.ShortCut:=CommandToShortCut(ecInsertUserName);
itmEditInsertDateTime.ShortCut:=CommandToShortCut(ecInsertDateTime);
itmEditInsertChangeLogEntry.ShortCut:=CommandToShortCut(ecInsertChangeLogEntry);
// search menu
itmSearchFind.ShortCut:=CommandToShortCut(ecFind);
itmSearchFindNext.ShortCut:=CommandToShortCut(ecFindNext);
itmSearchFindPrevious.ShortCut:=CommandToShortCut(ecFindPrevious);
itmSearchFindInFiles.ShortCut:=CommandToShortCut(ecFindInFiles);
itmSearchFindIdentifierRefs.ShortCut:=CommandToShortCut(ecFindIdentifierRefs);
itmSearchReplace.ShortCut:=CommandToShortCut(ecReplace);
itmSearchRenameIdentifier.ShortCut:=CommandToShortCut(ecRenameIdentifier);
itmIncrementalFind.ShortCut:=CommandToShortCut(ecIncrementalFind);
itmGotoLine.ShortCut:=CommandToShortCut(ecGotoLineNumber);
itmJumpBack.ShortCut:=CommandToShortCut(ecJumpBack);
itmJumpForward.ShortCut:=CommandToShortCut(ecJumpForward);
itmAddJumpPoint.ShortCut:=CommandToShortCut(ecAddJumpPoint);
itmJumpHistory.ShortCut:=CommandToShortCut(ecViewJumpHistory);
itmJumpToNextError.ShortCut:=CommandToShortCut(ecJumpToNextError);
itmJumpToPrevError.ShortCut:=CommandToShortCut(ecJumpToPrevError);
itmSetFreeBookmark.ShortCut:=CommandToShortCut(ecSetFreeBookmark);
itmJumpToNextBookmark.ShortCut:=CommandToShortCut(ecNextBookmark);
itmJumpToPrevBookmark.ShortCut:=CommandToShortCut(ecPrevBookmark);
itmFindBlockOtherEnd.ShortCut:=CommandToShortCut(ecFindBlockOtherEnd);
itmFindBlockStart.ShortCut:=CommandToShortCut(ecFindBlockStart);
itmFindDeclaration.ShortCut:=CommandToShortCut(ecFindDeclaration);
itmOpenFileAtCursor.ShortCut:=CommandToShortCut(ecOpenFileAtCursor);
itmGotoIncludeDirective.ShortCut:=CommandToShortCut(ecGotoIncludeDirective);
// view menu
itmViewInspector.ShortCut:=CommandToShortCut(ecToggleObjectInsp);
itmViewSourceEditor.ShortCut:=CommandToShortCut(ecToggleSourceEditor);
itmViewUnits.ShortCut:=CommandToShortCut(ecViewUnits);
itmViewCodeExplorer.ShortCut:=CommandToShortCut(ecToggleCodeExpl);
//itmViewLazDoc.ShortCut:=CommandToShortCut(ecLazDoc); //DBlaszijk 5-sep-05
itmViewUnitDependencies.ShortCut:=CommandToShortCut(ecViewUnitDependencies);
itmViewUnitInfo.ShortCut:=CommandToShortCut(ecViewUnitInfo);
itmViewForms.ShortCut:=CommandToShortCut(ecViewForms);
itmViewToggleFormUnit.ShortCut:=CommandToShortCut(ecToggleFormUnit);
itmViewMessage.ShortCut:=CommandToShortCut(ecToggleMessages);
itmViewSearchResults.ShortCut:=CommandToShortCut(ecToggleSearchResults);
itmViewAnchorEditor.ShortCut:=CommandToShortCut(ecViewAnchorEditor);
// project menu
itmProjectNew.ShortCut:=CommandToShortCut(ecNewProject);
itmProjectNewFromFile.ShortCut:=CommandToShortCut(ecNewProjectFromFile);
itmProjectOpen.ShortCut:=CommandToShortCut(ecOpenProject);
itmProjectSave.ShortCut:=CommandToShortCut(ecSaveProject);
itmProjectSaveAs.ShortCut:=CommandToShortCut(ecSaveProjectAs);
itmProjectPublish.ShortCut:=CommandToShortCut(ecPublishProject);
itmProjectInspector.ShortCut:=CommandToShortCut(ecProjectInspector);
itmProjectOptions.ShortCut:=CommandToShortCut(ecProjectOptions);
itmProjectCompilerOptions.ShortCut:=CommandToShortCut(ecCompilerOptions);
itmProjectAddTo.ShortCut:=CommandToShortCut(ecAddCurUnitToProj);
itmProjectRemoveFrom.ShortCut:=CommandToShortCut(ecRemoveFromProj);
itmProjectViewSource.ShortCut:=CommandToShortCut(ecViewProjectSource);
// run menu
itmRunMenuBuild.ShortCut:=CommandToShortCut(ecBuild);
itmRunMenuBuildAll.ShortCut:=CommandToShortCut(ecBuildAll);
itmRunMenuAbortBuild.ShortCut:=CommandToShortCut(ecAbortBuild);
itmRunMenuRun.ShortCut:=CommandToShortCut(ecRun);
itmRunMenuPause.ShortCut:=CommandToShortCut(ecPause);
itmRunMenuStepInto.ShortCut:=CommandToShortCut(ecStepInto);
itmRunMenuStepOver.ShortCut:=CommandToShortCut(ecStepOver);
itmRunMenuRunToCursor.ShortCut:=CommandToShortCut(ecRunToCursor);
itmRunMenuStop.ShortCut:=CommandToShortCut(ecStopProgram);
itmRunMenuResetDebugger.ShortCut:=CommandToShortCut(ecResetDebugger);
itmRunMenuRunParameters.ShortCut:=CommandToShortCut(ecRunParameters);
itmRunMenuBuildFile.ShortCut:=CommandToShortCut(ecBuildFile);
itmRunMenuRunFile.ShortCut:=CommandToShortCut(ecRunFile);
itmRunMenuConfigBuildFile.ShortCut:=CommandToShortCut(ecConfigBuildFile);
// components menu
itmPkgOpenPackage.ShortCut:=CommandToShortCut(ecOpenPackage);
itmPkgOpenPackageFile.ShortCut:=CommandToShortCut(ecOpenPackageFile);
itmPkgOpenPackageOfCurUnit.ShortCut:=CommandToShortCut(ecOpenPackageOfCurUnit);
itmPkgAddCurUnitToPkg.ShortCut:=CommandToShortCut(ecAddCurUnitToPkg);
itmPkgPkgGraph.ShortCut:=CommandToShortCut(ecPackageGraph);
itmPkgEditInstallPkgs.ShortCut:=CommandToShortCut(ecEditInstallPkgs);
{$IFDEF CustomIDEComps}
itmCompsConfigCustomComps.ShortCut:=CommandToShortCut(ecConfigCustomComps);
{$ENDIF}
// tools menu
itmToolConfigure.ShortCut:=CommandToShortCut(ecExtToolSettings);
itmToolSyntaxCheck.ShortCut:=CommandToShortCut(ecSyntaxCheck);
itmToolGuessUnclosedBlock.ShortCut:=CommandToShortCut(ecGuessUnclosedBlock);
itmToolGuessMisplacedIFDEF.ShortCut:=CommandToShortCut(ecGuessMisplacedIFDEF);
itmToolMakeResourceString.ShortCut:=CommandToShortCut(ecMakeResourceString);
itmToolDiff.ShortCut:=CommandToShortCut(ecDiff);
itmToolConvertDFMtoLFM.ShortCut:=CommandToShortCut(ecConvertDFM2LFM);
itmToolCheckLFM.ShortCut:=CommandToShortCut(ecCheckLFM);
itmToolConvertDelphiUnit.ShortCut:=CommandToShortCut(ecConvertDelphiUnit);
itmToolConvertDelphiProject.ShortCut:=CommandToShortCut(ecConvertDelphiProject);
itmToolBuildLazarus.ShortCut:=CommandToShortCut(ecBuildLazarus);
itmToolConfigureBuildLazarus.ShortCut:=CommandToShortCut(ecConfigBuildLazarus);
// environment menu
itmEnvGeneralOptions.ShortCut:=CommandToShortCut(ecEnvironmentOptions);
itmEnvEditorOptions.ShortCut:=CommandToShortCut(ecEditorOptions);
itmEnvCodeTemplates.ShortCut:=CommandToShortCut(ecEditCodeTemplates);
itmEnvCodeToolsOptions.ShortCut:=CommandToShortCut(ecCodeToolsOptions);
itmEnvCodeToolsDefinesEditor.ShortCut:=CommandToShortCut(ecCodeToolsDefinesEd);
itmEnvRescanFPCSrcDir.ShortCut:=CommandToShortCut(ecRescanFPCSrcDir);
// help menu
itmHelpAboutLazarus.ShortCut:=CommandToShortCut(ecAboutLazarus);
itmHelpOnlineHelp.ShortCut:=CommandToShortCut(ecOnlineHelp);
itmHelpConfigureHelp.ShortCut:=CommandToShortCut(ecConfigureHelp);
end;
{$ENDIF}
end;
function TMainIDEBase.GetToolStatus: TIDEToolStatus;
@ -1713,7 +1278,7 @@ procedure TMainIDEBase.UpdateWindowsMenu;
var
WindowsList: TList;
i: Integer;
CurMenuItem: {$IFDEF UseMenuIntf}TIDEMenuItem{$ELSE}TMenuItem{$ENDIF};
CurMenuItem: TIDEMenuItem;
AForm: TForm;
begin
WindowsList:=TList.Create;
@ -1741,13 +1306,8 @@ begin
if MainIDEBar.mnuWindows.Count>i then
CurMenuItem:=MainIDEBar.mnuWindows.Items[i]
else begin
{$IFDEF UseMenuIntf}
CurMenuItem:=RegisterIDEMenuCommand(MainIDEBar.mnuWindows.GetPath,
'Window'+IntToStr(i),'');
{$ELSE}
CurMenuItem:=TMenuItem.Create(MainIDEBar);
MainIDEBar.mnuWindows.Add(CurMenuItem);
{$ENDIF}
CurMenuItem.OnClick:=@mnuWindowsItemClick;
end;
CurMenuItem.Caption:=TCustomForm(WindowsList[i]).Caption;
@ -1759,25 +1319,16 @@ begin
WindowsList.Free;
end;
procedure TMainIDEBase.SetRecentSubMenu(
{$IFDEF UseMenuIntf}Section: TIDEMenuSection;
{$ELSE}Section: TMenuItem;{$ENDIF}
procedure TMainIDEBase.SetRecentSubMenu(Section: TIDEMenuSection;
FileList: TStringList; OnClickEvent: TNotifyEvent);
var
i: integer;
AMenuItem: {$IFDEF UseMenuIntf}TIDEMenuItem{$ELSE}TMenuItem{$ENDIF};
AMenuItem: TIDEMenuItem;
begin
// create enough menuitems
while Section.Count<FileList.Count do begin
{$IFDEF UseMenuIntf}
AMenuItem:=RegisterIDEMenuCommand(Section.GetPath,
Section.Name+'Recent'+IntToStr(Section.Count),'');
{$ELSE}
AMenuItem:=TMenuItem.Create(MainIDEBar);
AMenuItem.Name:=
Section.Name+'Recent'+IntToStr(Section.Count);
Section.Add(AMenuItem);
{$ENDIF}
end;
// delete unused menuitems
while Section.Count>FileList.Count do

View File

@ -202,9 +202,7 @@ type
procedure UpdateWindowsMenu; virtual; abstract;
procedure SaveEnvironment; virtual; abstract;
procedure SetRecentSubMenu({$IFDEF UseMenuIntf}Section: TIDEMenuSection;
{$ELSE}Section: TMenuItem;{$ENDIF}
FileList: TStringList;
procedure SetRecentSubMenu(Section: TIDEMenuSection; FileList: TStringList;
OnClickEvent: TNotifyEvent); virtual; abstract;
function DoJumpToSourcePosition(const Filename: string;
NewX, NewY, NewTopLine: integer;

View File

@ -615,7 +615,7 @@ end;
procedure TProjectInspectorForm.KeyUp(var Key: Word; Shift: TShiftState);
begin
inherited KeyDown(Key, Shift);
ExecuteIDEShortCut(Self,Key,Shift,{$IFDEF UseIDEScopes}nil{$ELSE}caMenuOnly{$ENDIF});
ExecuteIDEShortCut(Self,Key,Shift,nil);
end;
function TProjectInspectorForm.GetSelectedFile: TUnitInfo;

View File

@ -419,7 +419,7 @@ end;
procedure TUnitDependenciesView.KeyUp(var Key: Word; Shift: TShiftState);
begin
inherited KeyUp(Key, Shift);
ExecuteIDEShortCut(Self,Key,Shift,{$IFDEF UseIDEScopes}nil{$ELSE}caMenuOnly{$ENDIF});
ExecuteIDEShortCut(Self,Key,Shift,nil);
end;
function TUnitDependenciesView.RootValid: boolean;

View File

@ -2634,7 +2634,7 @@ begin
// key mapping
FKeyStrokes:=TSynEditKeyStrokes.Create(Self);
EditorOpts.KeyMap.AssignTo(FKeyStrokes,{$IFDEF UseIDEScopes}TSourceEditorWindowInterface{$ELSE}[caSourceEditor]{$ENDIF});
EditorOpts.KeyMap.AssignTo(FKeyStrokes,TSourceEditorWindowInterface);
// popup menu
BuildPopupMenu;
@ -5104,7 +5104,7 @@ Begin
IndentToTokenStart:=EditorOpts.CodeTemplateIndentToTokenStart;
end;
EditorOpts.KeyMap.AssignTo(FKeyStrokes,{$IFDEF UseIDEScopes}TSourceEditorWindowInterface{$ELSE}[caSourceEditor]{$ENDIF});
EditorOpts.KeyMap.AssignTo(FKeyStrokes,TSourceEditorWindowInterface);
if NoteBook<>nil then begin
if EditorOpts.ShowTabCloseButtons then
NoteBook.Options:=NoteBook.Options+[nboShowCloseButtons]

View File

@ -41,24 +41,6 @@ interface
uses
Classes, SysUtils, LCLProc, Forms, LCLType, Menus, TextTools;
{$IFNDEF UseIDEScopes}
type
TCommandArea = (
caMenu,
caSourceEditor,
caDesigner
);
TCommandAreas = set of TCommandArea;
const
caAll = [caMenu, caSourceEditor, caDesigner];
caMenuOnly = [caMenu];
caSrcEdit = [caMenu,caSourceEditor];
caSrcEditOnly = [caSourceEditor];
caDesign = [caMenu,caDesigner];
caDesignOnly = [caDesigner];
{$ENDIF}
type
TIDECommand = class;
TIDECommandCategory = class;
@ -134,28 +116,18 @@ type
FDescription: string;
FName: string;
FParent: TIDECommandCategory;
{$IFDEF UseIDEScopes}
FScope: TIDECommandScope;
procedure SetScope(const AValue: TIDECommandScope);
{$ELSE}
FAreas: TCommandAreas;
{$ENDIF}
public
{$IFDEF UseIDEScopes}
destructor Destroy; override;
function ScopeIntersects(AScope: TIDECommandScope): boolean;
procedure WriteScopeDebugReport;
{$ENDIF}
public
property Name: string read FName;
property Description: string read FDescription;
property Parent: TIDECommandCategory read FParent;
procedure Delete(Index: Integer); virtual;
{$IFDEF UseIDEScopes}
property Scope: TIDECommandScope read FScope write SetScope;
{$ELSE}
property Areas: TCommandAreas read FAreas;
{$ENDIF}
end;
@ -201,7 +173,6 @@ type
TIDECommands = class
public
function FindIDECommand(ACommand: word): TIDECommand; virtual; abstract;
{$IFDEF UseIDEScopes}
function CreateCategory(Parent: TIDECommandCategory;
const Name, Description: string;
Scope: TIDECommandScope = nil): TIDECommandCategory; virtual; abstract;
@ -209,7 +180,6 @@ type
const Name, Description: string;
const TheShortcutA, TheShortcutB: TIDEShortCut
): TIDECommand; virtual; abstract;
{$ENDIF}
end;
const
@ -223,11 +193,7 @@ function IDEShortCut(Key1: word; Shift1: TShiftState;
type
TExecuteIDEShortCut =
procedure(Sender: TObject; var Key: word; Shift: TShiftState;
{$IFDEF UseIDEScopes}
IDEWindowClass: TCustomFormClass
{$ELSE}
Areas: TCommandAreas
{$ENDIF}) of object;
IDEWindowClass: TCustomFormClass) of object;
TExecuteIDECommand = procedure(Sender: TObject; Command: word) of object;
var
@ -235,7 +201,7 @@ var
OnExecuteIDECommand: TExecuteIDECommand;
procedure ExecuteIDEShortCut(Sender: TObject; var Key: word; Shift: TShiftState;
{$IFDEF UseIDEScopes}IDEWindowClass: TCustomFormClass{$ELSE}Areas: TCommandAreas{$ENDIF});
IDEWindowClass: TCustomFormClass);
procedure ExecuteIDEShortCut(Sender: TObject; var Key: word; Shift: TShiftState);
procedure ExecuteIDECommand(Sender: TObject; Command: word);
@ -250,7 +216,6 @@ var
IDECmdScopeSrcEditOnly: TIDECommandScope;
IDECmdScopeDesignerOnly: TIDECommandScope;
{$IFDEF UseIDEScopes}
// register a new IDE command category (i.e. set of commands)
function RegisterIDECommandCategory(Parent: TIDECommandCategory;
const Name, Description: string): TIDECommandCategory;
@ -265,7 +230,6 @@ function RegisterIDECommand(Category: TIDECommandCategory;
function RegisterIDECommand(Category: TIDECommandCategory;
const Name, Description: string;
const ShortCut1, ShortCut2: TIDEShortCut): TIDECommand;
{$ENDIF}
// register a new IDE command scope (i.e. a set of windows)
function RegisterIDECommandScope(const Name: string): TIDECommandScope;
@ -289,17 +253,16 @@ begin
end;
procedure ExecuteIDEShortCut(Sender: TObject; var Key: word; Shift: TShiftState;
{$IFDEF UseIDEScopes}IDEWindowClass: TCustomFormClass{$ELSE}Areas: TCommandAreas{$ENDIF});
IDEWindowClass: TCustomFormClass);
begin
if (OnExecuteIDECommand<>nil) and (Key<>VK_UNKNOWN) then
OnExecuteIDEShortCut(Sender,Key,Shift,
{$IFDEF UseIDEScopes}IDEWindowClass{$ELSE}Areas{$ENDIF});
OnExecuteIDEShortCut(Sender,Key,Shift,IDEWindowClass);
end;
procedure ExecuteIDEShortCut(Sender: TObject; var Key: word;
Shift: TShiftState);
begin
OnExecuteIDEShortCut(Sender,Key,Shift,{$IFDEF UseIDEScopes}nil{$ELSE}caMenuOnly{$ENDIF});
OnExecuteIDEShortCut(Sender,Key,Shift,nil);
end;
procedure ExecuteIDECommand(Sender: TObject; Command: word);
@ -370,7 +333,6 @@ begin
Result:=0;
end;
{$IFDEF UseIDEScopes}
function RegisterIDECommandCategory(Parent: TIDECommandCategory;
const Name, Description: string): TIDECommandCategory;
begin
@ -404,7 +366,6 @@ begin
Result:=IDECommandList.CreateCommand(Category,Name,Description,
ShortCut1,ShortCut2);
end;
{$ENDIF}
function RegisterIDECommandScope(const Name: string): TIDECommandScope;
begin
@ -573,7 +534,6 @@ end;
{ TIDECommandCategory }
{$IFDEF UseIDEScopes}
procedure TIDECommandCategory.SetScope(const AValue: TIDECommandScope);
begin
if FScope=AValue then exit;
@ -607,7 +567,6 @@ begin
else
debugln(' Scope=nil');
end;
{$ENDIF}
procedure TIDECommandCategory.Delete(Index: Integer);
begin
@ -633,15 +592,11 @@ begin
end;
destructor TIDECommandScope.Destroy;
{$IFDEF UseIDEScopes}
var
i: Integer;
{$ENDIF}
begin
{$IFDEF UseIDEScopes}
for i:=FCategories.Count-1 downto 0 do
Categories[i].Scope:=nil;
{$ENDIF}
FreeAndNil(FIDEWindowClasses);
FreeAndNil(FCategories);
inherited Destroy;

View File

@ -452,7 +452,7 @@ end;
procedure TPkgGraphExplorer.KeyUp(var Key: Word; Shift: TShiftState);
begin
inherited KeyUp(Key, Shift);
ExecuteIDEShortCut(Self,Key,Shift,{$IFDEF UseIDEScopes}nil{$ELSE}caMenuOnly{$ENDIF});
ExecuteIDEShortCut(Self,Key,Shift,nil);
end;
constructor TPkgGraphExplorer.Create(TheOwner: TComponent);

View File

@ -947,7 +947,7 @@ procedure TPkgManager.MainIDEitmOpenRecentPackageClicked(Sender: TObject);
var
AFilename: string;
begin
AFileName:=ExpandFilename((Sender as {$IFDEF UseMenuIntf}TIDEMenuItem{$ELSE}TMenuItem{$ENDIF}).Caption);
AFileName:=ExpandFilename((Sender as TIDEMenuItem).Caption);
if DoOpenPackageFile(AFilename,[pofAddToRecent])=mrOk then begin
UpdateEnvironment;
end else begin