From 25edafc5a6e519e885cb2e269673606de6dfb4a4 Mon Sep 17 00:00:00 2001 From: juha Date: Tue, 21 Dec 2010 21:12:33 +0000 Subject: [PATCH] IDE: Build Advanced Lazarus improvements by Stephano git-svn-id: trunk@28797 - --- ide/buildlazdialog.pas | 10 ++++++++-- ide/genericchecklist.lfm | 7 ++++--- ide/genericchecklist.pas | 12 +++++++++++- ide/main.pp | 29 ++++++++++++++++++++++++++++- 4 files changed, 51 insertions(+), 7 deletions(-) diff --git a/ide/buildlazdialog.pas b/ide/buildlazdialog.pas index 8d1a326012..508be29c50 100644 --- a/ide/buildlazdialog.pas +++ b/ide/buildlazdialog.pas @@ -1133,6 +1133,10 @@ begin end; procedure TConfigureBuildLazarusDlg.CompileAdvancedButtonClick(Sender: TObject); +// mrOk=change selected profiles. Selected profiels will be saved or discarded +// depending on the calling dialog +// mrYes=save and compile +// mrCancel=do nothing var EditForm: TGenericCheckListForm; i, ind: Integer; @@ -1148,15 +1152,17 @@ begin EditForm.CheckListBox1.Checked[ind]:=True; end; // Show the form. - if EditForm.ShowModal=mrOK then begin + EditForm.ShowModal; + if EditForm.ModalResult in [mrOK, mrYes] then begin // Copy checked profile names to Selected. fProfiles.Selected.Clear; for i:=0 to fProfiles.Count-1 do begin // fProfiles and CheckListBox1 if EditForm.CheckListBox1.Checked[i] then // indexes match now. fProfiles.Selected.Add(fProfiles[i].Name); end; - ModalResult:=mrAll; end; + if EditForm.ModalResult=mrYes then + ModalResult:=mrAll; finally EditForm.Free; end; diff --git a/ide/genericchecklist.lfm b/ide/genericchecklist.lfm index 225a292c69..0ffdbf7822 100644 --- a/ide/genericchecklist.lfm +++ b/ide/genericchecklist.lfm @@ -3,6 +3,7 @@ object GenericCheckListForm: TGenericCheckListForm Height = 301 Top = 526 Width = 343 + ActiveControl = CheckListBox1 Caption = 'GenericCheckListForm' ClientHeight = 301 ClientWidth = 343 @@ -11,8 +12,8 @@ object GenericCheckListForm: TGenericCheckListForm LCLVersion = '0.9.29' object ButtonPanel1: TButtonPanel Left = 6 - Height = 34 - Top = 261 + Height = 37 + Top = 258 Width = 331 OKButton.Name = 'OKButton' OKButton.Caption = '&OK' @@ -30,7 +31,7 @@ object GenericCheckListForm: TGenericCheckListForm end object CheckListBox1: TCheckListBox Left = 0 - Height = 255 + Height = 252 Top = 0 Width = 343 Align = alClient diff --git a/ide/genericchecklist.pas b/ide/genericchecklist.pas index 8528db53b0..1daaaa6114 100644 --- a/ide/genericchecklist.pas +++ b/ide/genericchecklist.pas @@ -6,7 +6,7 @@ interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ButtonPanel, - StdCtrls, CheckLst, LazarusIDEStrConsts; + StdCtrls, CheckLst, LazarusIDEStrConsts, Buttons; type @@ -32,9 +32,19 @@ implementation { TGenericCheckListForm } procedure TGenericCheckListForm.FormCreate(Sender: TObject); +var + BitButtonYes: TBitBtn; begin ButtonPanel1.OKButton.Caption:=lisOk; ButtonPanel1.CancelButton.Caption:=dlgCancel; + + // save and compile + BitButtonYes:=TBitBtn.Create(ButtonPanel1); + BitButtonYes.Kind:=bkCustom; + BitButtonYes.ModalResult:=mrYes; + BitButtonYes.Caption:=lisLazBuildBuild; + BitButtonYes.Align:=alRight; + BitButtonYes.Parent:=ButtonPanel1; end; end. diff --git a/ide/main.pp b/ide/main.pp index f898f82c2e..22e783cd4f 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -327,6 +327,7 @@ type procedure mnuToolConvertDelphiPackageClicked(Sender: TObject); procedure mnuToolConvertEncodingClicked(Sender: TObject); procedure mnuToolBuildLazarusClicked(Sender: TObject); + procedure mnuToolBuildAdvancedLazarusClicked(Sender: TObject); procedure mnuToolConfigBuildLazClicked(Sender: TObject); procedure mnuCustomExtToolClick(Sender: TObject); @@ -3191,7 +3192,7 @@ begin DoConvertDFMtoLFM; ecBuildLazarus: - DoBuildLazarus([]); + mnuToolBuildLazarusClicked(Self); ecConfigBuildLazarus: mnuToolConfigBuildLazClicked(Self); @@ -4371,6 +4372,32 @@ begin DoBuildLazarus([]); end; +procedure TMainIDE.mnuToolBuildAdvancedLazarusClicked(Sender: TObject); +var + i: Integer; + FoundProfToBuild: Boolean; + s: String; +begin + with MiscellaneousOptions do begin + FoundProfToBuild:=False; + s:=sLineBreak+sLineBreak; + for i:=0 to BuildLazProfiles.Selected.Count-1 do + if BuildLazProfiles.IndexByName(BuildLazProfiles.Selected[i])<>-1 then begin + s:=s+BuildLazProfiles.Selected[i]+sLineBreak; + FoundProfToBuild:=True; + end; + if not FoundProfToBuild then begin + ShowMessage(lisNoBuildProfilesSelected); + exit; + end; + if BuildLazProfiles.ConfirmBuild then + if MessageDlg(Format(lisConfirmBuildAllProfiles, [s+sLineBreak]), + mtConfirmation, mbYesNo, 0)<>mrYes then + exit; + DoBuildAdvancedLazarus(BuildLazProfiles.Selected); + end; +end; + procedure TMainIDE.mnuToolConfigBuildLazClicked(Sender: TObject); var CmdLineDefines: TDefineTemplate;