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);
dec(Right, constCellPadding);
case Canvas.TextStyle.Alignment of case Canvas.TextStyle.Alignment of
Classes.taLeftJustify: Inc(Left, constCellPadding); Classes.taLeftJustify: Inc(ARect.Left, constCellPadding);
Classes.taRightJustify: Dec(Right, 1); Classes.taRightJustify: Dec(ARect.Right, 1);
end; end;
case Canvas.TextStyle.Layout of case Canvas.TextStyle.Layout of
tlTop: Inc(Top, constCellPadding); tlTop: Inc(ARect.Top, constCellPadding);
tlBottom: Dec(Bottom, constCellPadding); tlBottom: Dec(ARect.Bottom, constCellPadding);
end; end;
if Right<Left then if ARect.Right<ARect.Left then
Right:=Left; ARect.Right:=ARect.Left;
if Left>Right then if ARect.Left>ARect.Right then
Left:=Right; ARect.Left:=ARect.Right;
if Bottom<Top then if ARect.Bottom<ARect.Top then
Bottom:=Top; ARect.Bottom:=ARect.Top;
if Top>Bottom then if ARect.Top>ARect.Bottom then
Top:=Bottom; ARect.Top:=ARect.Bottom;
if (Left<>Right) and (Top<>Bottom) then if (ARect.Left<>ARect.Right) and (ARect.Top<>ARect.Bottom) then
Canvas.TextRect(aRect,Left,Top, aText); Canvas.TextRect(aRect,ARect.Left,ARect.Top, aText);
end;
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: Left := Trunc((aRect.Left + aRect.Right - CSize.cx)/2); taCenter: PaintRect.Left := Trunc((aRect.Left + aRect.Right - CSize.cx)/2);
taLeftJustify: Left := ARect.Left + constCellPadding; taLeftJustify: PaintRect.Left := ARect.Left + constCellPadding;
taRightJustify: Left := ARect.Right - CSize.Cx - constCellPadding - 1; taRightJustify: PaintRect.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,26 +4986,22 @@ 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 (x>FixedCols)and(W+integer(PtrUInt(FGCache.AccumWidth[x]))>=ColWidths[x-1]) do while (FTopleft.x>FixedCols)and(W+integer(PtrUInt(FGCache.AccumWidth[FTopleft.x]))>=ColWidths[FTopleft.x-1]) do
begin begin
Dec(x); Dec(FTopleft.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 (y>FixedRows)and(W+integer(PtrUInt(FGCache.AccumHeight[y]))>=RowHeights[y-1]) do while (FTopleft.y>FixedRows)and(W+integer(PtrUInt(FGCache.AccumHeight[FTopleft.y]))>=RowHeights[FTopleft.y-1]) do
begin begin
Dec(y); Dec(FTopleft.y);
end; end;
//DebugLn('TCustomGrid.CheckTopLeft A ',DbgSName(Self),' FTopLeft=',dbgs(FTopLeft)); //DebugLn('TCustomGrid.CheckTopLeft A ',DbgSName(Self),' FTopLeft=',dbgs(FTopLeft));
end; end;
end;
Result := not PointIgual(OldTopleft,FTopLeft); Result := not PointIgual(OldTopleft,FTopLeft);
if Result then if Result then
@ -5309,9 +5298,8 @@ 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)
@ -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;