From 61f6b4695c4b455b8d4b00c9e262b2f51d5c00a5 Mon Sep 17 00:00:00 2001 From: mattias Date: Sat, 16 Nov 2002 13:56:20 +0000 Subject: [PATCH] project now notices, if compiler options changed git-svn-id: trunk@3644 - --- ide/compileroptions.pp | 101 +++++++++++++++++++++++++++++++++++++++++ ide/project.pp | 4 ++ 2 files changed, 105 insertions(+) diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index ac97028074..bd919dafa5 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -50,6 +50,8 @@ type TCompilerOptions = class(TObject) private + FModified: boolean; + FOnModified: TNotifyEvent; fOptionsString: String; xmlconfig: TXMLConfig; @@ -134,6 +136,7 @@ type procedure LoadTheCompilerOptions; procedure SaveTheCompilerOptions; + procedure SetModified(const AValue: boolean); public constructor Create; destructor Destroy; override; @@ -141,6 +144,8 @@ type procedure LoadCompilerOptions(UseExistingFile: Boolean); procedure SaveCompilerOptions(UseExistingFile: Boolean); procedure Assign(CompOpts: TCompilerOptions); + function IsEqual(CompOpts: TCompilerOptions): boolean; + function MakeOptionsString: String; function MakeOptionsString(const MainSourceFileName: string): String; function ParseSearchPaths(const switch, paths: String): String; @@ -149,6 +154,9 @@ type procedure Clear; function CreateTargetFilename(const MainSourceFileName: string): string; + property Modified: boolean read FModified write SetModified; + property OnModified: TNotifyEvent read FOnModified write FOnModified; + property ProjectFile: String read fProjectFile write fProjectFile; property TargetFilename: String read fTargetFilename write fTargetFilename; property XMLConfigFile: TXMLConfig read xmlconfig write xmlconfig; @@ -556,6 +564,7 @@ begin XMLConfigFile.Free; XMLConfigFile := nil; end; + fModified:=false; end; {------------------------------------------------------------------------------} @@ -642,6 +651,14 @@ begin XMLConfigFile.Flush; end; +procedure TCompilerOptions.SetModified(const AValue: boolean); +begin + if FModified=AValue then exit; + FModified:=AValue; + if Assigned(OnModified) then + OnModified(Self); +end; + {------------------------------------------------------------------------------} { TCompilerOptions CreateTargetFilename } {------------------------------------------------------------------------------} @@ -1225,6 +1242,7 @@ procedure TCompilerOptions.Clear; begin fOptionsString := ''; fLoaded := false; + FModified := false; { Set Defaults } fStyle := 1; @@ -1368,6 +1386,81 @@ begin fLCLWidgetType := CompOpts.fLCLWidgetType; end; +function TCompilerOptions.IsEqual(CompOpts: TCompilerOptions): boolean; +begin + Result:= + (fOptionsString = CompOpts.fOptionsString) + and (fLoaded = CompOpts.fLoaded) + + and (fStyle = CompOpts.fStyle) + and (fD2Ext = CompOpts.fD2Ext) + and (fCStyleOp = CompOpts.fCStyleOp) + and (fIncludeAssertionCode = CompOpts.fIncludeAssertionCode) + and (fAllowLabel = CompOpts.fAllowLabel) + and (fCPPInline = CompOpts.fCPPInline) + and (fCMacros = CompOpts.fCMacros) + and (fTPCompat = CompOpts.fTPCompat) + and (fInitConst = CompOpts.fInitConst) + and (fStaticKwd = CompOpts.fStaticKwd) + and (fDelphiCompat = CompOpts.fDelphiCompat) + and (fUseAnsiStr = CompOpts.fUseAnsiStr) + and (fGPCCompat = CompOpts.fGPCCompat) + + and (fUnitStyle = CompOpts.fUnitStyle) + and (fIOChecks = CompOpts.fIOChecks) + and (fRangeChecks = CompOpts.fRangeChecks) + and (fOverflowChecks = CompOpts.fOverflowChecks) + and (fStackChecks = CompOpts.fStackChecks) + and (fHeapSize = CompOpts.fHeapSize) + and (fGenerate = CompOpts.fGenerate) + and (fTargetProc = CompOpts.fTargetProc) + and (fVarsInReg = CompOpts.fVarsInReg) + and (fUncertainOpt = CompOpts.fUncertainOpt) + and (fOptLevel = CompOpts.fOptLevel) + and (fTargetOS = CompOpts.fTargetOS) + + and (fGenDebugInfo = CompOpts.fGenDebugInfo) + and (fGenDebugDBX = CompOpts.fGenDebugDBX) + and (fUseLineInfoUnit = CompOpts.fUseLineInfoUnit) + and (fUseHeaptrc = CompOpts.fUseHeaptrc) + and (fGenGProfCode = CompOpts.fGenGProfCode) + and (fStripSymbols = CompOpts.fStripSymbols) + and (fLinkStyle = CompOpts.fLinkStyle) + and (fPassLinkerOpt = CompOpts.fPassLinkerOpt) + and (fLinkerOptions = CompOpts.fLinkerOptions) + + and (fShowErrors = CompOpts.fShowErrors) + and (fShowWarn = CompOpts.fShowWarn) + and (fShowNotes = CompOpts.fShowNotes) + and (fShowHints = CompOpts.fShowHints) + and (fShowGenInfo = CompOpts.fShowGenInfo) + and (fShowLineNum = CompOpts.fShowLineNum) + and (fShowAll = CompOpts.fShowAll) + and (fShowAllProcsOnError = CompOpts.fShowAllProcsOnError) + and (fShowDebugInfo = CompOpts.fShowDebugInfo) + and (fShowUsedFiles = CompOpts.fShowUsedFiles) + and (fShowTriedFiles = CompOpts.fShowTriedFiles) + and (fShowDefMacros = CompOpts.fShowDefMacros) + and (fShowCompProc = CompOpts.fShowCompProc) + and (fShowCond = CompOpts.fShowCond) + and (fShowNothing = CompOpts.fShowNothing) + and (fShowHintsForUnusedProjectUnits = CompOpts.fShowHintsForUnusedProjectUnits) + and (fWriteFPCLogo = CompOpts.fWriteFPCLogo) + and (fDontUseConfigFile = CompOpts.fDontUseConfigFile) + and (fAdditionalConfigFile = CompOpts.fAdditionalConfigFile) + and (fConfigFilePath = CompOpts.fConfigFilePath) + and (fStopAfterErrCount = CompOpts.fStopAfterErrCount) + + and (fIncludeFiles = CompOpts.fIncludeFiles) + and (fLibraries = CompOpts.fLibraries) + and (fOtherUnitFiles = CompOpts.fOtherUnitFiles) + and (fCompilerPath = CompOpts.fCompilerPath) + and (fUnitOutputDir = CompOpts.fUnitOutputDir) + + and (fLCLWidgetType = CompOpts.fLCLWidgetType) + ; +end; + {------------------------------------------------------------------------------} { TfrmCompilerOptions Constructor } {------------------------------------------------------------------------------} @@ -1642,8 +1735,12 @@ var code: LongInt; hs: LongInt; i: integer; + OldCompOpts: TCompilerOptions; begin { Put the compiler options into the TCompilerOptions class to be saved } + + OldCompOpts:=TCompilerOptions.Create; + OldCompOpts.Assign(CompilerOpts); if (radStyleIntel.Checked) then CompilerOpts.Style := 1 @@ -1766,6 +1863,10 @@ begin i:=TargetOSRadioGroup.Itemindex; if i<0 then i:=0; CompilerOpts.TargetOS:= TargetOSRadioGroup.Items[i]; + + if not OldCompOpts.IsEqual(CompilerOpts) then + CompilerOpts.Modified:=true; + OldCompOpts.Free; end; {------------------------------------------------------------------------------} diff --git a/ide/project.pp b/ide/project.pp index 30942be70f..fadd5ceda5 100644 --- a/ide/project.pp +++ b/ide/project.pp @@ -1906,6 +1906,7 @@ var i: integer; begin Result:=Modified; for i:=0 to UnitCount-1 do Result:=Result or Units[i].Modified; + Result:=Result or CompilerOptions.Modified; end; Function TProject.UnitWithForm(AForm : TComponent) : TUnitInfo; @@ -2100,6 +2101,9 @@ end. { $Log$ + Revision 1.86 2002/11/16 13:56:20 mattias + project now notices, if compiler options changed + Revision 1.85 2002/10/30 22:28:49 lazarus MG: fixed used virtual files and IsPartOfProject Bug