IDE: sourceeditor: ifdef node states: set idnInvalid for mixed cases

git-svn-id: trunk@41385 -
This commit is contained in:
mattias 2013-05-24 16:29:39 +00:00
parent 1be10bb6e1
commit d846fce1d2
3 changed files with 22 additions and 6 deletions

View File

@ -19,6 +19,12 @@
*************************************************************************** ***************************************************************************
ToDo: 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 - save matrix options for old build macro values
- load old build macro values into matrix - load old build macro values into matrix
- ifdef old frame - ifdef old frame

View File

@ -2896,7 +2896,7 @@ begin
ProjectSessionStorageNames[SessionStorage], ProjectSessionStorageNames[SessionStorage],
ProjectSessionStorageNames[DefaultProjectSessionStorage]); 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.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', xmlconfig.SetDeleteValue(Path+'General/AutoCreateForms/Value',
AutoCreateForms,true); AutoCreateForms,true);

View File

@ -5478,6 +5478,9 @@ var
X: integer; X: integer;
SynState: TSynMarkupIfdefNodeStateEx; SynState: TSynMarkupIfdefNodeStateEx;
SrcPos: Integer; SrcPos: Integer;
ActiveCnt: Integer;
InactiveCnt: Integer;
SkippedCnt: Integer;
begin begin
//debugln(['TSourceEditor.UpdateIfDefNodeStates START ',Filename]); //debugln(['TSourceEditor.UpdateIfDefNodeStates START ',Filename]);
if not EditorComponent.IsIfdefMarkupActive then 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)]); debugln(['TSourceEditor.UpdateIfDefNodeStates ',i,'/',Scanner.DirectiveCount,' ',dbgs(Pointer(Code)),' ',Code.Filename,' X=',X,' Y=',Y,' SrcPos=',aDirective^.SrcPos,' State=',dbgs(aDirective^.State)]);
{$ENDIF} {$ENDIF}
SrcPos:=aDirective^.SrcPos; SrcPos:=aDirective^.SrcPos;
ActiveCnt:=0;
InactiveCnt:=0;
SkippedCnt:=0;
repeat repeat
case aDirective^.State of case aDirective^.State of
lsdsActive: lsdsActive: inc(ActiveCnt);
SynState:=idnEnabled; lsdsInactive: inc(InactiveCnt);
lsdsInactive: lsdsSkipped: inc(SkippedCnt);
if SynState=idnInvalid then
SynState:=idnDisabled;
end; end;
if i < Scanner.DirectiveCount then begin if i < Scanner.DirectiveCount then begin
ADirective:=Scanner.DirectivesSorted[i]; ADirective:=Scanner.DirectivesSorted[i];
@ -5535,6 +5539,12 @@ begin
if (Pos(VFilePattern,Code.Filename)>0) and (Y>=VMinY) and (Y<=VMaxY) then if (Pos(VFilePattern,Code.Filename)>0) and (Y>=VMinY) and (Y<=VMaxY) then
debugln(['TSourceEditor.UpdateIfDefNodeStates y=',y,' x=',x,' SET SynState=',dbgs(SynState)]); debugln(['TSourceEditor.UpdateIfDefNodeStates y=',y,' x=',x,' SET SynState=',dbgs(SynState)]);
{$ENDIF} {$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); EditorComponent.SetIfdefNodeState(Y,X,SynState);
end; end;
finally finally