mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 00:29:28 +02:00
fpvectorial: Improves list rendering
git-svn-id: trunk@48985 -
This commit is contained in:
parent
d74381d94a
commit
3acde3bf25
@ -726,7 +726,7 @@ Var
|
|||||||
If Not Assigned(TvParagraph(oEntity).Style) Then
|
If Not Assigned(TvParagraph(oEntity).Style) Then
|
||||||
TvParagraph(oEntity).Style := AList.Style;
|
TvParagraph(oEntity).Style := AList.Style;
|
||||||
|
|
||||||
ProcessParagraph(TvParagraph(oEntity), AList.Level, FData.FindListStyleIndex(AList.ListStyle) + 1);
|
ProcessParagraph(TvParagraph(oEntity), AList.GetLevel(), FData.FindListStyleIndex(AList.ListStyle) + 1);
|
||||||
End
|
End
|
||||||
Else If oEntity Is TvList Then
|
Else If oEntity Is TvList Then
|
||||||
ProcessList(TvList(oEntity))
|
ProcessList(TvList(oEntity))
|
||||||
|
@ -1006,7 +1006,8 @@ type
|
|||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function AddParagraph(ASimpleText: string): TvParagraph;
|
function AddParagraph(ASimpleText: string): TvParagraph;
|
||||||
function AddList : TvList;
|
function AddList : TvList;
|
||||||
function Level : Integer;
|
function GetLevel : Integer;
|
||||||
|
function GetBulletSize: Double;
|
||||||
class procedure DrawBullet(ADest: TFPCustomCanvas; var ARenderInfo: TvRenderInfo;
|
class procedure DrawBullet(ADest: TFPCustomCanvas; var ARenderInfo: TvRenderInfo;
|
||||||
ALevel: Integer; AX, AY: Double; ADestX: Integer = 0; ADestY: Integer = 0;
|
ALevel: Integer; AX, AY: Double; ADestX: Integer = 0; ADestY: Integer = 0;
|
||||||
AMulX: Double = 1.0; AMulY: Double = 1.0; ADoDraw: Boolean = True);
|
AMulX: Double = 1.0; AMulY: Double = 1.0; ADoDraw: Boolean = True);
|
||||||
@ -6271,7 +6272,7 @@ begin
|
|||||||
AddEntity(Result);
|
AddEntity(Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TvList.Level: Integer;
|
function TvList.GetLevel: Integer;
|
||||||
var
|
var
|
||||||
oListItem : TvList;
|
oListItem : TvList;
|
||||||
begin
|
begin
|
||||||
@ -6287,6 +6288,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TvList.GetBulletSize: Double;
|
||||||
|
begin
|
||||||
|
Result := Font.Size;
|
||||||
|
if Result = 0 then Result := 10;
|
||||||
|
Result := Result * 1.5; // for upper/lower spacing
|
||||||
|
end;
|
||||||
|
|
||||||
class procedure TvList.DrawBullet(ADest: TFPCustomCanvas;
|
class procedure TvList.DrawBullet(ADest: TFPCustomCanvas;
|
||||||
var ARenderInfo: TvRenderInfo; ALevel: Integer; AX, AY: Double;
|
var ARenderInfo: TvRenderInfo; ALevel: Integer; AX, AY: Double;
|
||||||
ADestX: Integer; ADestY: Integer; AMulX: Double; AMulY: Double;
|
ADestX: Integer; ADestY: Integer; AMulX: Double; AMulY: Double;
|
||||||
@ -6329,37 +6337,26 @@ begin
|
|||||||
InitializeRenderInfo(ARenderInfo);
|
InitializeRenderInfo(ARenderInfo);
|
||||||
|
|
||||||
// Don't call inherited Render(ADest, ARenderInfo, ADestX, ADestY, AMulX, AMulY, ADoDraw);
|
// Don't call inherited Render(ADest, ARenderInfo, ADestX, ADestY, AMulX, AMulY, ADoDraw);
|
||||||
|
|
||||||
|
CurX := X + GetBulletSize();
|
||||||
|
CurY := Y;
|
||||||
|
|
||||||
lEntity := GetFirstEntity();
|
lEntity := GetFirstEntity();
|
||||||
while lEntity <> nil do
|
while lEntity <> nil do
|
||||||
begin
|
begin
|
||||||
if lEntity is TvParagraph then
|
if lEntity is TvParagraph then
|
||||||
begin
|
begin
|
||||||
{lText.Render(ADest, lEntityRenderInfo, CurX, ADestY + lHeight_px, AMulX, AMulY, ADoDraw);
|
TvList.DrawBullet(ADest, lEntityRenderInfo, GetLevel(),
|
||||||
lText.CalculateBoundingBox(ADest, lLeft, lTop, lRight, lBottom);
|
X, CurY, ADestX, ADestY, AMulX, AMulY, ADoDraw);
|
||||||
lCurWidth := lCurWidth + Abs(lRight - lLeft);
|
|
||||||
lFirstText := False;
|
|
||||||
lPrevText := lText;
|
|
||||||
|
|
||||||
lText.X := OldTextX;
|
|
||||||
lText.Y := OldTextY;
|
|
||||||
if lResetOldStyle then
|
|
||||||
TvText(lEntity).Style := nil; }
|
|
||||||
end
|
|
||||||
else if lEntity is TvList then
|
|
||||||
begin
|
|
||||||
{OldTextX := lText.X;
|
|
||||||
OldTextY := lText.Y;
|
|
||||||
lEntity.X := CoordToCanvasX(lEntity.X + X + lCurWidth);
|
|
||||||
lEntity.Y := lEntity.Y + Y;
|
|
||||||
|
|
||||||
lEntity.Render(ADest, lEntityRenderInfo, ADestX, ADestY + lHeight_px, AMulX, AMulY, ADoDraw);
|
|
||||||
|
|
||||||
lEntity.X := OldTextX;
|
|
||||||
lEntity.Y := OldTextY; }
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
lEntity.X := CurX;
|
||||||
|
lEntity.Y := CurY;
|
||||||
|
lEntity.Render(ADest, lEntityRenderInfo, ADestX, ADestY, AMulX, AMulY, ADoDraw);
|
||||||
|
|
||||||
MergeRenderInfo(lEntityRenderInfo, ARenderInfo);
|
MergeRenderInfo(lEntityRenderInfo, ARenderInfo);
|
||||||
|
|
||||||
|
CurY := CurY + GetBulletSize();
|
||||||
lEntity := GetNextEntity();
|
lEntity := GetNextEntity();
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user