View Issue Details

IDProjectCategoryView StatusLast Update
0032930LazarusIDEpublic2018-01-29 22:04
ReporterVojtech CihakAssigned ToMartin Friebe 
PrioritynormalSeverityminorReproducibilityN/A
Status resolvedResolutionfixed 
Product Version1.9 (SVN)Product Build 
Target Version1.8.2Fixed in Version1.8.2 
Summary0032930: Outlines in Source Editor (feature request)
DescriptionCurrently, colors of Outlines are hardcoded.
Request no.1 is to make them configurable.

Then, some people will want to use outlines but with standart colors (lets say all black).
Request no.2 is to enable multiple pen styles.
Outlines of nested blocks can be painted solid-dashed-dotted in repeatig sequece:
| ¦ .
| ¦ .
| ¦ .
| ¦ .
| ¦ .
or style can be assinged separately (case-of dotted, begin-end solid etc.)
TagsNo tags attached.
Fixed in Revision57182
LazTarget-
Widgetset
Attached Files
  • color_options_for_outline_coloring.patch (18,709 bytes)
    Index: components/synedit/syneditmarkupfoldcoloring.pas
    ===================================================================
    --- components/synedit/syneditmarkupfoldcoloring.pas	(revision 57125)
    +++ components/synedit/syneditmarkupfoldcoloring.pas	(working copy)
    @@ -43,7 +43,7 @@
     unit SynEditMarkupFoldColoring;
     
     {$mode objfpc}{$H+}
    -{ $define SynEditMarkupFoldColoringDebug}
    +{off $define SynEditMarkupFoldColoringDebug}
     
     interface
     
    @@ -71,10 +71,21 @@
     
       TSynEditMarkupFoldColors = class(TSynEditMarkup)
       private
    +    fUpdateColors: Boolean;
         function GetFirstCharacterColumn(index: Integer): Byte;
         procedure TextBufferChanged(Sender: TObject);
       private
         FHighlighter: TSynCustomFoldHighlighter;
    +    FColor1: TSynSelectedColor;
    +    FColor2: TSynSelectedColor;
    +    FColor3: TSynSelectedColor;
    +    FColor4: TSynSelectedColor;
    +    FColor5: TSynSelectedColor;
    +    FColor6: TSynSelectedColor;
    +    FColor7: TSynSelectedColor;
    +    FColor8: TSynSelectedColor;
    +    FColor9: TSynSelectedColor;
    +    FColor10: TSynSelectedColor;
         FNestList: TLazSynEditNestedFoldsList;
     
         // cache
    @@ -88,7 +99,7 @@
         FDefaultGroup: integer;
         FFoldColorInfos: TMarkupFoldColorInfos;
     
    -    Colors : array of TColor;
    +    FColors : array of TColor;
         FPreparedRow: integer;
         FLastNode: TSynFoldNodeInfo;
         FLastEnabled: Boolean;
    @@ -100,6 +111,7 @@
         procedure SetFoldColorInfosCount(pNewCount: Integer);
         procedure InitCache;
         procedure ClearCache;
    +    procedure UpdateColors;
         property FirstCharacterColumn[index: Integer]: Byte read GetFirstCharacterColumn;
       protected
         // Notifications about Changes to the text
    @@ -108,6 +120,7 @@
         procedure LinesChanged(Sender: TSynEditStrings; aIndex, aCount: Integer);
         procedure HighlightChanged(Sender: TSynEditStrings; aIndex, aCount: Integer);
         procedure DoEnabledChanged(Sender: TObject); override;
    +    procedure ColorChanged(AMarkup: TObject);
       public
         constructor Create(ASynEdit : TSynEditBase);
         destructor Destroy; override;
    @@ -122,6 +135,16 @@
     
         procedure PrepareMarkupForRow(aRow : Integer); override;
         property DefaultGroup : integer read FDefaultGroup write SetDefaultGroup;
    +    property Color1:  TSynSelectedColor read FColor1;
    +    property Color2:  TSynSelectedColor read FColor2;
    +    property Color3:  TSynSelectedColor read FColor3;
    +    property Color4:  TSynSelectedColor read FColor4;
    +    property Color5:  TSynSelectedColor read FColor5;
    +    property Color6:  TSynSelectedColor read FColor6;
    +    property Color7:  TSynSelectedColor read FColor7;
    +    property Color8:  TSynSelectedColor read FColor8;
    +    property Color9:  TSynSelectedColor read FColor9;
    +    property Color10: TSynSelectedColor read FColor10;
       end;
     
     implementation
    @@ -169,6 +192,27 @@
       FNestList.FoldFlags := [sfbIncludeDisabled];
       FNestList.IncludeOpeningOnLine := True;
     
    +  FColor1 := TSynSelectedColor.Create;
    +  FColor1.OnChange := @ColorChanged;
    +  FColor2 := TSynSelectedColor.Create;
    +  FColor2.OnChange := @ColorChanged;
    +  FColor3 := TSynSelectedColor.Create;
    +  FColor3.OnChange := @ColorChanged;
    +  FColor4 := TSynSelectedColor.Create;
    +  FColor4.OnChange := @ColorChanged;
    +  FColor5 := TSynSelectedColor.Create;
    +  FColor5.OnChange := @ColorChanged;
    +  FColor6 := TSynSelectedColor.Create;
    +  FColor6.OnChange := @ColorChanged;
    +  FColor7 := TSynSelectedColor.Create;
    +  FColor7.OnChange := @ColorChanged;
    +  FColor8 := TSynSelectedColor.Create;
    +  FColor8.OnChange := @ColorChanged;
    +  FColor9 := TSynSelectedColor.Create;
    +  FColor9.OnChange := @ColorChanged;
    +  FColor10 := TSynSelectedColor.Create;
    +  FColor10.OnChange := @ColorChanged;
    +
       MarkupInfo.Foreground := clGreen;
       MarkupInfo.Background := clNone;
       MarkupInfo.Style := [];
    @@ -175,17 +219,32 @@
       MarkupInfo.StyleMask := [];
       MarkupInfo.FrameEdges:= sfeLeft;
     
    -  SetLength(Colors, 6);
    -  Colors[0] := clRed;
    -  Colors[1] := $000098F7; //orange
    -  Colors[2] := $0022CC40; //green
    -  Colors[3] := $00CCCC00;   //cyan
    -  Colors[4] := $00FF682A; //blue
    -  Colors[5] := $00CF00C4; //purple
    +  SetLength(FColors, 6);
    +  FColor1.FrameColor  := clRed;
    +  FColor2.FrameColor  := $000098F7; //orange
    +  FColor3.FrameColor  := $0022CC40; //green
    +  FColor4.FrameColor  := $00CCCC00;   //cyan
    +  FColor5.FrameColor  := $00FF682A; //blue
    +  FColor6.FrameColor  := $00CF00C4; //purple
    +  FColor7.FrameColor  := clNone;
    +  FColor8.FrameColor  := clNone;
    +  FColor9.FrameColor  := clNone;
    +  FColor10.FrameColor := clNone;
    +
     end;
     
     destructor TSynEditMarkupFoldColors.Destroy;
     begin
    +  FColor1.Free;
    +  FColor2.Free;
    +  FColor3.Free;
    +  FColor4.Free;
    +  FColor5.Free;
    +  FColor6.Free;
    +  FColor7.Free;
    +  FColor8.Free;
    +  FColor9.Free;
    +  FColor10.Free;
       if Assigned(Lines) then begin
         Lines.RemoveChangeHandler(senrLineCount, @LinesChanged);
         Lines.RemoveChangeHandler(senrHighlightChanged, @HighlightChanged);
    @@ -242,12 +301,12 @@
               x2both := max(x2both, x2);
               MarkupInfo.SetFrameBoundsLog(x, x2both);
               if Border then begin
    -            MarkupInfo.FrameColor:= Colors[ColorIdx];
    +            MarkupInfo.FrameColor:= FColors[ColorIdx];
                 MarkupInfo.FrameEdges:= sfeLeft;
               end else begin
                 MarkupInfo.FrameColor:= clNone;
                 MarkupInfo.FrameEdges:= sfeNone;
    -            MarkupInfo.Foreground := Colors[ColorIdx];
    +            MarkupInfo.Foreground := FColors[ColorIdx];
               end;
             end;
       end;
    @@ -343,7 +402,7 @@
           if not Border and (sfaOutlineNoColor in ANode.FoldAction) then
             Ignore := True;
           Level := lvl;
    -      ColorIdx := Max(0, lvl) mod (length(Colors));
    +      ColorIdx := Max(0, lvl) mod (length(FColors));
         end;
       end;
     
    @@ -354,6 +413,7 @@
     
     begin
       y := ToIdx(aRow);
    +  FNestList.Clear;
       FNestList.Line := y;
       NestCount := FNestList.Count;
       FHighlighter.CurrentLines := Lines;
    @@ -391,7 +451,7 @@
               if sfaOutlineKeepLevel in FFoldColorInfos[FFoldColorInfosCount - 2].SrcNode.FoldAction then begin
                 lvl := FFoldColorInfos[FFoldColorInfosCount - 2].Level;
                 FFoldColorInfos[FFoldColorInfosCount - 1].Level := lvl;
    -            FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(Colors));
    +            FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(FColors));
               end;
             end;
     
    @@ -451,7 +511,7 @@
             X2 := ANode.LogXEnd + 1;
             Level := lvl;
             if not (sfaOutlineNocolor in ANode.FoldAction) then
    -           ColorIdx := Max(0, lvl) mod (length(Colors))
    +           ColorIdx := Max(0, lvl) mod (length(FColors))
             else
                ColorIdx := -1;
           end;
    @@ -510,7 +570,7 @@
                 or (sfaOutlineKeepLevel in FFoldColorInfos[FFoldColorInfosCount - 2].SrcNode.FoldAction) then begin
                   lvl := FFoldColorInfos[FFoldColorInfosCount - 2].Level;
                   FFoldColorInfos[FFoldColorInfosCount - 1].Level := lvl;
    -              FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(Colors));
    +              FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(FColors));
                 end;
               end;
     
    @@ -577,6 +637,12 @@
       //DebugLn('PrepareMarkupForRow %d', [aRow]);
       {$ENDIF}
       if not Assigned(FHighlighter) then exit;
    +
    +  if fUpdateColors then begin
    +    UpdateColors;
    +    fUpdateColors := False;
    +  end;
    +
       FPreparedRow := aRow;
       FFoldColorInfosCount := 0; //reset needed to prevent using of invalid area
     
    @@ -664,6 +730,37 @@
       end;
     end;
     
    +procedure TSynEditMarkupFoldColors.UpdateColors;
    +var
    +  c: Integer;
    +
    +  procedure AddColor(pColor: TSynSelectedColor);
    +  begin
    +    if pColor.FrameColor = clNone then exit;
    +    fColors[c] := pColor.FrameColor;
    +    inc(c);
    +  end;
    +
    +begin
    +  SetLength(fColors, 10);
    +  c := 0;
    +  AddColor(FColor1);
    +  AddColor(FColor2);
    +  AddColor(FColor3);
    +  AddColor(FColor4);
    +  AddColor(FColor5);
    +  AddColor(FColor6);
    +  AddColor(FColor7);
    +  AddColor(FColor8);
    +  AddColor(FColor9);
    +  AddColor(FColor10);
    +  if c = 0 then begin
    +    fColors[c] := $FF;
    +    inc(c);
    +  end;
    +  SetLength(fColors, c);
    +end;
    +
     procedure TSynEditMarkupFoldColors.DoTextChanged(StartLine, EndLine,
       ACountDiff: Integer);
     
    @@ -952,6 +1049,11 @@
         InvalidateSynLines(1, Lines.Count);
     end;
     
    +procedure TSynEditMarkupFoldColors.ColorChanged(AMarkup: TObject);
    +begin
    +  fUpdateColors := True;
    +end;
    +
     end.
     
     
    Index: ide/editoroptions.pp
    ===================================================================
    --- ide/editoroptions.pp	(revision 57125)
    +++ ide/editoroptions.pp	(working copy)
    @@ -121,7 +121,8 @@
         '',  // ahaTopInfoHint
         '', '', '',  // ahaIfDefBlockInactive, ahaIfDefBlockActive, ahaIfDefBlockTmpActive
         '', '', '',  // ahaIfDefNodeInactive, ahaIfDefNodeActive, ahaIfDefNodeTmpActive
    -    '', '', '', '' // ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
    +    '', '', '', '', // ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
    +    '', '', '', '', '', '', '', '', '', '' // ahaOutlineColor01..10
       );
     
       ahaGroupMap: array[TAdditionalHilightAttribute] of TAhaGroupName = (
    @@ -167,7 +168,17 @@
         { ahaIdentComplWindow }           agnIdentComplWindow,
         { ahaIdentComplWindowBorder }     agnIdentComplWindow,
         { ahaIdentComplWindowSelection }  agnIdentComplWindow,
    -    { ahaIdentComplWindowHighlight }  agnIdentComplWindow
    +    { ahaIdentComplWindowHighlight }  agnIdentComplWindow,
    +    { ahaOutlineColor1 }       agnOutlineColors,
    +    { ahaOutlineColor2 }       agnOutlineColors,
    +    { ahaOutlineColor3 }       agnOutlineColors,
    +    { ahaOutlineColor4 }       agnOutlineColors,
    +    { ahaOutlineColor5 }       agnOutlineColors,
    +    { ahaOutlineColor6 }       agnOutlineColors,
    +    { ahaOutlineColor7 }       agnOutlineColors,
    +    { ahaOutlineColor8 }       agnOutlineColors,
    +    { ahaOutlineColor9 }       agnOutlineColors,
    +    { ahaOutlineColor10 }      agnOutlineColors
     
       );
       ahaSupportedFeatures: array[TAdditionalHilightAttribute] of TColorSchemeAttributeFeatures =
    @@ -214,7 +225,17 @@
         { ahaIdentComplWindow }   [hafBackColor, hafForeColor],
         { ahaIdentComplWindowBorder }    [hafForeColor],
         { ahaIdentComplWindowSelection } [hafBackColor, hafForeColor],
    -    { ahaIdentComplWindowHighlight } [hafForeColor]
    +    { ahaIdentComplWindowHighlight } [hafForeColor],
    +    { ahaFoldColor1 }         [hafFrameColor, hafFrameStyle],
    +    { ahaFoldColor2 }         [hafFrameColor, hafFrameStyle],
    +    { ahaFoldColor3 }         [hafFrameColor, hafFrameStyle],
    +    { ahaFoldColor4 }         [hafFrameColor, hafFrameStyle],
    +    { ahaFoldColor5 }         [hafFrameColor, hafFrameStyle],
    +    { ahaFoldColor6 }         [hafFrameColor, hafFrameStyle],
    +    { ahaFoldColor7 }         [hafFrameColor, hafFrameStyle],
    +    { ahaFoldColor8 }         [hafFrameColor, hafFrameStyle],
    +    { ahaFoldColor9 }         [hafFrameColor, hafFrameStyle],
    +    { ahaFoldColor10 }        [hafFrameColor, hafFrameStyle]
       );
     
     
    @@ -2478,6 +2499,18 @@
       AdditionalHighlightAttributes[ahaIdentComplWindowHighlight] := dlgAddHiAttrHighlightPrefix;
       AdditionalHighlightGroupNames[agnIdentComplWindow]          := dlgIdentifierCompletion;
     
    +  AdditionalHighlightAttributes[ahaOutlineColor1]  := dlgAddHiAttrOutlineColor1;
    +  AdditionalHighlightAttributes[ahaOutlineColor2]  := dlgAddHiAttrOutlineColor2;
    +  AdditionalHighlightAttributes[ahaOutlineColor3]  := dlgAddHiAttrOutlineColor3;
    +  AdditionalHighlightAttributes[ahaOutlineColor4]  := dlgAddHiAttrOutlineColor4;
    +  AdditionalHighlightAttributes[ahaOutlineColor5]  := dlgAddHiAttrOutlineColor5;
    +  AdditionalHighlightAttributes[ahaOutlineColor6]  := dlgAddHiAttrOutlineColor6;
    +  AdditionalHighlightAttributes[ahaOutlineColor7]  := dlgAddHiAttrOutlineColor7;
    +  AdditionalHighlightAttributes[ahaOutlineColor8]  := dlgAddHiAttrOutlineColor8;
    +  AdditionalHighlightAttributes[ahaOutlineColor9]  := dlgAddHiAttrOutlineColor9;
    +  AdditionalHighlightAttributes[ahaOutlineColor10] := dlgAddHiAttrOutlineColor10;
    +  AdditionalHighlightGroupNames[agnOutlineColors]  := dlgAddHiAttrGroupOutlineColors;
    +
       AdditionalHighlightGroupNames[agnDefault]      := dlgAddHiAttrGroupDefault;
       AdditionalHighlightGroupNames[agnText]         := dlgAddHiAttrGroupText;
       AdditionalHighlightGroupNames[agnLine]         := dlgAddHiAttrGroupLine;
    @@ -6541,6 +6574,21 @@
           SetMarkupColor(ahaSyncroEditSync,  TSynPluginSyncroEdit(aSynEdit.Plugin[i]).MarkupInfoSync);
           SetMarkupColor(ahaSyncroEditArea,  TSynPluginSyncroEdit(aSynEdit.Plugin[i]).MarkupInfoArea);
         end;
    +    i := aSynEdit.MarkupCount - 1;
    +    while (i >= 0) and not(aSynEdit.Markup[i] is TSynEditMarkupFoldColors) do
    +      dec(i);
    +    if i >= 0 then begin
    +      SetMarkupColor(ahaOutlineColor1,  TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color1);
    +      SetMarkupColor(ahaOutlineColor2,  TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color2);
    +      SetMarkupColor(ahaOutlineColor3,  TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color3);
    +      SetMarkupColor(ahaOutlineColor4,  TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color4);
    +      SetMarkupColor(ahaOutlineColor5,  TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color5);
    +      SetMarkupColor(ahaOutlineColor6,  TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color6);
    +      SetMarkupColor(ahaOutlineColor7,  TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color7);
    +      SetMarkupColor(ahaOutlineColor8,  TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color8);
    +      SetMarkupColor(ahaOutlineColor9,  TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color9);
    +      SetMarkupColor(ahaOutlineColor10, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color10);
    +    end;
       finally
         ASynEdit.EndUpdate;
       end;
    @@ -6825,20 +6873,18 @@
       i, l: Integer;
     begin
       Result := length(s1) - length(s2);
    -  if Result <> 0 then
    -    exit;
       i := 1;
       if Result < 0 then
         l := length(s1)
       else
         l := length(s2);
    -  while i < l do begin
    +  while i <= l do begin
         Result := ord(s1[i]) - ord(s2[i]);
         if Result <> 0 then
           exit;
         inc(i);
       end;
    -  Result := 0;
    +  Result := length(s1) - length(s2);
     end;
     
     initialization
    Index: ide/frames/editor_color_options.pas
    ===================================================================
    --- ide/frames/editor_color_options.pas	(revision 57125)
    +++ ide/frames/editor_color_options.pas	(working copy)
    @@ -276,6 +276,19 @@
         exit;
       end;
     
    +  // Special draw oultine color
    +  if Attri.Group = agnOutlineColors then begin
    +    c := Attri.FrameColor;
    +    if c <> clNone then begin
    +      TheTree.Canvas.Pen.Color := c;
    +      TheTree.Canvas.MoveTo(NodeRect.Left+(FullAbcWidth div 2), NodeRect.Top+2);
    +      TheTree.Canvas.LineTo(NodeRect.Left+(FullAbcWidth div 2), NodeRect.Bottom-2);
    +      TheTree.Canvas.MoveTo(NodeRect.Left+(FullAbcWidth div 2)+1, NodeRect.Top+2);
    +      TheTree.Canvas.LineTo(NodeRect.Left+(FullAbcWidth div 2)+1, NodeRect.Bottom-2);
    +    end;
    +    exit;
    +  end;
    +
       // Draw preview Frame
       TheTree.Canvas.Pen.Color := Attri.FrameColor;
       if (hafFrameColor in Attri.Features) and (AttriIdx <> ord(ahaCodeFoldingTree)) and
    Index: ide/lazarusidestrconsts.pas
    ===================================================================
    --- ide/lazarusidestrconsts.pas	(revision 57125)
    +++ ide/lazarusidestrconsts.pas	(working copy)
    @@ -2104,6 +2104,16 @@
       dlgAddHiAttrDefaultWindow       = 'Default Text / Window';
       dlgAddHiAttrWindowBorder        = 'Window border';
       dlgAddHiAttrHighlightPrefix     = 'Highlight prefix';
    +  dlgAddHiAttrOutlineColor1       = 'Color  1';
    +  dlgAddHiAttrOutlineColor2       = 'Color  2';
    +  dlgAddHiAttrOutlineColor3       = 'Color  3';
    +  dlgAddHiAttrOutlineColor4       = 'Color  4';
    +  dlgAddHiAttrOutlineColor5       = 'Color  5';
    +  dlgAddHiAttrOutlineColor6       = 'Color  6';
    +  dlgAddHiAttrOutlineColor7       = 'Color  7';
    +  dlgAddHiAttrOutlineColor8       = 'Color  8';
    +  dlgAddHiAttrOutlineColor9       = 'Color  9';
    +  dlgAddHiAttrOutlineColor10      = 'Color 10';
       dlgAddHiSpecialVisibleChars     = 'Visualized Special Chars';
       dlgTopInfoHint                  = 'Current Class/Proc Hint';
       dlgIfDefBlockInactive           = 'Inactive $IFDEF code';
    @@ -2120,6 +2130,7 @@
       dlgAddHiAttrGroupSyncroEdit    = 'Syncron Edit';
       dlgAddHiAttrGroupTemplateEdit  = 'Template Edit';
       dlgAddHiAttrGroupIfDef    = 'IfDef';
    +  dlgAddHiAttrGroupOutlineColors = 'Outline Colors';
     
       dlgEditAccessCaptionLockedInView            = 'Locked, if text in view';
       dlgEditAccessCaptionUnLockedInSoftView      = 'Unlocked, if text in centered view';
    Index: ide/sourceeditprocs.pas
    ===================================================================
    --- ide/sourceeditprocs.pas	(revision 57125)
    +++ ide/sourceeditprocs.pas	(working copy)
    @@ -154,8 +154,8 @@
       BGGreen: Integer;
       BGBlue: Integer;
       TokenStart: Integer;
    -  BackgroundColor: TColorRef;
    -  ForegroundColor: TColorRef;
    +  BackgroundColor: TColor;
    +  ForegroundColor: TColor;
       AllowFontColor: Boolean;
     
       procedure SetFontColor(NewColor: TColor);
    @@ -193,7 +193,7 @@
         RedDiff:=Abs(FGRed-BGRed);
         GreenDiff:=Abs(FGGreen-BGGreen);
         BlueDiff:=Abs(FGBlue -BGBlue);
    -    if RedDiff*RedDiff + GreenDiff*GreenDiff + BlueDiff*BlueDiff<30000 then
    +    if RedDiff*RedDiff + GreenDiff*GreenDiff + BlueDiff*BlueDiff<20000 then
         begin
           NewColor:=InvertColor(NewColor);
           {IncreaseDiff(FGRed,BGRed);
    Index: ide/sourcemarks.pas
    ===================================================================
    --- ide/sourcemarks.pas	(revision 57125)
    +++ ide/sourcemarks.pas	(working copy)
    @@ -64,12 +64,13 @@
          ahaTopInfoHint,
          ahaIfDefBlockInactive, ahaIfDefBlockActive, ahaIfDefBlockTmpActive,
          ahaIfDefNodeInactive, ahaIfDefNodeActive, ahaIfDefNodeTmpActive,
    -     ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
    +     ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight,
    +     ahaOutlineColor1, ahaOutlineColor2, ahaOutlineColor3, ahaOutlineColor4, ahaOutlineColor5, ahaOutlineColor6, ahaOutlineColor7, ahaOutlineColor8, ahaOutlineColor9, ahaOutlineColor10
          );
     
       TAhaGroupName = (
         agnDefault, agnLanguage, agnText, agnLine, agnGutter, agnTemplateMode, agnSyncronMode,
    -    agnIfDef, agnIdentComplWindow
    +    agnIfDef, agnIdentComplWindow, agnOutlineColors
       );
     
       TSourceEditorBase = class;
    
  • color_options_for_outline_coloring_V2.patch (18,718 bytes)
    Index: components/synedit/syneditmarkupfoldcoloring.pas
    ===================================================================
    --- components/synedit/syneditmarkupfoldcoloring.pas	(revision 57141)
    +++ components/synedit/syneditmarkupfoldcoloring.pas	(working copy)
    @@ -43,7 +43,7 @@
     unit SynEditMarkupFoldColoring;
     
     {$mode objfpc}{$H+}
    -{ $define SynEditMarkupFoldColoringDebug}
    +{off $define SynEditMarkupFoldColoringDebug}
     
     interface
     
    @@ -71,10 +71,21 @@
     
       TSynEditMarkupFoldColors = class(TSynEditMarkup)
       private
    +    fUpdateColors: Boolean;
         function GetFirstCharacterColumn(index: Integer): Byte;
         procedure TextBufferChanged(Sender: TObject);
       private
         FHighlighter: TSynCustomFoldHighlighter;
    +    FColor1: TSynSelectedColor;
    +    FColor2: TSynSelectedColor;
    +    FColor3: TSynSelectedColor;
    +    FColor4: TSynSelectedColor;
    +    FColor5: TSynSelectedColor;
    +    FColor6: TSynSelectedColor;
    +    FColor7: TSynSelectedColor;
    +    FColor8: TSynSelectedColor;
    +    FColor9: TSynSelectedColor;
    +    FColor10: TSynSelectedColor;
         FNestList: TLazSynEditNestedFoldsList;
     
         // cache
    @@ -88,7 +99,7 @@
         FDefaultGroup: integer;
         FFoldColorInfos: TMarkupFoldColorInfos;
     
    -    Colors : array of TColor;
    +    FColors : array of TColor;
         FPreparedRow: integer;
         FLastNode: TSynFoldNodeInfo;
         FLastEnabled: Boolean;
    @@ -100,6 +111,7 @@
         procedure SetFoldColorInfosCount(pNewCount: Integer);
         procedure InitCache;
         procedure ClearCache;
    +    procedure UpdateColors;
         property FirstCharacterColumn[index: Integer]: Byte read GetFirstCharacterColumn;
       protected
         // Notifications about Changes to the text
    @@ -108,6 +120,7 @@
         procedure LinesChanged(Sender: TSynEditStrings; aIndex, aCount: Integer);
         procedure HighlightChanged(Sender: TSynEditStrings; aIndex, aCount: Integer);
         procedure DoEnabledChanged(Sender: TObject); override;
    +    procedure ColorChanged(AMarkup: TObject);
       public
         constructor Create(ASynEdit : TSynEditBase);
         destructor Destroy; override;
    @@ -122,6 +135,16 @@
     
         procedure PrepareMarkupForRow(aRow : Integer); override;
         property DefaultGroup : integer read FDefaultGroup write SetDefaultGroup;
    +    property Color1:  TSynSelectedColor read FColor1;
    +    property Color2:  TSynSelectedColor read FColor2;
    +    property Color3:  TSynSelectedColor read FColor3;
    +    property Color4:  TSynSelectedColor read FColor4;
    +    property Color5:  TSynSelectedColor read FColor5;
    +    property Color6:  TSynSelectedColor read FColor6;
    +    property Color7:  TSynSelectedColor read FColor7;
    +    property Color8:  TSynSelectedColor read FColor8;
    +    property Color9:  TSynSelectedColor read FColor9;
    +    property Color10: TSynSelectedColor read FColor10;
       end;
     
     implementation
    @@ -169,6 +192,27 @@
       FNestList.FoldFlags := [sfbIncludeDisabled];
       FNestList.IncludeOpeningOnLine := True;
     
    +  FColor1 := TSynSelectedColor.Create;
    +  FColor1.OnChange := @ColorChanged;
    +  FColor2 := TSynSelectedColor.Create;
    +  FColor2.OnChange := @ColorChanged;
    +  FColor3 := TSynSelectedColor.Create;
    +  FColor3.OnChange := @ColorChanged;
    +  FColor4 := TSynSelectedColor.Create;
    +  FColor4.OnChange := @ColorChanged;
    +  FColor5 := TSynSelectedColor.Create;
    +  FColor5.OnChange := @ColorChanged;
    +  FColor6 := TSynSelectedColor.Create;
    +  FColor6.OnChange := @ColorChanged;
    +  FColor7 := TSynSelectedColor.Create;
    +  FColor7.OnChange := @ColorChanged;
    +  FColor8 := TSynSelectedColor.Create;
    +  FColor8.OnChange := @ColorChanged;
    +  FColor9 := TSynSelectedColor.Create;
    +  FColor9.OnChange := @ColorChanged;
    +  FColor10 := TSynSelectedColor.Create;
    +  FColor10.OnChange := @ColorChanged;
    +
       MarkupInfo.Foreground := clGreen;
       MarkupInfo.Background := clNone;
       MarkupInfo.Style := [];
    @@ -175,17 +219,32 @@
       MarkupInfo.StyleMask := [];
       MarkupInfo.FrameEdges:= sfeLeft;
     
    -  SetLength(Colors, 6);
    -  Colors[0] := clRed;
    -  Colors[1] := $000098F7; //orange
    -  Colors[2] := $0022CC40; //green
    -  Colors[3] := $00CCCC00;   //cyan
    -  Colors[4] := $00FF682A; //blue
    -  Colors[5] := $00CF00C4; //purple
    +  SetLength(FColors, 6);
    +  FColor1.FrameColor  := clRed;
    +  FColor2.FrameColor  := $000098F7; //orange
    +  FColor3.FrameColor  := $0022CC40; //green
    +  FColor4.FrameColor  := $00CCCC00;   //cyan
    +  FColor5.FrameColor  := $00FF682A; //blue
    +  FColor6.FrameColor  := $00CF00C4; //purple
    +  FColor7.FrameColor  := clNone;
    +  FColor8.FrameColor  := clNone;
    +  FColor9.FrameColor  := clNone;
    +  FColor10.FrameColor := clNone;
    +
     end;
     
     destructor TSynEditMarkupFoldColors.Destroy;
     begin
    +  FColor1.Free;
    +  FColor2.Free;
    +  FColor3.Free;
    +  FColor4.Free;
    +  FColor5.Free;
    +  FColor6.Free;
    +  FColor7.Free;
    +  FColor8.Free;
    +  FColor9.Free;
    +  FColor10.Free;
       if Assigned(Lines) then begin
         Lines.RemoveChangeHandler(senrLineCount, @LinesChanged);
         Lines.RemoveChangeHandler(senrHighlightChanged, @HighlightChanged);
    @@ -242,12 +301,12 @@
               x2both := max(x2both, x2);
               MarkupInfo.SetFrameBoundsLog(x, x2both);
               if Border then begin
    -            MarkupInfo.FrameColor:= Colors[ColorIdx];
    +            MarkupInfo.FrameColor:= FColors[ColorIdx];
                 MarkupInfo.FrameEdges:= sfeLeft;
               end else begin
                 MarkupInfo.FrameColor:= clNone;
                 MarkupInfo.FrameEdges:= sfeNone;
    -            MarkupInfo.Foreground := Colors[ColorIdx];
    +            MarkupInfo.Foreground := FColors[ColorIdx];
               end;
             end;
       end;
    @@ -343,7 +402,7 @@
           if not Border and (sfaOutlineNoColor in ANode.FoldAction) then
             Ignore := True;
           Level := lvl;
    -      ColorIdx := Max(0, lvl) mod (length(Colors));
    +      ColorIdx := Max(0, lvl) mod (length(FColors));
         end;
       end;
     
    @@ -354,6 +413,7 @@
     
     begin
       y := ToIdx(aRow);
    +  FNestList.Clear;
       FNestList.Line := y;
       NestCount := FNestList.Count;
       FHighlighter.CurrentLines := Lines;
    @@ -391,7 +451,7 @@
               if sfaOutlineKeepLevel in FFoldColorInfos[FFoldColorInfosCount - 2].SrcNode.FoldAction then begin
                 lvl := FFoldColorInfos[FFoldColorInfosCount - 2].Level;
                 FFoldColorInfos[FFoldColorInfosCount - 1].Level := lvl;
    -            FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(Colors));
    +            FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(FColors));
               end;
             end;
     
    @@ -451,7 +511,7 @@
             X2 := ANode.LogXEnd + 1;
             Level := lvl;
             if not (sfaOutlineNocolor in ANode.FoldAction) then
    -           ColorIdx := Max(0, lvl) mod (length(Colors))
    +           ColorIdx := Max(0, lvl) mod (length(FColors))
             else
                ColorIdx := -1;
           end;
    @@ -510,7 +570,7 @@
                 or (sfaOutlineKeepLevel in FFoldColorInfos[FFoldColorInfosCount - 2].SrcNode.FoldAction) then begin
                   lvl := FFoldColorInfos[FFoldColorInfosCount - 2].Level;
                   FFoldColorInfos[FFoldColorInfosCount - 1].Level := lvl;
    -              FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(Colors));
    +              FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(FColors));
                 end;
               end;
     
    @@ -577,6 +637,12 @@
       //DebugLn('PrepareMarkupForRow %d', [aRow]);
       {$ENDIF}
       if not Assigned(FHighlighter) then exit;
    +
    +  if fUpdateColors then begin
    +    UpdateColors;
    +    fUpdateColors := False;
    +  end;
    +
       FPreparedRow := aRow;
       FFoldColorInfosCount := 0; //reset needed to prevent using of invalid area
     
    @@ -664,6 +730,37 @@
       end;
     end;
     
    +procedure TSynEditMarkupFoldColors.UpdateColors;
    +var
    +  c: Integer;
    +
    +  procedure AddColor(pColor: TSynSelectedColor);
    +  begin
    +    if pColor.FrameColor = clNone then exit;
    +    fColors[c] := pColor.FrameColor;
    +    inc(c);
    +  end;
    +
    +begin
    +  SetLength(fColors, 10);
    +  c := 0;
    +  AddColor(FColor1);
    +  AddColor(FColor2);
    +  AddColor(FColor3);
    +  AddColor(FColor4);
    +  AddColor(FColor5);
    +  AddColor(FColor6);
    +  AddColor(FColor7);
    +  AddColor(FColor8);
    +  AddColor(FColor9);
    +  AddColor(FColor10);
    +  if c = 0 then begin
    +    fColors[c] := $FF;
    +    inc(c);
    +  end;
    +  SetLength(fColors, c);
    +end;
    +
     procedure TSynEditMarkupFoldColors.DoTextChanged(StartLine, EndLine,
       ACountDiff: Integer);
     
    @@ -952,6 +1049,11 @@
         InvalidateSynLines(1, Lines.Count);
     end;
     
    +procedure TSynEditMarkupFoldColors.ColorChanged(AMarkup: TObject);
    +begin
    +  fUpdateColors := True;
    +end;
    +
     end.
     
     
    Index: ide/editoroptions.pp
    ===================================================================
    --- ide/editoroptions.pp	(revision 57141)
    +++ ide/editoroptions.pp	(working copy)
    @@ -121,7 +121,8 @@
         '',  // ahaTopInfoHint
         '', '', '',  // ahaIfDefBlockInactive, ahaIfDefBlockActive, ahaIfDefBlockTmpActive
         '', '', '',  // ahaIfDefNodeInactive, ahaIfDefNodeActive, ahaIfDefNodeTmpActive
    -    '', '', '', '' // ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
    +    '', '', '', '', // ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
    +    '', '', '', '', '', '', '', '', '', '' // ahaOutlineColor01..10
       );
     
       ahaGroupMap: array[TAdditionalHilightAttribute] of TAhaGroupName = (
    @@ -167,7 +168,17 @@
         { ahaIdentComplWindow }           agnIdentComplWindow,
         { ahaIdentComplWindowBorder }     agnIdentComplWindow,
         { ahaIdentComplWindowSelection }  agnIdentComplWindow,
    -    { ahaIdentComplWindowHighlight }  agnIdentComplWindow
    +    { ahaIdentComplWindowHighlight }  agnIdentComplWindow,
    +    { ahaOutlineColor01 }      agnOutlineColors,
    +    { ahaOutlineColor02 }      agnOutlineColors,
    +    { ahaOutlineColor03 }      agnOutlineColors,
    +    { ahaOutlineColor04 }      agnOutlineColors,
    +    { ahaOutlineColor05 }      agnOutlineColors,
    +    { ahaOutlineColor06 }      agnOutlineColors,
    +    { ahaOutlineColor07 }      agnOutlineColors,
    +    { ahaOutlineColor08 }      agnOutlineColors,
    +    { ahaOutlineColor09 }      agnOutlineColors,
    +    { ahaOutlineColor10 }      agnOutlineColors
     
       );
       ahaSupportedFeatures: array[TAdditionalHilightAttribute] of TColorSchemeAttributeFeatures =
    @@ -214,7 +225,17 @@
         { ahaIdentComplWindow }   [hafBackColor, hafForeColor],
         { ahaIdentComplWindowBorder }    [hafForeColor],
         { ahaIdentComplWindowSelection } [hafBackColor, hafForeColor],
    -    { ahaIdentComplWindowHighlight } [hafForeColor]
    +    { ahaIdentComplWindowHighlight } [hafForeColor],
    +    { ahaFoldColor01 }        [hafFrameColor, hafFrameStyle],
    +    { ahaFoldColor02 }        [hafFrameColor, hafFrameStyle],
    +    { ahaFoldColor03 }        [hafFrameColor, hafFrameStyle],
    +    { ahaFoldColor04 }        [hafFrameColor, hafFrameStyle],
    +    { ahaFoldColor05 }        [hafFrameColor, hafFrameStyle],
    +    { ahaFoldColor06 }        [hafFrameColor, hafFrameStyle],
    +    { ahaFoldColor07 }        [hafFrameColor, hafFrameStyle],
    +    { ahaFoldColor08 }        [hafFrameColor, hafFrameStyle],
    +    { ahaFoldColor09 }        [hafFrameColor, hafFrameStyle],
    +    { ahaFoldColor10 }        [hafFrameColor, hafFrameStyle]
       );
     
     
    @@ -2478,6 +2499,18 @@
       AdditionalHighlightAttributes[ahaIdentComplWindowHighlight] := dlgAddHiAttrHighlightPrefix;
       AdditionalHighlightGroupNames[agnIdentComplWindow]          := dlgIdentifierCompletion;
     
    +  AdditionalHighlightAttributes[ahaOutlineColor01] := dlgAddHiAttrOutlineColor1;
    +  AdditionalHighlightAttributes[ahaOutlineColor02] := dlgAddHiAttrOutlineColor2;
    +  AdditionalHighlightAttributes[ahaOutlineColor03] := dlgAddHiAttrOutlineColor3;
    +  AdditionalHighlightAttributes[ahaOutlineColor04] := dlgAddHiAttrOutlineColor4;
    +  AdditionalHighlightAttributes[ahaOutlineColor05] := dlgAddHiAttrOutlineColor5;
    +  AdditionalHighlightAttributes[ahaOutlineColor06] := dlgAddHiAttrOutlineColor6;
    +  AdditionalHighlightAttributes[ahaOutlineColor07] := dlgAddHiAttrOutlineColor7;
    +  AdditionalHighlightAttributes[ahaOutlineColor08] := dlgAddHiAttrOutlineColor8;
    +  AdditionalHighlightAttributes[ahaOutlineColor09] := dlgAddHiAttrOutlineColor9;
    +  AdditionalHighlightAttributes[ahaOutlineColor10] := dlgAddHiAttrOutlineColor10;
    +  AdditionalHighlightGroupNames[agnOutlineColors]  := dlgAddHiAttrGroupOutlineColors;
    +
       AdditionalHighlightGroupNames[agnDefault]      := dlgAddHiAttrGroupDefault;
       AdditionalHighlightGroupNames[agnText]         := dlgAddHiAttrGroupText;
       AdditionalHighlightGroupNames[agnLine]         := dlgAddHiAttrGroupLine;
    @@ -6541,6 +6574,21 @@
           SetMarkupColor(ahaSyncroEditSync,  TSynPluginSyncroEdit(aSynEdit.Plugin[i]).MarkupInfoSync);
           SetMarkupColor(ahaSyncroEditArea,  TSynPluginSyncroEdit(aSynEdit.Plugin[i]).MarkupInfoArea);
         end;
    +    i := aSynEdit.MarkupCount - 1;
    +    while (i >= 0) and not(aSynEdit.Markup[i] is TSynEditMarkupFoldColors) do
    +      dec(i);
    +    if i >= 0 then begin
    +      SetMarkupColor(ahaOutlineColor01, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color1);
    +      SetMarkupColor(ahaOutlineColor02, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color2);
    +      SetMarkupColor(ahaOutlineColor03, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color3);
    +      SetMarkupColor(ahaOutlineColor04, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color4);
    +      SetMarkupColor(ahaOutlineColor05, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color5);
    +      SetMarkupColor(ahaOutlineColor06, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color6);
    +      SetMarkupColor(ahaOutlineColor07, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color7);
    +      SetMarkupColor(ahaOutlineColor08, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color8);
    +      SetMarkupColor(ahaOutlineColor09, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color9);
    +      SetMarkupColor(ahaOutlineColor10, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color10);
    +    end;
       finally
         ASynEdit.EndUpdate;
       end;
    @@ -6825,20 +6873,18 @@
       i, l: Integer;
     begin
       Result := length(s1) - length(s2);
    -  if Result <> 0 then
    -    exit;
       i := 1;
       if Result < 0 then
         l := length(s1)
       else
         l := length(s2);
    -  while i < l do begin
    +  while i <= l do begin
         Result := ord(s1[i]) - ord(s2[i]);
         if Result <> 0 then
           exit;
         inc(i);
       end;
    -  Result := 0;
    +  Result := length(s1) - length(s2);
     end;
     
     initialization
    Index: ide/frames/editor_color_options.pas
    ===================================================================
    --- ide/frames/editor_color_options.pas	(revision 57141)
    +++ ide/frames/editor_color_options.pas	(working copy)
    @@ -276,6 +276,19 @@
         exit;
       end;
     
    +  // Special draw oultine color
    +  if Attri.Group = agnOutlineColors then begin
    +    c := Attri.FrameColor;
    +    if c <> clNone then begin
    +      TheTree.Canvas.Pen.Color := c;
    +      TheTree.Canvas.MoveTo(NodeRect.Left+(FullAbcWidth div 2), NodeRect.Top+2);
    +      TheTree.Canvas.LineTo(NodeRect.Left+(FullAbcWidth div 2), NodeRect.Bottom-2);
    +      TheTree.Canvas.MoveTo(NodeRect.Left+(FullAbcWidth div 2)+1, NodeRect.Top+2);
    +      TheTree.Canvas.LineTo(NodeRect.Left+(FullAbcWidth div 2)+1, NodeRect.Bottom-2);
    +    end;
    +    exit;
    +  end;
    +
       // Draw preview Frame
       TheTree.Canvas.Pen.Color := Attri.FrameColor;
       if (hafFrameColor in Attri.Features) and (AttriIdx <> ord(ahaCodeFoldingTree)) and
    Index: ide/lazarusidestrconsts.pas
    ===================================================================
    --- ide/lazarusidestrconsts.pas	(revision 57141)
    +++ ide/lazarusidestrconsts.pas	(working copy)
    @@ -2104,6 +2104,16 @@
       dlgAddHiAttrDefaultWindow       = 'Default Text / Window';
       dlgAddHiAttrWindowBorder        = 'Window border';
       dlgAddHiAttrHighlightPrefix     = 'Highlight prefix';
    +  dlgAddHiAttrOutlineColor1       = 'Color  1';
    +  dlgAddHiAttrOutlineColor2       = 'Color  2';
    +  dlgAddHiAttrOutlineColor3       = 'Color  3';
    +  dlgAddHiAttrOutlineColor4       = 'Color  4';
    +  dlgAddHiAttrOutlineColor5       = 'Color  5';
    +  dlgAddHiAttrOutlineColor6       = 'Color  6';
    +  dlgAddHiAttrOutlineColor7       = 'Color  7';
    +  dlgAddHiAttrOutlineColor8       = 'Color  8';
    +  dlgAddHiAttrOutlineColor9       = 'Color  9';
    +  dlgAddHiAttrOutlineColor10      = 'Color 10';
       dlgAddHiSpecialVisibleChars     = 'Visualized Special Chars';
       dlgTopInfoHint                  = 'Current Class/Proc Hint';
       dlgIfDefBlockInactive           = 'Inactive $IFDEF code';
    @@ -2120,6 +2130,7 @@
       dlgAddHiAttrGroupSyncroEdit    = 'Syncron Edit';
       dlgAddHiAttrGroupTemplateEdit  = 'Template Edit';
       dlgAddHiAttrGroupIfDef    = 'IfDef';
    +  dlgAddHiAttrGroupOutlineColors = 'Outline Colors';
     
       dlgEditAccessCaptionLockedInView            = 'Locked, if text in view';
       dlgEditAccessCaptionUnLockedInSoftView      = 'Unlocked, if text in centered view';
    Index: ide/sourceeditprocs.pas
    ===================================================================
    --- ide/sourceeditprocs.pas	(revision 57141)
    +++ ide/sourceeditprocs.pas	(working copy)
    @@ -154,8 +154,8 @@
       BGGreen: Integer;
       BGBlue: Integer;
       TokenStart: Integer;
    -  BackgroundColor: TColorRef;
    -  ForegroundColor: TColorRef;
    +  BackgroundColor: TColor;
    +  ForegroundColor: TColor;
       AllowFontColor: Boolean;
     
       procedure SetFontColor(NewColor: TColor);
    @@ -193,7 +193,7 @@
         RedDiff:=Abs(FGRed-BGRed);
         GreenDiff:=Abs(FGGreen-BGGreen);
         BlueDiff:=Abs(FGBlue -BGBlue);
    -    if RedDiff*RedDiff + GreenDiff*GreenDiff + BlueDiff*BlueDiff<30000 then
    +    if RedDiff*RedDiff + GreenDiff*GreenDiff + BlueDiff*BlueDiff<20000 then
         begin
           NewColor:=InvertColor(NewColor);
           {IncreaseDiff(FGRed,BGRed);
    Index: ide/sourcemarks.pas
    ===================================================================
    --- ide/sourcemarks.pas	(revision 57141)
    +++ ide/sourcemarks.pas	(working copy)
    @@ -64,12 +64,13 @@
          ahaTopInfoHint,
          ahaIfDefBlockInactive, ahaIfDefBlockActive, ahaIfDefBlockTmpActive,
          ahaIfDefNodeInactive, ahaIfDefNodeActive, ahaIfDefNodeTmpActive,
    -     ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
    +     ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight,
    +     ahaOutlineColor01, ahaOutlineColor02, ahaOutlineColor03, ahaOutlineColor04, ahaOutlineColor05, ahaOutlineColor06, ahaOutlineColor07, ahaOutlineColor08, ahaOutlineColor09, ahaOutlineColor10
          );
     
       TAhaGroupName = (
         agnDefault, agnLanguage, agnText, agnLine, agnGutter, agnTemplateMode, agnSyncronMode,
    -    agnIfDef, agnIdentComplWindow
    +    agnIfDef, agnIdentComplWindow, agnOutlineColors
       );
     
       TSourceEditorBase = class;
    
  • color_outlines.png (6,799 bytes)
    color_outlines.png (6,799 bytes)
  • color_options_for_outline_coloring_V3.patch (21,044 bytes)
    Index: components/synedit/syneditmarkupfoldcoloring.pas
    ===================================================================
    --- components/synedit/syneditmarkupfoldcoloring.pas	(revision 57176)
    +++ components/synedit/syneditmarkupfoldcoloring.pas	(working copy)
    @@ -43,7 +43,7 @@
     unit SynEditMarkupFoldColoring;
     
     {$mode objfpc}{$H+}
    -{ $define SynEditMarkupFoldColoringDebug}
    +{off $define SynEditMarkupFoldColoringDebug}
     
     interface
     
    @@ -71,10 +71,12 @@
     
       TSynEditMarkupFoldColors = class(TSynEditMarkup)
       private
    +    fUpdateColors: Boolean;
         function GetFirstCharacterColumn(index: Integer): Byte;
         procedure TextBufferChanged(Sender: TObject);
       private
         FHighlighter: TSynCustomFoldHighlighter;
    +    FMarkupColors: array of TSynSelectedColor;
         FNestList: TLazSynEditNestedFoldsList;
     
         // cache
    @@ -88,7 +90,7 @@
         FDefaultGroup: integer;
         FFoldColorInfos: TMarkupFoldColorInfos;
     
    -    Colors : array of TColor;
    +    FColors : array of TColor;
         FPreparedRow: integer;
         FLastNode: TSynFoldNodeInfo;
         FLastEnabled: Boolean;
    @@ -95,11 +97,13 @@
     
         procedure DoMarkupParentFoldAtRow(aRow: Integer);
         procedure DoMarkupParentCloseFoldAtRow(aRow: Integer);
    +    function GetColor(pIndex: Integer): TSynSelectedColor;
         procedure SetDefaultGroup(AValue: integer);
         procedure SetCacheCount(pNewCount: Integer);
         procedure SetFoldColorInfosCount(pNewCount: Integer);
         procedure InitCache;
         procedure ClearCache;
    +    procedure UpdateColors;
         property FirstCharacterColumn[index: Integer]: Byte read GetFirstCharacterColumn;
       protected
         // Notifications about Changes to the text
    @@ -108,6 +112,7 @@
         procedure LinesChanged(Sender: TSynEditStrings; aIndex, aCount: Integer);
         procedure HighlightChanged(Sender: TSynEditStrings; aIndex, aCount: Integer);
         procedure DoEnabledChanged(Sender: TObject); override;
    +    procedure ColorChanged(AMarkup: TObject);
       public
         constructor Create(ASynEdit : TSynEditBase);
         destructor Destroy; override;
    @@ -122,6 +127,7 @@
     
         procedure PrepareMarkupForRow(aRow : Integer); override;
         property DefaultGroup : integer read FDefaultGroup write SetDefaultGroup;
    +    property Color[pIndex: Integer]: TSynSelectedColor read GetColor;
       end;
     
     implementation
    @@ -147,6 +153,8 @@
     { TSynEditMarkupFoldColors }
     
     constructor TSynEditMarkupFoldColors.Create(ASynEdit: TSynEditBase);
    +var
    +  i: Integer;
     begin
       inherited Create(ASynEdit);
     
    @@ -169,6 +177,12 @@
       FNestList.FoldFlags := [sfbIncludeDisabled];
       FNestList.IncludeOpeningOnLine := True;
     
    +  SetLength(FMarkupColors, 10);
    +  for i := 0 to length(FMarkupColors) - 1 do begin
    +    FMarkupColors[i] := TSynSelectedColor.Create;
    +    FMarkupColors[i].OnChange := @ColorChanged;
    +  end;
    +
       MarkupInfo.Foreground := clGreen;
       MarkupInfo.Background := clNone;
       MarkupInfo.Style := [];
    @@ -175,17 +189,26 @@
       MarkupInfo.StyleMask := [];
       MarkupInfo.FrameEdges:= sfeLeft;
     
    -  SetLength(Colors, 6);
    -  Colors[0] := clRed;
    -  Colors[1] := $000098F7; //orange
    -  Colors[2] := $0022CC40; //green
    -  Colors[3] := $00CCCC00;   //cyan
    -  Colors[4] := $00FF682A; //blue
    -  Colors[5] := $00CF00C4; //purple
    +  SetLength(FColors, 6);
    +  FMarkupColors[0].Foreground  := clRed;
    +  FMarkupColors[1].Foreground  := $000098F7; //orange
    +  FMarkupColors[2].Foreground  := $0022CC40; //green
    +  FMarkupColors[3].Foreground  := $00CCCC00;   //cyan
    +  FMarkupColors[4].Foreground  := $00FF682A; //blue
    +  FMarkupColors[5].Foreground  := $00CF00C4; //purple
    +  FMarkupColors[6].Foreground  := clNone;
    +  FMarkupColors[7].Foreground  := clNone;
    +  FMarkupColors[8].Foreground  := clNone;
    +  FMarkupColors[9].Foreground := clNone;
    +
     end;
     
     destructor TSynEditMarkupFoldColors.Destroy;
    +var
    +  i: Integer;
     begin
    +  for i := 0 to Length(FMarkupColors) - 1 do
    +    FMarkupColors[i].Free;
       if Assigned(Lines) then begin
         Lines.RemoveChangeHandler(senrLineCount, @LinesChanged);
         Lines.RemoveChangeHandler(senrHighlightChanged, @HighlightChanged);
    @@ -242,12 +265,12 @@
               x2both := max(x2both, x2);
               MarkupInfo.SetFrameBoundsLog(x, x2both);
               if Border then begin
    -            MarkupInfo.FrameColor:= Colors[ColorIdx];
    +            MarkupInfo.FrameColor:= FColors[ColorIdx];
                 MarkupInfo.FrameEdges:= sfeLeft;
               end else begin
                 MarkupInfo.FrameColor:= clNone;
                 MarkupInfo.FrameEdges:= sfeNone;
    -            MarkupInfo.Foreground := Colors[ColorIdx];
    +            MarkupInfo.Foreground := FColors[ColorIdx];
               end;
             end;
       end;
    @@ -343,7 +366,7 @@
           if not Border and (sfaOutlineNoColor in ANode.FoldAction) then
             Ignore := True;
           Level := lvl;
    -      ColorIdx := Max(0, lvl) mod (length(Colors));
    +      ColorIdx := Max(0, lvl) mod (length(FColors));
         end;
       end;
     
    @@ -354,6 +377,7 @@
     
     begin
       y := ToIdx(aRow);
    +  FNestList.Clear;
       FNestList.Line := y;
       NestCount := FNestList.Count;
       FHighlighter.CurrentLines := Lines;
    @@ -391,7 +415,7 @@
               if sfaOutlineKeepLevel in FFoldColorInfos[FFoldColorInfosCount - 2].SrcNode.FoldAction then begin
                 lvl := FFoldColorInfos[FFoldColorInfosCount - 2].Level;
                 FFoldColorInfos[FFoldColorInfosCount - 1].Level := lvl;
    -            FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(Colors));
    +            FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(FColors));
               end;
             end;
     
    @@ -451,7 +475,7 @@
             X2 := ANode.LogXEnd + 1;
             Level := lvl;
             if not (sfaOutlineNocolor in ANode.FoldAction) then
    -           ColorIdx := Max(0, lvl) mod (length(Colors))
    +           ColorIdx := Max(0, lvl) mod (length(FColors))
             else
                ColorIdx := -1;
           end;
    @@ -510,7 +534,7 @@
                 or (sfaOutlineKeepLevel in FFoldColorInfos[FFoldColorInfosCount - 2].SrcNode.FoldAction) then begin
                   lvl := FFoldColorInfos[FFoldColorInfosCount - 2].Level;
                   FFoldColorInfos[FFoldColorInfosCount - 1].Level := lvl;
    -              FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(Colors));
    +              FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(FColors));
                 end;
               end;
     
    @@ -568,6 +592,12 @@
       end;
     end;
     
    +function TSynEditMarkupFoldColors.GetColor(pIndex: Integer): TSynSelectedColor;
    +begin
    +  Assert((pIndex >= 0) and (pIndex < Length(FMarkupColors)), 'Index out of range');
    +  Result := FMarkupColors[pIndex];
    +end;
    +
     procedure TSynEditMarkupFoldColors.PrepareMarkupForRow(aRow: Integer);
     var
       i, LastX, j: Integer;
    @@ -577,6 +607,12 @@
       //DebugLn('PrepareMarkupForRow %d', [aRow]);
       {$ENDIF}
       if not Assigned(FHighlighter) then exit;
    +
    +  if fUpdateColors then begin
    +    UpdateColors;
    +    fUpdateColors := False;
    +  end;
    +
       FPreparedRow := aRow;
       FFoldColorInfosCount := 0; //reset needed to prevent using of invalid area
     
    @@ -664,6 +700,29 @@
       end;
     end;
     
    +procedure TSynEditMarkupFoldColors.UpdateColors;
    +var
    +  c, i: Integer;
    +
    +  procedure AddColor(pColor: TSynSelectedColor);
    +  begin
    +    if pColor.Foreground = clNone then exit;
    +    fColors[c] := pColor.Foreground;
    +    inc(c);
    +  end;
    +
    +begin
    +  SetLength(fColors, Length(FMarkupColors));
    +  c := 0;
    +  for i := 0 to length(FMarkupColors) -1 do
    +    AddColor(FMarkupColors[i]);
    +  if c = 0 then begin
    +    fColors[c] := $0000FF; // default red
    +    inc(c);
    +  end;
    +  SetLength(fColors, c);
    +end;
    +
     procedure TSynEditMarkupFoldColors.DoTextChanged(StartLine, EndLine,
       ACountDiff: Integer);
     
    @@ -952,6 +1011,11 @@
         InvalidateSynLines(1, Lines.Count);
     end;
     
    +procedure TSynEditMarkupFoldColors.ColorChanged(AMarkup: TObject);
    +begin
    +  fUpdateColors := True;
    +end;
    +
     end.
     
     
    Index: ide/ColorDefault.xml
    ===================================================================
    --- ide/ColorDefault.xml	(revision 57176)
    +++ ide/ColorDefault.xml	(working copy)
    @@ -44,6 +44,12 @@
               <ahaGutter Background="clBtnFace"/>
               <ahaRightMargin Foreground="clSilver"/>
               <ahaIdentComplWindowHighlight Foreground="187"/>
    +          <ahaOutlineLevel1Color Foreground="clRed"/>
    +          <ahaOutlineLevel2Color Foreground="39159"/>
    +          <ahaOutlineLevel3Color Foreground="2280512"/>
    +          <ahaOutlineLevel4Color Foreground="13421568"/>
    +          <ahaOutlineLevel5Color Foreground="16738346"/>
    +          <ahaOutlineLevel6Color Foreground="13566148"/>
             </SchemeDefault>
           </Globals>
           <LangObjectPascal Version="6">
    Index: ide/ColorDelphi.xml
    ===================================================================
    --- ide/ColorDelphi.xml	(revision 57176)
    +++ ide/ColorDelphi.xml	(working copy)
    @@ -44,6 +44,12 @@
               <ahaGutter Background="clBtnFace"/>
               <ahaRightMargin Foreground="clSilver"/>
               <ahaIdentComplWindowHighlight Foreground="191"/>
    +          <ahaOutlineLevel1Color Foreground="clRed"/>
    +          <ahaOutlineLevel2Color Foreground="39159"/>
    +          <ahaOutlineLevel3Color Foreground="2280512"/>
    +          <ahaOutlineLevel4Color Foreground="13421568"/>
    +          <ahaOutlineLevel5Color Foreground="16738346"/>
    +          <ahaOutlineLevel6Color Foreground="13566148"/>
             </SchemeDelphi>
           </Globals>
           <LangObjectPascal Version="6">
    Index: ide/ColorOcean.xml
    ===================================================================
    --- ide/ColorOcean.xml	(revision 57176)
    +++ ide/ColorOcean.xml	(working copy)
    @@ -45,6 +45,12 @@
               <ahaRightMargin Foreground="clSilver"/>
               <ahaIdentComplWindowHighlight Foreground="clAqua"/>
               <ahaIdentComplWindow Background="8388649"/>
    +          <ahaOutlineLevel1Color Foreground="clRed"/>
    +          <ahaOutlineLevel2Color Foreground="39159"/>
    +          <ahaOutlineLevel3Color Foreground="2280512"/>
    +          <ahaOutlineLevel4Color Foreground="13421568"/>
    +          <ahaOutlineLevel5Color Foreground="16738346"/>
    +          <ahaOutlineLevel6Color Foreground="13566148"/>
             </SchemeOcean>
           </Globals>
           <LangObjectPascal Version="6">
    Index: ide/ColorPascalClassic.xml
    ===================================================================
    --- ide/ColorPascalClassic.xml	(revision 57176)
    +++ ide/ColorPascalClassic.xml	(working copy)
    @@ -44,6 +44,12 @@
               <ahaGutter Background="clNavy"/>
               <ahaIdentComplWindowHighlight Foreground="clAqua"/>
               <ahaIdentComplWindow Background="10420276"/>
    +          <ahaOutlineLevel1Color Foreground="clRed"/>
    +          <ahaOutlineLevel2Color Foreground="39159"/>
    +          <ahaOutlineLevel3Color Foreground="2280512"/>
    +          <ahaOutlineLevel4Color Foreground="13421568"/>
    +          <ahaOutlineLevel5Color Foreground="16738346"/>
    +          <ahaOutlineLevel6Color Foreground="13566148"/>
             </SchemePascal_Classic>
           </Globals>
           <LangObjectPascal Version="6">
    Index: ide/ColorTwilight.xml
    ===================================================================
    --- ide/ColorTwilight.xml	(revision 57176)
    +++ ide/ColorTwilight.xml	(working copy)
    @@ -46,6 +46,12 @@
               <ahaIdentComplWindow Background="3552822"/>
               <ahaIdentComplWindowBorder Foreground="7039851"/>
               <ahaIdentComplWindowHighlight Foreground="clLime"/>
    +          <ahaOutlineLevel1Color Foreground="clRed"/>
    +          <ahaOutlineLevel2Color Foreground="39159"/>
    +          <ahaOutlineLevel3Color Foreground="2280512"/>
    +          <ahaOutlineLevel4Color Foreground="13421568"/>
    +          <ahaOutlineLevel5Color Foreground="16738346"/>
    +          <ahaOutlineLevel6Color Foreground="13566148"/>
             </SchemeTwilight>
           </Globals>
           <LangObjectPascal Version="6">
    Index: ide/editoroptions.pp
    ===================================================================
    --- ide/editoroptions.pp	(revision 57176)
    +++ ide/editoroptions.pp	(working copy)
    @@ -121,7 +121,8 @@
         '',  // ahaTopInfoHint
         '', '', '',  // ahaIfDefBlockInactive, ahaIfDefBlockActive, ahaIfDefBlockTmpActive
         '', '', '',  // ahaIfDefNodeInactive, ahaIfDefNodeActive, ahaIfDefNodeTmpActive
    -    '', '', '', '' // ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
    +    '', '', '', '', // ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
    +    '', '', '', '', '', '', '', '', '', '' // ahaOutlineLevel1Color..ahaOutlineLevel10Color
       );
     
       ahaGroupMap: array[TAdditionalHilightAttribute] of TAhaGroupName = (
    @@ -167,7 +168,17 @@
         { ahaIdentComplWindow }           agnIdentComplWindow,
         { ahaIdentComplWindowBorder }     agnIdentComplWindow,
         { ahaIdentComplWindowSelection }  agnIdentComplWindow,
    -    { ahaIdentComplWindowHighlight }  agnIdentComplWindow
    +    { ahaIdentComplWindowHighlight }  agnIdentComplWindow,
    +    { ahaOutlineLevel1Color }  agnOutlineColors,
    +    { ahaOutlineLevel2Color }  agnOutlineColors,
    +    { ahaOutlineLevel3Color }  agnOutlineColors,
    +    { ahaOutlineLevel4Color }  agnOutlineColors,
    +    { ahaOutlineLevel5Color }  agnOutlineColors,
    +    { ahaOutlineLevel6Color }  agnOutlineColors,
    +    { ahaOutlineLevel7Color }  agnOutlineColors,
    +    { ahaOutlineLevel8Color }  agnOutlineColors,
    +    { ahaOutlineLevel9Color }  agnOutlineColors,
    +    { ahaOutlineLevel10Color } agnOutlineColors
     
       );
       ahaSupportedFeatures: array[TAdditionalHilightAttribute] of TColorSchemeAttributeFeatures =
    @@ -214,7 +225,17 @@
         { ahaIdentComplWindow }   [hafBackColor, hafForeColor],
         { ahaIdentComplWindowBorder }    [hafForeColor],
         { ahaIdentComplWindowSelection } [hafBackColor, hafForeColor],
    -    { ahaIdentComplWindowHighlight } [hafForeColor]
    +    { ahaIdentComplWindowHighlight } [hafForeColor],
    +    { ahaFoldLevel1Color }    [hafForeColor],
    +    { ahaFoldLevel2Color }    [hafForeColor],
    +    { ahaFoldLevel3Color }    [hafForeColor],
    +    { ahaFoldLevel4Color }    [hafForeColor],
    +    { ahaFoldLevel5Color }    [hafForeColor],
    +    { ahaFoldLevel6Color }    [hafForeColor],
    +    { ahaFoldLevel7Color }    [hafForeColor],
    +    { ahaFoldLevel8Color }    [hafForeColor],
    +    { ahaFoldLevel9Color }    [hafForeColor],
    +    { ahaFoldLevel10Color }   [hafForeColor]
       );
     
     
    @@ -2478,6 +2499,18 @@
       AdditionalHighlightAttributes[ahaIdentComplWindowHighlight] := dlgAddHiAttrHighlightPrefix;
       AdditionalHighlightGroupNames[agnIdentComplWindow]          := dlgIdentifierCompletion;
     
    +  AdditionalHighlightAttributes[ahaOutlineLevel1Color]  := dlgAddHiAttrOutlineLevel1Color;
    +  AdditionalHighlightAttributes[ahaOutlineLevel2Color]  := dlgAddHiAttrOutlineLevel2Color;
    +  AdditionalHighlightAttributes[ahaOutlineLevel3Color]  := dlgAddHiAttrOutlineLevel3Color;
    +  AdditionalHighlightAttributes[ahaOutlineLevel4Color]  := dlgAddHiAttrOutlineLevel4Color;
    +  AdditionalHighlightAttributes[ahaOutlineLevel5Color]  := dlgAddHiAttrOutlineLevel5Color;
    +  AdditionalHighlightAttributes[ahaOutlineLevel6Color]  := dlgAddHiAttrOutlineLevel6Color;
    +  AdditionalHighlightAttributes[ahaOutlineLevel7Color]  := dlgAddHiAttrOutlineLevel7Color;
    +  AdditionalHighlightAttributes[ahaOutlineLevel8Color]  := dlgAddHiAttrOutlineLevel8Color;
    +  AdditionalHighlightAttributes[ahaOutlineLevel9Color]  := dlgAddHiAttrOutlineLevel9Color;
    +  AdditionalHighlightAttributes[ahaOutlineLevel10Color] := dlgAddHiAttrOutlineLevel10Color;
    +  AdditionalHighlightGroupNames[agnOutlineColors]  := dlgAddHiAttrGroupOutlineColors;
    +
       AdditionalHighlightGroupNames[agnDefault]      := dlgAddHiAttrGroupDefault;
       AdditionalHighlightGroupNames[agnText]         := dlgAddHiAttrGroupText;
       AdditionalHighlightGroupNames[agnLine]         := dlgAddHiAttrGroupLine;
    @@ -6541,6 +6574,21 @@
           SetMarkupColor(ahaSyncroEditSync,  TSynPluginSyncroEdit(aSynEdit.Plugin[i]).MarkupInfoSync);
           SetMarkupColor(ahaSyncroEditArea,  TSynPluginSyncroEdit(aSynEdit.Plugin[i]).MarkupInfoArea);
         end;
    +    i := aSynEdit.MarkupCount - 1;
    +    while (i >= 0) and not(aSynEdit.Markup[i] is TSynEditMarkupFoldColors) do
    +      dec(i);
    +    if i >= 0 then begin
    +      SetMarkupColor(ahaOutlineLevel1Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[0]);
    +      SetMarkupColor(ahaOutlineLevel2Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[1]);
    +      SetMarkupColor(ahaOutlineLevel3Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[2]);
    +      SetMarkupColor(ahaOutlineLevel4Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[3]);
    +      SetMarkupColor(ahaOutlineLevel5Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[4]);
    +      SetMarkupColor(ahaOutlineLevel6Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[5]);
    +      SetMarkupColor(ahaOutlineLevel7Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[6]);
    +      SetMarkupColor(ahaOutlineLevel8Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[7]);
    +      SetMarkupColor(ahaOutlineLevel9Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[8]);
    +      SetMarkupColor(ahaOutlineLevel10Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[9]);
    +    end;
       finally
         ASynEdit.EndUpdate;
       end;
    Index: ide/editoroptions.res
    ===================================================================
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    Index: ide/frames/editor_color_options.pas
    ===================================================================
    --- ide/frames/editor_color_options.pas	(revision 57176)
    +++ ide/frames/editor_color_options.pas	(working copy)
    @@ -276,6 +276,19 @@
         exit;
       end;
     
    +  // Special draw oultine color
    +  if Attri.Group = agnOutlineColors then begin
    +    c := Attri.Foreground;
    +    if c <> clNone then begin
    +      TheTree.Canvas.Pen.Color := c;
    +      TheTree.Canvas.MoveTo(NodeRect.Left+(FullAbcWidth div 2), NodeRect.Top+2);
    +      TheTree.Canvas.LineTo(NodeRect.Left+(FullAbcWidth div 2), NodeRect.Bottom-2);
    +      TheTree.Canvas.MoveTo(NodeRect.Left+(FullAbcWidth div 2)+1, NodeRect.Top+2);
    +      TheTree.Canvas.LineTo(NodeRect.Left+(FullAbcWidth div 2)+1, NodeRect.Bottom-2);
    +    end;
    +    exit;
    +  end;
    +
       // Draw preview Frame
       TheTree.Canvas.Pen.Color := Attri.FrameColor;
       if (hafFrameColor in Attri.Features) and (AttriIdx <> ord(ahaCodeFoldingTree)) and
    Index: ide/lazarusidestrconsts.pas
    ===================================================================
    --- ide/lazarusidestrconsts.pas	(revision 57176)
    +++ ide/lazarusidestrconsts.pas	(working copy)
    @@ -2104,6 +2104,16 @@
       dlgAddHiAttrDefaultWindow       = 'Default Text / Window';
       dlgAddHiAttrWindowBorder        = 'Window border';
       dlgAddHiAttrHighlightPrefix     = 'Highlight prefix';
    +  dlgAddHiAttrOutlineLevel1Color  = 'Level  1';
    +  dlgAddHiAttrOutlineLevel2Color  = 'Level  2';
    +  dlgAddHiAttrOutlineLevel3Color  = 'Level  3';
    +  dlgAddHiAttrOutlineLevel4Color  = 'Level  4';
    +  dlgAddHiAttrOutlineLevel5Color  = 'Level  5';
    +  dlgAddHiAttrOutlineLevel6Color  = 'Level  6';
    +  dlgAddHiAttrOutlineLevel7Color  = 'Level  7';
    +  dlgAddHiAttrOutlineLevel8Color  = 'Level  8';
    +  dlgAddHiAttrOutlineLevel9Color  = 'Level  9';
    +  dlgAddHiAttrOutlineLevel10Color = 'Level 10';
       dlgAddHiSpecialVisibleChars     = 'Visualized Special Chars';
       dlgTopInfoHint                  = 'Current Class/Proc Hint';
       dlgIfDefBlockInactive           = 'Inactive $IFDEF code';
    @@ -2120,6 +2130,7 @@
       dlgAddHiAttrGroupSyncroEdit    = 'Syncron Edit';
       dlgAddHiAttrGroupTemplateEdit  = 'Template Edit';
       dlgAddHiAttrGroupIfDef    = 'IfDef';
    +  dlgAddHiAttrGroupOutlineColors = 'Outline Colors';
     
       dlgEditAccessCaptionLockedInView            = 'Locked, if text in view';
       dlgEditAccessCaptionUnLockedInSoftView      = 'Unlocked, if text in centered view';
    Index: ide/sourcemarks.pas
    ===================================================================
    --- ide/sourcemarks.pas	(revision 57176)
    +++ ide/sourcemarks.pas	(working copy)
    @@ -64,12 +64,13 @@
          ahaTopInfoHint,
          ahaIfDefBlockInactive, ahaIfDefBlockActive, ahaIfDefBlockTmpActive,
          ahaIfDefNodeInactive, ahaIfDefNodeActive, ahaIfDefNodeTmpActive,
    -     ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
    +     ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight,
    +     ahaOutlineLevel1Color, ahaOutlineLevel2Color, ahaOutlineLevel3Color, ahaOutlineLevel4Color, ahaOutlineLevel5Color, ahaOutlineLevel6Color, ahaOutlineLevel7Color, ahaOutlineLevel8Color, ahaOutlineLevel9Color, ahaOutlineLevel10Color
          );
     
       TAhaGroupName = (
         agnDefault, agnLanguage, agnText, agnLine, agnGutter, agnTemplateMode, agnSyncronMode,
    -    agnIfDef, agnIdentComplWindow
    +    agnIfDef, agnIdentComplWindow, agnOutlineColors
       );
     
       TSourceEditorBase = class;
    
  • editoroptions.res (65,924 bytes)

