lcl: less with-blocks due to FPC 3.1.1 new record methods

git-svn-id: trunk@50254 -
This commit is contained in:
mattias 2015-11-08 10:32:23 +00:00
parent 12697b9fd7
commit 936b768f7c

View File

@ -57,16 +57,13 @@ begin
if PaintRect.Top = PaintRect.Bottom then if PaintRect.Top = PaintRect.Bottom then
PaintRect.Bottom := PaintRect.Bottom + 1; PaintRect.Bottom := PaintRect.Bottom + 1;
with PaintRect do MinSize := Min(PaintRect.Right - PaintRect.Left, PaintRect.Bottom - PaintRect.Top);
begin
MinSize := Min(Right - Left, Bottom - Top);
if FShape in [stSquare, stRoundSquare, stCircle, stSquaredDiamond] then if FShape in [stSquare, stRoundSquare, stCircle, stSquaredDiamond] then
begin begin
Left := Left + ((Right - Left) - MinSize) div 2; PaintRect.Left := PaintRect.Left + ((PaintRect.Right - PaintRect.Left) - MinSize) div 2;
Top := Top + ((Bottom - Top) - MinSize) div 2; PaintRect.Top := PaintRect.Top + ((PaintRect.Bottom - PaintRect.Top) - MinSize) div 2;
Right := Left + MinSize; PaintRect.Right := PaintRect.Left + MinSize;
Bottom := Top + MinSize; PaintRect.Bottom := PaintRect.Top + MinSize;
end;
end; end;
case FShape of case FShape of
@ -78,22 +75,17 @@ begin
Ellipse(PaintRect); Ellipse(PaintRect);
stSquaredDiamond, stDiamond: stSquaredDiamond, stDiamond:
begin begin
with PaintRect do P[0].x := PaintRect.Left;
begin P[0].y := (PaintRect.Top + PaintRect.Bottom) div 2;
P[0].x := Left; P[1].x := (PaintRect.Left + PaintRect.Right) div 2;
P[0].y := (Top + Bottom) div 2; P[1].y := PaintRect.Top;
P[1].x := (Left + Right) div 2; P[2].x := PaintRect.Right - 1;
P[1].y := Top;
P[2].x := Right - 1;
P[2].y := P[0].y; P[2].y := P[0].y;
P[3].x := P[1].x; P[3].x := P[1].x;
P[3].y := Bottom - 1; P[3].y := PaintRect.Bottom - 1;
Polygon(P); Polygon(P);
end; end;
end;
stTriangle: stTriangle:
begin
with Self do
begin begin
P[0].x := (Width - 1) div 2; P[0].x := (Width - 1) div 2;
P[0].y := PenInc; P[0].y := PenInc;
@ -105,10 +97,7 @@ begin
P[3].y := P[0].y; P[3].y := P[0].y;
Polygon(P); Polygon(P);
end; end;
end;
stTriangleDown: stTriangleDown:
begin
with Self do
begin begin
P[0].x := (Width - 1) div 2; P[0].x := (Width - 1) div 2;
P[0].y := Height - PenInc - 1; P[0].y := Height - PenInc - 1;
@ -120,10 +109,7 @@ begin
P[3].y := P[0].y; P[3].y := P[0].y;
Polygon(P); Polygon(P);
end; end;
end;
stTriangleLeft: stTriangleLeft:
begin
with Self do
begin begin
P[0].x := PenInc; P[0].x := PenInc;
P[0].y := Height div 2; P[0].y := Height div 2;
@ -135,10 +121,7 @@ begin
P[3].y := P[0].y; P[3].y := P[0].y;
Polygon(P); Polygon(P);
end; end;
end;
stTriangleRight: stTriangleRight:
begin
with Self do
begin begin
P[0].x := Width - PenInc - 1; P[0].x := Width - PenInc - 1;
P[0].y := Height div 2; P[0].y := Height div 2;
@ -150,11 +133,8 @@ begin
P[3].y := P[0].y; P[3].y := P[0].y;
Polygon(P); Polygon(P);
end; end;
end;
stStar, stStar,
stStarDown: stStarDown:
begin
with Self do
begin begin
//radius if star scaled by height //radius if star scaled by height
RadiusBig := Trunc((Height-Pen.Width) / (1+cos(pi/5))); RadiusBig := Trunc((Height-Pen.Width) / (1+cos(pi/5)));
@ -191,7 +171,6 @@ begin
end; end;
end; end;
end; end;
end;
// to fire OnPaint event // to fire OnPaint event
inherited Paint; inherited Paint;
end; end;