You've already forked lazarus-ccr
fpspreadsheet: Improved centering of stacked text in cells of Worksheetgrid
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4206 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -428,7 +428,6 @@ begin
|
|||||||
totalHeight := 0;
|
totalHeight := 0;
|
||||||
|
|
||||||
Convert_sFont_to_Font(AWorkbook.GetFont(AFontIndex), ACanvas.Font);
|
Convert_sFont_to_Font(AWorkbook.GetFont(AFontIndex), ACanvas.Font);
|
||||||
|
|
||||||
if ARotation = rtStacked then
|
if ARotation = rtStacked then
|
||||||
stackPeriod := ACanvas.TextWidth('M') * 2;
|
stackPeriod := ACanvas.TextWidth('M') * 2;
|
||||||
|
|
||||||
@ -444,10 +443,7 @@ begin
|
|||||||
FirstRtpIndex := iRtp;
|
FirstRtpIndex := iRtp;
|
||||||
NextRtpIndex := iRtp;
|
NextRtpIndex := iRtp;
|
||||||
ScanLine(pEnd, NumSpaces, NextRtpIndex, Width, Height);
|
ScanLine(pEnd, NumSpaces, NextRtpIndex, Width, Height);
|
||||||
if ARotation = rtStacked then
|
totalHeight := totalHeight + Height;
|
||||||
totalHeight := totalHeight + stackPeriod
|
|
||||||
else
|
|
||||||
totalHeight := totalHeight + Height;
|
|
||||||
iRtp := NextRtpIndex;
|
iRtp := NextRtpIndex;
|
||||||
p := pEnd;
|
p := pEnd;
|
||||||
case p^ of
|
case p^ of
|
||||||
@ -462,6 +458,7 @@ begin
|
|||||||
until p^ = #0;
|
until p^ = #0;
|
||||||
|
|
||||||
// Draw lines
|
// Draw lines
|
||||||
|
// 1/ get starting point of line
|
||||||
case ARotation of
|
case ARotation of
|
||||||
trHorizontal:
|
trHorizontal:
|
||||||
case AVertAlignment of
|
case AVertAlignment of
|
||||||
@ -483,14 +480,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
rtStacked:
|
rtStacked:
|
||||||
begin
|
begin
|
||||||
|
totalHeight := (Length(lineinfos) - 1) * stackperiod;
|
||||||
case AHorAlignment of
|
case AHorAlignment of
|
||||||
haLeft : xpos := ARect.Left + stackPeriod div 2;
|
haLeft : xpos := ARect.Left + stackPeriod div 2;
|
||||||
haRight : xpos := ARect.Right - totalHeight + stackPeriod div 2;
|
haRight : xpos := ARect.Right - totalHeight + stackPeriod div 2;
|
||||||
haCenter: xpos := (ARect.Left + ARect.Right - (Length(lineInfos)-1) * stackPeriod) div 2;
|
haCenter: xpos := (ARect.Left + ARect.Right - totalHeight) div 2;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// 2/ Draw line by line and respect text rotation
|
||||||
for lineInfo in lineInfos do begin
|
for lineInfo in lineInfos do begin
|
||||||
with lineInfo do
|
with lineInfo do
|
||||||
begin
|
begin
|
||||||
|
Reference in New Issue
Block a user