Activities

Pascal Riekenberg

2018-01-20 07:39

reporter  

color_options_for_outline_coloring.patch (18,709 bytes)
Index: components/synedit/syneditmarkupfoldcoloring.pas
===================================================================
--- components/synedit/syneditmarkupfoldcoloring.pas	(revision 57125)
+++ components/synedit/syneditmarkupfoldcoloring.pas	(working copy)
@@ -43,7 +43,7 @@
 unit SynEditMarkupFoldColoring;
 
 {$mode objfpc}{$H+}
-{ $define SynEditMarkupFoldColoringDebug}
+{off $define SynEditMarkupFoldColoringDebug}
 
 interface
 
@@ -71,10 +71,21 @@
 
   TSynEditMarkupFoldColors = class(TSynEditMarkup)
   private
+    fUpdateColors: Boolean;
     function GetFirstCharacterColumn(index: Integer): Byte;
     procedure TextBufferChanged(Sender: TObject);
   private
     FHighlighter: TSynCustomFoldHighlighter;
+    FColor1: TSynSelectedColor;
+    FColor2: TSynSelectedColor;
+    FColor3: TSynSelectedColor;
+    FColor4: TSynSelectedColor;
+    FColor5: TSynSelectedColor;
+    FColor6: TSynSelectedColor;
+    FColor7: TSynSelectedColor;
+    FColor8: TSynSelectedColor;
+    FColor9: TSynSelectedColor;
+    FColor10: TSynSelectedColor;
     FNestList: TLazSynEditNestedFoldsList;
 
     // cache
