mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-16 01:00:34 +01:00
implemented IDE command scopes
git-svn-id: trunk@7733 -
This commit is contained in:
parent
628c0f8d8f
commit
904520640b
@ -480,7 +480,7 @@ end;
|
||||
procedure TAnchorDesigner.KeyUp(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
inherited KeyUp(Key, Shift);
|
||||
ExecuteIDEShortCut(Self,Key,Shift,caMenuOnly);
|
||||
ExecuteIDEShortCut(Self,Key,Shift,{$IFDEF UseIDEScopes}nil{$ELSE}caMenuOnly{$ENDIF});
|
||||
end;
|
||||
|
||||
procedure TAnchorDesigner.FillComboBoxWithSiblings(AComboBox: TComboBox);
|
||||
|
||||
@ -457,7 +457,7 @@ end;
|
||||
procedure TCodeExplorerView.KeyUp(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
inherited KeyUp(Key, Shift);
|
||||
ExecuteIDEShortCut(Self,Key,Shift,caMenuOnly);
|
||||
ExecuteIDEShortCut(Self,Key,Shift,{$IFDEF UseIDEScopes}nil{$ELSE}caMenuOnly{$ENDIF});
|
||||
end;
|
||||
|
||||
procedure TCodeExplorerView.BeginUpdate;
|
||||
|
||||
@ -33,7 +33,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs,
|
||||
StdCtrls, Buttons, SynEdit, SynHighlighterPas, ExtCtrls,
|
||||
SynEditAutoComplete, IDECommands,
|
||||
SynEditAutoComplete, IDECommands, SrcEditorIntf,
|
||||
InputHistory, LazarusIDEStrConsts, EditorOptions;
|
||||
|
||||
type
|
||||
@ -326,7 +326,7 @@ begin
|
||||
else
|
||||
TemplateSynEdit.Highlighter:=nil;
|
||||
EditorOpts.GetSynEditSettings(TemplateSynEdit);
|
||||
EditorOpts.KeyMap.AssignTo(TemplateSynEdit.KeyStrokes,[caSourceEditor]);
|
||||
EditorOpts.KeyMap.AssignTo(TemplateSynEdit.KeyStrokes,{$IFDEF UseIDEScopes}TSourceEditorWindowInterface{$ELSE}[caSourceEditor]{$ENDIF});
|
||||
TemplateSynEdit.Gutter.Visible:=false;
|
||||
|
||||
// init SynAutoComplete
|
||||
|
||||
@ -1749,7 +1749,7 @@ end;
|
||||
function TCustomFormEditor.TranslateKeyToDesignerCommand(Key: word;
|
||||
Shift: TShiftState): word;
|
||||
begin
|
||||
Result:=EditorOpts.KeyMap.TranslateKey(Key,Shift,[caDesigner]);
|
||||
Result:=EditorOpts.KeyMap.TranslateKey(Key,Shift,{$IFDEF UseIDEScopes}TDesignerIDECommandForm{$ELSE}[caDesigner]{$ENDIF});
|
||||
end;
|
||||
|
||||
Function TCustomFormEditor.CreateComponentInterface(
|
||||
|
||||
@ -41,7 +41,8 @@ uses
|
||||
SynHighlighterPas, SynHighlighterHTML, SynHighlighterCPP, SynHighlighterXML,
|
||||
SynHighlighterLFM, SynHighlighterPerl, SynHighlighterJava,
|
||||
SynHighlighterPython, SynHighlighterUNIXShellScript, SynHighlighterPHP,
|
||||
Laz_XMLCfg, IDEWindowIntf,
|
||||
Laz_XMLCfg,
|
||||
IDEWindowIntf, SrcEditorIntf,
|
||||
IDECommands, KeyMapping, InputHistory, IDEOptionDefs,
|
||||
LazarusIDEStrConsts, KeymapSchemeDlg;
|
||||
|
||||
@ -2065,7 +2066,7 @@ begin
|
||||
ASynEdit.MaxUndo:=fUndoLimit;
|
||||
GetSynEditSelectedColor(ASynEdit);
|
||||
|
||||
KeyMap.AssignTo(ASynEdit.KeyStrokes,{$IFDEF UseIDEScopes}IDECmdScopeSrcEdit{$ELSE}[caSourceEditor]{$ENDIF});
|
||||
KeyMap.AssignTo(ASynEdit.KeyStrokes,{$IFDEF UseIDEScopes}TSourceEditorWindowInterface{$ELSE}[caSourceEditor]{$ENDIF});
|
||||
end;
|
||||
|
||||
procedure TEditorOptions.SetSynEditSettings(ASynEdit:TSynEdit);
|
||||
@ -2140,7 +2141,7 @@ begin
|
||||
ASynEdit.ExtraLineSpacing:=fExtraLineSpacing;
|
||||
ASynEdit.ReadOnly:=true;
|
||||
|
||||
KeyMap.AssignTo(ASynEdit.KeyStrokes,[caSourceEditor]);
|
||||
KeyMap.AssignTo(ASynEdit.KeyStrokes,{$IFDEF UseIDEScopes}TSourceEditorWindowInterface{$ELSE}[caSourceEditor]{$ENDIF});
|
||||
end;
|
||||
|
||||
|
||||
@ -2234,7 +2235,7 @@ begin
|
||||
if EditorOpts.UseSyntaxHighlight then
|
||||
Highlighter:=PreviewSyn;
|
||||
EditorOpts.GetSynEditSettings(PreviewEdits[a]);
|
||||
EditingKeyMap.AssignTo(PreviewEdits[a].KeyStrokes,[caSourceEditor]);
|
||||
EditingKeyMap.AssignTo(PreviewEdits[a].KeyStrokes,{$IFDEF UseIDEScopes}TSourceEditorWindowInterface{$ELSE}[caSourceEditor]{$ENDIF});
|
||||
if a<>3 then
|
||||
begin
|
||||
Lines.Text:=EditorOpts.HighlighterList[CurLanguageID].SampleSource;
|
||||
@ -2748,7 +2749,8 @@ begin
|
||||
FillKeyMappingTreeView;
|
||||
for i:=Low(PreviewEdits) to High(PreviewEdits) do
|
||||
if PreviewEdits[i]<>nil then
|
||||
EditingKeyMap.AssignTo(PreviewEdits[i].KeyStrokes,[caSourceEditor]);
|
||||
EditingKeyMap.AssignTo(PreviewEdits[i].KeyStrokes,
|
||||
{$IFDEF UseIDEScopes}TSourceEditorWindowInterface{$ELSE}[caSourceEditor]{$ENDIF});
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -32,7 +32,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, CustomFormEditor, Controls, Forms, Buttons, SysUtils, Graphics,
|
||||
ObjectInspector, Designer, FormEditingIntf;
|
||||
ObjectInspector, Designer, IDECommands, FormEditingIntf;
|
||||
|
||||
type
|
||||
|
||||
@ -59,6 +59,7 @@ procedure CreateFormEditor;
|
||||
begin
|
||||
FormEditor1 := TFormEditor.Create;
|
||||
FormEditingHook := FormEditor1;
|
||||
IDECmdScopeDesignerOnly.AddWindowClass(TDesignerIDECommandForm);
|
||||
end;
|
||||
|
||||
procedure FreeFormEditor;
|
||||
|
||||
@ -320,12 +320,12 @@ type
|
||||
function Count: integer;
|
||||
function CategoryCount: integer;
|
||||
function Find(Key: TIDEShortCut;
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}Areas: TCommandAreas{$ENDIF}
|
||||
{$IFDEF UseIDEScopes}IDEWindowClass: TCustomFormClass{$ELSE}Areas: TCommandAreas{$ENDIF}
|
||||
): TKeyCommandRelation;
|
||||
function FindByCommand(ACommand:word): TKeyCommandRelation;
|
||||
function FindCategoryByName(const CategoryName: string): TKeyCommandCategory;
|
||||
function TranslateKey(Key: word; Shift: TShiftState;
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}Areas: TCommandAreas{$ENDIF};
|
||||
{$IFDEF UseIDEScopes}IDEWindowClass: TCustomFormClass{$ELSE}Areas: TCommandAreas{$ENDIF};
|
||||
UseLastKey: boolean = true
|
||||
): word;
|
||||
function IndexOf(ARelation: TKeyCommandRelation): integer;
|
||||
@ -2482,7 +2482,7 @@ begin
|
||||
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}IDECmdScopeDesigner{$ELSE}caDesignOnly{$ENDIF})];
|
||||
C:=Categories[AddCategory('Designer',lisKeyCatDesigner,{$IFDEF UseIDEScopes}IDECmdScopeDesignerOnly{$ELSE}caDesignOnly{$ENDIF})];
|
||||
AddDefault(C,'Copy selected Components to clipboard',ecDesignerCopy);
|
||||
AddDefault(C,'Cut selected Components to clipboard' ,ecDesignerCut);
|
||||
AddDefault(C,'Paste Components from clipboard' ,ecDesignerPaste);
|
||||
@ -2723,7 +2723,7 @@ begin
|
||||
end;
|
||||
|
||||
function TKeyCommandRelationList.Find(Key: TIDEShortCut;
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}Areas: TCommandAreas{$ENDIF}
|
||||
{$IFDEF UseIDEScopes}IDEWindowClass: TCustomFormClass{$ELSE}Areas: TCommandAreas{$ENDIF}
|
||||
): TKeyCommandRelation;
|
||||
var
|
||||
a:integer;
|
||||
@ -2732,7 +2732,7 @@ begin
|
||||
if Key.Key1=VK_UNKNOWN then exit;
|
||||
for a:=0 to FRelations.Count-1 do with Relations[a] do begin
|
||||
{$IFDEF UseIDEScopes}
|
||||
if not Category.Scope.HasIDEWindow(IDEWindow) then continue;
|
||||
if not Category.Scope.HasIDEWindowClass(IDEWindowClass) then continue;
|
||||
{$ELSE}
|
||||
if Category.Areas*Areas=[] then continue;
|
||||
{$ENDIF}
|
||||
@ -2772,8 +2772,8 @@ begin
|
||||
CurRelation:=Relations[a];
|
||||
if (CurRelation.KeyA.Key1=VK_UNKNOWN)
|
||||
{$IFDEF UseIDEScopes}
|
||||
or ((CurRelation.Category.Scope<>nil)
|
||||
and (not CurRelation.Category.Scope.HasIDEWindow(IDEWindow)))
|
||||
or ((IDEWindowClass<>nil) and (CurRelation.Category.Scope<>nil)
|
||||
and (not CurRelation.Category.Scope.HasIDEWindowClass(IDEWindowClass)))
|
||||
{$ELSE}
|
||||
or ((CurRelation.Category.Areas*Areas)=[])
|
||||
{$ENDIF}
|
||||
@ -2910,7 +2910,7 @@ begin
|
||||
end;
|
||||
|
||||
function TKeyCommandRelationList.TranslateKey(Key: word; Shift: TShiftState;
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}Areas: TCommandAreas{$ENDIF};
|
||||
{$IFDEF UseIDEScopes}IDEWindowClass: TCustomFormClass{$ELSE}Areas: TCommandAreas{$ENDIF};
|
||||
UseLastKey: boolean
|
||||
): word;
|
||||
{ If UseLastKey = true then only search for commmands with one key.
|
||||
@ -2927,7 +2927,7 @@ begin
|
||||
// => try a two key combination command
|
||||
fLastKey.Key2 := Key;
|
||||
fLastKey.Shift2 := Shift;
|
||||
ARelation := Find(fLastKey,{$IFDEF UseIDEScopes}IDEWindow{$ELSE}Areas{$ENDIF});
|
||||
ARelation := Find(fLastKey,{$IFDEF UseIDEScopes}IDEWindowClass{$ELSE}Areas{$ENDIF});
|
||||
end else begin
|
||||
ARelation := nil;
|
||||
end;
|
||||
@ -2938,7 +2938,7 @@ begin
|
||||
fLastKey.Shift1 := Shift;
|
||||
fLastKey.Key2 := VK_UNKNOWN;
|
||||
fLastKey.Shift2 := [];
|
||||
ARelation := Find(fLastKey,{$IFDEF UseIDEScopes}IDEWindow{$ELSE}Areas{$ENDIF});
|
||||
ARelation := Find(fLastKey,{$IFDEF UseIDEScopes}IDEWindowClass{$ELSE}Areas{$ENDIF});
|
||||
end;
|
||||
if ARelation<>nil then
|
||||
begin
|
||||
|
||||
12
ide/main.pp
12
ide/main.pp
@ -291,7 +291,7 @@ type
|
||||
var Handled: boolean);
|
||||
procedure OnExecuteIDEShortCut(Sender: TObject;
|
||||
var Key: word; Shift: TShiftState;
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm
|
||||
{$IFDEF UseIDEScopes}IDEWindowClass: TCustomFormClass
|
||||
{$ELSE}TheAreas: TCommandAreas{$ENDIF});
|
||||
procedure OnExecuteIDECommand(Sender: TObject; Command: word);
|
||||
|
||||
@ -1167,7 +1167,7 @@ end;
|
||||
procedure TMainIDE.OIRemainingKeyUp(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
begin
|
||||
OnExecuteIDEShortCut(Sender,Key,Shift,caDesign);
|
||||
OnExecuteIDEShortCut(Sender,Key,Shift,{$IFDEF UseIDEScopes}nil{$ELSE}caDesign{$ENDIF});
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OIOnAddToFavourites(Sender: TObject);
|
||||
@ -1554,7 +1554,9 @@ begin
|
||||
IDECommands.OnExecuteIDECommand:=@OnExecuteIDECommand;
|
||||
IDECommands.OnExecuteIDEShortCut:=@OnExecuteIDEShortCut;
|
||||
CreateStandardIDECommandScopes;
|
||||
IDECmdScopeSrcEdit.AddWindowClass(TSourceNotebook);
|
||||
IDECmdScopeSrcEdit.AddWindowClass(TSourceEditorWindowInterface);
|
||||
IDECmdScopeSrcEdit.AddWindowClass(nil);
|
||||
IDECmdScopeSrcEditOnly.AddWindowClass(TSourceEditorWindowInterface);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.SetupStartProject;
|
||||
@ -2383,7 +2385,7 @@ end;
|
||||
|
||||
procedure TMainIDE.OnExecuteIDEShortCut(Sender: TObject; var Key: word;
|
||||
Shift: TShiftState;
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}TheAreas: TCommandAreas{$ENDIF});
|
||||
{$IFDEF UseIDEScopes}IDEWindowClass: TCustomFormClass{$ELSE}TheAreas: TCommandAreas{$ENDIF});
|
||||
var
|
||||
// CommandRelation: TKeyCommandRelation;
|
||||
// Handled: Boolean;
|
||||
@ -2396,7 +2398,7 @@ begin
|
||||
// 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}IDEWindow{$ELSE}TheAreas{$ENDIF});
|
||||
Command := EditorOpts.KeyMap.TranslateKey(Key,Shift,{$IFDEF UseIDEScopes}IDEWindowClass{$ELSE}TheAreas{$ENDIF});
|
||||
if (Command = ecNone) then exit;
|
||||
Handled := false;
|
||||
OnProcessIDECommand(Sender, Command, Handled);
|
||||
|
||||
@ -615,7 +615,7 @@ end;
|
||||
procedure TProjectInspectorForm.KeyUp(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
inherited KeyDown(Key, Shift);
|
||||
ExecuteIDEShortCut(Self,Key,Shift,caMenuOnly);
|
||||
ExecuteIDEShortCut(Self,Key,Shift,{$IFDEF UseIDEScopes}nil{$ELSE}caMenuOnly{$ENDIF});
|
||||
end;
|
||||
|
||||
function TProjectInspectorForm.GetSelectedFile: TUnitInfo;
|
||||
|
||||
@ -419,7 +419,7 @@ end;
|
||||
procedure TUnitDependenciesView.KeyUp(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
inherited KeyUp(Key, Shift);
|
||||
ExecuteIDEShortCut(Self,Key,Shift,caMenuOnly);
|
||||
ExecuteIDEShortCut(Self,Key,Shift,{$IFDEF UseIDEScopes}nil{$ELSE}caMenuOnly{$ENDIF});
|
||||
end;
|
||||
|
||||
function TUnitDependenciesView.RootValid: boolean;
|
||||
|
||||
@ -335,7 +335,7 @@ type
|
||||
|
||||
{ TSourceNotebook }
|
||||
|
||||
TSourceNotebook = class(TForm)
|
||||
TSourceNotebook = class(TSourceEditorWindowInterface)
|
||||
SrcPopUpMenu: TPopupMenu;
|
||||
StatusBar: TStatusBar;
|
||||
Notebook: TNotebook;
|
||||
@ -2380,7 +2380,7 @@ begin
|
||||
|
||||
// key mapping
|
||||
FKeyStrokes:=TSynEditKeyStrokes.Create(Self);
|
||||
EditorOpts.KeyMap.AssignTo(FKeyStrokes,[caSourceEditor]);
|
||||
EditorOpts.KeyMap.AssignTo(FKeyStrokes,{$IFDEF UseIDEScopes}TSourceEditorWindowInterface{$ELSE}[caSourceEditor]{$ENDIF});
|
||||
|
||||
// popup menu
|
||||
BuildPopupMenu;
|
||||
@ -4805,7 +4805,7 @@ Begin
|
||||
IndentToTokenStart:=EditorOpts.CodeTemplateIndentToTokenStart;
|
||||
end;
|
||||
|
||||
EditorOpts.KeyMap.AssignTo(FKeyStrokes,[caSourceEditor]);
|
||||
EditorOpts.KeyMap.AssignTo(FKeyStrokes,{$IFDEF UseIDEScopes}TSourceEditorWindowInterface{$ELSE}[caSourceEditor]{$ENDIF});
|
||||
if NoteBook<>nil then begin
|
||||
if EditorOpts.ShowTabCloseButtons then
|
||||
NoteBook.Options:=NoteBook.Options+[nboShowCloseButtons]
|
||||
|
||||
@ -74,7 +74,7 @@ type
|
||||
Function FormModified : Boolean; virtual; abstract;
|
||||
Function MarkModified : Boolean; virtual; abstract;
|
||||
Function GetFormComponent : TIComponentInterface; virtual; abstract;
|
||||
Function FindComponent : TIComponentInterface; virtual; abstract;
|
||||
Function FindComponent : TIComponentInterface; virtual; abstract;
|
||||
Function GetComponentfromHandle(ComponentHandle:Pointer): TIComponentInterface; virtual; abstract;
|
||||
|
||||
Function GetSelCount: Integer; virtual; abstract;
|
||||
@ -134,6 +134,10 @@ type
|
||||
): Boolean; virtual; abstract;
|
||||
end;
|
||||
|
||||
type
|
||||
TDesignerIDECommandForm = class(TCustomForm)
|
||||
// dummy form class, use by the IDE commands for keys in the designers
|
||||
end;
|
||||
|
||||
var
|
||||
FormEditingHook: TAbstractFormEditor; // will be set by the IDE
|
||||
|
||||
@ -73,27 +73,20 @@ type
|
||||
TIDECommandScope = class(TPersistent)
|
||||
private
|
||||
FName: string;
|
||||
FIDEWindows: TFPList;// list of TCustomForm
|
||||
FIDEWindowClasses: TFPList;// list of TCustomFormClass
|
||||
FCategories: TFPList;
|
||||
function GetCategories(Index: integer): TIDECommandCategory;
|
||||
function GetIDEWindowClasses(Index: integer): TCustomFormClass;
|
||||
function GetIDEWindows(Index: integer): TCustomForm;
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure AddWindow(AWindow: TCustomForm);
|
||||
procedure RemoveWindow(AWindow: TCustomForm);
|
||||
procedure AddWindowClass(AWindowClass: TCustomFormClass);
|
||||
procedure RemoveWindowClass(AWindowClass: TCustomFormClass);
|
||||
function IDEWindowCount: integer;
|
||||
function IDEWindowClassCount: integer;
|
||||
function CategoryCount: integer;
|
||||
function HasIDEWindow(AWindow: TCustomForm): boolean;
|
||||
function HasIDEWindowClass(AWindowClass: TCustomFormClass): boolean;
|
||||
public
|
||||
property Name: string read FName;
|
||||
property IDEWindows[Index: integer]: TCustomForm read GetIDEWindows;
|
||||
property IDEWindowClasses[Index: integer]: TCustomFormClass read GetIDEWindowClasses;
|
||||
property Categories[Index: integer]: TIDECommandCategory read GetCategories;
|
||||
end;
|
||||
@ -202,7 +195,7 @@ type
|
||||
TExecuteIDEShortCut = procedure(Sender: TObject;
|
||||
var Key: word; Shift: TShiftState;
|
||||
{$IFDEF UseIDEScopes}
|
||||
IDEWindow: TCustomForm
|
||||
IDEWindowClass: TCustomFormClass
|
||||
{$ELSE}
|
||||
Areas: TCommandAreas
|
||||
{$ENDIF}) of object;
|
||||
@ -213,7 +206,7 @@ var
|
||||
OnExecuteIDECommand: TExecuteIDECommand;
|
||||
|
||||
procedure ExecuteIDEShortCut(Sender: TObject; var Key: word; Shift: TShiftState;
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}Areas: TCommandAreas{$ENDIF});
|
||||
{$IFDEF UseIDEScopes}IDEWindowClass: TCustomFormClass{$ELSE}Areas: TCommandAreas{$ENDIF});
|
||||
procedure ExecuteIDEShortCut(Sender: TObject; var Key: word; Shift: TShiftState);
|
||||
procedure ExecuteIDECommand(Sender: TObject; Command: word);
|
||||
|
||||
@ -226,7 +219,7 @@ var
|
||||
var
|
||||
IDECmdScopeSrcEdit: TIDECommandScope;
|
||||
IDECmdScopeSrcEditOnly: TIDECommandScope;
|
||||
IDECmdScopeDesigner: TIDECommandScope;
|
||||
IDECmdScopeDesignerOnly: TIDECommandScope;
|
||||
|
||||
procedure CreateStandardIDECommandScopes;
|
||||
function RegisterIDECommandScope(const Name: string): TIDECommandScope;
|
||||
@ -245,11 +238,11 @@ begin
|
||||
end;
|
||||
|
||||
procedure ExecuteIDEShortCut(Sender: TObject; var Key: word; Shift: TShiftState;
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}Areas: TCommandAreas{$ENDIF});
|
||||
{$IFDEF UseIDEScopes}IDEWindowClass: TCustomFormClass{$ELSE}Areas: TCommandAreas{$ENDIF});
|
||||
begin
|
||||
if (OnExecuteIDECommand<>nil) and (Key<>VK_UNKNOWN) then
|
||||
OnExecuteIDEShortCut(Sender,Key,Shift,
|
||||
{$IFDEF UseIDEScopes}IDEWindow{$ELSE}Areas{$ENDIF});
|
||||
{$IFDEF UseIDEScopes}IDEWindowClass{$ELSE}Areas{$ENDIF});
|
||||
end;
|
||||
|
||||
procedure ExecuteIDEShortCut(Sender: TObject; var Key: word;
|
||||
@ -276,7 +269,8 @@ procedure CreateStandardIDECommandScopes;
|
||||
begin
|
||||
IDECommandScopes:=TIDECommandScopes.Create;
|
||||
IDECmdScopeSrcEdit:=RegisterIDECommandScope('SourceEditor');
|
||||
IDECmdScopeDesigner:=RegisterIDECommandScope('Designer');
|
||||
IDECmdScopeSrcEditOnly:=RegisterIDECommandScope('SourceEditorOnly');
|
||||
IDECmdScopeDesignerOnly:=RegisterIDECommandScope('DesignerOnly');
|
||||
end;
|
||||
|
||||
function RegisterIDECommandScope(const Name: string): TIDECommandScope;
|
||||
@ -459,11 +453,6 @@ end;
|
||||
|
||||
{ TIDECommandScope }
|
||||
|
||||
function TIDECommandScope.GetIDEWindows(Index: integer): TCustomForm;
|
||||
begin
|
||||
Result:=TCustomForm(FIDEWindows[Index]);
|
||||
end;
|
||||
|
||||
function TIDECommandScope.GetCategories(Index: integer): TIDECommandCategory;
|
||||
begin
|
||||
Result:=TIDECommandCategory(FCategories[Index]);
|
||||
@ -476,7 +465,6 @@ end;
|
||||
|
||||
constructor TIDECommandScope.Create;
|
||||
begin
|
||||
FIDEWindows:=TFPList.Create;
|
||||
FIDEWindowClasses:=TFPList.Create;
|
||||
FCategories:=TFPList.Create;
|
||||
end;
|
||||
@ -492,23 +480,10 @@ begin
|
||||
Categories[i].Scope:=nil;
|
||||
{$ENDIF}
|
||||
FreeAndNil(FIDEWindowClasses);
|
||||
FreeAndNil(FIDEWindows);
|
||||
FreeAndNil(FCategories);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TIDECommandScope.AddWindow(AWindow: TCustomForm);
|
||||
begin
|
||||
if FIDEWindows.IndexOf(AWindow)>=0 then
|
||||
RaiseGDBException('TIDECommandScope.AddWindow');
|
||||
FIDEWindows.Add(AWindow);
|
||||
end;
|
||||
|
||||
procedure TIDECommandScope.RemoveWindow(AWindow: TCustomForm);
|
||||
begin
|
||||
FIDEWindows.Remove(AWindow);
|
||||
end;
|
||||
|
||||
procedure TIDECommandScope.AddWindowClass(AWindowClass: TCustomFormClass);
|
||||
begin
|
||||
if FIDEWindowClasses.IndexOf(AWindowClass)>=0 then
|
||||
@ -521,11 +496,6 @@ begin
|
||||
FIDEWindowClasses.Remove(AWindowClass);
|
||||
end;
|
||||
|
||||
function TIDECommandScope.IDEWindowCount: integer;
|
||||
begin
|
||||
Result:=FIDEWindows.Count;
|
||||
end;
|
||||
|
||||
function TIDECommandScope.IDEWindowClassCount: integer;
|
||||
begin
|
||||
Result:=FIDEWindowClasses.Count;
|
||||
@ -536,27 +506,14 @@ begin
|
||||
Result:=FCategories.Count;
|
||||
end;
|
||||
|
||||
function TIDECommandScope.HasIDEWindow(AWindow: TCustomForm): boolean;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=0 to FIDEWindows.Count-1 do
|
||||
if TCustomForm(FIDEWindows[i])=AWindow then
|
||||
exit(true);
|
||||
for i:=0 to FIDEWindowClasses.Count-1 do
|
||||
if AWindow.InheritsFrom(TCustomFormClass(FIDEWindowClasses[i])) then
|
||||
exit(true);
|
||||
Result:=(AWindow<>nil)
|
||||
and HasIDEWindowClass(TCustomFormClass(AWindow.ClassType));
|
||||
end;
|
||||
|
||||
function TIDECommandScope.HasIDEWindowClass(AWindowClass: TCustomFormClass
|
||||
): boolean;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=0 to FIDEWindowClasses.Count-1 do
|
||||
if AWindowClass.InheritsFrom(TCustomFormClass(FIDEWindowClasses[i])) then
|
||||
if (FIDEWindowClasses[i]=nil)
|
||||
or AWindowClass.InheritsFrom(TCustomFormClass(FIDEWindowClasses[i])) then
|
||||
exit(true);
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
@ -20,12 +20,15 @@ unit SrcEditorIntf;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils;
|
||||
Classes, SysUtils, Forms;
|
||||
|
||||
type
|
||||
TSourceEditorInterface = class
|
||||
end;
|
||||
|
||||
TSourceEditorWindowInterface = class(TForm)
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
||||
@ -452,7 +452,7 @@ end;
|
||||
procedure TPkgGraphExplorer.KeyUp(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
inherited KeyUp(Key, Shift);
|
||||
ExecuteIDEShortCut(Self,Key,Shift,caMenuOnly);
|
||||
ExecuteIDEShortCut(Self,Key,Shift,{$IFDEF UseIDEScopes}nil{$ELSE}caMenuOnly{$ENDIF});
|
||||
end;
|
||||
|
||||
constructor TPkgGraphExplorer.Create(TheOwner: TComponent);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user