LCL: exploded some With-blocks for fpc 3.1.1

git-svn-id: trunk@50237 -
This commit is contained in:
mattias 2015-11-06 18:35:28 +00:00
parent f088a0bc08
commit 89190707c1
9 changed files with 75 additions and 97 deletions

View File

@ -159,8 +159,7 @@ constructor TCustomCalendar.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
fCompStyle := csCalendar;
with GetControlClassDefaultSize do
SetInitialBounds(0, 0, CX, CY);
SetInitialBounds(0, 0, GetControlClassDefaultSize.CX, GetControlClassDefaultSize.CY);
FDisplaySettings := DefaultDisplaySettings;
ControlStyle:=ControlStyle-[csTripleClicks,csQuadClicks,csAcceptsControls,csCaptureMouse];
DateTime := Now;

View File

@ -1674,9 +1674,7 @@ begin
{$ifdef dbgDBGrid}
DebugLn('%s.IsEOF', [ClassName]);
{$endif}
with FDatalink do
result :=
Active and DataSet.EOF;
Result := FDatalink.Active and FDatalink.DataSet.EOF;
end;
function TCustomDBGrid.ValidDataSet: boolean;
@ -1684,13 +1682,13 @@ begin
{$ifdef dbgDBGrid}
DebugLn('%s.ValidDataSet', [ClassName]);
{$endif}
result := FDatalink.Active And (FDatalink.DataSet<>nil)
Result := FDatalink.Active And (FDatalink.DataSet<>nil)
end;
function TCustomDBGrid.InsertCancelable: boolean;
begin
with FDatalink.DataSet do
Result := (State=dsInsert) and not (Modified or FDataLink.FModified);
Result := (State=dsInsert) and not (Modified or FDataLink.FModified);
end;
procedure TCustomDBGrid.StartUpdating;

View File

@ -1944,8 +1944,7 @@ begin
TabStop := True;
FocusOnButtonClick := False;
with GetControlClassDefaultSize do
SetInitialBounds(0, 0, CX, CY);
SetInitialBounds(0, 0, GetControlClassDefaultSize.CX, GetControlClassDefaultSize.CY);
with FButton do
begin

View File

@ -266,8 +266,7 @@ constructor TPreviewFileControl.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
FCompStyle:=csPreviewFileControl;
with GetControlClassDefaultSize do
SetInitialBounds(0, 0, CX, CY);
SetInitialBounds(0, 0, GetControlClassDefaultSize.CX, GetControlClassDefaultSize.CY);
end;
{ TPreviewFileDialog }

View File

@ -268,10 +268,8 @@ end;
Operator := (Value : TFloatPoint) : TPoint;
begin
With Result do begin
X := Trunc(SimpleRoundTo(Value.X, 0));
Y := Trunc(SimpleRoundTo(Value.Y, 0));
end;
Result.X := Trunc(SimpleRoundTo(Value.X, 0));
Result.Y := Trunc(SimpleRoundTo(Value.Y, 0));
end;
Operator := (Value : TPoint) : TFloatPoint;

View File

@ -30,8 +30,7 @@ constructor TIndustrialBase.Create(aOwner: TComponent);
begin
inherited Create(aOwner);
FAntiAliasingMode := amDontCare;
with GetControlClassDefaultSize do
SetInitialBounds(0, 0, cx, cy);
SetInitialBounds(0, 0, GetControlClassDefaultSize.cx, GetControlClassDefaultSize.cy);
ControlStyle := ControlStyle - [csSetCaption];
end;

View File

