mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 05:55:54 +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;
|
||||
for UEntry in UnitList do
|
||||
begin
|
||||
if UEntry.Selected then
|
||||
if not UEntry.Selected then continue;
|
||||
AnUnitInfo := Project1.Units[UEntry.ID];
|
||||
if AnUnitInfo.OpenEditorInfoCount > 0 then
|
||||
begin
|
||||
AnUnitInfo := Project1.Units[UEntry.ID];
|
||||
if AnUnitInfo.OpenEditorInfoCount > 0 then
|
||||
begin
|
||||
SourceEditorManager.ActiveEditor := TSourceEditor(AnUnitInfo.OpenEditorInfo[0].EditorComponent);
|
||||
end else
|
||||
begin
|
||||
if Project1.MainUnitInfo = AnUnitInfo then
|
||||
Result:=SourceFileMgr.OpenMainUnit(-1,-1,[])
|
||||
else
|
||||
Result:=DoOpenEditorFile(AnUnitInfo.Filename,-1,-1,[ofOnlyIfExists]);
|
||||
if Result=mrAbort then exit;
|
||||
end;
|
||||
if OnlyForms and (AnUnitInfo.ComponentName<>'') then
|
||||
begin
|
||||
AForm := GetDesignerFormOfSource(AnUnitInfo,true);
|
||||
if AForm <> nil then
|
||||
ShowDesignerForm(AForm);
|
||||
end;
|
||||
SourceEditorManager.ActiveEditor :=
|
||||
TSourceEditor(AnUnitInfo.OpenEditorInfo[0].EditorComponent);
|
||||
end else
|
||||
begin
|
||||
if Project1.MainUnitInfo = AnUnitInfo then
|
||||
Result:=SourceFileMgr.OpenMainUnit(-1,-1,[])
|
||||
else
|
||||
Result:=DoOpenEditorFile(AnUnitInfo.Filename,-1,-1,[ofOnlyIfExists]);
|
||||
if Result=mrAbort then exit;
|
||||
end;
|
||||
if OnlyForms and (AnUnitInfo.ComponentName<>'') then
|
||||
begin
|
||||
AForm := GetDesignerFormOfSource(AnUnitInfo,true);
|
||||
if AForm <> nil then
|
||||
ShowDesignerForm(AForm);
|
||||
end;
|
||||
end; { for }
|
||||
if (AnUnitInfo <> nil) and (not OnlyForms) then
|
||||
@ -6681,6 +6680,7 @@ Begin
|
||||
begin
|
||||
if UEntry.Selected then
|
||||
begin
|
||||
if UEntry.ID<0 then continue;
|
||||
AnUnitInfo:=Project1.Units[UEntry.ID];
|
||||
if AnUnitInfo.IsPartOfProject then
|
||||
UnitInfos.Add(AnUnitInfo);
|
||||
|
@ -132,6 +132,8 @@ type
|
||||
procedure SetIdleConnected(AValue: boolean);
|
||||
procedure SetItemType(AValue: TIDEProjectItem);
|
||||
procedure SetSortAlphabetically(const AValue: boolean);
|
||||
procedure ShowEntries;
|
||||
procedure UpdateEntries;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
procedure Init(const aCaption: string;
|
||||
@ -298,7 +300,6 @@ procedure TViewUnitDialog.Init(const aCaption: string; AllowMultiSelect,
|
||||
EnableMultiSelect: Boolean; aItemType: TIDEProjectItem;
|
||||
TheEntries: TViewUnitEntries; aStartFilename: string);
|
||||
var
|
||||
UEntry: TViewUnitsEntry;
|
||||
SearchPath: String;
|
||||
p: Integer;
|
||||
Dir: String;
|
||||
@ -309,18 +310,11 @@ begin
|
||||
mniMultiselect.Enabled := AllowMultiSelect;
|
||||
mniMultiselect.Checked := EnableMultiSelect;
|
||||
ListBox.MultiSelect := mniMultiselect.Enabled;
|
||||
// Data items
|
||||
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);
|
||||
ShowEntries;
|
||||
|
||||
if aStartFilename<>'' then begin
|
||||
// init search for units
|
||||
// -> get unit search path
|
||||
// -> get unit search path and fill fSearchDirectories
|
||||
fStartFilename:=TrimFilename(aStartFilename);
|
||||
SearchPath:=CodeToolBoss.GetCompleteSrcPathForDirectory(ExtractFilePath(fStartFilename));
|
||||
p:=1;
|
||||
@ -365,16 +359,14 @@ procedure TViewUnitDialog.OnIdle(Sender: TObject; var Done: Boolean);
|
||||
piComponent:
|
||||
begin
|
||||
CompClass:=FindLFMBaseClass(aFilename);
|
||||
if CompClass<>pfcbcNone then begin
|
||||
fFoundFiles[aFilename]:=ExtractFileName(aFilename);
|
||||
end;
|
||||
if CompClass=pfcbcNone then exit;
|
||||
fFoundFiles[aFilename]:=ExtractFileName(aFilename);
|
||||
end;
|
||||
piFrame:
|
||||
begin
|
||||
CompClass:=FindLFMBaseClass(aFilename);
|
||||
if CompClass<>pfcbcFrame then begin
|
||||
fFoundFiles[aFilename]:=ExtractFileName(aFilename);
|
||||
end;
|
||||
if CompClass<>pfcbcFrame then exit;
|
||||
fFoundFiles[aFilename]:=ExtractFileName(aFilename);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -424,7 +416,8 @@ begin
|
||||
fSearchDirectories.Remove(aFilename);
|
||||
CheckDirectory(aFilename);
|
||||
end else begin
|
||||
// ToDo: update entries from fFoundFiles
|
||||
// update entries from fFoundFiles
|
||||
UpdateEntries;
|
||||
IdleConnected:=false;
|
||||
exit;
|
||||
end;
|
||||
@ -505,6 +498,36 @@ begin
|
||||
FilterEdit.InvalidateFilter;
|
||||
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);
|
||||
begin
|
||||
if FItemType=AValue then Exit;
|
||||
|
Loading…
Reference in New Issue
Block a user