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

git-svn-id: trunk@50253 -
This commit is contained in:
mattias 2015-11-08 10:30:24 +00:00
parent 9d4bc5783d
commit 12697b9fd7

View File

@ -3806,15 +3806,13 @@ var
begin begin
if InternalNeedBorder then begin if InternalNeedBorder then begin
R := Rect(0,0,ClientWidth-1, Clientheight-1); R := Rect(0,0,ClientWidth-1, Clientheight-1);
with R, Canvas do begin Canvas.Pen.Color := fBorderColor;
Pen.Color := fBorderColor; Canvas.Pen.Width := 1;
Pen.Width := 1; Canvas.MoveTo(0,0);
MoveTo(0,0); Canvas.LineTo(0,R.Bottom);
LineTo(0,Bottom); Canvas.LineTo(R.Right, R.Bottom);
LineTo(Right, Bottom); Canvas.LineTo(R.Right, 0);
LineTo(Right, 0); Canvas.LineTo(0,0);
LineTo(0,0);
end;
end; end;
end; end;
@ -4215,30 +4213,27 @@ end;
procedure TCustomGrid.DrawCellText(aCol, aRow: Integer; aRect: TRect; procedure TCustomGrid.DrawCellText(aCol, aRow: Integer; aRect: TRect;
aState: TGridDrawState; aText: String); aState: TGridDrawState; aText: String);
begin begin
with ARect do begin dec(ARect.Right, constCellPadding);
case Canvas.TextStyle.Alignment of
dec(Right, constCellPadding); Classes.taLeftJustify: Inc(ARect.Left, constCellPadding);
case Canvas.TextStyle.Alignment of Classes.taRightJustify: Dec(ARect.Right, 1);
Classes.taLeftJustify: Inc(Left, constCellPadding);
Classes.taRightJustify: Dec(Right, 1);
end;
case Canvas.TextStyle.Layout of
tlTop: Inc(Top, constCellPadding);
tlBottom: Dec(Bottom, constCellPadding);
end;
if Right<Left then
Right:=Left;
if Left>Right then
Left:=Right;
if Bottom<Top then
Bottom:=Top;
if Top>Bottom then
Top:=Bottom;
if (Left<>Right) and (Top<>Bottom) then
Canvas.TextRect(aRect,Left,Top, aText);
end; end;
case Canvas.TextStyle.Layout of
tlTop: Inc(ARect.Top, constCellPadding);
tlBottom: Dec(ARect.Bottom, constCellPadding);
end;
if ARect.Right<ARect.Left then
ARect.Right:=ARect.Left;
if ARect.Left>ARect.Right then
ARect.Left:=ARect.Right;
if ARect.Bottom<ARect.Top then
ARect.Bottom:=ARect.Top;
if ARect.Top>ARect.Bottom then
ARect.Top:=ARect.Bottom;
if (ARect.Left<>ARect.Right) and (ARect.Top<>ARect.Bottom) then
Canvas.TextRect(aRect,ARect.Left,ARect.Top, aText);
end; end;
procedure TCustomGrid.DrawGridCheckboxBitmaps(const aCol,aRow: Integer; procedure TCustomGrid.DrawGridCheckboxBitmaps(const aCol,aRow: Integer;
@ -4263,15 +4258,13 @@ begin
if (TitleStyle=tsNative) and not assigned(OnUserCheckboxBitmap) then begin if (TitleStyle=tsNative) and not assigned(OnUserCheckboxBitmap) then begin
Details := ThemeServices.GetElementDetails(arrtb[AState]); Details := ThemeServices.GetElementDetails(arrtb[AState]);
CSize := ThemeServices.GetDetailSize(Details); CSize := ThemeServices.GetDetailSize(Details);
with PaintRect do begin case bmpAlign of
case bmpAlign of taCenter: PaintRect.Left := Trunc((aRect.Left + aRect.Right - CSize.cx)/2);
taCenter: Left := Trunc((aRect.Left + aRect.Right - CSize.cx)/2); taLeftJustify: PaintRect.Left := ARect.Left + constCellPadding;
taLeftJustify: Left := ARect.Left + constCellPadding; taRightJustify: PaintRect.Left := ARect.Right - CSize.Cx - constCellPadding - 1;
taRightJustify: Left := ARect.Right - CSize.Cx - constCellPadding - 1;
end;
Top := Trunc((aRect.Top + aRect.Bottom - CSize.cy)/2);
PaintRect := Bounds(Left, Top, CSize.cx, CSize.cy);
end; end;
PaintRect.Top := Trunc((aRect.Top + aRect.Bottom - CSize.cy)/2);
PaintRect := Bounds(PaintRect.Left, PaintRect.Top, CSize.cx, CSize.cy);
ThemeServices.DrawElement(Canvas.Handle, Details, PaintRect, nil); ThemeServices.DrawElement(Canvas.Handle, Details, PaintRect, nil);
end else begin end else begin
ChkBitmap := GetImageForCheckBox(aCol, aRow, AState); ChkBitmap := GetImageForCheckBox(aCol, aRow, AState);
@ -4993,25 +4986,21 @@ begin
OldTopLeft := FTopLeft; OldTopLeft := FTopLeft;
Result:= False; Result:= False;
with FTopleft do begin if CheckCols and (FTopleft.X>FixedCols) then begin
if CheckCols and (X>FixedCols) then begin W := FGCache.ScrollWidth-ColWidths[aCol]-integer(PtrUInt(FGCache.AccumWidth[aCol]));
W := FGCache.ScrollWidth-ColWidths[aCol]-integer(PtrUInt(FGCache.AccumWidth[aCol])); while (FTopleft.x>FixedCols)and(W+integer(PtrUInt(FGCache.AccumWidth[FTopleft.x]))>=ColWidths[FTopleft.x-1]) do
while (x>FixedCols)and(W+integer(PtrUInt(FGCache.AccumWidth[x]))>=ColWidths[x-1]) do begin
begin Dec(FTopleft.x);
Dec(x);
end;
end; end;
end; end;
with FTopleft do begin if CheckRows and (FTopleft.Y > FixedRows) then begin
if CheckRows and (Y > FixedRows) then begin W := FGCache.ScrollHeight-RowHeights[aRow]-integer(PtrUInt(FGCache.AccumHeight[aRow]));
W := FGCache.ScrollHeight-RowHeights[aRow]-integer(PtrUInt(FGCache.AccumHeight[aRow])); while (FTopleft.y>FixedRows)and(W+integer(PtrUInt(FGCache.AccumHeight[FTopleft.y]))>=RowHeights[FTopleft.y-1]) do
while (y>FixedRows)and(W+integer(PtrUInt(FGCache.AccumHeight[y]))>=RowHeights[y-1]) do begin
begin Dec(FTopleft.y);
Dec(y);
end;
//DebugLn('TCustomGrid.CheckTopLeft A ',DbgSName(Self),' FTopLeft=',dbgs(FTopLeft));
end; end;
//DebugLn('TCustomGrid.CheckTopLeft A ',DbgSName(Self),' FTopLeft=',dbgs(FTopLeft));
end; end;
Result := not PointIgual(OldTopleft,FTopLeft); Result := not PointIgual(OldTopleft,FTopLeft);
@ -5309,15 +5298,14 @@ end;
procedure TCustomGrid.CancelSelection; procedure TCustomGrid.CancelSelection;
begin begin
with FRange do if (FRange.Bottom-FRange.Top>0) or
if (Bottom-Top>0) or ((FRange.Right-FRange.Left>0) and not (goRowSelect in Options)) then begin
((Right-Left>0) and not (goRowSelect in Options)) then begin InvalidateRange(FRange);
InvalidateRange(FRange); if goRowSelect in Options then
if goRowSelect in Options then FRange:=Rect(FFixedCols, FRow, ColCount-1, FRow)
FRange:=Rect(FFixedCols, FRow, ColCount-1, FRow) else
else FRange:=Rect(FCol,FRow,FCol,FRow);
FRange:=Rect(FCol,FRow,FCol,FRow); end;
end;
SelectActive := False; SelectActive := False;
end; end;
@ -5372,8 +5360,8 @@ end;
procedure TCustomGrid.SetSelection(const AValue: TGridRect); procedure TCustomGrid.SetSelection(const AValue: TGridRect);
begin begin
if goRangeSelect in Options then if goRangeSelect in Options then
with AValue do begin begin
if (Left<0)and(Top<0)and(Right<0)and(Bottom<0) then if (AValue.Left<0)and(AValue.Top<0)and(AValue.Right<0)and(AValue.Bottom<0) then
CancelSelection CancelSelection
else begin else begin
fRange:=NormalizarRect(aValue); fRange:=NormalizarRect(aValue);
@ -5397,11 +5385,9 @@ var
procedure FindPrevColumn; procedure FindPrevColumn;
begin begin
with FSizing do begin Dec(FSizing.Index);
Dec(Index); while (FSizing.Index>FixedCols) and (ColWidths[FSizing.Index]=0) do
while (Index>FixedCols) and (ColWidths[Index]=0) do Dec(FSizing.Index);
Dec(Index);
end;
end; end;
begin begin
@ -7579,8 +7565,7 @@ begin
SwapInt(ATop, ABottom); SwapInt(ATop, ABottom);
Result := CellRect(ALeft, ATop); Result := CellRect(ALeft, ATop);
with CellRect(ARight, ABottom) do Result.BottomRight := CellRect(ARight, ABottom).BottomRight;
Result.BottomRight := BottomRight;
IntersectRect(Result, Result, FGCache.VisibleGrid); IntersectRect(Result, Result, FGCache.VisibleGrid);
end; end;