@@ -88,7 +99,7 @@
     FDefaultGroup: integer;
     FFoldColorInfos: TMarkupFoldColorInfos;
 
-    Colors : array of TColor;
+    FColors : array of TColor;
     FPreparedRow: integer;
     FLastNode: TSynFoldNodeInfo;
     FLastEnabled: Boolean;
@@ -100,6 +111,7 @@
     procedure SetFoldColorInfosCount(pNewCount: Integer);
     procedure InitCache;
     procedure ClearCache;
+    procedure UpdateColors;
     property FirstCharacterColumn[index: Integer]: Byte read GetFirstCharacterColumn;
   protected
     // Notifications about Changes to the text
@@ -108,6 +120,7 @@
     procedure LinesChanged(Sender: TSynEditStrings; aIndex, aCount: Integer);
     procedure HighlightChanged(Sender: TSynEditStrings; aIndex, aCount: Integer);
     procedure DoEnabledChanged(Sender: TObject); override;
+    procedure ColorChanged(AMarkup: TObject);
   public
     constructor Create(ASynEdit : TSynEditBase);
     destructor Destroy; override;
@@ -122,6 +135,16 @@
 
     procedure PrepareMarkupForRow(aRow : Integer); override;
     property DefaultGroup : integer read FDefaultGroup write SetDefaultGroup;
