SynEdit: fold indicator pen.width for drawing depend on PPI / autosizing

git-svn-id: trunk@58516 -
This commit is contained in:
martin 2018-07-14 10:16:58 +00:00
parent 8eb5a276bc
commit ed902001ff

View File

@ -390,8 +390,6 @@ var
begin begin
inherited ScalePPI(AScaleFactor); inherited ScalePPI(AScaleFactor);
FPpiPenWidth := Max(1, Scale96ToFont(1)); FPpiPenWidth := Max(1, Scale96ToFont(1));
m := Max(1, Min(Width, TCustomSynEdit(SynEdit).LineHeight - cNodeOffset*2) div 5);
FPpiPenWidth := Min(m, FPpiPenWidth);
end; end;
procedure TSynGutterCodeFolding.PopClicked(Sender: TObject); procedure TSynGutterCodeFolding.PopClicked(Sender: TObject);
@ -421,8 +419,6 @@ begin
inherited SetWidth(AValue); inherited SetWidth(AValue);
FPpiPenWidth := Max(1, Scale96ToFont(1)); FPpiPenWidth := Max(1, Scale96ToFont(1));
m := Max(1, Min(Width, TCustomSynEdit(SynEdit).LineHeight - cNodeOffset*2) div 5);
FPpiPenWidth := Min(m, FPpiPenWidth);
end; end;
procedure TSynGutterCodeFolding.DoOnGutterClick(X, Y : integer); procedure TSynGutterCodeFolding.DoOnGutterClick(X, Y : integer);
@ -560,7 +556,7 @@ begin
Canvas.Rectangle(Rect); Canvas.Rectangle(Rect);
Canvas.Pen.Style := psSolid; Canvas.Pen.Style := psSolid;
Canvas.Pen.Cosmetic := OdlCosmetic; Canvas.Pen.Cosmetic := OdlCosmetic;
c := FPpiPenWidth div 2; c := Canvas.Pen.Width div 2;
LineBorder := Round((Rect.Right-Rect.Left) / 5) + c; LineBorder := Round((Rect.Right-Rect.Left) / 5) + c;
LineBorderEnd := LineBorder + c; LineBorderEnd := LineBorder + c;
X := (Rect.Left - 1 + Rect.Right) div 2; X := (Rect.Left - 1 + Rect.Right) div 2;
@ -618,8 +614,10 @@ begin
end; end;
function TSynGutterCodeFolding.PreferedWidth: Integer; function TSynGutterCodeFolding.PreferedWidth: Integer;
const PrefFullWidth = 10;
begin begin
Result := 10; Result :=
Max(PrefFullWidth div 2, Min(PrefFullWidth, TCustomSynEdit(SynEdit).LineHeight - cNodeOffset));
end; end;
procedure TSynGutterCodeFolding.Paint(Canvas : TCanvas; AClip : TRect; FirstLine, LastLine : integer); procedure TSynGutterCodeFolding.Paint(Canvas : TCanvas; AClip : TRect; FirstLine, LastLine : integer);
@ -656,7 +654,7 @@ var
// If belongs to line above, draw at very top // If belongs to line above, draw at very top
if isPrevLine then if isPrevLine then
ptCenter.Y := rcCodeFold.Top + (HalfBoxSize) - 1; ptCenter.Y := rcCodeFold.Top + (HalfBoxSize) - 1;
c := FPpiPenWidth div 2; c := Canvas.Pen.Width div 2;
//area of drawbox //area of drawbox
rcNode.Left := ptCenter.X - (HalfBoxSize) + 1 + c; rcNode.Left := ptCenter.X - (HalfBoxSize) + 1 + c;
@ -743,7 +741,7 @@ begin
begin begin
Pen.Color := MarkupInfo.Foreground; Pen.Color := MarkupInfo.Foreground;
Pen.EndCap := pecSquare; Pen.EndCap := pecSquare;
Pen.Width := FPpiPenWidth; Pen.Width := Min(Max(1, Min(Width, HalfBoxSize*2 - cNodeOffset*2) div 5), FPpiPenWidth);
rcLine.Bottom := AClip.Top; rcLine.Bottom := AClip.Top;
for iLine := FirstLine to LastLine do for iLine := FirstLine to LastLine do