@ -261,30 +261,24 @@ begin
b.bottom := b.bottom-1;
if pen.style = psSolid then
for r := 1 to pen.width do
begin
with b do
begin
CheckLine (left,top,left,bottom);
CheckLine (left,bottom,right,bottom);
CheckLine (right,bottom,right,top);
CheckLine (right,top,left,top);
end;
DecRect (b);
end
else if pen.style <> psClear then
begin
CheckLine (b.left,b.top,b.left,b.bottom);
CheckLine (b.left,b.bottom,b.right,b.bottom);
CheckLine (b.right,b.bottom,b.right,b.top);
CheckLine (b.right,b.top,b.left,b.top);
DecRect (b);
end
else if pen.style <> psClear then
begin
if pen.style = psPattern then
pattern := Pen.pattern
else
pattern := PenPatterns[pen.style];
with b do
begin
CheckPLine (left,top,left,bottom);
CheckPLine (left,bottom,right,bottom);
CheckPLine (right,bottom,right,top);
CheckPLine (right,top,left,top);
end;
end;
CheckPLine (b.left,b.top,b.left,b.bottom);
CheckPLine (b.left,b.bottom,b.right,b.bottom);
CheckPLine (b.right,b.bottom,b.right,b.top);
CheckPLine (b.right,b.top,b.left,b.top);
end;
end;
procedure TLazCanvas.DoRectangleFill(const Bounds: TRect);
@ -303,35 +297,32 @@ begin
Exit;
end;
// if clipping then
// CheckRectClipping (ClipRect, B);
with b do
case Brush.style of
bsSolid : FillRectangleColor (self, left,top, right,bottom);
bsPattern : FillRectanglePattern (self, left,top, right,bottom, brush.pattern);
bsImage :
if assigned (brush.image) then
if RelativeBrushImage then
FillRectangleImageRel (self, left,top, right,bottom, brush.image)
else
FillRectangleImage (self, left,top, right,bottom, brush.image)
case Brush.style of
bsSolid : FillRectangleColor (self, b.left,b.top, b.right,b.bottom);
bsPattern : FillRectanglePattern (self, b.left,b.top, b.right,b.bottom, brush.pattern);
bsImage :
if assigned (brush.image) then
if RelativeBrushImage then
FillRectangleImageRel (self, b.left,b.top, b.right,b.bottom, brush.image)
else
raise PixelCanvasException.Create (sErrNoImage);
bsBDiagonal : FillRectangleHashDiagonal (self, b, HashWidth);
bsFDiagonal : FillRectangleHashBackDiagonal (self, b, HashWidth);
bsCross :
begin
FillRectangleHashHorizontal (self, b, HashWidth);
FillRectangleHashVertical (self, b, HashWidth);
end;
bsDiagCross :
begin
FillRectangleHashDiagonal (self, b, HashWidth);
FillRectangleHashBackDiagonal (self, b, HashWidth);
end;
bsHorizontal : FillRectangleHashHorizontal (self, b, HashWidth);
bsVertical : FillRectangleHashVertical (self, b, HashWidth);
end;
FillRectangleImage (self, b.left,b.top, b.right,b.bottom, brush.image)
else
raise PixelCanvasException.Create (sErrNoImage);
bsBDiagonal : FillRectangleHashDiagonal (self, b, HashWidth);
bsFDiagonal : FillRectangleHashBackDiagonal (self, b, HashWidth);
bsCross :
begin
FillRectangleHashHorizontal (self, b, HashWidth);
FillRectangleHashVertical (self, b, HashWidth);
end;
bsDiagCross :
begin
FillRectangleHashDiagonal (self, b, HashWidth);
FillRectangleHashBackDiagonal (self, b, HashWidth);
end;
bsHorizontal : FillRectangleHashHorizontal (self, b, HashWidth);
bsVertical : FillRectangleHashVertical (self, b, HashWidth);
end;
end;
// unimplemented in FPC

View File

