ide: add compiler other options frame

git-svn-id: trunk@23339 -
This commit is contained in:
paul 2010-01-02 08:00:15 +00:00
parent eb4f300ff2
commit 658f3137f0
6 changed files with 228 additions and 1 deletions

3
.gitattributes vendored
View File

@ -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

View File

@ -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

View File

@ -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
]);

View File

@ -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.

View File

@ -43,7 +43,7 @@
<PackageName Value="SynEdit"/>
</Item4>
</RequiredPackages>
<Units Count="65">
<Units Count="66">
<Unit0>
<Filename Value="lazarus.pp"/>
<IsPartOfProject Value="True"/>
@ -491,6 +491,13 @@
<ResourceBaseClass Value="Frame"/>
<UnitName Value="compiler_verbosity_options"/>
</Unit64>
<Unit65>
<Filename Value="frames/compiler_other_options.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="CompilerOtherOptionsFrame"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="compiler_other_options"/>
</Unit65>
</Units>
</ProjectOptions>
<CompilerOptions>

View File

@ -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,