SynEdit Gutter: Fixing some AutoSize stuff

git-svn-id: trunk@18364 -
This commit is contained in:
martin 2009-01-20 22:54:53 +00:00
parent 87ca389d26
commit 3fe186c1da
3 changed files with 19 additions and 4 deletions

View File

@ -118,6 +118,7 @@ type
FOnGutterClick: TGutterClickEvent;
function GetGutterParts: TSynGutterPartList;
procedure SetMarkupInfo(const AValue: TSynSelectedColor);
procedure SetRealWidth(const AValue: Integer);
protected
FWidth : integer;
procedure SetAutoSize(const AValue : boolean); virtual;
@ -127,6 +128,7 @@ type
property GutterParts: TSynGutterPartList read GetGutterParts;
property Gutter: TSynGutter read FGutter;
property SynEdit:TSynEditBase read FSynEdit;
property RealWidth: Integer write SetRealWidth;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@ -600,8 +602,10 @@ end;
procedure TSynGutter.SetWidth(Value: integer);
begin
if FAutoSize then
Value := RealGutterWidth(FTextDrawer.CharWidth);
Value := Max(0, Value);
if (FWidth <> Value) and not FAutoSize then
if (FWidth <> Value) then
begin
FWidth := Value;
DoChange(Self);
@ -728,6 +732,13 @@ begin
FMarkupInfo.Assign(AValue);
end;
procedure TSynGutterPartBase.SetRealWidth(const AValue: Integer);
begin
if FWidth = AValue then exit;
FWidth := AValue;
DoChange(self);
end;
procedure TSynGutterPartBase.SetAutoSize(const AValue : boolean);
begin
if FAutoSize=AValue then exit;

View File

@ -90,7 +90,7 @@ begin
end;
if AutoSize then
Width := 4;
RealWidth := 4;
Result := Width;
end;

View File

@ -136,7 +136,7 @@ begin
end;
if AutoSize then
FWidth := FAutoSizeDigitCount * CharWidth + 1;
RealWidth := FAutoSizeDigitCount * CharWidth + 1;
Result := Width;
end;
@ -153,8 +153,12 @@ begin
FAutoSizeDigitCount := nDigits;
DoChange(Self);
end;
end else
end
else
if FAutoSizeDigitCount <> FDigitCount then begin
FAutoSizeDigitCount := FDigitCount;
DoChange(Self);
end;
end;
function TSynGutterLineNumber.FormatLineNumber(Line: integer; IsDot: boolean): string;