@ -1113,8 +1113,7 @@ begin
Self.WriteComment('Pushing and Setting current clip rect');
Self.Write('clipsave');
B := TxRectToBounds(FLazClipRect);
with B do
Self.Write(Format('%f %f %f %f rectclip',[fx, fy, fwidth, fheight],FFs));
Write(Format('%f %f %f %f rectclip',[B.fx, B.fy, B.fwidth, B.fheight],FFs));
Include(FStatus, pcsClipSaved);
end;
@ -1820,18 +1819,12 @@ begin
ellipsePath:='matrix currentmatrix %f %f translate %f %f scale 0 0 1 %d %d arc setmatrix';
PixelsToPoints(RX,RY,r.fx,r.fy);
{choice between newpath and moveto beginning of arc
go with newpath for precision, does this violate any assumptions in code???
write(format('%d %d moveto',[x1+rx, y1]),Lst # this also works}
with r do
begin
WriteB('newpath');
WriteB(Format(ellipsePath,[pp1.fx+fx,pp1.fy-fy,fx,fy,90,180],FFs));
WriteB(Format(ellipsePath,[pp1.fx+fx,pp2.fy+fy,fx,fy,180,270],FFs));
WriteB(Format(ellipsePath,[pp2.fx-fx,pp2.fy+fy,fx,fy,270,360],FFs));
WriteB(Format(ellipsePath,[pp2.fx-fx,pp1.fy-fy,fx,fy,0,90],FFs));
WriteB('closepath');
end;
WriteB('newpath');
WriteB(Format(ellipsePath,[pp1.fx+r.fx,pp1.fy-r.fy,r.fx,r.fy,90,180],FFs));
WriteB(Format(ellipsePath,[pp1.fx+r.fx,pp2.fy+r.fy,r.fx,r.fy,180,270],FFs));
WriteB(Format(ellipsePath,[pp2.fx-r.fx,pp2.fy+r.fy,r.fx,r.fy,270,360],FFs));
WriteB(Format(ellipsePath,[pp2.fx-r.fx,pp1.fy-r.fy,r.fx,r.fy,0,90],FFs));
WriteB('closepath');
SetBrushFillPattern(True,True);

View File

@ -1011,28 +1011,28 @@ end;
function TPaperSize.GetDefaultPaperRect(const AName: string;
var APaperRect:TPaperRect): Integer;
var
PR: TPaperRect;
begin
Result := IndexOfDefaultPaper(AName);
if Result>=0 then
with FInternalPapers[Result].PaperRect do begin
if FOwnedPrinter.Orientation in [poPortrait, poReversePortrait] then
begin
APaperRect.PhysicalRect := PhysicalRect;
APaperRect.WorkRect := WorkRect;
end else
begin
APaperRect.PhysicalRect.Left := 0;
APaperRect.PhysicalRect.Top := 0;
APaperRect.PhysicalRect.Right := PhysicalRect.Bottom;
APaperRect.Physicalrect.Bottom := PhysicalRect.Right;
PR:=FInternalPapers[Result].PaperRect;
if FOwnedPrinter.Orientation in [poPortrait, poReversePortrait] then
begin
APaperRect.PhysicalRect := PR.PhysicalRect;
APaperRect.WorkRect := PR.WorkRect;
end else
begin
APaperRect.PhysicalRect.Left := 0;
APaperRect.PhysicalRect.Top := 0;
APaperRect.PhysicalRect.Right := PR.PhysicalRect.Bottom;
APaperRect.Physicalrect.Bottom := PR.PhysicalRect.Right;
APaperRect.WorkRect.Left := WorkRect.Top;
APaperRect.WorkRect.Top := PhysicalRect.Right-WorkRect.Right;
APaperRect.WorkRect.Right := WorkRect.Bottom;
APaperRect.WorkRect.Bottom := PhysicalRect.Right-Workrect.Left;
end;
APaperRect.WorkRect.Left := PR.WorkRect.Top;
APaperRect.WorkRect.Top := PR.PhysicalRect.Right-PR.WorkRect.Right;
APaperRect.WorkRect.Right := PR.WorkRect.Bottom;
APaperRect.WorkRect.Bottom := PR.PhysicalRect.Right-PR.Workrect.Left;
end;
end;
function TPaperSize.GetPhysPaperHeight: Integer;
@ -1335,11 +1335,13 @@ begin
end;
function TPrinterCanvas.GetRightMargin: Integer;
var
PR: TPaperRect;
begin
if (fRightMargin=0) and (fPrinter<>nil) then
begin
with fPrinter.Papersize.PaperRect do
Result := PhysicalRect.Right-WorkRect.Right;
PR:=fPrinter.Papersize.PaperRect;
Result := PR.PhysicalRect.Right-PR.WorkRect.Right;
end else
Result := fRightMargin;
end;