cody: unit deps: search options

git-svn-id: trunk@41733 -
This commit is contained in:
mattias 2013-06-16 19:42:45 +00:00
parent 8c8d0e7028
commit d82797827f
2 changed files with 114 additions and 64 deletions

View File

@ -43,17 +43,17 @@ object UnitDependenciesWindow: TUnitDependenciesWindow
ClientWidth = 616 ClientWidth = 616
object ScopePanel: TPanel object ScopePanel: TPanel
Left = 0 Left = 0
Height = 33 Height = 59
Top = 0 Top = 0
Width = 616 Width = 616
Align = alTop Align = alTop
AutoSize = True AutoSize = True
ClientHeight = 33 ClientHeight = 59
ClientWidth = 616 ClientWidth = 616
TabOrder = 0 TabOrder = 0
object UnitScopeAddFilesCheckBox: TCheckBox object SearchCustomFilesCheckBox: TCheckBox
AnchorSideLeft.Control = ScopePanel AnchorSideLeft.Control = ScopePanel
AnchorSideTop.Control = UnitScopeAddFilesComboBox AnchorSideTop.Control = SearchCustomFilesComboBox
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 3 Left = 3
Height = 24 Height = 24
@ -61,14 +61,14 @@ object UnitDependenciesWindow: TUnitDependenciesWindow
Width = 111 Width = 111
BorderSpacing.Around = 2 BorderSpacing.Around = 2
Caption = 'Additional files:' Caption = 'Additional files:'
OnChange = UnitScopeAddFilesCheckBoxChange OnChange = SearchCustomFilesCheckBoxChange
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 0 TabOrder = 0
end end
object UnitScopeAddFilesButton: TButton object SearchCustomFilesBrowseButton: TButton
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = UnitScopeAddFilesComboBox AnchorSideTop.Control = SearchCustomFilesComboBox
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = ScopePanel AnchorSideRight.Control = ScopePanel
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
@ -79,14 +79,14 @@ object UnitDependenciesWindow: TUnitDependenciesWindow
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
AutoSize = True AutoSize = True
Caption = 'Browse' Caption = 'Browse'
OnClick = UnitScopeAddFilesButtonClick OnClick = SearchCustomFilesBrowseButtonClick
TabOrder = 1 TabOrder = 1
end end
object UnitScopeAddFilesComboBox: TComboBox object SearchCustomFilesComboBox: TComboBox
AnchorSideLeft.Control = UnitScopeAddFilesCheckBox AnchorSideLeft.Control = SearchCustomFilesCheckBox
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = ScopePanel AnchorSideTop.Control = ScopePanel
AnchorSideRight.Control = UnitScopeAddFilesButton AnchorSideRight.Control = SearchCustomFilesBrowseButton
Left = 116 Left = 116
Height = 27 Height = 27
Top = 3 Top = 3
@ -94,19 +94,47 @@ object UnitDependenciesWindow: TUnitDependenciesWindow
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 2 BorderSpacing.Around = 2
ItemHeight = 0 ItemHeight = 0
OnChange = UnitScopeAddFilesComboBoxChange OnChange = SearchCustomFilesComboBoxChange
TabOrder = 2 TabOrder = 2
Text = 'UnitScopeAddFilesComboBox' Text = 'SearchCustomFilesComboBox'
end
object SearchPkgsCheckBox: TCheckBox
AnchorSideLeft.Control = ScopePanel
AnchorSideTop.Control = SearchCustomFilesComboBox
AnchorSideTop.Side = asrBottom
Left = 3
Height = 24
Top = 32
Width = 141
BorderSpacing.Around = 2
Caption = 'SearchPkgsCheckBox'
OnChange = SearchPkgsCheckBoxChange
TabOrder = 3
end
object SearchSrcEditCheckBox: TCheckBox
AnchorSideLeft.Control = SearchPkgsCheckBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = SearchPkgsCheckBox
AnchorSideTop.Side = asrCenter
Left = 161
Height = 24
Top = 32
Width = 156
BorderSpacing.Left = 15
BorderSpacing.Around = 2
Caption = 'SearchSrcEditCheckBox'
OnChange = SearchSrcEditCheckBoxChange
TabOrder = 4
end end
end end
object AllUnitsGroupBox: TGroupBox object AllUnitsGroupBox: TGroupBox
Left = 0 Left = 0
Height = 356 Height = 330
Top = 33 Top = 59
Width = 248 Width = 248
Align = alLeft Align = alLeft
Caption = 'AllUnitsGroupBox' Caption = 'AllUnitsGroupBox'
ClientHeight = 339 ClientHeight = 313
ClientWidth = 244 ClientWidth = 244
TabOrder = 1 TabOrder = 1
object AllUnitsShowGroupNodesSpeedButton: TSpeedButton object AllUnitsShowGroupNodesSpeedButton: TSpeedButton
@ -158,7 +186,7 @@ object UnitDependenciesWindow: TUnitDependenciesWindow
AnchorSideRight.Control = AllUnitsSearchPrevSpeedButton AnchorSideRight.Control = AllUnitsSearchPrevSpeedButton
Left = 198 Left = 198
Height = 22 Height = 22
Top = 315 Top = 289
Width = 23 Width = 23
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
ShowHint = True ShowHint = True
@ -171,7 +199,7 @@ object UnitDependenciesWindow: TUnitDependenciesWindow
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 221 Left = 221
Height = 22 Height = 22
Top = 315 Top = 289
Width = 23 Width = 23
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
ShowHint = True ShowHint = True
@ -185,7 +213,7 @@ object UnitDependenciesWindow: TUnitDependenciesWindow
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = AllUnitsSearchEdit AnchorSideBottom.Control = AllUnitsSearchEdit
Left = 0 Left = 0
Height = 289 Height = 263
Top = 25 Top = 25
Width = 244 Width = 244
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
@ -201,7 +229,7 @@ object UnitDependenciesWindow: TUnitDependenciesWindow
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 0 Left = 0
Height = 25 Height = 25
Top = 314 Top = 288
Width = 198 Width = 198
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
TabOrder = 2 TabOrder = 2
@ -225,18 +253,18 @@ object UnitDependenciesWindow: TUnitDependenciesWindow
end end
object UnitsSplitter: TSplitter object UnitsSplitter: TSplitter
Left = 248 Left = 248
Height = 356 Height = 330
Top = 33 Top = 59
Width = 5 Width = 5
end end
object SelectedUnitsGroupBox: TGroupBox object SelectedUnitsGroupBox: TGroupBox
Left = 253 Left = 253
Height = 356 Height = 330
Top = 33 Top = 59
Width = 363 Width = 363
Align = alClient Align = alClient
Caption = 'SelectedUnitsGroupBox' Caption = 'SelectedUnitsGroupBox'
ClientHeight = 339 ClientHeight = 313
ClientWidth = 359 ClientWidth = 359
TabOrder = 3 TabOrder = 3
object SelUnitsSearchNextSpeedButton: TSpeedButton object SelUnitsSearchNextSpeedButton: TSpeedButton
@ -245,7 +273,7 @@ object UnitDependenciesWindow: TUnitDependenciesWindow
AnchorSideRight.Control = SelUnitsSearchPrevSpeedButton AnchorSideRight.Control = SelUnitsSearchPrevSpeedButton
Left = 313 Left = 313
Height = 22 Height = 22
Top = 315 Top = 289
Width = 23 Width = 23
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
ShowHint = True ShowHint = True
@ -258,7 +286,7 @@ object UnitDependenciesWindow: TUnitDependenciesWindow
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 336 Left = 336
Height = 22 Height = 22
Top = 315 Top = 289
Width = 23 Width = 23
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
ShowHint = True ShowHint = True
@ -271,7 +299,7 @@ object UnitDependenciesWindow: TUnitDependenciesWindow
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 0 Left = 0
Height = 25 Height = 25
Top = 314 Top = 288
Width = 313 Width = 313
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
TabOrder = 0 TabOrder = 0
@ -284,7 +312,7 @@ object UnitDependenciesWindow: TUnitDependenciesWindow
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = SelUnitsSearchEdit AnchorSideBottom.Control = SelUnitsSearchEdit
Left = 0 Left = 0
Height = 314 Height = 288
Top = 0 Top = 0
Width = 359 Width = 359
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]