+    property Color1:  TSynSelectedColor read FColor1;
+    property Color2:  TSynSelectedColor read FColor2;
+    property Color3:  TSynSelectedColor read FColor3;
+    property Color4:  TSynSelectedColor read FColor4;
+    property Color5:  TSynSelectedColor read FColor5;
+    property Color6:  TSynSelectedColor read FColor6;
+    property Color7:  TSynSelectedColor read FColor7;
+    property Color8:  TSynSelectedColor read FColor8;
+    property Color9:  TSynSelectedColor read FColor9;
+    property Color10: TSynSelectedColor read FColor10;
   end;
 
 implementation
@@ -169,6 +192,27 @@
   FNestList.FoldFlags := [sfbIncludeDisabled];
   FNestList.IncludeOpeningOnLine := True;
 
+  FColor1 := TSynSelectedColor.Create;
+  FColor1.OnChange := @ColorChanged;
+  FColor2 := TSynSelectedColor.Create;
+  FColor2.OnChange := @ColorChanged;
+  FColor3 := TSynSelectedColor.Create;
+  FColor3.OnChange := @ColorChanged;
+  FColor4 := TSynSelectedColor.Create;
+  FColor4.OnChange := @ColorChanged;
+  FColor5 := TSynSelectedColor.Create;
+  FColor5.OnChange := @ColorChanged;
+  FColor6 := TSynSelectedColor.Create;
+  FColor6.OnChange := @ColorChanged;
+  FColor7 := TSynSelectedColor.Create;
+  FColor7.OnChange := @ColorChanged;
+  FColor8 := TSynSelectedColor.Create;
+  FColor8.OnChange := @ColorChanged;
+  FColor9 := TSynSelectedColor.Create;
+  FColor9.OnChange := @ColorChanged;
+  FColor10 := TSynSelectedColor.Create;
+  FColor10.OnChange := @ColorChanged;
+
   MarkupInfo.Foreground := clGreen;
   MarkupInfo.Background := clNone;
   MarkupInfo.Style := [];
