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

View File

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

View File

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