IDE: Remove unused parameters about MultiSelection in functions for selecting units.

git-svn-id: trunk@62193 -
This commit is contained in:
juha 2019-11-04 22:38:06 +00:00
parent 78ec55ea05
commit 4d7fdb6248
3 changed files with 18 additions and 37 deletions

View File

@ -5984,7 +5984,6 @@ end;
function TMainIDE.DoSelectFrame: TComponentClass;
var
UnitList: TStringList;
dummy: Boolean;
i: Integer;
aFilename: String;
AComponent: TComponent;
@ -5992,10 +5991,7 @@ begin
Result := nil;
UnitList := TStringList.Create;
try
dummy := false;
if SelectUnitComponents(lisSelectFrame,piFrame,UnitList, false, dummy) <> mrOk
then
exit;
if SelectUnitComponents(lisSelectFrame,piFrame,UnitList) <> mrOk then exit;
for i := 0 to UnitList.Count-1 do
begin
aFilename:=UnitList[i];
@ -6016,7 +6012,6 @@ end;
function TMainIDE.DoViewUnitsAndForms(OnlyForms: boolean): TModalResult;
const
UseItemType: array[Boolean] of TIDEProjectItem = (piUnit, piComponent);
MultiSelectCheckedState: Array [Boolean] of Boolean = (True,True);
var
UnitList: TViewUnitEntries;
AForm: TCustomForm;
@ -6027,8 +6022,7 @@ begin
Project1.UpdateIsPartOfProjectFromMainUnit;
UnitList := TViewUnitEntries.Create;
try
if SelectProjectItems(UnitList, UseItemType[OnlyForms],
true, MultiSelectCheckedState[OnlyForms]) = mrOk then
if SelectProjectItems(UnitList, UseItemType[OnlyForms]) = mrOk then
begin
{ This is where we check what the user selected. }
AnUnitInfo := nil;

View File

