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 begin
inherited Create(AOwner); inherited Create(AOwner);
fCompStyle := csCalendar; fCompStyle := csCalendar;
with GetControlClassDefaultSize do SetInitialBounds(0, 0, GetControlClassDefaultSize.CX, GetControlClassDefaultSize.CY);
SetInitialBounds(0, 0, CX, CY);
FDisplaySettings := DefaultDisplaySettings; FDisplaySettings := DefaultDisplaySettings;
ControlStyle:=ControlStyle-[csTripleClicks,csQuadClicks,csAcceptsControls,csCaptureMouse]; ControlStyle:=ControlStyle-[csTripleClicks,csQuadClicks,csAcceptsControls,csCaptureMouse];
DateTime := Now; DateTime := Now;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -262,13 +262,10 @@ begin
if pen.style = psSolid then if pen.style = psSolid then
for r := 1 to pen.width do for r := 1 to pen.width do
begin begin
with b do CheckLine (b.left,b.top,b.left,b.bottom);
begin CheckLine (b.left,b.bottom,b.right,b.bottom);
CheckLine (left,top,left,bottom); CheckLine (b.right,b.bottom,b.right,b.top);
CheckLine (left,bottom,right,bottom); CheckLine (b.right,b.top,b.left,b.top);
CheckLine (right,bottom,right,top);
CheckLine (right,top,left,top);
end;
DecRect (b); DecRect (b);
end end
else if pen.style <> psClear then else if pen.style <> psClear then
@ -277,13 +274,10 @@ begin
pattern := Pen.pattern pattern := Pen.pattern
else else
pattern := PenPatterns[pen.style]; pattern := PenPatterns[pen.style];
with b do CheckPLine (b.left,b.top,b.left,b.bottom);
begin CheckPLine (b.left,b.bottom,b.right,b.bottom);
CheckPLine (left,top,left,bottom); CheckPLine (b.right,b.bottom,b.right,b.top);
CheckPLine (left,bottom,right,bottom); CheckPLine (b.right,b.top,b.left,b.top);
CheckPLine (right,bottom,right,top);
CheckPLine (right,top,left,top);
end;
end; end;
end; end;
@ -303,18 +297,15 @@ begin
Exit; Exit;
end; end;
// if clipping then
// CheckRectClipping (ClipRect, B);
with b do
case Brush.style of case Brush.style of
bsSolid : FillRectangleColor (self, left,top, right,bottom); bsSolid : FillRectangleColor (self, b.left,b.top, b.right,b.bottom);
bsPattern : FillRectanglePattern (self, left,top, right,bottom, brush.pattern); bsPattern : FillRectanglePattern (self, b.left,b.top, b.right,b.bottom, brush.pattern);
bsImage : bsImage :
if assigned (brush.image) then if assigned (brush.image) then
if RelativeBrushImage then if RelativeBrushImage then
FillRectangleImageRel (self, left,top, right,bottom, brush.image) FillRectangleImageRel (self, b.left,b.top, b.right,b.bottom, brush.image)
else else
FillRectangleImage (self, left,top, right,bottom, brush.image) FillRectangleImage (self, b.left,b.top, b.right,b.bottom, brush.image)
else else
raise PixelCanvasException.Create (sErrNoImage); raise PixelCanvasException.Create (sErrNoImage);
bsBDiagonal : FillRectangleHashDiagonal (self, b, HashWidth); bsBDiagonal : FillRectangleHashDiagonal (self, b, HashWidth);

View File

@ -1113,8 +1113,7 @@ begin
Self.WriteComment('Pushing and Setting current clip rect'); Self.WriteComment('Pushing and Setting current clip rect');
Self.Write('clipsave'); Self.Write('clipsave');
B := TxRectToBounds(FLazClipRect); B := TxRectToBounds(FLazClipRect);
with B do Write(Format('%f %f %f %f rectclip',[B.fx, B.fy, B.fwidth, B.fheight],FFs));
Self.Write(Format('%f %f %f %f rectclip',[fx, fy, fwidth, fheight],FFs));
Include(FStatus, pcsClipSaved); Include(FStatus, pcsClipSaved);
end; end;
@ -1820,18 +1819,12 @@ begin
ellipsePath:='matrix currentmatrix %f %f translate %f %f scale 0 0 1 %d %d arc setmatrix'; ellipsePath:='matrix currentmatrix %f %f translate %f %f scale 0 0 1 %d %d arc setmatrix';
PixelsToPoints(RX,RY,r.fx,r.fy); 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('newpath');
WriteB(Format(ellipsePath,[pp1.fx+fx,pp1.fy-fy,fx,fy,90,180],FFs)); WriteB(Format(ellipsePath,[pp1.fx+r.fx,pp1.fy-r.fy,r.fx,r.fy,90,180],FFs));
WriteB(Format(ellipsePath,[pp1.fx+fx,pp2.fy+fy,fx,fy,180,270],FFs)); WriteB(Format(ellipsePath,[pp1.fx+r.fx,pp2.fy+r.fy,r.fx,r.fy,180,270],FFs));
WriteB(Format(ellipsePath,[pp2.fx-fx,pp2.fy+fy,fx,fy,270,360],FFs)); WriteB(Format(ellipsePath,[pp2.fx-r.fx,pp2.fy+r.fy,r.fx,r.fy,270,360],FFs));
WriteB(Format(ellipsePath,[pp2.fx-fx,pp1.fy-fy,fx,fy,0,90],FFs)); WriteB(Format(ellipsePath,[pp2.fx-r.fx,pp1.fy-r.fy,r.fx,r.fy,0,90],FFs));
WriteB('closepath'); WriteB('closepath');
end;
SetBrushFillPattern(True,True); SetBrushFillPattern(True,True);

View File

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