mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 16:09:41 +02:00
IDE: add a choice to view relative paths in the found projects in ExampleManager.
git-svn-id: trunk@41109 -
This commit is contained in:
parent
14f0aec94d
commit
9634e0c285
@ -53,7 +53,7 @@ object ExampleManagerForm: TExampleManagerForm
|
|||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
FilteredListbox = ProjectsListBox
|
FilteredListbox = ProjectsListBox
|
||||||
end
|
end
|
||||||
object RelativeCheckBox: TCheckBox
|
object cbRelativePath: TCheckBox
|
||||||
AnchorSideLeft.Control = ProjectFilter
|
AnchorSideLeft.Control = ProjectFilter
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = ProjectFilter
|
AnchorSideTop.Control = ProjectFilter
|
||||||
@ -64,9 +64,8 @@ object ExampleManagerForm: TExampleManagerForm
|
|||||||
Width = 113
|
Width = 113
|
||||||
BorderSpacing.Left = 50
|
BorderSpacing.Left = 50
|
||||||
Caption = 'Relative paths'
|
Caption = 'Relative paths'
|
||||||
OnClick = RelativeCheckBoxClick
|
OnClick = cbRelativePathClick
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
Visible = False
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object ButtonPanel1: TButtonPanel
|
object ButtonPanel1: TButtonPanel
|
||||||
|
@ -19,7 +19,7 @@ type
|
|||||||
lbProjectCount: TLabel;
|
lbProjectCount: TLabel;
|
||||||
lbRootDirectory: TLabel;
|
lbRootDirectory: TLabel;
|
||||||
SelectPanel: TPanel;
|
SelectPanel: TPanel;
|
||||||
RelativeCheckBox: TCheckBox;
|
cbRelativePath: TCheckBox;
|
||||||
DescriptionMemo: TMemo;
|
DescriptionMemo: TMemo;
|
||||||
Splitter1: TSplitter;
|
Splitter1: TSplitter;
|
||||||
cbIncludeAllDirs: TCheckBox;
|
cbIncludeAllDirs: TCheckBox;
|
||||||
@ -41,7 +41,7 @@ type
|
|||||||
procedure OpenSelectedButtonClick(Sender: TObject);
|
procedure OpenSelectedButtonClick(Sender: TObject);
|
||||||
procedure ProjectFilterAfterFilter(Sender: TObject);
|
procedure ProjectFilterAfterFilter(Sender: TObject);
|
||||||
procedure ProjectsListBoxSelectionChange(Sender: TObject; User: boolean);
|
procedure ProjectsListBoxSelectionChange(Sender: TObject; User: boolean);
|
||||||
procedure RelativeCheckBoxClick(Sender: TObject);
|
procedure cbRelativePathClick(Sender: TObject);
|
||||||
procedure edRootDirectoryChange(Sender: TObject);
|
procedure edRootDirectoryChange(Sender: TObject);
|
||||||
procedure SelectAllButtonClick(Sender: TObject);
|
procedure SelectAllButtonClick(Sender: TObject);
|
||||||
procedure SelectNoneButtonClick(Sender: TObject);
|
procedure SelectNoneButtonClick(Sender: TObject);
|
||||||
@ -111,8 +111,13 @@ type
|
|||||||
{ TListFileSearcher }
|
{ TListFileSearcher }
|
||||||
|
|
||||||
procedure TListFileSearcher.DoFileFound;
|
procedure TListFileSearcher.DoFileFound;
|
||||||
|
var
|
||||||
|
s: String;
|
||||||
begin
|
begin
|
||||||
fForm.ProjectFilter.Items.Add(FileName);
|
s:=FileName;
|
||||||
|
if fForm.cbRelativePath.Checked then
|
||||||
|
s:=CreateRelativePath(s, fForm.edRootDirectory.Text);
|
||||||
|
fForm.ProjectFilter.Items.Add(s);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TListFileSearcher.Create(aForm: TExampleManagerForm);
|
constructor TListFileSearcher.Create(aForm: TExampleManagerForm);
|
||||||
@ -149,7 +154,7 @@ begin
|
|||||||
ProjectsGroupBox.Caption:=lisMEProjects;
|
ProjectsGroupBox.Caption:=lisMEProjects;
|
||||||
ActionGroupBox.Caption:=lisMEAction;
|
ActionGroupBox.Caption:=lisMEAction;
|
||||||
|
|
||||||
RelativeCheckBox.Caption:=lisRelativePaths;
|
cbRelativePath.Caption:=lisRelativePaths;
|
||||||
OpenSelectedButton.Caption:=lisExamplesOpenFirstSelected;
|
OpenSelectedButton.Caption:=lisExamplesOpenFirstSelected;
|
||||||
BuildAllSelectedButton.Caption:=lisExamplesBuildAllSelected;
|
BuildAllSelectedButton.Caption:=lisExamplesBuildAllSelected;
|
||||||
SelectAllButton.Caption:=lisMenuSelectAll;
|
SelectAllButton.Caption:=lisMenuSelectAll;
|
||||||
@ -206,26 +211,28 @@ begin
|
|||||||
IncludedDirs:=TStringList.Create;
|
IncludedDirs:=TStringList.Create;
|
||||||
AllDirs:=Nil;
|
AllDirs:=Nil;
|
||||||
try
|
try
|
||||||
// Collect each matching directory name to a list.
|
if edRootDirectory.Text<>'' then
|
||||||
if (edRootDirectory.Text<>'') and not cbIncludeAllDirs.Checked then
|
|
||||||
begin
|
begin
|
||||||
AllDirs:=FindAllDirectories(edRootDirectory.Text);
|
if cbIncludeAllDirs.Checked then
|
||||||
for i:=0 to AllDirs.Count-1 do
|
// Add only the root directory name to list. Will find all projects in one go.
|
||||||
begin
|
IncludedDirs.Add(edRootDirectory.Text)
|
||||||
LastDir:=ExtractFileName(AllDirs[i]);
|
else begin
|
||||||
for j:=Low(DirectoryChoices) to High(DirectoryChoices) do
|
// Collect each matching directory name to a list.
|
||||||
|
AllDirs:=FindAllDirectories(edRootDirectory.Text);
|
||||||
|
for i:=0 to AllDirs.Count-1 do
|
||||||
begin
|
begin
|
||||||
if cgIncludedDirs.Checked[j] and (LastDir=DirectoryChoices[j]) then
|
LastDir:=ExtractFileName(AllDirs[i]);
|
||||||
|
for j:=Low(DirectoryChoices) to High(DirectoryChoices) do
|
||||||
begin
|
begin
|
||||||
IncludedDirs.Add(AllDirs[i]);
|
if cgIncludedDirs.Checked[j] and (LastDir=DirectoryChoices[j]) then
|
||||||
Break;
|
begin
|
||||||
|
IncludedDirs.Add(AllDirs[i]);
|
||||||
|
Break;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end
|
end;
|
||||||
// Add only the root directory name to list. Will find all projects in one go.
|
|
||||||
else if cbIncludeAllDirs.Checked then
|
|
||||||
IncludedDirs.Add(edRootDirectory.Text);
|
|
||||||
ProjectFilter.Items.Clear;
|
ProjectFilter.Items.Clear;
|
||||||
// Find projects in all included directories.
|
// Find projects in all included directories.
|
||||||
for i:=0 to IncludedDirs.Count-1 do
|
for i:=0 to IncludedDirs.Count-1 do
|
||||||
@ -258,16 +265,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TExampleManagerForm.OpenSelectedButtonClick(Sender: TObject);
|
procedure TExampleManagerForm.OpenSelectedButtonClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
s: String;
|
||||||
begin
|
begin
|
||||||
if fFirstSelectedIndex <> -1 then
|
if fFirstSelectedIndex <> -1 then
|
||||||
begin
|
begin
|
||||||
if FileExistsUTF8(ProjectsListBox.Items[fFirstSelectedIndex]) then
|
s:=ProjectsListBox.Items[fFirstSelectedIndex];
|
||||||
|
if cbRelativePath.Checked then
|
||||||
|
s:=CreateAbsolutePath(s, edRootDirectory.Text);
|
||||||
|
if FileExistsUTF8(s) then
|
||||||
begin
|
begin
|
||||||
fSelectedFilename:=ProjectsListBox.Items[fFirstSelectedIndex];
|
fSelectedFilename:=s;
|
||||||
ModalResult:=mrYes; // mrYes means the selected file will be opened.
|
ModalResult:=mrYes; // mrYes means the selected file will be opened.
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
ShowMessage(Format(lisFileNotFound3, [ProjectsListBox.Items[fFirstSelectedIndex]]));
|
ShowMessage(Format(lisFileNotFound3, [s]));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -308,9 +320,23 @@ begin
|
|||||||
ProjectsListBoxSelectionChange(ProjectsListBox, False);
|
ProjectsListBoxSelectionChange(ProjectsListBox, False);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TExampleManagerForm.RelativeCheckBoxClick(Sender: TObject);
|
procedure TExampleManagerForm.cbRelativePathClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
IsRelative: Boolean;
|
||||||
|
i: Integer;
|
||||||
|
s: String;
|
||||||
begin
|
begin
|
||||||
;
|
IsRelative:=(Sender as TCheckBox).Checked;
|
||||||
|
for i:=0 to ProjectFilter.Items.Count-1 do
|
||||||
|
begin
|
||||||
|
s:=ProjectFilter.Items[i];
|
||||||
|
if IsRelative then
|
||||||
|
s:=CreateRelativePath(s, edRootDirectory.Text)
|
||||||
|
else
|
||||||
|
s:=CreateAbsolutePath(s, edRootDirectory.Text);
|
||||||
|
ProjectFilter.Items[i]:=s;
|
||||||
|
end;
|
||||||
|
ProjectFilter.InvalidateFilter;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Project list selection changes. Adjust buttons.
|
// Project list selection changes. Adjust buttons.
|
||||||
|
Loading…
Reference in New Issue
Block a user