mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 20:56:14 +02:00
SynEdit Gutter: Fixing some AutoSize stuff
git-svn-id: trunk@18364 -
This commit is contained in:
parent
87ca389d26
commit
3fe186c1da
@ -118,6 +118,7 @@ type
|
|||||||
FOnGutterClick: TGutterClickEvent;
|
FOnGutterClick: TGutterClickEvent;
|
||||||
function GetGutterParts: TSynGutterPartList;
|
function GetGutterParts: TSynGutterPartList;
|
||||||
procedure SetMarkupInfo(const AValue: TSynSelectedColor);
|
procedure SetMarkupInfo(const AValue: TSynSelectedColor);
|
||||||
|
procedure SetRealWidth(const AValue: Integer);
|
||||||
protected
|
protected
|
||||||
FWidth : integer;
|
FWidth : integer;
|
||||||
procedure SetAutoSize(const AValue : boolean); virtual;
|
procedure SetAutoSize(const AValue : boolean); virtual;
|
||||||
@ -127,6 +128,7 @@ type
|
|||||||
property GutterParts: TSynGutterPartList read GetGutterParts;
|
property GutterParts: TSynGutterPartList read GetGutterParts;
|
||||||
property Gutter: TSynGutter read FGutter;
|
property Gutter: TSynGutter read FGutter;
|
||||||
property SynEdit:TSynEditBase read FSynEdit;
|
property SynEdit:TSynEditBase read FSynEdit;
|
||||||
|
property RealWidth: Integer write SetRealWidth;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -600,8 +602,10 @@ end;
|
|||||||
|
|
||||||
procedure TSynGutter.SetWidth(Value: integer);
|
procedure TSynGutter.SetWidth(Value: integer);
|
||||||
begin
|
begin
|
||||||
|
if FAutoSize then
|
||||||
|
Value := RealGutterWidth(FTextDrawer.CharWidth);
|
||||||
Value := Max(0, Value);
|
Value := Max(0, Value);
|
||||||
if (FWidth <> Value) and not FAutoSize then
|
if (FWidth <> Value) then
|
||||||
begin
|
begin
|
||||||
FWidth := Value;
|
FWidth := Value;
|
||||||
DoChange(Self);
|
DoChange(Self);
|
||||||
@ -728,6 +732,13 @@ begin
|
|||||||
FMarkupInfo.Assign(AValue);
|
FMarkupInfo.Assign(AValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSynGutterPartBase.SetRealWidth(const AValue: Integer);
|
||||||
|
begin
|
||||||
|
if FWidth = AValue then exit;
|
||||||
|
FWidth := AValue;
|
||||||
|
DoChange(self);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSynGutterPartBase.SetAutoSize(const AValue : boolean);
|
procedure TSynGutterPartBase.SetAutoSize(const AValue : boolean);
|
||||||
begin
|
begin
|
||||||
if FAutoSize=AValue then exit;
|
if FAutoSize=AValue then exit;
|
||||||
|
@ -90,7 +90,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
if AutoSize then
|
if AutoSize then
|
||||||
Width := 4;
|
RealWidth := 4;
|
||||||
Result := Width;
|
Result := Width;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
if AutoSize then
|
if AutoSize then
|
||||||
FWidth := FAutoSizeDigitCount * CharWidth + 1;
|
RealWidth := FAutoSizeDigitCount * CharWidth + 1;
|
||||||
Result := Width;
|
Result := Width;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -153,8 +153,12 @@ begin
|
|||||||
FAutoSizeDigitCount := nDigits;
|
FAutoSizeDigitCount := nDigits;
|
||||||
DoChange(Self);
|
DoChange(Self);
|
||||||
end;
|
end;
|
||||||
end else
|
end
|
||||||
|
else
|
||||||
|
if FAutoSizeDigitCount <> FDigitCount then begin
|
||||||
FAutoSizeDigitCount := FDigitCount;
|
FAutoSizeDigitCount := FDigitCount;
|
||||||
|
DoChange(Self);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynGutterLineNumber.FormatLineNumber(Line: integer; IsDot: boolean): string;
|
function TSynGutterLineNumber.FormatLineNumber(Line: integer; IsDot: boolean): string;
|
||||||
|
Loading…
Reference in New Issue
Block a user