@@ -175,17 +219,32 @@
   MarkupInfo.StyleMask := [];
   MarkupInfo.FrameEdges:= sfeLeft;
 
-  SetLength(Colors, 6);
-  Colors[0] := clRed;
-  Colors[1] := $000098F7; //orange
-  Colors[2] := $0022CC40; //green
-  Colors[3] := $00CCCC00;   //cyan
-  Colors[4] := $00FF682A; //blue
-  Colors[5] := $00CF00C4; //purple
+  SetLength(FColors, 6);
+  FColor1.FrameColor  := clRed;
+  FColor2.FrameColor  := $000098F7; //orange
+  FColor3.FrameColor  := $0022CC40; //green
+  FColor4.FrameColor  := $00CCCC00;   //cyan
+  FColor5.FrameColor  := $00FF682A; //blue
+  FColor6.FrameColor  := $00CF00C4; //purple
+  FColor7.FrameColor  := clNone;
+  FColor8.FrameColor  := clNone;
+  FColor9.FrameColor  := clNone;
+  FColor10.FrameColor := clNone;
+
 end;
 
 destructor TSynEditMarkupFoldColors.Destroy;
 begin
+  FColor1.Free;
+  FColor2.Free;
+  FColor3.Free;
+  FColor4.Free;
+  FColor5.Free;
+  FColor6.Free;
+  FColor7.Free;
+  FColor8.Free;
+  FColor9.Free;
+  FColor10.Free;
   if Assigned(Lines) then begin
     Lines.RemoveChangeHandler(senrLineCount, @LinesChanged);
     Lines.RemoveChangeHandler(senrHighlightChanged, @HighlightChanged);
@@ -242,12 +301,12 @@
           x2both := max(x2both, x2);
           MarkupInfo.SetFrameBoundsLog(x, x2both);
           if Border then begin
-            MarkupInfo.FrameColor:= Colors[ColorIdx];
+            MarkupInfo.FrameColor:= FColors[ColorIdx];
             MarkupInfo.FrameEdges:= sfeLeft;
           end else begin
             MarkupInfo.FrameColor:= clNone;
             MarkupInfo.FrameEdges:= sfeNone;
-            MarkupInfo.Foreground := Colors[ColorIdx];
+            MarkupInfo.Foreground := FColors[ColorIdx];
           end;
         end;
   end;
@@ -343,7 +402,7 @@
       if not Border and (sfaOutlineNoColor in ANode.FoldAction) then
         Ignore := True;
       Level := lvl;
-      ColorIdx := Max(0, lvl) mod (length(Colors));
+      ColorIdx := Max(0, lvl) mod (length(FColors));
     end;
   end;
 
@@ -354,6 +413,7 @@
 
 begin
   y := ToIdx(aRow);
+  FNestList.Clear;
   FNestList.Line := y;
   NestCount := FNestList.Count;
   FHighlighter.CurrentLines := Lines;
@@ -391,7 +451,7 @@
           if sfaOutlineKeepLevel in FFoldColorInfos[FFoldColorInfosCount - 2].SrcNode.FoldAction then begin
             lvl := FFoldColorInfos[FFoldColorInfosCount - 2].Level;
             FFoldColorInfos[FFoldColorInfosCount - 1].Level := lvl;
-            FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(Colors));
+            FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(FColors));
           end;
         end;
 
@@ -451,7 +511,7 @@
         X2 := ANode.LogXEnd + 1;
         Level := lvl;
         if not (sfaOutlineNocolor in ANode.FoldAction) then
-           ColorIdx := Max(0, lvl) mod (length(Colors))
+           ColorIdx := Max(0, lvl) mod (length(FColors))
         else
            ColorIdx := -1;
       end;
@@ -510,7 +570,7 @@
             or (sfaOutlineKeepLevel in FFoldColorInfos[FFoldColorInfosCount - 2].SrcNode.FoldAction) then begin
               lvl := FFoldColorInfos[FFoldColorInfosCount - 2].Level;
               FFoldColorInfos[FFoldColorInfosCount - 1].Level := lvl;
-              FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(Colors));
+              FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(FColors));
             end;
           end;
 
@@ -577,6 +637,12 @@
   //DebugLn('PrepareMarkupForRow %d', [aRow]);
   {$ENDIF}
   if not Assigned(FHighlighter) then exit;
+
+  if fUpdateColors then begin
+    UpdateColors;
+    fUpdateColors := False;
+  end;
+
   FPreparedRow := aRow;
   FFoldColorInfosCount := 0; //reset needed to prevent using of invalid area
 
@@ -664,6 +730,37 @@
   end;
 end;
 
+procedure TSynEditMarkupFoldColors.UpdateColors;
+var
+  c: Integer;
+
+  procedure AddColor(pColor: TSynSelectedColor);
+  begin
+    if pColor.FrameColor = clNone then exit;
+    fColors[c] := pColor.FrameColor;
+    inc(c);
+  end;
+
+begin
+  SetLength(fColors, 10);
+  c := 0;
+  AddColor(FColor1);
+  AddColor(FColor2);
+  AddColor(FColor3);
+  AddColor(FColor4);
+  AddColor(FColor5);
+  AddColor(FColor6);
+  AddColor(FColor7);
+  AddColor(FColor8);
+  AddColor(FColor9);
+  AddColor(FColor10);
+  if c = 0 then begin
+    fColors[c] := $FF;
+    inc(c);
+  end;
+  SetLength(fColors, c);
+end;
+
 procedure TSynEditMarkupFoldColors.DoTextChanged(StartLine, EndLine,
   ACountDiff: Integer);
 
@@ -952,6 +1049,11 @@
     InvalidateSynLines(1, Lines.Count);
 end;
 
+procedure TSynEditMarkupFoldColors.ColorChanged(AMarkup: TObject);
+begin
+  fUpdateColors := True;
+end;
+
 end.
 
 
Index: ide/editoroptions.pp
===================================================================
--- ide/editoroptions.pp	(revision 57125)
+++ ide/editoroptions.pp	(working copy)
@@ -121,7 +121,8 @@
     '',  // ahaTopInfoHint
     '', '', '',  // ahaIfDefBlockInactive, ahaIfDefBlockActive, ahaIfDefBlockTmpActive
     '', '', '',  // ahaIfDefNodeInactive, ahaIfDefNodeActive, ahaIfDefNodeTmpActive
-    '', '', '', '' // ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
+    '', '', '', '', // ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
+    '', '', '', '', '', '', '', '', '', '' // ahaOutlineColor01..10
   );
 
   ahaGroupMap: array[TAdditionalHilightAttribute] of TAhaGroupName = (
@@ -167,7 +168,17 @@
     { ahaIdentComplWindow }           agnIdentComplWindow,
     { ahaIdentComplWindowBorder }     agnIdentComplWindow,
     { ahaIdentComplWindowSelection }  agnIdentComplWindow,
-    { ahaIdentComplWindowHighlight }  agnIdentComplWindow
+    { ahaIdentComplWindowHighlight }  agnIdentComplWindow,
+    { ahaOutlineColor1 }       agnOutlineColors,
+    { ahaOutlineColor2 }       agnOutlineColors,
+    { ahaOutlineColor3 }       agnOutlineColors,
+    { ahaOutlineColor4 }       agnOutlineColors,
+    { ahaOutlineColor5 }       agnOutlineColors,
+    { ahaOutlineColor6 }       agnOutlineColors,
+    { ahaOutlineColor7 }       agnOutlineColors,
+    { ahaOutlineColor8 }       agnOutlineColors,
+    { ahaOutlineColor9 }       agnOutlineColors,
+    { ahaOutlineColor10 }      agnOutlineColors
 
   );
   ahaSupportedFeatures: array[TAdditionalHilightAttribute] of TColorSchemeAttributeFeatures =
@@ -214,7 +225,17 @@
     { ahaIdentComplWindow }   [hafBackColor, hafForeColor],
     { ahaIdentComplWindowBorder }    [hafForeColor],
     { ahaIdentComplWindowSelection } [hafBackColor, hafForeColor],
-    { ahaIdentComplWindowHighlight } [hafForeColor]
+    { ahaIdentComplWindowHighlight } [hafForeColor],
+    { ahaFoldColor1 }         [hafFrameColor, hafFrameStyle],
+    { ahaFoldColor2 }         [hafFrameColor, hafFrameStyle],
+    { ahaFoldColor3 }         [hafFrameColor, hafFrameStyle],
+    { ahaFoldColor4 }         [hafFrameColor, hafFrameStyle],
+    { ahaFoldColor5 }         [hafFrameColor, hafFrameStyle],
+    { ahaFoldColor6 }         [hafFrameColor, hafFrameStyle],
+    { ahaFoldColor7 }         [hafFrameColor, hafFrameStyle],
+    { ahaFoldColor8 }         [hafFrameColor, hafFrameStyle],
+    { ahaFoldColor9 }         [hafFrameColor, hafFrameStyle],
+    { ahaFoldColor10 }        [hafFrameColor, hafFrameStyle]
   );
 
 
@@ -2478,6 +2499,18 @@
   AdditionalHighlightAttributes[ahaIdentComplWindowHighlight] := dlgAddHiAttrHighlightPrefix;
   AdditionalHighlightGroupNames[agnIdentComplWindow]          := dlgIdentifierCompletion;
 
+  AdditionalHighlightAttributes[ahaOutlineColor1]  := dlgAddHiAttrOutlineColor1;
+  AdditionalHighlightAttributes[ahaOutlineColor2]  := dlgAddHiAttrOutlineColor2;
+  AdditionalHighlightAttributes[ahaOutlineColor3]  := dlgAddHiAttrOutlineColor3;
+  AdditionalHighlightAttributes[ahaOutlineColor4]  := dlgAddHiAttrOutlineColor4;
+  AdditionalHighlightAttributes[ahaOutlineColor5]  := dlgAddHiAttrOutlineColor5;
+  AdditionalHighlightAttributes[ahaOutlineColor6]  := dlgAddHiAttrOutlineColor6;
+  AdditionalHighlightAttributes[ahaOutlineColor7]  := dlgAddHiAttrOutlineColor7;
+  AdditionalHighlightAttributes[ahaOutlineColor8]  := dlgAddHiAttrOutlineColor8;
+  AdditionalHighlightAttributes[ahaOutlineColor9]  := dlgAddHiAttrOutlineColor9;
+  AdditionalHighlightAttributes[ahaOutlineColor10] := dlgAddHiAttrOutlineColor10;
+  AdditionalHighlightGroupNames[agnOutlineColors]  := dlgAddHiAttrGroupOutlineColors;
+
   AdditionalHighlightGroupNames[agnDefault]      := dlgAddHiAttrGroupDefault;
   AdditionalHighlightGroupNames[agnText]         := dlgAddHiAttrGroupText;
   AdditionalHighlightGroupNames[agnLine]         := dlgAddHiAttrGroupLine;
@@ -6541,6 +6574,21 @@
       SetMarkupColor(ahaSyncroEditSync,  TSynPluginSyncroEdit(aSynEdit.Plugin[i]).MarkupInfoSync);
       SetMarkupColor(ahaSyncroEditArea,  TSynPluginSyncroEdit(aSynEdit.Plugin[i]).MarkupInfoArea);
     end;
+    i := aSynEdit.MarkupCount - 1;
+    while (i >= 0) and not(aSynEdit.Markup[i] is TSynEditMarkupFoldColors) do
+      dec(i);
+    if i >= 0 then begin
+      SetMarkupColor(ahaOutlineColor1,  TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color1);
+      SetMarkupColor(ahaOutlineColor2,  TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color2);
+      SetMarkupColor(ahaOutlineColor3,  TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color3);
+      SetMarkupColor(ahaOutlineColor4,  TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color4);
+      SetMarkupColor(ahaOutlineColor5,  TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color5);
+      SetMarkupColor(ahaOutlineColor6,  TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color6);
+      SetMarkupColor(ahaOutlineColor7,  TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color7);
+      SetMarkupColor(ahaOutlineColor8,  TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color8);
+      SetMarkupColor(ahaOutlineColor9,  TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color9);
+      SetMarkupColor(ahaOutlineColor10, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color10);
+    end;
   finally
     ASynEdit.EndUpdate;
   end;
@@ -6825,20 +6873,18 @@
   i, l: Integer;
 begin
   Result := length(s1) - length(s2);
-  if Result <> 0 then
-    exit;
   i := 1;
   if Result < 0 then
     l := length(s1)
   else
     l := length(s2);
-  while i < l do begin
+  while i <= l do begin
     Result := ord(s1[i]) - ord(s2[i]);
     if Result <> 0 then
       exit;
     inc(i);
   end;
-  Result := 0;
+  Result := length(s1) - length(s2);
 end;
 
 initialization
Index: ide/frames/editor_color_options.pas
===================================================================
--- ide/frames/editor_color_options.pas	(revision 57125)
+++ ide/frames/editor_color_options.pas	(working copy)
@@ -276,6 +276,19 @@
     exit;
   end;
 
+  // Special draw oultine color
+  if Attri.Group = agnOutlineColors then begin
+    c := Attri.FrameColor;
+    if c <> clNone then begin
+      TheTree.Canvas.Pen.Color := c;
+      TheTree.Canvas.MoveTo(NodeRect.Left+(FullAbcWidth div 2), NodeRect.Top+2);
+      TheTree.Canvas.LineTo(NodeRect.Left+(FullAbcWidth div 2), NodeRect.Bottom-2);
+      TheTree.Canvas.MoveTo(NodeRect.Left+(FullAbcWidth div 2)+1, NodeRect.Top+2);
+      TheTree.Canvas.LineTo(NodeRect.Left+(FullAbcWidth div 2)+1, NodeRect.Bottom-2);
+    end;
+    exit;
+  end;
+
   // Draw preview Frame
   TheTree.Canvas.Pen.Color := Attri.FrameColor;
   if (hafFrameColor in Attri.Features) and (AttriIdx <> ord(ahaCodeFoldingTree)) and
Index: ide/lazarusidestrconsts.pas
===================================================================
--- ide/lazarusidestrconsts.pas	(revision 57125)
+++ ide/lazarusidestrconsts.pas	(working copy)
@@ -2104,6 +2104,16 @@
   dlgAddHiAttrDefaultWindow       = 'Default Text / Window';
   dlgAddHiAttrWindowBorder        = 'Window border';
   dlgAddHiAttrHighlightPrefix     = 'Highlight prefix';
+  dlgAddHiAttrOutlineColor1       = 'Color  1';
+  dlgAddHiAttrOutlineColor2       = 'Color  2';
+  dlgAddHiAttrOutlineColor3       = 'Color  3';
+  dlgAddHiAttrOutlineColor4       = 'Color  4';
+  dlgAddHiAttrOutlineColor5       = 'Color  5';
+  dlgAddHiAttrOutlineColor6       = 'Color  6';
+  dlgAddHiAttrOutlineColor7       = 'Color  7';
+  dlgAddHiAttrOutlineColor8       = 'Color  8';
+  dlgAddHiAttrOutlineColor9       = 'Color  9';
+  dlgAddHiAttrOutlineColor10      = 'Color 10';
   dlgAddHiSpecialVisibleChars     = 'Visualized Special Chars';
   dlgTopInfoHint                  = 'Current Class/Proc Hint';
   dlgIfDefBlockInactive           = 'Inactive $IFDEF code';
@@ -2120,6 +2130,7 @@
   dlgAddHiAttrGroupSyncroEdit    = 'Syncron Edit';
   dlgAddHiAttrGroupTemplateEdit  = 'Template Edit';
   dlgAddHiAttrGroupIfDef    = 'IfDef';
+  dlgAddHiAttrGroupOutlineColors = 'Outline Colors';
 
   dlgEditAccessCaptionLockedInView            = 'Locked, if text in view';
   dlgEditAccessCaptionUnLockedInSoftView      = 'Unlocked, if text in centered view';
Index: ide/sourceeditprocs.pas
===================================================================
--- ide/sourceeditprocs.pas	(revision 57125)
+++ ide/sourceeditprocs.pas	(working copy)
@@ -154,8 +154,8 @@
   BGGreen: Integer;
   BGBlue: Integer;
   TokenStart: Integer;
-  BackgroundColor: TColorRef;
-  ForegroundColor: TColorRef;
+  BackgroundColor: TColor;
+  ForegroundColor: TColor;
   AllowFontColor: Boolean;
 
   procedure SetFontColor(NewColor: TColor);
@@ -193,7 +193,7 @@
     RedDiff:=Abs(FGRed-BGRed);
     GreenDiff:=Abs(FGGreen-BGGreen);
     BlueDiff:=Abs(FGBlue -BGBlue);
