mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-10 02:28:04 +02:00
implemented handling keys in IDE windows
git-svn-id: trunk@5526 -
This commit is contained in:
parent
d79589f135
commit
c1f1aa5d22
@ -2,6 +2,7 @@ object CodeExplorerView: TCodeExplorerView
|
||||
Caption = 'CodeExplorerView'
|
||||
ClientHeight = 505
|
||||
ClientWidth = 206
|
||||
KeyPreview = True
|
||||
OnClose = CodeExplorerViewCLOSE
|
||||
OnCreate = CodeExplorerViewCREATE
|
||||
OnResize = CodeExplorerViewRESIZE
|
||||
@ -13,7 +14,6 @@ object CodeExplorerView: TCodeExplorerView
|
||||
Width = 206
|
||||
object RefreshButton: TButton
|
||||
Caption = 'Refresh'
|
||||
TabStop = True
|
||||
TabOrder = 0
|
||||
OnClick = RefreshButtonCLICK
|
||||
Height = 25
|
||||
@ -22,14 +22,13 @@ object CodeExplorerView: TCodeExplorerView
|
||||
object OptionsButton: TButton
|
||||
Enabled = False
|
||||
Caption = 'Options'
|
||||
TabStop = True
|
||||
TabOrder = 1
|
||||
Left = 110
|
||||
Height = 25
|
||||
Width = 96
|
||||
end
|
||||
object CodeTreeview: TTreeView
|
||||
Align = ALBOTTOM
|
||||
Align = alBottom
|
||||
DefaultItemHeight = 17
|
||||
DragCursor = 65524
|
||||
HideSelection = False
|
||||
@ -40,7 +39,7 @@ object CodeExplorerView: TCodeExplorerView
|
||||
TabOrder = 2
|
||||
OnDblClick = CodeTreeviewDBLCLICK
|
||||
OnDeletion = CodeTreeviewDELETION
|
||||
Options = [TVOAUTOITEMHEIGHT, TVOKEEPCOLLAPSEDNODES, TVORIGHTCLICKSELECT, TVOSHOWBUTTONS, TVOSHOWLINES, TVOSHOWROOT, TVOTOOLTIPS]
|
||||
Options = [tvoAutoItemHeight, tvoKeepCollapsedNodes, tvoRightClickSelect, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips]
|
||||
Height = 480
|
||||
Top = 25
|
||||
Width = 206
|
||||
|
@ -2,24 +2,24 @@
|
||||
|
||||
LazarusResources.Add('TCodeExplorerView','FORMDATA',[
|
||||
'TPF0'#17'TCodeExplorerView'#16'CodeExplorerView'#7'Caption'#6#16'CodeExplore'
|
||||
+'rView'#12'ClientHeight'#3#249#1#11'ClientWidth'#3#206#0#7'OnClose'#7#21'Cod'
|
||||
+'eExplorerViewCLOSE'#8'OnCreate'#7#22'CodeExplorerViewCREATE'#8'OnResize'#7
|
||||
+#22'CodeExplorerViewRESIZE'#18'HorzScrollBar.Page'#3#207#0#18'VertScrollBar.'
|
||||
+'Page'#3#250#1#4'Left'#3'z'#1#6'Height'#3#249#1#3'Top'#3#175#0#5'Width'#3#206
|
||||
+#0#0#7'TButton'#13'RefreshButton'#7'Caption'#6#7'Refresh'#7'TabStop'#9#8'Tab'
|
||||
+'Order'#2#0#7'OnClick'#7#18'RefreshButtonCLICK'#6'Height'#2#25#5'Width'#2'`'
|
||||
+#0#0#7'TButton'#13'OptionsButton'#7'Enabled'#8#7'Caption'#6#7'Options'#7'Tab'
|
||||
+'Stop'#9#8'TabOrder'#2#1#4'Left'#2'n'#6'Height'#2#25#5'Width'#2'`'#0#0#9'TTr'
|
||||
+'eeView'#12'CodeTreeview'#5'Align'#7#8'ALBOTTOM'#17'DefaultItemHeight'#2#17
|
||||
+#10'DragCursor'#4#244#255#0#0#13'HideSelection'#8#6'Images'#7#10'Imagelist1'
|
||||
+#11'ParentCtl3D'#8#9'PopupMenu'#7#13'TreePopupmenu'#16'RightClickSelect'#9#8
|
||||
+'TabOrder'#2#2#10'OnDblClick'#7#20'CodeTreeviewDBLCLICK'#10'OnDeletion'#7#20
|
||||
+'CodeTreeviewDELETION'#7'Options'#11#17'TVOAUTOITEMHEIGHT'#21'TVOKEEPCOLLAPS'
|
||||
+'EDNODES'#19'TVORIGHTCLICKSELECT'#14'TVOSHOWBUTTONS'#12'TVOSHOWLINES'#11'TVO'
|
||||
+'SHOWROOT'#11'TVOTOOLTIPS'#0#6'Height'#3#224#1#3'Top'#2#25#5'Width'#3#206#0#0
|
||||
+#0#10'TImageList'#10'Imagelist1'#4'left'#2'@'#3'top'#2' '#0#0#10'TPopupMenu'
|
||||
+#13'TreePopupmenu'#4'left'#2'@'#3'top'#2'H'#0#9'TMenuItem'#14'JumpToMenuitem'
|
||||
+#7'Caption'#6#14'Jump to source'#7'OnClick'#7#19'JumpToMenuitemCLICK'#0#0#9
|
||||
+'TMenuItem'#15'RefreshMenuitem'#7'Caption'#6#7'Refresh'#7'OnClick'#7#20'Refr'
|
||||
+'eshMenuitemCLICK'#0#0#0#0
|
||||
+'rView'#12'ClientHeight'#3#249#1#11'ClientWidth'#3#206#0#10'KeyPreview'#9#7
|
||||
+'OnClose'#7#21'CodeExplorerViewCLOSE'#8'OnCreate'#7#22'CodeExplorerViewCREAT'
|
||||
+'E'#8'OnResize'#7#22'CodeExplorerViewRESIZE'#18'HorzScrollBar.Page'#3#207#0
|
||||
+#18'VertScrollBar.Page'#3#250#1#4'Left'#3'z'#1#6'Height'#3#249#1#3'Top'#3#175
|
||||
+#0#5'Width'#3#206#0#0#7'TButton'#13'RefreshButton'#7'Caption'#6#7'Refresh'#8
|
||||
+'TabOrder'#2#0#7'OnClick'#7#18'RefreshButtonCLICK'#6'Height'#2#25#5'Width'#2
|
||||
+'`'#0#0#7'TButton'#13'OptionsButton'#7'Enabled'#8#7'Caption'#6#7'Options'#8
|
||||
+'TabOrder'#2#1#4'Left'#2'n'#6'Height'#2#25#5'Width'#2'`'#0#0#9'TTreeView'#12
|
||||
+'CodeTreeview'#5'Align'#7#8'alBottom'#17'DefaultItemHeight'#2#17#10'DragCurs'
|
||||
+'or'#4#244#255#0#0#13'HideSelection'#8#6'Images'#7#10'Imagelist1'#11'ParentC'
|
||||
+'tl3D'#8#9'PopupMenu'#7#13'TreePopupmenu'#16'RightClickSelect'#9#8'TabOrder'
|
||||
+#2#2#10'OnDblClick'#7#20'CodeTreeviewDBLCLICK'#10'OnDeletion'#7#20'CodeTreev'
|
||||
+'iewDELETION'#7'Options'#11#17'tvoAutoItemHeight'#21'tvoKeepCollapsedNodes'
|
||||
+#19'tvoRightClickSelect'#14'tvoShowButtons'#12'tvoShowLines'#11'tvoShowRoot'
|
||||
+#11'tvoToolTips'#0#6'Height'#3#224#1#3'Top'#2#25#5'Width'#3#206#0#0#0#10'TIm'
|
||||
+'ageList'#10'Imagelist1'#4'left'#2'@'#3'top'#2' '#0#0#10'TPopupMenu'#13'Tree'
|
||||
+'Popupmenu'#4'left'#2'@'#3'top'#2'H'#0#9'TMenuItem'#14'JumpToMenuitem'#7'Cap'
|
||||
+'tion'#6#14'Jump to source'#7'OnClick'#7#19'JumpToMenuitemCLICK'#0#0#9'TMenu'
|
||||
+'Item'#15'RefreshMenuitem'#7'Caption'#6#7'Refresh'#7'OnClick'#7#20'RefreshMe'
|
||||
+'nuitemCLICK'#0#0#0#0
|
||||
]);
|
||||
|
@ -35,6 +35,7 @@ uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Buttons,
|
||||
ComCtrls,
|
||||
CodeToolManager, CodeAtom, CodeCache, CodeTree, PascalParserTool,
|
||||
IDECommands,
|
||||
EnvironmentOpts, IDEOptionDefs, LazarusIDEStrConsts, InputHistory, IDEProcs,
|
||||
Menus;
|
||||
|
||||
@ -95,6 +96,8 @@ type
|
||||
function GetNodeImage(CodeNode: TCodeTreeNode): integer;
|
||||
procedure CreateNodes(ACodeTool: TCodeTool; CodeNode: TCodeTreeNode;
|
||||
ParentViewNode, InFrontViewNode: TTreeNode; CreateSiblings: boolean);
|
||||
protected
|
||||
procedure KeyUp(var Key: Word; Shift: TShiftState); override;
|
||||
public
|
||||
procedure BeginUpdate;
|
||||
procedure EndUpdate;
|
||||
@ -367,6 +370,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCodeExplorerView.KeyUp(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
inherited KeyUp(Key, Shift);
|
||||
ExecuteIDECommand(Self,Key,Shift,caMenuOnly);
|
||||
end;
|
||||
|
||||
procedure TCodeExplorerView.BeginUpdate;
|
||||
begin
|
||||
inc(FUpdateCount);
|
||||
|
@ -240,11 +240,6 @@ const
|
||||
ecCustomToolLast = ecUserFirst + 2999;
|
||||
|
||||
|
||||
const
|
||||
caAll = [caSourceEditor, caDesigner];
|
||||
caSrcEditOnly = [caSourceEditor];
|
||||
caDesignOnly = [caDesigner];
|
||||
|
||||
type
|
||||
TKeyMapScheme = (
|
||||
kmsLazarus,
|
||||
@ -1800,7 +1795,7 @@ begin
|
||||
// create default keymapping
|
||||
|
||||
// moving
|
||||
C:=Categories[AddCategory('CursorMoving',srkmCatCursorMoving,caSrcEditOnly)];
|
||||
C:=Categories[AddCategory('CursorMoving',srkmCatCursorMoving,caSrcEdit)];
|
||||
AddDefault(C,'Move cursor word left',ecWordLeft);
|
||||
AddDefault(C,'Move cursor word right',ecWordRight);
|
||||
AddDefault(C,'Move cursor to line start',ecLineStart);
|
||||
@ -1819,7 +1814,7 @@ begin
|
||||
AddDefault(C,'Scroll right one char',ecScrollRight);
|
||||
|
||||
// selection
|
||||
C:=Categories[AddCategory('Selection',srkmCatSelection,caSrcEditOnly)];
|
||||
C:=Categories[AddCategory('Selection',srkmCatSelection,caSrcEdit)];
|
||||
AddDefault(C,'Copy selection to clipboard',ecCopy);
|
||||
AddDefault(C,'Cut selection to clipboard',ecCut);
|
||||
AddDefault(C,'Paste clipboard to current position',ecPaste);
|
||||
@ -1849,7 +1844,7 @@ begin
|
||||
AddDefault(C,'Break Lines in selection',ecSelectionBreakLines);
|
||||
|
||||
// editing
|
||||
C:=Categories[AddCategory('editing commands',srkmCatEditing,caSrcEditOnly)];
|
||||
C:=Categories[AddCategory('editing commands',srkmCatEditing,caSrcEdit)];
|
||||
AddDefault(C,'Indent block',ecBlockIndent);
|
||||
AddDefault(C,'Unindent block',ecBlockUnindent);
|
||||
AddDefault(C,'Delete last char',ecDeleteLastChar);
|
||||
@ -1883,7 +1878,7 @@ begin
|
||||
AddDefault(C,'Redo',ecRedo);
|
||||
|
||||
// search & replace
|
||||
C:=Categories[AddCategory('SearchReplace',srkmCatSearchReplace,caSrcEditOnly)];
|
||||
C:=Categories[AddCategory('SearchReplace',srkmCatSearchReplace,caAll)];
|
||||
AddDefault(C,'Go to matching bracket',ecMatchBracket);
|
||||
AddDefault(C,'Find text',ecFind);
|
||||
AddDefault(C,'Find next',ecFindNext);
|
||||
@ -1901,7 +1896,7 @@ begin
|
||||
AddDefault(C,'Open file at cursor',ecOpenFileAtCursor);
|
||||
|
||||
// marker
|
||||
C:=Categories[AddCategory('Marker',srkmCatMarker,caSrcEditOnly)];
|
||||
C:=Categories[AddCategory('Marker',srkmCatMarker,caSrcEdit)];
|
||||
AddDefault(C,'Go to marker 0',ecGotoMarker0);
|
||||
AddDefault(C,'Go to marker 1',ecGotoMarker1);
|
||||
AddDefault(C,'Go to marker 2',ecGotoMarker2);
|
||||
@ -1924,7 +1919,7 @@ begin
|
||||
AddDefault(C,'Set marker 9',ecSetMarker9);
|
||||
|
||||
// codetools
|
||||
C:=Categories[AddCategory('CodeTools',srkmCatCodeTools,caSrcEditOnly)];
|
||||
C:=Categories[AddCategory('CodeTools',srkmCatCodeTools,caSrcEdit)];
|
||||
AddDefault(C,'Code template completion',ecAutoCompletion);
|
||||
AddDefault(C,'Word completion',ecWordCompletion);
|
||||
AddDefault(C,'Complete code',ecCompleteCode);
|
||||
@ -2055,7 +2050,7 @@ begin
|
||||
AddDefault(C,'About Lazarus',ecAboutLazarus);
|
||||
|
||||
// designer
|
||||
C:=Categories[AddCategory('Designer',lisKeyCatDesigner,caDesignOnly)];
|
||||
C:=Categories[AddCategory('Designer',lisKeyCatDesigner,caDesign)];
|
||||
AddDefault(C,'Copy selected Components to clipboard',ecCopyComponents);
|
||||
AddDefault(C,'Cut selected Components to clipboard',ecCutComponents);
|
||||
AddDefault(C,'Paste Components from clipboard',ecPasteComponents);
|
||||
|
82
ide/main.pp
82
ide/main.pp
@ -50,6 +50,8 @@ uses
|
||||
Dialogs,
|
||||
// codetools
|
||||
Laz_XMLCfg, CodeToolsStructs, CodeToolManager, CodeCache, DefineTemplates,
|
||||
// IDE interface
|
||||
AllIDEIntf, ObjectInspector, PropEdits, IDECommands,
|
||||
// synedit
|
||||
SynEditKeyCmds,
|
||||
// compile
|
||||
@ -60,7 +62,7 @@ uses
|
||||
// designer
|
||||
ComponentPalette, ComponentReg,
|
||||
Designer, FormEditor, CustomFormEditor,
|
||||
ObjectInspector, PropEdits, ControlSelection, AllIDEIntf,
|
||||
ControlSelection,
|
||||
{$DEFINE UseNewMenuEditor}
|
||||
{$IFDEF UseNewMenuEditor}
|
||||
MenuEditorForm,
|
||||
@ -240,12 +242,14 @@ type
|
||||
// Global IDE events
|
||||
procedure OnProcessIDECommand(Sender: TObject; Command: word;
|
||||
var Handled: boolean);
|
||||
procedure OnExecuteIDECommand(Sender: TObject;
|
||||
var Key: word; Shift: TShiftState; Areas: TCommandAreas);
|
||||
|
||||
// Environment options dialog events
|
||||
procedure OnLoadEnvironmentSettings(Sender: TObject;
|
||||
TheEnvironmentOptions: TEnvironmentOptions);
|
||||
TheEnvironmentOptions: TEnvironmentOptions);
|
||||
procedure OnSaveEnvironmentSettings(Sender: TObject;
|
||||
TheEnvironmentOptions: TEnvironmentOptions);
|
||||
TheEnvironmentOptions: TEnvironmentOptions);
|
||||
procedure DoShowEnvGeneralOptions(StartPage: TEnvOptsDialogPage);
|
||||
|
||||
// SourceNotebook events
|
||||
@ -283,6 +287,8 @@ type
|
||||
// ObjectInspector + PropertyEditorHook events
|
||||
procedure OIOnSelectPersistents(Sender: TObject);
|
||||
procedure OIOnShowOptions(Sender: TObject);
|
||||
procedure OIRemainingKeyUp(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
procedure OnPropHookGetMethods(TypeData:PTypeData; Proc:TGetStringProc);
|
||||
function OnPropHookMethodExists(const AMethodName:ShortString;
|
||||
TypeData: PTypeData;
|
||||
@ -319,6 +325,7 @@ type
|
||||
procedure OnDesignerRenameComponent(ADesigner: TDesigner;
|
||||
AComponent: TComponent; const NewName: string);
|
||||
|
||||
// control selection
|
||||
procedure OnControlSelectionChanged(Sender: TObject);
|
||||
procedure OnControlSelectionPropsChanged(Sender: TObject);
|
||||
procedure OnControlSelectionFormChanged(Sender: TObject; OldForm,
|
||||
@ -423,6 +430,7 @@ type
|
||||
procedure SetupSourceNotebook;
|
||||
procedure SetupTransferMacros;
|
||||
procedure SetupControlSelection;
|
||||
procedure SetupIDEInterface;
|
||||
procedure SetupStartProject;
|
||||
procedure ReOpenIDEWindows;
|
||||
|
||||
@ -566,8 +574,12 @@ type
|
||||
var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo);
|
||||
procedure GetDesignerUnit(ADesigner: TDesigner;
|
||||
var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo);
|
||||
procedure GetObjectInspectorUnit(
|
||||
var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo);
|
||||
procedure GetUnitWithForm(AForm: TCustomForm;
|
||||
var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo);
|
||||
procedure GetUnitWithPersistent(APersistent: TPersistent;
|
||||
var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo);
|
||||
function GetSourceEditorForUnitInfo(AnUnitInfo: TUnitInfo): TSourceEditor;
|
||||
procedure UpdateDefaultPascalFileExtensions;
|
||||
function CreateSrcEditPageName(const AnUnitName, AFilename: string;
|
||||
@ -890,6 +902,7 @@ begin
|
||||
SetupSourceNotebook;
|
||||
SetupTransferMacros;
|
||||
SetupControlSelection;
|
||||
SetupIDEInterface;
|
||||
|
||||
// Main IDE bar created and setup completed -> Show it
|
||||
Show;
|
||||
@ -933,6 +946,7 @@ begin
|
||||
Application.RemoveOnUserInputHandler(@OnApplicationUserInput);
|
||||
Application.RemoveOnIdleHandler(@OnApplicationIdle);
|
||||
Screen.RemoveHandlerRemoveForm(@OnScreenRemoveForm);
|
||||
IDECommands.OnExecuteIDECommand:=nil;
|
||||
|
||||
// free project, if it is still there
|
||||
FreeThenNil(Project1);
|
||||
@ -988,6 +1002,12 @@ begin
|
||||
DoShowEnvGeneralOptions(eodpObjectInspector);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OIRemainingKeyUp(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
begin
|
||||
OnExecuteIDECommand(Sender,Key,Shift,caDesign);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnPropHookGetMethods(TypeData:PTypeData;
|
||||
Proc:TGetStringProc);
|
||||
var ActiveSrcEdit: TSourceEditor;
|
||||
@ -1198,6 +1218,7 @@ begin
|
||||
ObjectInspector1 := TObjectInspector.Create(Self);
|
||||
ObjectInspector1.OnSelectPersistentsInOI:=@OIOnSelectPersistents;
|
||||
ObjectInspector1.OnShowOptions:=@OIOnShowOptions;
|
||||
ObjectInspector1.OnRemainingKeyUp:=@OIRemainingKeyUp;
|
||||
|
||||
GlobalDesignHook:=TPropertyEditorHook.Create;
|
||||
GlobalDesignHook.GetPrivateDirectory:=AppendPathDelim(GetPrimaryConfigPath);
|
||||
@ -1209,6 +1230,7 @@ begin
|
||||
GlobalDesignHook.AddHandlerBeforeAddComponent(@OnPropHookBeforeAddComponent);
|
||||
GlobalDesignHook.AddHandlerComponentRenamed(@OnPropHookComponentRenamed);
|
||||
GlobalDesignHook.AddHandlerComponentAdded(@OnPropHookComponentAdded);
|
||||
|
||||
ObjectInspector1.PropertyEditorHook:=GlobalDesignHook;
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(ObjectInspector1,
|
||||
DefaultObjectInspectorName);
|
||||
@ -1349,6 +1371,11 @@ begin
|
||||
TheControlSelection.OnSelectionFormChanged:=@OnControlSelectionFormChanged;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.SetupIDEInterface;
|
||||
begin
|
||||
IDECommands.OnExecuteIDECommand:=@OnExecuteIDECommand;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.SetupStartProject;
|
||||
var
|
||||
LastParam: String;
|
||||
@ -1881,10 +1908,14 @@ begin
|
||||
|
||||
case Command of
|
||||
ecSave:
|
||||
if Sender is TDesigner then begin
|
||||
if (Sender is TDesigner) then begin
|
||||
GetDesignerUnit(TDesigner(Sender),ASrcEdit,AnUnitInfo);
|
||||
if (AnUnitInfo<>nil) and (AnUnitInfo.EditorIndex>=0) then
|
||||
DoSaveEditorFile(AnUnitInfo.EditorIndex,[sfCheckAmbigiousFiles]);
|
||||
end else if (Sender is TObjectInspector) then begin
|
||||
GetObjectInspectorUnit(ASrcEdit,AnUnitInfo);
|
||||
if (AnUnitInfo<>nil) and (AnUnitInfo.EditorIndex>=0) then
|
||||
DoSaveEditorFile(AnUnitInfo.EditorIndex,[sfCheckAmbigiousFiles]);
|
||||
end else if Sender is TSourceNotebook then
|
||||
mnuSaveClicked(Self);
|
||||
|
||||
@ -1996,6 +2027,21 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnExecuteIDECommand(Sender: TObject; var Key: word;
|
||||
Shift: TShiftState; Areas: TCommandAreas);
|
||||
var
|
||||
CommandRelation: TKeyCommandRelation;
|
||||
Handled: Boolean;
|
||||
begin
|
||||
writeln('TMainIDE.OnExecuteIDECommand A ',Key);
|
||||
CommandRelation:=EditorOpts.KeyMap.Find(Key,Shift,Areas);
|
||||
if (CommandRelation=nil) or (CommandRelation.Command=ecNone) then exit;
|
||||
Handled:=false;
|
||||
writeln('TMainIDE.OnExecuteIDECommand B ',CommandRelation.Command,' ',ecSave);
|
||||
OnProcessIDECommand(Sender,CommandRelation.Command,Handled);
|
||||
if Handled then Key:=VK_UNKNOWN;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnSrcNoteBookCtrlMouseUp(Sender: TObject;
|
||||
Button: TMouseButton; Shift: TShiftstate; X, Y: Integer);
|
||||
var
|
||||
@ -6715,6 +6761,18 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.GetObjectInspectorUnit(
|
||||
var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo);
|
||||
begin
|
||||
ActiveSourceEditor:=nil;
|
||||
ActiveUnitInfo:=nil;
|
||||
if (ObjectInspector1=nil) or (ObjectInspector1.PropertyEditorHook=nil)
|
||||
or (ObjectInspector1.PropertyEditorHook.LookupRoot=nil)
|
||||
then exit;
|
||||
GetUnitWithPersistent(ObjectInspector1.PropertyEditorHook.LookupRoot,
|
||||
ActiveSourceEditor,ActiveUnitInfo);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.GetUnitWithForm(AForm: TCustomForm;
|
||||
var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo);
|
||||
var
|
||||
@ -6726,9 +6784,20 @@ begin
|
||||
AComponent:=TDesigner(AForm.Designer).LookupRoot;
|
||||
if AComponent=nil then
|
||||
RaiseException('TMainIDE.GetUnitWithForm AComponent=nil');
|
||||
GetUnitWithPersistent(AComponent,ActiveSourceEditor,ActiveUnitInfo);
|
||||
end else begin
|
||||
ActiveSourceEditor:=nil;
|
||||
ActiveUnitInfo:=nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.GetUnitWithPersistent(APersistent: TPersistent;
|
||||
var ActiveSourceEditor: TSourceEditor; var ActiveUnitInfo: TUnitInfo);
|
||||
begin
|
||||
if APersistent<>nil then begin
|
||||
ActiveUnitInfo:=Project1.FirstUnitWithComponent;
|
||||
while ActiveUnitInfo<>nil do begin
|
||||
if ActiveUnitInfo.Component=AComponent then begin
|
||||
if ActiveUnitInfo.Component=APersistent then begin
|
||||
ActiveSourceEditor:=SourceNoteBook.FindSourceEditorWithPageIndex(
|
||||
ActiveUnitInfo.EditorIndex);
|
||||
exit;
|
||||
@ -10345,6 +10414,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.727 2004/05/29 17:20:05 mattias
|
||||
implemented handling keys in IDE windows
|
||||
|
||||
Revision 1.726 2004/05/29 14:52:18 mattias
|
||||
implemented go to next/previous error
|
||||
|
||||
|
@ -253,6 +253,8 @@ type
|
||||
itmJumpForward: TMenuItem;
|
||||
itmAddJumpPoint: TMenuItem;
|
||||
itmJumpHistory: TMenuItem;
|
||||
itmJumpToNextError: TMenuItem;
|
||||
itmJumpToPrevError: TMenuItem;
|
||||
itmFindBlockOtherEnd: TMenuItem;
|
||||
itmFindBlockStart: TMenuItem;
|
||||
itmFindDeclaration: TMenuItem;
|
||||
@ -725,6 +727,8 @@ begin
|
||||
CreateMenuItem(mnuSearch,itmJumpForward,'itmJumpForward',lisMenuJumpForward);
|
||||
CreateMenuItem(mnuSearch,itmAddJumpPoint,'itmAddJumpPoint',lisMenuAddJumpPointToHistory);
|
||||
CreateMenuItem(mnuSearch,itmJumpHistory,'itmJumpHistory',lisMenuViewJumpHistory);
|
||||
CreateMenuItem(mnuSearch,itmJumpHistory,'itmJumpToNextError',lisMenuJumpToNextError);
|
||||
CreateMenuItem(mnuSearch,itmJumpHistory,'itmJumpToPrevError',lisMenuJumpToPrevError);
|
||||
|
||||
mnuSearch.Add(CreateMenuSeparator);
|
||||
|
||||
@ -944,6 +948,8 @@ begin
|
||||
itmJumpForward.ShortCut:=CommandToShortCut(ecJumpForward);
|
||||
itmAddJumpPoint.ShortCut:=CommandToShortCut(ecAddJumpPoint);
|
||||
itmJumpHistory.ShortCut:=CommandToShortCut(ecViewJumpHistory);
|
||||
itmJumpToNextError.ShortCut:=CommandToShortCut(ecJumpToNextError);
|
||||
itmJumpToPrevError.ShortCut:=CommandToShortCut(ecJumpToPrevError);
|
||||
itmFindBlockOtherEnd.ShortCut:=CommandToShortCut(ecFindBlockOtherEnd);
|
||||
itmFindBlockStart.ShortCut:=CommandToShortCut(ecFindBlockStart);
|
||||
itmFindDeclaration.ShortCut:=CommandToShortCut(ecFindDeclaration);
|
||||
|
@ -38,7 +38,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Controls, StdCtrls, Forms, LResources, IDEProcs,
|
||||
IDEOptionDefs, EnvironmentOpts, LazarusIDEStrConsts;
|
||||
IDEOptionDefs, IDECommands, EnvironmentOpts, LazarusIDEStrConsts;
|
||||
|
||||
type
|
||||
{ TMessageLine }
|
||||
@ -68,6 +68,8 @@ type
|
||||
MessageView: TListBox;
|
||||
procedure MessageViewDblClicked(Sender: TObject);
|
||||
Procedure MessageViewClicked(sender : TObject);
|
||||
procedure MessagesViewKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
private
|
||||
FItems: TList; // list of TMessageLine
|
||||
FVisibleItems: TList; // list of TMessageLine (visible Items of FItems)
|
||||
@ -149,6 +151,8 @@ Begin
|
||||
ItemByEnum(nmiwMessagesViewName);
|
||||
ALayout.Form:=TForm(Self);
|
||||
ALayout.Apply;
|
||||
KeyPreview:=true;
|
||||
OnKeyDown:=@MessagesViewKeyDown;
|
||||
end;
|
||||
|
||||
destructor TMessagesView.Destroy;
|
||||
@ -388,6 +392,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMessagesView.MessagesViewKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
begin
|
||||
ExecuteIDECommand(Self,Key,Shift);
|
||||
end;
|
||||
|
||||
function TMessagesView.GetDirectory: string;
|
||||
var
|
||||
i: Integer;
|
||||
|
@ -40,6 +40,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, LResources, Forms, Controls, Buttons, ComCtrls,
|
||||
StdCtrls, Menus, Dialogs, Graphics, FileCtrl,
|
||||
IDECommands,
|
||||
LazarusIDEStrConsts, IDEProcs, IDEOptionDefs, EnvironmentOpts,
|
||||
Project, AddToProjectDlg, PackageSystem, PackageDefs;
|
||||
|
||||
@ -104,6 +105,8 @@ type
|
||||
function GetImageIndexOfFile(AFile: TUnitInfo): integer;
|
||||
procedure OnProjectBeginUpdate(Sender: TObject);
|
||||
procedure OnProjectEndUpdate(Sender: TObject; ProjectChanged: boolean);
|
||||
protected
|
||||
procedure KeyUp(var Key: Word; Shift: TShiftState); override;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -602,6 +605,12 @@ begin
|
||||
EndUpdate;
|
||||
end;
|
||||
|
||||
procedure TProjectInspectorForm.KeyUp(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
inherited KeyDown(Key, Shift);
|
||||
ExecuteIDECommand(Self,Key,Shift,caMenuOnly);
|
||||
end;
|
||||
|
||||
function TProjectInspectorForm.GetSelectedFile: TUnitInfo;
|
||||
var
|
||||
CurNode: TTreeNode;
|
||||
@ -679,6 +688,7 @@ begin
|
||||
inherited Create(TheOwner);
|
||||
Name:=NonModalIDEWindowNames[nmiwProjectInspector];
|
||||
Caption:=lisMenuProjectInspector;
|
||||
KeyPreview:=true;
|
||||
|
||||
ALayout:=EnvironmentOptions.IDEWindowLayoutList.ItemByFormID(Name);
|
||||
ALayout.Form:=TForm(Self);
|
||||
@ -688,6 +698,7 @@ begin
|
||||
OnResize:=@ProjectInspectorFormResize;
|
||||
OnResize(Self);
|
||||
OnShow:=@ProjectInspectorFormShow;
|
||||
KeyPreview:=true;
|
||||
end;
|
||||
|
||||
destructor TProjectInspectorForm.Destroy;
|
||||
|
@ -47,6 +47,7 @@ uses
|
||||
Classes, SysUtils, Controls, Forms, Dialogs, Buttons, ComCtrls, StdCtrls,
|
||||
Graphics, LCLType, FileCtrl, LResources,
|
||||
CodeToolManager, CodeCache,
|
||||
IDECommands,
|
||||
EnvironmentOpts, IDEOptionDefs, LazarusIDEStrConsts, InputHistory;
|
||||
|
||||
type
|
||||
@ -198,6 +199,8 @@ type
|
||||
procedure RebuildTree;
|
||||
procedure SetRootFilename(const AValue: string);
|
||||
procedure SetRootShortFilename(const AValue: string);
|
||||
protected
|
||||
procedure KeyUp(var Key: Word; Shift: TShiftState); override;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -413,6 +416,12 @@ begin
|
||||
FRootNode.ShortFilename:=AValue;
|
||||
end;
|
||||
|
||||
procedure TUnitDependenciesView.KeyUp(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
inherited KeyUp(Key, Shift);
|
||||
ExecuteIDECommand(Self,Key,Shift,caMenuOnly);
|
||||
end;
|
||||
|
||||
function TUnitDependenciesView.RootValid: boolean;
|
||||
begin
|
||||
Result:=FRootValid;
|
||||
@ -439,6 +448,7 @@ begin
|
||||
Name:=NonModalIDEWindowNames[nmiwUnitDependenciesName];
|
||||
Caption := dlgUnitDepCaption;
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(Self,Name);
|
||||
KeyPreview:=true;
|
||||
|
||||
SrcTypeImageList:=TImageList.Create(Self);
|
||||
with SrcTypeImageList do
|
||||
|
@ -38,9 +38,16 @@ uses
|
||||
Classes, SysUtils, LCLType;
|
||||
|
||||
type
|
||||
TCommandArea = (caSourceEditor, caDesigner);
|
||||
TCommandArea = (caMenu, caSourceEditor, caDesigner);
|
||||
TCommandAreas = set of TCommandArea;
|
||||
|
||||
const
|
||||
caAll = [caMenu, caSourceEditor, caDesigner];
|
||||
caMenuOnly = [caMenu];
|
||||
caSrcEdit = [caMenu,caSourceEditor];
|
||||
caDesign = [caMenu,caDesigner];
|
||||
|
||||
|
||||
type
|
||||
TIDEShortCut = record
|
||||
Key1: word;
|
||||
Shift1: TShiftState;
|
||||
@ -100,6 +107,20 @@ function IDEShortCut(Key1: word; Shift1: TShiftState;
|
||||
Key2: word; Shift2: TShiftState): TIDEShortCut;
|
||||
|
||||
|
||||
type
|
||||
TExecuteIDECommand = procedure(Sender: TObject;
|
||||
var Key: word; Shift: TShiftState;
|
||||
Areas: TCommandAreas) of object;
|
||||
|
||||
var
|
||||
// will be set by the IDE
|
||||
OnExecuteIDECommand: TExecuteIDECommand;
|
||||
|
||||
procedure ExecuteIDECommand(Sender: TObject; var Key: word; Shift: TShiftState;
|
||||
Areas: TCommandAreas);
|
||||
procedure ExecuteIDECommand(Sender: TObject; var Key: word; Shift: TShiftState);
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
@ -112,6 +133,18 @@ begin
|
||||
Result.Shift2:=Shift2;
|
||||
end;
|
||||
|
||||
procedure ExecuteIDECommand(Sender: TObject; var Key: word; Shift: TShiftState;
|
||||
Areas: TCommandAreas);
|
||||
begin
|
||||
if (OnExecuteIDECommand<>nil) and (Key<>VK_UNKNOWN) then
|
||||
OnExecuteIDECommand(Sender,Key,Shift,Areas);
|
||||
end;
|
||||
|
||||
procedure ExecuteIDECommand(Sender: TObject; var Key: word; Shift: TShiftState);
|
||||
begin
|
||||
OnExecuteIDECommand(Sender,Key,Shift,caMenuOnly);
|
||||
end;
|
||||
|
||||
{ TIDECommandCategory }
|
||||
|
||||
procedure TIDECommandCategory.Delete(Index: Integer);
|
||||
|
@ -358,6 +358,7 @@ type
|
||||
procedure OnMainPopupMenuPopup(Sender: TObject);
|
||||
procedure HookRefreshPropertyValues;
|
||||
private
|
||||
FOnRemainingKeyUp: TKeyEvent;
|
||||
FSelection: TPersistentSelectionList;
|
||||
FComponentTreeHeight: integer;
|
||||
FDefaultItemHeight: integer;
|
||||
@ -414,6 +415,7 @@ type
|
||||
read FPropertyEditorHook write SetPropertyEditorHook;
|
||||
property OnModified: TNotifyEvent read FOnModified write FOnModified;
|
||||
property OnShowOptions: TNotifyEvent read FOnShowOptions write SetOnShowOptions;
|
||||
property OnRemainingKeyUp: TKeyEvent read FOnRemainingKeyUp write FOnRemainingKeyUp;
|
||||
property ShowComponentTree: boolean read FShowComponentTree write SetShowComponentTree;
|
||||
property ComponentTreeHeight: integer read FComponentTreeHeight write SetComponentTreeHeight;
|
||||
property UsePairSplitter: boolean read FUsePairSplitter write SetUsePairSplitter;
|
||||
@ -2261,16 +2263,18 @@ constructor TObjectInspector.Create(AnOwner: TComponent);
|
||||
|
||||
begin
|
||||
inherited Create(AnOwner);
|
||||
Caption := oisObjectInspector;
|
||||
FPropertyEditorHook:=nil;
|
||||
FSelection:=TPersistentSelectionList.Create;
|
||||
FUpdatingAvailComboBox:=false;
|
||||
Name := DefaultObjectInspectorName;
|
||||
FDefaultItemHeight := 22;
|
||||
FComponentTreeHeight:=100;
|
||||
FShowComponentTree:=true;
|
||||
FUsePairSplitter:=TPairSplitter.IsSupportedByInterface;
|
||||
|
||||
Caption := oisObjectInspector;
|
||||
Name := DefaultObjectInspectorName;
|
||||
KeyPreview:=true;
|
||||
|
||||
// StatusBar
|
||||
StatusBar:=TStatusBar.Create(Self);
|
||||
with StatusBar do begin
|
||||
@ -2844,6 +2848,8 @@ begin
|
||||
if Key=VK_UNKNOWN then exit;
|
||||
end;
|
||||
inherited KeyDown(Key, Shift);
|
||||
if (Key<>VK_UNKNOWN) and Assigned(OnRemainingKeyUp) then
|
||||
OnRemainingKeyUp(Self,Key,Shift);
|
||||
end;
|
||||
|
||||
procedure TObjectInspector.OnShowHintPopupMenuItemClick(Sender : TObject);
|
||||
|
@ -40,6 +40,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, LResources, Forms, Controls, Buttons, ComCtrls,
|
||||
StdCtrls, Menus, Dialogs, Graphics, FileCtrl, AVL_Tree,
|
||||
IDECommands,
|
||||
LazConf, LazarusIDEStrConsts, IDEProcs, IDEOptionDefs, EnvironmentOpts,
|
||||
Project, PackageDefs, PackageSystem, PackageEditor;
|
||||
|
||||
@ -86,6 +87,8 @@ type
|
||||
procedure GetCurrentIsUsedBy(var Dependency: TPkgDependency);
|
||||
function SearchParentNodeWithText(ANode: TTreeNode;
|
||||
const NodeText: string): TTreeNode;
|
||||
protected
|
||||
procedure KeyUp(var Key: Word; Shift: TShiftState); override;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -444,6 +447,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TPkgGraphExplorer.KeyUp(var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
inherited KeyUp(Key, Shift);
|
||||
ExecuteIDECommand(Self,Key,Shift,caMenuOnly);
|
||||
end;
|
||||
|
||||
constructor TPkgGraphExplorer.Create(TheOwner: TComponent);
|
||||
var
|
||||
ALayout: TIDEWindowLayout;
|
||||
@ -453,6 +462,7 @@ begin
|
||||
fSortedPackages:=TAVLTree.Create(@CompareLazPackageID);
|
||||
Name:=NonModalIDEWindowNames[nmiwPkgGraphExplorer];
|
||||
Caption:=lisMenuPackageGraph;
|
||||
KeyPreview:=true;
|
||||
|
||||
ALayout:=EnvironmentOptions.IDEWindowLayoutList.ItemByFormID(Name);
|
||||
ALayout.Form:=TForm(Self);
|
||||
|
Loading…
Reference in New Issue
Block a user