@ -203,11 +203,9 @@ function SaveEditorFile(const Filename: string; Flags: TSaveFlags): TModalResult
function CloseEditorFile(AEditor: TSourceEditorInterface; Flags: TCloseFlags):TModalResult;
function CloseEditorFile(const Filename: string; Flags: TCloseFlags): TModalResult;
// interactive unit selection
function SelectProjectItems(ItemList: TViewUnitEntries; ItemType: TIDEProjectItem;
MultiSelect: boolean; var MultiSelectCheckedState: Boolean): TModalResult;
function SelectProjectItems(ItemList: TViewUnitEntries; ItemType: TIDEProjectItem): TModalResult;
function SelectUnitComponents(DlgCaption: string; ItemType: TIDEProjectItem;
Files: TStringList; MultiSelect: boolean;
var MultiSelectCheckedState: Boolean): TModalResult;
Files: TStringList): TModalResult;
// unit search
function FindUnitFileImpl(const AFilename: string; TheOwner: TObject = nil;
Flags: TFindUnitFileFlags = []): string;
@ -3304,9 +3302,7 @@ begin
end;
end;
function SelectProjectItems(ItemList: TViewUnitEntries;
ItemType: TIDEProjectItem; MultiSelect: boolean;
var MultiSelectCheckedState: Boolean): TModalResult;
function SelectProjectItems(ItemList: TViewUnitEntries; ItemType: TIDEProjectItem): TModalResult;
var
i: integer;
AUnitName, DlgCaption: string;
@ -3389,12 +3385,11 @@ begin
piFrame: DlgCaption := dlgMainViewFrames;
else DlgCaption := '';
end;
Result := ShowViewUnitsDlg(ItemList, MultiSelect, MultiSelectCheckedState, DlgCaption, ItemType);
Result := ShowViewUnitsDlg(ItemList, true, DlgCaption, ItemType);
end;
function SelectUnitComponents(DlgCaption: string;
ItemType: TIDEProjectItem; Files: TStringList; MultiSelect: boolean;
var MultiSelectCheckedState: Boolean): TModalResult;
function SelectUnitComponents(DlgCaption: string; ItemType: TIDEProjectItem;
Files: TStringList): TModalResult;
var
ActiveSourceEditor: TSourceEditor;
ActiveUnitInfo: TUnitInfo;
@ -3529,7 +3524,7 @@ begin
inc(i);
end;
// show dialog
Result := ShowViewUnitsDlg(UnitList, MultiSelect, MultiSelectCheckedState,
Result := ShowViewUnitsDlg(UnitList, false,
DlgCaption, ItemType, ActiveUnitInfo.Filename);
// create list of selected files
for Entry in UnitList do
@ -3557,8 +3552,6 @@ var
AnUnitInfo: TUnitInfo;
UnitInfos: TFPList;
UEntry: TViewUnitsEntry;
const
MultiSelectCheckedState: Boolean = true;
Begin
if Project1=nil then exit(mrCancel);
Project1.UpdateIsPartOfProjectFromMainUnit;
@ -3574,8 +3567,7 @@ Begin
ViewUnitEntries.Add(AName,AnUnitInfo.FileName,i,false);
end;
end;
if ShowViewUnitsDlg(ViewUnitEntries, true, MultiSelectCheckedState,
lisRemoveFromProject, piUnit) <> mrOk then
if ShowViewUnitsDlg(ViewUnitEntries,true,lisRemoveFromProject,piUnit) <> mrOk then
exit(mrOk);
{ This is where we check what the user selected. }
UnitInfos:=TFPList.Create;

View File

@ -150,7 +150,7 @@ type
procedure UpdateEntries;
public
procedure Init(const aCaption: string;
AllowMultiSelect, EnableMultiSelect: Boolean; aItemType: TIDEProjectItem;
EnableMultiSelect: Boolean; aItemType: TIDEProjectItem;
TheEntries: TViewUnitEntries; aStartFilename: string = '');
property SortAlphabetically: boolean read FSortAlphabetically write SetSortAlphabetically;
property ItemType: TIDEProjectItem read FItemType write SetItemType;
@ -158,8 +158,8 @@ type
end;
// Entries is a list of TViewUnitsEntry(s)
function ShowViewUnitsDlg(Entries: TViewUnitEntries; AllowMultiSelect: boolean;
var CheckMultiSelect: Boolean; const aCaption: string; ItemType: TIDEProjectItem;
function ShowViewUnitsDlg(Entries: TViewUnitEntries; CheckMultiSelect: Boolean;
const aCaption: string; ItemType: TIDEProjectItem;
StartFilename: string = '' // if StartFilename is given the Entries are automatically updated
): TModalResult;
@ -167,21 +167,16 @@ implementation
{$R *.lfm}
function ShowViewUnitsDlg(Entries: TViewUnitEntries; AllowMultiSelect: boolean;
var CheckMultiSelect: Boolean; const aCaption: string;
ItemType: TIDEProjectItem; StartFilename: string): TModalResult;
function ShowViewUnitsDlg(Entries: TViewUnitEntries; CheckMultiSelect: Boolean;
const aCaption: string; ItemType: TIDEProjectItem; StartFilename: string): TModalResult;
var
ViewUnitDialog: TViewUnitDialog;
begin
ViewUnitDialog:=TViewUnitDialog.Create(nil);
try
ViewUnitDialog.Init(aCaption,AllowMultiSelect,CheckMultiSelect,ItemType,Entries,
StartFilename);
ViewUnitDialog.Init(aCaption,CheckMultiSelect,ItemType,Entries,StartFilename);
// Show the dialog
Result:=ViewUnitDialog.ShowModal;
if Result=mrOk then begin
CheckMultiSelect := ViewUnitDialog.mniMultiselect.Checked;
end;
finally
ViewUnitDialog.Free;
end;
@ -338,7 +333,7 @@ begin
IDEDialogLayoutList.SaveLayout(Self);
end;
procedure TViewUnitDialog.Init(const aCaption: string; AllowMultiSelect,
procedure TViewUnitDialog.Init(const aCaption: string;
EnableMultiSelect: Boolean; aItemType: TIDEProjectItem;
TheEntries: TViewUnitEntries; aStartFilename: string);
var
@ -349,7 +344,7 @@ begin
Caption:=aCaption;
ItemType:=aItemType;
fEntries:=TheEntries;
mniMultiselect.Enabled := AllowMultiSelect;
mniMultiselect.Enabled := EnableMultiSelect;
mniMultiselect.Checked := EnableMultiSelect;
ListBox.MultiSelect := mniMultiselect.Enabled;
ShowEntries;