-    if RedDiff*RedDiff + GreenDiff*GreenDiff + BlueDiff*BlueDiff<30000 then
+    if RedDiff*RedDiff + GreenDiff*GreenDiff + BlueDiff*BlueDiff<20000 then
     begin
       NewColor:=InvertColor(NewColor);
       {IncreaseDiff(FGRed,BGRed);
Index: ide/sourcemarks.pas
===================================================================
--- ide/sourcemarks.pas	(revision 57125)
+++ ide/sourcemarks.pas	(working copy)
@@ -64,12 +64,13 @@
      ahaTopInfoHint,
      ahaIfDefBlockInactive, ahaIfDefBlockActive, ahaIfDefBlockTmpActive,
      ahaIfDefNodeInactive, ahaIfDefNodeActive, ahaIfDefNodeTmpActive,
-     ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
+     ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight,
+     ahaOutlineColor1, ahaOutlineColor2, ahaOutlineColor3, ahaOutlineColor4, ahaOutlineColor5, ahaOutlineColor6, ahaOutlineColor7, ahaOutlineColor8, ahaOutlineColor9, ahaOutlineColor10
      );
 
   TAhaGroupName = (
     agnDefault, agnLanguage, agnText, agnLine, agnGutter, agnTemplateMode, agnSyncronMode,
-    agnIfDef, agnIdentComplWindow
+    agnIfDef, agnIdentComplWindow, agnOutlineColors
   );
 
   TSourceEditorBase = class;

Pascal Riekenberg

2018-01-20 07:40

reporter   ~0105949

Here is a patch for no.1

Vojtech Cihak

2018-01-20 18:59

reporter   ~0105959

I applied patch, so some notes and questions.

1) After apply, all outlines become red. By default all checkboxes (Text-mark) are unchecked. Shouldn't be the default the same as it is now?

2) Items are sorted alphabetically, Color1, Color10, Color2, ... It would be nice to have Color 10 as the last. But Color 0-9 will not work too.

Anyway, thanks, it works.

Pascal Riekenberg

2018-01-20 21:52

reporter   ~0105964

Last edited: 2018-01-20 21:59

View 2 revisions

>2) Items are sorted alphabetically, Color1, Color10, Color2, ... It would be nice to have Color 10 as the last. But Color 0-9 will not work too.

Sorry, forgot to fix a bug. I'll update the patch.

>1) After apply, all outlines become red. By default all checkboxes (Text-mark) are unchecked. Shouldn't be the default the same as it is now?

At the moment you have to set the colors once.
But this will not work due to the bug i missed to fix. Try it and you'll see.

Pascal Riekenberg

2018-01-21 07:42

reporter   ~0105974

Strange: The bugfix is already in the patch and the names with one digit contain an additional space in front of it. See patch:

===================================================================
--- ide/lazarusidestrconsts.pas (revision 57125)
+++ ide/lazarusidestrconsts.pas (working copy)
@@ -2104,6 +2104,16 @@
   dlgAddHiAttrDefaultWindow = 'Default Text / Window';
   dlgAddHiAttrWindowBorder = 'Window border';
   dlgAddHiAttrHighlightPrefix = 'Highlight prefix';
+ dlgAddHiAttrOutlineColor1 = 'Color 1';
+ dlgAddHiAttrOutlineColor2 = 'Color 2';
+ dlgAddHiAttrOutlineColor3 = 'Color 3';
+ dlgAddHiAttrOutlineColor4 = 'Color 4';
+ dlgAddHiAttrOutlineColor5 = 'Color 5';
+ dlgAddHiAttrOutlineColor6 = 'Color 6';
+ dlgAddHiAttrOutlineColor7 = 'Color 7';
+ dlgAddHiAttrOutlineColor8 = 'Color 8';
+ dlgAddHiAttrOutlineColor9 = 'Color 9';
+ dlgAddHiAttrOutlineColor10 = 'Color 10';
   dlgAddHiSpecialVisibleChars = 'Visualized Special Chars';
   dlgTopInfoHint = 'Current Class/Proc Hint';
   dlgIfDefBlockInactive = 'Inactive $IFDEF code';

Maybe the sorting routine still has a bug, i can't see atm. You can try to delete the function DoCompareText from ide/editoroptions.pp:TQuickStringlist

Pascal Riekenberg

2018-01-21 08:21

reporter   ~0105975

Sorry, can't reproduce this here. Patch is working fine on a plain trunk version here.

What fpc version are you using? I used trunk.

Vojtech Cihak

2018-01-21 14:41

reporter   ~0105984

Last edited: 2018-01-21 14:42

View 2 revisions

I use 3.0.4. I'll try trunk too.

Vojtech Cihak

2018-01-21 16:59

reporter   ~0105987

Even with 3.1.1 is sorted wrongly (1, 10, 2, 3...). But double spaces are there.

Pascal Riekenberg

2018-01-22 08:08

reporter   ~0105999

Which OS and bitness are you using?

Pascal Riekenberg

2018-01-22 11:27

reporter  

color_options_for_outline_coloring_V2.patch (18,718 bytes)
Index: components/synedit/syneditmarkupfoldcoloring.pas
===================================================================
--- components/synedit/syneditmarkupfoldcoloring.pas	(revision 57141)
+++ components/synedit/syneditmarkupfoldcoloring.pas	(working copy)
@@ -43,7 +43,7 @@
 unit SynEditMarkupFoldColoring;
 
 {$mode objfpc}{$H+}
-{ $define SynEditMarkupFoldColoringDebug}
+{off $define SynEditMarkupFoldColoringDebug}
 
 interface
 
@@ -71,10 +71,21 @@
 
   TSynEditMarkupFoldColors = class(TSynEditMarkup)
   private
+    fUpdateColors: Boolean;
     function GetFirstCharacterColumn(index: Integer): Byte;
     procedure TextBufferChanged(Sender: TObject);
   private
     FHighlighter: TSynCustomFoldHighlighter;
+    FColor1: TSynSelectedColor;
+    FColor2: TSynSelectedColor;
+    FColor3: TSynSelectedColor;
+    FColor4: TSynSelectedColor;
+    FColor5: TSynSelectedColor;
+    FColor6: TSynSelectedColor;
+    FColor7: TSynSelectedColor;
+    FColor8: TSynSelectedColor;
+    FColor9: TSynSelectedColor;
+    FColor10: TSynSelectedColor;
     FNestList: TLazSynEditNestedFoldsList;
 
     // cache
@@ -88,7 +99,7 @@
     FDefaultGroup: integer;
     FFoldColorInfos: TMarkupFoldColorInfos;
 
-    Colors : array of TColor;
+    FColors : array of TColor;
     FPreparedRow: integer;
     FLastNode: TSynFoldNodeInfo;
     FLastEnabled: Boolean;
@@ -100,6 +111,7 @@
     procedure SetFoldColorInfosCount(pNewCount: Integer);
     procedure InitCache;
     procedure ClearCache;
+    procedure UpdateColors;
     property FirstCharacterColumn[index: Integer]: Byte read GetFirstCharacterColumn;
   protected
     // Notifications about Changes to the text
@@ -108,6 +120,7 @@
     procedure LinesChanged(Sender: TSynEditStrings; aIndex, aCount: Integer);
     procedure HighlightChanged(Sender: TSynEditStrings; aIndex, aCount: Integer);
     procedure DoEnabledChanged(Sender: TObject); override;
+    procedure ColorChanged(AMarkup: TObject);
   public
     constructor Create(ASynEdit : TSynEditBase);
     destructor Destroy; override;
@@ -122,6 +135,16 @@
 
     procedure PrepareMarkupForRow(aRow : Integer); override;
     property DefaultGroup : integer read FDefaultGroup write SetDefaultGroup;
+    property Color1:  TSynSelectedColor read FColor1;
+    property Color2:  TSynSelectedColor read FColor2;
+    property Color3:  TSynSelectedColor read FColor3;
+    property Color4:  TSynSelectedColor read FColor4;
+    property Color5:  TSynSelectedColor read FColor5;
+    property Color6:  TSynSelectedColor read FColor6;
+    property Color7:  TSynSelectedColor read FColor7;
+    property Color8:  TSynSelectedColor read FColor8;
+    property Color9:  TSynSelectedColor read FColor9;
+    property Color10: TSynSelectedColor read FColor10;
   end;
 
 implementation
@@ -169,6 +192,27 @@
   FNestList.FoldFlags := [sfbIncludeDisabled];
   FNestList.IncludeOpeningOnLine := True;
 
+  FColor1 := TSynSelectedColor.Create;
+  FColor1.OnChange := @ColorChanged;
+  FColor2 := TSynSelectedColor.Create;
+  FColor2.OnChange := @ColorChanged;
+  FColor3 := TSynSelectedColor.Create;
+  FColor3.OnChange := @ColorChanged;
+  FColor4 := TSynSelectedColor.Create;
+  FColor4.OnChange := @ColorChanged;
+  FColor5 := TSynSelectedColor.Create;
+  FColor5.OnChange := @ColorChanged;
+  FColor6 := TSynSelectedColor.Create;
+  FColor6.OnChange := @ColorChanged;
+  FColor7 := TSynSelectedColor.Create;
+  FColor7.OnChange := @ColorChanged;
+  FColor8 := TSynSelectedColor.Create;
+  FColor8.OnChange := @ColorChanged;
+  FColor9 := TSynSelectedColor.Create;
+  FColor9.OnChange := @ColorChanged;
+  FColor10 := TSynSelectedColor.Create;
+  FColor10.OnChange := @ColorChanged;
+
   MarkupInfo.Foreground := clGreen;
   MarkupInfo.Background := clNone;
   MarkupInfo.Style := [];
@@ -175,17 +219,32 @@
   MarkupInfo.StyleMask := [];
   MarkupInfo.FrameEdges:= sfeLeft;
 
-  SetLength(Colors, 6);
-  Colors[0] := clRed;
-  Colors[1] := $000098F7; //orange
-  Colors[2] := $0022CC40; //green
-  Colors[3] := $00CCCC00;   //cyan
-  Colors[4] := $00FF682A; //blue
-  Colors[5] := $00CF00C4; //purple
+  SetLength(FColors, 6);
+  FColor1.FrameColor  := clRed;
+  FColor2.FrameColor  := $000098F7; //orange
+  FColor3.FrameColor  := $0022CC40; //green
+  FColor4.FrameColor  := $00CCCC00;   //cyan
+  FColor5.FrameColor  := $00FF682A; //blue
+  FColor6.FrameColor  := $00CF00C4; //purple
+  FColor7.FrameColor  := clNone;
+  FColor8.FrameColor  := clNone;
+  FColor9.FrameColor  := clNone;
+  FColor10.FrameColor := clNone;
+
 end;
 
 destructor TSynEditMarkupFoldColors.Destroy;
 begin
+  FColor1.Free;
+  FColor2.Free;
+  FColor3.Free;
+  FColor4.Free;
+  FColor5.Free;
+  FColor6.Free;
+  FColor7.Free;
+  FColor8.Free;
+  FColor9.Free;
+  FColor10.Free;
   if Assigned(Lines) then begin
     Lines.RemoveChangeHandler(senrLineCount, @LinesChanged);
     Lines.RemoveChangeHandler(senrHighlightChanged, @HighlightChanged);
@@ -242,12 +301,12 @@
           x2both := max(x2both, x2);
           MarkupInfo.SetFrameBoundsLog(x, x2both);
           if Border then begin
-            MarkupInfo.FrameColor:= Colors[ColorIdx];
+            MarkupInfo.FrameColor:= FColors[ColorIdx];
             MarkupInfo.FrameEdges:= sfeLeft;
           end else begin
             MarkupInfo.FrameColor:= clNone;
             MarkupInfo.FrameEdges:= sfeNone;
-            MarkupInfo.Foreground := Colors[ColorIdx];
+            MarkupInfo.Foreground := FColors[ColorIdx];
           end;
         end;
   end;
@@ -343,7 +402,7 @@
       if not Border and (sfaOutlineNoColor in ANode.FoldAction) then
         Ignore := True;
       Level := lvl;
-      ColorIdx := Max(0, lvl) mod (length(Colors));
+      ColorIdx := Max(0, lvl) mod (length(FColors));
     end;
   end;
 
@@ -354,6 +413,7 @@
 
 begin
   y := ToIdx(aRow);
+  FNestList.Clear;
   FNestList.Line := y;
   NestCount := FNestList.Count;
   FHighlighter.CurrentLines := Lines;
@@ -391,7 +451,7 @@
           if sfaOutlineKeepLevel in FFoldColorInfos[FFoldColorInfosCount - 2].SrcNode.FoldAction then begin
             lvl := FFoldColorInfos[FFoldColorInfosCount - 2].Level;
             FFoldColorInfos[FFoldColorInfosCount - 1].Level := lvl;
-            FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(Colors));
+            FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(FColors));
           end;
         end;
 
@@ -451,7 +511,7 @@
         X2 := ANode.LogXEnd + 1;
         Level := lvl;
         if not (sfaOutlineNocolor in ANode.FoldAction) then
-           ColorIdx := Max(0, lvl) mod (length(Colors))
+           ColorIdx := Max(0, lvl) mod (length(FColors))
         else
            ColorIdx := -1;
       end;
@@ -510,7 +570,7 @@
             or (sfaOutlineKeepLevel in FFoldColorInfos[FFoldColorInfosCount - 2].SrcNode.FoldAction) then begin
               lvl := FFoldColorInfos[FFoldColorInfosCount - 2].Level;
               FFoldColorInfos[FFoldColorInfosCount - 1].Level := lvl;
-              FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(Colors));
+              FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(FColors));
             end;
           end;
 
@@ -577,6 +637,12 @@
   //DebugLn('PrepareMarkupForRow %d', [aRow]);
   {$ENDIF}
   if not Assigned(FHighlighter) then exit;
+
+  if fUpdateColors then begin
+    UpdateColors;
+    fUpdateColors := False;
+  end;
+
   FPreparedRow := aRow;
   FFoldColorInfosCount := 0; //reset needed to prevent using of invalid area
 
@@ -664,6 +730,37 @@
   end;
 end;
 
+procedure TSynEditMarkupFoldColors.UpdateColors;
+var
+  c: Integer;
+
+  procedure AddColor(pColor: TSynSelectedColor);
+  begin
+    if pColor.FrameColor = clNone then exit;
+    fColors[c] := pColor.FrameColor;
+    inc(c);
+  end;
+
+begin
+  SetLength(fColors, 10);
+  c := 0;
+  AddColor(FColor1);
+  AddColor(FColor2);
+  AddColor(FColor3);
+  AddColor(FColor4);
+  AddColor(FColor5);
+  AddColor(FColor6);
+  AddColor(FColor7);
+  AddColor(FColor8);
+  AddColor(FColor9);
+  AddColor(FColor10);
+  if c = 0 then begin
+    fColors[c] := $FF;
+    inc(c);
+  end;
+  SetLength(fColors, c);
+end;
+
 procedure TSynEditMarkupFoldColors.DoTextChanged(StartLine, EndLine,
   ACountDiff: Integer);
 
@@ -952,6 +1049,11 @@
     InvalidateSynLines(1, Lines.Count);
 end;
 
+procedure TSynEditMarkupFoldColors.ColorChanged(AMarkup: TObject);
+begin
+  fUpdateColors := True;
+end;
+
 end.
 
 
Index: ide/editoroptions.pp
===================================================================
--- ide/editoroptions.pp	(revision 57141)
+++ ide/editoroptions.pp	(working copy)
@@ -121,7 +121,8 @@
     '',  // ahaTopInfoHint
     '', '', '',  // ahaIfDefBlockInactive, ahaIfDefBlockActive, ahaIfDefBlockTmpActive
     '', '', '',  // ahaIfDefNodeInactive, ahaIfDefNodeActive, ahaIfDefNodeTmpActive
-    '', '', '', '' // ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
+    '', '', '', '', // ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
+    '', '', '', '', '', '', '', '', '', '' // ahaOutlineColor01..10
   );
 
   ahaGroupMap: array[TAdditionalHilightAttribute] of TAhaGroupName = (
@@ -167,7 +168,17 @@
     { ahaIdentComplWindow }           agnIdentComplWindow,
     { ahaIdentComplWindowBorder }     agnIdentComplWindow,
     { ahaIdentComplWindowSelection }  agnIdentComplWindow,
-    { ahaIdentComplWindowHighlight }  agnIdentComplWindow
+    { ahaIdentComplWindowHighlight }  agnIdentComplWindow,
+    { ahaOutlineColor01 }      agnOutlineColors,
+    { ahaOutlineColor02 }      agnOutlineColors,
+    { ahaOutlineColor03 }      agnOutlineColors,
+    { ahaOutlineColor04 }      agnOutlineColors,
+    { ahaOutlineColor05 }      agnOutlineColors,
+    { ahaOutlineColor06 }      agnOutlineColors,
+    { ahaOutlineColor07 }      agnOutlineColors,
+    { ahaOutlineColor08 }      agnOutlineColors,
+    { ahaOutlineColor09 }      agnOutlineColors,
+    { ahaOutlineColor10 }      agnOutlineColors
 
   );
   ahaSupportedFeatures: array[TAdditionalHilightAttribute] of TColorSchemeAttributeFeatures =
@@ -214,7 +225,17 @@
     { ahaIdentComplWindow }   [hafBackColor, hafForeColor],
     { ahaIdentComplWindowBorder }    [hafForeColor],
     { ahaIdentComplWindowSelection } [hafBackColor, hafForeColor],
-    { ahaIdentComplWindowHighlight } [hafForeColor]
+    { ahaIdentComplWindowHighlight } [hafForeColor],
+    { ahaFoldColor01 }        [hafFrameColor, hafFrameStyle],
+    { ahaFoldColor02 }        [hafFrameColor, hafFrameStyle],
+    { ahaFoldColor03 }        [hafFrameColor, hafFrameStyle],
+    { ahaFoldColor04 }        [hafFrameColor, hafFrameStyle],
+    { ahaFoldColor05 }        [hafFrameColor, hafFrameStyle],
+    { ahaFoldColor06 }        [hafFrameColor, hafFrameStyle],
+    { ahaFoldColor07 }        [hafFrameColor, hafFrameStyle],
+    { ahaFoldColor08 }        [hafFrameColor, hafFrameStyle],
+    { ahaFoldColor09 }        [hafFrameColor, hafFrameStyle],
+    { ahaFoldColor10 }        [hafFrameColor, hafFrameStyle]
   );
 
 
@@ -2478,6 +2499,18 @@
   AdditionalHighlightAttributes[ahaIdentComplWindowHighlight] := dlgAddHiAttrHighlightPrefix;
   AdditionalHighlightGroupNames[agnIdentComplWindow]          := dlgIdentifierCompletion;
 
