IDE: small optimizations for UseProjUnitDlg.

git-svn-id: trunk@28966 -
This commit is contained in:
juha 2011-01-11 23:30:17 +00:00
parent 8c4273f6e4
commit dff83af5e8

View File

@ -20,7 +20,7 @@ type
SectionRadioGroup: TRadioGroup;
private
procedure AddItems(AItems: TStrings);
function SelectFirst: string;
procedure SelectFirst;
function SelectedUnit: string;
function InterfaceSelected: Boolean;
public
@ -42,7 +42,7 @@ var
MainUsedUnits, ImplUsedUnits: TStrings;
AvailUnits: TStringList;
s: String;
IsIntf, CTRes: Boolean;
CTRes: Boolean;
begin
Result:=mrOk;
if not LazarusIDE.BeginCodeTools then exit;
@ -79,10 +79,8 @@ begin
UseProjUnitDlg.SelectFirst;
if UseProjUnitDlg.ShowModal=mrOk then begin
s:=UseProjUnitDlg.SelectedUnit;
IsIntf:=UseProjUnitDlg.InterfaceSelected;
if s<>'' then begin
CTRes:=True;
if IsIntf then
if UseProjUnitDlg.InterfaceSelected then
CTRes:=CodeToolBoss.AddUnitToMainUsesSection(Code, s, '')
else
CTRes:=CodeToolBoss.AddUnitToImplementationUsesSection(Code, s, '');
@ -111,10 +109,9 @@ begin
UnitsListBox.Items.Assign(AItems);
end;
function TUseProjUnitDialog.SelectFirst: string;
procedure TUseProjUnitDialog.SelectFirst;
begin
UnitsListBox.Selected[0]:=True;
Result:=UnitsListBox.Items[0];
end;
function TUseProjUnitDialog.SelectedUnit: string;