From fbbd9447baa082175555114fd1a51740480520cc Mon Sep 17 00:00:00 2001 From: mattias Date: Wed, 15 Dec 2010 13:00:17 +0000 Subject: [PATCH] IDE: added project compiler option: apply target file conventions, bug #17847 git-svn-id: trunk@28721 - --- ide/compileroptions.pp | 10 +++- ide/frames/compiler_path_options.lfm | 87 ++++++++++++++++------------ ide/frames/compiler_path_options.pas | 7 ++- ide/lazarusidestrconsts.pas | 1 + ideintf/projectintf.pas | 12 ++++ 5 files changed, 76 insertions(+), 41 deletions(-) diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index 91941c1d93..240806f2cb 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -1359,6 +1359,7 @@ begin { Target } p:=Path+'Target/'; TargetFilename := f(aXMLConfig.GetValue(p+'Filename/Value', '')); + TargetFilenameAppplyConventions := aXMLConfig.GetValue(p+'Filename/ApplyConventions', true); { SearchPaths } p:=Path+'SearchPaths/'; @@ -1569,6 +1570,7 @@ begin { Target } p:=Path+'Target/'; aXMLConfig.SetDeleteValue(p+'Filename/Value', f(TargetFilename),''); + aXMLConfig.SetDeleteValue(p+'Filename/ApplyConventions', TargetFilenameAppplyConventions,true); { SearchPaths } p:=Path+'SearchPaths/'; @@ -1803,8 +1805,10 @@ begin Result:=CreateAbsolutePath(OutFilename,UnitOutDir); end; Result:=TrimFilename(Result); - AppendDefaultExt; - PrependDefaultType; + if TargetFilenameAppplyConventions then begin + AppendDefaultExt; + PrependDefaultType; + end; end; function TBaseCompilerOptions.GetTargetFileExt: string; @@ -2986,6 +2990,7 @@ begin // Target TargetFilename := CompOpts.TargetFilename; + TargetFilenameAppplyConventions := CompOpts.TargetFilenameAppplyConventions; // Search Paths StorePathDelim := CompOpts.StorePathDelim; @@ -3129,6 +3134,7 @@ begin // target if Done(Tool.AddDiff('TargetFilename',fTargetFilename,CompOpts.fTargetFilename)) then exit; + if Done(Tool.AddDiff('TargetFilenameAppplyConventions',FTargetFilenameAppplyConventions,CompOpts.FTargetFilenameAppplyConventions)) then exit; // search paths if Tool<>nil then Tool.Path:='Paths'; diff --git a/ide/frames/compiler_path_options.lfm b/ide/frames/compiler_path_options.lfm index 924c6916d8..defb188e4a 100644 --- a/ide/frames/compiler_path_options.lfm +++ b/ide/frames/compiler_path_options.lfm @@ -12,7 +12,7 @@ inherited CompilerPathOptionsFrame: TCompilerPathOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 0 - Height = 14 + Height = 18 Top = 0 Width = 509 Anchors = [akTop, akLeft, akRight] @@ -26,8 +26,8 @@ inherited CompilerPathOptionsFrame: TCompilerPathOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 0 - Height = 14 - Top = 41 + Height = 18 + Top = 51 Width = 509 Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 6 @@ -41,8 +41,8 @@ inherited CompilerPathOptionsFrame: TCompilerPathOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 0 - Height = 14 - Top = 205 + Height = 18 + Top = 255 Width = 509 Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 6 @@ -56,8 +56,8 @@ inherited CompilerPathOptionsFrame: TCompilerPathOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 0 - Height = 14 - Top = 82 + Height = 18 + Top = 102 Width = 509 Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 6 @@ -71,8 +71,8 @@ inherited CompilerPathOptionsFrame: TCompilerPathOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 0 - Height = 14 - Top = 123 + Height = 18 + Top = 153 Width = 509 Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 6 @@ -86,8 +86,8 @@ inherited CompilerPathOptionsFrame: TCompilerPathOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 0 - Height = 14 - Top = 246 + Height = 18 + Top = 306 Width = 509 Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 6 @@ -99,9 +99,9 @@ inherited CompilerPathOptionsFrame: TCompilerPathOptionsFrame AnchorSideTop.Control = LCLWidgetTypeComboBox AnchorSideTop.Side = asrCenter Left = 0 - Height = 14 - Top = 290 - Width = 101 + Height = 18 + Top = 363 + Width = 134 Caption = 'LCLWidgetTypeLabel' ParentColor = False end @@ -112,8 +112,8 @@ inherited CompilerPathOptionsFrame: TCompilerPathOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 0 - Height = 21 - Top = 14 + Height = 27 + Top = 18 Width = 509 Anchors = [akTop, akLeft, akRight] BorderSpacing.Bottom = 6 @@ -127,8 +127,8 @@ inherited CompilerPathOptionsFrame: TCompilerPathOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 0 - Height = 21 - Top = 55 + Height = 27 + Top = 69 Width = 509 Anchors = [akTop, akLeft, akRight] BorderSpacing.Bottom = 6 @@ -142,8 +142,8 @@ inherited CompilerPathOptionsFrame: TCompilerPathOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 0 - Height = 21 - Top = 219 + Height = 27 + Top = 273 Width = 509 Anchors = [akTop, akLeft, akRight] BorderSpacing.Bottom = 6 @@ -157,8 +157,8 @@ inherited CompilerPathOptionsFrame: TCompilerPathOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 0 - Height = 21 - Top = 96 + Height = 27 + Top = 120 Width = 509 Anchors = [akTop, akLeft, akRight] BorderSpacing.Bottom = 6 @@ -172,8 +172,8 @@ inherited CompilerPathOptionsFrame: TCompilerPathOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 0 - Height = 21 - Top = 137 + Height = 27 + Top = 171 Width = 509 Anchors = [akTop, akLeft, akRight] BorderSpacing.Bottom = 6 @@ -187,8 +187,8 @@ inherited CompilerPathOptionsFrame: TCompilerPathOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 0 - Height = 21 - Top = 260 + Height = 27 + Top = 324 Width = 509 Anchors = [akTop, akLeft, akRight] BorderSpacing.Bottom = 6 @@ -200,13 +200,13 @@ inherited CompilerPathOptionsFrame: TCompilerPathOptionsFrame AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = DebugPathEdit AnchorSideTop.Side = asrBottom - Left = 107 - Height = 21 - Top = 287 + Left = 140 + Height = 31 + Top = 357 Width = 171 BorderSpacing.Left = 6 BorderSpacing.Top = 6 - ItemHeight = 13 + ItemHeight = 0 Style = csDropDownList TabOrder = 7 end @@ -214,13 +214,10 @@ inherited CompilerPathOptionsFrame: TCompilerPathOptionsFrame AnchorSideLeft.Control = Owner AnchorSideTop.Control = UnitOutputDirEdit AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom Left = 0 - Height = 14 - Top = 164 - Width = 509 - Anchors = [akTop, akLeft, akRight] + Height = 18 + Top = 204 + Width = 124 Caption = 'ProjTargetFileLabel' ParentColor = False end @@ -231,8 +228,8 @@ inherited CompilerPathOptionsFrame: TCompilerPathOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 0 - Height = 21 - Top = 178 + Height = 27 + Top = 222 Width = 509 Anchors = [akTop, akLeft, akRight] BorderSpacing.Bottom = 6 @@ -240,4 +237,18 @@ inherited CompilerPathOptionsFrame: TCompilerPathOptionsFrame TabOrder = 4 Text = 'ProjTargetFileEdit' end + object ProjTargetApplyConventionsCheckBox: TCheckBox[16] + AnchorSideLeft.Control = ProjTargetFileLabel + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = ProjTargetFileLabel + AnchorSideTop.Side = asrCenter + AnchorSideRight.Side = asrBottom + Left = 130 + Height = 22 + Top = 202 + Width = 272 + BorderSpacing.Left = 6 + Caption = 'ProjTargetApplyConventionsCheckBox' + TabOrder = 8 + end end diff --git a/ide/frames/compiler_path_options.pas b/ide/frames/compiler_path_options.pas index aa3ee886e4..28f669659e 100644 --- a/ide/frames/compiler_path_options.pas +++ b/ide/frames/compiler_path_options.pas @@ -28,6 +28,7 @@ type OtherSourcesLabel: TLabel; OtherUnitsEdit: TEdit; OtherUnitsLabel: TLabel; + ProjTargetApplyConventionsCheckBox: TCheckBox; ProjTargetFileEdit: TEdit; ProjTargetFileLabel: TLabel; UnitOutputDirEdit: TEdit; @@ -558,6 +559,7 @@ var s: string; begin ProjTargetFileEdit.Text:=''; + ProjTargetApplyConventionsCheckBox.Caption:=lisApplyConventions; OtherUnitsLabel.Caption := dlgOtherUnitFiles; OtherUnitsPathEditBtn := TPathEditorButton.Create(Self); @@ -729,6 +731,7 @@ begin ProjTargetFileEdit.Visible:=true; ProjTargetFileLabel.Visible:=true; ProjTargetFileEdit.Text:=TProjectCompilerOptions(AOptions).TargetFilename; + ProjTargetApplyConventionsCheckBox.Checked:=TProjectCompilerOptions(AOptions).TargetFilenameAppplyConventions; UpdateTargetFileLabel; end else begin ProjTargetFileEdit.Visible:=false; @@ -757,8 +760,10 @@ procedure TCompilerPathOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions) var i: integer; begin - if AOptions is TProjectCompilerOptions then + if AOptions is TProjectCompilerOptions then begin TProjectCompilerOptions(AOptions).TargetFilename:=ProjTargetFileEdit.Text; + TProjectCompilerOptions(AOptions).TargetFilenameAppplyConventions:=ProjTargetApplyConventionsCheckBox.Checked; + end; with AOptions as TBaseCompilerOptions do begin diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 373f9ce3b8..9fb965bb3e 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -5089,6 +5089,7 @@ resourcestring //Disassembler dialog lisDisAssAssembler = 'Assembler'; + lisApplyConventions = 'Apply conventions'; implementation diff --git a/ideintf/projectintf.pas b/ideintf/projectintf.pas index 1b6d1e70d6..e3a6c6ce7b 100644 --- a/ideintf/projectintf.pas +++ b/ideintf/projectintf.pas @@ -171,6 +171,7 @@ type procedure SetStopAfterErrCount(const AValue: integer); procedure SetStripSymbols(const AValue: Boolean); procedure SetSyntaxMode(const AValue: string); + procedure SetTargetFilenameAppplyConventions(const AValue: boolean); procedure SetUncertainOpt(const AValue: Boolean); procedure SetUseAnsiStr(const AValue: Boolean); procedure SetUseExternalDbgSyms(const AValue: Boolean); @@ -240,6 +241,7 @@ type FExecutableType: TCompilationExecutableType; FUseExternalDbgSyms : Boolean; fTargetFilename: string; + FTargetFilenameAppplyConventions: boolean; // Messages: fShowErrors: Boolean; @@ -327,6 +329,7 @@ type // target: property TargetFilename: String read fTargetFilename write SetTargetFilename; + property TargetFilenameAppplyConventions: boolean read FTargetFilenameAppplyConventions write SetTargetFilenameAppplyConventions; // parsing: property SyntaxMode: string read FSyntaxMode write SetSyntaxMode; @@ -1751,6 +1754,14 @@ begin IncreaseChangeStamp; end; +procedure TLazCompilerOptions.SetTargetFilenameAppplyConventions( + const AValue: boolean); +begin + if FTargetFilenameAppplyConventions=AValue then exit; + FTargetFilenameAppplyConventions:=AValue; + IncreaseChangeStamp; +end; + procedure TLazCompilerOptions.SetUncertainOpt(const AValue: Boolean); begin if fUncertainOpt=AValue then exit; @@ -1833,6 +1844,7 @@ begin fOnChanged:=TMethodList.Create; FChangeStamp:=InvalidChangeStamp; FSavedChangeStamp:=FChangeStamp; + FTargetFilenameAppplyConventions:=true; FOwner := TheOwner; end;