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,13 +1682,13 @@ 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;
begin begin
with FDatalink.DataSet do with FDatalink.DataSet do
Result := (State=dsInsert) and not (Modified or FDataLink.FModified); Result := (State=dsInsert) and not (Modified or FDataLink.FModified);
end; end;
procedure TCustomDBGrid.StartUpdating; procedure TCustomDBGrid.StartUpdating;

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

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

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 WriteB('newpath');
go with newpath for precision, does this violate any assumptions in code??? WriteB(Format(ellipsePath,[pp1.fx+r.fx,pp1.fy-r.fy,r.fx,r.fy,90,180],FFs));
write(format('%d %d moveto',[x1+rx, y1]),Lst # this also works} WriteB(Format(ellipsePath,[pp1.fx+r.fx,pp2.fy+r.fy,r.fx,r.fy,180,270],FFs));
with r do WriteB(Format(ellipsePath,[pp2.fx-r.fx,pp2.fy+r.fy,r.fx,r.fy,270,360],FFs));
begin WriteB(Format(ellipsePath,[pp2.fx-r.fx,pp1.fy-r.fy,r.fx,r.fy,0,90],FFs));
WriteB('newpath'); WriteB('closepath');
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;
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;