View File

@ -80,15 +80,17 @@ type
ProgressBar1: TProgressBar; ProgressBar1: TProgressBar;
GroupsTabSheet: TTabSheet; GroupsTabSheet: TTabSheet;
GroupsSplitter: TSplitter; GroupsSplitter: TSplitter;
SearchPkgsCheckBox: TCheckBox;
SearchSrcEditCheckBox: TCheckBox;
SelectedUnitsGroupBox: TGroupBox; SelectedUnitsGroupBox: TGroupBox;
SelUnitsSearchEdit: TEdit; SelUnitsSearchEdit: TEdit;
SelUnitsSearchNextSpeedButton: TSpeedButton; SelUnitsSearchNextSpeedButton: TSpeedButton;
SelUnitsSearchPrevSpeedButton: TSpeedButton; SelUnitsSearchPrevSpeedButton: TSpeedButton;
SelUnitsTreeView: TTreeView; SelUnitsTreeView: TTreeView;
UnitScopeAddFilesButton: TButton; SearchCustomFilesBrowseButton: TButton;
UnitScopeAddFilesCheckBox: TCheckBox; SearchCustomFilesCheckBox: TCheckBox;
ScopePanel: TPanel; ScopePanel: TPanel;
UnitScopeAddFilesComboBox: TComboBox; SearchCustomFilesComboBox: TComboBox;
UnitsSplitter: TSplitter; UnitsSplitter: TSplitter;
UnitsTabSheet: TTabSheet; UnitsTabSheet: TTabSheet;
Timer1: TTimer; Timer1: TTimer;
@ -97,10 +99,12 @@ type
procedure FormDestroy(Sender: TObject); procedure FormDestroy(Sender: TObject);
procedure GroupsLvlGraphSelectionChanged(Sender: TObject); procedure GroupsLvlGraphSelectionChanged(Sender: TObject);
procedure OnIdle(Sender: TObject; var {%H-}Done: Boolean); procedure OnIdle(Sender: TObject; var {%H-}Done: Boolean);
procedure SearchPkgsCheckBoxChange(Sender: TObject);
procedure SearchSrcEditCheckBoxChange(Sender: TObject);
procedure Timer1Timer(Sender: TObject); procedure Timer1Timer(Sender: TObject);
procedure UnitScopeAddFilesButtonClick(Sender: TObject); procedure SearchCustomFilesBrowseButtonClick(Sender: TObject);
procedure UnitScopeAddFilesCheckBoxChange(Sender: TObject); procedure SearchCustomFilesCheckBoxChange(Sender: TObject);
procedure UnitScopeAddFilesComboBoxChange(Sender: TObject); procedure SearchCustomFilesComboBoxChange(Sender: TObject);
private private
FAllUnitsMultiSelect: boolean; FAllUnitsMultiSelect: boolean;
FCurrentUnit: TUGUnit; FCurrentUnit: TUGUnit;
@ -216,12 +220,22 @@ begin
end; end;
end; end;
procedure TUnitDependenciesWindow.SearchPkgsCheckBoxChange(Sender: TObject);
begin
IdleConnected:=true;
end;
procedure TUnitDependenciesWindow.SearchSrcEditCheckBoxChange(Sender: TObject);
begin
IdleConnected:=true;
end;
procedure TUnitDependenciesWindow.Timer1Timer(Sender: TObject); procedure TUnitDependenciesWindow.Timer1Timer(Sender: TObject);
begin begin
end; end;
procedure TUnitDependenciesWindow.UnitScopeAddFilesButtonClick(Sender: TObject); procedure TUnitDependenciesWindow.SearchCustomFilesBrowseButtonClick(Sender: TObject);
var var
Dlg: TSelectDirectoryDialog; Dlg: TSelectDirectoryDialog;
s: TCaption; s: TCaption;
@ -234,26 +248,26 @@ begin
Dlg.Options:=Dlg.Options+[ofPathMustExist]; Dlg.Options:=Dlg.Options+[ofPathMustExist];
if not Dlg.Execute then exit; if not Dlg.Execute then exit;
aFilename:=TrimFilename(Dlg.FileName); aFilename:=TrimFilename(Dlg.FileName);
s:=UnitScopeAddFilesComboBox.Text; s:=SearchCustomFilesComboBox.Text;
p:=1; p:=1;
if FindNextDelimitedItem(s,';',p,aFilename)<>'' then exit; if FindNextDelimitedItem(s,';',p,aFilename)<>'' then exit;
if s<>'' then s+=';'; if s<>'' then s+=';';
s+=aFilename; s+=aFilename;
UnitScopeAddFilesComboBox.Text:=s; SearchCustomFilesComboBox.Text:=s;
IdleConnected:=true; IdleConnected:=true;
finally finally
Dlg.Free; Dlg.Free;
end; end;
end; end;
procedure TUnitDependenciesWindow.UnitScopeAddFilesCheckBoxChange( procedure TUnitDependenciesWindow.SearchCustomFilesCheckBoxChange(
Sender: TObject); Sender: TObject);
begin begin
UpdateAddFiles; UpdateAddFiles;
IdleConnected:=true; IdleConnected:=true;
end; end;
procedure TUnitDependenciesWindow.UnitScopeAddFilesComboBoxChange( procedure TUnitDependenciesWindow.SearchCustomFilesComboBoxChange(
Sender: TObject); Sender: TObject);
begin begin
IdleConnected:=true; IdleConnected:=true;
@ -460,29 +474,34 @@ begin
if (aProject<>nil) and (aProject.MainFile<>nil) then if (aProject<>nil) and (aProject.MainFile<>nil) then
UsesGraph.AddStartUnit(aProject.MainFile.Filename); UsesGraph.AddStartUnit(aProject.MainFile.Filename);
// ToDo: add all open packages // add all open packages
for i:=0 to PackageEditingInterface.GetPackageCount-1 do begin if SearchPkgsCheckBox.Checked then begin
Pkg:=PackageEditingInterface.GetPackages(i); for i:=0 to PackageEditingInterface.GetPackageCount-1 do begin
if not FilenameIsAbsolute(Pkg.Filename) then continue; Pkg:=PackageEditingInterface.GetPackages(i);
for j:=0 to Pkg.FileCount-1 do begin if not FilenameIsAbsolute(Pkg.Filename) then continue;
PkgFile:=Pkg.Files[j]; for j:=0 to Pkg.FileCount-1 do begin
if PkgFile.Removed then continue; PkgFile:=Pkg.Files[j];
aFilename:=PkgFile.GetFullFilename; if PkgFile.Removed then continue;
aFilename:=PkgFile.GetFullFilename;
if FilenameIsPascalUnit(AFilename) then
UsesGraph.AddStartUnit(AFilename);
end;
end;
end;
// add all source editor files
if SearchSrcEditCheckBox.Checked then begin
for i:=0 to SourceEditorManagerIntf.SourceEditorCount-1 do begin
SrcEdit:=SourceEditorManagerIntf.SourceEditors[i];
AFilename:=SrcEdit.FileName;
if FilenameIsPascalUnit(AFilename) then if FilenameIsPascalUnit(AFilename) then
UsesGraph.AddStartUnit(AFilename); UsesGraph.AddStartUnit(AFilename);
end; end;
end; end;
// add all source editor files
for i:=0 to SourceEditorManagerIntf.SourceEditorCount-1 do begin
SrcEdit:=SourceEditorManagerIntf.SourceEditors[i];
AFilename:=SrcEdit.FileName;
if FilenameIsPascalUnit(AFilename) then
UsesGraph.AddStartUnit(AFilename);
end;
// additional units and directories // additional units and directories
AddAdditionalFilesAsStartUnits; if SearchCustomFilesCheckBox.Checked then
AddAdditionalFilesAsStartUnits;
end; end;
procedure TUnitDependenciesWindow.AddAdditionalFilesAsStartUnits; procedure TUnitDependenciesWindow.AddAdditionalFilesAsStartUnits;
@ -493,7 +512,7 @@ var
i: Integer; i: Integer;
p: Integer; p: Integer;
begin begin
List:=UnitScopeAddFilesComboBox.Text; List:=SearchCustomFilesComboBox.Text;
p:=1; p:=1;
while p<=length(List) do begin while p<=length(List) do begin
aFilename:=TrimAndExpandFilename(GetNextDelimitedItem(List,';',p)); aFilename:=TrimAndExpandFilename(GetNextDelimitedItem(List,';',p));
@ -555,10 +574,13 @@ begin
UnitsTabSheet.Caption:='Units'; UnitsTabSheet.Caption:='Units';
// start searching // start searching
UnitScopeAddFilesCheckBox.Caption:='Additional directories:'; SearchCustomFilesCheckBox.Caption:='Additional directories:';
UnitScopeAddFilesCheckBox.Hint:='By default only the project units and the source editor units are searched. Add here a list of directories separated by semicolon to search as well.'; SearchCustomFilesCheckBox.Hint:='By default only the project units and the source editor units are searched. Add here a list of directories separated by semicolon to search as well.';
UnitScopeAddFilesComboBox.Text:=''; SearchCustomFilesComboBox.Text:='';
UnitScopeAddFilesButton.Caption:='Browse'; SearchCustomFilesBrowseButton.Caption:='Browse';
SearchPkgsCheckBox.Caption:='All package units';
SearchSrcEditCheckBox.Caption:='All source editor units';
// view all units // view all units
AllUnitsGroupBox.Caption:='All units'; AllUnitsGroupBox.Caption:='All units';
@ -589,8 +611,8 @@ end;
procedure TUnitDependenciesWindow.UpdateAddFiles; procedure TUnitDependenciesWindow.UpdateAddFiles;
begin begin
UnitScopeAddFilesComboBox.Enabled:=UnitScopeAddFilesCheckBox.Checked; SearchCustomFilesComboBox.Enabled:=SearchCustomFilesCheckBox.Checked;
UnitScopeAddFilesButton.Enabled:=UnitScopeAddFilesCheckBox.Checked; SearchCustomFilesBrowseButton.Enabled:=SearchCustomFilesCheckBox.Checked;
end; end;
procedure TUnitDependenciesWindow.UpdateAll; procedure TUnitDependenciesWindow.UpdateAll;