diff --git a/.gitattributes b/.gitattributes index c4fab9a88b..8b1f1c8fa0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -556,6 +556,7 @@ ide/codetoolsdefpreview.pas svneol=native#text/pascal ide/codetoolsoptions.pas svneol=native#text/pascal ide/compiler.pp svneol=native#text/pascal ide/compileroptions.pp svneol=native#text/pascal +ide/compileroptionsdlg.pp svneol=native#text/pascal ide/componentpalette.pas svneol=native#text/pascal ide/condef.lfm svneol=native#text/plain ide/condef.lrs svneol=native#text/pascal diff --git a/debugger/cmdlinedebugger.pp b/debugger/cmdlinedebugger.pp index e38b77e3b8..bd8d4f0a5f 100644 --- a/debugger/cmdlinedebugger.pp +++ b/debugger/cmdlinedebugger.pp @@ -263,7 +263,6 @@ end; destructor TCmdLineDebugger.Destroy; begin - FreeAndNil(FLineEnds); inherited; try FDbgProcess.Free; @@ -271,6 +270,7 @@ begin except on E: Exception do WriteLN('Exeption while freeing debugger: ', E.Message); end; + FreeAndNil(FLineEnds); end; procedure TCmdLineDebugger.Flush; @@ -435,6 +435,11 @@ initialization end. { ============================================================================= $Log$ + Revision 1.34 2004/09/04 21:54:08 marc + + Added option to skip compiler step on compile, build or run + * Fixed adding of runtime watches + * Fixed runnerror reporting (correct number and location is shown) + Revision 1.33 2004/03/13 00:01:53 marc * fixed debugtarget PID parsing (for win32) diff --git a/debugger/gdbmidebugger.pp b/debugger/gdbmidebugger.pp index 3d2e3c9ef7..9d012c36b4 100644 --- a/debugger/gdbmidebugger.pp +++ b/debugger/gdbmidebugger.pp @@ -85,6 +85,7 @@ type FCommandQueue: TStringList; FTargetPID: Integer; FBreakErrorBreakID: Integer; + FRunErrorBreakID: Integer; FExceptionBreakID: Integer; FVersion: String; FPauseWaitState: TGDBMIPauseWaitState; @@ -409,6 +410,7 @@ end; constructor TGDBMIDebugger.Create(const AExternalDebugger: String); begin FBreakErrorBreakID := -1; + FRunErrorBreakID := -1; FExceptionBreakID := -1; FCommandQueue := TStringList.Create; FTargetPID := 0; @@ -1230,11 +1232,15 @@ function TGDBMIDebugger.ProcessStopped(const AParams: String; const AIgnoreSigIn ErrorNo: Integer; Location: TDBGLocationRec; begin - ErrorNo := Integer(GetData('$fp+8', [])); + if tfRTLUsesRegCall in FTargetFlags + then ErrorNo := GetIntValue('$eax', []) + else ErrorNo := Integer(GetData('$fp+8', [])); Location.SrcLine := -1; Location.SrcFile := ''; - Location.Address := GetData('$fp+12', []); + if tfRTLUsesRegCall in FTargetFlags + then Location.Address := Pointer(GetIntValue('$edx', [])) + else Location.Address := GetData('$fp+12', []); Location.FuncName := ''; if ExecuteCommand('info line * pointer(%d)', [Integer(Location.Address)], S, [cfIgnoreError, cfNoMiCommand]) then begin @@ -1246,6 +1252,30 @@ function TGDBMIDebugger.ProcessStopped(const AParams: String; const AIgnoreSigIn DoCurrent(Location); end; + procedure ProcessRunError; + var + S: String; + ErrorNo: Integer; + List: TStrings; + begin + if tfRTLUsesRegCall in FTargetFlags + then ErrorNo := GetIntValue('$eax', []) + else ErrorNo := Integer(GetData('$fp+8', [])); + + DoException(Format('RunError(%d)', [ErrorNo]), ''); + + if ExecuteCommand('-stack-list-frames 1 1', [], S, [cfIgnoreError]) + then begin + List := CreateMIValueList(S); + S := List.Values['stack']; + FreeAndNil(List); + List := CreateMIValueList(S); + S := List.Values['frame']; + FreeAndNil(List); + ProcessFrame(S); + end; + end; + procedure ProcessSignalReceived(const AList: TStringList); var SigInt: Boolean; @@ -1322,6 +1352,13 @@ begin Exit; end; + if BreakID = FRunErrorBreakID + then begin + SetState(dsPause); + ProcessRunError; + Exit; + end; + if BreakID = FExceptionBreakID then begin SetState(dsPause); @@ -1444,11 +1481,27 @@ function TGDBMIDebugger.StartDebugging(const AContinueCommand: String): Boolean; // params are passes by stack Exclude(FTargetFlags, tfRTLUsesRegCall); end; + + function InsertBreakPoint(const AName: String): Integer; + var + S: String; + ResultList, BkptList: TStringList; + ResultState: TDBGState; + begin + ExecuteCommand('-break-insert %s', [AName], ResultState, S, [cfIgnoreError]); + if ResultState <> dsError + then begin + ResultList := CreateMIValueList(S); + BkptList := CreateMIValueList(ResultList.Values['bkpt']); + Result := StrToIntDef(BkptList.Values['number'], -1); + ResultList.Free; + BkptList.Free; + end; + end; var S, FileType, EntryPoint: String; ResultState: TDBGState; - ResultList, BkptList: TStringList; TargetPIDPart: String; TempInstalled: Boolean; begin @@ -1482,35 +1535,15 @@ begin TempInstalled := False; end; - // try to insert Exception breakpoint - // we might have rtl symbols - if FExceptionBreakID = -1 - then begin - ExecuteCommand('-break-insert FPC_RAISEEXCEPTION', [], ResultState, S, [cfIgnoreError]); - if ResultState <> dsError - then begin - ResultList := CreateMIValueList(S); - BkptList := CreateMIValueList(ResultList.Values['bkpt']); - FExceptionBreakID := StrToIntDef(BkptList.Values['number'], -1); - ResultList.Free; - BkptList.Free; - end; - end; - // try Insert Break breakpoint // we might have rtl symbols + if FExceptionBreakID = -1 + then FExceptionBreakID := InsertBreakPoint('FPC_RAISEEXCEPTION'); if FBreakErrorBreakID = -1 - then begin - ExecuteCommand('-break-insert FPC_BREAK_ERROR', [], ResultState, S, [cfIgnoreError]); - if ResultState <> dsError - then begin - ResultList := CreateMIValueList(S); - BkptList := CreateMIValueList(ResultList.Values['bkpt']); - FBreakErrorBreakID := StrToIntDef(BkptList.Values['number'], -1); - ResultList.Free; - BkptList.Free; - end; - end; + then FBreakErrorBreakID := InsertBreakPoint('FPC_BREAK_ERROR'); + if FRunErrorBreakID = -1 + then FRunErrorBreakID := InsertBreakPoint('FPC_RUNERROR'); + // try to retrieve the filetype and program entry point if ExecuteCommand('info file', [], ResultState, S, [cfIgnoreError, cfNoMICommand]) @@ -2250,6 +2283,11 @@ initialization end. { ============================================================================= $Log$ + Revision 1.49 2004/09/04 21:54:08 marc + + Added option to skip compiler step on compile, build or run + * Fixed adding of runtime watches + * Fixed runnerror reporting (correct number and location is shown) + Revision 1.48 2004/08/26 23:50:05 marc * Restructured debugger view classes * Fixed help diff --git a/ide/basedebugmanager.pas b/ide/basedebugmanager.pas index 01c6af2d96..3f50f82a21 100644 --- a/ide/basedebugmanager.pas +++ b/ide/basedebugmanager.pas @@ -81,7 +81,8 @@ type procedure DoRestoreDebuggerMarks(AnUnitInfo: TUnitInfo); virtual; abstract; - function DoInitDebugger: TModalResult; virtual; abstract; + function InitDebugger: Boolean; virtual; abstract; + function DoPauseProject: TModalResult; virtual; abstract; function DoStepIntoProject: TModalResult; virtual; abstract; function DoStepOverProject: TModalResult; virtual; abstract; @@ -169,6 +170,11 @@ end. { ============================================================================= $Log$ + Revision 1.21 2004/09/04 21:54:08 marc + + Added option to skip compiler step on compile, build or run + * Fixed adding of runtime watches + * Fixed runnerror reporting (correct number and location is shown) + Revision 1.20 2004/08/26 23:50:04 marc * Restructured debugger view classes * Fixed help diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index 2238af3d5a..3566494f1c 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -1,7 +1,7 @@ { /*************************************************************************** compileroptions.pp - Lazarus IDE unit --------------------------------------- - Compiler options form sets the switches for the project + Compiler options sets the switches for the project file for the FPC compiler. @@ -41,10 +41,10 @@ unit CompilerOptions; interface uses - Forms, Classes, SysUtils, ComCtrls, Buttons, StdCtrls, ExtCtrls, Graphics, - LResources, Laz_XMLCfg, FileCtrl, Dialogs, Controls, - PathEditorDlg, IDEProcs, LazConf, IDEOptionDefs, LazarusIDEStrConsts, - TransferMacros, ShowCompilerOpts; + Classes, SysUtils, FileCtrl, + Laz_XMLCfg, + IDEProcs, LazConf, + TransferMacros; type @@ -146,18 +146,25 @@ type ); TCompilerCmdLineOptions = set of TCompilerCmdLineOption; + TCompileReason = (crCompile, crBuild, crRun); + TCompileReasons = set of TCompileReason; +const + crAll = [crCompile, crBuild, crRun]; + +type + TCompilationToolClass = class of TCompilationTool; TCompilationTool = class public Command: string; ScanForFPCMessages: boolean; ScanForMakeMessages: boolean; ShowAllMessages: boolean; - procedure Clear; - function IsEqual(Params: TCompilationTool): boolean; - procedure Assign(Src: TCompilationTool); + procedure Clear; virtual; + function IsEqual(Params: TCompilationTool): boolean; virtual; + procedure Assign(Src: TCompilationTool); virtual; procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string; - DoSwitchPathDelims: boolean); - procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string); + DoSwitchPathDelims: boolean); virtual; + procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string); virtual; end; TCompilationGenerateCode = ( @@ -166,6 +173,7 @@ type cgcSmallerCode ); + TBaseCompilerOptionsClass = class of TBaseCompilerOptions; TBaseCompilerOptions = class private FBaseDirectory: string; @@ -182,7 +190,7 @@ type fTargetFilename: string; FWin32GraphicApp: boolean; fXMLFile: String; - xmlconfig: TXMLConfig; + FXMLConfig: TXMLConfig; // Paths: fIncludeFiles: String; @@ -268,7 +276,6 @@ type // Compilation fCompilerPath: String; - fSkipCompiler: boolean; fExecuteBefore: TCompilationTool; fExecuteAfter: TCompilationTool; @@ -294,7 +301,8 @@ type procedure ClearInheritedOptions; procedure SetDefaultMakeOptionsFlags(const AValue: TCompilerCmdLineOptions); public - constructor Create(TheOwner: TObject); + constructor Create(const AOwner: TObject); virtual; + constructor Create(const AOwner: TObject; const AToolClass: TCompilationToolClass); destructor Destroy; override; procedure Clear; virtual; @@ -343,7 +351,7 @@ type read FDefaultMakeOptionsFlags write SetDefaultMakeOptionsFlags; property XMLFile: String read fXMLFile write fXMLFile; - property XMLConfigFile: TXMLConfig read xmlconfig write xmlconfig; + property XMLConfigFile: TXMLConfig read FXMLConfig write FXMLConfig; property Loaded: Boolean read fLoaded write fLoaded; // search paths: @@ -437,7 +445,6 @@ type // compilation property CompilerPath: String read fCompilerPath write SetCompilerPath; - property SkipCompiler: boolean read fSkipCompiler write fSkipCompiler; property ExecuteBefore: TCompilationTool read fExecuteBefore; property ExecuteAfter: TCompilationTool read fExecuteAfter; end; @@ -489,242 +496,15 @@ type end; - { TCompilerOptions } +// { TCompilerOptions } - TCompilerOptions = class(TBaseCompilerOptions) - public - procedure Clear; override; - end; + TCompilerOptions = TBaseCompilerOptions; +// TCompilerOptions = class(TBaseCompilerOptions) +// public +// procedure Clear; override; +// end; - { Compiler options form } - - TfrmCompilerOptions = class(TForm) - nbMain: TNotebook; - ImageList: TImageList; - - { Search Paths Controls } - PathPage: TPage; - grpOtherUnits: TGroupBox; - edtOtherUnits: TEdit; - OtherUnitsPathEditBtn: TPathEditorButton; - - grpIncludeFiles: TGroupBox; - edtIncludeFiles: TEdit; - IncludeFilesPathEditBtn: TPathEditorButton; - - grpOtherSources: TGroupBox; - edtOtherSources: TEdit; - OtherSourcesPathEditBtn: TPathEditorButton; - - grpLibraries: TGroupBox; - edtLibraries: TEdit; - LibrariesPathEditBtn: TPathEditorButton; - - grpUnitOutputDir: TGroupBox; - edtUnitOutputDir: TEdit; - btnUnitOutputDir: TButton; - - grpDebugPath: TGroupBox; - edtDebugPath: TEdit; - DebugPathEditBtn: TPathEditorButton; - - LCLWidgetTypeRadioGroup: TRadioGroup; - - { Parsing Controls } - ParsingPage: TPage; - grpStyle: TRadioGroup; - - grpSymantecChk: TGroupBox; - chkSymD2Ext: TCheckBox; - chkSymCOper: TCheckBox; - chkSymIncludeAssertions: TCheckBox; - chkSymAllowLab: TCheckBox; - chkSymUseAnsiStrings: TCheckBox; - chkSymCPPInline: TCheckBox; - chkSymCMacros: TCheckBox; - chkSymDelphiCompat: TCheckBox; - chkSymTP7Compat: TCheckBox; - chkSymGPCCompat: TCheckBox; - chkSymConstInit: TCheckBox; - chkSymStaticKwd: TCheckBox; - - { Code Generation Controls } - CodeGenPage: TPage; - grpUnitStyle: TRadioGroup; - - grpChecks: TGroupBox; - chkChecksIO: TCheckBox; - chkChecksRange: TCheckBox; - chkChecksOverflow: TCheckBox; - chkChecksStack: TCheckBox; - - grpHeapSize: TGroupBox; - edtHeapSize: TEdit; - - grpGenerate: TGroupBox; - radGenNormal: TRadioButton; - radGenFaster: TRadioButton; - radGenSmaller: TRadioButton; - - grpTargetProc: TRadioGroup; - - grpOptimizations: TGroupBox; - chkOptVarsInReg: TCheckBox; - chkOptUncertain: TCheckBox; - radOptLevelNone: TRadioButton; - radOptLevel1: TRadioButton; - radOptLevel2: TRadioButton; - radOptLevel3: TRadioButton; - - TargetOSGroupBox: TGroupBox; - TargetOSComboBox: TComboBox; - - { Linking Controls } - LinkingPage: TPage; - grpDebugging: TGroupBox; - chkDebugGDB: TCheckBox; - chkDebugDBX: TCheckBox; - chkUseLineInfoUnit: TCheckBox; - chkUseHeaptrc: TCheckBox; - chkUseValgrind: TCheckBox; - chkGenGProfCode: TCheckBox; - chkSymbolsStrip: TCheckBox; - - grpLinkLibraries: TGroupBox; - radLibsLinkDynamic: TRadioButton; - radLibsLinkStatic: TRadioButton; - radLibsLinkSmart: TRadioButton; - - grpOptions: TGroupBox; - chkOptionsLinkOpt: TCheckBox; - edtOptionsLinkOpt: TEdit; - TargetSpecificsGrpBox: TGroupBox; - chkWin32GraphicApp: TCheckBox; - - { Messages Controls } - MsgPage: TPage; - grpVerbosity: TGroupBox; - chkErrors: TCheckBox; - chkWarnings: TCheckBox; - chkNotes: TCheckBox; - chkHints: TCheckBox; - chkGeneralInfo: TCheckBox; - chkLineNumbers: TCheckBox; - chkEverything: TCheckBox; - chkAllProcsOnError: TCheckBox; - chkDebugInfo: TCheckBox; - chkUsedFiles: TCheckBox; - chkTriedFiles: TCheckBox; - chkDefinedMacros: TCheckBox; - chkCompiledProc: TCheckBox; - chkConditionals: TCheckBox; - chkNothing: TCheckBox; - chkHintsForUnusedUnitsInMainSrc: TCheckBox; - chkFPCLogo: TCheckBox; - - grpErrorCnt: TGroupBox; - edtErrorCnt: TEdit; - - { 'Other' Controls } - OtherPage: TPage; - grpConfigFile: TGroupBox; - chkConfigFile: TCheckBox; - chkAdditionalConfigFile: TCheckBox; - edtConfigPath: TEdit; - grpCustomOptions: TGroupBox; - memCustomOptions: TMemo; - - { Inherited Options } - InheritedPage: TPage; - InhNoteLabel: TLabel; - InhTreeView: TTreeView; - InhItemMemo: TMemo; - - { Compilation } - CompilationPage: TPage; - - ExecuteBeforeGroupBox: TGroupBox; - ExecuteBeforeCommandLabel: TLabel; - ExecuteBeforeCommandEdit: TEdit; - ExecuteBeforeScanFPCCheckBox: TCheckBox; - ExecuteBeforeScanMakeCheckBox: TCheckBox; - ExecuteBeforeShowAllCheckBox: TCheckBox; - - grpCompiler: TGroupBox; - edtCompiler: TEdit; - btnCompiler: TButton; - chkSkipCompiler: TCheckBox; - - ExecuteAfterGroupBox: TGroupBox; - ExecuteAfterCommandLabel: TLabel; - ExecuteAfterCommandEdit: TEdit; - ExecuteAfterScanFPCCheckBox: TCheckBox; - ExecuteAfterScanMakeCheckBox: TCheckBox; - ExecuteAfterShowAllCheckBox: TCheckBox; - - { Buttons } - btnShowOptions: TButton; - btnOK: TButton; - btnCancel: TButton; - btnCheck: TButton; - btnLoadSave: TButton; - - procedure ButtonOKClicked(Sender: TObject); - procedure ButtonCancelClicked(Sender: TObject); - procedure ButtonCheckClicked(Sender: TObject); - procedure ButtonLoadSaveClick(Sender: TObject); - procedure ButtonShowOptionsClicked(Sender: TObject); - procedure ExecuteAfterGroupBoxResize(Sender: TObject); - procedure ExecuteBeforeGroupBoxResize(Sender: TObject); - procedure FileBrowseBtnClick(Sender: TObject); - procedure InhTreeViewSelectionChanged(Sender: TObject); - procedure InheritedPageResize(Sender: TObject); - procedure chkAdditionalConfigFileClick(Sender: TObject); - procedure PathEditBtnClick(Sender: TObject); - procedure PathEditBtnExecuted(Sender: TObject); - procedure frmCompilerOptionsClose(Sender: TObject; - var CloseAction: TCloseAction); - procedure frmCompilerOptionsResize(Sender: TObject); - private - procedure SetupSearchPathsTab(Page: integer); - procedure SetupParsingTab(Page: integer); - procedure SetupCodeGenerationTab(Page: integer); - procedure SetupLinkingTab(Page: integer); - procedure SetupMessagesTab(Page: integer); - procedure SetupOtherTab(Page: integer); - procedure SetupInheritedTab(Page: integer); - procedure SetupCompilationTab(Page: integer); - procedure SetupButtonBar; - private - FOnImExportCompilerOptions: TNotifyEvent; - FOnTest: TNotifyEvent; - FReadOnly: boolean; - ImageIndexPackage: integer; - ImageIndexRequired: integer; - ImageIndexInherited: integer; - InheritedChildDatas: TList; // list of PInheritedNodeData - procedure SetReadOnly(const AValue: boolean); - procedure UpdateInheritedTab; - procedure ClearInheritedTree; - public - CompilerOpts: TBaseCompilerOptions; - - constructor Create(TheOwner: TComponent); override; - destructor Destroy; override; - - procedure GetCompilerOptions; - procedure GetCompilerOptions(SrcCompilerOptions: TBaseCompilerOptions); - procedure PutCompilerOptions; - procedure PutCompilerOptions(DestCompilerOptions: TBaseCompilerOptions); - public - property ReadOnly: boolean read FReadOnly write SetReadOnly; - property OnTest: TNotifyEvent read FOnTest write FOnTest; - property OnImExportCompilerOptions: TNotifyEvent - read FOnImExportCompilerOptions write FOnImExportCompilerOptions; - end; - - const CompilationGenerateCodeNames: array [TCompilationGenerateCode] of string = ( 'Normal', 'Faster', 'Smaller'); @@ -756,6 +536,9 @@ function ConvertOptionsToCmdLine(const Delim, Switch, OptionStr: string): string function CompilationGenerateCodeNameToType( const Name: string): TCompilationGenerateCode; +function LoadXMLCompileReasons(const AConfig: TXMLConfig; const APath: String): TCompileReasons; +procedure SaveXMLCompileReasons(const AConfig: TXMLConfig; const APath: String; const AFlags: TCompileReasons); + implementation const @@ -764,13 +547,6 @@ const MaxParseStamp = $7fffffff; MinParseStamp = -$7fffffff; InvalidParseStamp = MinParseStamp-1; - -type - TInheritedNodeData = record - FullText: string; - Option: TInheritedCompilerOption; - end; - PInheritedNodeData = ^TInheritedNodeData; procedure IncreaseCompilerParseStamp; begin @@ -980,6 +756,23 @@ begin Result:=cgcNormalCode; end; +function LoadXMLCompileReasons(const AConfig: TXMLConfig; const APath: String): TCompileReasons; +begin + Result := []; + if AConfig.GetValue(APath+'Compile',false) + then Include(Result, crCompile); + if AConfig.GetValue(APath+'Build',false) + then Include(Result, crBuild); + if AConfig.GetValue(APath+'Run',false) + then Include(Result, crRun); +end; + +procedure SaveXMLCompileReasons(const AConfig: TXMLConfig; const APath: String; const AFlags: TCompileReasons); +begin + AConfig.SetDeleteValue(APath+'Compile', crCompile in AFlags, False); + AConfig.SetDeleteValue(APath+'Build', crBuild in AFlags, False); + AConfig.SetDeleteValue(APath+'Run', crRun in AFlags, False); +end; { TBaseCompilerOptions } @@ -987,16 +780,21 @@ end; {------------------------------------------------------------------------------ TBaseCompilerOptions Constructor ------------------------------------------------------------------------------} -constructor TBaseCompilerOptions.Create(TheOwner: TObject); +constructor TBaseCompilerOptions.Create(const AOwner: TObject; const AToolClass: TCompilationToolClass); begin inherited Create; - fOwner:=TheOwner; - FParsedOpts:=TParsedCompilerOptions.Create; - fExecuteBefore:=TCompilationTool.Create; - fExecuteAfter:=TCompilationTool.Create; + FOwner := AOwner; + FParsedOpts := TParsedCompilerOptions.Create; + FExecuteBefore := AToolClass.Create; + FExecuteAfter := AToolClass.Create; Clear; end; +constructor TBaseCompilerOptions.Create(const AOwner: TObject); +begin + Create(AOwner, TCompilationTool); +end; + {------------------------------------------------------------------------------ TBaseCompilerOptions Destructor ------------------------------------------------------------------------------} @@ -1215,7 +1013,9 @@ var CompilationGenerateCodeNames[cgcNormalCode])); end; end; - + +var + SkipCompiler: Boolean; // old compatebility begin { Load the compiler options from the XML file } p:=Path; @@ -1314,9 +1114,9 @@ begin { Compilation } CompilerPath := f(XMLConfigFile.GetValue(p+'CompilerPath/Value','$(CompPath)')); - fSkipCompiler := XMLConfigFile.GetValue(p+'SkipCompiler/Value',false); - ExecuteBefore.LoadFromXMLConfig(XMLConfig,p+'ExecuteBefore/',PathDelimChanged); - ExecuteAfter.LoadFromXMLConfig(XMLConfig,p+'ExecuteAfter/',PathDelimChanged); + + ExecuteBefore.LoadFromXMLConfig(XMLConfigFile,p+'ExecuteBefore/',PathDelimChanged); + ExecuteAfter.LoadFromXMLConfig(XMLConfigFile,p+'ExecuteAfter/',PathDelimChanged); end; {------------------------------------------------------------------------------} @@ -1451,9 +1251,8 @@ begin { Compilation } XMLConfigFile.SetDeleteValue(p+'CompilerPath/Value', CompilerPath,''); - XMLConfigFile.SetDeleteValue(p+'SkipCompiler/Value',fSkipCompiler,false); - ExecuteBefore.SaveToXMLConfig(XMLConfig,p+'ExecuteBefore/'); - ExecuteAfter.SaveToXMLConfig(XMLConfig,p+'ExecuteAfter/'); + ExecuteBefore.SaveToXMLConfig(XMLConfigFile,p+'ExecuteBefore/'); + ExecuteAfter.SaveToXMLConfig(XMLConfigFile,p+'ExecuteAfter/'); // write XMLConfigFile.Flush; @@ -2337,7 +2136,6 @@ begin // compilation CompilerPath := '$(CompPath)'; - SkipCompiler:=false; fExecuteBefore.Clear; fExecuteAfter.Clear; end; @@ -2430,7 +2228,6 @@ begin // compilation CompilerPath := CompOpts.fCompilerPath; - fSkipCompiler:= CompOpts.fSkipCompiler; ExecuteBefore.Assign(CompOpts.ExecuteBefore); ExecuteAfter.Assign(CompOpts.ExecuteAfter); end; @@ -2522,2310 +2319,12 @@ begin // compilation and (fCompilerPath = CompOpts.fCompilerPath) - and (fSkipCompiler = CompOpts.fSkipCompiler) and ExecuteBefore.IsEqual(CompOpts.ExecuteBefore) and ExecuteAfter.IsEqual(CompOpts.ExecuteAfter) ; end; -{------------------------------------------------------------------------------} -{ TfrmCompilerOptions Constructor } -{------------------------------------------------------------------------------} -constructor TfrmCompilerOptions.Create(TheOwner: TComponent); - procedure AddResImg(const ResName: string); - var Pixmap: TPixmap; - begin - Pixmap:=TPixmap.Create; - Pixmap.TransparentColor:=clWhite; - Pixmap.LoadFromLazarusResource(ResName); - ImageList.Add(Pixmap,nil) - end; - -var Page: integer; -begin - inherited Create(TheOwner); - Name:='CompilerOptionsDlg'; - Caption := dlgCompilerOptions; - - Position:=poScreenCenter; - IDEDialogLayoutList.ApplyLayout(Self,550,450); - - ImageList:=TImageList.Create(Self); - with ImageList do begin - Width:=17; - Height:=17; - Name:='ImageList'; - ImageIndexPackage:=Count; - AddResImg('pkg_package'); - ImageIndexRequired:=Count; - AddResImg('pkg_required'); - ImageIndexInherited:=Count; - AddResImg('pkg_inherited'); - end; - - nbMain := TNotebook.Create(Self); - nbMain.Parent := Self; - nbMain.Height := Height - 50; - nbMain.Width := Width - 4; - nbMain.Top := 0; - nbMain.Left := 0; - - // Add the pages - with nbMain.Pages do begin - Add(dlgSearchPaths); - Add(dlgCOParsing); - Add(dlgCodeGeneration); - Add(dlgCOLinking); - Add(dlgCOMessages); - Add(dlgCOOther); - Add(dlgCOInherited); - Add(dlgCOCompilation); - end; - nbMain.PageIndex:=0; - - Page:=0; - - { Search Paths Tab } - SetupSearchPathsTab(Page); - inc(Page); - - { Parsing Tab } - SetupParsingTab(Page); - inc(Page); - - { Code Generation Tab } - SetupCodeGenerationTab(Page); - inc(Page); - - { Linking Tab } - SetupLinkingTab(Page); - inc(Page); - - { Messages Tab } - SetupMessagesTab(Page); - inc(Page); - - { Other Tab } - SetupOtherTab(Page); - inc(Page); - - { Inherited Tab } - SetupInheritedTab(Page); - inc(Page); - - { Compilation Tab } - SetupCompilationTab(Page); - inc(Page); - - { Bottom Buttons } - SetupButtonBar; - - OnResize:=@frmCompilerOptionsResize; - OnResize(Self); - OnClose:=@frmCompilerOptionsClose; -end; - -{------------------------------------------------------------------------------} -{ TfrmCompilerOptions Destructor } -{------------------------------------------------------------------------------} -destructor TfrmCompilerOptions.Destroy; -begin - ClearInheritedTree; - inherited Destroy; -end; - -procedure TfrmCompilerOptions.GetCompilerOptions; -begin - GetCompilerOptions(nil); -end; - -{------------------------------------------------------------------------------} -{ TfrmCompilerOptions ButtonOKClicked } -{------------------------------------------------------------------------------} -procedure TfrmCompilerOptions.ButtonOKClicked(Sender: TObject); -begin - // Accept any changes - Assert(False, 'Trace:Accept compiler options changes'); - - { Save the options and hide the dialog } - PutCompilerOptions; - ModalResult:=mrOk; -end; - -{------------------------------------------------------------------------------} -{ TfrmCompilerOptions ButtonCancelClicked } -{------------------------------------------------------------------------------} -procedure TfrmCompilerOptions.ButtonCancelClicked(Sender: TObject); -begin - // Cancel any changes - Assert(False, 'Trace:Cancel compiler options changes'); - - ModalResult:=mrCancel; -end; - -{------------------------------------------------------------------------------ - TfrmCompilerOptions ButtonCheckClicked -------------------------------------------------------------------------------} -procedure TfrmCompilerOptions.ButtonCheckClicked(Sender: TObject); -begin - // Apply any changes and test - PutCompilerOptions; - if Assigned(OnTest) then OnTest(CompilerOpts); -end; - -{------------------------------------------------------------------------------ - 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.ButtonShowOptionsClicked(Sender: TObject); -var - CurOptions: String; -begin - // Test MakeOptionsString function - PutCompilerOptions; - CurOptions := CompilerOpts.MakeOptionsString(nil, - CompilerOpts.DefaultMakeOptionsFlags); - WriteLn('CompilerOpts.MakeOptionsString: ' + CurOptions); - ShowCompilerOptionsDialog(CurOptions); -end; - -procedure TfrmCompilerOptions.ExecuteAfterGroupBoxResize(Sender: TObject); -var - x: Integer; - y: Integer; - w: Integer; -begin - x:=5; - y:=2; - w:=ExecuteAfterGroupBox.ClientWidth-2*x; - - with ExecuteAfterCommandLabel do - SetBounds(x,y+3,90,Height); - - with ExecuteAfterCommandEdit do begin - SetBounds(x+90,y,w-x-90,Height); - inc(y,Height+5); - end; - - with ExecuteAfterScanFPCCheckBox do - SetBounds(x,y,w div 2,Height); - - with ExecuteAfterScanMakeCheckBox do begin - SetBounds(x+(w div 2),y,w div 2,Height); - inc(y,Height+5); - end; - - with ExecuteAfterShowAllCheckBox do - SetBounds(x,y,w div 2,Height); -end; - -procedure TfrmCompilerOptions.ExecuteBeforeGroupBoxResize(Sender: TObject); -var - x: Integer; - y: Integer; - w: Integer; -begin - x:=5; - y:=2; - w:=ExecuteBeforeGroupBox.ClientWidth-2*x; - - with ExecuteBeforeCommandLabel do - SetBounds(x,y+3,90,Height); - - with ExecuteBeforeCommandEdit do begin - SetBounds(x+90,y,w-x-90,Height); - inc(y,Height+5); - end; - - with ExecuteBeforeScanFPCCheckBox do - SetBounds(x,y,w div 2,Height); - - with ExecuteBeforeScanMakeCheckBox do begin - SetBounds(x+(w div 2),y,w div 2,Height); - inc(y,Height+5); - end; - - with ExecuteBeforeShowAllCheckBox do - SetBounds(x,y,w div 2,Height); -end; - -procedure TfrmCompilerOptions.FileBrowseBtnClick(Sender: TObject); -var - OpenDialog: TOpenDialog; - DefaultFilename: String; - NewFilename: String; -begin - OpenDialog:=TOpenDialog.Create(Self); - try - if Sender=btnCompiler then begin - OpenDialog.Title:=Format(lisBrowseForCompiler, [GetDefaultCompilerFilename - ]); - DefaultFilename:=FindDefaultCompilerPath; - OpenDialog.Options:=OpenDialog.Options+[ofFileMustExist]; - end else if Sender=btnUnitOutputDir then begin - OpenDialog.Title:=lisUnitOutputDirectory; - DefaultFilename:=''; - OpenDialog.Options:=OpenDialog.Options+[ofPathMustExist]; - end else - exit; - OpenDialog.Filename:=ExtractFilename(DefaultFilename); - if DefaultFilename<>'' then - OpenDialog.InitialDir:=ExtractFilePath(DefaultFilename); - if OpenDialog.Execute then begin - NewFilename:=TrimFilename(OpenDialog.Filename); - if CompilerOpts<>nil then - NewFilename:=CompilerOpts.ShortenPath(NewFilename,false); - if Sender=btnCompiler then begin - edtCompiler.Text:=OpenDialog.Filename; - end else if Sender=btnUnitOutputDir then begin - edtUnitOutputDir.Text:=OpenDialog.Filename; - end; - end; - finally - OpenDialog.Free; - end; -end; - -procedure TfrmCompilerOptions.InhTreeViewSelectionChanged(Sender: TObject); -var - ANode: TTreeNode; - ChildData: PInheritedNodeData; - sl: TStringList; -begin - ANode:=InhTreeView.Selected; - if (ANode=nil) or (ANode.Data=nil) then begin - InhItemMemo.Lines.Text:=lisSelectANode; - end else begin - ChildData:=PInheritedNodeData(ANode.Data); - if ChildData^.Option in icoAllSearchPaths then begin - sl:=SplitString(ChildData^.FullText,';'); - InhItemMemo.Lines.Assign(sl); - sl.Free; - end else - InhItemMemo.Lines.Text:=ChildData^.FullText; - end; -end; - -{------------------------------------------------------------------------------ - procedure TfrmCompilerOptions.InheritedPageResize(Sender: TObject); -------------------------------------------------------------------------------} -procedure TfrmCompilerOptions.InheritedPageResize(Sender: TObject); -var - y: Integer; -begin - InhNoteLabel.SetBounds(3,3,InheritedPage.ClientWidth-6,20); - InhTreeView.SetBounds(0,25, - InheritedPage.ClientWidth,InheritedPage.ClientHeight-100); - y:=InhTreeView.Top+InhTreeView.Height; - InhItemMemo.SetBounds(0,y, - InheritedPage.ClientWidth,InheritedPage.ClientHeight-y); -end; - -procedure TfrmCompilerOptions.ButtonLoadSaveClick(Sender: TObject); -begin - if Assigned(OnImExportCompilerOptions) then - OnImExportCompilerOptions(Self); -end; - -{------------------------------------------------------------------------------ - TfrmCompilerOptions GetCompilerOptions -------------------------------------------------------------------------------} -procedure TfrmCompilerOptions.GetCompilerOptions( - SrcCompilerOptions: TBaseCompilerOptions); -var - i: integer; - EnabledLinkerOpts: Boolean; - Options: TBaseCompilerOptions; -begin - if SrcCompilerOptions<>nil then - Options:=SrcCompilerOptions - else - Options:=CompilerOpts; - - EnabledLinkerOpts:=Options.NeedsLinkerOpts; - - { Get the compiler options and apply them to the dialog } - - // paths - edtOtherUnits.Text := Options.OtherUnitFiles; - edtIncludeFiles.Text := Options.IncludeFiles; - edtLibraries.Text := Options.Libraries; - grpLibraries.Enabled:=EnabledLinkerOpts; - edtOtherSources.Text := Options.SrcPath; - edtUnitOutputDir.Text := Options.UnitOutputDirectory; - edtDebugPath.Text := Options.DebugPath; - - i:=LCLWidgetTypeRadioGroup.Items.IndexOf(Options.LCLWidgetType); - if i<0 then i:=0; - LCLWidgetTypeRadioGroup.ItemIndex:=i; - i:=TargetOSComboBox.Items.IndexOf(Options.TargetOS); - if i<0 then i:=0; // 0 is default - TargetOSComboBox.ItemIndex:=i; - TargetOSComboBox.Text:=Options.TargetOS; - - // parsing - if (Options.AssemblerStyle in [1,2,3]) then - grpStyle.ItemIndex:=Options.AssemblerStyle - else - grpStyle.ItemIndex:=0; - - chkSymD2Ext.Checked := Options.D2Extensions; - chkSymCOper.Checked := Options.CStyleOperators; - chkSymIncludeAssertions.Checked := Options.IncludeAssertionCode; - chkSymAllowLab.Checked := Options.AllowLabel; - chkSymCPPInline.Checked := Options.CPPInline; - chkSymCMacros.Checked := Options.CStyleMacros; - chkSymTP7Compat.Checked := Options.TPCompatible; - chkSymConstInit.Checked := Options.InitConstructor; - chkSymStaticKwd.Checked := Options.StaticKeyword; - chkSymDelphiCompat.Checked := Options.DelphiCompat; - chkSymUseAnsiStrings.Checked := Options.UseAnsiStrings; - chkSymGPCCompat.Checked := Options.GPCCompat; - - // code generation - grpUnitStyle.ItemIndex:=Options.UnitStyle; - - chkChecksIO.Checked := Options.IOChecks; - chkChecksRange.Checked := Options.RangeChecks; - chkChecksOverflow.Checked := Options.OverflowChecks; - chkChecksStack.Checked := Options.StackChecks; - - grpHeapSize.Enabled:=EnabledLinkerOpts; - edtHeapSize.Text := IntToStr(Options.HeapSize); - - case Options.Generate of - cgcNormalCode: radGenNormal.Checked := true; - cgcFasterCode: radGenFaster.Checked := true; - cgcSmallerCode: radGenSmaller.Checked := true; - end; - - case Options.TargetProcessor of - 1..3: grpTargetProc.ItemIndex:=Options.TargetProcessor; - else - grpTargetProc.ItemIndex:=0; - end; - - chkOptVarsInReg.Checked := Options.VariablesInRegisters; - chkOptUncertain.Checked := Options.UncertainOptimizations; - - case Options.OptimizationLevel of - 1: radOptLevel1.Checked := true; - 2: radOptLevel2.Checked := true; - 3: radOptLevel3.Checked := true; - else - radOptLevelNone.Checked := true; - end; - - // linking - chkDebugGDB.Checked := Options.GenerateDebugInfo; - chkDebugDBX.Checked := Options.GenerateDebugDBX; - chkUseLineInfoUnit.Checked := Options.UseLineInfoUnit; - chkUseHeaptrc.Checked := Options.UseHeaptrc; - chkUseValgrind.Checked := Options.UseValgrind; - chkGenGProfCode.Checked := Options.GenGProfCode; - chkSymbolsStrip.Checked := Options.StripSymbols; - chkSymbolsStrip.Enabled:=EnabledLinkerOpts; - - case Options.LinkStyle of - 1: radLibsLinkDynamic.Checked := true; - 2: radLibsLinkStatic.Checked := true; - 3: radLibsLinkSmart.Checked := true; - end; - grpLinkLibraries.Enabled:=EnabledLinkerOpts; - - chkOptionsLinkOpt.Checked := Options.PassLinkerOptions; - edtOptionsLinkOpt.Text := Options.LinkerOptions; - chkWin32GraphicApp.Checked := Options.Win32GraphicApp; - chkWin32GraphicApp.Enabled:=EnabledLinkerOpts; - grpOptions.Enabled:=EnabledLinkerOpts; - - // messages - chkErrors.Checked := Options.ShowErrors; - chkWarnings.Checked := Options.ShowWarn; - chkNotes.Checked := Options.ShowNotes; - chkHints.Checked := Options.ShowHints; - chkGeneralInfo.Checked := Options.ShowGenInfo; - chkLineNumbers.Checked := Options.ShowLineNum; - chkEverything.Checked := Options.ShowAll; - chkAllProcsOnError.Checked := Options.ShowAllProcsOnError; - chkDebugInfo.Checked := Options.ShowDebugInfo; - chkUsedFiles.Checked := Options.ShowUsedFiles; - chkTriedFiles.Checked := Options.ShowTriedFiles; - chkDefinedMacros.Checked := Options.ShowDefMacros; - chkCompiledProc.Checked := Options.ShowCompProc; - chkConditionals.Checked := Options.ShowCond; - chkNothing.Checked := Options.ShowNothing; - chkHintsForUnusedUnitsInMainSrc.Checked := - Options.ShowHintsForUnusedUnitsInMainSrc; - - chkFPCLogo.Checked := Options.WriteFPCLogo; - - // other - chkConfigFile.Checked := not Options.DontUseConfigFile; - chkAdditionalConfigFile.Checked := Options.AdditionalConfigFile; - edtConfigPath.Enabled := chkAdditionalConfigFile.Checked; - edtConfigPath.Text := Options.ConfigFilePath; - memCustomOptions.Text := Options.CustomOptions; - - edtErrorCnt.Text := IntToStr(Options.StopAfterErrCount); - - // inherited tab - UpdateInheritedTab; - - // compilation - ExecuteBeforeCommandEdit.Text:=Options.ExecuteBefore.Command; - ExecuteBeforeScanFPCCheckBox.Checked:=Options.ExecuteBefore.ScanForFPCMessages; - ExecuteBeforeScanMakeCheckBox.Checked:= - Options.ExecuteBefore.ScanForMakeMessages; - ExecuteBeforeShowAllCheckBox.Checked:=Options.ExecuteBefore.ShowAllMessages; - edtCompiler.Text := Options.CompilerPath; - chkSkipCompiler.Checked := Options.SkipCompiler; - ExecuteAfterCommandEdit.Text:=Options.ExecuteAfter.Command; - ExecuteAfterScanFPCCheckBox.Checked:=Options.ExecuteAfter.ScanForFPCMessages; - ExecuteAfterScanMakeCheckBox.Checked:=Options.ExecuteAfter.ScanForMakeMessages; - ExecuteAfterShowAllCheckBox.Checked:=Options.ExecuteAfter.ShowAllMessages; -end; - -{------------------------------------------------------------------------------} -{ TfrmCompilerOptions PutCompilerOptions } -{------------------------------------------------------------------------------} -procedure TfrmCompilerOptions.PutCompilerOptions( - DestCompilerOptions: TBaseCompilerOptions); -var - code: LongInt; - hs: LongInt; - i: integer; - OldCompOpts: TBaseCompilerOptions; - NewTargetOS: String; - Options: TBaseCompilerOptions; -begin - { Put the compiler options into the TCompilerOptions class to be saved } - if DestCompilerOptions<>nil then - Options:=DestCompilerOptions - else - Options:=CompilerOpts; - if ReadOnly and (Options=CompilerOpts) then exit; - - OldCompOpts:=TBaseCompilerOptions.Create(nil); - OldCompOpts.Assign(Options); - - // paths - Options.IncludeFiles := edtIncludeFiles.Text; - Options.Libraries := edtLibraries.Text; - Options.OtherUnitFiles := edtOtherUnits.Text; - Options.SrcPath := edtOtherSources.Text; - Options.UnitOutputDirectory := edtUnitOutputDir.Text; - Options.DebugPath := edtDebugPath.Text; - - i:=LCLWidgetTypeRadioGroup.Itemindex; - if i<=0 then - Options.LCLWidgetType:='' - else - Options.LCLWidgetType:= LCLWidgetTypeRadioGroup.Items[i]; - - // parsing; - Options.AssemblerStyle := grpStyle.ItemIndex; - Options.D2Extensions := chkSymD2Ext.Checked; - Options.CStyleOperators := chkSymCOper.Checked; - Options.IncludeAssertionCode := chkSymIncludeAssertions.Checked; - Options.AllowLabel := chkSymAllowLab.Checked; - Options.CPPInline := chkSymCPPInline.Checked; - Options.CStyleMacros := chkSymCMacros.Checked; - Options.TPCompatible := chkSymTP7Compat.Checked; - Options.InitConstructor := chkSymConstInit.Checked; - Options.StaticKeyword := chkSymStaticKwd.Checked; - Options.DelphiCompat := chkSymDelphiCompat.Checked; - Options.UseAnsiStrings := chkSymUseAnsiStrings.Checked; - Options.GPCCompat := chkSymGPCCompat.Checked; - - // code generation - Options.UnitStyle := grpUnitStyle.ItemIndex; - - Options.IOChecks := chkChecksIO.Checked; - Options.RangeChecks := chkChecksRange.Checked; - Options.OverflowChecks := chkChecksOverflow.Checked; - Options.StackChecks := chkChecksStack.Checked; - - Val(edtHeapSize.Text, hs, code); - if (code <> 0) then - Options.HeapSize := 0 - else - Options.HeapSize := hs; - - if (radGenFaster.Checked) then - Options.Generate := cgcFasterCode - else if (radGenSmaller.Checked) then - Options.Generate := cgcSmallerCode - else - Options.Generate := cgcNormalCode; - - Options.TargetProcessor := grpTargetProc.ItemIndex; - - Options.VariablesInRegisters := chkOptVarsInReg.Checked; - Options.UncertainOptimizations := chkOptUncertain.Checked; - - if (radOptLevel1.Checked) then - Options.OptimizationLevel := 1 - else if (radOptLevel2.Checked) then - Options.OptimizationLevel := 2 - else if (radOptLevel3.Checked) then - Options.OptimizationLevel := 3 - else - Options.OptimizationLevel := 0; - - // linking - Options.GenerateDebugInfo := chkDebugGDB.Checked; - Options.GenerateDebugDBX := chkDebugDBX.Checked; - Options.UseLineInfoUnit := chkUseLineInfoUnit.Checked; - Options.UseHeaptrc := chkUseHeaptrc.Checked; - Options.UseValgrind := chkUseValgrind.Checked; - Options.GenGProfCode := chkGenGProfCode.Checked; - Options.StripSymbols := chkSymbolsStrip.Checked; - - Options.PassLinkerOptions := chkOptionsLinkOpt.Checked; - Options.LinkerOptions := edtOptionsLinkOpt.Text; - Options.Win32GraphicApp := chkWin32GraphicApp.Checked; - - if (radLibsLinkDynamic.Checked) then - Options.LinkStyle := 1 - else if (radLibsLinkStatic.Checked) then - Options.LinkStyle := 2 - else if (radLibsLinkSmart.Checked) then - Options.LinkStyle := 3 - else - Options.LinkStyle := 1; - - // messages - Options.ShowErrors := chkErrors.Checked; - Options.ShowWarn := chkWarnings.Checked; - Options.ShowNotes := chkNotes.Checked; - Options.ShowHints := chkHints.Checked; - Options.ShowGenInfo := chkGeneralInfo.Checked; - Options.ShowLineNum := chkLineNumbers.Checked; - Options.ShowAll := chkEverything.Checked; - Options.ShowAllProcsOnError := chkAllProcsOnError.Checked; - Options.ShowDebugInfo := chkDebugInfo.Checked; - Options.ShowUsedFiles := chkUsedFiles.Checked; - Options.ShowTriedFiles := chkTriedFiles.Checked; - Options.ShowDefMacros := chkDefinedMacros.Checked; - Options.ShowCompProc := chkCompiledProc.Checked; - Options.ShowCond := chkConditionals.Checked; - Options.ShowNothing := chkNothing.Checked; - Options.ShowHintsForUnusedUnitsInMainSrc := - chkHintsForUnusedUnitsInMainSrc.Checked; - - Options.WriteFPCLogo := chkFPCLogo.Checked; - - // other - Options.DontUseConfigFile := not chkConfigFile.Checked; - Options.AdditionalConfigFile := chkAdditionalConfigFile.Checked; - Options.ConfigFilePath := edtConfigPath.Text; - Options.CustomOptions := memCustomOptions.Text; - - Options.StopAfterErrCount := StrToIntDef(edtErrorCnt.Text,1); - - - NewTargetOS:=TargetOSComboBox.Text; - if TargetOSComboBox.Items.IndexOf(NewTargetOS)<=0 then - NewTargetOS:=''; - Options.TargetOS:=NewTargetOS; - - // compilation - Options.ExecuteBefore.Command := ExecuteBeforeCommandEdit.Text; - Options.ExecuteBefore.ScanForFPCMessages := - ExecuteBeforeScanFPCCheckBox.Checked; - Options.ExecuteBefore.ScanForMakeMessages := - ExecuteBeforeScanMakeCheckBox.Checked; - Options.ExecuteBefore.ShowAllMessages:=ExecuteBeforeShowAllCheckBox.Checked; - Options.CompilerPath := edtCompiler.Text; - Options.SkipCompiler := chkSkipCompiler.Checked; - Options.ExecuteAfter.Command := ExecuteAfterCommandEdit.Text; - Options.ExecuteAfter.ScanForFPCMessages := - ExecuteAfterScanFPCCheckBox.Checked; - Options.ExecuteAfter.ScanForMakeMessages := - ExecuteAfterScanMakeCheckBox.Checked; - Options.ExecuteAfter.ShowAllMessages:=ExecuteAfterShowAllCheckBox.Checked; - - - // check for change and save - if not OldCompOpts.IsEqual(Options) then - Options.Modified:=true; - OldCompOpts.Free; -end; - -procedure TfrmCompilerOptions.PutCompilerOptions; -begin - PutCompilerOptions(nil); -end; - -procedure TfrmCompilerOptions.UpdateInheritedTab; -var - OptionsList: TList; - i: Integer; - AncestorOptions: TAdditionalCompilerOptions; - AncestorNode: TTreeNode; - - procedure AddChildNode(const NewNodeName, Value: string; - Option: TInheritedCompilerOption); - var - VisibleValue: String; - ChildNode: TTreeNode; - ChildData: PInheritedNodeData; - begin - if Value='' then exit; - New(ChildData); - ChildData^.FullText:=Value; - ChildData^.Option:=Option; - if InheritedChildDatas=nil then InheritedChildDatas:=TList.Create; - InheritedChildDatas.Add(ChildData); - - if length(Value)>100 then - VisibleValue:=copy(Value,1,100)+'[...]' - else - VisibleValue:=Value; - ChildNode:=InhTreeView.Items.AddChildObject(AncestorNode, - NewNodeName+' = "'+VisibleValue+'"',ChildData); - ChildNode.ImageIndex:=ImageIndexRequired; - ChildNode.SelectedIndex:=ChildNode.ImageIndex; - end; - -begin - OptionsList:=nil; - CompilerOpts.GetInheritedCompilerOptions(OptionsList); - InhTreeView.BeginUpdate; - ClearInheritedTree; - if OptionsList<>nil then begin - // add All node - AncestorNode:=InhTreeView.Items.Add(nil,'All inherited options'); - AncestorNode.ImageIndex:=ImageIndexInherited; - AncestorNode.SelectedIndex:=AncestorNode.ImageIndex; - with CompilerOpts do begin - AddChildNode('unit path', - GetInheritedOption(icoUnitPath,true),icoUnitPath); - AddChildNode('include path', - GetInheritedOption(icoIncludePath,true),icoIncludePath); - AddChildNode('object path', - GetInheritedOption(icoObjectPath,true),icoObjectPath); - AddChildNode('library path', - GetInheritedOption(icoLibraryPath,true),icoLibraryPath); - AddChildNode('linker options',GetInheritedOption(icoLinkerOptions,true), - icoLinkerOptions); - AddChildNode('custom options',GetInheritedOption(icoCustomOptions,true), - icoCustomOptions); - end; - AncestorNode.Expanded:=true; - // add detail nodes - for i:=0 to OptionsList.Count-1 do begin - AncestorOptions:=TAdditionalCompilerOptions(OptionsList[i]); - AncestorNode:=InhTreeView.Items.Add(nil,''); - AncestorNode.Text:=AncestorOptions.GetOwnerName; - AncestorNode.ImageIndex:=ImageIndexPackage; - AncestorNode.SelectedIndex:=AncestorNode.ImageIndex; - with AncestorOptions.ParsedOpts do begin - AddChildNode(lisunitPath, - CreateRelativeSearchPath(GetParsedValue(pcosUnitPath), - CompilerOpts.BaseDirectory),icoUnitPath); - AddChildNode(lisincludePath, - CreateRelativeSearchPath(GetParsedValue(pcosIncludePath), - CompilerOpts.BaseDirectory),icoIncludePath); - AddChildNode(lisobjectPath, - CreateRelativeSearchPath(GetParsedValue(pcosObjectPath), - CompilerOpts.BaseDirectory),icoObjectPath); - AddChildNode(lislibraryPath, - CreateRelativeSearchPath(GetParsedValue(pcosLibraryPath), - CompilerOpts.BaseDirectory),icoLibraryPath); - AddChildNode(lislinkerOptions, GetParsedValue(pcosLinkerOptions), - icoLinkerOptions); - AddChildNode(liscustomOptions, GetParsedValue(pcosCustomOptions), - icoCustomOptions); - end; - AncestorNode.Expanded:=true; - end; - OptionsList.Free; - end else begin - InhTreeView.Items.Add(nil, lisNoCompilerOptionsInherited); - end; - InhTreeView.EndUpdate; -end; - -procedure TfrmCompilerOptions.ClearInheritedTree; -var - i: Integer; - ChildData: PInheritedNodeData; -begin - InhTreeView.BeginUpdate; - // dispose all child data - if InheritedChildDatas<>nil then begin - for i:=0 to InheritedChildDatas.Count-1 do begin - ChildData:=PInheritedNodeData(InheritedChildDatas[i]); - Dispose(ChildData); - end; - InheritedChildDatas.Free; - InheritedChildDatas:=nil; - end; - InhTreeView.Items.Clear; - InhTreeView.EndUpdate; -end; - -{------------------------------------------------------------------------------ - TfrmCompilerOptions SetupParsingTab -------------------------------------------------------------------------------} -procedure TfrmCompilerOptions.SetupParsingTab(Page: integer); -var - y: Integer; - yDiff: Integer; -begin - // Setup the Parsing Tab - ParsingPage:=nbMain.Page[Page]; - - grpStyle := TRadioGroup.Create(Self); - with grpStyle do - begin - Parent := ParsingPage; - Top := 5; - Left := 5; - Height := 42; - Width := 400; - Caption := dlgCOStyle+' (-r)'; - with Items do begin - BeginUpdate; - Items.Add('Default'); - Items.Add('Intel'); - Items.Add('AT&T'); - Items.Add('direct'); - EndUpdate; - end; - Columns:=4; - end; - - yDiff:=22; - - grpSymantecChk := TGroupBox.Create(Self); - with grpSymantecChk do - begin - Parent := ParsingPage; - Top := grpStyle.Top+grpStyle.Height+5; - Left := grpStyle.Left; - Height := 25+12*yDiff; - Width := Self.ClientWidth-28; - Caption := dlgSymantecChecking; - end; - - y:=2; - - chkSymD2Ext := TCheckBox.Create(Self); - with chkSymD2Ext do - begin - Parent := grpSymantecChk; - Caption := dlgDelphi2Ext+' (-S2)'; - Top := y; - Left := 5; - Width := Parent.ClientWidth-20; - end; - - inc(y,yDiff); - chkSymCOper := TCheckBox.Create(Self); - with chkSymCOper do - begin - Parent := grpSymantecChk; - Caption := dlgCOCOps+' (-Sc)'; - Top := y; - Left := 5; - Width := Parent.ClientWidth-20; - end; - - inc(y,yDiff); - chkSymIncludeAssertions := TCheckBox.Create(Self); - with chkSymIncludeAssertions do - begin - Parent := grpSymantecChk; - Caption := dlgAssertCode+' (-Sa)'; - Top := y; - Left := 5; - Width := Parent.ClientWidth-20; - end; - - inc(y,yDiff); - chkSymAllowLab := TCheckBox.Create(Self); - with chkSymAllowLab do - begin - Parent := grpSymantecChk; - Caption := dlgLabelGoto+' (-Sg)'; - Top := y; - Left := 5; - Width := Parent.ClientWidth-20; - end; - - inc(y,yDiff); - chkSymCPPInline := TCheckBox.Create(Self); - with chkSymCPPInline do - begin - Parent := grpSymantecChk; - Caption := dlgCppInline+' (-Si)'; - Top := y; - Left := 5; - Width := Parent.ClientWidth-20; - end; - - inc(y,yDiff); - chkSymCMacros := TCheckBox.Create(Self); - with chkSymCMacros do - begin - Parent := grpSymantecChk; - Caption := dlgCMacro+' (-Sm)'; - Top := y; - Left := 5; - Width := Parent.ClientWidth-20; - end; - - inc(y,yDiff); - chkSymTP7Compat := TCheckBox.Create(Self); - with chkSymTP7Compat do - begin - Parent := grpSymantecChk; - Caption := dlgBP7Cptb+' (-So)'; - Top := y; - Left := 5; - Width := Parent.ClientWidth-20; - end; - - inc(y,yDiff); - chkSymConstInit := TCheckBox.Create(Self); - with chkSymConstInit do - begin - Parent := grpSymantecChk; - Caption := dlgInitDoneOnly+' (-Ss)'; - Top := y; - Left := 5; - Width := Parent.ClientWidth-20; - end; - - inc(y,yDiff); - chkSymStaticKwd := TCheckBox.Create(Self); - with chkSymStaticKwd do - begin - Parent := grpSymantecChk; - Caption := dlgStaticKeyword+' (-St)'; - Top := y; - Left := 5; - Width := Parent.ClientWidth-20; - end; - - inc(y,yDiff); - chkSymDelphiCompat := TCheckBox.Create(Self); - with chkSymDelphiCompat do - begin - Parent := grpSymantecChk; - Caption := dlgDeplhiComp+' (-Sd)'; - Top := y; - Left := 5; - Width := Parent.ClientWidth-20; - end; - - inc(y,yDiff); - chkSymUseAnsiStrings := TCheckBox.Create(Self); - with chkSymUseAnsiStrings do - begin - Parent := grpSymantecChk; - Caption := dlgCOAnsiStr+' (-Sh)'; - Top := y; - Left := 5; - Width := Parent.ClientWidth-20; - end; - - inc(y,yDiff); - chkSymGPCCompat := TCheckBox.Create(Self); - with chkSymGPCCompat do - begin - Parent := grpSymantecChk; - Caption := dlgGPCComp+' (-Sp)'; - Top := y; - Left := 5; - Width := Parent.ClientWidth-20; - end; -end; - - -{------------------------------------------------------------------------------} -{ TfrmCompilerOptions SetupCodeGenerationTab } -{------------------------------------------------------------------------------} -procedure TfrmCompilerOptions.SetupCodeGenerationTab(Page: integer); -var - w: Integer; -begin - // Setup the Code Generation Tab - CodeGenPage:=nbMain.Page[Page]; - - grpUnitStyle := TRadioGroup.Create(Self); - with grpUnitStyle do - begin - Parent := CodeGenPage; - Top := 5; - Left := 5; - Height := 80; - Width := 150; - Caption := dlgCOUnitStyle; - with Items do begin - Add(dlgStatic+' (none)'); - Add(dlgDynamic+' (-CD)'); - Add(dlgCOSmart+' (-CS)'); - end; - end; - - {------------------------------------------------------------} - grpChecks := TGroupBox.Create(Self); - with grpChecks do - begin - Parent := CodeGenPage; - Top := 5; - Left := grpUnitStyle.Left + grpUnitStyle.Width + 10; - Height := 80; - Width := 210; - Caption := dlgCOChecks; - end; - - chkChecksIO := TCheckBox.Create(Self); - with chkChecksIO do - begin - Parent := grpChecks; - Caption := 'I/O (-Ci)'; - Top := 2; - Left := 2; - Width := 100; - end; - - chkChecksRange := TCheckBox.Create(Self); - with chkChecksRange do - begin - Parent := grpChecks; - Caption := dlgCORange+' (-Cr)'; - Top := 2; - Left := 102; - Width := 100; - end; - - chkChecksOverflow := TCheckBox.Create(Self); - with chkChecksOverflow do - begin - Parent := grpChecks; - Caption := dlgCOOverflow+' (-Co)'; - Top := 27; - Left := 2; - Width := 100; - end; - - chkChecksStack := TCheckBox.Create(Self); - with chkChecksStack do - begin - Parent := grpChecks; - Caption := dlgCOStack+' (-Cs)'; - Top := 27; - Left := 102; - Width := 100; - end; - - {------------------------------------------------------------} - - grpHeapSize := TGroupBox.Create(Self); - with grpHeapSize do - begin - Parent := CodeGenPage; - Top := 10; - Left := grpChecks.Left + grpChecks.Width + 10; - Height := 55; - Width := 100; - Caption := dlgHeapSize +' (-Ch):'; - end; - - edtHeapSize := TEdit.Create(grpHeapSize); - with edtHeapSize do - begin - Parent := grpHeapSize; - Caption := dlgHeapSize; - Top := 8; - Left := 5; - Height := 23; - Width := 65; - Text := ''; - end; - - {------------------------------------------------------------} - - grpGenerate := TGroupBox.Create(Self); - with grpGenerate do - begin - Parent := CodeGenPage; - Top := grpUnitStyle.Top + grpUnitStyle.Height + 6; - Left := 10; - Height := 90; - Width := 150; - Caption := dlgCOGenerate; - end; - - radGenNormal := TRadioButton.Create(grpGenerate); - with radGenNormal do - begin - Parent := grpGenerate; - Top := 5; - Left := 5; - Width := 140; - Caption := dlgCONormal+' (none)'; - end; - - radGenFaster := TRadioButton.Create(grpGenerate); - with radGenFaster do - begin - Parent := grpGenerate; - Top := 28; - Left := 5; - Width := 140; - Caption := dlgCOFast+' (-OG)'; - end; - - radGenSmaller := TRadioButton.Create(grpGenerate); - with radGenSmaller do - begin - Parent := grpGenerate; - Top := 51; - Left := 5; - Width := 140; - Caption := dlgCOSmaller+' (-Og)'; - end; - - - {------------------------------------------------------------} - - grpTargetProc := TRadioGroup.Create(Self); - with grpTargetProc do - begin - Parent := CodeGenPage; - Top := grpGenerate.Top; - Left := grpGenerate.Left + grpGenerate.Width + 10; - Height := 90; - Width := 300; - Caption := dlgTargetProc; - with Items do begin - Add('default (none)'); - Add('386/486 (-Op1)'); - Add('Pentium/Pentium MMX (-Op2)'); - Add('Pentium Pro/Pentium II/C6x86/K6 (-Op3)'); - end; - end; - - {------------------------------------------------------------} - - grpOptimizations := TGroupBox.Create(Self); - with grpOptimizations do - begin - Parent := CodeGenPage; - Top := grpTargetProc.Top + grpTargetProc.Height + 6; - Left := 10; - Height := 150; - Width := 360; - Caption := dlgOptimiz; - end; - - w:=(grpOptimizations.Width-10); - radOptLevelNone := TRadioButton.Create(grpOptimizations); - with radOptLevelNone do - begin - Parent := grpOptimizations; - Caption := dlgLevelNoneOpt+' (none)'; - Top := 5; - Left := 5; - Width := w; - end; - - radOptLevel1 := TRadioButton.Create(grpOptimizations); - with radOptLevel1 do - begin - Parent := grpOptimizations; - Caption := dlgLevel1Opt+' (-O1)'; - Top := 26; - Left := 5; - Width := w; - end; - - radOptLevel2 := TRadioButton.Create(grpOptimizations); - with radOptLevel2 do - begin - Parent := grpOptimizations; - Caption := dlgLevel2Opt+' (-O2)'; - Top := 47; - Left := 5; - Width := w; - end; - - radOptLevel3 := TRadioButton.Create(grpOptimizations); - with radOptLevel3 do - begin - Parent := grpOptimizations; - Caption := dlgLevel3Opt+' (-O3)'; - Top := 68; - Left := 5; - Width := w; - end; - - chkOptVarsInReg := TCheckBox.Create(Self); - with chkOptVarsInReg do - begin - Parent := grpOptimizations; - Caption := dlgCOKeepVarsReg+' (-Or)'; - Top := 89; - Left := 5; - Width := w; - end; - - chkOptUncertain := TCheckBox.Create(Self); - with chkOptUncertain do - begin - Parent := grpOptimizations; - Caption := dlgUncertOpt+' (-Ou)'; - Top := 110; - Left := 5; - Width := w; - end; - - {-----------------------------------------------------} - - TargetOSGroupBox:=TGroupBox.Create(Self); - with TargetOSGroupBox do begin - Name:='TargetOSGroupBox'; - Parent := CodeGenPage; - Left := grpOptimizations.Left+grpOptimizations.Width+5; - Top:=grpOptimizations.Top; - Width:=150; - Height:=45; - Caption:=dlgTargetOS+' (-T)'; - end; - - TargetOSComboBox:=TComboBox.Create(Self); - with TargetOSComboBox do begin - Name:='TargetOSComboBox'; - Parent := TargetOSGroupBox; - Align:=alTop; - with Items do begin - Add('('+rsiwpDefault+')'); - Add('Darwin'); - Add('FreeBSD'); - Add('Linux'); - Add('NetBSD'); - Add('OpenBSD'); - Add('Win32'); - end; - ItemIndex:=0; - end; -end; - -{------------------------------------------------------------------------------ - TfrmCompilerOptions SetupLinkingTab -------------------------------------------------------------------------------} -procedure TfrmCompilerOptions.SetupLinkingTab(Page: integer); -begin - // Setup the Linking Tab - LinkingPage:=nbMain.Page[Page]; - - grpDebugging := TGroupBox.Create(Self); - with grpDebugging do - begin - Parent := LinkingPage; - Top := 10; - Left := 10; - Height := 172; - Width := Self.ClientWidth-28; - Caption := dlgCODebugging; - end; - - chkDebugGDB := TCheckBox.Create(Self); - with chkDebugGDB do - begin - Parent := grpDebugging; - Caption := dlgCOGDB+' (-g)'; - Top := 6; - Left := 8; - Width := 360; - end; - - chkDebugDBX := TCheckBox.Create(Self); - with chkDebugDBX do - begin - Parent := grpDebugging; - Caption := dlgCODBX+' (-gd)'; - Top := 27; - Left := 8; - Width := 360; - end; - - chkUseLineInfoUnit := TCheckBox.Create(Self); - with chkUseLineInfoUnit do - begin - Parent := grpDebugging; - Caption := dlgLNumsBct+' (-gl)'; - Top := 48; - Left := 8; - Width := 360; - end; - - chkUseHeaptrc := TCheckBox.Create(Self); - with chkUseHeaptrc do - begin - Parent := grpDebugging; - Caption := dlgCOHeaptrc+' (-gh)'; - Top := 69; - Left := 8; - Width := 360; - end; - - chkUseValgrind := TCheckBox.Create(Self); - with chkUseValgrind do - begin - Parent := grpDebugging; - Caption := dlgCOValgrind+' (-gv)'; - Top := 90; - Left := 8; - Width := 360; - end; - - chkGenGProfCode := TCheckBox.Create(Self); - with chkGenGProfCode do - begin - Parent := grpDebugging; - Caption := dlgGPROF+' (-pg)'; - Top := 111; - Left := 8; - Width := 360; - end; - - chkSymbolsStrip := TCheckBox.Create(Self); - with chkSymbolsStrip do - begin - Parent := grpDebugging; - Caption := dlgCOStrip+' (-Xs)'; - Top := 132; - Left := 8; - Width := 360; - end; - - {------------------------------------------------------------} - - grpLinkLibraries := TGroupBox.Create(Self); - with grpLinkLibraries do - begin - Parent := LinkingPage; - Top := grpDebugging.Top + grpDebugging.Height + 10; - Left := 10; - Height := 91; - Width := (Self.ClientWidth-30) div 2; - Caption := dlgLinkLibraries; - end; - - radLibsLinkDynamic := TRadioButton.Create(Self); - with radLibsLinkDynamic do - begin - Parent := grpLinkLibraries; - Caption := dlgLinkDinLibs+' (-XD)'; - Top := 6; - Left := 8; - Height := 22; - Width := Parent.Width-10; - end; - - radLibsLinkStatic := TRadioButton.Create(Self); - with radLibsLinkStatic do - begin - Parent := grpLinkLibraries; - Caption := dlgLinkStatLibs+' (-XS)'; - Top := 27; - Left := 8; - Height := 22; - Width := Parent.Width-10; - end; - - radLibsLinkSmart := TRadioButton.Create(Self); - with radLibsLinkSmart do - begin - Parent := grpLinkLibraries; - Caption := dlgLinkSmart+' (-XX -CX)'; - Top := 48; - Left := 8; - Height := 22; - Width := Parent.Width-10; - end; - - {------------------------------------------------------------} - - TargetSpecificsGrpBox := TGroupBox.Create(Self); - with TargetSpecificsGrpBox do begin - Parent := LinkingPage; - Top := grpLinkLibraries.Top; - Left := grpLinkLibraries.Left+grpLinkLibraries.Width+10; - Height := 50; - Width := (Self.ClientWidth-30) div 2; - Caption := lisCOTargetOSSpecificOptions; - end; - - chkWin32GraphicApp := TCheckBox.Create(Self); - with chkWin32GraphicApp do - begin - Parent := TargetSpecificsGrpBox; - Caption := 'Win32 gui application (-WG)'; - Top := 5; - Left := 2; - Height := 22; - Width := Parent.Width-10; - end; - - {------------------------------------------------------------} - - grpOptions := TGroupBox.Create(Self); - with grpOptions do - begin - Parent := LinkingPage; - Top := grpLinkLibraries.Top + grpLinkLibraries.Height + 10; - Left := 10; - Height := 75; - Width := (Self.ClientWidth-20); - Caption := dlgCOOpts+' (-k)'; - end; - - chkOptionsLinkOpt := TCheckBox.Create(Self); - with chkOptionsLinkOpt do - begin - Parent := grpOptions; - Caption := dlgPassOptsLinker; - Top := 6; - Left := 8; - Width := 330; - end; - - edtOptionsLinkOpt := TEdit.Create(grpOptions); - with edtOptionsLinkOpt do - begin - Parent := grpOptions; - Top := 27; - Left := 8; - Height := 23; - Width := Parent.ClientWidth-20; - Text := ''; - end; -end; - -{------------------------------------------------------------------------------} -{ TfrmCompilerOptions SetupMessagesTab } -{------------------------------------------------------------------------------} -procedure TfrmCompilerOptions.SetupMessagesTab(Page: integer); -begin - // Setup the Messages Tab - MsgPage:=nbMain.Page[Page]; - - grpVerbosity := TGroupBox.Create(Self); - with grpVerbosity do - begin - Parent := MsgPage; - Top := 10; - Left := 10; - Height := 212; - Width := Self.ClientWidth-28; - Caption := dlgVerbosity; - end; - - chkErrors := TCheckBox.Create(Self); - with chkErrors do - begin - Parent := grpVerbosity; - Caption := dlgCOShowErr+' (-ve)'; - Top := 6; - Left := 8; - Width := (grpVerbosity.ClientWidth div 2)-12; - end; - - chkWarnings := TCheckBox.Create(Self); - with chkWarnings do - begin - Parent := grpVerbosity; - Caption := dlgShowWarnings+' (-vw)'; - Top := 27; - Left := chkErrors.Left; - Height := chkErrors.Height; - Width := chkErrors.Width; - end; - - chkNotes := TCheckBox.Create(Self); - with chkNotes do - begin - Parent := grpVerbosity; - Caption := dlgShowNotes+' (-vn)'; - Top := 48; - Left := chkErrors.Left; - Height := chkErrors.Height; - Width := chkErrors.Width; - end; - - chkHints := TCheckBox.Create(Self); - with chkHints do - begin - Parent := grpVerbosity; - Caption := dlgShowHint+' (-vh)'; - Top := 69; - Left := chkErrors.Left; - Height := chkErrors.Height; - Width := chkErrors.Width; - end; - - chkGeneralInfo := TCheckBox.Create(Self); - with chkGeneralInfo do - begin - Parent := grpVerbosity; - Caption := dlgShowGeneralInfo+' (-vi)'; - Top := 90; - Left := chkErrors.Left; - Height := chkErrors.Height; - Width := chkErrors.Width; - end; - - chkLineNumbers := TCheckBox.Create(Self); - with chkLineNumbers do - begin - Parent := grpVerbosity; - Caption := dlgShowLineNumbers+' (-vl)'; - Top := 111; - Left := chkErrors.Left; - Height := chkErrors.Height; - Width := chkErrors.Width; - end; - - chkAllProcsOnError := TCheckBox.Create(Self); - with chkAllProcsOnError do - begin - Parent := grpVerbosity; - Caption := dlgShowProcsError+' (-vb)'; - Top := 132; - Left := chkErrors.Left; - Height := chkErrors.Height; - Width := chkErrors.Width; - end; - - chkEverything := TCheckBox.Create(Self); - with chkEverything do - begin - Parent := grpVerbosity; - Caption := dlgShowEverything+' (-va)'; - Top := 153; - Left := chkErrors.Left; - Height := chkErrors.Height; - Width := chkErrors.Width; - end; - - chkDebugInfo := TCheckBox.Create(Self); - with chkDebugInfo do - begin - Parent := grpVerbosity; - Caption := dlgShowDebugInfo+' (-vd)'; - Top := 6; - Left := (grpVerbosity.ClientWidth div 2)+4; - Width := (grpVerbosity.ClientWidth div 2)-12; - end; - - chkUsedFiles := TCheckBox.Create(Self); - with chkUsedFiles do - begin - Parent := grpVerbosity; - Caption := dlgShowUsedFiles+' (-vu)'; - Top := 27; - Left := chkDebugInfo.Left; - Height := chkDebugInfo.Height; - Width := chkDebugInfo.Width; - end; - - chkTriedFiles := TCheckBox.Create(Self); - with chkTriedFiles do - begin - Parent := grpVerbosity; - Caption := dlgShowTriedFiles+' (-vt)'; - Top := 48; - Left := chkDebugInfo.Left; - Height := chkDebugInfo.Height; - Width := chkDebugInfo.Width; - end; - - chkDefinedMacros := TCheckBox.Create(Self); - with chkDefinedMacros do - begin - Parent := grpVerbosity; - Caption := dlgShowDefinedMacros+' (-vm)'; - Top := 69; - Left := chkDebugInfo.Left; - Height := chkDebugInfo.Height; - Width := chkDebugInfo.Width; - end; - - chkCompiledProc := TCheckBox.Create(Self); - with chkCompiledProc do - begin - Parent := grpVerbosity; - Caption := dlgShowCompiledProcedures+' (-vp)'; - Top := 90; - Left := chkDebugInfo.Left; - Height := chkDebugInfo.Height; - Width := chkDebugInfo.Width; - end; - - chkConditionals := TCheckBox.Create(Self); - with chkConditionals do - begin - Parent := grpVerbosity; - Caption := dlgShowConditionals+' (-vc)'; - Top := 111; - Left := chkDebugInfo.Left; - Height := chkDebugInfo.Height; - Width := chkDebugInfo.Width; - end; - - chkNothing := TCheckBox.Create(Self); - with chkNothing do - begin - Parent := grpVerbosity; - Caption := dlgShowNothing+' (-v0)'; - Top := 132; - Left := chkDebugInfo.Left; - Height := chkDebugInfo.Height; - Width := chkDebugInfo.Width; - end; - - chkFPCLogo := TCheckBox.Create(Self); - with chkFPCLogo do - begin - Parent := grpVerbosity; - Caption := dlgWriteFPCLogo+' (-l)'; - Top := 153; - Left := chkDebugInfo.Left; - Height := chkDebugInfo.Height; - Width := chkDebugInfo.Width; - end; - - chkHintsForUnusedUnitsInMainSrc := TCheckBox.Create(Self); - with chkHintsForUnusedUnitsInMainSrc do - begin - Parent := grpVerbosity; - Caption := dlgHintsUnused+' (none)'; - Top := 174; - Left := ChkErrors.Left; - Height := ChkErrors.Height; - Width := chkDebugInfo.Width*2; - end; - - {------------------------------------------------------------} - grpErrorCnt := TGroupBox.Create(Self); - with grpErrorCnt do - begin - Parent := MsgPage; - Top := grpVerbosity.Top + grpVerbosity.Height + 10; - Left := 10; - Height := 50; - Width := 200; - Caption := dlgStopAfterNrErr+' (-Se)'; - end; - - edtErrorCnt := TEdit.Create(grpErrorCnt); - with edtErrorCnt do - begin - Parent := grpErrorCnt; - Top := 6; - Left := 8; - Height := 23; - Width := grpErrorCnt.ClientWidth-2*Left-4; - Text := ''; - end; -end; - -procedure TfrmCompilerOptions.SetupOtherTab(Page: integer); -begin - {------------------------------------------------------------} - OtherPage:=nbMain.Page[Page]; - - grpConfigFile := TGroupBox.Create(Self); - with grpConfigFile do - begin - Parent := OtherPage; - Top := 10; - Left := 10; - Height := 95; - Width := Self.ClientWidth-28; - Caption := dlgConfigFiles; - end; - - chkConfigFile := TCheckBox.Create(Self); - with chkConfigFile do - begin - Parent := grpConfigFile; - Caption := dlgUseFpcCfg+' (none, not is -n)'; - Top := 6; - Left := 8; - Width := 330; - end; - - chkAdditionalConfigFile := TCheckBox.Create(Self); - with chkAdditionalConfigFile do - begin - Parent := grpConfigFile; - Caption := dlgUseAdditionalConfig+' (@)'; - Top := 27; - Left := 8; - Width := 330; - OnClick:=@chkAdditionalConfigFileClick; - end; - - edtConfigPath := TEdit.Create(grpConfigFile); - with edtConfigPath do - begin - Parent := grpConfigFile; - Top := 48; - Left := 8; - Height := 23; - Width := 330; - Text := ''; - end; - - grpCustomOptions := TGroupBox.Create(Self); - with grpCustomOptions do begin - Name:='grpCustomOptions'; - Parent := OtherPage; - Left:=grpConfigFile.Left; - Top:=grpConfigFile.Top+grpConfigFile.Height+10; - Width:=grpConfigFile.Width; - Height:=200; - Caption:=lisCustomOptions2; - end; - - memCustomOptions := TMemo.Create(Self); - with memCustomOptions do begin - Name:='memCustomOptions'; - Parent:=grpCustomOptions; - Align:=alClient; - end; -end; - -{------------------------------------------------------------------------------ - procedure TfrmCompilerOptions.SetupInheritedTab(Page: integer); -------------------------------------------------------------------------------} -procedure TfrmCompilerOptions.SetupInheritedTab(Page: integer); -begin - InheritedPage:=nbMain.Page[Page]; - InheritedPage.OnResize:=@InheritedPageResize; - - InhNoteLabel:=TLabel.Create(Self); - with InhNoteLabel do begin - Name:='InhNoteLabel'; - Parent:=InheritedPage; - Caption:=lisAdditionalCompilerOptionsInheritedFromPackages; - end; - - InhTreeView:=TTreeView.Create(Self); - with InhTreeView do begin - Name:='InhTreeView'; - Parent:=InheritedPage; - Options:=Options+[tvoReadOnly, tvoRightClickSelect, tvoShowRoot, - tvoKeepCollapsedNodes]; - Images:=ImageList; - OnSelectionChanged:=@InhTreeViewSelectionChanged; - end; - - InhItemMemo:=TMemo.Create(Self); - with InhItemMemo do begin - Name:='InhItemMemo'; - Parent:=InheritedPage; - ReadOnly:=true; - WordWrap:=true; - ScrollBars:=ssAutoVertical; - Text:=lisSelectANode; - end; -end; - -procedure TfrmCompilerOptions.SetupCompilationTab(Page: integer); -var - y: Integer; - x: Integer; - w: Integer; -begin - CompilationPage:=nbMain.Page[Page]; - x:=5; - w:=ClientWidth-20; - y:=5; - - {------------------------------------------------------------} - - ExecuteBeforeGroupBox:=TGroupBox.Create(Self); - with ExecuteBeforeGroupBox do begin - Name:='ExecuteBeforeGroupBox'; - Parent:=CompilationPage; - SetBounds(x,y,w,100); - inc(y,Height+10); - Caption:=lisCOExecuteBefore; - OnResize:=@ExecuteBeforeGroupBoxResize; - end; - - ExecuteBeforeCommandLabel:=TLabel.Create(Self); - with ExecuteBeforeCommandLabel do begin - Name:='ExecuteBeforeCommandLabel'; - Parent:=ExecuteBeforeGroupBox; - Caption:=lisCOCommand; - end; - - ExecuteBeforeCommandEdit:=TEdit.Create(Self); - with ExecuteBeforeCommandEdit do begin - Name:='ExecuteBeforeCommandEdit'; - Parent:=ExecuteBeforeGroupBox; - Text:=''; - end; - - ExecuteBeforeScanFPCCheckBox:=TCheckBox.Create(Self); - with ExecuteBeforeScanFPCCheckBox do begin - Name:='ExecuteBeforeScanFPCCheckBox'; - Parent:=ExecuteBeforeGroupBox; - Caption:=lisCOScanForFPCMessages; - end; - - ExecuteBeforeScanMakeCheckBox:=TCheckBox.Create(Self); - with ExecuteBeforeScanMakeCheckBox do begin - Name:='ExecuteBeforeScanMakeCheckBox'; - Parent:=ExecuteBeforeGroupBox; - Caption:=lisCOScanForMakeMessages; - end; - - ExecuteBeforeShowAllCheckBox:=TCheckBox.Create(Self); - with ExecuteBeforeShowAllCheckBox do begin - Name:='ExecuteBeforeShowAllCheckBox'; - Parent:=ExecuteBeforeGroupBox; - Caption:=lisCOShowAllMessages; - end; - - {------------------------------------------------------------} - - grpCompiler := TGroupBox.Create(Self); - with grpCompiler do - begin - Parent := CompilationPage; - Top := y; - Left := x; - Width := w; - Height := 90; - Caption := dlgToFPCPath; - inc(y,Height+10); - end; - - edtCompiler := TEdit.Create(grpCompiler); - with edtCompiler do - begin - Parent := grpCompiler; - Left := 2; - Top := 3; - Width := Parent.ClientWidth-Left-37; - Text := ''; - end; - - btnCompiler:=TButton.Create(Self); - with btnCompiler do begin - Name:='btnCompiler'; - Parent:=grpCompiler; - Left:=edtCompiler.Left+edtCompiler.Width+3; - Top:=edtCompiler.Top; - Width:=25; - Height:=edtCompiler.Height; - Caption:='...'; - OnClick:=@FileBrowseBtnClick; - end; - - chkSkipCompiler:=TCheckBox.Create(Self); - with chkSkipCompiler do begin - Name:='chkSkipCompiler'; - Parent:=grpCompiler; - Left:=5; - Top:=35; - Width:=Parent.ClientWidth-2*Left; - Caption:=lisCOSkipCallingCompiler; - end; - - {------------------------------------------------------------} - - ExecuteAfterGroupBox:=TGroupBox.Create(Self); - with ExecuteAfterGroupBox do begin - Name:='ExecuteAfterGroupBox'; - Parent:=CompilationPage; - SetBounds(x,y,w,100); - inc(y,Height+10); - Caption:=lisCOExecuteAfter; - OnResize:=@ExecuteAfterGroupBoxResize; - end; - - ExecuteAfterCommandLabel:=TLabel.Create(Self); - with ExecuteAfterCommandLabel do begin - Name:='ExecuteAfterCommandLabel'; - Parent:=ExecuteAfterGroupBox; - Caption:=lisCOCommand; - end; - - ExecuteAfterCommandEdit:=TEdit.Create(Self); - with ExecuteAfterCommandEdit do begin - Name:='ExecuteAfterCommandEdit'; - Parent:=ExecuteAfterGroupBox; - Text:=''; - end; - - ExecuteAfterScanFPCCheckBox:=TCheckBox.Create(Self); - with ExecuteAfterScanFPCCheckBox do begin - Name:='ExecuteAfterScanFPCCheckBox'; - Parent:=ExecuteAfterGroupBox; - Caption:=lisCOScanForFPCMessages; - end; - - ExecuteAfterScanMakeCheckBox:=TCheckBox.Create(Self); - with ExecuteAfterScanMakeCheckBox do begin - Name:='ExecuteAfterScanMakeCheckBox'; - Parent:=ExecuteAfterGroupBox; - Caption:=lisCOScanForMakeMessages; - end; - - ExecuteAfterShowAllCheckBox:=TCheckBox.Create(Self); - with ExecuteAfterShowAllCheckBox do begin - Name:='ExecuteAfterShowAllCheckBox'; - Parent:=ExecuteAfterGroupBox; - Caption:=lisCOShowAllMessages; - end; - -end; - -{------------------------------------------------------------------------------ - TfrmCompilerOptions SetupSearchPathsTab -------------------------------------------------------------------------------} -procedure TfrmCompilerOptions.SetupSearchPathsTab(Page: integer); -var - y: Integer; -begin - // Setup the Search Paths Tab - PathPage:=nbMain.Page[Page]; - - y:=5; - - grpOtherUnits := TGroupBox.Create(Self); - with grpOtherUnits do - begin - Parent := PathPage; - Left := 10; - Top := y; - Width := Self.ClientWidth-28; - Height := 45; - Caption := dlgOtherUnitFiles; - inc(y,Height+5); - end; - - edtOtherUnits := TEdit.Create(Self); - with edtOtherUnits do - begin - Parent := grpOtherUnits; - Left := 8; - Top := 0; - Width := Parent.ClientWidth-Left-37; - Text := ''; - end; - - OtherUnitsPathEditBtn:=TPathEditorButton.Create(Self); - with OtherUnitsPathEditBtn do begin - Name:='OtherUnitsPathEditBtn'; - Parent:=grpOtherUnits; - Left:=edtOtherUnits.Left+edtOtherUnits.Width+3; - Top:=edtOtherUnits.Top; - Width:=25; - Height:=edtOtherUnits.Height; - Caption:='...'; - OnClick:=@PathEditBtnClick; - OnExecuted:=@PathEditBtnExecuted; - end; - - - {------------------------------------------------------------} - - grpIncludeFiles := TGroupBox.Create(Self); - with grpIncludeFiles do - begin - Parent := PathPage; - Left := grpOtherUnits.Left; - Top := y; - Width := grpOtherUnits.Width; - Height := grpOtherUnits.Height; - Caption := dlgCOIncFiles; - inc(y,Height+5); - end; - - edtIncludeFiles := TEdit.Create(Self); - with edtIncludeFiles do - begin - Parent := grpIncludeFiles; - Left := edtOtherUnits.Left; - Top := edtOtherUnits.Top; - Width := Parent.ClientWidth-Left-37; - Text := ''; - end; - - IncludeFilesPathEditBtn:=TPathEditorButton.Create(Self); - with IncludeFilesPathEditBtn do begin - Name:='IncludeFilesPathEditBtn'; - Parent:=grpIncludeFiles; - Left:=edtIncludeFiles.Left+edtIncludeFiles.Width+3; - Top:=edtIncludeFiles.Top; - Width:=25; - Height:=edtIncludeFiles.Height; - Caption:='...'; - OnClick:=@PathEditBtnClick; - OnExecuted:=@PathEditBtnExecuted; - end; - - {------------------------------------------------------------} - - grpOtherSources := TGroupBox.Create(Self); - with grpOtherSources do - begin - Parent := PathPage; - Top := y; - Left := grpOtherUnits.Left; - Width := grpOtherUnits.Width; - Height := grpOtherUnits.Height; - Caption := dlgCOSources; - inc(y,Height+5); - end; - - edtOtherSources := TEdit.Create(Self); - with edtOtherSources do - begin - Parent := grpOtherSources; - Left := edtOtherUnits.Left; - Top := edtOtherUnits.Top; - Width := Parent.ClientWidth-Left-37; - Text := ''; - end; - - OtherSourcesPathEditBtn:=TPathEditorButton.Create(Self); - with OtherSourcesPathEditBtn do begin - Name:='OtherSourcesPathEditBtn'; - Parent:=grpOtherSources; - Left:=edtOtherSources.Left+edtOtherSources.Width+3; - Top:=edtOtherSources.Top; - Width:=25; - Height:=edtOtherSources.Height; - Caption:='...'; - OnClick:=@PathEditBtnClick; - OnExecuted:=@PathEditBtnExecuted; - end; - - {------------------------------------------------------------} - - grpLibraries := TGroupBox.Create(Self); - with grpLibraries do - begin - Parent := PathPage; - Top := y; - Left := grpOtherUnits.Left; - Width := grpOtherUnits.Width; - Height := grpOtherUnits.Height; - Caption := dlgCOLibraries; - inc(y,Height+5); - end; - - edtLibraries := TEdit.Create(Self); - with edtLibraries do - begin - Parent := grpLibraries; - Left := edtOtherUnits.Left; - Top := edtOtherUnits.Top; - Width := Parent.ClientWidth-Left-37; - Text := ''; - end; - - LibrariesPathEditBtn:=TPathEditorButton.Create(Self); - with LibrariesPathEditBtn do begin - Name:='LibrariesPathEditBtn'; - Parent:=grpLibraries; - Left:=edtLibraries.Left+edtLibraries.Width+3; - Top:=edtLibraries.Top; - Width:=25; - Height:=edtLibraries.Height; - Caption:='...'; - OnClick:=@PathEditBtnClick; - OnExecuted:=@PathEditBtnExecuted; - end; - - {------------------------------------------------------------} - - grpUnitOutputDir := TGroupBox.Create(Self); - with grpUnitOutputDir do - begin - Parent := PathPage; - Top := y; - Left := grpOtherUnits.Left; - Width := grpOtherUnits.Width; - Height := grpOtherUnits.Height; - Caption := dlgUnitOutp; - inc(y,Height+5); - end; - - edtUnitOutputDir := TEdit.Create(Self); - with edtUnitOutputDir do - begin - Parent := grpUnitOutputDir; - Left := edtOtherUnits.Left; - Top := edtOtherUnits.Top; - Width := Parent.ClientWidth-Left-37; - Text := ''; - end; - - btnUnitOutputDir:=TButton.Create(Self); - with btnUnitOutputDir do begin - Name:='btnUnitOutputDir'; - Parent:=grpUnitOutputDir; - Left:=edtUnitOutputDir.Left+edtUnitOutputDir.Width+3; - Top:=edtUnitOutputDir.Top; - Width:=25; - Height:=edtUnitOutputDir.Height; - Caption:='...'; - OnClick:=@FileBrowseBtnClick; - end; - - {------------------------------------------------------------} - - grpDebugPath := TGroupBox.Create(Self); - with grpDebugPath do - begin - Parent := PathPage; - Left := 10; - Top := y; - Width := Self.ClientWidth-28; - Height := 45; - Caption := dlgCODebugPath; - inc(y,Height+5); - end; - - edtDebugPath := TEdit.Create(Self); - with edtDebugPath do - begin - Parent := grpDebugPath; - Left := 8; - Top := 0; - Width := Parent.ClientWidth-Left-37; - Text := ''; - end; - - DebugPathEditBtn:=TPathEditorButton.Create(Self); - with DebugPathEditBtn do begin - Name:='DebugPathEditBtn'; - Parent:=grpDebugPath; - Left:=edtDebugPath.Left+edtDebugPath.Width+3; - Top:=edtDebugPath.Top; - Width:=25; - Height:=edtDebugPath.Height; - Caption:='...'; - OnClick:=@PathEditBtnClick; - OnExecuted:=@PathEditBtnExecuted; - end; - - - {------------------------------------------------------------} - - LCLWidgetTypeRadioGroup:=TRadioGroup.Create(Self); - with LCLWidgetTypeRadioGroup do begin - Name:='LCLWidgetTypeRadioGroup'; - Parent := PathPage; - Left := grpOtherUnits.Left; - Top:= y; - Width:=Self.ClientWidth-28; - Height:=45; - Caption:=lisLCLWidgetType+' (various)'; - with Items do begin - Add(Format(lisCOdefault, [GetDefaultLCLWidgetType])); - Add('gnome'); - Add('gtk'); - Add('gtk2'); - Add('win32'); - end; - Columns:=Items.Count; - ItemIndex:=1; - end; -end; - -{------------------------------------------------------------------------------} -{ TfrmCompilerOptions SetupButtonBar } -{------------------------------------------------------------------------------} -procedure TfrmCompilerOptions.SetupButtonBar; -begin - // Setup the Button Bar - btnOK := TButton.Create(Self); - with btnOK do - begin - Parent := Self; - Caption := 'OK'; - OnClick := @ButtonOKClicked; - end; - - btnCancel := TButton.Create(Self); - with btnCancel do - begin - Parent := Self; - Caption := dlgCancel; - OnClick := @ButtonCancelClicked; - end; - - btnShowOptions := TButton.Create(Self); - with btnShowOptions do - begin - Parent := Self; - Caption := dlgCOShowOptions; - OnClick := @ButtonShowOptionsClicked; - end; - - btnCheck := TButton.Create(Self); - with btnCheck do - begin - Parent := Self; - Caption := lisCompTest; - OnClick := @ButtonCheckClicked; - end; - - btnLoadSave := TButton.Create(Self); - with btnLoadSave do - begin - Parent := Self; - Caption := dlgCOLoadSave; - OnClick := @ButtonLoadSaveClick; - end; -end; - -procedure TfrmCompilerOptions.chkAdditionalConfigFileClick(Sender: TObject); -begin - edtConfigPath.Enabled:=chkAdditionalConfigFile.Checked; -end; - -procedure TfrmCompilerOptions.PathEditBtnClick(Sender: TObject); -var AButton: TPathEditorButton; - OldPath, Templates: string; -begin - if Sender is TPathEditorButton then begin - AButton:=TPathEditorButton(Sender); - if AButton=OtherUnitsPathEditBtn then begin - OldPath:=edtOtherUnits.Text; - Templates:=SetDirSeparators( - '$(LazarusDir)/lcl/units/$(TargetCPU)/$(TargetOS)' - +';$(LazarusDir)/lcl/units/$(TargetCPU)/$(TargetOS)/$(LCLWidgetType)' - +';$(LazarusDir)/components/units/$(TargetCPU)/$(TargetOS)' - +';$(LazarusDir)/components/custom' - +';$(LazarusDir)/packager/units/$(TargetCPU)/$(TargetOS)' - ); - end else - if AButton=IncludeFilesPathEditBtn then begin - OldPath:=edtIncludeFiles.Text; - Templates:='include'; - end else - if AButton=OtherSourcesPathEditBtn then begin - OldPath:=edtOtherSources.Text; - Templates:=SetDirSeparators( - '$(LazarusDir)/lcl' - +';$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)' - +';$(LazarusDir)/components/synedit' - +';$(LazarusDir)/components/codetools' - ); - end else - if AButton=LibrariesPathEditBtn then begin - OldPath:=edtLibraries.Text; - Templates:=SetDirSeparators('/usr/X11R6/lib;/sw/lib'); - end else - if AButton=DebugPathEditBtn then begin - OldPath:=edtDebugPath.Text; - Templates:=SetDirSeparators( - '$(LazarusDir)/lcl/include' - +';$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)' - +';$(LazarusDir)/include/' - ); - end else - exit; - AButton.CurrentPathEditor.Path:=OldPath; - AButton.CurrentPathEditor.Templates:=SetDirSeparators(Templates); - end; -end; - -procedure TfrmCompilerOptions.PathEditBtnExecuted(Sender: TObject); -var AButton: TPathEditorButton; - NewPath: string; -begin - if Sender is TPathEditorButton then begin - AButton:=TPathEditorButton(Sender); - if AButton.CurrentPathEditor.ModalResult<>mrOk then exit; - NewPath:=AButton.CurrentPathEditor.Path; - if CompilerOpts<>nil then - NewPath:=CompilerOpts.ShortenPath(NewPath,false); - if AButton=OtherUnitsPathEditBtn then begin - edtOtherUnits.Text:=NewPath; - end else - if AButton=IncludeFilesPathEditBtn then begin - edtIncludeFiles.Text:=NewPath; - end else - if AButton=OtherSourcesPathEditBtn then begin - edtOtherSources.Text:=NewPath; - end else - if AButton=LibrariesPathEditBtn then begin - edtLibraries.Text:=NewPath; - end else - if AButton=DebugPathEditBtn then begin - edtDebugPath.Text:=NewPath; - end; - end; -end; - -procedure TfrmCompilerOptions.frmCompilerOptionsClose(Sender: TObject; - var CloseAction: TCloseAction); -begin - IDEDialogLayoutList.SaveLayout(Self); -end; - -procedure TfrmCompilerOptions.frmCompilerOptionsResize(Sender: TObject); -var - x: Integer; - y: Integer; -begin - with nbMain do - SetBounds(0,0,Parent.ClientWidth,Parent.ClientHeight-45); - - x:=Width - 10; - y:=Height - btnCheck.Height - 12; - - with btnLoadSave do - SetBounds(x-120,y,120,Height); - dec(x,btnLoadSave.Width+10); - - with btnCheck do - SetBounds(x-70,y,70,Height); - dec(x,btnCheck.Width+10); - - with btnShowOptions do - SetBounds(x-120,y,120,Height); - dec(x,btnShowOptions.Width+10); - - with btnCancel do - SetBounds(x-70,y,70,Height); - dec(x,btnCancel.Width+10); - - with btnOK do - SetBounds(x-70,y,70,Height); - dec(x,btnOk.Width+10); -end; - -procedure TfrmCompilerOptions.SetReadOnly(const AValue: boolean); -begin - if FReadOnly=AValue then exit; - FReadOnly:=AValue; - btnOk.Enabled:=not FReadOnly; - btnCheck.Enabled:=not FReadOnly; -end; - - { TAdditionalCompilerOptions } procedure TAdditionalCompilerOptions.SetCustomOptions(const AValue: string); @@ -5029,12 +2528,12 @@ begin ParsedStamp[Option]:=InvalidParseStamp; end; -{ TCompilerOptions } +//{ TCompilerOptions } -procedure TCompilerOptions.Clear; -begin - inherited Clear; -end; +//procedure TCompilerOptions.Clear; +//begin +// inherited Clear; // DUH! +//end; { TCompilationTool } @@ -5049,10 +2548,10 @@ end; function TCompilationTool.IsEqual(Params: TCompilationTool ): boolean; begin - Result:= (Command=Params.Command) - and ScanForFPCMessages=Params.ScanForFPCMessages - and ScanForMakeMessages=Params.ScanForMakeMessages - and ShowAllMessages=Params.ShowAllMessages + Result:= (Command=Params.Command) + and (ScanForFPCMessages=Params.ScanForFPCMessages) + and (ScanForMakeMessages=Params.ScanForMakeMessages) + and (ShowAllMessages=Params.ShowAllMessages) ; end; diff --git a/ide/compileroptionsdlg.pp b/ide/compileroptionsdlg.pp new file mode 100644 index 0000000000..03a259619f --- /dev/null +++ b/ide/compileroptionsdlg.pp @@ -0,0 +1,2786 @@ +{ /*************************************************************************** + compileroptionsdlg.pp - Lazarus IDE unit + --------------------------------------- + Compiler options form sets the switches for the project + file for the FPC compiler. + + + Initial Revision : Sat May 10 23:15:32 CST 1999 + + + ***************************************************************************/ + + *************************************************************************** + * * + * 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. * + * * + *************************************************************************** +} +unit CompilerOptionsDlg; + +{$mode objfpc}{$H+} + +interface + +uses + Forms, Classes, SysUtils, ComCtrls, Buttons, StdCtrls, ExtCtrls, Graphics, + LResources, FileCtrl, Dialogs, Controls, GraphType, + PathEditorDlg, LazarusIDEStrConsts, IDEOptionDefs, LazConf, IDEProcs, + CompilerOptions, ShowCompilerOpts, Project, PackageDefs; + +type + { Compiler options form } + + TfrmCompilerOptions = class(TForm) + nbMain: TNotebook; + ImageList: TImageList; + + { Search Paths Controls } + PathPage: TPage; + grpOtherUnits: TGroupBox; + edtOtherUnits: TEdit; + OtherUnitsPathEditBtn: TPathEditorButton; + + grpIncludeFiles: TGroupBox; + edtIncludeFiles: TEdit; + IncludeFilesPathEditBtn: TPathEditorButton; + + grpOtherSources: TGroupBox; + edtOtherSources: TEdit; + OtherSourcesPathEditBtn: TPathEditorButton; + + grpLibraries: TGroupBox; + edtLibraries: TEdit; + LibrariesPathEditBtn: TPathEditorButton; + + grpUnitOutputDir: TGroupBox; + edtUnitOutputDir: TEdit; + btnUnitOutputDir: TButton; + + grpDebugPath: TGroupBox; + edtDebugPath: TEdit; + DebugPathEditBtn: TPathEditorButton; + + LCLWidgetTypeRadioGroup: TRadioGroup; + + { Parsing Controls } + ParsingPage: TPage; + grpStyle: TRadioGroup; + + grpSymantecChk: TGroupBox; + chkSymD2Ext: TCheckBox; + chkSymCOper: TCheckBox; + chkSymIncludeAssertions: TCheckBox; + chkSymAllowLab: TCheckBox; + chkSymUseAnsiStrings: TCheckBox; + chkSymCPPInline: TCheckBox; + chkSymCMacros: TCheckBox; + chkSymDelphiCompat: TCheckBox; + chkSymTP7Compat: TCheckBox; + chkSymGPCCompat: TCheckBox; + chkSymConstInit: TCheckBox; + chkSymStaticKwd: TCheckBox; + + { Code Generation Controls } + CodeGenPage: TPage; + grpUnitStyle: TRadioGroup; + + grpChecks: TGroupBox; + chkChecksIO: TCheckBox; + chkChecksRange: TCheckBox; + chkChecksOverflow: TCheckBox; + chkChecksStack: TCheckBox; + + grpHeapSize: TGroupBox; + edtHeapSize: TEdit; + + grpGenerate: TGroupBox; + radGenNormal: TRadioButton; + radGenFaster: TRadioButton; + radGenSmaller: TRadioButton; + + grpTargetProc: TRadioGroup; + + grpOptimizations: TGroupBox; + chkOptVarsInReg: TCheckBox; + chkOptUncertain: TCheckBox; + radOptLevelNone: TRadioButton; + radOptLevel1: TRadioButton; + radOptLevel2: TRadioButton; + radOptLevel3: TRadioButton; + + TargetOSGroupBox: TGroupBox; + TargetOSComboBox: TComboBox; + + { Linking Controls } + LinkingPage: TPage; + grpDebugging: TGroupBox; + chkDebugGDB: TCheckBox; + chkDebugDBX: TCheckBox; + chkUseLineInfoUnit: TCheckBox; + chkUseHeaptrc: TCheckBox; + chkUseValgrind: TCheckBox; + chkGenGProfCode: TCheckBox; + chkSymbolsStrip: TCheckBox; + + grpLinkLibraries: TGroupBox; + radLibsLinkDynamic: TRadioButton; + radLibsLinkStatic: TRadioButton; + radLibsLinkSmart: TRadioButton; + + grpOptions: TGroupBox; + chkOptionsLinkOpt: TCheckBox; + edtOptionsLinkOpt: TEdit; + TargetSpecificsGrpBox: TGroupBox; + chkWin32GraphicApp: TCheckBox; + + { Messages Controls } + MsgPage: TPage; + grpVerbosity: TGroupBox; + chkErrors: TCheckBox; + chkWarnings: TCheckBox; + chkNotes: TCheckBox; + chkHints: TCheckBox; + chkGeneralInfo: TCheckBox; + chkLineNumbers: TCheckBox; + chkEverything: TCheckBox; + chkAllProcsOnError: TCheckBox; + chkDebugInfo: TCheckBox; + chkUsedFiles: TCheckBox; + chkTriedFiles: TCheckBox; + chkDefinedMacros: TCheckBox; + chkCompiledProc: TCheckBox; + chkConditionals: TCheckBox; + chkNothing: TCheckBox; + chkHintsForUnusedUnitsInMainSrc: TCheckBox; + chkFPCLogo: TCheckBox; + + grpErrorCnt: TGroupBox; + edtErrorCnt: TEdit; + + { 'Other' Controls } + OtherPage: TPage; + grpConfigFile: TGroupBox; + chkConfigFile: TCheckBox; + chkAdditionalConfigFile: TCheckBox; + edtConfigPath: TEdit; + grpCustomOptions: TGroupBox; + memCustomOptions: TMemo; + + { Inherited Options } + InheritedPage: TPage; + InhNoteLabel: TLabel; + InhTreeView: TTreeView; + InhItemMemo: TMemo; + + { Compilation } + CompilationPage: TPage; + + lblRunIfExecBefore: TLabel; + chkExecBeforeCompile: TCheckBox; + chkExecBeforeBuild: TCheckBox; + chkExecBeforeRun: TCheckBox; + + ExecuteBeforeGroupBox: TGroupBox; + ExecuteBeforeCommandLabel: TLabel; + ExecuteBeforeCommandEdit: TEdit; + ExecuteBeforeScanFPCCheckBox: TCheckBox; + ExecuteBeforeScanMakeCheckBox: TCheckBox; + ExecuteBeforeShowAllCheckBox: TCheckBox; + + lblRunIfCompiler: TLabel; + chkCompilerCompile: TCheckBox; + chkCompilerBuild: TCheckBox; + chkCompilerRun: TCheckBox; + + grpCompiler: TGroupBox; + edtCompiler: TEdit; + btnCompiler: TButton; + lblCompiler: TLabel; + + lblRunIfExecAfter: TLabel; + chkExecAfterCompile: TCheckBox; + chkExecAfterBuild: TCheckBox; + chkExecAfterRun: TCheckBox; + + ExecuteAfterGroupBox: TGroupBox; + ExecuteAfterCommandLabel: TLabel; + ExecuteAfterCommandEdit: TEdit; + ExecuteAfterScanFPCCheckBox: TCheckBox; + ExecuteAfterScanMakeCheckBox: TCheckBox; + ExecuteAfterShowAllCheckBox: TCheckBox; + + { Buttons } + btnShowOptions: TButton; + btnOK: TButton; + btnCancel: TButton; + btnCheck: TButton; + btnLoadSave: TButton; + + procedure ButtonOKClicked(Sender: TObject); + procedure ButtonCancelClicked(Sender: TObject); + procedure ButtonCheckClicked(Sender: TObject); + procedure ButtonLoadSaveClick(Sender: TObject); + procedure ButtonShowOptionsClicked(Sender: TObject); + procedure ExecuteAfterGroupBoxResize(Sender: TObject); + procedure ExecuteBeforeGroupBoxResize(Sender: TObject); + procedure grpCompilerResize(Sender: TObject); + procedure FileBrowseBtnClick(Sender: TObject); + procedure InhTreeViewSelectionChanged(Sender: TObject); + procedure InheritedPageResize(Sender: TObject); + procedure chkAdditionalConfigFileClick(Sender: TObject); + procedure PathEditBtnClick(Sender: TObject); + procedure PathEditBtnExecuted(Sender: TObject); + procedure frmCompilerOptionsClose(Sender: TObject; + var CloseAction: TCloseAction); + procedure frmCompilerOptionsResize(Sender: TObject); + private + procedure SetupSearchPathsTab(Page: integer); + procedure SetupParsingTab(Page: integer); + procedure SetupCodeGenerationTab(Page: integer); + procedure SetupLinkingTab(Page: integer); + procedure SetupMessagesTab(Page: integer); + procedure SetupOtherTab(Page: integer); + procedure SetupInheritedTab(Page: integer); + procedure SetupCompilationTab(Page: integer); + procedure SetupButtonBar; + private + FOnImExportCompilerOptions: TNotifyEvent; + FOnTest: TNotifyEvent; + FReadOnly: boolean; + ImageIndexPackage: integer; + ImageIndexRequired: integer; + ImageIndexInherited: integer; + InheritedChildDatas: TList; // list of PInheritedNodeData + procedure SetReadOnly(const AValue: boolean); + procedure UpdateInheritedTab; + procedure ClearInheritedTree; + public + CompilerOpts: TBaseCompilerOptions; + + constructor Create(TheOwner: TComponent); override; + destructor Destroy; override; + + procedure GetCompilerOptions; + procedure GetCompilerOptions(SrcCompilerOptions: TBaseCompilerOptions); + procedure PutCompilerOptions; + procedure PutCompilerOptions(DestCompilerOptions: TBaseCompilerOptions); + public + property ReadOnly: boolean read FReadOnly write SetReadOnly; + property OnTest: TNotifyEvent read FOnTest write FOnTest; + property OnImExportCompilerOptions: TNotifyEvent + read FOnImExportCompilerOptions write FOnImExportCompilerOptions; + end; + + + + + +implementation + +const + XMARGIN = 5; + YMARGIN = 5; + + WCOLABEL = 90; // the with of the labels on the Compiler tab + + +type + TInheritedNodeData = record + FullText: string; + Option: TInheritedCompilerOption; + end; + PInheritedNodeData = ^TInheritedNodeData; + + + +{------------------------------------------------------------------------------} +{ TfrmCompilerOptions Constructor } +{------------------------------------------------------------------------------} +constructor TfrmCompilerOptions.Create(TheOwner: TComponent); + + procedure AddResImg(const ResName: string); + var Pixmap: TPixmap; + begin + Pixmap:=TPixmap.Create; + Pixmap.TransparentColor:=clWhite; + Pixmap.LoadFromLazarusResource(ResName); + ImageList.Add(Pixmap,nil) + end; + +var Page: integer; +begin + inherited Create(TheOwner); + Name:='CompilerOptionsDlg'; + Caption := dlgCompilerOptions; + + Position:=poScreenCenter; + IDEDialogLayoutList.ApplyLayout(Self,550,450); + + ImageList:=TImageList.Create(Self); + with ImageList do begin + Width:=17; + Height:=17; + Name:='ImageList'; + ImageIndexPackage:=Count; + AddResImg('pkg_package'); + ImageIndexRequired:=Count; + AddResImg('pkg_required'); + ImageIndexInherited:=Count; + AddResImg('pkg_inherited'); + end; + + nbMain := TNotebook.Create(Self); + nbMain.Parent := Self; + nbMain.Height := Height - 50; + nbMain.Width := Width - 4; + nbMain.Top := 0; + nbMain.Left := 0; + + // Add the pages + with nbMain.Pages do begin + Add(dlgSearchPaths); + Add(dlgCOParsing); + Add(dlgCodeGeneration); + Add(dlgCOLinking); + Add(dlgCOMessages); + Add(dlgCOOther); + Add(dlgCOInherited); + Add(dlgCOCompilation); + end; + nbMain.PageIndex:=0; + + Page:=0; + + { Search Paths Tab } + SetupSearchPathsTab(Page); + inc(Page); + + { Parsing Tab } + SetupParsingTab(Page); + inc(Page); + + { Code Generation Tab } + SetupCodeGenerationTab(Page); + inc(Page); + + { Linking Tab } + SetupLinkingTab(Page); + inc(Page); + + { Messages Tab } + SetupMessagesTab(Page); + inc(Page); + + { Other Tab } + SetupOtherTab(Page); + inc(Page); + + { Inherited Tab } + SetupInheritedTab(Page); + inc(Page); + + { Compilation Tab } + SetupCompilationTab(Page); + inc(Page); + + { Bottom Buttons } + SetupButtonBar; + + + //TODO: MWE: Are these still needed ? + // can't we just use a Doxxx portected method ? + OnResize:=@frmCompilerOptionsResize; + OnResize(Self); + OnClose:=@frmCompilerOptionsClose; +end; + +{------------------------------------------------------------------------------} +{ TfrmCompilerOptions Destructor } +{------------------------------------------------------------------------------} +destructor TfrmCompilerOptions.Destroy; +begin + ClearInheritedTree; + inherited Destroy; +end; + +procedure TfrmCompilerOptions.GetCompilerOptions; +begin + GetCompilerOptions(nil); +end; + +{------------------------------------------------------------------------------} +{ TfrmCompilerOptions ButtonOKClicked } +{------------------------------------------------------------------------------} +procedure TfrmCompilerOptions.ButtonOKClicked(Sender: TObject); +begin + // Accept any changes + Assert(False, 'Trace:Accept compiler options changes'); + + { Save the options and hide the dialog } + PutCompilerOptions; + ModalResult:=mrOk; +end; + +{------------------------------------------------------------------------------} +{ TfrmCompilerOptions ButtonCancelClicked } +{------------------------------------------------------------------------------} +procedure TfrmCompilerOptions.ButtonCancelClicked(Sender: TObject); +begin + // Cancel any changes + Assert(False, 'Trace:Cancel compiler options changes'); + + ModalResult:=mrCancel; +end; + +{------------------------------------------------------------------------------ + TfrmCompilerOptions ButtonCheckClicked +------------------------------------------------------------------------------} +procedure TfrmCompilerOptions.ButtonCheckClicked(Sender: TObject); +begin + // Apply any changes and test + PutCompilerOptions; + if Assigned(OnTest) then OnTest(CompilerOpts); +end; + +{------------------------------------------------------------------------------ + 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.ButtonShowOptionsClicked(Sender: TObject); +var + CurOptions: String; +begin + // Test MakeOptionsString function + PutCompilerOptions; + CurOptions := CompilerOpts.MakeOptionsString(nil, + CompilerOpts.DefaultMakeOptionsFlags); + WriteLn('CompilerOpts.MakeOptionsString: ' + CurOptions); + ShowCompilerOptionsDialog(CurOptions); +end; + +procedure TfrmCompilerOptions.ExecuteAfterGroupBoxResize(Sender: TObject); +var + m, w: Integer; +begin + w := ExecuteAfterGroupBox.ClientWidth; + m := w div 2; + + with ExecuteAfterCommandEdit do + Width := w - Left - XMARGIN; + + with ExecuteAfterScanFPCCheckBox do + Width := m - Left; + + with ExecuteAfterScanMakeCheckBox do + SetBounds(m, Top, m - XMARGIN, Height); + + with ExecuteAfterShowAllCheckBox do + Width := m - Left; + + chkExecAfterBuild.Left := (chkExecAfterCompile.Left + m) div 2; + chkExecAfterRun.Left := m; + +end; + +procedure TfrmCompilerOptions.ExecuteBeforeGroupBoxResize(Sender: TObject); +var + m, w: Integer; +begin + w := ExecuteBeforeGroupBox.ClientWidth; + m := w div 2; + + with ExecuteBeforeCommandEdit do + Width := w - Left - XMARGIN; + + with ExecuteBeforeScanFPCCheckBox do + Width := m - Left; + + with ExecuteBeforeScanMakeCheckBox do + SetBounds(m, Top, m - XMARGIN, Height); + + with ExecuteBeforeShowAllCheckBox do + Width := m - Left; + + chkExecBeforeBuild.Left := (chkExecBeforeCompile.Left + m) div 2; + chkExecBeforeRun.Left := m; +end; + +procedure TfrmCompilerOptions.grpCompilerResize(Sender: TObject); +var + m, w: Integer; +begin + w := ExecuteBeforeGroupBox.ClientWidth; + m := w div 2; + + btnCompiler.Left := w - btnCompiler.Width - XMARGIN; + edtCompiler.Width := btnCompiler.Left - edtCompiler.Left - 2; + + chkCompilerBuild.Left := (chkCompilerCompile.Left + m) div 2; + chkCompilerRun.Left := m; +end; + +procedure TfrmCompilerOptions.FileBrowseBtnClick(Sender: TObject); +var + OpenDialog: TOpenDialog; + DefaultFilename: String; + NewFilename: String; +begin + OpenDialog:=TOpenDialog.Create(Self); + try + if Sender=btnCompiler then begin + OpenDialog.Title:=Format(lisBrowseForCompiler, [GetDefaultCompilerFilename + ]); + DefaultFilename:=FindDefaultCompilerPath; + OpenDialog.Options:=OpenDialog.Options+[ofFileMustExist]; + end else if Sender=btnUnitOutputDir then begin + OpenDialog.Title:=lisUnitOutputDirectory; + DefaultFilename:=''; + OpenDialog.Options:=OpenDialog.Options+[ofPathMustExist]; + end else + exit; + OpenDialog.Filename:=ExtractFilename(DefaultFilename); + if DefaultFilename<>'' then + OpenDialog.InitialDir:=ExtractFilePath(DefaultFilename); + if OpenDialog.Execute then begin + NewFilename:=TrimFilename(OpenDialog.Filename); + if CompilerOpts<>nil then + NewFilename:=CompilerOpts.ShortenPath(NewFilename,false); + if Sender=btnCompiler then begin + edtCompiler.Text:=OpenDialog.Filename; + end else if Sender=btnUnitOutputDir then begin + edtUnitOutputDir.Text:=OpenDialog.Filename; + end; + end; + finally + OpenDialog.Free; + end; +end; + +procedure TfrmCompilerOptions.InhTreeViewSelectionChanged(Sender: TObject); +var + ANode: TTreeNode; + ChildData: PInheritedNodeData; + sl: TStringList; +begin + ANode:=InhTreeView.Selected; + if (ANode=nil) or (ANode.Data=nil) then begin + InhItemMemo.Lines.Text:=lisSelectANode; + end else begin + ChildData:=PInheritedNodeData(ANode.Data); + if ChildData^.Option in icoAllSearchPaths then begin + sl:=SplitString(ChildData^.FullText,';'); + InhItemMemo.Lines.Assign(sl); + sl.Free; + end else + InhItemMemo.Lines.Text:=ChildData^.FullText; + end; +end; + +{------------------------------------------------------------------------------ + procedure TfrmCompilerOptions.InheritedPageResize(Sender: TObject); +------------------------------------------------------------------------------} +procedure TfrmCompilerOptions.InheritedPageResize(Sender: TObject); +var + y: Integer; +begin + InhNoteLabel.SetBounds(3,3,InheritedPage.ClientWidth-6,20); + InhTreeView.SetBounds(0,25, + InheritedPage.ClientWidth,InheritedPage.ClientHeight-100); + y:=InhTreeView.Top+InhTreeView.Height; + InhItemMemo.SetBounds(0,y, + InheritedPage.ClientWidth,InheritedPage.ClientHeight-y); +end; + +procedure TfrmCompilerOptions.ButtonLoadSaveClick(Sender: TObject); +begin + if Assigned(OnImExportCompilerOptions) then + OnImExportCompilerOptions(Self); +end; + +{------------------------------------------------------------------------------ + TfrmCompilerOptions GetCompilerOptions +------------------------------------------------------------------------------} +procedure TfrmCompilerOptions.GetCompilerOptions( + SrcCompilerOptions: TBaseCompilerOptions); +var + i: integer; + EnabledLinkerOpts: Boolean; + Options: TBaseCompilerOptions; +begin + if SrcCompilerOptions<>nil then + Options:=SrcCompilerOptions + else + Options:=CompilerOpts; + + EnabledLinkerOpts:=Options.NeedsLinkerOpts; + + { Get the compiler options and apply them to the dialog } + + // paths + edtOtherUnits.Text := Options.OtherUnitFiles; + edtIncludeFiles.Text := Options.IncludeFiles; + edtLibraries.Text := Options.Libraries; + grpLibraries.Enabled:=EnabledLinkerOpts; + edtOtherSources.Text := Options.SrcPath; + edtUnitOutputDir.Text := Options.UnitOutputDirectory; + edtDebugPath.Text := Options.DebugPath; + + i:=LCLWidgetTypeRadioGroup.Items.IndexOf(Options.LCLWidgetType); + if i<0 then i:=0; + LCLWidgetTypeRadioGroup.ItemIndex:=i; + i:=TargetOSComboBox.Items.IndexOf(Options.TargetOS); + if i<0 then i:=0; // 0 is default + TargetOSComboBox.ItemIndex:=i; + TargetOSComboBox.Text:=Options.TargetOS; + + // parsing + if (Options.AssemblerStyle in [1,2,3]) then + grpStyle.ItemIndex:=Options.AssemblerStyle + else + grpStyle.ItemIndex:=0; + + chkSymD2Ext.Checked := Options.D2Extensions; + chkSymCOper.Checked := Options.CStyleOperators; + chkSymIncludeAssertions.Checked := Options.IncludeAssertionCode; + chkSymAllowLab.Checked := Options.AllowLabel; + chkSymCPPInline.Checked := Options.CPPInline; + chkSymCMacros.Checked := Options.CStyleMacros; + chkSymTP7Compat.Checked := Options.TPCompatible; + chkSymConstInit.Checked := Options.InitConstructor; + chkSymStaticKwd.Checked := Options.StaticKeyword; + chkSymDelphiCompat.Checked := Options.DelphiCompat; + chkSymUseAnsiStrings.Checked := Options.UseAnsiStrings; + chkSymGPCCompat.Checked := Options.GPCCompat; + + // code generation + grpUnitStyle.ItemIndex:=Options.UnitStyle; + + chkChecksIO.Checked := Options.IOChecks; + chkChecksRange.Checked := Options.RangeChecks; + chkChecksOverflow.Checked := Options.OverflowChecks; + chkChecksStack.Checked := Options.StackChecks; + + grpHeapSize.Enabled:=EnabledLinkerOpts; + edtHeapSize.Text := IntToStr(Options.HeapSize); + + case Options.Generate of + cgcNormalCode: radGenNormal.Checked := true; + cgcFasterCode: radGenFaster.Checked := true; + cgcSmallerCode: radGenSmaller.Checked := true; + end; + + case Options.TargetProcessor of + 1..3: grpTargetProc.ItemIndex:=Options.TargetProcessor; + else + grpTargetProc.ItemIndex:=0; + end; + + chkOptVarsInReg.Checked := Options.VariablesInRegisters; + chkOptUncertain.Checked := Options.UncertainOptimizations; + + case Options.OptimizationLevel of + 1: radOptLevel1.Checked := true; + 2: radOptLevel2.Checked := true; + 3: radOptLevel3.Checked := true; + else + radOptLevelNone.Checked := true; + end; + + // linking + chkDebugGDB.Checked := Options.GenerateDebugInfo; + chkDebugDBX.Checked := Options.GenerateDebugDBX; + chkUseLineInfoUnit.Checked := Options.UseLineInfoUnit; + chkUseHeaptrc.Checked := Options.UseHeaptrc; + chkUseValgrind.Checked := Options.UseValgrind; + chkGenGProfCode.Checked := Options.GenGProfCode; + chkSymbolsStrip.Checked := Options.StripSymbols; + chkSymbolsStrip.Enabled:=EnabledLinkerOpts; + + case Options.LinkStyle of + 1: radLibsLinkDynamic.Checked := true; + 2: radLibsLinkStatic.Checked := true; + 3: radLibsLinkSmart.Checked := true; + end; + grpLinkLibraries.Enabled:=EnabledLinkerOpts; + + chkOptionsLinkOpt.Checked := Options.PassLinkerOptions; + edtOptionsLinkOpt.Text := Options.LinkerOptions; + chkWin32GraphicApp.Checked := Options.Win32GraphicApp; + chkWin32GraphicApp.Enabled:=EnabledLinkerOpts; + grpOptions.Enabled:=EnabledLinkerOpts; + + // messages + chkErrors.Checked := Options.ShowErrors; + chkWarnings.Checked := Options.ShowWarn; + chkNotes.Checked := Options.ShowNotes; + chkHints.Checked := Options.ShowHints; + chkGeneralInfo.Checked := Options.ShowGenInfo; + chkLineNumbers.Checked := Options.ShowLineNum; + chkEverything.Checked := Options.ShowAll; + chkAllProcsOnError.Checked := Options.ShowAllProcsOnError; + chkDebugInfo.Checked := Options.ShowDebugInfo; + chkUsedFiles.Checked := Options.ShowUsedFiles; + chkTriedFiles.Checked := Options.ShowTriedFiles; + chkDefinedMacros.Checked := Options.ShowDefMacros; + chkCompiledProc.Checked := Options.ShowCompProc; + chkConditionals.Checked := Options.ShowCond; + chkNothing.Checked := Options.ShowNothing; + chkHintsForUnusedUnitsInMainSrc.Checked := + Options.ShowHintsForUnusedUnitsInMainSrc; + + chkFPCLogo.Checked := Options.WriteFPCLogo; + + // other + chkConfigFile.Checked := not Options.DontUseConfigFile; + chkAdditionalConfigFile.Checked := Options.AdditionalConfigFile; + edtConfigPath.Enabled := chkAdditionalConfigFile.Checked; + edtConfigPath.Text := Options.ConfigFilePath; + memCustomOptions.Text := Options.CustomOptions; + + edtErrorCnt.Text := IntToStr(Options.StopAfterErrCount); + + // inherited tab + UpdateInheritedTab; + + // compilation + ExecuteBeforeCommandEdit.Text:=Options.ExecuteBefore.Command; + ExecuteBeforeScanFPCCheckBox.Checked:=Options.ExecuteBefore.ScanForFPCMessages; + ExecuteBeforeScanMakeCheckBox.Checked:= + Options.ExecuteBefore.ScanForMakeMessages; + ExecuteBeforeShowAllCheckBox.Checked:=Options.ExecuteBefore.ShowAllMessages; + if Options.ExecuteBefore is TProjectCompilationTool + then with TProjectCompilationTool(Options.ExecuteBefore) do begin + chkExecBeforeCompile.Checked := crCompile in CompileReasons; + chkExecBeforeBuild.Checked := crBuild in CompileReasons; + chkExecBeforeRun.Checked := crRun in CompileReasons; + lblRunIfExecBefore.Visible := True; + chkExecBeforeCompile.Visible := True; + chkExecBeforeBuild.Visible := True; + chkExecBeforeRun.Visible := True; + end + else begin + lblRunIfExecBefore.Visible := False; + chkExecBeforeCompile.Visible := False; + chkExecBeforeBuild.Visible := False; + chkExecBeforeRun.Visible := False; + end; + + edtCompiler.Text := Options.CompilerPath; + if Options is TProjectCompilerOptions + then with TProjectCompilerOptions(Options) do begin + chkCompilerCompile.Checked := crCompile in CompileReasons; + chkCompilerBuild.Checked := crBuild in CompileReasons; + chkCompilerRun.Checked := crRun in CompileReasons; + lblRunIfCompiler.Visible := True; + chkCompilerCompile.Visible := True; + chkCompilerCompile.Caption := lisCOCallOnCompile; + chkCompilerCompile.Width := WCOLABEL; + chkCompilerBuild.Visible := True; + chkCompilerRun.Visible := True; + end + else if Options is TPkgCompilerOptions + then begin + lblRunIfCompiler.Visible := False; + chkCompilerCompile.Visible := True; + chkCompilerCompile.Caption := lisCOSkipCallingCompiler; + chkCompilerCompile.Width := 2 * WCOLABEL; + chkCompilerBuild.Visible := False; + chkCompilerRun.Visible := False; + end + else begin + lblRunIfCompiler.Visible := False; + chkCompilerCompile.Visible := False; + chkCompilerBuild.Visible := False; + chkCompilerRun.Visible := False; + end; + + ExecuteAfterCommandEdit.Text:=Options.ExecuteAfter.Command; + ExecuteAfterScanFPCCheckBox.Checked:=Options.ExecuteAfter.ScanForFPCMessages; + ExecuteAfterScanMakeCheckBox.Checked:=Options.ExecuteAfter.ScanForMakeMessages; + ExecuteAfterShowAllCheckBox.Checked:=Options.ExecuteAfter.ShowAllMessages; + if Options.ExecuteAfter is TProjectCompilationTool + then with TProjectCompilationTool(Options.ExecuteAfter) do begin + chkExecAfterCompile.Checked := crCompile in CompileReasons; + chkExecAfterBuild.Checked := crBuild in CompileReasons; + chkExecAfterRun.Checked := crRun in CompileReasons; + lblRunIfExecAfter.Visible := True; + chkExecAfterCompile.Visible := True; + chkExecAfterBuild.Visible := True; + chkExecAfterRun.Visible := True; + end + else begin + lblRunIfExecAfter.Visible := False; + chkExecAfterCompile.Visible := False; + chkExecAfterBuild.Visible := False; + chkExecAfterRun.Visible := False; + end; +end; + +{------------------------------------------------------------------------------} +{ TfrmCompilerOptions PutCompilerOptions } +{------------------------------------------------------------------------------} +procedure TfrmCompilerOptions.PutCompilerOptions( + DestCompilerOptions: TBaseCompilerOptions); + + function MakeCompileReasons(const ACompile, ABuild, ARun: TCheckBox): TCompileReasons; + begin + Result := []; + if ACompile.Checked then Include(Result, crCompile); + if ABuild.Checked then Include(Result, crBuild); + if ARun.Checked then Include(Result, crRun); + end; + +var + code: LongInt; + hs: LongInt; + i: integer; + OldCompOpts: TBaseCompilerOptions; + NewTargetOS: String; + Options: TBaseCompilerOptions; +begin + { Put the compiler options into the TCompilerOptions class to be saved } + if DestCompilerOptions<>nil then + Options:=DestCompilerOptions + else + Options:=CompilerOpts; + if ReadOnly and (Options=CompilerOpts) then exit; + + OldCompOpts := TBaseCompilerOptionsClass(Options.ClassType).Create(nil); + OldCompOpts.Assign(Options); + + // paths + Options.IncludeFiles := edtIncludeFiles.Text; + Options.Libraries := edtLibraries.Text; + Options.OtherUnitFiles := edtOtherUnits.Text; + Options.SrcPath := edtOtherSources.Text; + Options.UnitOutputDirectory := edtUnitOutputDir.Text; + Options.DebugPath := edtDebugPath.Text; + + i:=LCLWidgetTypeRadioGroup.Itemindex; + if i<=0 then + Options.LCLWidgetType:='' + else + Options.LCLWidgetType:= LCLWidgetTypeRadioGroup.Items[i]; + + // parsing; + Options.AssemblerStyle := grpStyle.ItemIndex; + Options.D2Extensions := chkSymD2Ext.Checked; + Options.CStyleOperators := chkSymCOper.Checked; + Options.IncludeAssertionCode := chkSymIncludeAssertions.Checked; + Options.AllowLabel := chkSymAllowLab.Checked; + Options.CPPInline := chkSymCPPInline.Checked; + Options.CStyleMacros := chkSymCMacros.Checked; + Options.TPCompatible := chkSymTP7Compat.Checked; + Options.InitConstructor := chkSymConstInit.Checked; + Options.StaticKeyword := chkSymStaticKwd.Checked; + Options.DelphiCompat := chkSymDelphiCompat.Checked; + Options.UseAnsiStrings := chkSymUseAnsiStrings.Checked; + Options.GPCCompat := chkSymGPCCompat.Checked; + + // code generation + Options.UnitStyle := grpUnitStyle.ItemIndex; + + Options.IOChecks := chkChecksIO.Checked; + Options.RangeChecks := chkChecksRange.Checked; + Options.OverflowChecks := chkChecksOverflow.Checked; + Options.StackChecks := chkChecksStack.Checked; + + Val(edtHeapSize.Text, hs, code); + if (code <> 0) then + Options.HeapSize := 0 + else + Options.HeapSize := hs; + + if (radGenFaster.Checked) then + Options.Generate := cgcFasterCode + else if (radGenSmaller.Checked) then + Options.Generate := cgcSmallerCode + else + Options.Generate := cgcNormalCode; + + Options.TargetProcessor := grpTargetProc.ItemIndex; + + Options.VariablesInRegisters := chkOptVarsInReg.Checked; + Options.UncertainOptimizations := chkOptUncertain.Checked; + + if (radOptLevel1.Checked) then + Options.OptimizationLevel := 1 + else if (radOptLevel2.Checked) then + Options.OptimizationLevel := 2 + else if (radOptLevel3.Checked) then + Options.OptimizationLevel := 3 + else + Options.OptimizationLevel := 0; + + // linking + Options.GenerateDebugInfo := chkDebugGDB.Checked; + Options.GenerateDebugDBX := chkDebugDBX.Checked; + Options.UseLineInfoUnit := chkUseLineInfoUnit.Checked; + Options.UseHeaptrc := chkUseHeaptrc.Checked; + Options.UseValgrind := chkUseValgrind.Checked; + Options.GenGProfCode := chkGenGProfCode.Checked; + Options.StripSymbols := chkSymbolsStrip.Checked; + + Options.PassLinkerOptions := chkOptionsLinkOpt.Checked; + Options.LinkerOptions := edtOptionsLinkOpt.Text; + Options.Win32GraphicApp := chkWin32GraphicApp.Checked; + + if (radLibsLinkDynamic.Checked) then + Options.LinkStyle := 1 + else if (radLibsLinkStatic.Checked) then + Options.LinkStyle := 2 + else if (radLibsLinkSmart.Checked) then + Options.LinkStyle := 3 + else + Options.LinkStyle := 1; + + // messages + Options.ShowErrors := chkErrors.Checked; + Options.ShowWarn := chkWarnings.Checked; + Options.ShowNotes := chkNotes.Checked; + Options.ShowHints := chkHints.Checked; + Options.ShowGenInfo := chkGeneralInfo.Checked; + Options.ShowLineNum := chkLineNumbers.Checked; + Options.ShowAll := chkEverything.Checked; + Options.ShowAllProcsOnError := chkAllProcsOnError.Checked; + Options.ShowDebugInfo := chkDebugInfo.Checked; + Options.ShowUsedFiles := chkUsedFiles.Checked; + Options.ShowTriedFiles := chkTriedFiles.Checked; + Options.ShowDefMacros := chkDefinedMacros.Checked; + Options.ShowCompProc := chkCompiledProc.Checked; + Options.ShowCond := chkConditionals.Checked; + Options.ShowNothing := chkNothing.Checked; + Options.ShowHintsForUnusedUnitsInMainSrc := + chkHintsForUnusedUnitsInMainSrc.Checked; + + Options.WriteFPCLogo := chkFPCLogo.Checked; + + // other + Options.DontUseConfigFile := not chkConfigFile.Checked; + Options.AdditionalConfigFile := chkAdditionalConfigFile.Checked; + Options.ConfigFilePath := edtConfigPath.Text; + Options.CustomOptions := memCustomOptions.Text; + + Options.StopAfterErrCount := StrToIntDef(edtErrorCnt.Text,1); + + + NewTargetOS:=TargetOSComboBox.Text; + if TargetOSComboBox.Items.IndexOf(NewTargetOS)<=0 then + NewTargetOS:=''; + Options.TargetOS:=NewTargetOS; + + // compilation + Options.ExecuteBefore.Command := ExecuteBeforeCommandEdit.Text; + Options.ExecuteBefore.ScanForFPCMessages := + ExecuteBeforeScanFPCCheckBox.Checked; + Options.ExecuteBefore.ScanForMakeMessages := + ExecuteBeforeScanMakeCheckBox.Checked; + Options.ExecuteBefore.ShowAllMessages:=ExecuteBeforeShowAllCheckBox.Checked; + if Options.ExecuteBefore is TProjectCompilationTool + then begin + TProjectCompilationTool(Options.ExecuteBefore).CompileReasons := MakeCompileReasons( + chkExecBeforeCompile, + chkExecBeforeBuild, + chkExecBeforeRun + ); + end; + + Options.CompilerPath := edtCompiler.Text; + if Options is TProjectCompilerOptions + then begin + TProjectCompilerOptions(Options).CompileReasons := MakeCompileReasons( + chkCompilerCompile, + chkCompilerBuild, + chkCompilerRun + ); + end + else if Options is TPkgCompilerOptions + then begin + TPkgCompilerOptions(Options).SkipCompiler := chkCompilerCompile.Checked; + end; + + Options.ExecuteAfter.Command := ExecuteAfterCommandEdit.Text; + Options.ExecuteAfter.ScanForFPCMessages := + ExecuteAfterScanFPCCheckBox.Checked; + Options.ExecuteAfter.ScanForMakeMessages := + ExecuteAfterScanMakeCheckBox.Checked; + Options.ExecuteAfter.ShowAllMessages:=ExecuteAfterShowAllCheckBox.Checked; + if Options.ExecuteAfter is TProjectCompilationTool + then begin + TProjectCompilationTool(Options.ExecuteAfter).CompileReasons := MakeCompileReasons( + chkExecAfterCompile, + chkExecAfterBuild, + chkExecAfterRun + ); + end; + + // check for change and save + if not OldCompOpts.IsEqual(Options) + then Options.Modified:=true; + OldCompOpts.Free; +end; + +procedure TfrmCompilerOptions.PutCompilerOptions; +begin + PutCompilerOptions(nil); +end; + +procedure TfrmCompilerOptions.UpdateInheritedTab; +var + OptionsList: TList; + i: Integer; + AncestorOptions: TAdditionalCompilerOptions; + AncestorNode: TTreeNode; + + procedure AddChildNode(const NewNodeName, Value: string; + Option: TInheritedCompilerOption); + var + VisibleValue: String; + ChildNode: TTreeNode; + ChildData: PInheritedNodeData; + begin + if Value='' then exit; + New(ChildData); + ChildData^.FullText:=Value; + ChildData^.Option:=Option; + if InheritedChildDatas=nil then InheritedChildDatas:=TList.Create; + InheritedChildDatas.Add(ChildData); + + if length(Value)>100 then + VisibleValue:=copy(Value,1,100)+'[...]' + else + VisibleValue:=Value; + ChildNode:=InhTreeView.Items.AddChildObject(AncestorNode, + NewNodeName+' = "'+VisibleValue+'"',ChildData); + ChildNode.ImageIndex:=ImageIndexRequired; + ChildNode.SelectedIndex:=ChildNode.ImageIndex; + end; + +begin + OptionsList:=nil; + CompilerOpts.GetInheritedCompilerOptions(OptionsList); + InhTreeView.BeginUpdate; + ClearInheritedTree; + if OptionsList<>nil then begin + // add All node + AncestorNode:=InhTreeView.Items.Add(nil,'All inherited options'); + AncestorNode.ImageIndex:=ImageIndexInherited; + AncestorNode.SelectedIndex:=AncestorNode.ImageIndex; + with CompilerOpts do begin + AddChildNode('unit path', + GetInheritedOption(icoUnitPath,true),icoUnitPath); + AddChildNode('include path', + GetInheritedOption(icoIncludePath,true),icoIncludePath); + AddChildNode('object path', + GetInheritedOption(icoObjectPath,true),icoObjectPath); + AddChildNode('library path', + GetInheritedOption(icoLibraryPath,true),icoLibraryPath); + AddChildNode('linker options',GetInheritedOption(icoLinkerOptions,true), + icoLinkerOptions); + AddChildNode('custom options',GetInheritedOption(icoCustomOptions,true), + icoCustomOptions); + end; + AncestorNode.Expanded:=true; + // add detail nodes + for i:=0 to OptionsList.Count-1 do begin + AncestorOptions:=TAdditionalCompilerOptions(OptionsList[i]); + AncestorNode:=InhTreeView.Items.Add(nil,''); + AncestorNode.Text:=AncestorOptions.GetOwnerName; + AncestorNode.ImageIndex:=ImageIndexPackage; + AncestorNode.SelectedIndex:=AncestorNode.ImageIndex; + with AncestorOptions.ParsedOpts do begin + AddChildNode(lisunitPath, + CreateRelativeSearchPath(GetParsedValue(pcosUnitPath), + CompilerOpts.BaseDirectory),icoUnitPath); + AddChildNode(lisincludePath, + CreateRelativeSearchPath(GetParsedValue(pcosIncludePath), + CompilerOpts.BaseDirectory),icoIncludePath); + AddChildNode(lisobjectPath, + CreateRelativeSearchPath(GetParsedValue(pcosObjectPath), + CompilerOpts.BaseDirectory),icoObjectPath); + AddChildNode(lislibraryPath, + CreateRelativeSearchPath(GetParsedValue(pcosLibraryPath), + CompilerOpts.BaseDirectory),icoLibraryPath); + AddChildNode(lislinkerOptions, GetParsedValue(pcosLinkerOptions), + icoLinkerOptions); + AddChildNode(liscustomOptions, GetParsedValue(pcosCustomOptions), + icoCustomOptions); + end; + AncestorNode.Expanded:=true; + end; + OptionsList.Free; + end else begin + InhTreeView.Items.Add(nil, lisNoCompilerOptionsInherited); + end; + InhTreeView.EndUpdate; +end; + +procedure TfrmCompilerOptions.ClearInheritedTree; +var + i: Integer; + ChildData: PInheritedNodeData; +begin + InhTreeView.BeginUpdate; + // dispose all child data + if InheritedChildDatas<>nil then begin + for i:=0 to InheritedChildDatas.Count-1 do begin + ChildData:=PInheritedNodeData(InheritedChildDatas[i]); + Dispose(ChildData); + end; + InheritedChildDatas.Free; + InheritedChildDatas:=nil; + end; + InhTreeView.Items.Clear; + InhTreeView.EndUpdate; +end; + +{------------------------------------------------------------------------------ + TfrmCompilerOptions SetupParsingTab +------------------------------------------------------------------------------} +procedure TfrmCompilerOptions.SetupParsingTab(Page: integer); +var + y: Integer; + yDiff: Integer; +begin + // Setup the Parsing Tab + ParsingPage:=nbMain.Page[Page]; + + grpStyle := TRadioGroup.Create(Self); + with grpStyle do + begin + Parent := ParsingPage; + Top := 5; + Left := 5; + Height := 42; + Width := 400; + Caption := dlgCOStyle+' (-r)'; + with Items do begin + BeginUpdate; + Items.Add('Default'); + Items.Add('Intel'); + Items.Add('AT&T'); + Items.Add('direct'); + EndUpdate; + end; + Columns:=4; + end; + + yDiff:=22; + + grpSymantecChk := TGroupBox.Create(Self); + with grpSymantecChk do + begin + Parent := ParsingPage; + Top := grpStyle.Top+grpStyle.Height+5; + Left := grpStyle.Left; + Height := 25+12*yDiff; + Width := Self.ClientWidth-28; + Caption := dlgSymantecChecking; + end; + + y:=2; + + chkSymD2Ext := TCheckBox.Create(Self); + with chkSymD2Ext do + begin + Parent := grpSymantecChk; + Caption := dlgDelphi2Ext+' (-S2)'; + Top := y; + Left := 5; + Width := Parent.ClientWidth-20; + end; + + inc(y,yDiff); + chkSymCOper := TCheckBox.Create(Self); + with chkSymCOper do + begin + Parent := grpSymantecChk; + Caption := dlgCOCOps+' (-Sc)'; + Top := y; + Left := 5; + Width := Parent.ClientWidth-20; + end; + + inc(y,yDiff); + chkSymIncludeAssertions := TCheckBox.Create(Self); + with chkSymIncludeAssertions do + begin + Parent := grpSymantecChk; + Caption := dlgAssertCode+' (-Sa)'; + Top := y; + Left := 5; + Width := Parent.ClientWidth-20; + end; + + inc(y,yDiff); + chkSymAllowLab := TCheckBox.Create(Self); + with chkSymAllowLab do + begin + Parent := grpSymantecChk; + Caption := dlgLabelGoto+' (-Sg)'; + Top := y; + Left := 5; + Width := Parent.ClientWidth-20; + end; + + inc(y,yDiff); + chkSymCPPInline := TCheckBox.Create(Self); + with chkSymCPPInline do + begin + Parent := grpSymantecChk; + Caption := dlgCppInline+' (-Si)'; + Top := y; + Left := 5; + Width := Parent.ClientWidth-20; + end; + + inc(y,yDiff); + chkSymCMacros := TCheckBox.Create(Self); + with chkSymCMacros do + begin + Parent := grpSymantecChk; + Caption := dlgCMacro+' (-Sm)'; + Top := y; + Left := 5; + Width := Parent.ClientWidth-20; + end; + + inc(y,yDiff); + chkSymTP7Compat := TCheckBox.Create(Self); + with chkSymTP7Compat do + begin + Parent := grpSymantecChk; + Caption := dlgBP7Cptb+' (-So)'; + Top := y; + Left := 5; + Width := Parent.ClientWidth-20; + end; + + inc(y,yDiff); + chkSymConstInit := TCheckBox.Create(Self); + with chkSymConstInit do + begin + Parent := grpSymantecChk; + Caption := dlgInitDoneOnly+' (-Ss)'; + Top := y; + Left := 5; + Width := Parent.ClientWidth-20; + end; + + inc(y,yDiff); + chkSymStaticKwd := TCheckBox.Create(Self); + with chkSymStaticKwd do + begin + Parent := grpSymantecChk; + Caption := dlgStaticKeyword+' (-St)'; + Top := y; + Left := 5; + Width := Parent.ClientWidth-20; + end; + + inc(y,yDiff); + chkSymDelphiCompat := TCheckBox.Create(Self); + with chkSymDelphiCompat do + begin + Parent := grpSymantecChk; + Caption := dlgDeplhiComp+' (-Sd)'; + Top := y; + Left := 5; + Width := Parent.ClientWidth-20; + end; + + inc(y,yDiff); + chkSymUseAnsiStrings := TCheckBox.Create(Self); + with chkSymUseAnsiStrings do + begin + Parent := grpSymantecChk; + Caption := dlgCOAnsiStr+' (-Sh)'; + Top := y; + Left := 5; + Width := Parent.ClientWidth-20; + end; + + inc(y,yDiff); + chkSymGPCCompat := TCheckBox.Create(Self); + with chkSymGPCCompat do + begin + Parent := grpSymantecChk; + Caption := dlgGPCComp+' (-Sp)'; + Top := y; + Left := 5; + Width := Parent.ClientWidth-20; + end; +end; + + +{------------------------------------------------------------------------------} +{ TfrmCompilerOptions SetupCodeGenerationTab } +{------------------------------------------------------------------------------} +procedure TfrmCompilerOptions.SetupCodeGenerationTab(Page: integer); +var + w: Integer; +begin + // Setup the Code Generation Tab + CodeGenPage:=nbMain.Page[Page]; + + grpUnitStyle := TRadioGroup.Create(Self); + with grpUnitStyle do + begin + Parent := CodeGenPage; + Top := 5; + Left := 5; + Height := 80; + Width := 150; + Caption := dlgCOUnitStyle; + with Items do begin + Add(dlgStatic+' (none)'); + Add(dlgDynamic+' (-CD)'); + Add(dlgCOSmart+' (-CS)'); + end; + end; + + {------------------------------------------------------------} + grpChecks := TGroupBox.Create(Self); + with grpChecks do + begin + Parent := CodeGenPage; + Top := 5; + Left := grpUnitStyle.Left + grpUnitStyle.Width + 10; + Height := 80; + Width := 210; + Caption := dlgCOChecks; + end; + + chkChecksIO := TCheckBox.Create(Self); + with chkChecksIO do + begin + Parent := grpChecks; + Caption := 'I/O (-Ci)'; + Top := 2; + Left := 2; + Width := 100; + end; + + chkChecksRange := TCheckBox.Create(Self); + with chkChecksRange do + begin + Parent := grpChecks; + Caption := dlgCORange+' (-Cr)'; + Top := 2; + Left := 102; + Width := 100; + end; + + chkChecksOverflow := TCheckBox.Create(Self); + with chkChecksOverflow do + begin + Parent := grpChecks; + Caption := dlgCOOverflow+' (-Co)'; + Top := 27; + Left := 2; + Width := 100; + end; + + chkChecksStack := TCheckBox.Create(Self); + with chkChecksStack do + begin + Parent := grpChecks; + Caption := dlgCOStack+' (-Cs)'; + Top := 27; + Left := 102; + Width := 100; + end; + + {------------------------------------------------------------} + + grpHeapSize := TGroupBox.Create(Self); + with grpHeapSize do + begin + Parent := CodeGenPage; + Top := 10; + Left := grpChecks.Left + grpChecks.Width + 10; + Height := 55; + Width := 100; + Caption := dlgHeapSize +' (-Ch):'; + end; + + edtHeapSize := TEdit.Create(grpHeapSize); + with edtHeapSize do + begin + Parent := grpHeapSize; + Caption := dlgHeapSize; + Top := 8; + Left := 5; + Height := 23; + Width := 65; + Text := ''; + end; + + {------------------------------------------------------------} + + grpGenerate := TGroupBox.Create(Self); + with grpGenerate do + begin + Parent := CodeGenPage; + Top := grpUnitStyle.Top + grpUnitStyle.Height + 6; + Left := 10; + Height := 90; + Width := 150; + Caption := dlgCOGenerate; + end; + + radGenNormal := TRadioButton.Create(grpGenerate); + with radGenNormal do + begin + Parent := grpGenerate; + Top := 5; + Left := 5; + Width := 140; + Caption := dlgCONormal+' (none)'; + end; + + radGenFaster := TRadioButton.Create(grpGenerate); + with radGenFaster do + begin + Parent := grpGenerate; + Top := 28; + Left := 5; + Width := 140; + Caption := dlgCOFast+' (-OG)'; + end; + + radGenSmaller := TRadioButton.Create(grpGenerate); + with radGenSmaller do + begin + Parent := grpGenerate; + Top := 51; + Left := 5; + Width := 140; + Caption := dlgCOSmaller+' (-Og)'; + end; + + + {------------------------------------------------------------} + + grpTargetProc := TRadioGroup.Create(Self); + with grpTargetProc do + begin + Parent := CodeGenPage; + Top := grpGenerate.Top; + Left := grpGenerate.Left + grpGenerate.Width + 10; + Height := 90; + Width := 300; + Caption := dlgTargetProc; + with Items do begin + Add('default (none)'); + Add('386/486 (-Op1)'); + Add('Pentium/Pentium MMX (-Op2)'); + Add('Pentium Pro/Pentium II/C6x86/K6 (-Op3)'); + end; + end; + + {------------------------------------------------------------} + + grpOptimizations := TGroupBox.Create(Self); + with grpOptimizations do + begin + Parent := CodeGenPage; + Top := grpTargetProc.Top + grpTargetProc.Height + 6; + Left := 10; + Height := 150; + Width := 360; + Caption := dlgOptimiz; + end; + + w:=(grpOptimizations.Width-10); + radOptLevelNone := TRadioButton.Create(grpOptimizations); + with radOptLevelNone do + begin + Parent := grpOptimizations; + Caption := dlgLevelNoneOpt+' (none)'; + Top := 5; + Left := 5; + Width := w; + end; + + radOptLevel1 := TRadioButton.Create(grpOptimizations); + with radOptLevel1 do + begin + Parent := grpOptimizations; + Caption := dlgLevel1Opt+' (-O1)'; + Top := 26; + Left := 5; + Width := w; + end; + + radOptLevel2 := TRadioButton.Create(grpOptimizations); + with radOptLevel2 do + begin + Parent := grpOptimizations; + Caption := dlgLevel2Opt+' (-O2)'; + Top := 47; + Left := 5; + Width := w; + end; + + radOptLevel3 := TRadioButton.Create(grpOptimizations); + with radOptLevel3 do + begin + Parent := grpOptimizations; + Caption := dlgLevel3Opt+' (-O3)'; + Top := 68; + Left := 5; + Width := w; + end; + + chkOptVarsInReg := TCheckBox.Create(Self); + with chkOptVarsInReg do + begin + Parent := grpOptimizations; + Caption := dlgCOKeepVarsReg+' (-Or)'; + Top := 89; + Left := 5; + Width := w; + end; + + chkOptUncertain := TCheckBox.Create(Self); + with chkOptUncertain do + begin + Parent := grpOptimizations; + Caption := dlgUncertOpt+' (-Ou)'; + Top := 110; + Left := 5; + Width := w; + end; + + {-----------------------------------------------------} + + TargetOSGroupBox:=TGroupBox.Create(Self); + with TargetOSGroupBox do begin + Name:='TargetOSGroupBox'; + Parent := CodeGenPage; + Left := grpOptimizations.Left+grpOptimizations.Width+5; + Top:=grpOptimizations.Top; + Width:=150; + Height:=45; + Caption:=dlgTargetOS+' (-T)'; + end; + + TargetOSComboBox:=TComboBox.Create(Self); + with TargetOSComboBox do begin + Name:='TargetOSComboBox'; + Parent := TargetOSGroupBox; + Align:=alTop; + with Items do begin + Add('('+rsiwpDefault+')'); + Add('Darwin'); + Add('FreeBSD'); + Add('Linux'); + Add('NetBSD'); + Add('OpenBSD'); + Add('Win32'); + end; + ItemIndex:=0; + end; +end; + +{------------------------------------------------------------------------------ + TfrmCompilerOptions SetupLinkingTab +------------------------------------------------------------------------------} +procedure TfrmCompilerOptions.SetupLinkingTab(Page: integer); +begin + // Setup the Linking Tab + LinkingPage:=nbMain.Page[Page]; + + grpDebugging := TGroupBox.Create(Self); + with grpDebugging do + begin + Parent := LinkingPage; + Top := 10; + Left := 10; + Height := 172; + Width := Self.ClientWidth-28; + Caption := dlgCODebugging; + end; + + chkDebugGDB := TCheckBox.Create(Self); + with chkDebugGDB do + begin + Parent := grpDebugging; + Caption := dlgCOGDB+' (-g)'; + Top := 6; + Left := 8; + Width := 360; + end; + + chkDebugDBX := TCheckBox.Create(Self); + with chkDebugDBX do + begin + Parent := grpDebugging; + Caption := dlgCODBX+' (-gd)'; + Top := 27; + Left := 8; + Width := 360; + end; + + chkUseLineInfoUnit := TCheckBox.Create(Self); + with chkUseLineInfoUnit do + begin + Parent := grpDebugging; + Caption := dlgLNumsBct+' (-gl)'; + Top := 48; + Left := 8; + Width := 360; + end; + + chkUseHeaptrc := TCheckBox.Create(Self); + with chkUseHeaptrc do + begin + Parent := grpDebugging; + Caption := dlgCOHeaptrc+' (-gh)'; + Top := 69; + Left := 8; + Width := 360; + end; + + chkUseValgrind := TCheckBox.Create(Self); + with chkUseValgrind do + begin + Parent := grpDebugging; + Caption := dlgCOValgrind+' (-gv)'; + Top := 90; + Left := 8; + Width := 360; + end; + + chkGenGProfCode := TCheckBox.Create(Self); + with chkGenGProfCode do + begin + Parent := grpDebugging; + Caption := dlgGPROF+' (-pg)'; + Top := 111; + Left := 8; + Width := 360; + end; + + chkSymbolsStrip := TCheckBox.Create(Self); + with chkSymbolsStrip do + begin + Parent := grpDebugging; + Caption := dlgCOStrip+' (-Xs)'; + Top := 132; + Left := 8; + Width := 360; + end; + + {------------------------------------------------------------} + + grpLinkLibraries := TGroupBox.Create(Self); + with grpLinkLibraries do + begin + Parent := LinkingPage; + Top := grpDebugging.Top + grpDebugging.Height + 10; + Left := 10; + Height := 91; + Width := (Self.ClientWidth-30) div 2; + Caption := dlgLinkLibraries; + end; + + radLibsLinkDynamic := TRadioButton.Create(Self); + with radLibsLinkDynamic do + begin + Parent := grpLinkLibraries; + Caption := dlgLinkDinLibs+' (-XD)'; + Top := 6; + Left := 8; + Height := 22; + Width := Parent.Width-10; + end; + + radLibsLinkStatic := TRadioButton.Create(Self); + with radLibsLinkStatic do + begin + Parent := grpLinkLibraries; + Caption := dlgLinkStatLibs+' (-XS)'; + Top := 27; + Left := 8; + Height := 22; + Width := Parent.Width-10; + end; + + radLibsLinkSmart := TRadioButton.Create(Self); + with radLibsLinkSmart do + begin + Parent := grpLinkLibraries; + Caption := dlgLinkSmart+' (-XX -CX)'; + Top := 48; + Left := 8; + Height := 22; + Width := Parent.Width-10; + end; + + {------------------------------------------------------------} + + TargetSpecificsGrpBox := TGroupBox.Create(Self); + with TargetSpecificsGrpBox do begin + Parent := LinkingPage; + Top := grpLinkLibraries.Top; + Left := grpLinkLibraries.Left+grpLinkLibraries.Width+10; + Height := 50; + Width := (Self.ClientWidth-30) div 2; + Caption := lisCOTargetOSSpecificOptions; + end; + + chkWin32GraphicApp := TCheckBox.Create(Self); + with chkWin32GraphicApp do + begin + Parent := TargetSpecificsGrpBox; + Caption := 'Win32 gui application (-WG)'; + Top := 5; + Left := 2; + Height := 22; + Width := Parent.Width-10; + end; + + {------------------------------------------------------------} + + grpOptions := TGroupBox.Create(Self); + with grpOptions do + begin + Parent := LinkingPage; + Top := grpLinkLibraries.Top + grpLinkLibraries.Height + 10; + Left := 10; + Height := 75; + Width := (Self.ClientWidth-20); + Caption := dlgCOOpts+' (-k)'; + end; + + chkOptionsLinkOpt := TCheckBox.Create(Self); + with chkOptionsLinkOpt do + begin + Parent := grpOptions; + Caption := dlgPassOptsLinker; + Top := 6; + Left := 8; + Width := 330; + end; + + edtOptionsLinkOpt := TEdit.Create(grpOptions); + with edtOptionsLinkOpt do + begin + Parent := grpOptions; + Top := 27; + Left := 8; + Height := 23; + Width := Parent.ClientWidth-20; + Text := ''; + end; +end; + +{------------------------------------------------------------------------------} +{ TfrmCompilerOptions SetupMessagesTab } +{------------------------------------------------------------------------------} +procedure TfrmCompilerOptions.SetupMessagesTab(Page: integer); +begin + // Setup the Messages Tab + MsgPage:=nbMain.Page[Page]; + + grpVerbosity := TGroupBox.Create(Self); + with grpVerbosity do + begin + Parent := MsgPage; + Top := 10; + Left := 10; + Height := 212; + Width := Self.ClientWidth-28; + Caption := dlgVerbosity; + end; + + chkErrors := TCheckBox.Create(Self); + with chkErrors do + begin + Parent := grpVerbosity; + Caption := dlgCOShowErr+' (-ve)'; + Top := 6; + Left := 8; + Width := (grpVerbosity.ClientWidth div 2)-12; + end; + + chkWarnings := TCheckBox.Create(Self); + with chkWarnings do + begin + Parent := grpVerbosity; + Caption := dlgShowWarnings+' (-vw)'; + Top := 27; + Left := chkErrors.Left; + Height := chkErrors.Height; + Width := chkErrors.Width; + end; + + chkNotes := TCheckBox.Create(Self); + with chkNotes do + begin + Parent := grpVerbosity; + Caption := dlgShowNotes+' (-vn)'; + Top := 48; + Left := chkErrors.Left; + Height := chkErrors.Height; + Width := chkErrors.Width; + end; + + chkHints := TCheckBox.Create(Self); + with chkHints do + begin + Parent := grpVerbosity; + Caption := dlgShowHint+' (-vh)'; + Top := 69; + Left := chkErrors.Left; + Height := chkErrors.Height; + Width := chkErrors.Width; + end; + + chkGeneralInfo := TCheckBox.Create(Self); + with chkGeneralInfo do + begin + Parent := grpVerbosity; + Caption := dlgShowGeneralInfo+' (-vi)'; + Top := 90; + Left := chkErrors.Left; + Height := chkErrors.Height; + Width := chkErrors.Width; + end; + + chkLineNumbers := TCheckBox.Create(Self); + with chkLineNumbers do + begin + Parent := grpVerbosity; + Caption := dlgShowLineNumbers+' (-vl)'; + Top := 111; + Left := chkErrors.Left; + Height := chkErrors.Height; + Width := chkErrors.Width; + end; + + chkAllProcsOnError := TCheckBox.Create(Self); + with chkAllProcsOnError do + begin + Parent := grpVerbosity; + Caption := dlgShowProcsError+' (-vb)'; + Top := 132; + Left := chkErrors.Left; + Height := chkErrors.Height; + Width := chkErrors.Width; + end; + + chkEverything := TCheckBox.Create(Self); + with chkEverything do + begin + Parent := grpVerbosity; + Caption := dlgShowEverything+' (-va)'; + Top := 153; + Left := chkErrors.Left; + Height := chkErrors.Height; + Width := chkErrors.Width; + end; + + chkDebugInfo := TCheckBox.Create(Self); + with chkDebugInfo do + begin + Parent := grpVerbosity; + Caption := dlgShowDebugInfo+' (-vd)'; + Top := 6; + Left := (grpVerbosity.ClientWidth div 2)+4; + Width := (grpVerbosity.ClientWidth div 2)-12; + end; + + chkUsedFiles := TCheckBox.Create(Self); + with chkUsedFiles do + begin + Parent := grpVerbosity; + Caption := dlgShowUsedFiles+' (-vu)'; + Top := 27; + Left := chkDebugInfo.Left; + Height := chkDebugInfo.Height; + Width := chkDebugInfo.Width; + end; + + chkTriedFiles := TCheckBox.Create(Self); + with chkTriedFiles do + begin + Parent := grpVerbosity; + Caption := dlgShowTriedFiles+' (-vt)'; + Top := 48; + Left := chkDebugInfo.Left; + Height := chkDebugInfo.Height; + Width := chkDebugInfo.Width; + end; + + chkDefinedMacros := TCheckBox.Create(Self); + with chkDefinedMacros do + begin + Parent := grpVerbosity; + Caption := dlgShowDefinedMacros+' (-vm)'; + Top := 69; + Left := chkDebugInfo.Left; + Height := chkDebugInfo.Height; + Width := chkDebugInfo.Width; + end; + + chkCompiledProc := TCheckBox.Create(Self); + with chkCompiledProc do + begin + Parent := grpVerbosity; + Caption := dlgShowCompiledProcedures+' (-vp)'; + Top := 90; + Left := chkDebugInfo.Left; + Height := chkDebugInfo.Height; + Width := chkDebugInfo.Width; + end; + + chkConditionals := TCheckBox.Create(Self); + with chkConditionals do + begin + Parent := grpVerbosity; + Caption := dlgShowConditionals+' (-vc)'; + Top := 111; + Left := chkDebugInfo.Left; + Height := chkDebugInfo.Height; + Width := chkDebugInfo.Width; + end; + + chkNothing := TCheckBox.Create(Self); + with chkNothing do + begin + Parent := grpVerbosity; + Caption := dlgShowNothing+' (-v0)'; + Top := 132; + Left := chkDebugInfo.Left; + Height := chkDebugInfo.Height; + Width := chkDebugInfo.Width; + end; + + chkFPCLogo := TCheckBox.Create(Self); + with chkFPCLogo do + begin + Parent := grpVerbosity; + Caption := dlgWriteFPCLogo+' (-l)'; + Top := 153; + Left := chkDebugInfo.Left; + Height := chkDebugInfo.Height; + Width := chkDebugInfo.Width; + end; + + chkHintsForUnusedUnitsInMainSrc := TCheckBox.Create(Self); + with chkHintsForUnusedUnitsInMainSrc do + begin + Parent := grpVerbosity; + Caption := dlgHintsUnused+' (none)'; + Top := 174; + Left := ChkErrors.Left; + Height := ChkErrors.Height; + Width := chkDebugInfo.Width*2; + end; + + {------------------------------------------------------------} + grpErrorCnt := TGroupBox.Create(Self); + with grpErrorCnt do + begin + Parent := MsgPage; + Top := grpVerbosity.Top + grpVerbosity.Height + 10; + Left := 10; + Height := 50; + Width := 200; + Caption := dlgStopAfterNrErr+' (-Se)'; + end; + + edtErrorCnt := TEdit.Create(grpErrorCnt); + with edtErrorCnt do + begin + Parent := grpErrorCnt; + Top := 6; + Left := 8; + Height := 23; + Width := grpErrorCnt.ClientWidth-2*Left-4; + Text := ''; + end; +end; + +procedure TfrmCompilerOptions.SetupOtherTab(Page: integer); +begin + {------------------------------------------------------------} + OtherPage:=nbMain.Page[Page]; + + grpConfigFile := TGroupBox.Create(Self); + with grpConfigFile do + begin + Parent := OtherPage; + Top := 10; + Left := 10; + Height := 95; + Width := Self.ClientWidth-28; + Caption := dlgConfigFiles; + end; + + chkConfigFile := TCheckBox.Create(Self); + with chkConfigFile do + begin + Parent := grpConfigFile; + Caption := dlgUseFpcCfg+' (none, not is -n)'; + Top := 6; + Left := 8; + Width := 330; + end; + + chkAdditionalConfigFile := TCheckBox.Create(Self); + with chkAdditionalConfigFile do + begin + Parent := grpConfigFile; + Caption := dlgUseAdditionalConfig+' (@)'; + Top := 27; + Left := 8; + Width := 330; + OnClick:=@chkAdditionalConfigFileClick; + end; + + edtConfigPath := TEdit.Create(grpConfigFile); + with edtConfigPath do + begin + Parent := grpConfigFile; + Top := 48; + Left := 8; + Height := 23; + Width := 330; + Text := ''; + end; + + grpCustomOptions := TGroupBox.Create(Self); + with grpCustomOptions do begin + Name:='grpCustomOptions'; + Parent := OtherPage; + Left:=grpConfigFile.Left; + Top:=grpConfigFile.Top+grpConfigFile.Height+10; + Width:=grpConfigFile.Width; + Height:=200; + Caption:=lisCustomOptions2; + end; + + memCustomOptions := TMemo.Create(Self); + with memCustomOptions do begin + Name:='memCustomOptions'; + Parent:=grpCustomOptions; + Align:=alClient; + end; +end; + +{------------------------------------------------------------------------------ + procedure TfrmCompilerOptions.SetupInheritedTab(Page: integer); +------------------------------------------------------------------------------} +procedure TfrmCompilerOptions.SetupInheritedTab(Page: integer); +begin + InheritedPage:=nbMain.Page[Page]; + InheritedPage.OnResize:=@InheritedPageResize; + + InhNoteLabel:=TLabel.Create(Self); + with InhNoteLabel do begin + Name:='InhNoteLabel'; + Parent:=InheritedPage; + Caption:=lisAdditionalCompilerOptionsInheritedFromPackages; + end; + + InhTreeView:=TTreeView.Create(Self); + with InhTreeView do begin + Name:='InhTreeView'; + Parent:=InheritedPage; + Options:=Options+[tvoReadOnly, tvoRightClickSelect, tvoShowRoot, + tvoKeepCollapsedNodes]; + Images:=ImageList; + OnSelectionChanged:=@InhTreeViewSelectionChanged; + end; + + InhItemMemo:=TMemo.Create(Self); + with InhItemMemo do begin + Name:='InhItemMemo'; + Parent:=InheritedPage; + ReadOnly:=true; + WordWrap:=true; + ScrollBars:=ssAutoVertical; + Text:=lisSelectANode; + end; +end; + +procedure TfrmCompilerOptions.SetupCompilationTab(Page: integer); +// the real edit widht is calculated in the groupbox resize +// here the controls are given initial sizes to avoid jumpy controls + + function CreateGroupHead(const AParent: TWinControl; + var ALabel: TLabel; var ACheck1, ACheck2, ACheck3: TCheckBox): Integer; + begin + ALabel := TLabel.Create(Self); + ALabel.Parent := AParent; + ALabel.Caption := lisCOCallOn; + ALabel.Top := 3; + ALabel.Left := XMARGIN; + ALabel.Width := WCOLABEL; + + ACheck1 := TCheckBox.Create(Self); + ACheck1.Parent := AParent; + ACheck1.Caption := lisCOCallOnCompile; + ACheck1.Top := 0; + ACheck1.Left := XMARGIN + 1 * WCOLABEL; + ACheck1.Width := WCOLABEL; + + ACheck2 := TCheckBox.Create(Self); + ACheck2.Parent := AParent; + ACheck2.Caption := lisCOCallOnBuild; + ACheck2.Top := 0; + ACheck2.Left := XMARGIN + 2 * WCOLABEL; + ACheck2.Width := WCOLABEL; + + ACheck3 := TCheckBox.Create(Self); + ACheck3.Parent := AParent; + ACheck3.Caption := lisCOCallOnRun; + ACheck3.Top := 0; + ACheck3.Left := XMARGIN + 3 * WCOLABEL; + ACheck3.Width := WCOLABEL; + + Result := ACheck1.Height + YMARGIN; + end; + +var + y: Integer; // Top of groups + w: Integer; // Width of groups + cy: Integer; // Top of controls + cm: Integer; // Mid for controls +begin + CompilationPage := nbMain.Page[Page]; + y := YMARGIN; + w := ClientWidth - 2 * XMARGIN; + cm := w div 2 - 2 * XMARGIN; + + {------------------------------------------------------------} + + ExecuteBeforeGroupBox:=TGroupBox.Create(Self); + with ExecuteBeforeGroupBox do + begin + Name := 'ExecuteBeforeGroupBox'; + Parent := CompilationPage; + SetBounds(XMARGIN, y, w, 125); + Caption := lisCOExecuteBefore; + OnResize := @ExecuteBeforeGroupBoxResize; + Inc(y, Height + YMARGIN); + end; + + cy := CreateGroupHead(ExecuteBeforeGroupBox, + lblRunIfExecBefore, + chkExecBeforeCompile, + chkExecBeforeBuild, + chkExecBeforeRun + ); + + ExecuteBeforeCommandLabel:=TLabel.Create(Self); + with ExecuteBeforeCommandLabel do begin + Name:='ExecuteBeforeCommandLabel'; + Parent:=ExecuteBeforeGroupBox; + Caption:=lisCOCommand; + SetBounds(XMARGIN, cy + 2, WCOLABEL, Height); +// Inc(cy, Height + YMARGIN); + end; + + ExecuteBeforeCommandEdit:=TEdit.Create(Self); + with ExecuteBeforeCommandEdit do begin + Name:='ExecuteBeforeCommandEdit'; + Parent:=ExecuteBeforeGroupBox; + Text:=''; + SetBounds(XMARGIN + WCOLABEL, cy, w - 2 * XMARGIN - WCOLABEL, Height); + inc(cy, Height+YMARGIN); + end; + + ExecuteBeforeScanFPCCheckBox:=TCheckBox.Create(Self); + with ExecuteBeforeScanFPCCheckBox do begin + Name:='ExecuteBeforeScanFPCCheckBox'; + Parent:=ExecuteBeforeGroupBox; + Caption:=lisCOScanForFPCMessages; + SetBounds(XMARGIN, cy, cm, Height); + end; + + ExecuteBeforeScanMakeCheckBox:=TCheckBox.Create(Self); + with ExecuteBeforeScanMakeCheckBox do begin + Name:='ExecuteBeforeScanMakeCheckBox'; + Parent:=ExecuteBeforeGroupBox; + Caption:=lisCOScanForMakeMessages; + SetBounds(XMARGIN + cm, cy, cm, Height); + inc(cy, Height); + end; + + ExecuteBeforeShowAllCheckBox:=TCheckBox.Create(Self); + with ExecuteBeforeShowAllCheckBox do begin + Name:='ExecuteBeforeShowAllCheckBox'; + Parent:=ExecuteBeforeGroupBox; + Caption:=lisCOShowAllMessages; + SetBounds(XMARGIN, cy, cm, Height); + end; + + {------------------------------------------------------------} + + grpCompiler := TGroupBox.Create(Self); + with grpCompiler do + begin + Name := 'grpCompiler'; + Parent := CompilationPage; + SetBounds(XMARGIN, y, w, 80); + Caption := lisCompiler; + OnResize := @grpCompilerResize; + Inc(y, Height + YMARGIN); + end; + + cy := CreateGroupHead(grpCompiler, + lblRunIfCompiler, + chkCompilerCompile, + chkCompilerBuild, + chkCompilerRun + ); + chkCompilerCompile.Checked := True; + chkCompilerBuild.Checked := True; + chkCompilerRun.Checked := True; + + lblCompiler := TLabel.Create(grpCompiler); + with lblCompiler do + begin + Name := 'lblCompiler'; + Parent := grpCompiler; + SetBounds(XMARGIN, cy, WCOLABEL, Height); + Caption := lisToFPCPath; +// Inc(cy, YMARGIN + Height); + end; + + edtCompiler := TEdit.Create(grpCompiler); + with edtCompiler do + begin + Name := 'edtCompiler'; + Parent := grpCompiler; + SetBounds(XMARGIN + WCOLABEL, cy, w - 2 * XMARGIN - WCOLABEL - 28, Height); + Text := ''; + inc(cy, Height+YMARGIN); + end; + + btnCompiler := TButton.Create(Self); + with btnCompiler do + begin + Name := 'btnCompiler'; + Parent := grpCompiler; + Caption:='...'; + OnClick:=@FileBrowseBtnClick; + end; + with edtCompiler do // <- note here we set differnt bounds that the with + btnCompiler.SetBounds(Left+Width+3, Top, 25, Height); + + {------------------------------------------------------------} + + ExecuteAfterGroupBox:=TGroupBox.Create(Self); + with ExecuteAfterGroupBox do begin + Name := 'ExecuteAfterGroupBox'; + Parent := CompilationPage; + SetBounds(XMARGIN, y, w, 125); + Caption := lisCOExecuteAfter; + OnResize := @ExecuteAfterGroupBoxResize; + Inc(y, Height + YMARGIN); + end; + + cy := CreateGroupHead(ExecuteAfterGroupBox, + lblRunIfExecAfter, + chkExecAfterCompile, + chkExecAfterBuild, + chkExecAfterRun + ); + + ExecuteAfterCommandLabel:=TLabel.Create(Self); + with ExecuteAfterCommandLabel do begin + Name:='ExecuteAfterCommandLabel'; + Parent:=ExecuteAfterGroupBox; + Caption:=lisCOCommand; + SetBounds(XMARGIN, cy + 2, WCOLABEL, Height); +// inc(cy, Height+YMARGIN); + end; + + ExecuteAfterCommandEdit:=TEdit.Create(Self); + with ExecuteAfterCommandEdit do begin + Name:='ExecuteAfterCommandEdit'; + Parent:=ExecuteAfterGroupBox; + Text:=''; + SetBounds(XMARGIN + WCOLABEL, cy, w - 2 * XMARGIN - WCOLABEL, Height); + inc(cy, Height+YMARGIN); + end; + + ExecuteAfterScanFPCCheckBox:=TCheckBox.Create(Self); + with ExecuteAfterScanFPCCheckBox do begin + Name:='ExecuteAfterScanFPCCheckBox'; + Parent:=ExecuteAfterGroupBox; + Caption:=lisCOScanForFPCMessages; + SetBounds(XMARGIN, cy, cm, Height); + end; + + ExecuteAfterScanMakeCheckBox:=TCheckBox.Create(Self); + with ExecuteAfterScanMakeCheckBox do begin + Name:='ExecuteAfterScanMakeCheckBox'; + Parent:=ExecuteAfterGroupBox; + Caption:=lisCOScanForMakeMessages; + SetBounds(XMARGIN + cm, cy, cm, Height); + inc(cy, Height); + end; + + ExecuteAfterShowAllCheckBox:=TCheckBox.Create(Self); + with ExecuteAfterShowAllCheckBox do begin + Name:='ExecuteAfterShowAllCheckBox'; + Parent:=ExecuteAfterGroupBox; + Caption:=lisCOShowAllMessages; + SetBounds(XMARGIN, cy, cm, Height); + end; + +end; + +{------------------------------------------------------------------------------ + TfrmCompilerOptions SetupSearchPathsTab +------------------------------------------------------------------------------} +procedure TfrmCompilerOptions.SetupSearchPathsTab(Page: integer); +var + y: Integer; +begin + // Setup the Search Paths Tab + PathPage:=nbMain.Page[Page]; + + y:=5; + + grpOtherUnits := TGroupBox.Create(Self); + with grpOtherUnits do + begin + Parent := PathPage; + Left := 10; + Top := y; + Width := Self.ClientWidth-28; + Height := 45; + Caption := dlgOtherUnitFiles; + inc(y,Height+5); + end; + + edtOtherUnits := TEdit.Create(Self); + with edtOtherUnits do + begin + Parent := grpOtherUnits; + Left := 8; + Top := 0; + Width := Parent.ClientWidth-Left-37; + Text := ''; + end; + + OtherUnitsPathEditBtn:=TPathEditorButton.Create(Self); + with OtherUnitsPathEditBtn do begin + Name:='OtherUnitsPathEditBtn'; + Parent:=grpOtherUnits; + Left:=edtOtherUnits.Left+edtOtherUnits.Width+3; + Top:=edtOtherUnits.Top; + Width:=25; + Height:=edtOtherUnits.Height; + Caption:='...'; + OnClick:=@PathEditBtnClick; + OnExecuted:=@PathEditBtnExecuted; + end; + + + {------------------------------------------------------------} + + grpIncludeFiles := TGroupBox.Create(Self); + with grpIncludeFiles do + begin + Parent := PathPage; + Left := grpOtherUnits.Left; + Top := y; + Width := grpOtherUnits.Width; + Height := grpOtherUnits.Height; + Caption := dlgCOIncFiles; + inc(y,Height+5); + end; + + edtIncludeFiles := TEdit.Create(Self); + with edtIncludeFiles do + begin + Parent := grpIncludeFiles; + Left := edtOtherUnits.Left; + Top := edtOtherUnits.Top; + Width := Parent.ClientWidth-Left-37; + Text := ''; + end; + + IncludeFilesPathEditBtn:=TPathEditorButton.Create(Self); + with IncludeFilesPathEditBtn do begin + Name:='IncludeFilesPathEditBtn'; + Parent:=grpIncludeFiles; + Left:=edtIncludeFiles.Left+edtIncludeFiles.Width+3; + Top:=edtIncludeFiles.Top; + Width:=25; + Height:=edtIncludeFiles.Height; + Caption:='...'; + OnClick:=@PathEditBtnClick; + OnExecuted:=@PathEditBtnExecuted; + end; + + {------------------------------------------------------------} + + grpOtherSources := TGroupBox.Create(Self); + with grpOtherSources do + begin + Parent := PathPage; + Top := y; + Left := grpOtherUnits.Left; + Width := grpOtherUnits.Width; + Height := grpOtherUnits.Height; + Caption := dlgCOSources; + inc(y,Height+5); + end; + + edtOtherSources := TEdit.Create(Self); + with edtOtherSources do + begin + Parent := grpOtherSources; + Left := edtOtherUnits.Left; + Top := edtOtherUnits.Top; + Width := Parent.ClientWidth-Left-37; + Text := ''; + end; + + OtherSourcesPathEditBtn:=TPathEditorButton.Create(Self); + with OtherSourcesPathEditBtn do begin + Name:='OtherSourcesPathEditBtn'; + Parent:=grpOtherSources; + Left:=edtOtherSources.Left+edtOtherSources.Width+3; + Top:=edtOtherSources.Top; + Width:=25; + Height:=edtOtherSources.Height; + Caption:='...'; + OnClick:=@PathEditBtnClick; + OnExecuted:=@PathEditBtnExecuted; + end; + + {------------------------------------------------------------} + + grpLibraries := TGroupBox.Create(Self); + with grpLibraries do + begin + Parent := PathPage; + Top := y; + Left := grpOtherUnits.Left; + Width := grpOtherUnits.Width; + Height := grpOtherUnits.Height; + Caption := dlgCOLibraries; + inc(y,Height+5); + end; + + edtLibraries := TEdit.Create(Self); + with edtLibraries do + begin + Parent := grpLibraries; + Left := edtOtherUnits.Left; + Top := edtOtherUnits.Top; + Width := Parent.ClientWidth-Left-37; + Text := ''; + end; + + LibrariesPathEditBtn:=TPathEditorButton.Create(Self); + with LibrariesPathEditBtn do begin + Name:='LibrariesPathEditBtn'; + Parent:=grpLibraries; + Left:=edtLibraries.Left+edtLibraries.Width+3; + Top:=edtLibraries.Top; + Width:=25; + Height:=edtLibraries.Height; + Caption:='...'; + OnClick:=@PathEditBtnClick; + OnExecuted:=@PathEditBtnExecuted; + end; + + {------------------------------------------------------------} + + grpUnitOutputDir := TGroupBox.Create(Self); + with grpUnitOutputDir do + begin + Parent := PathPage; + Top := y; + Left := grpOtherUnits.Left; + Width := grpOtherUnits.Width; + Height := grpOtherUnits.Height; + Caption := dlgUnitOutp; + inc(y,Height+5); + end; + + edtUnitOutputDir := TEdit.Create(Self); + with edtUnitOutputDir do + begin + Parent := grpUnitOutputDir; + Left := edtOtherUnits.Left; + Top := edtOtherUnits.Top; + Width := Parent.ClientWidth-Left-37; + Text := ''; + end; + + btnUnitOutputDir:=TButton.Create(Self); + with btnUnitOutputDir do begin + Name:='btnUnitOutputDir'; + Parent:=grpUnitOutputDir; + Left:=edtUnitOutputDir.Left+edtUnitOutputDir.Width+3; + Top:=edtUnitOutputDir.Top; + Width:=25; + Height:=edtUnitOutputDir.Height; + Caption:='...'; + OnClick:=@FileBrowseBtnClick; + end; + + {------------------------------------------------------------} + + grpDebugPath := TGroupBox.Create(Self); + with grpDebugPath do + begin + Parent := PathPage; + Left := 10; + Top := y; + Width := Self.ClientWidth-28; + Height := 45; + Caption := dlgCODebugPath; + inc(y,Height+5); + end; + + edtDebugPath := TEdit.Create(Self); + with edtDebugPath do + begin + Parent := grpDebugPath; + Left := 8; + Top := 0; + Width := Parent.ClientWidth-Left-37; + Text := ''; + end; + + DebugPathEditBtn:=TPathEditorButton.Create(Self); + with DebugPathEditBtn do begin + Name:='DebugPathEditBtn'; + Parent:=grpDebugPath; + Left:=edtDebugPath.Left+edtDebugPath.Width+3; + Top:=edtDebugPath.Top; + Width:=25; + Height:=edtDebugPath.Height; + Caption:='...'; + OnClick:=@PathEditBtnClick; + OnExecuted:=@PathEditBtnExecuted; + end; + + + {------------------------------------------------------------} + + LCLWidgetTypeRadioGroup:=TRadioGroup.Create(Self); + with LCLWidgetTypeRadioGroup do begin + Name:='LCLWidgetTypeRadioGroup'; + Parent := PathPage; + Left := grpOtherUnits.Left; + Top:= y; + Width:=Self.ClientWidth-28; + Height:=45; + Caption:=lisLCLWidgetType+' (various)'; + with Items do begin + Add(Format(lisCOdefault, [GetDefaultLCLWidgetType])); + Add('gnome'); + Add('gtk'); + Add('gtk2'); + Add('win32'); + end; + Columns:=Items.Count; + ItemIndex:=1; + end; +end; + +{------------------------------------------------------------------------------} +{ TfrmCompilerOptions SetupButtonBar } +{------------------------------------------------------------------------------} +procedure TfrmCompilerOptions.SetupButtonBar; +begin + // Setup the Button Bar + btnOK := TButton.Create(Self); + with btnOK do + begin + Parent := Self; + Caption := 'OK'; + OnClick := @ButtonOKClicked; + end; + + btnCancel := TButton.Create(Self); + with btnCancel do + begin + Parent := Self; + Caption := dlgCancel; + OnClick := @ButtonCancelClicked; + end; + + btnShowOptions := TButton.Create(Self); + with btnShowOptions do + begin + Parent := Self; + Caption := dlgCOShowOptions; + OnClick := @ButtonShowOptionsClicked; + end; + + btnCheck := TButton.Create(Self); + with btnCheck do + begin + Parent := Self; + Caption := lisCompTest; + OnClick := @ButtonCheckClicked; + end; + + btnLoadSave := TButton.Create(Self); + with btnLoadSave do + begin + Parent := Self; + Caption := dlgCOLoadSave; + OnClick := @ButtonLoadSaveClick; + end; +end; + +procedure TfrmCompilerOptions.chkAdditionalConfigFileClick(Sender: TObject); +begin + edtConfigPath.Enabled:=chkAdditionalConfigFile.Checked; +end; + +procedure TfrmCompilerOptions.PathEditBtnClick(Sender: TObject); +var AButton: TPathEditorButton; + OldPath, Templates: string; +begin + if Sender is TPathEditorButton then begin + AButton:=TPathEditorButton(Sender); + if AButton=OtherUnitsPathEditBtn then begin + OldPath:=edtOtherUnits.Text; + Templates:=SetDirSeparators( + '$(LazarusDir)/lcl/units/$(TargetCPU)/$(TargetOS)' + +';$(LazarusDir)/lcl/units/$(TargetCPU)/$(TargetOS)/$(LCLWidgetType)' + +';$(LazarusDir)/components/units/$(TargetCPU)/$(TargetOS)' + +';$(LazarusDir)/components/custom' + +';$(LazarusDir)/packager/units/$(TargetCPU)/$(TargetOS)' + ); + end else + if AButton=IncludeFilesPathEditBtn then begin + OldPath:=edtIncludeFiles.Text; + Templates:='include'; + end else + if AButton=OtherSourcesPathEditBtn then begin + OldPath:=edtOtherSources.Text; + Templates:=SetDirSeparators( + '$(LazarusDir)/lcl' + +';$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)' + +';$(LazarusDir)/components/synedit' + +';$(LazarusDir)/components/codetools' + ); + end else + if AButton=LibrariesPathEditBtn then begin + OldPath:=edtLibraries.Text; + Templates:=SetDirSeparators('/usr/X11R6/lib;/sw/lib'); + end else + if AButton=DebugPathEditBtn then begin + OldPath:=edtDebugPath.Text; + Templates:=SetDirSeparators( + '$(LazarusDir)/lcl/include' + +';$(LazarusDir)/lcl/interfaces/$(LCLWidgetType)' + +';$(LazarusDir)/include/' + ); + end else + exit; + AButton.CurrentPathEditor.Path:=OldPath; + AButton.CurrentPathEditor.Templates:=SetDirSeparators(Templates); + end; +end; + +procedure TfrmCompilerOptions.PathEditBtnExecuted(Sender: TObject); +var AButton: TPathEditorButton; + NewPath: string; +begin + if Sender is TPathEditorButton then begin + AButton:=TPathEditorButton(Sender); + if AButton.CurrentPathEditor.ModalResult<>mrOk then exit; + NewPath:=AButton.CurrentPathEditor.Path; + if CompilerOpts<>nil then + NewPath:=CompilerOpts.ShortenPath(NewPath,false); + if AButton=OtherUnitsPathEditBtn then begin + edtOtherUnits.Text:=NewPath; + end else + if AButton=IncludeFilesPathEditBtn then begin + edtIncludeFiles.Text:=NewPath; + end else + if AButton=OtherSourcesPathEditBtn then begin + edtOtherSources.Text:=NewPath; + end else + if AButton=LibrariesPathEditBtn then begin + edtLibraries.Text:=NewPath; + end else + if AButton=DebugPathEditBtn then begin + edtDebugPath.Text:=NewPath; + end; + end; +end; + +procedure TfrmCompilerOptions.frmCompilerOptionsClose(Sender: TObject; + var CloseAction: TCloseAction); +begin + IDEDialogLayoutList.SaveLayout(Self); +end; + +procedure TfrmCompilerOptions.frmCompilerOptionsResize(Sender: TObject); +var + x: Integer; + y: Integer; +begin + with nbMain do + SetBounds(0,0,Parent.ClientWidth,Parent.ClientHeight-45); + + x:=Width - 10; + y:=Height - btnCheck.Height - 12; + + with btnLoadSave do + SetBounds(x-120,y,120,Height); + dec(x,btnLoadSave.Width+10); + + with btnCheck do + SetBounds(x-70,y,70,Height); + dec(x,btnCheck.Width+10); + + with btnShowOptions do + SetBounds(x-120,y,120,Height); + dec(x,btnShowOptions.Width+10); + + with btnCancel do + SetBounds(x-70,y,70,Height); + dec(x,btnCancel.Width+10); + + with btnOK do + SetBounds(x-70,y,70,Height); + dec(x,btnOk.Width+10); +end; + +procedure TfrmCompilerOptions.SetReadOnly(const AValue: boolean); +begin + if FReadOnly=AValue then exit; + FReadOnly:=AValue; + btnOk.Enabled:=not FReadOnly; + btnCheck.Enabled:=not FReadOnly; +end; + +end. + diff --git a/ide/debugmanager.pas b/ide/debugmanager.pas index 0a986e02ed..bd7c99172a 100644 --- a/ide/debugmanager.pas +++ b/ide/debugmanager.pas @@ -111,6 +111,7 @@ type procedure InitLocalsDlg; procedure InitCallStackDlg; + procedure FreeDebugger; protected function GetState: TDBGState; override; function GetCommands: TDBGCommands; override; @@ -127,7 +128,8 @@ type procedure DoRestoreDebuggerMarks(AnUnitInfo: TUnitInfo); override; procedure ClearDebugOutputLog; - function DoInitDebugger: TModalResult; override; + function InitDebugger: Boolean; override; + function DoPauseProject: TModalResult; override; function DoStepIntoProject: TModalResult; override; function DoStepOverProject: TModalResult; override; @@ -216,6 +218,8 @@ type procedure AssignTo(Dest: TPersistent); override; function GetValid: TValidState; override; function GetValue: String; override; + procedure SetEnabled(const AValue: Boolean); override; + procedure SetExpression(const AValue: String); override; public constructor Create(ACollection: TCollection); override; procedure ResetMaster; @@ -442,6 +446,20 @@ begin else Result := FMaster.GetValue; end; +procedure TManagedWatch.SetEnabled(const AValue: Boolean); +begin + if Enabled = AValue then Exit; + inherited SetEnabled(AValue); + if FMaster <> nil then FMaster.Enabled := AValue; +end; + +procedure TManagedWatch.SetExpression(const AValue: String); +begin + if AValue = Expression then Exit; + inherited SetExpression(AValue); + if FMaster <> nil then FMaster.Expression := AValue; +end; + constructor TManagedWatch.Create(ACollection: TCollection); begin inherited Create(ACollection); @@ -977,8 +995,8 @@ begin if OldState = dsNone then Exit; EndDebugging; - OnDebuggerChangeState(FDebugger, OldState); - DoInitDebugger; +// OnDebuggerChangeState(FDebugger, OldState); +// InitDebugger; end; procedure TDebugManager.mnuDebuggerOptionsClick(Sender: TObject); @@ -1116,21 +1134,20 @@ begin end; case FDebugger.State of - - dsError: - begin + dsError: begin WriteLN('Ooops, the debugger entered the error state'); MessageDlg(lisDebuggerError, Format(lisDebuggerErrorOoopsTheDebuggerEnteredTheErrorState, [#13#13, #13, #13#13]), mtError, [mbOK],0); end; - - dsStop: - if (OldState<>dsIdle) then begin - MessageDlg(lisExecutionStopped, - Format(lisExecutionStoppedOn, [#13#13]), - mtInformation, [mbOK],0); + dsStop: begin + if (OldState<>dsIdle) + then begin + MessageDlg(lisExecutionStopped, + Format(lisExecutionStoppedOn, [#13#13]), + mtInformation, [mbOK],0); + end; end; end; @@ -1529,17 +1546,20 @@ end; // Debugger routines //----------------------------------------------------------------------------- -function TDebugManager.DoInitDebugger: TModalResult; - procedure FreeDebugger; - var - dbg: TDebugger; - begin - dbg := FDebugger; - SetDebugger(nil); - dbg.Free; - Exclude(FManagerStates,dmsDebuggerObjectBroken); - end; +procedure TDebugManager.FreeDebugger; +var + dbg: TDebugger; +begin + dbg := FDebugger; + SetDebugger(nil); + dbg.Free; + FManagerStates := []; + + if MainIDE.ToolStatus = itDebugger + then MainIDE.ToolStatus := itNone; +end; +function TDebugManager.InitDebugger: Boolean; var LaunchingCmdLine, LaunchingApplication, LaunchingParams: String; NewWorkingDir: String; @@ -1547,19 +1567,27 @@ var begin WriteLN('[TDebugManager.DoInitDebugger] A'); - Result:=mrCancel; + Result := False; if (Project1.MainUnitID < 0) or Destroying then Exit; - LaunchingCmdLine:=MainIDE.GetRunCommandLine; - SplitCmdLine(LaunchingCmdLine,LaunchingApplication,LaunchingParams); - if (not FileExists(LaunchingApplication)) then exit; + LaunchingCmdLine := MainIDE.GetRunCommandLine; + SplitCmdLine(LaunchingCmdLine,LaunchingApplication, LaunchingParams); + if not FileIsExecutable(LaunchingApplication) + then begin + MessageDlg(lisLaunchingApplicationInvalid, + Format(lisTheLaunchingApplicationDoesNotExistsOrIsNotExecuta, ['"', + EnvironmentOptions.DebuggerFilename, '"', #13, #13, #13]), + mtError, [mbOK],0); + Exit; + end; - if not FileIsExecutable(EnvironmentOptions.DebuggerFilename) then begin + if not FileIsExecutable(EnvironmentOptions.DebuggerFilename) + then begin MessageDlg(lisDebuggerInvalid, Format(lisTheDebuggerDoesNotExistsOrIsNotExecutableSeeEnviro, ['"', EnvironmentOptions.DebuggerFilename, '"', #13, #13, #13]), - mtError,[mbCancel],0); - exit; + mtError,[mbOK],0); + Exit; end; DebuggerClass := FindDebuggerClass(EnvironmentOptions.DebuggerClass); @@ -1590,8 +1618,7 @@ begin if FDebugger = nil then begin // something went wrong - Result := mrCancel; - exit; + Exit; end; ClearDebugOutputLog; @@ -1609,8 +1636,8 @@ begin Exclude(FManagerStates,dmsInitializingDebuggerObject); if dmsInitializingDebuggerObjectFailed in FManagerStates then begin - Result:=mrCancel; - exit; + FreeDebugger; + Exit; end; end; @@ -1623,15 +1650,14 @@ begin FDebugger.WorkingDir:=NewWorkingDir; // check if debugging needs restart - if ((FDebugger=nil) or (dmsDebuggerObjectBroken in FManagerStates)) - and (MainIDE.ToolStatus=itDebugger) + // mwe: can this still happen ? + if (dmsDebuggerObjectBroken in FManagerStates) then begin - MainIDE.ToolStatus:=itNone; - Result:=mrCancel; - exit; + FreeDebugger; + Exit; end; - Result := mrOk; + Result := True; WriteLN('[TDebugManager.DoInitDebugger] END'); end; @@ -1719,6 +1745,8 @@ end; procedure TDebugManager.EndDebugging; begin if FDebugger <> nil then FDebugger.Done; + // if not already freed + FreeDebugger; end; function TDebugManager.Evaluate(const AExpression: String; @@ -1863,6 +1891,11 @@ end. { ============================================================================= $Log$ + Revision 1.72 2004/09/04 21:54:08 marc + + Added option to skip compiler step on compile, build or run + * Fixed adding of runtime watches + * Fixed runnerror reporting (correct number and location is shown) + Revision 1.71 2004/08/27 09:19:27 micha fix compile by adding braces diff --git a/ide/imexportcompileropts.lfm b/ide/imexportcompileropts.lfm index 9aa4f78352..57541b178a 100644 --- a/ide/imexportcompileropts.lfm +++ b/ide/imexportcompileropts.lfm @@ -1,91 +1,88 @@ object ImExportCompOptsDlg: TImExportCompOptsDlg - CAPTION = 'ImExportCompOptsDlg' - CLIENTHEIGHT = 235 - CLIENTWIDTH = 554 - ONCLOSE = ImExportCompOptsDlgCLOSE - ONCREATE = ImExportCompOptsDlgCREATE - HORZSCROLLBAR.PAGE = 555 - VERTSCROLLBAR.PAGE = 236 - LEFT = 316 - HEIGHT = 235 - TOP = 212 - WIDTH = 554 - object OpenRecentGroupbox: TGROUPBOX - ANCHORS = [aktop, akleft, akright, akbottom] - CAPTION = 'OpenRecentGroupbox' - CLIENTHEIGHT = 159 - CLIENTWIDTH = 532 - PARENTCTL3D = False - TABORDER = 0 - LEFT = 8 - HEIGHT = 176 - TOP = 8 - WIDTH = 536 - object RecentListbox: TLISTBOX - ALIGN = altop - ANCHORS = [aktop, akleft, akbottom] - ONCLICK = RecentListboxCLICK - ONDBLCLICK = RecentListboxDBLCLICK - TABORDER = 0 - TABSTOP = True - TOPINDEX = -1 - HEIGHT = 121 - WIDTH = 532 + Caption = 'ImExportCompOptsDlg' + ClientHeight = 235 + ClientWidth = 554 + OnClose = ImExportCompOptsDlgCLOSE + OnCreate = ImExportCompOptsDlgCREATE + PixelsPerInch = 90 + HorzScrollBar.Page = 555 + VertScrollBar.Page = 236 + Left = 316 + Height = 235 + Top = 212 + Width = 554 + object OpenRecentGroupbox: TGroupBox + Anchors = [akTop, akLeft, akRight, akBottom] + Caption = 'OpenRecentGroupbox' + ClientHeight = 159 + ClientWidth = 532 + ParentColor = True + ParentCtl3D = False + TabOrder = 0 + Left = 8 + Height = 176 + Top = 8 + Width = 536 + object RecentListbox: TListBox + Align = alTop + Anchors = [akTop, akLeft, akBottom] + ClickOnSelChange = False + OnClick = RecentListboxCLICK + OnDblClick = RecentListboxDBLCLICK + TabOrder = 0 + TopIndex = 18446744073709551615 + Height = 121 + Width = 532 end - object OpenRecentButton: TBUTTON - ANCHORS = [akleft, akbottom] - CAPTION = 'OpenRecentButton' - TABSTOP = True - TABORDER = 1 - ONCLICK = OpenRecentButtonCLICK - LEFT = 9 - HEIGHT = 25 - TOP = 129 - WIDTH = 150 + object OpenRecentButton: TButton + Anchors = [akLeft, akBottom] + Caption = 'OpenRecentButton' + OnClick = OpenRecentButtonCLICK + TabOrder = 1 + Left = 9 + Height = 25 + Top = 129 + Width = 150 end - object SaveToRecentButton: TBUTTON - ANCHORS = [akleft, akbottom] - CAPTION = 'SaveToRecentButton' - TABSTOP = True - TABORDER = 2 - ONCLICK = SaveToRecentButtonCLICK - LEFT = 182 - HEIGHT = 25 - TOP = 129 - WIDTH = 150 + object SaveToRecentButton: TButton + Anchors = [akLeft, akBottom] + Caption = 'SaveToRecentButton' + OnClick = SaveToRecentButtonCLICK + TabOrder = 2 + Left = 182 + Height = 25 + Top = 129 + Width = 150 end end - object OpenButton: TBUTTON - ANCHORS = [akleft, akbottom] - CAPTION = 'OpenButton' - TABSTOP = True - TABORDER = 1 - ONCLICK = OpenButtonCLICK - LEFT = 8 - HEIGHT = 25 - TOP = 200 - WIDTH = 167 + object OpenButton: TButton + Anchors = [akLeft, akBottom] + Caption = 'OpenButton' + OnClick = OpenButtonCLICK + TabOrder = 1 + Left = 8 + Height = 25 + Top = 200 + Width = 167 end - object CancelButton: TBUTTON - ANCHORS = [akleft, akbottom] - MODALRESULT = 2 - CAPTION = 'CancelButton' - TABSTOP = True - TABORDER = 2 - LEFT = 432 - HEIGHT = 25 - TOP = 200 - WIDTH = 110 + object CancelButton: TButton + Anchors = [akLeft, akBottom] + Caption = 'CancelButton' + ModalResult = 2 + TabOrder = 2 + Left = 432 + Height = 25 + Top = 200 + Width = 110 end - object SaveButton: TBUTTON - ANCHORS = [akleft, akbottom] - CAPTION = 'SaveButton' - TABSTOP = True - TABORDER = 3 - ONCLICK = SaveButtonCLICK - LEFT = 214 - HEIGHT = 25 - TOP = 200 - WIDTH = 167 + object SaveButton: TButton + Anchors = [akLeft, akBottom] + Caption = 'SaveButton' + OnClick = SaveButtonCLICK + TabOrder = 3 + Left = 214 + Height = 25 + Top = 200 + Width = 167 end end diff --git a/ide/imexportcompileropts.lrs b/ide/imexportcompileropts.lrs index 2c35c87b63..7271c18b23 100644 --- a/ide/imexportcompileropts.lrs +++ b/ide/imexportcompileropts.lrs @@ -1,31 +1,31 @@ { This is an automatically generated lazarus resource file } LazarusResources.Add('TImExportCompOptsDlg','FORMDATA',[ - 'TPF0'#20'TImExportCompOptsDlg'#19'ImExportCompOptsDlg'#7'CAPTION'#6#19'ImExp' - +'ortCompOptsDlg'#12'CLIENTHEIGHT'#3#235#0#11'CLIENTWIDTH'#3'*'#2#7'ONCLOSE'#7 - +#24'ImExportCompOptsDlgCLOSE'#8'ONCREATE'#7#25'ImExportCompOptsDlgCREATE'#18 - +'HORZSCROLLBAR.PAGE'#3'+'#2#18'VERTSCROLLBAR.PAGE'#3#236#0#4'LEFT'#3'<'#1#6 - +'HEIGHT'#3#235#0#3'TOP'#3#212#0#5'WIDTH'#3'*'#2#0#9'TGROUPBOX'#18'OpenRecent' - +'Groupbox'#7'ANCHORS'#11#5'aktop'#6'akleft'#7'akright'#8'akbottom'#0#7'CAPTI' - +'ON'#6#18'OpenRecentGroupbox'#12'CLIENTHEIGHT'#3#159#0#11'CLIENTWIDTH'#3#20#2 - +#11'PARENTCTL3D'#8#8'TABORDER'#2#0#4'LEFT'#2#8#6'HEIGHT'#3#176#0#3'TOP'#2#8#5 - +'WIDTH'#3#24#2#0#8'TLISTBOX'#13'RecentListbox'#5'ALIGN'#7#5'altop'#7'ANCHORS' - +#11#5'aktop'#6'akleft'#8'akbottom'#0#7'ONCLICK'#7#18'RecentListboxCLICK'#10 - +'ONDBLCLICK'#7#21'RecentListboxDBLCLICK'#8'TABORDER'#2#0#7'TABSTOP'#9#8'TOPI' - +'NDEX'#2#255#6'HEIGHT'#2'y'#5'WIDTH'#3#20#2#0#0#7'TBUTTON'#16'OpenRecentButt' - +'on'#7'ANCHORS'#11#6'akleft'#8'akbottom'#0#7'CAPTION'#6#16'OpenRecentButton' - +#7'TABSTOP'#9#8'TABORDER'#2#1#7'ONCLICK'#7#21'OpenRecentButtonCLICK'#4'LEFT' - +#2#9#6'HEIGHT'#2#25#3'TOP'#3#129#0#5'WIDTH'#3#150#0#0#0#7'TBUTTON'#18'SaveTo' - +'RecentButton'#7'ANCHORS'#11#6'akleft'#8'akbottom'#0#7'CAPTION'#6#18'SaveToR' - +'ecentButton'#7'TABSTOP'#9#8'TABORDER'#2#2#7'ONCLICK'#7#23'SaveToRecentButto' - +'nCLICK'#4'LEFT'#3#182#0#6'HEIGHT'#2#25#3'TOP'#3#129#0#5'WIDTH'#3#150#0#0#0#0 - +#7'TBUTTON'#10'OpenButton'#7'ANCHORS'#11#6'akleft'#8'akbottom'#0#7'CAPTION'#6 - +#10'OpenButton'#7'TABSTOP'#9#8'TABORDER'#2#1#7'ONCLICK'#7#15'OpenButtonCLICK' - +#4'LEFT'#2#8#6'HEIGHT'#2#25#3'TOP'#3#200#0#5'WIDTH'#3#167#0#0#0#7'TBUTTON'#12 - +'CancelButton'#7'ANCHORS'#11#6'akleft'#8'akbottom'#0#11'MODALRESULT'#2#2#7'C' - +'APTION'#6#12'CancelButton'#7'TABSTOP'#9#8'TABORDER'#2#2#4'LEFT'#3#176#1#6'H' - +'EIGHT'#2#25#3'TOP'#3#200#0#5'WIDTH'#2'n'#0#0#7'TBUTTON'#10'SaveButton'#7'AN' - +'CHORS'#11#6'akleft'#8'akbottom'#0#7'CAPTION'#6#10'SaveButton'#7'TABSTOP'#9#8 - +'TABORDER'#2#3#7'ONCLICK'#7#15'SaveButtonCLICK'#4'LEFT'#3#214#0#6'HEIGHT'#2 - +#25#3'TOP'#3#200#0#5'WIDTH'#3#167#0#0#0#0 + 'TPF0'#20'TImExportCompOptsDlg'#19'ImExportCompOptsDlg'#7'Caption'#6#19'ImExp' + +'ortCompOptsDlg'#12'ClientHeight'#3#235#0#11'ClientWidth'#3'*'#2#7'OnClose'#7 + +#24'ImExportCompOptsDlgCLOSE'#8'OnCreate'#7#25'ImExportCompOptsDlgCREATE'#13 + +'PixelsPerInch'#2'Z'#18'HorzScrollBar.Page'#3'+'#2#18'VertScrollBar.Page'#3 + +#236#0#4'Left'#3'<'#1#6'Height'#3#235#0#3'Top'#3#212#0#5'Width'#3'*'#2#0#9'T' + +'GroupBox'#18'OpenRecentGroupbox'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight' + +#8'akBottom'#0#7'Caption'#6#18'OpenRecentGroupbox'#12'ClientHeight'#3#159#0 + +#11'ClientWidth'#3#20#2#11'ParentColor'#9#11'ParentCtl3D'#8#8'TabOrder'#2#0#4 + +'Left'#2#8#6'Height'#3#176#0#3'Top'#2#8#5'Width'#3#24#2#0#8'TListBox'#13'Rec' + +'entListbox'#5'Align'#7#5'alTop'#7'Anchors'#11#5'akTop'#6'akLeft'#8'akBottom' + +#0#16'ClickOnSelChange'#8#7'OnClick'#7#18'RecentListboxCLICK'#10'OnDblClick' + +#7#21'RecentListboxDBLCLICK'#8'TabOrder'#2#0#8'TopIndex'#2#255#6'Height'#2'y' + +#5'Width'#3#20#2#0#0#7'TButton'#16'OpenRecentButton'#7'Anchors'#11#6'akLeft' + +#8'akBottom'#0#7'Caption'#6#16'OpenRecentButton'#7'OnClick'#7#21'OpenRecentB' + +'uttonCLICK'#8'TabOrder'#2#1#4'Left'#2#9#6'Height'#2#25#3'Top'#3#129#0#5'Wid' + +'th'#3#150#0#0#0#7'TButton'#18'SaveToRecentButton'#7'Anchors'#11#6'akLeft'#8 + +'akBottom'#0#7'Caption'#6#18'SaveToRecentButton'#7'OnClick'#7#23'SaveToRecen' + +'tButtonCLICK'#8'TabOrder'#2#2#4'Left'#3#182#0#6'Height'#2#25#3'Top'#3#129#0 + +#5'Width'#3#150#0#0#0#0#7'TButton'#10'OpenButton'#7'Anchors'#11#6'akLeft'#8 + +'akBottom'#0#7'Caption'#6#10'OpenButton'#7'OnClick'#7#15'OpenButtonCLICK'#8 + +'TabOrder'#2#1#4'Left'#2#8#6'Height'#2#25#3'Top'#3#200#0#5'Width'#3#167#0#0#0 + +#7'TButton'#12'CancelButton'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Caption' + +#6#12'CancelButton'#11'ModalResult'#2#2#8'TabOrder'#2#2#4'Left'#3#176#1#6'He' + +'ight'#2#25#3'Top'#3#200#0#5'Width'#2'n'#0#0#7'TButton'#10'SaveButton'#7'Anc' + +'hors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#10'SaveButton'#7'OnClick'#7#15 + +'SaveButtonCLICK'#8'TabOrder'#2#3#4'Left'#3#214#0#6'Height'#2#25#3'Top'#3#200 + +#0#5'Width'#3#167#0#0#0#0 ]); diff --git a/ide/imexportcompileropts.pas b/ide/imexportcompileropts.pas index 917e329bf2..c830b5116d 100644 --- a/ide/imexportcompileropts.pas +++ b/ide/imexportcompileropts.pas @@ -34,7 +34,7 @@ interface uses Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, Buttons, FileCtrl, Laz_XMLCfg, - LazarusIDEStrConsts, InputHistory, CompilerOptions; + LazarusIDEStrConsts, InputHistory, CompilerOptions, CompilerOptionsDlg; type TImExportCompOptsResult = ( diff --git a/ide/lazarus.pp b/ide/lazarus.pp index aebdf22b22..631571925b 100644 --- a/ide/lazarus.pp +++ b/ide/lazarus.pp @@ -55,7 +55,7 @@ uses {$IFDEF AddStaticPkgs} {$I staticpackages.inc} {$ENDIF} - MainBase; + MainBase, compileroptionsdlg; begin Application.Initialize; @@ -99,6 +99,11 @@ end. { $Log$ + Revision 1.60 2004/09/04 21:54:08 marc + + Added option to skip compiler step on compile, build or run + * Fixed adding of runtime watches + * Fixed runnerror reporting (correct number and location is shown) + Revision 1.59 2004/08/08 18:02:44 mattias splitted TMainIDE (main control instance) and TMainIDEBar (IDE menu and palette), added mainbase.pas and mainintf.pas diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 7286cd6c4c..6792606fb4 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -386,6 +386,8 @@ resourcestring +'environment options,%syou can create new projects and build them at ' +'once.%sSave project?'; lisProjectSuccessfullyBuilt = 'Project %s%s%s successfully built. :)'; + lisExecutingCommandBefore = 'Executing command befor'; + lisExecutingCommandAfter = 'Executing command after'; lisNoProgramFileSFound = 'No program file %s%s%s found.'; lisErrorInitializingProgramSErrorS = 'Error initializing program%s%s%s%s%s' +'Error: %s'; @@ -927,8 +929,13 @@ resourcestring dlgCOSources = 'Other Sources (.pp/.pas files, used only by IDE not by compiler)'; dlgCOLibraries = 'Libraries (-Fl):'; dlgCODebugPath = 'Debugger path addition (none):'; - dlgToFPCPath = 'Path To Compiler:'; + lisCompiler = 'Compiler'; + lisToFPCPath = 'Path:'; lisCOSkipCallingCompiler = 'Skip calling Compiler'; + lisCOCallOn = 'Call on:'; + lisCOCallOnCompile = 'Compile'; + lisCOCallOnBuild = 'Build'; + lisCOCallOnRun = 'Run'; lisCOExecuteAfter = 'Execute after'; lisCOExecuteBefore = 'Execute before'; lisAdditionalCompilerOptionsInheritedFromPackages = 'Additional compiler ' @@ -1818,6 +1825,12 @@ resourcestring lisTheFileWasNotFoundDoYouWantToLocateItYourself = 'The file %s%s%s%swas ' +'not found.%sDo you want to locate it yourself ?%s'; lisRunToFailed = 'Run-to failed'; + lisLaunchingApplicationInvalid = 'Launching application invalid'; + lisTheLaunchingApplicationDoesNotExistsOrIsNotExecuta = 'The launching ' + +'application %s%s%' + +'s%sdoes not exists or is not executable.%s%sSee Run -> Run parameters -> ' + +'Local'; + lisDebuggerInvalid = 'Debugger invalid'; lisTheDebuggerDoesNotExistsOrIsNotExecutableSeeEnviro = 'The debugger %s%s%' +'s%sdoes not exists or is not executable.%s%sSee Environment -> Debugger ' diff --git a/ide/main.pp b/ide/main.pp index 111b9fd154..2e001257ae 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -69,7 +69,8 @@ uses // synedit SynEditKeyCmds, // compile - Compiler, CompilerOptions, CheckCompilerOpts, ImExportCompilerOpts, + Compiler, CompilerOptions, CompilerOptionsDlg, CheckCompilerOpts, + ImExportCompilerOpts, // projects ProjectIntf, Project, ProjectDefs, NewProjectDlg, ProjectOpts, PublishProjectDlg, ProjectInspector, @@ -565,7 +566,7 @@ type function DoRemoveFromProjectDialog: TModalResult; procedure DoWarnAmbigiousFiles; function DoSaveForBuild: TModalResult; override; - function DoBuildProject(BuildAll: boolean): TModalResult; + function DoBuildProject(const AReason: TCompileReason): TModalResult; function DoAbortBuild: TModalResult; function DoInitProjectRun: TModalResult; override; function DoRunProject: TModalResult; @@ -2016,10 +2017,10 @@ begin and AnUnitInfo.BuildFileIfActive then DoBuildFile else - DoBuildProject(Command=ecBuildAll); + DoBuildProject(crCompile); end; - ecBuildAll: DoBuildProject(Command=ecBuildAll); + ecBuildAll: DoBuildProject(crBuild); ecAbortBuild: DoAbortBuild; ecRun: @@ -2548,12 +2549,12 @@ end; Procedure TMainIDE.mnuBuildProjectClicked(Sender : TObject); Begin - DoBuildProject(false); + DoBuildProject(crCompile); end; Procedure TMainIDE.mnuBuildAllProjectClicked(Sender : TObject); Begin - DoBuildProject(true); + DoBuildProject(crBuild); end; Procedure TMainIDE.mnuAbortBuildProjectClicked(Sender : TObject); @@ -2593,7 +2594,7 @@ end; procedure TMainIDE.mnuProjectCompilerSettingsClicked(Sender : TObject); var - frmCompilerOptions:TfrmCompilerOptions; + frmCompilerOptions: TfrmCompilerOptions; NewCaption: String; begin frmCompilerOptions:=TfrmCompilerOptions.Create(Application); @@ -5947,7 +5948,7 @@ begin end; end; -function TMainIDE.DoBuildProject(BuildAll: boolean): TModalResult; +function TMainIDE.DoBuildProject(const AReason: TCompileReason): TModalResult; var DefaultFilename: string; begin @@ -5981,12 +5982,16 @@ begin DoWarnAmbigiousFiles; // execute compilation tool 'Before' - Result:=DoExecuteCompilationTool(Project1.CompilerOptions.ExecuteBefore, - Project1.ProjectDirectory, - 'Executing command before'); + if (AReason in TProjectCompilationTool(Project1.CompilerOptions.ExecuteBefore).CompileReasons) + then begin + Result:=DoExecuteCompilationTool(Project1.CompilerOptions.ExecuteBefore, + Project1.ProjectDirectory, + lisExecutingCommandBefore); + end; if (Result=mrOk) - and (not Project1.CompilerOptions.SkipCompiler) then begin + and (AReason in Project1.CompilerOptions.CompileReasons) + then begin try // change tool status ToolStatus:=itBuilder; @@ -5995,7 +6000,7 @@ begin TheOutputFilter.OnReadLine:=@MessagesView.AddProgress; // compile - Result:=TheCompiler.Compile(Project1,BuildAll,DefaultFilename); + Result:=TheCompiler.Compile(Project1, AReason = crBuild, DefaultFilename); if Result<>mrOk then DoJumpToCompilerMessage(-1,true); finally @@ -6004,14 +6009,17 @@ begin end; // execute compilation tool 'After' - if Result=mrOk then begin + if (Result = mrOk) + and (AReason in TProjectCompilationTool(Project1.CompilerOptions.ExecuteAfter).CompileReasons) + then begin Result:=DoExecuteCompilationTool(Project1.CompilerOptions.ExecuteAfter, Project1.ProjectDirectory, - 'Executing command after'); + lisExecutingCommandAfter); end; // add success message - if Result=mrOk then begin + if Result=mrOk + then begin MessagesView.AddMsg( Format(lisProjectSuccessfullyBuilt, ['"', Project1.Title, '"']),''); end; @@ -6049,7 +6057,7 @@ begin then Exit; // Build project first - if DoBuildProject(false) <> mrOk + if DoBuildProject(crRun) <> mrOk then Exit; // Check project build @@ -6065,7 +6073,7 @@ begin // Setup debugger if EnvironmentOptions.DebuggerClass <> '' then begin - if (DebugBoss.DoInitDebugger <> mrOk) + if not DebugBoss.InitDebugger then Exit; end else begin @@ -10636,6 +10644,11 @@ end. { ============================================================================= $Log$ + Revision 1.766 2004/09/04 21:54:08 marc + + Added option to skip compiler step on compile, build or run + * Fixed adding of runtime watches + * Fixed runnerror reporting (correct number and location is shown) + Revision 1.765 2004/09/01 10:25:58 mattias added some project flags to start getting rid of TProjectType diff --git a/ide/project.pp b/ide/project.pp index a9cb43b208..4bf1247911 100644 --- a/ide/project.pp +++ b/ide/project.pp @@ -227,26 +227,44 @@ type //--------------------------------------------------------------------------- + { TProjectCompilationTool } + TProjectCompilationTool = class(TCompilationTool) + public + CompileReasons: TCompileReasons; + procedure Clear; override; + function IsEqual(Params: TCompilationTool): boolean; override; + procedure Assign(Src: TCompilationTool); override; + procedure LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string; + DoSwitchPathDelims: boolean); override; + procedure SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string); override; + end; + { TProjectCompilerOptions } - TProjectCompilerOptions = class(TCompilerOptions) + TProjectCompilerOptions = class(TBaseCompilerOptions) private FGlobals: TGlobalCompilerOptions; FOwnerProject: TProject; + FCompileReasons: TCompileReasons; protected + procedure LoadTheCompilerOptions(const APath: string); override; + procedure SaveTheCompilerOptions(const APath: string); override; + procedure SetTargetCPU(const AValue: string); override; procedure SetTargetOS(const AValue: string); override; - procedure Assign(CompOpts: TBaseCompilerOptions); override; procedure UpdateGlobals; virtual; public - constructor Create(TheProject: TProject); + constructor Create(const AOwner: TObject); override; destructor Destroy; override; function GetOwnerName: string; override; function GetDefaultMainSourceFileName: string; override; procedure GetInheritedCompilerOptions(var OptionsList: TList); override; + procedure Assign(CompOpts: TBaseCompilerOptions); override; + function IsEqual(CompOpts: TBaseCompilerOptions): boolean; override; public property OwnerProject: TProject read FOwnerProject; property Globals: TGlobalCompilerOptions read FGlobals; + property CompileReasons: TCompileReasons read FCompileReasons write FCompileReasons; end; @@ -2653,9 +2671,64 @@ begin AnUnitInfo.fPrev[ListType]:=nil; end; +{ TProjectCompilationTool } + +procedure TProjectCompilationTool.Clear; +begin + inherited Clear; + CompileReasons := crAll; +end; + +function TProjectCompilationTool.IsEqual(Params: TCompilationTool): boolean; +begin + Result := (Params is TProjectCompilationTool) + and (CompileReasons = TProjectCompilationTool(Params).CompileReasons) + and inherited IsEqual(Params); +end; + +procedure TProjectCompilationTool.Assign(Src: TCompilationTool); +begin + inherited Assign(Src); + if Src is TProjectCompilationTool + then begin + CompileReasons := TProjectCompilationTool(Src).CompileReasons; + end + else begin + CompileReasons := crAll; + end; +end; + +procedure TProjectCompilationTool.LoadFromXMLConfig(XMLConfig: TXMLConfig; const Path: string; DoSwitchPathDelims: boolean); +begin + inherited LoadFromXMLConfig(XMLConfig, Path, DoSwitchPathDelims); + CompileReasons := LoadXMLCompileReasons(XMLConfig, Path+'CompileReasons/'); +end; + +procedure TProjectCompilationTool.SaveToXMLConfig(XMLConfig: TXMLConfig; const Path: string); +begin + inherited SaveToXMLConfig(XMLConfig, Path); + SaveXMLCompileReasons(XMLConfig, Path+'CompileReasons/', CompileReasons); +end; { TProjectCompilerOptions } +procedure TProjectCompilerOptions.LoadTheCompilerOptions(const APath: string); +begin + inherited LoadTheCompilerOptions(APath); + + // old compatebility + if XMLConfigFile.GetValue(APAth+'SkipCompiler/Value',false) + then FCompileReasons := [] + else FCompileReasons := LoadXMLCompileReasons(XMLConfigFile,APath+'CompileReasons/'); +end; + +procedure TProjectCompilerOptions.SaveTheCompilerOptions(const APath: string); +begin + inherited SaveTheCompilerOptions(APath); + + SaveXMLCompileReasons(XMLConfigFile, APath+'CompileReasons/', FCompileReasons); +end; + procedure TProjectCompilerOptions.SetTargetCPU(const AValue: string); begin inherited SetTargetCPU(AValue); @@ -2671,21 +2744,34 @@ end; procedure TProjectCompilerOptions.Assign(CompOpts: TBaseCompilerOptions); begin inherited Assign(CompOpts); + if CompOpts is TProjectCompilerOptions + then FCompileReasons := TProjectCompilerOptions(CompOpts).FCompileReasons + else FCompileReasons := [crCompile, crBuild, crRun]; + UpdateGlobals; end; +function TProjectCompilerOptions.IsEqual(CompOpts: TBaseCompilerOptions): boolean; +begin + Result := (CompOpts is TProjectCompilerOptions) + and (FCompileReasons = TProjectCompilerOptions(CompOpts).FCompileReasons) + and inherited IsEqual(CompOpts); +end; + procedure TProjectCompilerOptions.UpdateGlobals; begin FGlobals.TargetCPU:=TargetCPU; FGlobals.TargetOS:=TargetOS; end; -constructor TProjectCompilerOptions.Create(TheProject: TProject); +constructor TProjectCompilerOptions.Create(const AOwner: TObject); begin - FGlobals:=TGlobalCompilerOptions.Create; - inherited Create(TheProject); + FGlobals := TGlobalCompilerOptions.Create; + FCompileReasons := [crCompile, crBuild, crRun]; + inherited Create(AOwner, TProjectCompilationTool); UpdateGlobals; - fOwnerProject:=TheProject; + if AOwner <> nil + then FOwnerProject := AOwner as TProject; end; destructor TProjectCompilerOptions.Destroy; @@ -2818,6 +2904,11 @@ end. { $Log$ + Revision 1.161 2004/09/04 21:54:08 marc + + Added option to skip compiler step on compile, build or run + * Fixed adding of runtime watches + * Fixed runnerror reporting (correct number and location is shown) + Revision 1.160 2004/09/01 10:25:58 mattias added some project flags to start getting rid of TProjectType diff --git a/packager/packagedefs.pas b/packager/packagedefs.pas index a8688bc8df..f382cfa97e 100644 --- a/packager/packagedefs.pas +++ b/packager/packagedefs.pas @@ -321,7 +321,11 @@ type TPkgCompilerOptions = class(TBaseCompilerOptions) private FLazPackage: TLazPackage; + FSkipCompiler: Boolean; protected + procedure LoadTheCompilerOptions(const APath: string); override; + procedure SaveTheCompilerOptions(const APath: string); override; + procedure SetLazPackage(const AValue: TLazPackage); procedure SetModified(const NewValue: boolean); override; procedure SetCustomOptions(const AValue: string); override; @@ -333,15 +337,19 @@ type procedure SetOtherUnitFiles(const AValue: string); override; procedure SetUnitOutputDir(const AValue: string); override; public - constructor Create(ThePackage: TLazPackage); + constructor Create(const AOwner: TObject); override; procedure Clear; override; procedure GetInheritedCompilerOptions(var OptionsList: TList); override; function GetOwnerName: string; override; procedure InvalidateOptions; function GetDefaultMainSourceFileName: string; override; function CreateTargetFilename(const MainSourceFileName: string): string; override; + + procedure Assign(CompOpts: TBaseCompilerOptions); override; + function IsEqual(CompOpts: TBaseCompilerOptions): boolean; override; public property LazPackage: TLazPackage read FLazPackage write SetLazPackage; + property SkipCompiler: Boolean read FSkipCompiler write FSkipCompiler; end; @@ -2883,6 +2891,20 @@ end; { TPkgCompilerOptions } +procedure TPkgCompilerOptions.LoadTheCompilerOptions(const APath: string); +begin + inherited LoadTheCompilerOptions(APath); + + FSkipCompiler := XMLConfigFile.GetValue(APath+'SkipCompiler/Value', False); +end; + +procedure TPkgCompilerOptions.SaveTheCompilerOptions(const APath: string); +begin + inherited SaveTheCompilerOptions(APath); + + XMLConfigFile.SetDeleteValue(APath+'SkipCompiler/Value', FSkipCompiler, False); +end; + procedure TPkgCompilerOptions.SetLazPackage(const AValue: TLazPackage); begin if FLazPackage=AValue then exit; @@ -2953,10 +2975,11 @@ begin LazPackage.DefineTemplates.OutputDirectoryChanged; end; -constructor TPkgCompilerOptions.Create(ThePackage: TLazPackage); +constructor TPkgCompilerOptions.Create(const AOwner: TObject); begin - inherited Create(ThePackage); - fLazPackage:=ThePackage; + inherited Create(AOwner); + if AOwner <> nil + then FLazPackage := AOwner as TLazPackage; end; procedure TPkgCompilerOptions.Clear; @@ -2993,6 +3016,25 @@ begin Result:=''; end; +procedure TPkgCompilerOptions.Assign(CompOpts: TBaseCompilerOptions); +begin + inherited Assign(CompOpts); + if CompOpts is TPkgCompilerOptions + then begin + FSkipCompiler := TPkgCompilerOptions(CompOpts).FSkipCompiler; + end + else begin + FSkipCompiler := False; + end; +end; + +function TPkgCompilerOptions.IsEqual(CompOpts: TBaseCompilerOptions): boolean; +begin + Result := (CompOpts is TPkgCompilerOptions) + and (FSkipCompiler = TPkgCompilerOptions(CompOpts).FSkipCompiler) + and inherited IsEqual(CompOpts); +end; + { TPkgAdditionalCompilerOptions } procedure TPkgAdditionalCompilerOptions.SetLazPackage(const AValue: TLazPackage diff --git a/packager/packageeditor.pas b/packager/packageeditor.pas index 46081eeb42..02ac275961 100644 --- a/packager/packageeditor.pas +++ b/packager/packageeditor.pas @@ -41,8 +41,8 @@ uses Classes, SysUtils, Forms, Controls, StdCtrls, ComCtrls, Buttons, LResources, Graphics, LCLType, Menus, Dialogs, FileCtrl, Laz_XMLCfg, AVL_Tree, IDEProcs, LazConf, LazarusIDEStrConsts, IDEOptionDefs, IDEDefs, - CompilerOptions, ComponentReg, PackageDefs, PkgOptionsDlg, AddToPackageDlg, - PackageSystem; + CompilerOptions, CompilerOptionsDlg, ComponentReg, PackageDefs, PkgOptionsDlg, + AddToPackageDlg, PackageSystem; type TOnOpenFile =