Cleanups.

git-svn-id: trunk@3587 -
This commit is contained in:
lazarus 2002-10-30 19:49:04 +00:00
parent 3ae29b7c22
commit 361a0b4f55

View File

@ -68,25 +68,22 @@ type
SaveOnlyProjectUnitInfoCheckBox: TCheckBox; SaveOnlyProjectUnitInfoCheckBox: TCheckBox;
// buttons at bottom // buttons at bottom
OkButton: TButton; OkButton: TBitBtn;
CancelButton: TButton; CancelButton: TBitBtn;
procedure OkButtonClick(Sender: TObject); procedure ProjectOptionsClose(Sender: TObject; var Action: TCloseAction);
procedure CancelButtonClick(Sender: TObject); procedure ProjectOptionsResize(Sender: TObject);
procedure FormsAddToAutoCreatedFormsBtnClick(Sender: TObject); procedure FormsAddToAutoCreatedFormsBtnClick(Sender: TObject);
procedure FormsRemoveFromAutoCreatedFormsBtnClick(Sender: TObject); procedure FormsRemoveFromAutoCreatedFormsBtnClick(Sender: TObject);
procedure FormsMoveAutoCreatedFormUpBtnClick(Sender: TObject); procedure FormsMoveAutoCreatedFormUpBtnClick(Sender: TObject);
procedure FormsMoveAutoCreatedFormDownBtnClick(Sender: TObject); procedure FormsMoveAutoCreatedFormDownBtnClick(Sender: TObject);
procedure ProjectOptionsDialogResize(Sender: TObject);
private private
FProject: TProject; FProject: TProject;
procedure SetProject(AProject: TProject); procedure SetProject(AProject: TProject);
procedure SetupApplicationPage; procedure SetupApplicationPage;
procedure SetupFormsPage; procedure SetupFormsPage;
procedure SetupInfoPage; procedure SetupInfoPage;
procedure ResizeApplicationPage;
procedure ResizeFormsPage; procedure ResizeFormsPage;
procedure ResizeInfoPage;
procedure FillAutoCreateFormsListbox; procedure FillAutoCreateFormsListbox;
procedure FillAvailFormsListBox; procedure FillAvailFormsListBox;
function IndexOfAutoCreateForm(FormName: string): integer; function IndexOfAutoCreateForm(FormName: string): integer;
@ -107,16 +104,12 @@ implementation
function ShowProjectOptionsDialog(AProject: TProject): TModalResult; function ShowProjectOptionsDialog(AProject: TProject): TModalResult;
var ProjectOptionsDialog: TProjectOptionsDialog;
begin begin
ProjectOptionsDialog:=TProjectOptionsDialog.Create(Application); with TProjectOptionsDialog.Create(Application) do try
try Project:= AProject;
with ProjectOptionsDialog do begin Result:= ShowModal;
Project:=AProject;
Result:=ShowModal;
end;
finally finally
ProjectOptionsDialog.Free; Free;
end; end;
end; end;
@ -129,58 +122,51 @@ begin
if LazarusResources.Find(ClassName)=nil then begin if LazarusResources.Find(ClassName)=nil then begin
Width:=430; Width:=430;
Height:=375; Height:=375;
Position:=poScreenCenter; Position:= poScreenCenter;
OnResize:=@ProjectOptionsDialogResize; OnResize:= @ProjectOptionsResize;
OnClose:= @ProjectOptionsClose;
Caption:=dlgProjectOptions; Caption:=dlgProjectOptions;
Constraints.MinWidth:= 400;
Constraints.MinHeight:= 300;
NoteBook:=TNoteBook.Create(Self); NoteBook:=TNoteBook.Create(Self);
with NoteBook do begin with NoteBook do begin
Name:='NoteBook';
Parent:=Self; Parent:=Self;
SetBounds(0,0,Self.ClientWidth,Self.ClientHeight-50); SetBounds(0, 0, Self.ClientWidth, Self.ClientHeight - 33);
if PageCount>0 then Anchors:= [akTop, akLeft, akRight, akBottom];
if PageCount > 0 then
Pages[0]:=dlgPOApplication Pages[0]:=dlgPOApplication
else else
Pages.Add(dlgPOApplication); Pages.Add(dlgPOApplication);
Pages.Add(dlgPOFroms); Pages.Add(dlgPOFroms);
Pages.Add(dlgPOInfo); Pages.Add(dlgPOInfo);
Visible:=true;
end; end;
SetupFormsPage; SetupFormsPage;
SetupApplicationPage; SetupApplicationPage;
SetupInfoPage; SetupInfoPage;
CancelButton:=TButton.Create(Self); CancelButton:=TBitBtn.Create(Self);
with CancelButton do begin with CancelButton do begin
Name:='CancelButton'; Parent:= Self;
Parent:=Self; Left:= Self.ClientWidth - Width - 4;
Width:=70; Top:= Self.ClientHeight - Height - 4;
Height:=23; Kind:= bkCancel;
Left:=Self.ClientWidth-Width-15; Anchors:= [akBottom, akRight];
Top:=Self.ClientHeight-Height-15;
Caption:=dlgCancel;
OnClick:=@CancelButtonClick;
Show;
end; end;
OkButton:=TButton.Create(Self); OkButton:=TBitBtn.Create(Self);
with OkButton do begin with OkButton do begin
Name:='OkButton'; Parent:= Self;
Parent:=Self; Left:= CancelButton.Left - Width - 4;
Width:=CancelButton.Width; Top:= CancelButton.Top;
Height:=CancelButton.Height; Kind:= bkOk;
Left:=CancelButton.Left-15-Width; Anchors:= [akBottom, akRight];
Top:=CancelButton.Top;
Caption:='Ok';
OnClick:=@OkButtonClick;
Show;
end; end;
end; end;
IDEDialogLayoutList.ApplyLayout(Self,430,375); IDEDialogLayoutList.ApplyLayout(Self, 430, 375);
ProjectOptionsDialogResize(nil);
end; end;
procedure TProjectOptionsDialog.SetupApplicationPage; procedure TProjectOptionsDialog.SetupApplicationPage;
@ -190,72 +176,64 @@ begin
AppSettingsGroupBox:=TGroupBox.Create(Self); AppSettingsGroupBox:=TGroupBox.Create(Self);
with AppSettingsGroupBox do begin with AppSettingsGroupBox do begin
Name:='AppSettingsGroupBox';
Parent:=NoteBook.Page[0]; Parent:=NoteBook.Page[0];
Left:=5; Left:=5;
Top:=5; Top:=5;
Width:=MaxX-2*Left; Width:=MaxX-2*Left;
Height:=60; Height:=60;
Anchors:= [akTop, akLeft, akRight];
Caption:=dlgApplicationSettings; Caption:=dlgApplicationSettings;
Visible:=true;
end; end;
TitleLabel:=TLabel.Create(Self); TitleLabel:=TLabel.Create(Self);
with TitleLabel do begin with TitleLabel do begin
Name:='TitleLabel';
Parent:=AppSettingsGroupBox; Parent:=AppSettingsGroupBox;
Left:=15; Left:= 5;
Top:=1; Top:= 4;
Width:=100; Width:= 50;
Height:=23; Height:= 23;
Caption:=dlgPOTitle; Caption:=dlgPOTitle;
Visible:=true;
end; end;
TitleEdit:=TEdit.Create(Self); TitleEdit:=TEdit.Create(Self);
with TitleEdit do begin with TitleEdit do begin
Name:='TitleEdit';
Parent:=AppSettingsGroupBox; Parent:=AppSettingsGroupBox;
Left:=TitleLabel.Left+TitleLabel.Width+2; Left:=TitleLabel.Left+TitleLabel.Width+2;
Top:=TitleLabel.Top+4; Top:=TitleLabel.Top - 1;
Width:=AppSettingsGroupBox.ClientWidth-Left-10; Width:=AppSettingsGroupBox.ClientWidth-Left-10;
Anchors:= [akTop, akLeft, akRight];
Text:=''; Text:='';
Visible:=true;
end; end;
OutputSettingsGroupBox:=TGroupBox.Create(Self); OutputSettingsGroupBox:=TGroupBox.Create(Self);
with OutputSettingsGroupBox do begin with OutputSettingsGroupBox do begin
Name:='OutputSettingsGroupBox';
Parent:=NoteBook.Page[0]; Parent:=NoteBook.Page[0];
Left:=AppSettingsGroupBox.Left; Left:=AppSettingsGroupBox.Left;
Top:=AppSettingsGroupBox.Top+AppSettingsGroupBox.Height+5; Top:=AppSettingsGroupBox.Top+AppSettingsGroupBox.Height+5;
Width:=AppSettingsGroupBox.Width; Width:=AppSettingsGroupBox.Width;
Height:=60; Height:=60;
Caption:=dlgPOOutputSettings ; Anchors:= [akTop, akLeft, akRight];
Visible:=true; Caption:=dlgPOOutputSettings;
end; end;
TargetFileLabel:=TLabel.Create(Self); TargetFileLabel:=TLabel.Create(Self);
with TargetFileLabel do begin with TargetFileLabel do begin
Name:='TargetFileLabel';
Parent:=OutputSettingsGroupBox; Parent:=OutputSettingsGroupBox;
Left:=5; Left:= 5;
Top:=1; Top:= 4;
Width:=200; Width:= 100;
Height:=23; Height:= 23;
Caption:=dlgPOTargetFileName ; Caption:=dlgPOTargetFileName;
Visible:=true;
end; end;
TargetFileEdit:=TEdit.Create(Self); TargetFileEdit:=TEdit.Create(Self);
with TargetFileEdit do begin with TargetFileEdit do begin
Name:='TargetFileEdit';
Parent:=OutputSettingsGroupBox; Parent:=OutputSettingsGroupBox;
Left:=TargetFileLabel.Left+TargetFileLabel.Width+5; Left:=TargetFileLabel.Left+TargetFileLabel.Width+5;
Top:=TargetFileLabel.Top+4; Top:=TargetFileLabel.Top - 1;
Width:=OutputSettingsGroupBox.Width-Left-10; Width:=OutputSettingsGroupBox.Width-Left-10;
Anchors:= [akTop, akLeft, akRight];
Text:=''; Text:='';
Visible:=true;
end; end;
end; end;
@ -263,55 +241,46 @@ procedure TProjectOptionsDialog.SetupFormsPage;
begin begin
FormsAutoCreatedLabel:=TLabel.Create(Self); FormsAutoCreatedLabel:=TLabel.Create(Self);
with FormsAutoCreatedLabel do begin with FormsAutoCreatedLabel do begin
Name:='FormsAutoCreatedLabel';
Parent:=NoteBook.Page[1]; Parent:=NoteBook.Page[1];
Left:=40; Left:=40;
Top:=1; Top:=4;
Width:=150; Width:=150;
Height:=23; Height:=23;
Caption:=dlgAutoCreateForms; Caption:=dlgAutoCreateForms;
Visible:=true;
end; end;
FormsAutoCreatedListBox:=TListBox.Create(Self); FormsAutoCreatedListBox:=TListBox.Create(Self);
with FormsAutoCreatedListBox do begin with FormsAutoCreatedListBox do begin
Name:='FormsAutoCreatedListBox';
Parent:=NoteBook.Page[1]; Parent:=NoteBook.Page[1];
Left:=40; Left:=40;
Top:=28; Top:=28;
Width:=165; Width:=165;
Height:=228; Height:=228;
MultiSelect:=true; MultiSelect:=true;
Visible:=true;
end; end;
FormsAvailFormsLabel:=TLabel.Create(Self); FormsAvailFormsLabel:=TLabel.Create(Self);
with FormsAvailFormsLabel do begin with FormsAvailFormsLabel do begin
Name:='FormsAvailFormsLabel';
Parent:=NoteBook.Page[1]; Parent:=NoteBook.Page[1];
Left:=FormsAutoCreatedListBox.Left+FormsAutoCreatedListBox.Width+45; Left:=FormsAutoCreatedListBox.Left+FormsAutoCreatedListBox.Width+45;
Top:=FormsAutoCreatedLabel.Top; Top:=FormsAutoCreatedLabel.Top;
Width:=FormsAutoCreatedLabel.Width; Width:=FormsAutoCreatedLabel.Width;
Height:=FormsAutoCreatedLabel.Height; Height:=FormsAutoCreatedLabel.Height;
Caption:=dlgAvailableForms ; Caption:=dlgAvailableForms;
Visible:=true;
end; end;
FormsAvailFormsListBox:=TListBox.Create(Self); FormsAvailFormsListBox:=TListBox.Create(Self);
with FormsAvailFormsListBox do begin with FormsAvailFormsListBox do begin
Name:='FormsAvailFormsListBox';
Parent:=NoteBook.Page[1]; Parent:=NoteBook.Page[1];
Left:=FormsAvailFormsLabel.Left; Left:=FormsAvailFormsLabel.Left;
Top:=FormsAutoCreatedListBox.Top; Top:=FormsAutoCreatedListBox.Top;
Width:=FormsAutoCreatedListBox.Width; Width:=FormsAutoCreatedListBox.Width;
Height:=FormsAutoCreatedListBox.Height; Height:=FormsAutoCreatedListBox.Height;
MultiSelect:=true; MultiSelect:=true;
Visible:=true;
end; end;
FormsAddToAutoCreatedFormsBtn:=TSpeedButton.Create(Self); FormsAddToAutoCreatedFormsBtn:=TSpeedButton.Create(Self);
with FormsAddToAutoCreatedFormsBtn do begin with FormsAddToAutoCreatedFormsBtn do begin
Name:='FormsAddToAutoCreatedFormsBtn';
Parent:=NoteBook.Page[1]; Parent:=NoteBook.Page[1];
Left:=FormsAutoCreatedListBox.Left+FormsAutoCreatedListBox.Width+10; Left:=FormsAutoCreatedListBox.Left+FormsAutoCreatedListBox.Width+10;
Top:=FormsAutoCreatedListBox.Top+80; Top:=FormsAutoCreatedListBox.Top+80;
@ -320,12 +289,10 @@ begin
Glyph:=TPixmap.Create; Glyph:=TPixmap.Create;
Glyph.LoadFromLazarusResource('leftarrow'); Glyph.LoadFromLazarusResource('leftarrow');
OnClick:=@FormsAddToAutoCreatedFormsBtnClick; OnClick:=@FormsAddToAutoCreatedFormsBtnClick;
Visible:=true;
end; end;
FormsRemoveFromAutoCreatedFormsBtn:=TSpeedButton.Create(Self); FormsRemoveFromAutoCreatedFormsBtn:=TSpeedButton.Create(Self);
with FormsRemoveFromAutoCreatedFormsBtn do begin with FormsRemoveFromAutoCreatedFormsBtn do begin
Name:='FormsRemoveFromAutoCreatedFormsBtn';
Parent:=NoteBook.Page[1]; Parent:=NoteBook.Page[1];
Left:=FormsAddToAutoCreatedFormsBtn.Left; Left:=FormsAddToAutoCreatedFormsBtn.Left;
Top:=FormsAddToAutoCreatedFormsBtn.Top Top:=FormsAddToAutoCreatedFormsBtn.Top
@ -335,12 +302,10 @@ begin
Glyph:=TPixmap.Create; Glyph:=TPixmap.Create;
Glyph.LoadFromLazarusResource('rightarrow'); Glyph.LoadFromLazarusResource('rightarrow');
OnClick:=@FormsRemoveFromAutoCreatedFormsBtnClick; OnClick:=@FormsRemoveFromAutoCreatedFormsBtnClick;
Visible:=true;
end; end;
FormsMoveAutoCreatedFormUpBtn:=TSpeedButton.Create(Self); FormsMoveAutoCreatedFormUpBtn:=TSpeedButton.Create(Self);
with FormsMoveAutoCreatedFormUpBtn do begin with FormsMoveAutoCreatedFormUpBtn do begin
Name:='FormsMoveAutoCreatedFormUpBtn';
Parent:=NoteBook.Page[1]; Parent:=NoteBook.Page[1];
Left:=FormsAutoCreatedListBox.Left-35; Left:=FormsAutoCreatedListBox.Left-35;
Top:=FormsAutoCreatedListBox.Top+80; Top:=FormsAutoCreatedListBox.Top+80;
@ -349,12 +314,10 @@ begin
Glyph:=TPixmap.Create; Glyph:=TPixmap.Create;
Glyph.LoadFromLazarusResource('uparrow'); Glyph.LoadFromLazarusResource('uparrow');
OnClick:=@FormsMoveAutoCreatedFormUpBtnClick; OnClick:=@FormsMoveAutoCreatedFormUpBtnClick;
Visible:=true;
end; end;
FormsMoveAutoCreatedFormDownBtn:=TSpeedButton.Create(Self); FormsMoveAutoCreatedFormDownBtn:=TSpeedButton.Create(Self);
with FormsMoveAutoCreatedFormDownBtn do begin with FormsMoveAutoCreatedFormDownBtn do begin
Name:='FormsMoveAutoCreatedFormDownBtn';
Parent:=NoteBook.Page[1]; Parent:=NoteBook.Page[1];
Left:=FormsMoveAutoCreatedFormUpBtn.Left; Left:=FormsMoveAutoCreatedFormUpBtn.Left;
Top:=FormsMoveAutoCreatedFormUpBtn.Top Top:=FormsMoveAutoCreatedFormUpBtn.Top
@ -364,91 +327,38 @@ begin
Glyph:=TPixmap.Create; Glyph:=TPixmap.Create;
Glyph.LoadFromLazarusResource('downarrow'); Glyph.LoadFromLazarusResource('downarrow');
OnClick:=@FormsMoveAutoCreatedFormDownBtnClick; OnClick:=@FormsMoveAutoCreatedFormDownBtnClick;
Visible:=true;
end; end;
FormsAutoCreateNewFormsCheckBox:=TCheckBox.Create(Self); FormsAutoCreateNewFormsCheckBox:=TCheckBox.Create(Self);
with FormsAutoCreateNewFormsCheckBox do begin with FormsAutoCreateNewFormsCheckBox do begin
Name:='FormsAutoCreateNewFormsCheckBox';
Parent:=NoteBook.Page[1]; Parent:=NoteBook.Page[1];
Left:=FormsAutoCreatedListBox.Left+5; Left:=FormsAutoCreatedListBox.Left+5;
Top:=FormsAutoCreatedListBox.Top+FormsAutoCreatedListBox.Height+5; Top:=FormsAutoCreatedListBox.Top+FormsAutoCreatedListBox.Height+5;
Width:=200; Width:=200;
Height:=25; Height:=25;
Caption:=dlgAutoCreateNewForms ; Caption:=dlgAutoCreateNewForms ;
Enabled:=false; Enabled:= false;
Visible:=true;
end; end;
end; end;
procedure TProjectOptionsDialog.SetupInfoPage; procedure TProjectOptionsDialog.SetupInfoPage;
begin begin
SaveClosedUnitInfoCheckBox:=TCheckBox.Create(Self); SaveClosedUnitInfoCheckBox:= TCheckBox.Create(Self);
with SaveClosedUnitInfoCheckBox do begin with SaveClosedUnitInfoCheckBox do begin
Name:='SaveClosedUnitInfoCheckBox'; Parent:= NoteBook.Page[2];
Parent:=NoteBook.Page[2]; Left:= 10;
Left:=10; Top:= 10;
Top:=10; Width:= 350;
Width:=350; Caption:= dlgSaveEditorInfo;
Caption:=dlgSaveEditorInfo ;
Visible:=true;
end; end;
SaveOnlyProjectUnitInfoCheckBox:=TCheckBox.Create(Self); SaveOnlyProjectUnitInfoCheckBox:= TCheckBox.Create(Self);
with SaveOnlyProjectUnitInfoCheckBox do begin with SaveOnlyProjectUnitInfoCheckBox do begin
Name:='SaveOnlyProjectUnitInfoCheckBox'; Parent:= NoteBook.Page[2];
Parent:=NoteBook.Page[2]; Left:= SaveClosedUnitInfoCheckBox.Left;
Left:=SaveClosedUnitInfoCheckBox.Left; Top:= SaveClosedUnitInfoCheckBox.Top+SaveClosedUnitInfoCheckBox.Height+10;
Top:=SaveClosedUnitInfoCheckBox.Top+SaveClosedUnitInfoCheckBox.Height+10; Width:= SaveClosedUnitInfoCheckBox.Width;
Width:=SaveClosedUnitInfoCheckBox.Width; Caption:= dlgSaveEditorInfoProject;
Caption:=dlgSaveEditorInfoProject;
Visible:=true;
end;
end;
procedure TProjectOptionsDialog.ResizeApplicationPage;
var MaxX:integer;
begin
MaxX:=ClientWidth-5;
with AppSettingsGroupBox do begin
Left:=5;
Top:=5;
Width:=MaxX-2*Left;
Height:=60;
end;
with TitleLabel do begin
Left:=5;
Top:=1;
Width:=100;
Height:=23;
end;
with TitleEdit do begin
Left:=TitleLabel.Left+TitleLabel.Width+2;
Top:=TitleLabel.Top+4;
Width:=AppSettingsGroupBox.ClientWidth-Left-10;
end;
with OutputSettingsGroupBox do begin
Left:=AppSettingsGroupBox.Left;
Top:=AppSettingsGroupBox.Top+AppSettingsGroupBox.Height+5;
Width:=AppSettingsGroupBox.Width;
Height:=60;
end;
with TargetFileLabel do begin
Left:=5;
Top:=1;
Width:=160;
Height:=23;
end;
with TargetFileEdit do begin
Left:=TargetFileLabel.Left+TargetFileLabel.Width+5;
Top:=TargetFileLabel.Top+4;
Width:=OutputSettingsGroupBox.Width-Left-10;
end; end;
end; end;
@ -460,12 +370,6 @@ begin
ListBoxWidth:=(MaxX-95) div 2; ListBoxWidth:=(MaxX-95) div 2;
ListBoxHeight:=MaxY-70; ListBoxHeight:=MaxY-70;
with FormsAutoCreatedLabel do begin
Left:=40;
Top:=1;
Width:=190;
end;
with FormsAutoCreatedListBox do begin with FormsAutoCreatedListBox do begin
Left:=FormsAutoCreatedLabel.Left; Left:=FormsAutoCreatedLabel.Left;
Top:=FormsAutoCreatedLabel.Top+FormsAutoCreatedLabel.Height+3; Top:=FormsAutoCreatedLabel.Top+FormsAutoCreatedLabel.Height+3;
@ -525,21 +429,6 @@ begin
end; end;
end; end;
procedure TProjectOptionsDialog.ResizeInfoPage;
begin
with SaveClosedUnitInfoCheckBox do begin
Left:=10;
Top:=10;
Width:=350;
end;
with SaveOnlyProjectUnitInfoCheckBox do begin
Left:=SaveClosedUnitInfoCheckBox.Left;
Top:=SaveClosedUnitInfoCheckBox.Top+SaveClosedUnitInfoCheckBox.Height+10;
Width:=SaveClosedUnitInfoCheckBox.Width;
end;
end;
procedure TProjectOptionsDialog.SetProject(AProject: TProject); procedure TProjectOptionsDialog.SetProject(AProject: TProject);
begin begin
FProject:=AProject; FProject:=AProject;
@ -557,35 +446,32 @@ begin
(pfSaveOnlyProjectUnits in AProject.Flags); (pfSaveOnlyProjectUnits in AProject.Flags);
end; end;
procedure TProjectOptionsDialog.OkButtonClick(Sender: TObject); procedure TProjectOptionsDialog.ProjectOptionsClose(Sender: TObject; var Action: TCloseAction);
var NewFlags: TProjectFlags; var NewFlags: TProjectFlags;
begin begin
with Project do begin if ModalResult = mrOk then begin
Title:=TitleEdit.Text;
TargetFilename:=TargetFileEdit.Text;
end;
// flags
NewFlags:=Project.Flags;
if SaveClosedUnitInfoCheckBox.Checked then
Include(NewFlags,pfSaveClosedUnits)
else
Exclude(NewFlags,pfSaveClosedUnits);
if SaveOnlyProjectUnitInfoCheckBox.Checked then
Include(NewFlags,pfSaveOnlyProjectUnits)
else
Exclude(NewFlags,pfSaveOnlyProjectUnits);
Project.Flags:=NewFlags;
SetAutoCreateForms;
IDEDialogLayoutList.SaveLayout(Self);
ModalResult:=mrOk;
end;
procedure TProjectOptionsDialog.CancelButtonClick(Sender: TObject); with Project do begin
begin Title:=TitleEdit.Text;
TargetFilename:=TargetFileEdit.Text;
end;
// flags
NewFlags:=Project.Flags;
if SaveClosedUnitInfoCheckBox.Checked then
Include(NewFlags,pfSaveClosedUnits)
else
Exclude(NewFlags,pfSaveClosedUnits);
if SaveOnlyProjectUnitInfoCheckBox.Checked then
Include(NewFlags,pfSaveOnlyProjectUnits)
else
Exclude(NewFlags,pfSaveOnlyProjectUnits);
Project.Flags:=NewFlags;
SetAutoCreateForms;
end;
IDEDialogLayoutList.SaveLayout(Self); IDEDialogLayoutList.SaveLayout(Self);
ModalResult:=mrCancel;
end; end;
function TProjectOptionsDialog.GetAutoCreatedFormsList: TStrings; function TProjectOptionsDialog.GetAutoCreatedFormsList: TStrings;
@ -615,37 +501,38 @@ end;
procedure TProjectOptionsDialog.FillAutoCreateFormsListbox; procedure TProjectOptionsDialog.FillAutoCreateFormsListbox;
var sl: TStrings; var sl: TStrings;
begin begin
sl:=GetAutoCreatedFormsList; sl:= GetAutoCreatedFormsList;
FormsAutoCreatedListBox.Items.BeginUpdate; FormsAutoCreatedListBox.Items.BeginUpdate;
FormsAutoCreatedListBox.Items.Clear; FormsAutoCreatedListBox.Items.Clear;
if sl<>nil then if sl <> nil then begin
FormsAutoCreatedListBox.Items.Assign(sl); FormsAutoCreatedListBox.Items.Assign(sl);
sl.Free;
end;
FormsAutoCreatedListBox.Items.EndUpdate; FormsAutoCreatedListBox.Items.EndUpdate;
if sl<>nil then sl.Free;
end; end;
procedure TProjectOptionsDialog.FillAvailFormsListBox; procedure TProjectOptionsDialog.FillAvailFormsListBox;
var sl: TStringList; var sl: TStringList;
i: integer; i: integer;
begin begin
if (FProject<>nil) then begin
sl:=TStringList.Create;
for i:=0 to FProject.UnitCount-1 do begin
if (FProject.Units[i].IsPartOfProject)
and (FProject.Units[i].FormName<>'') then begin
if IndexOfAutoCreateForm(FProject.Units[i].FormName)<0 then begin
sl.Add(FProject.Units[i].FormName);
end;
end;
end;
sl.Sort;
end else begin
sl:=nil;
end;
FormsAvailFormsListBox.Items.BeginUpdate; FormsAvailFormsListBox.Items.BeginUpdate;
FormsAvailFormsListBox.Items.Clear; FormsAvailFormsListBox.Items.Clear;
if sl<>nil then
FormsAvailFormsListBox.Items.Assign(sl); if (FProject<>nil) then begin
sl:= TStringList.Create;
try
for i:= 0 to FProject.UnitCount - 1 do begin
if (FProject.Units[i].IsPartOfProject)
and (FProject.Units[i].FormName <> '')
and (IndexOfAutoCreateForm(FProject.Units[i].FormName) < 0) then
sl.Add(FProject.Units[i].FormName);
end;
sl.Sort;
FormsAvailFormsListBox.Items.Assign(sl);
finally
sl.Free;
end;
end;
FormsAvailFormsListBox.Items.EndUpdate; FormsAvailFormsListBox.Items.EndUpdate;
end; end;
@ -768,29 +655,9 @@ begin
SelectOnlyThisAutoCreateForm(i+1); SelectOnlyThisAutoCreateForm(i+1);
end; end;
procedure TProjectOptionsDialog.ProjectOptionsDialogResize(Sender: TObject); procedure TProjectOptionsDialog.ProjectOptionsResize(Sender: TObject);
begin begin
with NoteBook do begin
SetBounds(0,0,Self.ClientWidth,Self.ClientHeight-50);
end;
ResizeFormsPage; ResizeFormsPage;
ResizeApplicationPage;
ResizeInfoPage;
with CancelButton do begin
Width:=70;
Height:=23;
Left:=Self.ClientWidth-Width-15;
Top:=Self.ClientHeight-Height-15;
end;
with OkButton do begin
Width:=CancelButton.Width;
Height:=CancelButton.Height;
Left:=CancelButton.Left-15-Width;
Top:=CancelButton.Top;
end;
end; end;
procedure TProjectOptionsDialog.SelectOnlyThisAutoCreateForm( procedure TProjectOptionsDialog.SelectOnlyThisAutoCreateForm(
@ -799,7 +666,7 @@ var i: integer;
begin begin
with FormsAutoCreatedListBox do begin with FormsAutoCreatedListBox do begin
for i:=0 to Items.Count-1 do for i:=0 to Items.Count-1 do
Selected[i]:=(i=Index); Selected[i]:= (i = Index);
end; end;
end; end;