mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 10:49:16 +02:00
IDE: started find overloads dlg
git-svn-id: trunk@19736 -
This commit is contained in:
parent
ea97d80f56
commit
a73e46e40c
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -2608,6 +2608,9 @@ ide/filereferencelist.pas svneol=native#text/pascal
|
|||||||
ide/findinfilesdlg.lfm svneol=native#text/plain
|
ide/findinfilesdlg.lfm svneol=native#text/plain
|
||||||
ide/findinfilesdlg.lrs svneol=native#text/plain
|
ide/findinfilesdlg.lrs svneol=native#text/plain
|
||||||
ide/findinfilesdlg.pas svneol=native#text/pascal
|
ide/findinfilesdlg.pas svneol=native#text/pascal
|
||||||
|
ide/findoverloadsdlg.lfm svneol=native#text/plain
|
||||||
|
ide/findoverloadsdlg.lrs svneol=native#text/plain
|
||||||
|
ide/findoverloadsdlg.pas svneol=native#text/plain
|
||||||
ide/findpalettecomp.lfm svneol=native#text/plain
|
ide/findpalettecomp.lfm svneol=native#text/plain
|
||||||
ide/findpalettecomp.lrs svneol=native#text/plain
|
ide/findpalettecomp.lrs svneol=native#text/plain
|
||||||
ide/findpalettecomp.pas svneol=native#text/plain
|
ide/findpalettecomp.pas svneol=native#text/plain
|
||||||
|
79
ide/findoverloadsdlg.lfm
Normal file
79
ide/findoverloadsdlg.lfm
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
object FindOverloadsDialog: TFindOverloadsDialog
|
||||||
|
Left = 297
|
||||||
|
Height = 338
|
||||||
|
Top = 171
|
||||||
|
Width = 548
|
||||||
|
ActiveControl = CurTreeView
|
||||||
|
Caption = 'FindOverloadsDialog'
|
||||||
|
ClientHeight = 338
|
||||||
|
ClientWidth = 548
|
||||||
|
OnCreate = FormCreate
|
||||||
|
Position = poScreenCenter
|
||||||
|
LCLVersion = '0.9.27'
|
||||||
|
object ButtonPanel1: TButtonPanel
|
||||||
|
Left = 6
|
||||||
|
Height = 44
|
||||||
|
Top = 288
|
||||||
|
Width = 536
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object CurGroupBox: TGroupBox
|
||||||
|
Left = 6
|
||||||
|
Height = 72
|
||||||
|
Top = 6
|
||||||
|
Width = 536
|
||||||
|
Align = alTop
|
||||||
|
BorderSpacing.Around = 6
|
||||||
|
Caption = 'CurGroupBox'
|
||||||
|
ClientHeight = 53
|
||||||
|
ClientWidth = 532
|
||||||
|
TabOrder = 1
|
||||||
|
object CurTreeView: TTreeView
|
||||||
|
Left = 0
|
||||||
|
Height = 53
|
||||||
|
Top = 0
|
||||||
|
Width = 532
|
||||||
|
Align = alClient
|
||||||
|
DefaultItemHeight = 19
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object ResultsGroupBox: TGroupBox
|
||||||
|
Left = 6
|
||||||
|
Height = 198
|
||||||
|
Top = 84
|
||||||
|
Width = 536
|
||||||
|
Align = alClient
|
||||||
|
BorderSpacing.Around = 6
|
||||||
|
Caption = 'ResultsGroupBox'
|
||||||
|
ClientHeight = 179
|
||||||
|
ClientWidth = 532
|
||||||
|
TabOrder = 2
|
||||||
|
object ResultsTreeView: TTreeView
|
||||||
|
Left = 0
|
||||||
|
Height = 136
|
||||||
|
Top = 0
|
||||||
|
Width = 532
|
||||||
|
Align = alClient
|
||||||
|
DefaultItemHeight = 19
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object ResultsProgressBar: TProgressBar
|
||||||
|
Left = 0
|
||||||
|
Height = 21
|
||||||
|
Top = 136
|
||||||
|
Width = 532
|
||||||
|
Align = alBottom
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
object SearchAllCheckBox: TCheckBox
|
||||||
|
Left = 0
|
||||||
|
Height = 22
|
||||||
|
Top = 157
|
||||||
|
Width = 532
|
||||||
|
Align = alBottom
|
||||||
|
Caption = 'SearchAllCheckBox'
|
||||||
|
TabOrder = 2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
25
ide/findoverloadsdlg.lrs
Normal file
25
ide/findoverloadsdlg.lrs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{ This is an automatically generated lazarus resource file }
|
||||||
|
|
||||||
|
LazarusResources.Add('TFindOverloadsDialog','FORMDATA',[
|
||||||
|
'TPF0'#20'TFindOverloadsDialog'#19'FindOverloadsDialog'#4'Left'#3')'#1#6'Heig'
|
||||||
|
+'ht'#3'R'#1#3'Top'#3#171#0#5'Width'#3'$'#2#13'ActiveControl'#7#11'CurTreeVie'
|
||||||
|
+'w'#7'Caption'#6#19'FindOverloadsDialog'#12'ClientHeight'#3'R'#1#11'ClientWi'
|
||||||
|
+'dth'#3'$'#2#8'OnCreate'#7#10'FormCreate'#8'Position'#7#14'poScreenCenter'#10
|
||||||
|
+'LCLVersion'#6#6'0.9.27'#0#12'TButtonPanel'#12'ButtonPanel1'#4'Left'#2#6#6'H'
|
||||||
|
+'eight'#2','#3'Top'#3' '#1#5'Width'#3#24#2#8'TabOrder'#2#0#0#0#9'TGroupBox'
|
||||||
|
+#11'CurGroupBox'#4'Left'#2#6#6'Height'#2'H'#3'Top'#2#6#5'Width'#3#24#2#5'Ali'
|
||||||
|
+'gn'#7#5'alTop'#20'BorderSpacing.Around'#2#6#7'Caption'#6#11'CurGroupBox'#12
|
||||||
|
+'ClientHeight'#2'5'#11'ClientWidth'#3#20#2#8'TabOrder'#2#1#0#9'TTreeView'#11
|
||||||
|
+'CurTreeView'#4'Left'#2#0#6'Height'#2'5'#3'Top'#2#0#5'Width'#3#20#2#5'Align'
|
||||||
|
+#7#8'alClient'#17'DefaultItemHeight'#2#19#8'TabOrder'#2#0#0#0#0#9'TGroupBox'
|
||||||
|
+#15'ResultsGroupBox'#4'Left'#2#6#6'Height'#3#198#0#3'Top'#2'T'#5'Width'#3#24
|
||||||
|
+#2#5'Align'#7#8'alClient'#20'BorderSpacing.Around'#2#6#7'Caption'#6#15'Resul'
|
||||||
|
+'tsGroupBox'#12'ClientHeight'#3#179#0#11'ClientWidth'#3#20#2#8'TabOrder'#2#2
|
||||||
|
+#0#9'TTreeView'#15'ResultsTreeView'#4'Left'#2#0#6'Height'#3#136#0#3'Top'#2#0
|
||||||
|
+#5'Width'#3#20#2#5'Align'#7#8'alClient'#17'DefaultItemHeight'#2#19#8'TabOrde'
|
||||||
|
+'r'#2#0#0#0#12'TProgressBar'#18'ResultsProgressBar'#4'Left'#2#0#6'Height'#2
|
||||||
|
+#21#3'Top'#3#136#0#5'Width'#3#20#2#5'Align'#7#8'alBottom'#8'TabOrder'#2#1#0#0
|
||||||
|
+#9'TCheckBox'#17'SearchAllCheckBox'#4'Left'#2#0#6'Height'#2#22#3'Top'#3#157#0
|
||||||
|
+#5'Width'#3#20#2#5'Align'#7#8'alBottom'#7'Caption'#6#17'SearchAllCheckBox'#8
|
||||||
|
+'TabOrder'#2#2#0#0#0#0
|
||||||
|
]);
|
208
ide/findoverloadsdlg.pas
Normal file
208
ide/findoverloadsdlg.pas
Normal file
@ -0,0 +1,208 @@
|
|||||||
|
{
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* This source is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This code is distributed in the hope that it will be useful, but *
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||||
|
* General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* A copy of the GNU General Public License is available on the World *
|
||||||
|
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
|
||||||
|
* obtain it by writing to the Free Software Foundation, *
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
Author: Mattias Gaertner
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
Find all alternative declarations of an identifier.
|
||||||
|
}
|
||||||
|
unit FindOverloadsDlg;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||||||
|
ExtCtrls, StdCtrls, Buttons, ButtonPanel, ComCtrls, AvgLvlTree,
|
||||||
|
// codetools
|
||||||
|
CodeTree, CodeCache,
|
||||||
|
// IDE
|
||||||
|
SrcEditorIntf
|
||||||
|
;
|
||||||
|
|
||||||
|
type
|
||||||
|
TFOWNode = class
|
||||||
|
public
|
||||||
|
Identifier: string;
|
||||||
|
Desc: TCodeTreeNodeDesc;
|
||||||
|
Code: TCodeBuffer;
|
||||||
|
Position: integer;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TFOWFile }
|
||||||
|
|
||||||
|
TFOWFile = class
|
||||||
|
private
|
||||||
|
FCode: TCodeBuffer;
|
||||||
|
FFilename: string;
|
||||||
|
FScanned: boolean;
|
||||||
|
procedure SetCode(const AValue: TCodeBuffer);
|
||||||
|
procedure SetScanned(const AValue: boolean);
|
||||||
|
public
|
||||||
|
constructor Create(const TheFilename: string);
|
||||||
|
destructor Destroy; override;
|
||||||
|
property Filename: string read FFilename;
|
||||||
|
property Scanned: boolean read FScanned write SetScanned;
|
||||||
|
property Code: TCodeBuffer read FCode write SetCode;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TFindOverloadScope = (
|
||||||
|
fosProject,
|
||||||
|
fosPackages,
|
||||||
|
fosFPC
|
||||||
|
);
|
||||||
|
TFindOverloadScopes = set of TFindOverloadScope;
|
||||||
|
|
||||||
|
TFOWStage = (
|
||||||
|
fowsStart,
|
||||||
|
fowsFinished
|
||||||
|
);
|
||||||
|
|
||||||
|
{ TFindOverloadWorker }
|
||||||
|
|
||||||
|
TFindOverloadWorker = class
|
||||||
|
private
|
||||||
|
FFiles: TAvgLvlTree;
|
||||||
|
FScanFiles: TAvgLvlTree;
|
||||||
|
public
|
||||||
|
Scopes: TFindOverloadScopes;
|
||||||
|
CompletedScopes: TFindOverloadScopes;
|
||||||
|
constructor Create;
|
||||||
|
destructor Destroy; override;
|
||||||
|
procedure Clear;
|
||||||
|
procedure Work;
|
||||||
|
function Done: boolean;
|
||||||
|
property Files: TAvgLvlTree read FFiles; // tree of TFindOverloadWorkerFile
|
||||||
|
property ScanFiles: TAvgLvlTree read FScanFiles;// tree of TFindOverloadWorkerFile
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TFindOverloadsDialog }
|
||||||
|
|
||||||
|
TFindOverloadsDialog = class(TForm)
|
||||||
|
ButtonPanel1: TButtonPanel;
|
||||||
|
SearchAllCheckBox: TCheckBox;
|
||||||
|
CurGroupBox: TGroupBox;
|
||||||
|
ResultsProgressBar: TProgressBar;
|
||||||
|
ResultsGroupBox: TGroupBox;
|
||||||
|
CurTreeView: TTreeView;
|
||||||
|
ResultsTreeView: TTreeView;
|
||||||
|
procedure FormCreate(Sender: TObject);
|
||||||
|
private
|
||||||
|
public
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ShowFindOverloadsDialog: TModalResult;
|
||||||
|
function ShowFindOverloadsDialog(Code: TCodeBuffer; X, Y: integer): TModalResult;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
function ShowFindOverloadsDialog: TModalResult;
|
||||||
|
var
|
||||||
|
SrcEdit: TSourceEditorInterface;
|
||||||
|
Code: TCodeBuffer;
|
||||||
|
XY: TPoint;
|
||||||
|
begin
|
||||||
|
SrcEdit:=SourceEditorWindow.ActiveEditor;
|
||||||
|
if SrcEdit=nil then
|
||||||
|
exit(mrCancel);
|
||||||
|
Code:=TCodeBuffer(SrcEdit.CodeToolsBuffer);
|
||||||
|
XY:=SrcEdit.CursorTextXY;
|
||||||
|
Result:=ShowFindOverloadsDialog(Code,XY.X,XY.Y);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ShowFindOverloadsDialog(Code: TCodeBuffer; X, Y: integer
|
||||||
|
): TModalResult;
|
||||||
|
var
|
||||||
|
FindOverloadsDialog: TFindOverloadsDialog;
|
||||||
|
begin
|
||||||
|
FindOverloadsDialog:=TFindOverloadsDialog.Create(nil);
|
||||||
|
try
|
||||||
|
Result:=FindOverloadsDialog.ShowModal;
|
||||||
|
finally
|
||||||
|
FindOverloadsDialog.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TFindOverloadsDialog }
|
||||||
|
|
||||||
|
procedure TFindOverloadsDialog.FormCreate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Caption:='Find overloads';
|
||||||
|
CurGroupBox.Caption:='Current identifier';
|
||||||
|
ResultsGroupBox.Caption:='Overloads';
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TFOWFile }
|
||||||
|
|
||||||
|
procedure TFOWFile.SetCode(const AValue: TCodeBuffer);
|
||||||
|
begin
|
||||||
|
if FCode=AValue then exit;
|
||||||
|
FCode:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TFOWFile.SetScanned(const AValue: boolean);
|
||||||
|
begin
|
||||||
|
if FScanned=AValue then exit;
|
||||||
|
FScanned:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TFOWFile.Create(const TheFilename: string);
|
||||||
|
begin
|
||||||
|
FFilename:=TheFilename;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TFOWFile.Destroy;
|
||||||
|
begin
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TFindOverloadWorker }
|
||||||
|
|
||||||
|
constructor TFindOverloadWorker.Create;
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TFindOverloadWorker.Destroy;
|
||||||
|
begin
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TFindOverloadWorker.Clear;
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TFindOverloadWorker.Work;
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TFindOverloadWorker.Done: boolean;
|
||||||
|
begin
|
||||||
|
Result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
{$I findoverloadsdlg.lrs}
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
17
ide/main.pp
17
ide/main.pp
@ -130,15 +130,16 @@ uses
|
|||||||
debugger_language_exceptions_options, debugger_signals_options,
|
debugger_language_exceptions_options, debugger_signals_options,
|
||||||
codeexplorer_update_options, codeexplorer_categories_options,
|
codeexplorer_update_options, codeexplorer_categories_options,
|
||||||
codeobserver_options,
|
codeobserver_options,
|
||||||
PublishModule, EnvironmentOpts, TransferMacros, KeyMapping,
|
PublishModule, EnvironmentOpts, TransferMacros, KeyMapping, IDETranslations,
|
||||||
IDETranslations, IDEProcs, ExtToolDialog, ExtToolEditDlg, OutputFilter, JumpHistoryView,
|
IDEProcs, ExtToolDialog, ExtToolEditDlg, OutputFilter, JumpHistoryView,
|
||||||
BuildLazDialog, MiscOptions, InputHistory, UnitDependencies, ClipBoardHistory,
|
BuildLazDialog, MiscOptions, InputHistory, UnitDependencies, ClipBoardHistory,
|
||||||
ProcessList, InitialSetupDlgs, NewDialog, MakeResStrDlg, ToDoList,
|
ProcessList, InitialSetupDlgs, NewDialog, MakeResStrDlg, ToDoList,
|
||||||
DialogProcs, FindReplaceDialog, FindInFilesDlg, CodeExplorer, BuildFileDlg,
|
DialogProcs, FindReplaceDialog, FindInFilesDlg, CodeExplorer, BuildFileDlg,
|
||||||
ProcedureList, ExtractProcDlg, FindRenameIdentifier, AbstractsMethodsDlg,
|
ProcedureList, ExtractProcDlg, FindRenameIdentifier, AbstractsMethodsDlg,
|
||||||
EmptyMethodsDlg, UnusedUnitsDlg, CleanDirDlg, CodeContextForm, AboutFrm,
|
EmptyMethodsDlg, UnusedUnitsDlg, FindOverloadsDlg, CleanDirDlg,
|
||||||
CompatibilityRestrictions, RestrictionBrowser, ProjectWizardDlg, IDECmdLine,
|
CodeContextForm, AboutFrm, CompatibilityRestrictions, RestrictionBrowser,
|
||||||
BuildManager, CodeExplOpts,
|
ProjectWizardDlg, IDECmdLine, CodeExplOpts,
|
||||||
|
BuildManager,
|
||||||
// main ide
|
// main ide
|
||||||
MainBar, MainIntf, MainBase;
|
MainBar, MainIntf, MainBase;
|
||||||
|
|
||||||
@ -871,6 +872,7 @@ type
|
|||||||
function DoShowAbstractMethods: TModalResult;
|
function DoShowAbstractMethods: TModalResult;
|
||||||
function DoRemoveEmptyMethods: TModalResult;
|
function DoRemoveEmptyMethods: TModalResult;
|
||||||
function DoRemoveUnusedUnits: TModalResult;
|
function DoRemoveUnusedUnits: TModalResult;
|
||||||
|
function DoFindOverloads: TModalResult;
|
||||||
function DoInitIdentCompletion(JumpToError: boolean): boolean;
|
function DoInitIdentCompletion(JumpToError: boolean): boolean;
|
||||||
function DoShowCodeContext(JumpToError: boolean): boolean;
|
function DoShowCodeContext(JumpToError: boolean): boolean;
|
||||||
procedure DoCompleteCodeAtCursor;
|
procedure DoCompleteCodeAtCursor;
|
||||||
@ -12796,6 +12798,11 @@ begin
|
|||||||
Result:=ShowUnusedUnitsDialog;
|
Result:=ShowUnusedUnitsDialog;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TMainIDE.DoFindOverloads: TModalResult;
|
||||||
|
begin
|
||||||
|
Result:=ShowFindOverloadsDialog;
|
||||||
|
end;
|
||||||
|
|
||||||
{-------------------------------------------------------------------------------
|
{-------------------------------------------------------------------------------
|
||||||
function TMainIDE.DoInitIdentCompletion(JumpToError: boolean): boolean;
|
function TMainIDE.DoInitIdentCompletion(JumpToError: boolean): boolean;
|
||||||
-------------------------------------------------------------------------------}
|
-------------------------------------------------------------------------------}
|
||||||
|
Loading…
Reference in New Issue
Block a user