+  AdditionalHighlightAttributes[ahaOutlineColor01] := dlgAddHiAttrOutlineColor1;
+  AdditionalHighlightAttributes[ahaOutlineColor02] := dlgAddHiAttrOutlineColor2;
+  AdditionalHighlightAttributes[ahaOutlineColor03] := dlgAddHiAttrOutlineColor3;
+  AdditionalHighlightAttributes[ahaOutlineColor04] := dlgAddHiAttrOutlineColor4;
+  AdditionalHighlightAttributes[ahaOutlineColor05] := dlgAddHiAttrOutlineColor5;
+  AdditionalHighlightAttributes[ahaOutlineColor06] := dlgAddHiAttrOutlineColor6;
+  AdditionalHighlightAttributes[ahaOutlineColor07] := dlgAddHiAttrOutlineColor7;
+  AdditionalHighlightAttributes[ahaOutlineColor08] := dlgAddHiAttrOutlineColor8;
+  AdditionalHighlightAttributes[ahaOutlineColor09] := dlgAddHiAttrOutlineColor9;
+  AdditionalHighlightAttributes[ahaOutlineColor10] := dlgAddHiAttrOutlineColor10;
+  AdditionalHighlightGroupNames[agnOutlineColors]  := dlgAddHiAttrGroupOutlineColors;
+
   AdditionalHighlightGroupNames[agnDefault]      := dlgAddHiAttrGroupDefault;
   AdditionalHighlightGroupNames[agnText]         := dlgAddHiAttrGroupText;
   AdditionalHighlightGroupNames[agnLine]         := dlgAddHiAttrGroupLine;
@@ -6541,6 +6574,21 @@
       SetMarkupColor(ahaSyncroEditSync,  TSynPluginSyncroEdit(aSynEdit.Plugin[i]).MarkupInfoSync);
       SetMarkupColor(ahaSyncroEditArea,  TSynPluginSyncroEdit(aSynEdit.Plugin[i]).MarkupInfoArea);
     end;
+    i := aSynEdit.MarkupCount - 1;
+    while (i >= 0) and not(aSynEdit.Markup[i] is TSynEditMarkupFoldColors) do
+      dec(i);
+    if i >= 0 then begin
+      SetMarkupColor(ahaOutlineColor01, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color1);
+      SetMarkupColor(ahaOutlineColor02, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color2);
+      SetMarkupColor(ahaOutlineColor03, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color3);
+      SetMarkupColor(ahaOutlineColor04, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color4);
+      SetMarkupColor(ahaOutlineColor05, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color5);
+      SetMarkupColor(ahaOutlineColor06, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color6);
+      SetMarkupColor(ahaOutlineColor07, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color7);
+      SetMarkupColor(ahaOutlineColor08, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color8);
+      SetMarkupColor(ahaOutlineColor09, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color9);
+      SetMarkupColor(ahaOutlineColor10, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color10);
+    end;
   finally
     ASynEdit.EndUpdate;
   end;
@@ -6825,20 +6873,18 @@
   i, l: Integer;
 begin
   Result := length(s1) - length(s2);
-  if Result <> 0 then
-    exit;
   i := 1;
   if Result < 0 then
     l := length(s1)
   else
     l := length(s2);
-  while i < l do begin
+  while i <= l do begin
     Result := ord(s1[i]) - ord(s2[i]);
     if Result <> 0 then
       exit;
     inc(i);
   end;
-  Result := 0;
+  Result := length(s1) - length(s2);
 end;
 
 initialization
Index: ide/frames/editor_color_options.pas
===================================================================
--- ide/frames/editor_color_options.pas	(revision 57141)
+++ ide/frames/editor_color_options.pas	(working copy)
@@ -276,6 +276,19 @@
     exit;
   end;
 
+  // Special draw oultine color
+  if Attri.Group = agnOutlineColors then begin
+    c := Attri.FrameColor;
+    if c <> clNone then begin
+      TheTree.Canvas.Pen.Color := c;
+      TheTree.Canvas.MoveTo(NodeRect.Left+(FullAbcWidth div 2), NodeRect.Top+2);
+      TheTree.Canvas.LineTo(NodeRect.Left+(FullAbcWidth div 2), NodeRect.Bottom-2);
+      TheTree.Canvas.MoveTo(NodeRect.Left+(FullAbcWidth div 2)+1, NodeRect.Top+2);
+      TheTree.Canvas.LineTo(NodeRect.Left+(FullAbcWidth div 2)+1, NodeRect.Bottom-2);
+    end;
+    exit;
+  end;
+
   // Draw preview Frame
   TheTree.Canvas.Pen.Color := Attri.FrameColor;
   if (hafFrameColor in Attri.Features) and (AttriIdx <> ord(ahaCodeFoldingTree)) and
Index: ide/lazarusidestrconsts.pas
===================================================================
--- ide/lazarusidestrconsts.pas	(revision 57141)
+++ ide/lazarusidestrconsts.pas	(working copy)
@@ -2104,6 +2104,16 @@
   dlgAddHiAttrDefaultWindow       = 'Default Text / Window';
   dlgAddHiAttrWindowBorder        = 'Window border';
   dlgAddHiAttrHighlightPrefix     = 'Highlight prefix';
+  dlgAddHiAttrOutlineColor1       = 'Color  1';
+  dlgAddHiAttrOutlineColor2       = 'Color  2';
+  dlgAddHiAttrOutlineColor3       = 'Color  3';
+  dlgAddHiAttrOutlineColor4       = 'Color  4';
+  dlgAddHiAttrOutlineColor5       = 'Color  5';
+  dlgAddHiAttrOutlineColor6       = 'Color  6';
+  dlgAddHiAttrOutlineColor7       = 'Color  7';
+  dlgAddHiAttrOutlineColor8       = 'Color  8';
+  dlgAddHiAttrOutlineColor9       = 'Color  9';
+  dlgAddHiAttrOutlineColor10      = 'Color 10';
   dlgAddHiSpecialVisibleChars     = 'Visualized Special Chars';
   dlgTopInfoHint                  = 'Current Class/Proc Hint';
   dlgIfDefBlockInactive           = 'Inactive $IFDEF code';
@@ -2120,6 +2130,7 @@
   dlgAddHiAttrGroupSyncroEdit    = 'Syncron Edit';
   dlgAddHiAttrGroupTemplateEdit  = 'Template Edit';
   dlgAddHiAttrGroupIfDef    = 'IfDef';
+  dlgAddHiAttrGroupOutlineColors = 'Outline Colors';
 
   dlgEditAccessCaptionLockedInView            = 'Locked, if text in view';
   dlgEditAccessCaptionUnLockedInSoftView      = 'Unlocked, if text in centered view';
Index: ide/sourceeditprocs.pas
===================================================================
--- ide/sourceeditprocs.pas	(revision 57141)
+++ ide/sourceeditprocs.pas	(working copy)
@@ -154,8 +154,8 @@
   BGGreen: Integer;
   BGBlue: Integer;
   TokenStart: Integer;
-  BackgroundColor: TColorRef;
-  ForegroundColor: TColorRef;
+  BackgroundColor: TColor;
+  ForegroundColor: TColor;
   AllowFontColor: Boolean;
 
   procedure SetFontColor(NewColor: TColor);
@@ -193,7 +193,7 @@
     RedDiff:=Abs(FGRed-BGRed);
     GreenDiff:=Abs(FGGreen-BGGreen);
     BlueDiff:=Abs(FGBlue -BGBlue);
-    if RedDiff*RedDiff + GreenDiff*GreenDiff + BlueDiff*BlueDiff<30000 then
+    if RedDiff*RedDiff + GreenDiff*GreenDiff + BlueDiff*BlueDiff<20000 then
     begin
       NewColor:=InvertColor(NewColor);
       {IncreaseDiff(FGRed,BGRed);
Index: ide/sourcemarks.pas
===================================================================
--- ide/sourcemarks.pas	(revision 57141)
+++ ide/sourcemarks.pas	(working copy)
@@ -64,12 +64,13 @@
      ahaTopInfoHint,
      ahaIfDefBlockInactive, ahaIfDefBlockActive, ahaIfDefBlockTmpActive,
      ahaIfDefNodeInactive, ahaIfDefNodeActive, ahaIfDefNodeTmpActive,
-     ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
+     ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight,
+     ahaOutlineColor01, ahaOutlineColor02, ahaOutlineColor03, ahaOutlineColor04, ahaOutlineColor05, ahaOutlineColor06, ahaOutlineColor07, ahaOutlineColor08, ahaOutlineColor09, ahaOutlineColor10
      );
 
   TAhaGroupName = (
     agnDefault, agnLanguage, agnText, agnLine, agnGutter, agnTemplateMode, agnSyncronMode,
-    agnIfDef, agnIdentComplWindow
+    agnIfDef, agnIdentComplWindow, agnOutlineColors
   );
 
   TSourceEditorBase = class;

Pascal Riekenberg

2018-01-22 11:31

reporter   ~0106002

I suppose you are using an OS other than Windows 10.

I prepared a new patch which uses other names for the attributes
(TAdditionalHilightAttribute). So they should be added to the treeview
in the right order.

You have to edit you editoroptions.xml in the config to keep your
colors for outlining. Just add a 0 to the single digit colors:

ahaOutlineColor01
ahaOutlineColor02
ahaOutlineColor03
ahaOutlineColor04
ahaOutlineColor05
ahaOutlineColor06
ahaOutlineColor07
ahaOutlineColor08
ahaOutlineColor09
ahaOutlineColor10

Vojtech Cihak

2018-01-22 14:13

reporter   ~0106004

Linux, 64-bits

Pascal Riekenberg

2018-01-22 14:48

reporter   ~0106007

Okay, then TTreeView behaves differently on Linux concerning sorting of child nodes. The new patch should help then.

Vojtech Cihak

2018-01-22 15:18

reporter   ~0106008

Last edited: 2018-01-22 15:19

View 2 revisions

I applied patch V2 and updated editoroptions.xml but it remained. See picture. There must be something wrong with alphasorting in treeview.

Vojtech Cihak

2018-01-22 15:18

reporter  

color_outlines.png (6,799 bytes)
color_outlines.png (6,799 bytes)

Pascal Riekenberg

2018-01-22 15:25

reporter   ~0106009

Last edited: 2018-01-22 15:31

View 2 revisions

Yes, i think so, too!
Can you make a new bug report with simple sample project for that issue?

Vojtech Cihak

2018-01-22 15:55

reporter   ~0106010

I did: https://bugs.freepascal.org/view.php?id=33064

Pascal Riekenberg

2018-01-22 16:00

reporter   ~0106012

Thanks!

Pascal Riekenberg

2018-01-29 10:16

reporter  

color_options_for_outline_coloring_V3.patch (21,044 bytes)
Index: components/synedit/syneditmarkupfoldcoloring.pas
===================================================================
--- components/synedit/syneditmarkupfoldcoloring.pas	(revision 57176)
+++ components/synedit/syneditmarkupfoldcoloring.pas	(working copy)
@@ -43,7 +43,7 @@
 unit SynEditMarkupFoldColoring;
 
 {$mode objfpc}{$H+}
-{ $define SynEditMarkupFoldColoringDebug}
+{off $define SynEditMarkupFoldColoringDebug}
 
 interface
 
@@ -71,10 +71,12 @@
 
   TSynEditMarkupFoldColors = class(TSynEditMarkup)
   private
+    fUpdateColors: Boolean;
     function GetFirstCharacterColumn(index: Integer): Byte;
     procedure TextBufferChanged(Sender: TObject);
   private
     FHighlighter: TSynCustomFoldHighlighter;
+    FMarkupColors: array of TSynSelectedColor;
     FNestList: TLazSynEditNestedFoldsList;
 
     // cache
@@ -88,7 +90,7 @@
     FDefaultGroup: integer;
     FFoldColorInfos: TMarkupFoldColorInfos;
 
-    Colors : array of TColor;
+    FColors : array of TColor;
     FPreparedRow: integer;
     FLastNode: TSynFoldNodeInfo;
     FLastEnabled: Boolean;
@@ -95,11 +97,13 @@
 
     procedure DoMarkupParentFoldAtRow(aRow: Integer);
     procedure DoMarkupParentCloseFoldAtRow(aRow: Integer);
+    function GetColor(pIndex: Integer): TSynSelectedColor;
     procedure SetDefaultGroup(AValue: integer);
     procedure SetCacheCount(pNewCount: Integer);
     procedure SetFoldColorInfosCount(pNewCount: Integer);
     procedure InitCache;
     procedure ClearCache;
+    procedure UpdateColors;
     property FirstCharacterColumn[index: Integer]: Byte read GetFirstCharacterColumn;
   protected
     // Notifications about Changes to the text
@@ -108,6 +112,7 @@
     procedure LinesChanged(Sender: TSynEditStrings; aIndex, aCount: Integer);
     procedure HighlightChanged(Sender: TSynEditStrings; aIndex, aCount: Integer);
     procedure DoEnabledChanged(Sender: TObject); override;
+    procedure ColorChanged(AMarkup: TObject);
   public
     constructor Create(ASynEdit : TSynEditBase);
     destructor Destroy; override;
@@ -122,6 +127,7 @@
 
     procedure PrepareMarkupForRow(aRow : Integer); override;
     property DefaultGroup : integer read FDefaultGroup write SetDefaultGroup;
+    property Color[pIndex: Integer]: TSynSelectedColor read GetColor;
   end;
 
 implementation
@@ -147,6 +153,8 @@
 { TSynEditMarkupFoldColors }
 
 constructor TSynEditMarkupFoldColors.Create(ASynEdit: TSynEditBase);
+var
+  i: Integer;
 begin
   inherited Create(ASynEdit);
 
@@ -169,6 +177,12 @@
   FNestList.FoldFlags := [sfbIncludeDisabled];
   FNestList.IncludeOpeningOnLine := True;
 
+  SetLength(FMarkupColors, 10);
+  for i := 0 to length(FMarkupColors) - 1 do begin
+    FMarkupColors[i] := TSynSelectedColor.Create;
+    FMarkupColors[i].OnChange := @ColorChanged;
+  end;
+
   MarkupInfo.Foreground := clGreen;
   MarkupInfo.Background := clNone;
   MarkupInfo.Style := [];
@@ -175,17 +189,26 @@
   MarkupInfo.StyleMask := [];
   MarkupInfo.FrameEdges:= sfeLeft;
 
-  SetLength(Colors, 6);
-  Colors[0] := clRed;
-  Colors[1] := $000098F7; //orange
-  Colors[2] := $0022CC40; //green
-  Colors[3] := $00CCCC00;   //cyan
-  Colors[4] := $00FF682A; //blue
-  Colors[5] := $00CF00C4; //purple
+  SetLength(FColors, 6);
+  FMarkupColors[0].Foreground  := clRed;
+  FMarkupColors[1].Foreground  := $000098F7; //orange
+  FMarkupColors[2].Foreground  := $0022CC40; //green
+  FMarkupColors[3].Foreground  := $00CCCC00;   //cyan
+  FMarkupColors[4].Foreground  := $00FF682A; //blue
+  FMarkupColors[5].Foreground  := $00CF00C4; //purple
+  FMarkupColors[6].Foreground  := clNone;
+  FMarkupColors[7].Foreground  := clNone;
+  FMarkupColors[8].Foreground  := clNone;
+  FMarkupColors[9].Foreground := clNone;
+
 end;
 
 destructor TSynEditMarkupFoldColors.Destroy;
+var
+  i: Integer;
 begin
+  for i := 0 to Length(FMarkupColors) - 1 do
+    FMarkupColors[i].Free;
   if Assigned(Lines) then begin
     Lines.RemoveChangeHandler(senrLineCount, @LinesChanged);
     Lines.RemoveChangeHandler(senrHighlightChanged, @HighlightChanged);
@@ -242,12 +265,12 @@
           x2both := max(x2both, x2);
           MarkupInfo.SetFrameBoundsLog(x, x2both);
           if Border then begin
-            MarkupInfo.FrameColor:= Colors[ColorIdx];
+            MarkupInfo.FrameColor:= FColors[ColorIdx];
             MarkupInfo.FrameEdges:= sfeLeft;
           end else begin
             MarkupInfo.FrameColor:= clNone;
             MarkupInfo.FrameEdges:= sfeNone;
-            MarkupInfo.Foreground := Colors[ColorIdx];
+            MarkupInfo.Foreground := FColors[ColorIdx];
           end;
         end;
   end;
@@ -343,7 +366,7 @@
       if not Border and (sfaOutlineNoColor in ANode.FoldAction) then
         Ignore := True;
       Level := lvl;
-      ColorIdx := Max(0, lvl) mod (length(Colors));
+      ColorIdx := Max(0, lvl) mod (length(FColors));
     end;
   end;
 
@@ -354,6 +377,7 @@
 
 begin
   y := ToIdx(aRow);
+  FNestList.Clear;
   FNestList.Line := y;
   NestCount := FNestList.Count;
   FHighlighter.CurrentLines := Lines;
@@ -391,7 +415,7 @@
           if sfaOutlineKeepLevel in FFoldColorInfos[FFoldColorInfosCount - 2].SrcNode.FoldAction then begin
             lvl := FFoldColorInfos[FFoldColorInfosCount - 2].Level;
             FFoldColorInfos[FFoldColorInfosCount - 1].Level := lvl;
-            FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(Colors));
+            FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(FColors));
           end;
         end;
 
@@ -451,7 +475,7 @@
         X2 := ANode.LogXEnd + 1;
         Level := lvl;
         if not (sfaOutlineNocolor in ANode.FoldAction) then
-           ColorIdx := Max(0, lvl) mod (length(Colors))
+           ColorIdx := Max(0, lvl) mod (length(FColors))
         else
            ColorIdx := -1;
       end;
@@ -510,7 +534,7 @@
             or (sfaOutlineKeepLevel in FFoldColorInfos[FFoldColorInfosCount - 2].SrcNode.FoldAction) then begin
               lvl := FFoldColorInfos[FFoldColorInfosCount - 2].Level;
               FFoldColorInfos[FFoldColorInfosCount - 1].Level := lvl;
-              FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(Colors));
+              FFoldColorInfos[FFoldColorInfosCount - 1].ColorIdx := Max(0, lvl) mod (length(FColors));
             end;
           end;
 
@@ -568,6 +592,12 @@
   end;
 end;
 
+function TSynEditMarkupFoldColors.GetColor(pIndex: Integer): TSynSelectedColor;
+begin
+  Assert((pIndex >= 0) and (pIndex < Length(FMarkupColors)), 'Index out of range');
+  Result := FMarkupColors[pIndex];
+end;
+
 procedure TSynEditMarkupFoldColors.PrepareMarkupForRow(aRow: Integer);
 var
   i, LastX, j: Integer;
@@ -577,6 +607,12 @@
   //DebugLn('PrepareMarkupForRow %d', [aRow]);
   {$ENDIF}
   if not Assigned(FHighlighter) then exit;
+
+  if fUpdateColors then begin
+    UpdateColors;
+    fUpdateColors := False;
+  end;
+
   FPreparedRow := aRow;
   FFoldColorInfosCount := 0; //reset needed to prevent using of invalid area
 
@@ -664,6 +700,29 @@
   end;
 end;
 
