mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 17:39:20 +02:00
IDE: select frame: scan sources
git-svn-id: trunk@42322 -
This commit is contained in:
parent
ee0b433bd1
commit
b28666ea29
38
ide/main.pp
38
ide/main.pp
@ -5891,26 +5891,25 @@ begin
|
|||||||
AnUnitInfo := nil;
|
AnUnitInfo := nil;
|
||||||
for UEntry in UnitList do
|
for UEntry in UnitList do
|
||||||
begin
|
begin
|
||||||
if UEntry.Selected then
|
if not UEntry.Selected then continue;
|
||||||
|
AnUnitInfo := Project1.Units[UEntry.ID];
|
||||||
|
if AnUnitInfo.OpenEditorInfoCount > 0 then
|
||||||
begin
|
begin
|
||||||
AnUnitInfo := Project1.Units[UEntry.ID];
|
SourceEditorManager.ActiveEditor :=
|
||||||
if AnUnitInfo.OpenEditorInfoCount > 0 then
|
TSourceEditor(AnUnitInfo.OpenEditorInfo[0].EditorComponent);
|
||||||
begin
|
end else
|
||||||
SourceEditorManager.ActiveEditor := TSourceEditor(AnUnitInfo.OpenEditorInfo[0].EditorComponent);
|
begin
|
||||||
end else
|
if Project1.MainUnitInfo = AnUnitInfo then
|
||||||
begin
|
Result:=SourceFileMgr.OpenMainUnit(-1,-1,[])
|
||||||
if Project1.MainUnitInfo = AnUnitInfo then
|
else
|
||||||
Result:=SourceFileMgr.OpenMainUnit(-1,-1,[])
|
Result:=DoOpenEditorFile(AnUnitInfo.Filename,-1,-1,[ofOnlyIfExists]);
|
||||||
else
|
if Result=mrAbort then exit;
|
||||||
Result:=DoOpenEditorFile(AnUnitInfo.Filename,-1,-1,[ofOnlyIfExists]);
|
end;
|
||||||
if Result=mrAbort then exit;
|
if OnlyForms and (AnUnitInfo.ComponentName<>'') then
|
||||||
end;
|
begin
|
||||||
if OnlyForms and (AnUnitInfo.ComponentName<>'') then
|
AForm := GetDesignerFormOfSource(AnUnitInfo,true);
|
||||||
begin
|
if AForm <> nil then
|
||||||
AForm := GetDesignerFormOfSource(AnUnitInfo,true);
|
ShowDesignerForm(AForm);
|
||||||
if AForm <> nil then
|
|
||||||
ShowDesignerForm(AForm);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end; { for }
|
end; { for }
|
||||||
if (AnUnitInfo <> nil) and (not OnlyForms) then
|
if (AnUnitInfo <> nil) and (not OnlyForms) then
|
||||||
@ -6681,6 +6680,7 @@ Begin
|
|||||||
begin
|
begin
|
||||||
if UEntry.Selected then
|
if UEntry.Selected then
|
||||||
begin
|
begin
|
||||||
|
if UEntry.ID<0 then continue;
|
||||||
AnUnitInfo:=Project1.Units[UEntry.ID];
|
AnUnitInfo:=Project1.Units[UEntry.ID];
|
||||||
if AnUnitInfo.IsPartOfProject then
|
if AnUnitInfo.IsPartOfProject then
|
||||||
UnitInfos.Add(AnUnitInfo);
|
UnitInfos.Add(AnUnitInfo);
|
||||||
|
@ -132,6 +132,8 @@ type
|
|||||||
procedure SetIdleConnected(AValue: boolean);
|
procedure SetIdleConnected(AValue: boolean);
|
||||||
procedure SetItemType(AValue: TIDEProjectItem);
|
procedure SetItemType(AValue: TIDEProjectItem);
|
||||||
procedure SetSortAlphabetically(const AValue: boolean);
|
procedure SetSortAlphabetically(const AValue: boolean);
|
||||||
|
procedure ShowEntries;
|
||||||
|
procedure UpdateEntries;
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
procedure Init(const aCaption: string;
|
procedure Init(const aCaption: string;
|
||||||
@ -298,7 +300,6 @@ procedure TViewUnitDialog.Init(const aCaption: string; AllowMultiSelect,
|
|||||||
EnableMultiSelect: Boolean; aItemType: TIDEProjectItem;
|
EnableMultiSelect: Boolean; aItemType: TIDEProjectItem;
|
||||||
TheEntries: TViewUnitEntries; aStartFilename: string);
|
TheEntries: TViewUnitEntries; aStartFilename: string);
|
||||||
var
|
var
|
||||||
UEntry: TViewUnitsEntry;
|
|
||||||
SearchPath: String;
|
SearchPath: String;
|
||||||
p: Integer;
|
p: Integer;
|
||||||
Dir: String;
|
Dir: String;
|
||||||
@ -309,18 +310,11 @@ begin
|
|||||||
mniMultiselect.Enabled := AllowMultiSelect;
|
mniMultiselect.Enabled := AllowMultiSelect;
|
||||||
mniMultiselect.Checked := EnableMultiSelect;
|
mniMultiselect.Checked := EnableMultiSelect;
|
||||||
ListBox.MultiSelect := mniMultiselect.Enabled;
|
ListBox.MultiSelect := mniMultiselect.Enabled;
|
||||||
// Data items
|
ShowEntries;
|
||||||
for UEntry in fEntries do
|
|
||||||
FilterEdit.Items.Add(UEntry.Name);
|
|
||||||
FilterEdit.InvalidateFilter;
|
|
||||||
// Initial selection
|
|
||||||
for UEntry in fEntries do
|
|
||||||
if UEntry.Selected then
|
|
||||||
FilterEdit.SelectionList.Add(UEntry.Name);
|
|
||||||
|
|
||||||
if aStartFilename<>'' then begin
|
if aStartFilename<>'' then begin
|
||||||
// init search for units
|
// init search for units
|
||||||
// -> get unit search path
|
// -> get unit search path and fill fSearchDirectories
|
||||||
fStartFilename:=TrimFilename(aStartFilename);
|
fStartFilename:=TrimFilename(aStartFilename);
|
||||||
SearchPath:=CodeToolBoss.GetCompleteSrcPathForDirectory(ExtractFilePath(fStartFilename));
|
SearchPath:=CodeToolBoss.GetCompleteSrcPathForDirectory(ExtractFilePath(fStartFilename));
|
||||||
p:=1;
|
p:=1;
|
||||||
@ -365,16 +359,14 @@ procedure TViewUnitDialog.OnIdle(Sender: TObject; var Done: Boolean);
|
|||||||
piComponent:
|
piComponent:
|
||||||
begin
|
begin
|
||||||
CompClass:=FindLFMBaseClass(aFilename);
|
CompClass:=FindLFMBaseClass(aFilename);
|
||||||
if CompClass<>pfcbcNone then begin
|
if CompClass=pfcbcNone then exit;
|
||||||
fFoundFiles[aFilename]:=ExtractFileName(aFilename);
|
fFoundFiles[aFilename]:=ExtractFileName(aFilename);
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
piFrame:
|
piFrame:
|
||||||
begin
|
begin
|
||||||
CompClass:=FindLFMBaseClass(aFilename);
|
CompClass:=FindLFMBaseClass(aFilename);
|
||||||
if CompClass<>pfcbcFrame then begin
|
if CompClass<>pfcbcFrame then exit;
|
||||||
fFoundFiles[aFilename]:=ExtractFileName(aFilename);
|
fFoundFiles[aFilename]:=ExtractFileName(aFilename);
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -424,7 +416,8 @@ begin
|
|||||||
fSearchDirectories.Remove(aFilename);
|
fSearchDirectories.Remove(aFilename);
|
||||||
CheckDirectory(aFilename);
|
CheckDirectory(aFilename);
|
||||||
end else begin
|
end else begin
|
||||||
// ToDo: update entries from fFoundFiles
|
// update entries from fFoundFiles
|
||||||
|
UpdateEntries;
|
||||||
IdleConnected:=false;
|
IdleConnected:=false;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -505,6 +498,36 @@ begin
|
|||||||
FilterEdit.InvalidateFilter;
|
FilterEdit.InvalidateFilter;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TViewUnitDialog.ShowEntries;
|
||||||
|
var
|
||||||
|
UEntry: TViewUnitsEntry;
|
||||||
|
begin
|
||||||
|
DisableAutoSizing;
|
||||||
|
try
|
||||||
|
// Data items
|
||||||
|
FilterEdit.Items.Clear;
|
||||||
|
for UEntry in fEntries do
|
||||||
|
FilterEdit.Items.Add(UEntry.Name);
|
||||||
|
FilterEdit.InvalidateFilter;
|
||||||
|
// Initial selection
|
||||||
|
for UEntry in fEntries do
|
||||||
|
if UEntry.Selected then
|
||||||
|
FilterEdit.SelectionList.Add(UEntry.Name);
|
||||||
|
finally
|
||||||
|
EnableAutoSizing;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TViewUnitDialog.UpdateEntries;
|
||||||
|
var
|
||||||
|
F2SItem: PStringToStringTreeItem;
|
||||||
|
begin
|
||||||
|
fEntries.Clear;
|
||||||
|
for F2SItem in fFoundFiles do
|
||||||
|
fEntries.Add(F2SItem^.Value,F2SItem^.Name,-1,false);
|
||||||
|
ShowEntries;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TViewUnitDialog.SetItemType(AValue: TIDEProjectItem);
|
procedure TViewUnitDialog.SetItemType(AValue: TIDEProjectItem);
|
||||||
begin
|
begin
|
||||||
if FItemType=AValue then Exit;
|
if FItemType=AValue then Exit;
|
||||||
|
Loading…
Reference in New Issue
Block a user