From d846fce1d26fe8e064ed0363f0d2f697c143619d Mon Sep 17 00:00:00 2001 From: mattias Date: Fri, 24 May 2013 16:29:39 +0000 Subject: [PATCH] IDE: sourceeditor: ifdef node states: set idnInvalid for mixed cases git-svn-id: trunk@41385 - --- ide/frames/compiler_modematrix.pas | 6 ++++++ ide/project.pp | 2 +- ide/sourceeditor.pp | 20 +++++++++++++++----- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/ide/frames/compiler_modematrix.pas b/ide/frames/compiler_modematrix.pas index 0c1cf9d569..f7f29a9649 100644 --- a/ide/frames/compiler_modematrix.pas +++ b/ide/frames/compiler_modematrix.pas @@ -19,6 +19,12 @@ *************************************************************************** ToDo: + - save session modes in session + - for IDE + - for project + - load session modes + - for IDE + - for project - save matrix options for old build macro values - load old build macro values into matrix - ifdef old frame diff --git a/ide/project.pp b/ide/project.pp index 84884a2629..7ae2e2c4fa 100644 --- a/ide/project.pp +++ b/ide/project.pp @@ -2896,7 +2896,7 @@ begin ProjectSessionStorageNames[SessionStorage], ProjectSessionStorageNames[DefaultProjectSessionStorage]); - // properties + // general properties xmlconfig.SetValue(Path+'General/MainUnit/Value', MainUnitID); // always write a value to support opening by older IDEs (<=0.9.28). This can be changed in a few released. xmlconfig.SetDeleteValue(Path+'General/AutoCreateForms/Value', AutoCreateForms,true); diff --git a/ide/sourceeditor.pp b/ide/sourceeditor.pp index c68438b77b..ab14bcbfe1 100644 --- a/ide/sourceeditor.pp +++ b/ide/sourceeditor.pp @@ -5478,6 +5478,9 @@ var X: integer; SynState: TSynMarkupIfdefNodeStateEx; SrcPos: Integer; + ActiveCnt: Integer; + InactiveCnt: Integer; + SkippedCnt: Integer; begin //debugln(['TSourceEditor.UpdateIfDefNodeStates START ',Filename]); if not EditorComponent.IsIfdefMarkupActive then @@ -5512,13 +5515,14 @@ begin debugln(['TSourceEditor.UpdateIfDefNodeStates ',i,'/',Scanner.DirectiveCount,' ',dbgs(Pointer(Code)),' ',Code.Filename,' X=',X,' Y=',Y,' SrcPos=',aDirective^.SrcPos,' State=',dbgs(aDirective^.State)]); {$ENDIF} SrcPos:=aDirective^.SrcPos; + ActiveCnt:=0; + InactiveCnt:=0; + SkippedCnt:=0; repeat case aDirective^.State of - lsdsActive: - SynState:=idnEnabled; - lsdsInactive: - if SynState=idnInvalid then - SynState:=idnDisabled; + lsdsActive: inc(ActiveCnt); + lsdsInactive: inc(InactiveCnt); + lsdsSkipped: inc(SkippedCnt); end; if i < Scanner.DirectiveCount then begin ADirective:=Scanner.DirectivesSorted[i]; @@ -5535,6 +5539,12 @@ begin if (Pos(VFilePattern,Code.Filename)>0) and (Y>=VMinY) and (Y<=VMaxY) then debugln(['TSourceEditor.UpdateIfDefNodeStates y=',y,' x=',x,' SET SynState=',dbgs(SynState)]); {$ENDIF} + if (ActiveCnt=1) and (InactiveCnt=0) and (SkippedCnt=0) then + SynState:=idnEnabled + else if (InactiveCnt=1) and (ActiveCnt=0) and (SkippedCnt=0) then + SynState:=idnDisabled + else + SynState:=idnInvalid; EditorComponent.SetIfdefNodeState(Y,X,SynState); end; finally