+procedure TSynEditMarkupFoldColors.UpdateColors;
+var
+  c, i: Integer;
+
+  procedure AddColor(pColor: TSynSelectedColor);
+  begin
+    if pColor.Foreground = clNone then exit;
+    fColors[c] := pColor.Foreground;
+    inc(c);
+  end;
+
+begin
+  SetLength(fColors, Length(FMarkupColors));
+  c := 0;
+  for i := 0 to length(FMarkupColors) -1 do
+    AddColor(FMarkupColors[i]);
+  if c = 0 then begin
+    fColors[c] := $0000FF; // default red
+    inc(c);
+  end;
+  SetLength(fColors, c);
+end;
+
 procedure TSynEditMarkupFoldColors.DoTextChanged(StartLine, EndLine,
   ACountDiff: Integer);
 
@@ -952,6 +1011,11 @@
     InvalidateSynLines(1, Lines.Count);
 end;
 
+procedure TSynEditMarkupFoldColors.ColorChanged(AMarkup: TObject);
+begin
+  fUpdateColors := True;
+end;
+
 end.
 
 
Index: ide/ColorDefault.xml
===================================================================
--- ide/ColorDefault.xml	(revision 57176)
+++ ide/ColorDefault.xml	(working copy)
@@ -44,6 +44,12 @@
           <ahaGutter Background="clBtnFace"/>
           <ahaRightMargin Foreground="clSilver"/>
           <ahaIdentComplWindowHighlight Foreground="187"/>
+          <ahaOutlineLevel1Color Foreground="clRed"/>
+          <ahaOutlineLevel2Color Foreground="39159"/>
+          <ahaOutlineLevel3Color Foreground="2280512"/>
+          <ahaOutlineLevel4Color Foreground="13421568"/>
+          <ahaOutlineLevel5Color Foreground="16738346"/>
+          <ahaOutlineLevel6Color Foreground="13566148"/>
         </SchemeDefault>
       </Globals>
       <LangObjectPascal Version="6">
Index: ide/ColorDelphi.xml
===================================================================
--- ide/ColorDelphi.xml	(revision 57176)
+++ ide/ColorDelphi.xml	(working copy)
@@ -44,6 +44,12 @@
           <ahaGutter Background="clBtnFace"/>
           <ahaRightMargin Foreground="clSilver"/>
           <ahaIdentComplWindowHighlight Foreground="191"/>
+          <ahaOutlineLevel1Color Foreground="clRed"/>
+          <ahaOutlineLevel2Color Foreground="39159"/>
+          <ahaOutlineLevel3Color Foreground="2280512"/>
+          <ahaOutlineLevel4Color Foreground="13421568"/>
+          <ahaOutlineLevel5Color Foreground="16738346"/>
+          <ahaOutlineLevel6Color Foreground="13566148"/>
         </SchemeDelphi>
       </Globals>
       <LangObjectPascal Version="6">
Index: ide/ColorOcean.xml
===================================================================
--- ide/ColorOcean.xml	(revision 57176)
+++ ide/ColorOcean.xml	(working copy)
@@ -45,6 +45,12 @@
           <ahaRightMargin Foreground="clSilver"/>
           <ahaIdentComplWindowHighlight Foreground="clAqua"/>
           <ahaIdentComplWindow Background="8388649"/>
+          <ahaOutlineLevel1Color Foreground="clRed"/>
+          <ahaOutlineLevel2Color Foreground="39159"/>
+          <ahaOutlineLevel3Color Foreground="2280512"/>
+          <ahaOutlineLevel4Color Foreground="13421568"/>
+          <ahaOutlineLevel5Color Foreground="16738346"/>
+          <ahaOutlineLevel6Color Foreground="13566148"/>
         </SchemeOcean>
       </Globals>
       <LangObjectPascal Version="6">
Index: ide/ColorPascalClassic.xml
===================================================================
--- ide/ColorPascalClassic.xml	(revision 57176)
+++ ide/ColorPascalClassic.xml	(working copy)
@@ -44,6 +44,12 @@
           <ahaGutter Background="clNavy"/>
           <ahaIdentComplWindowHighlight Foreground="clAqua"/>
           <ahaIdentComplWindow Background="10420276"/>
+          <ahaOutlineLevel1Color Foreground="clRed"/>
+          <ahaOutlineLevel2Color Foreground="39159"/>
+          <ahaOutlineLevel3Color Foreground="2280512"/>
+          <ahaOutlineLevel4Color Foreground="13421568"/>
+          <ahaOutlineLevel5Color Foreground="16738346"/>
+          <ahaOutlineLevel6Color Foreground="13566148"/>
         </SchemePascal_Classic>
       </Globals>
       <LangObjectPascal Version="6">
Index: ide/ColorTwilight.xml
===================================================================
--- ide/ColorTwilight.xml	(revision 57176)
+++ ide/ColorTwilight.xml	(working copy)
@@ -46,6 +46,12 @@
           <ahaIdentComplWindow Background="3552822"/>
           <ahaIdentComplWindowBorder Foreground="7039851"/>
           <ahaIdentComplWindowHighlight Foreground="clLime"/>
+          <ahaOutlineLevel1Color Foreground="clRed"/>
+          <ahaOutlineLevel2Color Foreground="39159"/>
+          <ahaOutlineLevel3Color Foreground="2280512"/>
+          <ahaOutlineLevel4Color Foreground="13421568"/>
+          <ahaOutlineLevel5Color Foreground="16738346"/>
+          <ahaOutlineLevel6Color Foreground="13566148"/>
         </SchemeTwilight>
       </Globals>
       <LangObjectPascal Version="6">
Index: ide/editoroptions.pp
===================================================================
--- ide/editoroptions.pp	(revision 57176)
+++ ide/editoroptions.pp	(working copy)
@@ -121,7 +121,8 @@
     '',  // ahaTopInfoHint
     '', '', '',  // ahaIfDefBlockInactive, ahaIfDefBlockActive, ahaIfDefBlockTmpActive
     '', '', '',  // ahaIfDefNodeInactive, ahaIfDefNodeActive, ahaIfDefNodeTmpActive
-    '', '', '', '' // ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
+    '', '', '', '', // ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
+    '', '', '', '', '', '', '', '', '', '' // ahaOutlineLevel1Color..ahaOutlineLevel10Color
   );
 
   ahaGroupMap: array[TAdditionalHilightAttribute] of TAhaGroupName = (
@@ -167,7 +168,17 @@
     { ahaIdentComplWindow }           agnIdentComplWindow,
     { ahaIdentComplWindowBorder }     agnIdentComplWindow,
     { ahaIdentComplWindowSelection }  agnIdentComplWindow,
-    { ahaIdentComplWindowHighlight }  agnIdentComplWindow
+    { ahaIdentComplWindowHighlight }  agnIdentComplWindow,
+    { ahaOutlineLevel1Color }  agnOutlineColors,
+    { ahaOutlineLevel2Color }  agnOutlineColors,
+    { ahaOutlineLevel3Color }  agnOutlineColors,
+    { ahaOutlineLevel4Color }  agnOutlineColors,
+    { ahaOutlineLevel5Color }  agnOutlineColors,
+    { ahaOutlineLevel6Color }  agnOutlineColors,
+    { ahaOutlineLevel7Color }  agnOutlineColors,
+    { ahaOutlineLevel8Color }  agnOutlineColors,
+    { ahaOutlineLevel9Color }  agnOutlineColors,
+    { ahaOutlineLevel10Color } agnOutlineColors
 
   );
   ahaSupportedFeatures: array[TAdditionalHilightAttribute] of TColorSchemeAttributeFeatures =
@@ -214,7 +225,17 @@
     { ahaIdentComplWindow }   [hafBackColor, hafForeColor],
     { ahaIdentComplWindowBorder }    [hafForeColor],
     { ahaIdentComplWindowSelection } [hafBackColor, hafForeColor],
-    { ahaIdentComplWindowHighlight } [hafForeColor]
+    { ahaIdentComplWindowHighlight } [hafForeColor],
+    { ahaFoldLevel1Color }    [hafForeColor],
+    { ahaFoldLevel2Color }    [hafForeColor],
+    { ahaFoldLevel3Color }    [hafForeColor],
+    { ahaFoldLevel4Color }    [hafForeColor],
+    { ahaFoldLevel5Color }    [hafForeColor],
+    { ahaFoldLevel6Color }    [hafForeColor],
+    { ahaFoldLevel7Color }    [hafForeColor],
+    { ahaFoldLevel8Color }    [hafForeColor],
+    { ahaFoldLevel9Color }    [hafForeColor],
+    { ahaFoldLevel10Color }   [hafForeColor]
   );
 
 
@@ -2478,6 +2499,18 @@
   AdditionalHighlightAttributes[ahaIdentComplWindowHighlight] := dlgAddHiAttrHighlightPrefix;
   AdditionalHighlightGroupNames[agnIdentComplWindow]          := dlgIdentifierCompletion;
 
+  AdditionalHighlightAttributes[ahaOutlineLevel1Color]  := dlgAddHiAttrOutlineLevel1Color;
+  AdditionalHighlightAttributes[ahaOutlineLevel2Color]  := dlgAddHiAttrOutlineLevel2Color;
+  AdditionalHighlightAttributes[ahaOutlineLevel3Color]  := dlgAddHiAttrOutlineLevel3Color;
+  AdditionalHighlightAttributes[ahaOutlineLevel4Color]  := dlgAddHiAttrOutlineLevel4Color;
+  AdditionalHighlightAttributes[ahaOutlineLevel5Color]  := dlgAddHiAttrOutlineLevel5Color;
+  AdditionalHighlightAttributes[ahaOutlineLevel6Color]  := dlgAddHiAttrOutlineLevel6Color;
+  AdditionalHighlightAttributes[ahaOutlineLevel7Color]  := dlgAddHiAttrOutlineLevel7Color;
+  AdditionalHighlightAttributes[ahaOutlineLevel8Color]  := dlgAddHiAttrOutlineLevel8Color;
+  AdditionalHighlightAttributes[ahaOutlineLevel9Color]  := dlgAddHiAttrOutlineLevel9Color;
+  AdditionalHighlightAttributes[ahaOutlineLevel10Color] := dlgAddHiAttrOutlineLevel10Color;
+  AdditionalHighlightGroupNames[agnOutlineColors]  := dlgAddHiAttrGroupOutlineColors;
+
   AdditionalHighlightGroupNames[agnDefault]      := dlgAddHiAttrGroupDefault;
   AdditionalHighlightGroupNames[agnText]         := dlgAddHiAttrGroupText;
   AdditionalHighlightGroupNames[agnLine]         := dlgAddHiAttrGroupLine;
@@ -6541,6 +6574,21 @@
       SetMarkupColor(ahaSyncroEditSync,  TSynPluginSyncroEdit(aSynEdit.Plugin[i]).MarkupInfoSync);
       SetMarkupColor(ahaSyncroEditArea,  TSynPluginSyncroEdit(aSynEdit.Plugin[i]).MarkupInfoArea);
     end;
+    i := aSynEdit.MarkupCount - 1;
+    while (i >= 0) and not(aSynEdit.Markup[i] is TSynEditMarkupFoldColors) do
+      dec(i);
+    if i >= 0 then begin
+      SetMarkupColor(ahaOutlineLevel1Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[0]);
+      SetMarkupColor(ahaOutlineLevel2Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[1]);
+      SetMarkupColor(ahaOutlineLevel3Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[2]);
+      SetMarkupColor(ahaOutlineLevel4Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[3]);
+      SetMarkupColor(ahaOutlineLevel5Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[4]);
+      SetMarkupColor(ahaOutlineLevel6Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[5]);
+      SetMarkupColor(ahaOutlineLevel7Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[6]);
+      SetMarkupColor(ahaOutlineLevel8Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[7]);
+      SetMarkupColor(ahaOutlineLevel9Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[8]);
+      SetMarkupColor(ahaOutlineLevel10Color, TSynEditMarkupFoldColors(aSynEdit.Markup[i]).Color[9]);
+    end;
   finally
     ASynEdit.EndUpdate;
   end;
Index: ide/editoroptions.res
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: ide/frames/editor_color_options.pas
===================================================================
--- ide/frames/editor_color_options.pas	(revision 57176)
+++ ide/frames/editor_color_options.pas	(working copy)
@@ -276,6 +276,19 @@
     exit;
   end;
 
+  // Special draw oultine color
+  if Attri.Group = agnOutlineColors then begin
+    c := Attri.Foreground;
+    if c <> clNone then begin
+      TheTree.Canvas.Pen.Color := c;
+      TheTree.Canvas.MoveTo(NodeRect.Left+(FullAbcWidth div 2), NodeRect.Top+2);
+      TheTree.Canvas.LineTo(NodeRect.Left+(FullAbcWidth div 2), NodeRect.Bottom-2);
+      TheTree.Canvas.MoveTo(NodeRect.Left+(FullAbcWidth div 2)+1, NodeRect.Top+2);
+      TheTree.Canvas.LineTo(NodeRect.Left+(FullAbcWidth div 2)+1, NodeRect.Bottom-2);
+    end;
+    exit;
+  end;
+
   // Draw preview Frame
   TheTree.Canvas.Pen.Color := Attri.FrameColor;
   if (hafFrameColor in Attri.Features) and (AttriIdx <> ord(ahaCodeFoldingTree)) and
Index: ide/lazarusidestrconsts.pas
===================================================================
--- ide/lazarusidestrconsts.pas	(revision 57176)
+++ ide/lazarusidestrconsts.pas	(working copy)
@@ -2104,6 +2104,16 @@
   dlgAddHiAttrDefaultWindow       = 'Default Text / Window';
   dlgAddHiAttrWindowBorder        = 'Window border';
   dlgAddHiAttrHighlightPrefix     = 'Highlight prefix';
+  dlgAddHiAttrOutlineLevel1Color  = 'Level  1';
+  dlgAddHiAttrOutlineLevel2Color  = 'Level  2';
+  dlgAddHiAttrOutlineLevel3Color  = 'Level  3';
+  dlgAddHiAttrOutlineLevel4Color  = 'Level  4';
+  dlgAddHiAttrOutlineLevel5Color  = 'Level  5';
+  dlgAddHiAttrOutlineLevel6Color  = 'Level  6';
+  dlgAddHiAttrOutlineLevel7Color  = 'Level  7';
+  dlgAddHiAttrOutlineLevel8Color  = 'Level  8';
+  dlgAddHiAttrOutlineLevel9Color  = 'Level  9';
+  dlgAddHiAttrOutlineLevel10Color = 'Level 10';
   dlgAddHiSpecialVisibleChars     = 'Visualized Special Chars';
   dlgTopInfoHint                  = 'Current Class/Proc Hint';
   dlgIfDefBlockInactive           = 'Inactive $IFDEF code';
@@ -2120,6 +2130,7 @@
   dlgAddHiAttrGroupSyncroEdit    = 'Syncron Edit';
   dlgAddHiAttrGroupTemplateEdit  = 'Template Edit';
   dlgAddHiAttrGroupIfDef    = 'IfDef';
+  dlgAddHiAttrGroupOutlineColors = 'Outline Colors';
 
   dlgEditAccessCaptionLockedInView            = 'Locked, if text in view';
   dlgEditAccessCaptionUnLockedInSoftView      = 'Unlocked, if text in centered view';
Index: ide/sourcemarks.pas
===================================================================
--- ide/sourcemarks.pas	(revision 57176)
+++ ide/sourcemarks.pas	(working copy)
@@ -64,12 +64,13 @@
      ahaTopInfoHint,
      ahaIfDefBlockInactive, ahaIfDefBlockActive, ahaIfDefBlockTmpActive,
      ahaIfDefNodeInactive, ahaIfDefNodeActive, ahaIfDefNodeTmpActive,
-     ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight
+     ahaIdentComplWindow, ahaIdentComplWindowBorder, ahaIdentComplWindowSelection, ahaIdentComplWindowHighlight,
+     ahaOutlineLevel1Color, ahaOutlineLevel2Color, ahaOutlineLevel3Color, ahaOutlineLevel4Color, ahaOutlineLevel5Color, ahaOutlineLevel6Color, ahaOutlineLevel7Color, ahaOutlineLevel8Color, ahaOutlineLevel9Color, ahaOutlineLevel10Color
      );
 
   TAhaGroupName = (
     agnDefault, agnLanguage, agnText, agnLine, agnGutter, agnTemplateMode, agnSyncronMode,
-    agnIfDef, agnIdentComplWindow
+    agnIfDef, agnIdentComplWindow, agnOutlineColors
   );
 
   TSourceEditorBase = class;

Pascal Riekenberg

2018-01-29 10:16

reporter  

editoroptions.res (65,924 bytes)

Issue History

Date Modified Username Field Change
2018-01-02 16:37 Vojtech Cihak New Issue
2018-01-02 20:47 Martin Friebe Assigned To => Martin Friebe
2018-01-02 20:47 Martin Friebe Status new => assigned
2018-01-20 07:39 Pascal Riekenberg File Added: color_options_for_outline_coloring.patch
2018-01-20 07:40 Pascal Riekenberg Note Added: 0105949
2018-01-20 18:59 Vojtech Cihak Note Added: 0105959
2018-01-20 21:52 Pascal Riekenberg Note Added: 0105964
2018-01-20 21:59 Pascal Riekenberg Note Edited: 0105964 View Revisions
2018-01-21 07:42 Pascal Riekenberg Note Added: 0105974
2018-01-21 08:21 Pascal Riekenberg Note Added: 0105975
2018-01-21 14:41 Vojtech Cihak Note Added: 0105984
2018-01-21 14:42 Vojtech Cihak Note Edited: 0105984 View Revisions
2018-01-21 16:59 Vojtech Cihak Note Added: 0105987
2018-01-22 08:08 Pascal Riekenberg Note Added: 0105999
2018-01-22 11:27 Pascal Riekenberg File Added: color_options_for_outline_coloring_V2.patch
2018-01-22 11:31 Pascal Riekenberg Note Added: 0106002
2018-01-22 14:13 Vojtech Cihak Note Added: 0106004
2018-01-22 14:48 Pascal Riekenberg Note Added: 0106007
2018-01-22 15:18 Vojtech Cihak Note Added: 0106008
2018-01-22 15:18 Vojtech Cihak File Added: color_outlines.png
2018-01-22 15:19 Vojtech Cihak Note Edited: 0106008 View Revisions
2018-01-22 15:25 Pascal Riekenberg Note Added: 0106009
2018-01-22 15:31 Pascal Riekenberg Note Edited: 0106009 View Revisions
2018-01-22 15:55 Vojtech Cihak Note Added: 0106010
2018-01-22 16:00 Pascal Riekenberg Note Added: 0106012
2018-01-29 10:16 Pascal Riekenberg File Added: color_options_for_outline_coloring_V3.patch
2018-01-29 10:16 Pascal Riekenberg File Added: editoroptions.res
2018-01-29 22:04 Martin Friebe Fixed in Revision => 57182
2018-01-29 22:04 Martin Friebe LazTarget => -
2018-01-29 22:04 Martin Friebe Status assigned => resolved
2018-01-29 22:04 Martin Friebe Fixed in Version => 1.8.2
2018-01-29 22:04 Martin Friebe Resolution open => fixed
2018-01-29 22:04 Martin Friebe Target Version => 1.8.2