From 658f3137f0642743dba093a213a0651ea6324ade Mon Sep 17 00:00:00 2001 From: paul Date: Sat, 2 Jan 2010 08:00:15 +0000 Subject: [PATCH] ide: add compiler other options frame git-svn-id: trunk@23339 - --- .gitattributes | 3 + ide/frames/compiler_other_options.lfm | 71 +++++++++++++++ ide/frames/compiler_other_options.lrs | 23 +++++ ide/frames/compiler_other_options.pas | 122 ++++++++++++++++++++++++++ ide/lazarus.lpi | 9 +- ide/main.pp | 1 + 6 files changed, 228 insertions(+), 1 deletion(-) create mode 100644 ide/frames/compiler_other_options.lfm create mode 100644 ide/frames/compiler_other_options.lrs create mode 100644 ide/frames/compiler_other_options.pas diff --git a/.gitattributes b/.gitattributes index 7b239851a8..b9a2aa44ea 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3405,6 +3405,9 @@ ide/frames/compiler_linking_options.pas svneol=native#text/pascal ide/frames/compiler_messages_options.lfm svneol=native#text/plain ide/frames/compiler_messages_options.lrs svneol=native#text/plain ide/frames/compiler_messages_options.pas svneol=native#text/plain +ide/frames/compiler_other_options.lfm svneol=native#text/plain +ide/frames/compiler_other_options.lrs svneol=native#text/pascal +ide/frames/compiler_other_options.pas svneol=native#text/pascal ide/frames/compiler_parsing_options.lfm svneol=native#text/plain ide/frames/compiler_parsing_options.lrs svneol=native#text/plain ide/frames/compiler_parsing_options.pas svneol=native#text/plain diff --git a/ide/frames/compiler_other_options.lfm b/ide/frames/compiler_other_options.lfm new file mode 100644 index 0000000000..fa12cd0a07 --- /dev/null +++ b/ide/frames/compiler_other_options.lfm @@ -0,0 +1,71 @@ +inherited CompilerOtherOptionsFrame: TCompilerOtherOptionsFrame + Height = 486 + Width = 553 + ClientHeight = 486 + ClientWidth = 553 + DesignLeft = 434 + DesignTop = 276 + object grpConfigFile: TGroupBox[0] + Left = 0 + Height = 97 + Top = 0 + Width = 553 + Align = alTop + AutoSize = True + Caption = 'grpConfigFile' + ClientHeight = 79 + ClientWidth = 549 + TabOrder = 0 + object chkConfigFile: TCheckBox + Left = 6 + Height = 17 + Top = 6 + Width = 537 + Align = alTop + BorderSpacing.Around = 6 + Caption = 'chkConfigFile' + TabOrder = 0 + end + object chkCustomConfigFile: TCheckBox + Left = 6 + Height = 17 + Top = 29 + Width = 537 + Align = alTop + BorderSpacing.Around = 6 + Caption = 'chkCustomConfigFile' + TabOrder = 1 + end + object edtConfigPath: TEdit + Left = 6 + Height = 21 + Top = 52 + Width = 537 + Align = alTop + BorderSpacing.Around = 6 + TabOrder = 2 + Text = 'edtConfigPath' + end + end + object grpCustomOptions: TGroupBox[1] + Left = 0 + Height = 383 + Top = 103 + Width = 553 + Align = alClient + BorderSpacing.Top = 6 + Caption = 'grpCustomOptions' + ClientHeight = 365 + ClientWidth = 549 + TabOrder = 1 + object memCustomOptions: TMemo + Left = 6 + Height = 353 + Top = 6 + Width = 537 + Align = alClient + BorderSpacing.Around = 6 + TabOrder = 0 + end + end +end diff --git a/ide/frames/compiler_other_options.lrs b/ide/frames/compiler_other_options.lrs new file mode 100644 index 0000000000..ac03bb326e --- /dev/null +++ b/ide/frames/compiler_other_options.lrs @@ -0,0 +1,23 @@ +{ This is an automatically generated lazarus resource file } + +LazarusResources.Add('TCompilerOtherOptionsFrame','FORMDATA',[ + 'TPF0'#241#26'TCompilerOtherOptionsFrame'#25'CompilerOtherOptionsFrame'#6'Hei' + +'ght'#3#230#1#5'Width'#3')'#2#12'ClientHeight'#3#230#1#11'ClientWidth'#3')'#2 + +#10'DesignLeft'#3#178#1#9'DesignTop'#3#20#1#0#242#2#0#9'TGroupBox'#13'grpCon' + +'figFile'#4'Left'#2#0#6'Height'#2'a'#3'Top'#2#0#5'Width'#3')'#2#5'Align'#7#5 + +'alTop'#8'AutoSize'#9#7'Caption'#6#13'grpConfigFile'#12'ClientHeight'#2'O'#11 + +'ClientWidth'#3'%'#2#8'TabOrder'#2#0#0#9'TCheckBox'#13'chkConfigFile'#4'Left' + +#2#6#6'Height'#2#17#3'Top'#2#6#5'Width'#3#25#2#5'Align'#7#5'alTop'#20'Border' + +'Spacing.Around'#2#6#7'Caption'#6#13'chkConfigFile'#8'TabOrder'#2#0#0#0#9'TC' + +'heckBox'#19'chkCustomConfigFile'#4'Left'#2#6#6'Height'#2#17#3'Top'#2#29#5'W' + +'idth'#3#25#2#5'Align'#7#5'alTop'#20'BorderSpacing.Around'#2#6#7'Caption'#6 + +#19'chkCustomConfigFile'#8'TabOrder'#2#1#0#0#5'TEdit'#13'edtConfigPath'#4'Le' + +'ft'#2#6#6'Height'#2#21#3'Top'#2'4'#5'Width'#3#25#2#5'Align'#7#5'alTop'#20'B' + +'orderSpacing.Around'#2#6#8'TabOrder'#2#2#4'Text'#6#13'edtConfigPath'#0#0#0 + +#242#2#1#9'TGroupBox'#16'grpCustomOptions'#4'Left'#2#0#6'Height'#3#127#1#3'T' + +'op'#2'g'#5'Width'#3')'#2#5'Align'#7#8'alClient'#17'BorderSpacing.Top'#2#6#7 + +'Caption'#6#16'grpCustomOptions'#12'ClientHeight'#3'm'#1#11'ClientWidth'#3'%' + +#2#8'TabOrder'#2#1#0#5'TMemo'#16'memCustomOptions'#4'Left'#2#6#6'Height'#3'a' + +#1#3'Top'#2#6#5'Width'#3#25#2#5'Align'#7#8'alClient'#20'BorderSpacing.Around' + +#2#6#8'TabOrder'#2#0#0#0#0#0 +]); diff --git a/ide/frames/compiler_other_options.pas b/ide/frames/compiler_other_options.pas new file mode 100644 index 0000000000..af7e06f183 --- /dev/null +++ b/ide/frames/compiler_other_options.pas @@ -0,0 +1,122 @@ +unit compiler_other_options; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, + StdCtrls, LCLProc, IDEOptionsIntf, Project, CompilerOptions, LazarusIDEStrConsts; + +type + + { TCompilerOtherOptionsFrame } + + TCompilerOtherOptionsFrame = class(TAbstractIDEOptionsEditor) + chkConfigFile: TCheckBox; + chkCustomConfigFile: TCheckBox; + edtConfigPath: TEdit; + grpConfigFile: TGroupBox; + grpCustomOptions: TGroupBox; + memCustomOptions: TMemo; + private + FOptions: TProjectCompilerOptions; + public + function Check: Boolean; override; + function GetTitle: string; override; + procedure Setup(ADialog: TAbstractOptionsEditorDialog); override; + procedure ReadSettings(AOptions: TAbstractIDEOptions); override; + procedure WriteSettings(AOptions: TAbstractIDEOptions); override; + class function SupportedOptionsClass: TAbstractIDEOptionsClass; override; + end; + +implementation + +{ TCompilerOtherOptionsFrame } + +function TCompilerOtherOptionsFrame.Check: Boolean; +var + NewDontUseConfigFile: Boolean; + NewCustomConfigFile: Boolean; + NewConfigFilePath: String; + AdditionalConfig: String; +begin + NewDontUseConfigFile := not chkConfigFile.Checked; + NewCustomConfigFile := chkCustomConfigFile.Checked; + NewConfigFilePath := edtConfigPath.Text; + + if ((NewDontUseConfigFile <> FOptions.DontUseConfigFile) or + (NewCustomConfigFile <> FOptions.CustomConfigFile) or + (NewConfigFilePath <> FOptions.ConfigFilePath)) and (not NewDontUseConfigFile) and + NewCustomConfigFile then + begin + // config file options changed + // and both additional and standard config files are used + AdditionalConfig := ExtractFilename(edtConfigPath.Text); + if (CompareFileNames(AdditionalConfig, 'fpc.cfg') = 0) or + (CompareFileNames(AdditionalConfig, 'ppc386.cfg') = 0) then + begin + if MessageDlg(lisCOAmbiguousAdditionalCompilerConfigFile, + Format(lisCOClickOKIfAreSureToDoThat, + [BreakString(lisCOWarningTheAdditionalCompilerConfigFileHasTheSameNa, + 60, 0), #13#13]), mtWarning, [mbOK, mbCancel], 0) <> mrOk then + begin + Result := False; + exit; + end; + end; + end; + Result := True; +end; + +function TCompilerOtherOptionsFrame.GetTitle: string; +begin + Result := dlgCOOther; +end; + +procedure TCompilerOtherOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog); +begin + grpConfigFile.Caption := dlgConfigFiles; + chkConfigFile.Caption := dlgUseFpcCfg + ' (If not checked: -n)'; + chkCustomConfigFile.Caption := dlgUseCustomConfig + ' (@)'; + edtConfigPath.Text := ''; + + grpCustomOptions.Caption := lisCustomOptions2; +end; + +procedure TCompilerOtherOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); +begin + FOptions := AOptions as TProjectCompilerOptions; + with FOptions do + begin + chkConfigFile.Checked := not DontUseConfigFile; + chkCustomConfigFile.Checked := CustomConfigFile; + edtConfigPath.Enabled := chkCustomConfigFile.Checked; + edtConfigPath.Text := ConfigFilePath; + memCustomOptions.Text := CustomOptions; + end; +end; + +procedure TCompilerOtherOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions); +begin + with AOptions as TProjectCompilerOptions do + begin + DontUseConfigFile := not chkConfigFile.Checked; + CustomConfigFile := chkCustomConfigFile.Checked; + ConfigFilePath := edtConfigPath.Text; + CustomOptions := memCustomOptions.Text; + end; +end; + +class function TCompilerOtherOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass; +begin + Result := TProjectCompilerOptions; +end; + +initialization + {$I compiler_other_options.lrs} + RegisterIDEOptionsEditor(GroupCompiler, TCompilerOtherOptionsFrame, + CompilerOptionsOther); + +end. + diff --git a/ide/lazarus.lpi b/ide/lazarus.lpi index aeae5c1520..15e0ad7a3c 100644 --- a/ide/lazarus.lpi +++ b/ide/lazarus.lpi @@ -43,7 +43,7 @@ - + @@ -491,6 +491,13 @@ + + + + + + + diff --git a/ide/main.pp b/ide/main.pp index 87a2164e16..5d85d08bbd 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -128,6 +128,7 @@ uses // project compiler options compiler_path_options, compiler_parsing_options, compiler_codegen_options, compiler_linking_options, compiler_verbosity_options, compiler_messages_options, + compiler_other_options, PublishModule, EnvironmentOpts, TransferMacros, KeyMapping, IDETranslations, IDEProcs, ExtToolDialog, ExtToolEditDlg, OutputFilter, JumpHistoryView,