mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-03 17:23:45 +02:00
synedit: allow code folding tree color customization
git-svn-id: trunk@18046 -
This commit is contained in:
parent
ad86924500
commit
28544c79b9
@ -471,6 +471,7 @@ type
|
|||||||
function GetLineHighlightColor: TSynSelectedColor;
|
function GetLineHighlightColor: TSynSelectedColor;
|
||||||
function GetLineNumberColor: TSynSelectedColor;
|
function GetLineNumberColor: TSynSelectedColor;
|
||||||
function GetModifiedLineColor: TSynSelectedColor;
|
function GetModifiedLineColor: TSynSelectedColor;
|
||||||
|
function GetCodeFoldingTreeColor: TSynSelectedColor;
|
||||||
function GetOnGutterClick : TGutterClickEvent;
|
function GetOnGutterClick : TGutterClickEvent;
|
||||||
function GetSelectedColor : TSynSelectedColor;
|
function GetSelectedColor : TSynSelectedColor;
|
||||||
function GetBracketMatchColor : TSynSelectedColor;
|
function GetBracketMatchColor : TSynSelectedColor;
|
||||||
@ -938,6 +939,7 @@ type
|
|||||||
property LineNumberColor: TSynSelectedColor read GetLineNumberColor;
|
property LineNumberColor: TSynSelectedColor read GetLineNumberColor;
|
||||||
property LineHighlightColor: TSynSelectedColor read GetLineHighlightColor;
|
property LineHighlightColor: TSynSelectedColor read GetLineHighlightColor;
|
||||||
property ModifiedLineColor: TSynSelectedColor read GetModifiedLineColor;
|
property ModifiedLineColor: TSynSelectedColor read GetModifiedLineColor;
|
||||||
|
property CodeFoldingTreeColor: TSynSelectedColor read GetCodeFoldingTreeColor;
|
||||||
property BracketHighlightStyle: TSynEditBracketHighlightStyle
|
property BracketHighlightStyle: TSynEditBracketHighlightStyle
|
||||||
read GetBracketHighlightStyle write SetBracketHighlightStyle;
|
read GetBracketHighlightStyle write SetBracketHighlightStyle;
|
||||||
//property Color: TSynSelectedColor read GetSelectedColor;
|
//property Color: TSynSelectedColor read GetSelectedColor;
|
||||||
@ -1083,6 +1085,7 @@ type
|
|||||||
property BracketHighlightStyle;
|
property BracketHighlightStyle;
|
||||||
property BracketMatchColor;
|
property BracketMatchColor;
|
||||||
property ModifiedLineColor;
|
property ModifiedLineColor;
|
||||||
|
property CodeFoldingTreeColor;
|
||||||
property MouseLinkColor;
|
property MouseLinkColor;
|
||||||
property LineNumberColor;
|
property LineNumberColor;
|
||||||
property LineHighlightColor;
|
property LineHighlightColor;
|
||||||
@ -4103,6 +4106,11 @@ begin
|
|||||||
Result := Point(CaretX, CaretY);
|
Result := Point(CaretX, CaretY);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomSynEdit.GetCodeFoldingTreeColor: TSynSelectedColor;
|
||||||
|
begin
|
||||||
|
Result := fGutter.MarkupInfoCodeFoldingTree;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomSynEdit.SetCaretXY(Value: TPoint);
|
procedure TCustomSynEdit.SetCaretXY(Value: TPoint);
|
||||||
// physical position (screen)
|
// physical position (screen)
|
||||||
var
|
var
|
||||||
|
@ -157,6 +157,7 @@ type
|
|||||||
procedure SetShowOnlyLineNumbersMultiplesOf(const AValue: integer);
|
procedure SetShowOnlyLineNumbersMultiplesOf(const AValue: integer);
|
||||||
function GetMarkupInfoLineNumber: TSynSelectedColor;
|
function GetMarkupInfoLineNumber: TSynSelectedColor;
|
||||||
function GetMarkupInfoModifiedLine: TSynSelectedColor;
|
function GetMarkupInfoModifiedLine: TSynSelectedColor;
|
||||||
|
function GetMarkupInfoCodeFoldingTree: TSynSelectedColor;
|
||||||
function GetDigitCount : Integer;
|
function GetDigitCount : Integer;
|
||||||
function GetZeroStart : Boolean;
|
function GetZeroStart : Boolean;
|
||||||
function GetShowOnlyLineNumbersMultiplesOf : Integer;
|
function GetShowOnlyLineNumbersMultiplesOf : Integer;
|
||||||
@ -206,6 +207,7 @@ type
|
|||||||
property ZeroStart: boolean read GetZeroStart write SetZeroStart;
|
property ZeroStart: boolean read GetZeroStart write SetZeroStart;
|
||||||
property MarkupInfoLineNumber: TSynSelectedColor read GetMarkupInfoLineNumber;
|
property MarkupInfoLineNumber: TSynSelectedColor read GetMarkupInfoLineNumber;
|
||||||
property MarkupInfoModifiedLine: TSynSelectedColor read GetMarkupInfoModifiedLine;
|
property MarkupInfoModifiedLine: TSynSelectedColor read GetMarkupInfoModifiedLine;
|
||||||
|
property MarkupInfoCodeFoldingTree: TSynSelectedColor read GetMarkupInfoCodeFoldingTree;
|
||||||
property LeadingZeros: boolean read GetLeadingZeros write SetLeadingZeros
|
property LeadingZeros: boolean read GetLeadingZeros write SetLeadingZeros
|
||||||
default FALSE;
|
default FALSE;
|
||||||
property DigitCount: integer read GetDigitCount write SetDigitCount
|
property DigitCount: integer read GetDigitCount write SetDigitCount
|
||||||
@ -479,6 +481,11 @@ begin
|
|||||||
Result := TSynGutterPartBase(FGutterPartList[Index]);
|
Result := TSynGutterPartBase(FGutterPartList[Index]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSynGutter.GetMarkupInfoCodeFoldingTree: TSynSelectedColor;
|
||||||
|
begin
|
||||||
|
Result := TSynGutterCodeFolding(FCodeFoldGutter).MarkupInfoCodeFoldingTree;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSynGutter.SetLeftOffset(Value: integer);
|
procedure TSynGutter.SetLeftOffset(Value: integer);
|
||||||
begin
|
begin
|
||||||
Value := Max(0, Value);
|
Value := Max(0, Value);
|
||||||
|
@ -95,7 +95,7 @@ begin
|
|||||||
Canvas.FillRect(AClip);
|
Canvas.FillRect(AClip);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Canvas.Pen.Width := Width ;
|
Canvas.Pen.Width := Width;
|
||||||
Canvas.Pen.EndCap:= pecFlat;
|
Canvas.Pen.EndCap:= pecFlat;
|
||||||
|
|
||||||
rcLine := AClip;
|
rcLine := AClip;
|
||||||
|
@ -16,7 +16,7 @@ type
|
|||||||
private
|
private
|
||||||
FEdit: TSynEditBase;
|
FEdit: TSynEditBase;
|
||||||
FFoldView: TSynEditFoldedView;
|
FFoldView: TSynEditFoldedView;
|
||||||
|
FMarkupInfoCodeFoldingTree: TSynSelectedColor;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner : TSynEditBase; AFoldView : TSynEditFoldedView);
|
constructor Create(AOwner : TSynEditBase; AFoldView : TSynEditFoldedView);
|
||||||
|
|
||||||
@ -25,6 +25,7 @@ type
|
|||||||
function RealGutterWidth(CharWidth: integer): integer; override;
|
function RealGutterWidth(CharWidth: integer): integer; override;
|
||||||
procedure DoOnGutterClick(X, Y: integer); override;
|
procedure DoOnGutterClick(X, Y: integer); override;
|
||||||
public
|
public
|
||||||
|
property MarkupInfoCodeFoldingTree: TSynSelectedColor read FMarkupInfoCodeFoldingTree;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -40,6 +41,12 @@ begin
|
|||||||
FEdit := AOwner;
|
FEdit := AOwner;
|
||||||
FFoldView := AFoldView;
|
FFoldView := AFoldView;
|
||||||
|
|
||||||
|
FMarkupInfoCodeFoldingTree := TSynSelectedColor.Create;
|
||||||
|
FMarkupInfoCodeFoldingTree.Background := clNone;
|
||||||
|
FMarkupInfoCodeFoldingTree.Foreground := clDkGray;
|
||||||
|
FMarkupInfoCodeFoldingTree.FrameColor := clNone;
|
||||||
|
FMarkupInfoCodeFoldingTree.OnChange := @DoChange;
|
||||||
|
|
||||||
Width := 14;
|
Width := 14;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -64,7 +71,6 @@ procedure TSynGutterCodeFolding.Paint(Canvas : TCanvas; AClip : TRect; FirstLine
|
|||||||
var
|
var
|
||||||
iLine: integer;
|
iLine: integer;
|
||||||
rcLine: TRect;
|
rcLine: TRect;
|
||||||
dc: HDC;
|
|
||||||
rcCodeFold: TRect;
|
rcCodeFold: TRect;
|
||||||
tmp: TSynEditCodeFoldType;
|
tmp: TSynEditCodeFoldType;
|
||||||
LineHeight, LineOffset: Integer;
|
LineHeight, LineOffset: Integer;
|
||||||
@ -138,15 +144,19 @@ begin
|
|||||||
if not Visible then exit;
|
if not Visible then exit;
|
||||||
LineHeight := TSynEdit(FEdit).LineHeight;
|
LineHeight := TSynEdit(FEdit).LineHeight;
|
||||||
LineOffset := 0;
|
LineOffset := 0;
|
||||||
Canvas.Brush.Color := Color;
|
|
||||||
dc := Canvas.Handle;
|
if MarkupInfoCodeFoldingTree.Background <> clNone then
|
||||||
{$IFDEF SYN_LAZARUS}
|
begin
|
||||||
LCLIntf.SetBkColor(dc,Canvas.Brush.Color);
|
Canvas.Brush.Color := MarkupInfoCodeFoldingTree.Background;
|
||||||
{$ENDIF}
|
{$IFDEF SYN_LAZARUS}
|
||||||
|
LCLIntf.SetBkColor(Canvas.Handle, Canvas.Brush.Color);
|
||||||
|
{$ENDIF}
|
||||||
|
Canvas.FillRect(AClip);
|
||||||
|
end;
|
||||||
|
|
||||||
with Canvas do
|
with Canvas do
|
||||||
begin
|
begin
|
||||||
Pen.Color := clDkGray;
|
Pen.Color := MarkupInfoCodeFoldingTree.Foreground;
|
||||||
Pen.Width := 1;
|
Pen.Width := 1;
|
||||||
|
|
||||||
rcLine.Bottom := FirstLine * LineHeight;
|
rcLine.Bottom := FirstLine * LineHeight;
|
||||||
|
Loading…
Reference in New Issue
Block a user