IDE: select units/forms/frames: using a special list

git-svn-id: trunk@42320 -
This commit is contained in:
mattias 2013-08-04 12:55:07 +00:00
parent f40d0f314f
commit 29f25bb619
2 changed files with 184 additions and 66 deletions

View File

@ -59,7 +59,8 @@ uses
MemCheck, MemCheck,
{$ENDIF} {$ENDIF}
// fpc packages // fpc packages
Math, Classes, SysUtils, Process, AsyncProcess, TypInfo, types, strutils, AVL_Tree, Math, Classes, SysUtils, Process, AsyncProcess, TypInfo, types, strutils,
AVL_Tree, contnrs,
// lazutils // lazutils
LazUTF8, Laz2_XMLCfg, AvgLvlTree, LazUTF8, Laz2_XMLCfg, AvgLvlTree,
// lcl // lcl
@ -944,7 +945,7 @@ type
procedure DoJumpToGuessedMisplacedIFDEF(FindNextUTF8: boolean); procedure DoJumpToGuessedMisplacedIFDEF(FindNextUTF8: boolean);
procedure DoGotoIncludeDirective; procedure DoGotoIncludeDirective;
function SelectProjectItems(ItemList: TStringList; function SelectProjectItems(ItemList: TViewUnitEntries;
ItemType: TIDEProjectItem; ItemType: TIDEProjectItem;
MultiSelect: boolean; MultiSelect: boolean;
var MultiSelectCheckedState: Boolean): TModalResult; var MultiSelectCheckedState: Boolean): TModalResult;
@ -5603,7 +5604,7 @@ begin
Result:=SourceFileMgr.OpenEditorFile(AFileName, PageIndex, WindowIndex, AEditorInfo, Flags); Result:=SourceFileMgr.OpenEditorFile(AFileName, PageIndex, WindowIndex, AEditorInfo, Flags);
end; end;
function TMainIDE.SelectProjectItems(ItemList: TStringList; function TMainIDE.SelectProjectItems(ItemList: TViewUnitEntries;
ItemType: TIDEProjectItem; MultiSelect: boolean; ItemType: TIDEProjectItem; MultiSelect: boolean;
var MultiSelectCheckedState: Boolean): TModalResult; var MultiSelectCheckedState: Boolean): TModalResult;
var var
@ -5633,9 +5634,8 @@ begin
begin begin
if (ItemType = piComponent) or if (ItemType = piComponent) or
((ItemType = piFrame) and (CurUnitInfo.ResourceBaseClass = pfcbcFrame)) then ((ItemType = piFrame) and (CurUnitInfo.ResourceBaseClass = pfcbcFrame)) then
ItemList.AddObject(CurUnitInfo.Unit_Name, ItemList.Add(CurUnitInfo.ComponentName,
TViewUnitsEntry.Create(CurUnitInfo.ComponentName, CurUnitInfo.Filename, CurUnitInfo.Filename, i, CurUnitInfo = ActiveUnitInfo);
i, CurUnitInfo = ActiveUnitInfo));
end else if FilenameIsAbsolute(CurUnitInfo.Filename) end else if FilenameIsAbsolute(CurUnitInfo.Filename)
and FilenameIsPascalSource(CurUnitInfo.Filename) and FilenameIsPascalSource(CurUnitInfo.Filename)
and FileExistsCached(CurUnitInfo.Filename) then begin and FileExistsCached(CurUnitInfo.Filename) then begin
@ -5648,9 +5648,8 @@ begin
anUnitName:=CurUnitInfo.Unit_Name; anUnitName:=CurUnitInfo.Unit_Name;
if anUnitName='' then if anUnitName='' then
anUnitName:=ExtractFileNameOnly(LFMFilename); anUnitName:=ExtractFileNameOnly(LFMFilename);
ItemList.AddObject(anUnitName, ItemList.Add(LFMComponentName, CurUnitInfo.Filename,
TViewUnitsEntry.Create(LFMComponentName, CurUnitInfo.Filename, i, i, CurUnitInfo = ActiveUnitInfo);
CurUnitInfo = ActiveUnitInfo));
end; end;
end; end;
end else end else
@ -5659,10 +5658,9 @@ begin
if (CurUnitInfo.FileName <> '') then if (CurUnitInfo.FileName <> '') then
begin begin
AUnitName := ExtractFileName(CurUnitInfo.Filename); AUnitName := ExtractFileName(CurUnitInfo.Filename);
if ItemList.IndexOf(AUnitName) = -1 then if ItemList.Find(AUnitName) = nil then
ItemList.AddObject(AUnitName, ItemList.Add(AUnitName, CurUnitInfo.Filename,
TViewUnitsEntry.Create(AUnitName, CurUnitInfo.Filename, i, CurUnitInfo = ActiveUnitInfo);
i, CurUnitInfo = ActiveUnitInfo));
end end
else else
if Project1.MainUnitID = i then if Project1.MainUnitID = i then
@ -5671,11 +5669,10 @@ begin
if pfMainUnitIsPascalSource in Project1.Flags then if pfMainUnitIsPascalSource in Project1.Flags then
begin begin
AUnitName := ExtractFileName(MainUnitInfo.Filename); AUnitName := ExtractFileName(MainUnitInfo.Filename);
if (AUnitName <> '') and (ItemList.IndexOf(AUnitName) = -1) then if (AUnitName <> '') and (ItemList.Find(AUnitName) = nil) then
begin begin
ItemList.AddObject(AUnitName, ItemList.Add(AUnitName, MainUnitInfo.Filename,
TViewUnitsEntry.Create(AUnitName, MainUnitInfo.Filename, i, MainUnitInfo = ActiveUnitInfo);
i, MainUnitInfo = ActiveUnitInfo));
end; end;
end; end;
end; end;
@ -5763,7 +5760,7 @@ var
S2SItem: PStringToStringTreeItem; S2SItem: PStringToStringTreeItem;
AnUnitName: String; AnUnitName: String;
AFilename: String; AFilename: String;
UnitList: TStringList; UnitList: TViewUnitEntries;
Entry: TViewUnitsEntry; Entry: TViewUnitsEntry;
begin begin
Result:=mrCancel; Result:=mrCancel;
@ -5773,7 +5770,7 @@ begin
UnitPath:=CodeToolBoss.GetCompleteSrcPathForDirectory(ExtractFilePath(ActiveUnitInfo.Filename)); UnitPath:=CodeToolBoss.GetCompleteSrcPathForDirectory(ExtractFilePath(ActiveUnitInfo.Filename));
PkgList:=nil; PkgList:=nil;
UnitToFilename:=TStringToStringTree.Create(false); UnitToFilename:=TStringToStringTree.Create(false);
UnitList:=TStringList.Create; UnitList:=TViewUnitEntries.Create;
try try
// fetch owner of active unit // fetch owner of active unit
AProject:=nil; AProject:=nil;
@ -5822,23 +5819,19 @@ begin
for S2SItem in UnitToFilename do begin for S2SItem in UnitToFilename do begin
AnUnitName:=S2SItem^.Name; AnUnitName:=S2SItem^.Name;
AFilename:=S2SItem^.Value; AFilename:=S2SItem^.Value;
UnitList.AddObject(AnUnitName,TViewUnitsEntry.Create(AnUnitName,AFilename,i,false)); UnitList.Add(AnUnitName,AFilename,i,false);
inc(i); inc(i);
end; end;
// show dialog // show dialog
Result := ShowViewUnitsDlg(UnitList, MultiSelect, MultiSelectCheckedState, Result := ShowViewUnitsDlg(UnitList, MultiSelect, MultiSelectCheckedState,
DlgCaption, ItemType, ActiveUnitInfo.Filename); DlgCaption, ItemType, ActiveUnitInfo.Filename);
// create list of selected files // create list of selected files
for i:=0 to UnitList.Count-1 do begin for Entry in UnitList do begin
Entry:=TViewUnitsEntry(UnitList.Objects[i]);
if Entry.Selected then if Entry.Selected then
Files.Add(Entry.Filename); Files.Add(Entry.Filename);
end; end;
finally finally
for i := 0 to UnitList.Count-1 do
TViewUnitsEntry(UnitList.Objects[i]).Free;
UnitList.Free; UnitList.Free;
PkgList.Free; PkgList.Free;
Owners.Free; Owners.Free;
@ -5883,25 +5876,24 @@ const
UseItemType: array[Boolean] of TIDEProjectItem = (piUnit, piComponent); UseItemType: array[Boolean] of TIDEProjectItem = (piUnit, piComponent);
MultiSelectCheckedState: Array [Boolean] of Boolean = (True,True); MultiSelectCheckedState: Array [Boolean] of Boolean = (True,True);
var var
UnitList: TStringList; UnitList: TViewUnitEntries;
i: integer;
AForm: TCustomForm; AForm: TCustomForm;
AnUnitInfo: TUnitInfo; AnUnitInfo: TUnitInfo;
UEntry: TViewUnitsEntry;
begin begin
if Project1=nil then exit(mrCancel); if Project1=nil then exit(mrCancel);
UnitList := TStringList.Create; UnitList := TViewUnitEntries.Create;
UnitList.Sorted := True;
try try
if SelectProjectItems(UnitList, UseItemType[OnlyForms], if SelectProjectItems(UnitList, UseItemType[OnlyForms],
true, MultiSelectCheckedState[OnlyForms]) = mrOk then true, MultiSelectCheckedState[OnlyForms]) = mrOk then
begin begin
{ This is where we check what the user selected. } { This is where we check what the user selected. }
AnUnitInfo := nil; AnUnitInfo := nil;
for i := 0 to UnitList.Count-1 do for UEntry in UnitList do
begin begin
if TViewUnitsEntry(UnitList.Objects[i]).Selected then if UEntry.Selected then
begin begin
AnUnitInfo := Project1.Units[TViewUnitsEntry(UnitList.Objects[i]).ID]; AnUnitInfo := Project1.Units[UEntry.ID];
if AnUnitInfo.OpenEditorInfoCount > 0 then if AnUnitInfo.OpenEditorInfoCount > 0 then
begin begin
SourceEditorManager.ActiveEditor := TSourceEditor(AnUnitInfo.OpenEditorInfo[0].EditorComponent); SourceEditorManager.ActiveEditor := TSourceEditor(AnUnitInfo.OpenEditorInfo[0].EditorComponent);
@ -5925,8 +5917,6 @@ begin
SourceEditorManager.ShowActiveWindowOnTop(True); SourceEditorManager.ShowActiveWindowOnTop(True);
end; { if ShowViewUnitDlg... } end; { if ShowViewUnitDlg... }
finally finally
for i := 0 to UnitList.Count-1 do
TViewUnitsEntry(UnitList.Objects[i]).Free;
UnitList.Free; UnitList.Free;
end; end;
Result := mrOk; Result := mrOk;
@ -6660,17 +6650,17 @@ end;
function TMainIDE.DoRemoveFromProjectDialog: TModalResult; function TMainIDE.DoRemoveFromProjectDialog: TModalResult;
var var
ViewUnitEntries: TStringList; ViewUnitEntries: TViewUnitEntries;
i:integer; i:integer;
AName: string; AName: string;
AnUnitInfo: TUnitInfo; AnUnitInfo: TUnitInfo;
UnitInfos: TFPList; UnitInfos: TFPList;
UEntry: TViewUnitsEntry;
const const
MultiSelectCheckedState: Boolean = true; MultiSelectCheckedState: Boolean = true;
Begin Begin
if Project1=nil then exit(mrCancel); if Project1=nil then exit(mrCancel);
ViewUnitEntries := TStringList.Create; ViewUnitEntries := TViewUnitEntries.Create;
ViewUnitEntries.Sorted := True;
UnitInfos:=nil; UnitInfos:=nil;
try try
for i := 0 to Project1.UnitCount-1 do for i := 0 to Project1.UnitCount-1 do
@ -6679,8 +6669,7 @@ Begin
if (AnUnitInfo.IsPartOfProject) and (i<>Project1.MainUnitID) then if (AnUnitInfo.IsPartOfProject) and (i<>Project1.MainUnitID) then
begin begin
AName := Project1.RemoveProjectPathFromFilename(AnUnitInfo.FileName); AName := Project1.RemoveProjectPathFromFilename(AnUnitInfo.FileName);
ViewUnitEntries.AddObject(AName, ViewUnitEntries.Add(AName,AnUnitInfo.FileName,i,false);
TViewUnitsEntry.Create(AName,AnUnitInfo.FileName,i,false));
end; end;
end; end;
if ShowViewUnitsDlg(ViewUnitEntries, true, MultiSelectCheckedState, if ShowViewUnitsDlg(ViewUnitEntries, true, MultiSelectCheckedState,
@ -6688,11 +6677,11 @@ Begin
exit(mrOk); exit(mrOk);
{ This is where we check what the user selected. } { This is where we check what the user selected. }
UnitInfos:=TFPList.Create; UnitInfos:=TFPList.Create;
for i:=0 to ViewUnitEntries.Count-1 do for UEntry in ViewUnitEntries do
begin begin
if TViewUnitsEntry(ViewUnitEntries.Objects[i]).Selected then if UEntry.Selected then
begin begin
AnUnitInfo:=Project1.Units[TViewUnitsEntry(ViewUnitEntries.Objects[i]).ID]; AnUnitInfo:=Project1.Units[UEntry.ID];
if AnUnitInfo.IsPartOfProject then if AnUnitInfo.IsPartOfProject then
UnitInfos.Add(AnUnitInfo); UnitInfos.Add(AnUnitInfo);
end; end;
@ -6703,8 +6692,6 @@ Begin
Result:=mrOk; Result:=mrOk;
finally finally
UnitInfos.Free; UnitInfos.Free;
for i := 0 to ViewUnitEntries.Count-1 do
TViewUnitsEntry(ViewUnitEntries.Objects[i]).Free;
ViewUnitEntries.Free; ViewUnitEntries.Free;
end; end;
end; end;

View File

@ -40,7 +40,7 @@ interface
uses uses
SysUtils, Classes, Math, Controls, Forms, Dialogs, Buttons, StdCtrls, SysUtils, Classes, Math, Controls, Forms, Dialogs, Buttons, StdCtrls,
LazarusIdeStrConsts, IDEProcs, CustomFormEditor, LCLType, LCLIntf, LMessages, LazarusIdeStrConsts, IDEProcs, CustomFormEditor, LCLType, LCLIntf, LMessages,
ExtCtrls, ButtonPanel, Menus, StrUtils, AVL_Tree, ImgList, ComCtrls, ExtCtrls, ButtonPanel, Menus, StrUtils, AVL_Tree, contnrs, ImgList, ComCtrls,
PackageDefs, IDEWindowIntf, IDEHelpIntf, IDEImagesIntf, ListFilterEdit, PackageDefs, IDEWindowIntf, IDEHelpIntf, IDEImagesIntf, ListFilterEdit,
CodeToolsStructs, CodeToolManager, FileProcs, lazutf8sysutils, LazFileUtils, CodeToolsStructs, CodeToolManager, FileProcs, lazutf8sysutils, LazFileUtils,
LazLogger; LazLogger;
@ -63,6 +63,37 @@ type
constructor Create(const AName, AFilename: string; AnID: integer; ASelected: boolean); constructor Create(const AName, AFilename: string; AnID: integer; ASelected: boolean);
end; end;
{ TViewUnitsEntryEnumerator }
TViewUnitsEntryEnumerator = class
private
FTree: TAVLTree;
FCurrent: TAVLTreeNode;
function GetCurrent: TViewUnitsEntry;
public
constructor Create(Tree: TAVLTree);
function MoveNext: boolean;
property Current: TViewUnitsEntry read GetCurrent;
end;
{ TViewUnitEntries }
TViewUnitEntries = class
private
fItems: TStringToPointerTree; // tree of TViewUnitsEntry
public
constructor Create;
destructor Destroy; override;
procedure Clear;
function Add(AName, AFilename: string; AnID: integer; ASelected: boolean): TViewUnitsEntry;
function Find(const aName: string): TViewUnitsEntry; inline;
function Count: integer; inline;
function GetFiles: TStringList;
function GetNames: TStringList;
function GetEntries: TFPList;
function GetEnumerator: TViewUnitsEntryEnumerator;
end;
{ TViewUnitDialog } { TViewUnitDialog }
TViewUnitDialog = class(TForm) TViewUnitDialog = class(TForm)
@ -97,6 +128,7 @@ type
fSearchDirectories: TFilenameToStringTree; // queued directories to search fSearchDirectories: TFilenameToStringTree; // queued directories to search
fSearchFiles: TFilenameToStringTree; // queued files to search fSearchFiles: TFilenameToStringTree; // queued files to search
fFoundFiles: TFilenameToStringTree; // filename to caption fFoundFiles: TFilenameToStringTree; // filename to caption
fEntries: TViewUnitEntries;
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);
@ -104,28 +136,27 @@ type
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
procedure Init(const aCaption: string; procedure Init(const aCaption: string;
AllowMultiSelect, EnableMultiSelect: Boolean; aItemType: TIDEProjectItem; AllowMultiSelect, EnableMultiSelect: Boolean; aItemType: TIDEProjectItem;
Entries: TStringList; aStartFilename: string = ''); TheEntries: TViewUnitEntries; aStartFilename: string = '');
property SortAlphabetically: boolean read FSortAlphabetically write SetSortAlphabetically; property SortAlphabetically: boolean read FSortAlphabetically write SetSortAlphabetically;
property ItemType: TIDEProjectItem read FItemType write SetItemType; property ItemType: TIDEProjectItem read FItemType write SetItemType;
property IdleConnected: boolean read FIdleConnected write SetIdleConnected; property IdleConnected: boolean read FIdleConnected write SetIdleConnected;
end; end;
// Entries is a list of TViewUnitsEntry(s) // Entries is a list of TViewUnitsEntry(s)
function ShowViewUnitsDlg(Entries: TStringList; AllowMultiSelect: boolean; function ShowViewUnitsDlg(Entries: TViewUnitEntries; AllowMultiSelect: boolean;
var CheckMultiSelect: Boolean; const aCaption: string; ItemType: TIDEProjectItem; var CheckMultiSelect: Boolean; const aCaption: string; ItemType: TIDEProjectItem;
StartFilename: string = ''): TModalResult; StartFilename: string = '' // if StartFilename is given the Entries are automatically updated
): TModalResult;
implementation implementation
{$R *.lfm} {$R *.lfm}
function ShowViewUnitsDlg(Entries: TStringList; AllowMultiSelect: boolean; function ShowViewUnitsDlg(Entries: TViewUnitEntries; AllowMultiSelect: boolean;
var CheckMultiSelect: Boolean; const aCaption: string; var CheckMultiSelect: Boolean; const aCaption: string;
ItemType: TIDEProjectItem; StartFilename: string): TModalResult; ItemType: TIDEProjectItem; StartFilename: string): TModalResult;
var var
ViewUnitDialog: TViewUnitDialog; ViewUnitDialog: TViewUnitDialog;
UEntry: TViewUnitsEntry;
i: integer;
begin begin
ViewUnitDialog:=TViewUnitDialog.Create(nil); ViewUnitDialog:=TViewUnitDialog.Create(nil);
try try
@ -134,12 +165,6 @@ begin
// Show the dialog // Show the dialog
Result:=ViewUnitDialog.ShowModal; Result:=ViewUnitDialog.ShowModal;
if Result=mrOk then begin if Result=mrOk then begin
// Return new selections from the dialog
ViewUnitDialog.FilterEdit.StoreSelection;
for i:=0 to Entries.Count-1 do begin
UEntry:=TViewUnitsEntry(Entries.Objects[i]);
UEntry.Selected:=ViewUnitDialog.FilterEdit.SelectionList.IndexOf(UEntry.Name)>-1;
end;
CheckMultiSelect := ViewUnitDialog.mniMultiselect.Checked; CheckMultiSelect := ViewUnitDialog.mniMultiselect.Checked;
end; end;
finally finally
@ -147,6 +172,108 @@ begin
end; end;
end; end;
{ TViewUnitsEntryEnumerator }
function TViewUnitsEntryEnumerator.GetCurrent: TViewUnitsEntry;
begin
Result:=TViewUnitsEntry(PStringToPointerTreeItem(FCurrent.Data)^.Value);
end;
constructor TViewUnitsEntryEnumerator.Create(Tree: TAVLTree);
begin
FTree:=Tree;
end;
function TViewUnitsEntryEnumerator.MoveNext: boolean;
begin
if FCurrent=nil then
FCurrent:=FTree.FindLowest
else
FCurrent:=FTree.FindSuccessor(FCurrent);
Result:=FCurrent<>nil;
end;
{ TViewUnitEntries }
// inline
function TViewUnitEntries.Count: integer;
begin
Result:=fItems.Count;
end;
// inline
function TViewUnitEntries.Find(const aName: string): TViewUnitsEntry;
begin
Result:=TViewUnitsEntry(fItems[aName]);
end;
function TViewUnitEntries.GetFiles: TStringList;
var
S2PItem: PStringToPointerTreeItem;
begin
Result:=TStringList.Create;
for S2PItem in fItems do
Result.Add(TViewUnitsEntry(S2PItem^.Value).Filename);
end;
function TViewUnitEntries.GetNames: TStringList;
var
S2PItem: PStringToPointerTreeItem;
begin
Result:=TStringList.Create;
for S2PItem in fItems do
Result.Add(TViewUnitsEntry(S2PItem^.Value).Name);
end;
function TViewUnitEntries.GetEntries: TFPList;
var
S2PItem: PStringToPointerTreeItem;
begin
Result:=TFPList.Create;
for S2PItem in fItems do
Result.Add(TViewUnitsEntry(S2PItem^.Value));
end;
function TViewUnitEntries.GetEnumerator: TViewUnitsEntryEnumerator;
begin
Result:=TViewUnitsEntryEnumerator.Create(fItems.Tree);
end;
constructor TViewUnitEntries.Create;
begin
fItems:=TStringToPointerTree.create(false);
end;
destructor TViewUnitEntries.Destroy;
begin
Clear;
inherited Destroy;
end;
procedure TViewUnitEntries.Clear;
var
S2PItem: PStringToPointerTreeItem;
begin
for S2PItem in fItems do
TViewUnitsEntry(S2PItem^.Value).Free;
fItems.Clear;
end;
function TViewUnitEntries.Add(AName, AFilename: string; AnID: integer;
ASelected: boolean): TViewUnitsEntry;
var
i: Integer;
begin
if Find(AName)<>nil then begin
i:=2;
while Find(AName+'('+IntToStr(i)+')')<>nil do
inc(i);
AName:=AName+'('+IntToStr(i)+')';
end;
Result:=TViewUnitsEntry.Create(AName,AFilename,AnID,ASelected);
fItems[AName]:=Result;
end;
{ TViewUnitsEntry } { TViewUnitsEntry }
constructor TViewUnitsEntry.Create(const AName, AFilename: string; constructor TViewUnitsEntry.Create(const AName, AFilename: string;
@ -168,10 +295,9 @@ begin
end; end;
procedure TViewUnitDialog.Init(const aCaption: string; AllowMultiSelect, procedure TViewUnitDialog.Init(const aCaption: string; AllowMultiSelect,
EnableMultiSelect: Boolean; aItemType: TIDEProjectItem; Entries: TStringList; EnableMultiSelect: Boolean; aItemType: TIDEProjectItem;
aStartFilename: string); TheEntries: TViewUnitEntries; aStartFilename: string);
var var
i: Integer;
UEntry: TViewUnitsEntry; UEntry: TViewUnitsEntry;
SearchPath: String; SearchPath: String;
p: Integer; p: Integer;
@ -179,21 +305,18 @@ var
begin begin
Caption:=aCaption; Caption:=aCaption;
ItemType:=aItemType; ItemType:=aItemType;
fEntries:=TheEntries;
mniMultiselect.Enabled := AllowMultiSelect; mniMultiselect.Enabled := AllowMultiSelect;
mniMultiselect.Checked := EnableMultiSelect; mniMultiselect.Checked := EnableMultiSelect;
ListBox.MultiSelect := mniMultiselect.Enabled; ListBox.MultiSelect := mniMultiselect.Enabled;
// Data items // Data items
for i:=0 to Entries.Count-1 do begin for UEntry in fEntries do
UEntry:=TViewUnitsEntry(Entries.Objects[i]);
FilterEdit.Items.Add(UEntry.Name); FilterEdit.Items.Add(UEntry.Name);
end;
FilterEdit.InvalidateFilter; FilterEdit.InvalidateFilter;
// Initial selection // Initial selection
for i:=0 to Entries.Count-1 do begin for UEntry in fEntries do
UEntry:=TViewUnitsEntry(Entries.Objects[i]);
if UEntry.Selected then if UEntry.Selected then
FilterEdit.SelectionList.Add(UEntry.Name); FilterEdit.SelectionList.Add(UEntry.Name);
end;
if aStartFilename<>'' then begin if aStartFilename<>'' then begin
// init search for units // init search for units
@ -333,8 +456,16 @@ begin
end; end;
procedure TViewUnitDialog.OKButtonClick(Sender: TObject); procedure TViewUnitDialog.OKButtonClick(Sender: TObject);
var
S2PItem: PStringToPointerTreeItem;
Entry: TViewUnitsEntry;
Begin Begin
IDEDialogLayoutList.SaveLayout(Self); IDEDialogLayoutList.SaveLayout(Self);
FilterEdit.StoreSelection;
for S2PItem in fEntries.fItems do begin
Entry:=TViewUnitsEntry(S2PItem^.Value);
Entry.Selected:=FilterEdit.SelectionList.IndexOf(Entry.Name)>-1;
end;
ModalResult := mrOK; ModalResult := mrOK;
End; End;