From 671a98ae74bd412f61ff485b9cb6852c104487af Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 10 Aug 2003 09:52:39 +0000 Subject: [PATCH] added show compiler options dialog git-svn-id: trunk@4462 - --- .gitattributes | 3 ++ ide/compileroptions.pp | 73 +++++++++++++++---------------------- ide/showcompileropts.lfm | 44 ++++++++++++++++++++++ ide/showcompileropts.lrs | 16 ++++++++ ide/showcompileropts.pas | 79 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 172 insertions(+), 43 deletions(-) create mode 100644 ide/showcompileropts.lfm create mode 100644 ide/showcompileropts.lrs create mode 100644 ide/showcompileropts.pas diff --git a/.gitattributes b/.gitattributes index db28f02d9b..d07e39eb37 100644 --- a/.gitattributes +++ b/.gitattributes @@ -378,6 +378,9 @@ ide/publishprojectdlg.lfm svneol=native#text/plain ide/publishprojectdlg.lrs svneol=native#text/pascal ide/publishprojectdlg.pas svneol=native#text/pascal ide/runparamsopts.pas svneol=native#text/pascal +ide/showcompileropts.lfm svneol=native#text/plain +ide/showcompileropts.lrs svneol=native#text/pascal +ide/showcompileropts.pas svneol=native#text/pascal ide/sortselectiondlg.pas svneol=native#text/pascal ide/sourceeditprocs.pas svneol=native#text/pascal ide/sourcemarks.pas svneol=native#text/pascal diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index 877f96bd76..4a204ce063 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -44,7 +44,7 @@ uses Forms, Classes, SysUtils, ComCtrls, Buttons, StdCtrls, ExtCtrls, Graphics, LResources, Laz_XMLCfg, FileCtrl, Dialogs, Controls, PathEditorDlg, IDEProcs, LazConf, IDEOptionDefs, LazarusIDEStrConsts, - TransferMacros; + TransferMacros, ShowCompilerOpts; type TInheritedCompilerOption = ( @@ -626,16 +626,16 @@ type ExecuteAfterScanMakeCheckBox: TCheckBox; { Buttons } - btnTest: TButton; + btnShowOptions: TButton; btnOK: TButton; btnCancel: TButton; - btnApply: TButton; + btnCheck: TButton; { Procedures } procedure ButtonOKClicked(Sender: TObject); procedure ButtonCancelClicked(Sender: TObject); - procedure ButtonApplyClicked(Sender: TObject); - procedure ButtonTestClicked(Sender: TObject); + procedure ButtonCheckClicked(Sender: TObject); + procedure ButtonShowOptionsClicked(Sender: TObject); procedure ExecuteAfterGroupBoxResize(Sender: TObject); procedure ExecuteBeforeGroupBoxResize(Sender: TObject); procedure FileBrowseBtnClick(Sender: TObject); @@ -2493,42 +2493,29 @@ begin end; {------------------------------------------------------------------------------ - TfrmCompilerOptions ButtonApplyClicked + TfrmCompilerOptions ButtonCheckClicked ------------------------------------------------------------------------------} -procedure TfrmCompilerOptions.ButtonApplyClicked(Sender: TObject); +procedure TfrmCompilerOptions.ButtonCheckClicked(Sender: TObject); begin // Apply any changes PutCompilerOptions; end; {------------------------------------------------------------------------------ - TfrmCompilerOptions ButtonTestClicked + TfrmCompilerOptions ButtonShowOptionsClicked This function is for testing the MakeOptionsString function only. Remove this function and its button when the function is working correctly. ------------------------------------------------------------------------------} -procedure TfrmCompilerOptions.ButtonTestClicked(Sender: TObject); +procedure TfrmCompilerOptions.ButtonShowOptionsClicked(Sender: TObject); var - teststr: String; - i, LineLen: integer; + CurOptions: String; begin // Test MakeOptionsString function - Assert(False, 'Trace:Test MakeOptionsString function'); - PutCompilerOptions; - teststr := CompilerOpts.MakeOptionsString(CompilerOpts.DefaultMakeOptionsFlags); - WriteLn('CompilerOpts.MakeOptionsString: ' + teststr); - i:=1; - LineLen:=0; - while (i<=length(TestStr)) do begin - inc(LineLen); - if (LineLen>60) and (TestStr[i]=' ') then begin - TestStr[i]:=#13; - LineLen:=0; - end; - inc(i); - end; - MessageDlg(dlgShowCompilerOptions,dlgCOOpts+#13+TestStr,mtInformation, - [mbOk],0); + CurOptions := CompilerOpts.MakeOptionsString( + CompilerOpts.DefaultMakeOptionsFlags); + WriteLn('CompilerOpts.MakeOptionsString: ' + CurOptions); + ShowCompilerOptionsDialog(CurOptions); end; procedure TfrmCompilerOptions.ExecuteAfterGroupBoxResize(Sender: TObject); @@ -4489,16 +4476,16 @@ begin // Setup the Button Bar Assert(False, 'Trace:Setting up compiler options button bar'); - btnApply := TButton.Create(Self); - with btnApply do + btnCheck := TButton.Create(Self); + with btnCheck do begin Parent := Self; Width := 70; Height := 23; - Top := Self.Height - btnApply.Height - 15; - Left := Self.Width - btnApply.Width - 10; + Top := Self.Height - btnCheck.Height - 15; + Left := Self.Width - btnCheck.Width - 10; Caption := dlgButApply; - OnClick := @ButtonApplyClicked; + OnClick := @ButtonCheckClicked; end; btnCancel := TButton.Create(Self); @@ -4508,7 +4495,7 @@ begin Width := 70; Height := 23; Top := Self.Height - btnCancel.Height - 15; - Left := btnApply.Left - btnCancel.Width - 5; + Left := btnCheck.Left - btnCancel.Width - 5; Caption := dlgCancel ; OnClick := @ButtonCancelClicked; end; @@ -4525,16 +4512,16 @@ begin OnClick := @ButtonOKClicked; end; - btnTest := TButton.Create(Self); - with btnTest do + btnShowOptions := TButton.Create(Self); + with btnShowOptions do begin Parent := Self; Width := 110; Height := 23; - Top := Self.Height - btnTest.Height - 15; - Left := btnOK.Left - btnTest.Width - 5; + Top := Self.Height - btnShowOptions.Height - 15; + Left := btnOK.Left - btnShowOptions.Width - 5; Caption := dlgCOShowOptions; - OnClick := @ButtonTestClicked; + OnClick := @ButtonShowOptionsClicked; end; end; @@ -4633,10 +4620,10 @@ begin SetBounds(0,0,Parent.ClientWidth,Parent.ClientHeight-45); x:=Width - 10; - y:=Height - btnApply.Height - 15; - with btnApply do + y:=Height - btnCheck.Height - 15; + with btnCheck do SetBounds(x-70,y,70,Height); - dec(x,btnApply.Width+10); + dec(x,btnCheck.Width+10); with btnCancel do SetBounds(x-70,y,70,Height); @@ -4646,7 +4633,7 @@ begin SetBounds(x-70,y,70,Height); dec(x,btnOk.Width+10); - with btnTest do + with btnShowOptions do SetBounds(x-120,y,120,Height); end; @@ -4655,7 +4642,7 @@ begin if FReadOnly=AValue then exit; FReadOnly:=AValue; btnOk.Enabled:=not FReadOnly; - btnApply.Enabled:=not FReadOnly; + btnCheck.Enabled:=not FReadOnly; end; diff --git a/ide/showcompileropts.lfm b/ide/showcompileropts.lfm new file mode 100644 index 0000000000..117aa31cf4 --- /dev/null +++ b/ide/showcompileropts.lfm @@ -0,0 +1,44 @@ +object ShowCompilerOptionsDlg: TShowCompilerOptionsDlg + CAPTION = 'Compiler Options' + CLIENTHEIGHT = 203 + CLIENTWIDTH = 393 + HORZSCROLLBAR.PAGE = 394 + VERTSCROLLBAR.PAGE = 204 + LEFT = 358 + HEIGHT = 203 + TOP = 337 + WIDTH = 393 + object OkButton: TBUTTON + ANCHORS = [akbottom] + CAPTION = 'Ok' + TABSTOP = True + TABORDER = 0 + ONCLICK = OkButtonCLICK + LEFT = 159 + HEIGHT = 25 + TOP = 168 + WIDTH = 75 + end + object CmdLineGroupbox: TGROUPBOX + ALIGN = altop + ANCHORS = [aktop, akleft, akbottom] + CAPTION = 'Command line parameters' + CLIENTHEIGHT = 144 + CLIENTWIDTH = 389 + PARENTCTL3D = False + TABORDER = 1 + HEIGHT = 161 + WIDTH = 393 + object CmdLineMemo: TMEMO + ALIGN = alclient + LINES.Strings = ( + 'CmdLineMemo' + ) + TABSTOP = True + TABSTOP = True + TABORDER = 0 + HEIGHT = 144 + WIDTH = 389 + end + end +end diff --git a/ide/showcompileropts.lrs b/ide/showcompileropts.lrs new file mode 100644 index 0000000000..23e037c31c --- /dev/null +++ b/ide/showcompileropts.lrs @@ -0,0 +1,16 @@ +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TShowCompilerOptionsDlg','FORMDATA',[ + 'TPF0'#23'TShowCompilerOptionsDlg'#22'ShowCompilerOptionsDlg'#7'CAPTION'#6#16 + +'Compiler Options'#12'CLIENTHEIGHT'#3#203#0#11'CLIENTWIDTH'#3#137#1#18'HORZS' + +'CROLLBAR.PAGE'#3#138#1#18'VERTSCROLLBAR.PAGE'#3#204#0#4'LEFT'#3'f'#1#6'HEIG' + +'HT'#3#203#0#3'TOP'#3'Q'#1#5'WIDTH'#3#137#1#0#7'TBUTTON'#8'OkButton'#7'ANCHO' + +'RS'#11#8'akbottom'#0#7'CAPTION'#6#2'Ok'#7'TABSTOP'#9#8'TABORDER'#2#0#7'ONCL' + +'ICK'#7#13'OkButtonCLICK'#4'LEFT'#3#159#0#6'HEIGHT'#2#25#3'TOP'#3#168#0#5'WI' + +'DTH'#2'K'#0#0#9'TGROUPBOX'#15'CmdLineGroupbox'#5'ALIGN'#7#5'altop'#7'ANCHOR' + +'S'#11#5'aktop'#6'akleft'#8'akbottom'#0#7'CAPTION'#6#23'Command line paramet' + +'ers'#12'CLIENTHEIGHT'#3#144#0#11'CLIENTWIDTH'#3#133#1#11'PARENTCTL3D'#8#8'T' + +'ABORDER'#2#1#6'HEIGHT'#3#161#0#5'WIDTH'#3#137#1#0#5'TMEMO'#11'CmdLineMemo'#5 + +'ALIGN'#7#8'alclient'#13'LINES.Strings'#1#6#11'CmdLineMemo'#0#7'TABSTOP'#9#7 + +'TABSTOP'#9#8'TABORDER'#2#0#6'HEIGHT'#3#144#0#5'WIDTH'#3#133#1#0#0#0#0 +]); diff --git a/ide/showcompileropts.pas b/ide/showcompileropts.pas new file mode 100644 index 0000000000..a9ecb372f1 --- /dev/null +++ b/ide/showcompileropts.pas @@ -0,0 +1,79 @@ +{ /*************************************************************************** + showcompileropts.pas - Lazarus IDE unit + ----------------------------------------- + + ***************************************************************************/ + + *************************************************************************** + * * + * This source is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This code is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * General Public License for more details. * + * * + * A copy of the GNU General Public License is available on the World * + * Wide Web at . You can also * + * obtain it by writing to the Free Software Foundation, * + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + *************************************************************************** + + Author: Mattias Gaertner + + Abstract: + Dialog for showing the compiler options as command line parameters. +} +unit ShowCompilerOpts; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Buttons, + StdCtrls; + +type + TShowCompilerOptionsDlg = class(TForm) + OkButton: TBUTTON; + CmdLineGroupbox: TGROUPBOX; + CmdLineMemo: TMEMO; + procedure OkButtonCLICK(Sender: TObject); + private + public + end; + +function ShowCompilerOptionsDialog(const CmdLine: string): TModalResult; + +implementation + +function ShowCompilerOptionsDialog(const CmdLine: string): TModalResult; +var + ShowCompilerOptionsDlg: TShowCompilerOptionsDlg; +begin + Result:=mrOk; + ShowCompilerOptionsDlg:=TShowCompilerOptionsDlg.Create(Application); + with ShowCompilerOptionsDlg do begin + CmdLineMemo.Lines.Text:=CmdLine; + ShowModal; + Free; + end; +end; + +{ TShowCompilerOptionsDlg } + +procedure TShowCompilerOptionsDlg.OkButtonCLICK(Sender: TObject); +begin + ModalResult:=mrOk; +end; + +initialization + {$I showcompileropts.lrs} + +end. +