Reduce compiler warnings.

(cherry picked from commit c3891ad820)
This commit is contained in:
Juha 2023-07-02 12:45:55 +03:00 committed by Maxim Ganetsky
parent 7a3caa746f
commit 0bc8523ddf
52 changed files with 176 additions and 171 deletions

View File

@ -1262,11 +1262,11 @@ begin
// Move to visible area : // Move to visible area :
// window is out at left side of screen // window is out at left side of screen
if NewBounds.Right < Screen.DesktopLeft + 60 then if NewBounds.Right < Screen.DesktopLeft + 60 then
OffsetRect(NewBounds, Screen.DesktopLeft + 60 - NewBounds.Right, 0); Types.OffsetRect(NewBounds, Screen.DesktopLeft + 60 - NewBounds.Right, 0);
// window is out above the screen // window is out above the screen
if NewBounds.Bottom < Screen.DesktopTop+60 then if NewBounds.Bottom < Screen.DesktopTop+60 then
OffsetRect(NewBounds, 0, Screen.DesktopTop + 60 - NewBounds.Bottom); Types.OffsetRect(NewBounds, 0, Screen.DesktopTop + 60 - NewBounds.Bottom);
// window is out at right side of screen, i = right edge of screen - 60 // window is out at right side of screen, i = right edge of screen - 60
i := Screen.DesktopWidth + Screen.DesktopLeft - 60; i := Screen.DesktopWidth + Screen.DesktopLeft - 60;
@ -1739,32 +1739,32 @@ begin
if DockSibling.Parent<>nil then if DockSibling.Parent<>nil then
begin begin
Offset:=DockSibling.ClientToScreen(Point(0,0)); Offset:=DockSibling.ClientToScreen(Point(0,0));
OffsetRect(DockSiblingBounds,Offset.X,Offset.Y); Types.OffsetRect(DockSiblingBounds,Offset.X,Offset.Y);
end; end;
case DockAlign of case DockAlign of
alLeft: alLeft:
begin begin
NewBounds.Top:=DockSiblingBounds.Top; NewBounds.Top:=DockSiblingBounds.Top;
NewBounds.Bottom:=DockSiblingBounds.Bottom; NewBounds.Bottom:=DockSiblingBounds.Bottom;
OffsetRect(NewBounds,DockSiblingBounds.Left-6-NewBounds.Right,0); Types.OffsetRect(NewBounds,DockSiblingBounds.Left-6-NewBounds.Right,0);
end; end;
alRight: alRight:
begin begin
NewBounds.Top:=DockSiblingBounds.Top; NewBounds.Top:=DockSiblingBounds.Top;
NewBounds.Bottom:=DockSiblingBounds.Bottom; NewBounds.Bottom:=DockSiblingBounds.Bottom;
OffsetRect(NewBounds,DockSiblingBounds.Right+6-NewBounds.Left,0); Types.OffsetRect(NewBounds,DockSiblingBounds.Right+6-NewBounds.Left,0);
end; end;
alTop: alTop:
begin begin
NewBounds.Left:=DockSiblingBounds.Left; NewBounds.Left:=DockSiblingBounds.Left;
NewBounds.Right:=DockSiblingBounds.Right; NewBounds.Right:=DockSiblingBounds.Right;
OffsetRect(NewBounds,0,DockSiblingBounds.Top-25-NewBounds.Bottom); Types.OffsetRect(NewBounds,0,DockSiblingBounds.Top-25-NewBounds.Bottom);
end; end;
alBottom: alBottom:
begin begin
NewBounds.Left:=DockSiblingBounds.Left; NewBounds.Left:=DockSiblingBounds.Left;
NewBounds.Right:=DockSiblingBounds.Right; NewBounds.Right:=DockSiblingBounds.Right;
OffsetRect(NewBounds,0,DockSiblingBounds.Bottom+25-NewBounds.Top); Types.OffsetRect(NewBounds,0,DockSiblingBounds.Bottom+25-NewBounds.Top);
end; end;
alClient: alClient:
NewBounds:=DockSibling.BoundsRect; NewBounds:=DockSibling.BoundsRect;

View File

@ -5799,7 +5799,7 @@ begin
w1 := r.Right - r.Left; w1 := r.Right - r.Left;
h1 := r.Bottom - r.Top; h1 := r.Bottom - r.Top;
if (Flags and flPictCenter) <> 0 then if (Flags and flPictCenter) <> 0 then
OffsetRect(r, (w - w1) div 2, (h - h1) div 2); Types.OffsetRect(r, (w - w1) div 2, (h - h1) div 2);
end; end;
{$IFDEF LCLNOGUI} {$IFDEF LCLNOGUI}
bmp := TLazreportBitmap.create; bmp := TLazreportBitmap.create;
@ -5815,7 +5815,7 @@ begin
PictureWidth := Round(Picture.Width * ScaleX); PictureWidth := Round(Picture.Width * ScaleX);
PictureHeight := Round(Picture.Height * ScaleY); PictureHeight := Round(Picture.Height * ScaleY);
if (Flags and flPictCenter) <> 0 then if (Flags and flPictCenter) <> 0 then
OffsetRect(r, (w - PictureWidth) div 2, (h - PictureHeight) div 2); Types.OffsetRect(r, (w - PictureWidth) div 2, (h - PictureHeight) div 2);
{$IFDEF LCLNOGUI} {$IFDEF LCLNOGUI}
bmp := TLazreportBitmap.create; bmp := TLazreportBitmap.create;
bmp.LoadFromGraphic(Picture.Graphic); bmp.LoadFromGraphic(Picture.Graphic);

View File

@ -2700,7 +2700,7 @@ begin
begin begin
NPEraseFocusRect; NPEraseFocusRect;
RoundCoord(x, y); RoundCoord(x, y);
OffsetRect(OldRect, x - OldRect.Left, y - OldRect.Top); Types.OffsetRect(OldRect, x - OldRect.Left, y - OldRect.Top);
NPDrawFocusRect; NPDrawFocusRect;
ShowSizes := True; ShowSizes := True;
FDesigner.UpdateStatus; FDesigner.UpdateStatus;
@ -3288,7 +3288,7 @@ begin
if (Mode = mdInsert) and not Down then if (Mode = mdInsert) and not Down then
begin begin
NPEraseFocusRect; NPEraseFocusRect;
OffsetRect(OldRect, -10000, -10000); Types.OffsetRect(OldRect, -10000, -10000);
end; end;
fGuides.HideGuides; fGuides.HideGuides;
end; end;
@ -7192,10 +7192,10 @@ begin
begin begin
if not Selected then if not Selected then
begin begin
OffsetRect(Rect, 1, 1); Types.OffsetRect(Rect, 1, 1);
Font.Color := clBtnHighlight; Font.Color := clBtnHighlight;
DrawText(Handle, PChar(Caption), Length(Caption), Rect, Flags); DrawText(Handle, PChar(Caption), Length(Caption), Rect, Flags);
OffsetRect(Rect, -1, -1); Types.OffsetRect(Rect, -1, -1);
end; end;
Font.Color := clBtnShadow; Font.Color := clBtnShadow;
end; end;
@ -7262,7 +7262,7 @@ begin
if AMenuItem.Caption <> '-' then if AMenuItem.Caption <> '-' then
begin begin
OffsetRect(ARect, 0, 2); Types.OffsetRect(ARect, 0, 2);
DoDrawText(ACanvas, AMenuItem.Caption, ARect, Selected, AMenuItem.Enabled, DT_LEFT); DoDrawText(ACanvas, AMenuItem.Caption, ARect, Selected, AMenuItem.Enabled, DT_LEFT);
if AMenuItem.ShortCut <> 0 then if AMenuItem.ShortCut <> 0 then
begin begin

View File

@ -105,7 +105,7 @@ begin
r.Right := r.Left + 18; r.Right := r.Left + 18;
r.Bottom := r.Top + 16; r.Bottom := r.Top + 16;
OffsetRect(r, 2, (ARect.Bottom - ARect.Top) div 2 - 8); Types.OffsetRect(r, 2, (ARect.Bottom - ARect.Top) div 2 - 8);
with CB1.Canvas do with CB1.Canvas do
begin begin

View File

@ -475,7 +475,7 @@ begin
for i := 0 to Pages.Count - 1 do // drawing window background for i := 0 to Pages.Count - 1 do // drawing window background
begin begin
r := Pages[i]^.r; r := Pages[i]^.r;
OffsetRect(r, Preview.ofx, Preview.ofy); Types.OffsetRect(r, Preview.ofx, Preview.ofy);
if (r.Top > 2000) or (r.Bottom < 0) then if (r.Top > 2000) or (r.Bottom < 0) then
Pages[i]^.Visible := False else Pages[i]^.Visible := False else
Pages[i]^.Visible := RectVisible(Canvas.Handle, r); Pages[i]^.Visible := RectVisible(Canvas.Handle, r);
@ -499,7 +499,7 @@ begin
if Pages[i]^.Visible then if Pages[i]^.Visible then
begin begin
r := Pages[i]^.r; r := Pages[i]^.r;
OffsetRect(r, Preview.ofx, Preview.ofy); Types.OffsetRect(r, Preview.ofx, Preview.ofy);
Canvas.Rectangle(r.Left, r.Top, r.Right, r.Bottom); Canvas.Rectangle(r.Left, r.Top, r.Right, r.Bottom);
Canvas.Polyline([Point(r.Left + 1, r.Bottom), Canvas.Polyline([Point(r.Left + 1, r.Bottom),
Point(r.Right, r.Bottom), Point(r.Right, r.Bottom),
@ -511,7 +511,7 @@ begin
if Pages[i]^.Visible then if Pages[i]^.Visible then
begin begin
r := Pages[i]^.r; r := Pages[i]^.r;
OffsetRect(r, Preview.ofx, Preview.ofy); Types.OffsetRect(r, Preview.ofx, Preview.ofy);
if Pages[i]^.pgMargins then if Pages[i]^.pgMargins then
Pages.Draw(i, Canvas, r) Pages.Draw(i, Canvas, r)
else else

View File

@ -432,15 +432,13 @@ function ExecBasicHandler({%H-}Caller: TPSExec; p: TPSExternalProcRec;
ASyn := TSynEdit(o); ASyn := TSynEdit(o);
end; end;
var var
res: PPSVariant;
data: PPoint; data: PPoint;
temp: TPSVariantIFC; temp: TPSVariantIFC;
s: String; s: String;
typerec: TPSTypeRec;
Obj: TSynEdit; Obj: TSynEdit;
begin begin
Result := True; Result := True;
case Longint(p.Ext1) of case PtrUInt(p.Ext1) of
FunctionId_POINT: begin // POINT() FunctionId_POINT: begin // POINT()
CheckMinParamCount(3, 'Point'); CheckMinParamCount(3, 'Point');
data := GetVarPointFromStack(Stack, -1); data := GetVarPointFromStack(Stack, -1);

View File

@ -240,7 +240,7 @@ var
s: TbtString; s: TbtString;
begin begin
Result := True; Result := True;
case Longint(p.Ext1) of case PtrUInt(p.Ext1) of
Id_test_ord_mb: begin // test_ord_mb(ABtn: TMsgDlgBtn): Integer; Id_test_ord_mb: begin // test_ord_mb(ABtn: TMsgDlgBtn): Integer;
if Stack.Count < 2 then raise TEMScriptBadParamException.Create('Invalid param count for "test_ord_mb"'); if Stack.Count < 2 then raise TEMScriptBadParamException.Create('Invalid param count for "test_ord_mb"');
Stack.SetInt(-1, test_ord_mb(TMsgDlgBtn(Stack.GetUInt(-2))) ); Stack.SetInt(-1, test_ord_mb(TMsgDlgBtn(Stack.GetUInt(-2))) );

View File

@ -193,7 +193,7 @@ type
procedure RebuildGridLayout; virtual; procedure RebuildGridLayout; virtual;
procedure AddHeaderPropertyEditor(Prop: TPropertyEditor); procedure AddHeaderPropertyEditor(Prop: TPropertyEditor);
procedure BeforeMoveSelection(const DCol,DRow: Integer); override; procedure BeforeMoveSelection(const DCol,DRow: Integer); override;
procedure CalcCellExtent(aCol, aRow: Integer; var aRect: TRect); virtual; procedure CalcCellExtent(aCol, aRow: Integer; var aRect: TRect); override;
procedure DoEditorHide; override; procedure DoEditorHide; override;
procedure DoEditorShow; override; procedure DoEditorShow; override;
procedure DrawCell(aCol, aRow: Integer; aRect: TRect; procedure DrawCell(aCol, aRow: Integer; aRect: TRect;

View File

@ -5406,7 +5406,7 @@ begin
pt := ClientToScreen(Point(ClientWidth-ScrollBarWidth - rc.Right - 4, 10)); pt := ClientToScreen(Point(ClientWidth-ScrollBarWidth - rc.Right - 4, 10));
if eoScrollHintFollows in fOptions then if eoScrollHintFollows in fOptions then
pt.y := Mouse.CursorPos.y - (rc.Bottom div 2); pt.y := Mouse.CursorPos.y - (rc.Bottom div 2);
OffsetRect(rc, pt.x, pt.y); Types.OffsetRect(rc, pt.x, pt.y);
ScrollHint.ActivateWithBounds(rc, s); ScrollHint.ActivateWithBounds(rc, s);
ScrollHint.Invalidate; ScrollHint.Invalidate;
ScrollHint.Update; ScrollHint.Update;

View File

@ -2064,7 +2064,7 @@ end;
function TSynCssSyn.GetRange: Pointer; function TSynCssSyn.GetRange: Pointer;
begin begin
Result := {%H-}Pointer(Integer(fRange)); Result := Pointer(PtrUInt(Cardinal(fRange)));
end; end;
function TSynCssSyn.GetToken: string; function TSynCssSyn.GetToken: string;
@ -2122,7 +2122,7 @@ end;
procedure TSynCssSyn.SetRange(Value: Pointer); procedure TSynCssSyn.SetRange(Value: Pointer);
begin begin
FRange := TRangeStates({%H-}Cardinal(Value)); FRange := TRangeStates(Cardinal(PtrUInt(Value)));
end; end;
function TSynCssSyn.GetIdentChars: TSynIdentChars; function TSynCssSyn.GetIdentChars: TSynIdentChars;

View File

@ -277,7 +277,7 @@ begin
if cloShowCheckboxes in Options then begin if cloShowCheckboxes in Options then begin
ACheckBoxRect := Rect(0, 0, FCheckboxSize.CX, FCheckboxSize.CY); ACheckBoxRect := Rect(0, 0, FCheckboxSize.CX, FCheckboxSize.CY);
if isRTL then dec(x, FCheckboxSize.CX); if isRTL then dec(x, FCheckboxSize.CX);
OffsetRect(ACheckboxRect, x, (AItemRect.Top + AItemRect.Bottom - FCheckboxSize.CY) div 2); Types.OffsetRect(ACheckboxRect, x, (AItemRect.Top + AItemRect.Bottom - FCheckboxSize.CY) div 2);
if cloShowIcons in Options then if cloShowIcons in Options then
x := IfThen(isRTL, ACheckboxRect.Left - MARGIN, ACheckboxRect.Right + MARGIN); x := IfThen(isRTL, ACheckboxRect.Left - MARGIN, ACheckboxRect.Right + MARGIN);
end; end;

View File

@ -681,7 +681,7 @@ begin
end; end;
rDrop:=rBar; rDrop:=rBar;
szB:=Size(rBar); szB:=Size(rBar);
OffsetRect(rDrop, szB.cx + 1, 2); Types.OffsetRect(rDrop, szB.cx + 1, 2);
rDrop.Right:=r.Right-1; rDrop.Right:=r.Right-1;
rDrop.Bottom:=r.Bottom-1; rDrop.Bottom:=r.Bottom-1;
Canvas.Frame(rDrop); Canvas.Frame(rDrop);

View File

@ -851,7 +851,7 @@ var
// token fits into line // token fits into line
// => draw token // => draw token
OffsetRect(TokenRect,TokenPos.x,TokenPos.y); Types.OffsetRect(TokenRect,TokenPos.x,TokenPos.y);
if Draw then begin if Draw then begin
Canvas.FillRect(Rect(TokenRect.Left,TokenRect.Top-VerticalSpace, Canvas.FillRect(Rect(TokenRect.Left,TokenRect.Top-VerticalSpace,
TokenRect.Right,TokenRect.Bottom+VerticalSpace)); TokenRect.Right,TokenRect.Bottom+VerticalSpace));

View File

@ -3950,7 +3950,7 @@ begin
// Save all SynEditKeyStrokes into a tree map for fast lookup, sorted by command. // Save all SynEditKeyStrokes into a tree map for fast lookup, sorted by command.
for i:=ASynEditKeyStrokes.Count-1 downto 0 do begin for i:=ASynEditKeyStrokes.Count-1 downto 0 do begin
Key:=ASynEditKeyStrokes[i]; Key:=ASynEditKeyStrokes[i];
Node:=KeyStrokesByCmds.FindKey({%H-}Pointer(Key.Command), @CompareKeyCmd); Node:=KeyStrokesByCmds.FindKey({%H-}Pointer(PtrUInt(Key.Command)), @CompareKeyCmd);
if Assigned(Node) then begin // Another key is already defined for this command if Assigned(Node) then begin // Another key is already defined for this command
KeyList:=TKeyStrokeList(Node.Data); KeyList:=TKeyStrokeList(Node.Data);
if KeyList.FCount < 3 then if KeyList.FCount < 3 then
@ -3987,7 +3987,7 @@ begin
if (ccid >= ecFirstPlugin) and (ccid < ecLastPlugin) then if (ccid >= ecFirstPlugin) and (ccid < ecLastPlugin) then
ccid:=ccid+ACommandOffsetOffset; ccid:=ccid+ACommandOffsetOffset;
// Get SynEditKeyStrokes from the lookup tree // Get SynEditKeyStrokes from the lookup tree
Node:=KeyStrokesByCmds.FindKey({%H-}Pointer(ccid), @CompareKeyCmd); Node:=KeyStrokesByCmds.FindKey({%H-}Pointer(PtrUInt(ccid)), @CompareKeyCmd);
// First and second shortcuts for this command // First and second shortcuts for this command
UpdateOrAddKeyStroke(0, @CurRelation.ShortcutA); UpdateOrAddKeyStroke(0, @CurRelation.ShortcutA);
UpdateOrAddKeyStroke(1, @CurRelation.ShortcutB); UpdateOrAddKeyStroke(1, @CurRelation.ShortcutB);

View File

@ -7101,6 +7101,7 @@ end;
{$IfOpt C+} {$IfOpt C+}
function TIdeWatches.Add: TCollectionItem; function TIdeWatches.Add: TCollectionItem;
begin begin
Result := Nil; // Prevent compiler warning.
assert(False, 'TIdeWatches.Add: False'); assert(False, 'TIdeWatches.Add: False');
end; end;
{$EndIf} {$EndIf}

View File

@ -35,7 +35,7 @@ interface
{$ENDIF} {$ENDIF}
{$MACRO ON} {$MACRO ON}
{$IF FPC_FULLVERSION >= 30300} {$IF FPC_FULLVERSION >= 30200}
{$DEFINE SysUITypes:=System.UITypes} {$DEFINE SysUITypes:=System.UITypes}
{$ELSE} {$ELSE}
{$DEFINE SysUITypes:=UITypes} {$DEFINE SysUITypes:=UITypes}

View File

@ -815,7 +815,7 @@ begin
ParentOrigin.Y := 0; ParentOrigin.Y := 0;
if FHintControl.Parent <> nil then if FHintControl.Parent <> nil then
ParentOrigin := FHintControl.Parent.ClientOrigin; ParentOrigin := FHintControl.Parent.ClientOrigin;
OffsetRect(HintInfo.CursorRect, ParentOrigin.X - ClientOrigin.X, Types.OffsetRect(HintInfo.CursorRect, ParentOrigin.X - ClientOrigin.X,
ParentOrigin.Y - ClientOrigin.Y); ParentOrigin.Y - ClientOrigin.Y);
HintInfo.CursorPos := FHintControl.ScreenToClient(Info.MousePos); HintInfo.CursorPos := FHintControl.ScreenToClient(Info.MousePos);
HintInfo.HintStr := GetControlShortHint(Info.Control); HintInfo.HintStr := GetControlShortHint(Info.Control);
@ -866,7 +866,7 @@ begin
WidthAdjust := HintWinRect.Right - HintWinRect.Left WidthAdjust := HintWinRect.Right - HintWinRect.Left
else else
WidthAdjust := 0; WidthAdjust := 0;
OffsetRect(HintWinRect, HintInfo.HintPos.X - WidthAdjust, HintInfo.HintPos.Y); Types.OffsetRect(HintWinRect, HintInfo.HintPos.X - WidthAdjust, HintInfo.HintPos.Y);
//DebugLn(['TApplication.ShowHintWindow HintStr="',HintInfo.HintStr,'" HintWinRect=',dbgs(HintWinRect)]); //DebugLn(['TApplication.ShowHintWindow HintStr="',HintInfo.HintStr,'" HintWinRect=',dbgs(HintWinRect)]);
FHintWindow.Color := HintInfo.HintColor; FHintWindow.Color := HintInfo.HintColor;

View File

@ -1313,13 +1313,13 @@ begin
begin begin
DrawText(DC, pChar(Text), Length(Text), fRect, DT_CALCRECT or Options); DrawText(DC, pChar(Text), Length(Text), fRect, DT_CALCRECT or Options);
case Style.Alignment of case Style.Alignment of
taRightJustify : OffsetRect(fRect, ARect.Right - fRect.Right, 0); taRightJustify : Types.OffsetRect(fRect, ARect.Right - fRect.Right, 0);
taCenter : OffsetRect(fRect, (ARect.Right - fRect.Right) div 2, 0); taCenter : Types.OffsetRect(fRect, (ARect.Right - fRect.Right) div 2, 0);
end; end;
case Style.Layout of case Style.Layout of
tlCenter : OffsetRect(fRect, 0, tlCenter : Types.OffsetRect(fRect, 0,
((ARect.Bottom - ARect.Top) - (fRect.Bottom - fRect.Top)) div 2); ((ARect.Bottom - ARect.Top) - (fRect.Bottom - fRect.Top)) div 2);
tlBottom : OffsetRect(fRect, 0, ARect.Bottom - fRect.Bottom); tlBottom : Types.OffsetRect(fRect, 0, ARect.Bottom - fRect.Bottom);
end; end;
end; end;

View File

@ -472,10 +472,10 @@ begin
MoveRectToFit(ARect, NewDockSite.GetLogicalClientRect); MoveRectToFit(ARect, NewDockSite.GetLogicalClientRect);
// consider Align to increase chance the width/height is kept // consider Align to increase chance the width/height is kept
case Align of case Align of
alLeft: OffsetRect(ARect,-ARect.Left,0); alLeft: Types.OffsetRect(ARect,-ARect.Left,0);
alTop: OffsetRect(ARect,0,-ARect.Top); alTop: Types.OffsetRect(ARect,0,-ARect.Top);
alRight: OffsetRect(ARect,NewDockSite.ClientWidth-ARect.Right,0); alRight: Types.OffsetRect(ARect,NewDockSite.ClientWidth-ARect.Right,0);
alBottom: OffsetRect(ARect,0,NewDockSite.ClientHeight-ARect.Bottom); alBottom: Types.OffsetRect(ARect,0,NewDockSite.ClientHeight-ARect.Bottom);
end; end;
end; end;
//DebugLn('TControl.DoDock AFTER Adjusting ',DbgSName(Self),' ',dbgs(ARect),' Align=',DbgS(Align),' NewDockSite.ClientRect=',dbgs(NewDockSite.ClientRect)); //DebugLn('TControl.DoDock AFTER Adjusting ',DbgSName(Self),' ',dbgs(ARect),' Align=',DbgS(Align),' NewDockSite.ClientRect=',dbgs(NewDockSite.ClientRect));

View File

@ -233,7 +233,7 @@ begin
ChangeY := (ImgHeight-PicHeight) div 2; ChangeY := (ImgHeight-PicHeight) div 2;
if FKeepOriginXWhenClipped and (ChangeX<0) then ChangeX := 0; if FKeepOriginXWhenClipped and (ChangeX<0) then ChangeX := 0;
if FKeepOriginYWhenClipped and (ChangeY<0) then ChangeY := 0; if FKeepOriginYWhenClipped and (ChangeY<0) then ChangeY := 0;
OffsetRect(Result, ChangeX, ChangeY); Types.OffsetRect(Result, ChangeX, ChangeY);
end; end;
end; end;

View File

@ -134,7 +134,7 @@ begin
begin begin
Canvas.Font.Color := clBtnHighlight; Canvas.Font.Color := clBtnHighlight;
Rect2 := Rect; Rect2 := Rect;
OffsetRect(Rect2, 1, 1); Types.OffsetRect(Rect2, 1, 1);
DrawText(Canvas.Handle, PChar(LabelText), Length(LabelText), Rect2, Flags); DrawText(Canvas.Handle, PChar(LabelText), Length(LabelText), Rect2, Flags);
Canvas.Font.Color := clBtnShadow; Canvas.Font.Color := clBtnShadow;
end; end;
@ -449,8 +449,8 @@ begin
begin begin
case FLayout of case FLayout of
tlTop: ; // nothing tlTop: ; // nothing
tlCenter: OffsetRect(R, 0, (R.Height-CalcRect.Height) div 2); tlCenter: Types.OffsetRect(R, 0, (R.Height-CalcRect.Height) div 2);
tlBottom: OffsetRect(R, 0, R.Height-CalcRect.Height) tlBottom: Types.OffsetRect(R, 0, R.Height-CalcRect.Height)
end; end;
R.Height := CalcRect.Height; R.Height := CalcRect.Height;
end; end;
@ -463,16 +463,16 @@ begin
CalcRect := RotateRect(CalcRect.Width, CalcRect.Height, angle); CalcRect := RotateRect(CalcRect.Width, CalcRect.Height, angle);
R := CalcRect; R := CalcRect;
case FAlignment of case FAlignment of
taLeftJustify: OffsetRect(R, -CalcRect.Left, 0); taLeftJustify: Types.OffsetRect(R, -CalcRect.Left, 0);
taCenter: OffsetRect(R, (Width - CalcRect.Width) div 2 - CalcRect.Left, 0); taCenter: Types.OffsetRect(R, (Width - CalcRect.Width) div 2 - CalcRect.Left, 0);
taRightJustify: OffsetRect(r, Width - CalcRect.Right, 0); taRightJustify: Types.OffsetRect(r, Width - CalcRect.Right, 0);
end; end;
case FLayout of case FLayout of
tlTop: OffsetRect(R, 0, -CalcRect.Top); tlTop: Types.OffsetRect(R, 0, -CalcRect.Top);
tlCenter: OffsetRect(R, 0, (Height - CalcRect.Height) div 2 - CalcRect.Top); tlCenter: Types.OffsetRect(R, 0, (Height - CalcRect.Height) div 2 - CalcRect.Top);
tlBottom: OffsetRect(R, 0, Height - CalcRect.Bottom); tlBottom: Types.OffsetRect(R, 0, Height - CalcRect.Bottom);
end; end;
OffsetRect(R, -CalcRect.Left-1, -CalcRect.Top-1); Types.OffsetRect(R, -CalcRect.Left-1, -CalcRect.Top-1);
end; end;
//debugln('TCustomLabel.Paint ',dbgs(Alignment=tacenter),' ',dbgs(Layout=tlCenter),' ',dbgs(TextLeft),' TextTop=',dbgs(TextTop),' ',dbgs(R)); //debugln('TCustomLabel.Paint ',dbgs(Alignment=tacenter),' ',dbgs(Layout=tlCenter),' ',dbgs(TextLeft),' TextTop=',dbgs(TextTop),' ',dbgs(R));
DoDrawText(R, Flags); DoDrawText(R, Flags);

View File

@ -839,7 +839,7 @@ begin
if (Index=Items.Count) and (Index>0) then if (Index=Items.Count) and (Index>0) then
begin begin
TWSCustomListBoxClass(WidgetSetClass).GetItemRect(Self, Index - 1, Result); TWSCustomListBoxClass(WidgetSetClass).GetItemRect(Self, Index - 1, Result);
OffsetRect(Result, 0, Result.Bottom - Result.Top); Types.OffsetRect(Result, 0, Result.Bottom - Result.Top);
end; end;
end; end;

View File

@ -174,10 +174,10 @@ begin
else else
begin begin
Canvas.Font.Color := clBtnHighlight; Canvas.Font.Color := clBtnHighlight;
OffsetRect(ARect, 1, 1); Types.OffsetRect(ARect, 1, 1);
Canvas.TextRect(ARect, ARect.Left, ARect.Top, Caption, TS); Canvas.TextRect(ARect, ARect.Left, ARect.Top, Caption, TS);
Canvas.Font.Color := clBtnShadow; Canvas.Font.Color := clBtnShadow;
OffsetRect(ARect, -1, -1); Types.OffsetRect(ARect, -1, -1);
end end
else else
Canvas.Font.Color := Font.Color; Canvas.Font.Color := Font.Color;

View File

@ -229,13 +229,13 @@ var
OldSize := GetControlSize(CurResizeControl); OldSize := GetControlSize(CurResizeControl);
case ResizeAnchor of case ResizeAnchor of
akLeft: akLeft:
OffsetRect(NewRect, NewSize - OldSize, 0); Types.OffsetRect(NewRect, NewSize - OldSize, 0);
akRight: akRight:
OffsetRect(NewRect, OldSize - NewSize, 0); Types.OffsetRect(NewRect, OldSize - NewSize, 0);
akTop: akTop:
OffsetRect(NewRect, 0, NewSize - OldSize); Types.OffsetRect(NewRect, 0, NewSize - OldSize);
akBottom: akBottom:
OffsetRect(NewRect, 0, OldSize - NewSize); Types.OffsetRect(NewRect, 0, OldSize - NewSize);
end; end;
SetRubberBandRect(FSplitterWindow, NewRect); SetRubberBandRect(FSplitterWindow, NewRect);
end; end;
@ -476,9 +476,9 @@ begin
NewRect.BottomRight := Parent.ClientToScreen(NewRect.BottomRight); NewRect.BottomRight := Parent.ClientToScreen(NewRect.BottomRight);
if ResizeAnchor in [akLeft, akRight] then if ResizeAnchor in [akLeft, akRight] then
OffsetRect(NewRect, Offset, 0) Types.OffsetRect(NewRect, Offset, 0)
else else
OffsetRect(NewRect, 0, Offset); Types.OffsetRect(NewRect, 0, Offset);
SetRubberBandRect(FSplitterWindow, NewRect); SetRubberBandRect(FSplitterWindow, NewRect);
end; end;
end; end;

View File

@ -127,7 +127,7 @@ end;
procedure TDragDockObject.AdjustDockRect(ARect: TRect); procedure TDragDockObject.AdjustDockRect(ARect: TRect);
begin begin
with DockOffset do with DockOffset do
OffsetRect(FDockRect, -X, -Y); Types.OffsetRect(FDockRect, -X, -Y);
end; end;
function TDragDockObject.GetDragCursor(Accepted: Boolean; X, Y: Integer): TCursor; function TDragDockObject.GetDragCursor(Accepted: Boolean; X, Y: Integer): TCursor;

View File

@ -351,7 +351,7 @@ end;
function THintWindow.OffsetHintRect(AOffset: TPoint; dy: Integer; function THintWindow.OffsetHintRect(AOffset: TPoint; dy: Integer;
KeepWidth: Boolean; KeepHeight: Boolean): Boolean; KeepWidth: Boolean; KeepHeight: Boolean): Boolean;
begin begin
Result:=OffsetRect(FHintRect, AOffset.X, AOffset.Y + dy); Result:=Types.OffsetRect(FHintRect, AOffset.X, AOffset.Y + dy);
AdjustBoundsForMonitor(KeepWidth, KeepHeight); AdjustBoundsForMonitor(KeepWidth, KeepHeight);
end; end;

View File

@ -1431,7 +1431,7 @@ var
ImageRect: TRect; ImageRect: TRect;
begin begin
ImageRect := Rect(0, 0, Width, Height); ImageRect := Rect(0, 0, Width, Height);
OffsetRect(ImageRect, (Image.Width-Width) div 2, (Image.Height-Height) div 2); Types.OffsetRect(ImageRect, (Image.Width-Width) div 2, (Image.Height-Height) div 2);
Result := AddSlice(Image, ImageRect); Result := AddSlice(Image, ImageRect);
end; end;
@ -2619,7 +2619,7 @@ var
begin begin
if not FindResolution(AImageWidth, R) then Exit; if not FindResolution(AImageWidth, R) then Exit;
ImageRect := Rect(0, 0, R.Width, R.Height); ImageRect := Rect(0, 0, R.Width, R.Height);
OffsetRect(ImageRect, (Image.Width-R.Width) div 2, (Image.Height-R.Height) div 2); Types.OffsetRect(ImageRect, (Image.Width-R.Width) div 2, (Image.Height-R.Height) div 2);
ReplaceSlice(AIndex, Image, ImageRect, AllResolutions); ReplaceSlice(AIndex, Image, ImageRect, AllResolutions);
end; end;
@ -2794,7 +2794,7 @@ function TLCLGlyphs.GetImageIndex(const AResourceName: string): Integer;
Exit(-1); Exit(-1);
try try
ImageRect := Rect(0, 0, Resolution.Width, GetHeightForWidth(Resolution.Width)); ImageRect := Rect(0, 0, Resolution.Width, GetHeightForWidth(Resolution.Width));
OffsetRect(ImageRect, (G.Width-ImageRect.Right) div 2, (G.Height-ImageRect.Bottom) div 2); Types.OffsetRect(ImageRect, (G.Width-ImageRect.Right) div 2, (G.Height-ImageRect.Bottom) div 2);
Result := AddSlice(G, ImageRect); Result := AddSlice(G, ImageRect);
finally finally
G.Free; G.Free;

View File

@ -612,9 +612,9 @@ var
If not CalcRect then If not CalcRect then
Case LeftOffset of Case LeftOffset of
DT_CENTER : DT_CENTER :
OffsetRect(theRect, (Rect.Right - theRect.Right) div 2, 0); Types.OffsetRect(theRect, (Rect.Right - theRect.Right) div 2, 0);
DT_Right : DT_Right :
OffsetRect(theRect, Rect.Right - theRect.Right, 0); Types.OffsetRect(theRect, Rect.Right - theRect.Right, 0);
end; end;
theRect.Bottom := theRect.Top + hT; theRect.Bottom := theRect.Top + hT;
@ -624,9 +624,9 @@ var
If SingleLine then If SingleLine then
Case TopOffset of Case TopOffset of
DT_VCENTER : DT_VCENTER :
OffsetRect(theRect, 0, (Rect.Bottom - theRect.Bottom) div 2); Types.OffsetRect(theRect, 0, (Rect.Bottom - theRect.Bottom) div 2);
DT_Bottom : DT_Bottom :
OffsetRect(theRect, 0, Rect.Bottom - theRect.Bottom); Types.OffsetRect(theRect, 0, Rect.Bottom - theRect.Bottom);
end; end;
end; end;
var var

View File

@ -328,7 +328,7 @@ begin
TextLeft := (cMinLeft + reqWidth - TextBox.Right) div 2; TextLeft := (cMinLeft + reqWidth - TextBox.Right) div 2;
// position the text // position the text
OffsetRect(TextBox, TextLeft, Scale96ToFont(cLabelSpacing)); Types.OffsetRect(TextBox, TextLeft, Scale96ToFont(cLabelSpacing));
// set size of form // set size of form
ClientWidth := reqWidth + 2 * Scale96ToFont(cLabelSpacing); ClientWidth := reqWidth + 2 * Scale96ToFont(cLabelSpacing);
@ -722,7 +722,7 @@ begin
end; end;
// calculate the text position // calculate the text position
OffsetRect(TextBox, Types.OffsetRect(TextBox,
((reqWidth-cMinLeft-TextBox.Right-cLabelSpacing) div 2) + cMinLeft, ((reqWidth-cMinLeft-TextBox.Right-cLabelSpacing) div 2) + cMinLeft,
cLabelSpacing); cLabelSpacing);

View File

@ -284,7 +284,7 @@ begin
if not LHorzVisible and not LVertVisible then Exit; if not LHorzVisible and not LVertVisible then Exit;
LRect := Rect(0, 0, AControl.Width, AControl.Height); LRect := Rect(0, 0, AControl.Width, AControl.Height);
LPoint := AControl.ClientToParent(Point(0, 0), Self); LPoint := AControl.ClientToParent(Point(0, 0), Self);
OffsetRect(LRect, LPoint.x, LPoint.y); Types.OffsetRect(LRect, LPoint.x, LPoint.y);
if LHorzVisible then if LHorzVisible then
if LRect.Left < 0 then if LRect.Left < 0 then
HorzScrollBar.Position := HorzScrollBar.Position + LRect.Left HorzScrollBar.Position := HorzScrollBar.Position + LRect.Left

View File

@ -266,7 +266,7 @@ procedure TToolButton.Paint;
ARect.Top := (ARect.Top + ARect.Bottom) div 2 - 5; ARect.Top := (ARect.Top + ARect.Bottom) div 2 - 5;
ARect.Bottom := ARect.Top + 5; ARect.Bottom := ARect.Top + 5;
DrawDivider(Details, ARect); DrawDivider(Details, ARect);
OffsetRect(ARect, 0, 5); Types.OffsetRect(ARect, 0, 5);
DrawDivider(Details, ARect); DrawDivider(Details, ARect);
end end
else else
@ -279,7 +279,7 @@ procedure TToolButton.Paint;
ARect.Left := (ARect.Left + ARect.Right) div 2 - 5; ARect.Left := (ARect.Left + ARect.Right) div 2 - 5;
ARect.Right := ARect.Left + 5; ARect.Right := ARect.Left + 5;
DrawDivider(Details, ARect); DrawDivider(Details, ARect);
OffsetRect(ARect, 5, 0); Types.OffsetRect(ARect, 5, 0);
DrawDivider(Details, ARect); DrawDivider(Details, ARect);
end end
else else

View File

@ -2069,7 +2069,7 @@ begin
Info^.SelectedIndex := SelectedIndex; Info^.SelectedIndex := SelectedIndex;
Info^.OverlayIndex := OverlayIndex; Info^.OverlayIndex := OverlayIndex;
Info^.StateIndex := StateIndex; Info^.StateIndex := StateIndex;
Info^.Data := {%H-}Cardinal(Data); Info^.Data := {%H-}Cardinal(PtrUInt(Data));
ItemCount := Count; ItemCount := Count;
Info^.Count := ItemCount; Info^.Count := ItemCount;
Stream.WriteBuffer(Size, SizeOf(Size)); Stream.WriteBuffer(Size, SizeOf(Size));
@ -4598,7 +4598,7 @@ begin
end; end;
TextRect := Rect(Node.DisplayTextLeft, Node.Top, Node.DisplayTextRight, Node.Top + Node.Height); TextRect := Rect(Node.DisplayTextLeft, Node.Top, Node.DisplayTextRight, Node.Top + Node.Height);
OffsetRect(TextRect, 0, -ScrolledTop); Types.OffsetRect(TextRect, 0, -ScrolledTop);
if not PtInRect(TextRect, Point(X, Y)) if not PtInRect(TextRect, Point(X, Y))
or (IntersectRect(IntRect, TextRect, ClientRect) and EqualRect(IntRect, TextRect)) then or (IntersectRect(IntRect, TextRect, ClientRect) and EqualRect(IntRect, TextRect)) then
begin begin
@ -4632,7 +4632,7 @@ begin
PHint.X := PLeft.X - R.Right; PHint.X := PLeft.X - R.Right;
end; end;
end; end;
OffsetRect(R, PHint.X, PHint.Y); Types.OffsetRect(R, PHint.X, PHint.Y);
FHintWnd.ActivateHint(R, Node.Text) FHintWnd.ActivateHint(R, Node.Text)
end; end;

View File

@ -749,7 +749,7 @@ begin
{$ENDIF} {$ENDIF}
R := ARect; R := ARect;
LPtoDP(ADC, R, 2); LPtoDP(ADC, R, 2);
OffSetRect(R, DCOrigin.x, DCOrigin.y); Types.OffSetRect(R, DCOrigin.x, DCOrigin.y);
Drawable := DevCtx.Drawable; Drawable := DevCtx.Drawable;
if Drawable = nil then if Drawable = nil then

View File

@ -542,7 +542,7 @@ begin
begin begin
OffsetPage := RectFromGdkRect(PageWidget^.allocation); OffsetPage := RectFromGdkRect(PageWidget^.allocation);
Result := RectFromGdkRect(TabWidget^.allocation); Result := RectFromGdkRect(TabWidget^.allocation);
OffsetRect(Result, -OffsetPage.Left, -OffsetPage.Top); Types.OffsetRect(Result, -OffsetPage.Left, -OffsetPage.Top);
end; end;
end; end;
end; end;

View File

@ -6222,7 +6222,7 @@ begin
Widget^.allocation.width + Widget^.allocation.x, Widget^.allocation.width + Widget^.allocation.x,
Widget^.allocation.height + Widget^.allocation.y); Widget^.allocation.height + Widget^.allocation.y);
OffsetRect(ItemStruct^.rcItem, -ItemStruct^.rcItem.Left, -ItemStruct^.rcItem.Top); Types.OffsetRect(ItemStruct^.rcItem, -ItemStruct^.rcItem.Left, -ItemStruct^.rcItem.Top);
// take frame borders into account // take frame borders into account
with ItemStruct^.rcItem do with ItemStruct^.rcItem do

View File

@ -2347,7 +2347,7 @@ begin
LPtoDP(DC, R, 2); LPtoDP(DC, R, 2);
DCOrigin := Offset; DCOrigin := Offset;
OffsetRect(R, DCOrigin.X, DCOrigin.Y); Types.OffsetRect(R, DCOrigin.X, DCOrigin.Y);
// try to use the gdk functions, so that the current theme is used // try to use the gdk functions, so that the current theme is used
BInner := False; BInner := False;
@ -2415,7 +2415,7 @@ begin
if (grfFlags and BF_ADJUST) = BF_ADJUST then if (grfFlags and BF_ADJUST) = BF_ADJUST then
begin begin
ARect := R; ARect := R;
OffsetRect(ARect, -DCOrigin.X, -DCOrigin.Y); Types.OffsetRect(ARect, -DCOrigin.X, -DCOrigin.Y);
DPtoLP(DC, ARect, 2); DPtoLP(DC, ARect, 2);
end; end;
Result := True; Result := True;
@ -2515,12 +2515,12 @@ var
theRect.Bottom := theRect.Top + AP.cY; theRect.Bottom := theRect.Top + AP.cY;
if (Flags and DT_VCENTER) > 0 then if (Flags and DT_VCENTER) > 0 then
begin begin
OffsetRect(theRect, 0, ((Rect.Bottom - Rect.Top) - (theRect.Bottom - theRect.Top)) div 2); Types.OffsetRect(theRect, 0, ((Rect.Bottom - Rect.Top) - (theRect.Bottom - theRect.Top)) div 2);
end end
else else
if (Flags and DT_BOTTOM) > 0 then if (Flags and DT_BOTTOM) > 0 then
begin begin
OffsetRect(theRect, 0, (Rect.Bottom - Rect.Top) - (theRect.Bottom - theRect.Top)); Types.OffsetRect(theRect, 0, (Rect.Bottom - Rect.Top) - (theRect.Bottom - theRect.Top));
end; end;
end; end;
@ -2567,9 +2567,9 @@ var
if not CalcRect then if not CalcRect then
case LeftOffset of case LeftOffset of
DT_CENTER: DT_CENTER:
OffsetRect(theRect, (Rect.Right - theRect.Right) div 2, 0); Types.OffsetRect(theRect, (Rect.Right - theRect.Right) div 2, 0);
DT_RIGHT: DT_RIGHT:
OffsetRect(theRect, Rect.Right - theRect.Right, 0); Types.OffsetRect(theRect, Rect.Right - theRect.Right, 0);
end; end;
end; end;
@ -2625,7 +2625,7 @@ var
begin begin
{see issue #27547} {see issue #27547}
AClipRect := RectFromGdkRect(TGtkDeviceContext(DC).ClipRect); AClipRect := RectFromGdkRect(TGtkDeviceContext(DC).ClipRect);
OffsetRect(AClipRect, -AClipRect.Left, -AClipRect.Top); Types.OffsetRect(AClipRect, -AClipRect.Left, -AClipRect.Top);
Result := (TGtkDeviceContext(DC).CurrentFont^.LogFont.lfOrientation <> 0) and Result := (TGtkDeviceContext(DC).CurrentFont^.LogFont.lfOrientation <> 0) and
(Flags and DT_SINGLELINE <> 0) and (Flags and DT_SINGLELINE <> 0) and
(Flags and DT_VCENTER = 0) and (Flags and DT_CENTER = 0) and (Flags and DT_VCENTER = 0) and (Flags and DT_CENTER = 0) and
@ -3883,8 +3883,8 @@ begin
if ((Options and (ETO_OPAQUE + ETO_CLIPPED)) <> 0) and (Rect = nil) then if ((Options and (ETO_OPAQUE + ETO_CLIPPED)) <> 0) and (Rect = nil) then
begin begin
R := RectFromGdkRect(DevCtx.ClipRect); R := RectFromGdkRect(DevCtx.ClipRect);
OffsetRect(R, -R.Left, -R.Top); Types.OffsetRect(R, -R.Left, -R.Top);
OffsetRect(R, X, Y); Types.OffsetRect(R, X, Y);
DrawText(DC, Str, Count, R, DT_SINGLELINE or DT_CALCRECT); DrawText(DC, Str, Count, R, DT_SINGLELINE or DT_CALCRECT);
Rect := @R; Rect := @R;
end; end;
@ -4505,7 +4505,7 @@ begin
lpRect^.Bottom := lpRect^.Top + CRect.Height; lpRect^.Bottom := lpRect^.Top + CRect.Height;
end; end;
DPtoLP(DC, lpRect^, 2); DPtoLP(DC, lpRect^, 2);
OffsetRect(lpRect^, -DCOrigin.X, -DCOrigin.Y); Types.OffsetRect(lpRect^, -DCOrigin.X, -DCOrigin.Y);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -6522,7 +6522,7 @@ begin
Pt.X := Round(Adjustment^.value); Pt.X := Round(Adjustment^.value);
dec(gdkRect.x, Pt.X); dec(gdkRect.x, Pt.X);
dec(gdkRect.y, Pt.Y); dec(gdkRect.y, Pt.Y);
OffsetRect(Rect^, -Pt.X, -Pt.Y); Types.OffsetRect(Rect^, -Pt.X, -Pt.Y);
end; end;
WidgetInfo := GetWidgetInfo(Widget); // GetOrCreateWidgetInfo() ?? WidgetInfo := GetWidgetInfo(Widget); // GetOrCreateWidgetInfo() ??
if WidgetInfo <> nil then if WidgetInfo <> nil then

View File

@ -452,10 +452,10 @@ begin
Offs := TabWidget.getGeometry; Offs := TabWidget.getGeometry;
Result := TabWidget.TabBar.GetTabRect(AIndex); Result := TabWidget.TabBar.GetTabRect(AIndex);
case ATabControl.TabPosition of case ATabControl.TabPosition of
tpTop: OffsetRect(Result, 0, -Result.Bottom); tpTop: Types.OffsetRect(Result, 0, -Result.Bottom);
tpLeft: OffsetRect(Result, -Result.Right, 0); tpLeft: Types.OffsetRect(Result, -Result.Right, 0);
tpRight: OffsetRect(Result, Offs.Width - Result.Right, 0); tpRight: Types.OffsetRect(Result, Offs.Width - Result.Right, 0);
tpBottom: OffsetRect(Result, 0, Offs.Height - Result.Bottom); tpBottom: Types.OffsetRect(Result, 0, Offs.Height - Result.Bottom);
end; end;
end; end;

View File

@ -11,8 +11,10 @@ uses
Types, Classes, SysUtils, Types, Classes, SysUtils,
// qt bindings // qt bindings
qt5, qt5,
// LazUtils
LazLoggerBase,
// lcl // lcl
LCLType, LCLProc, LCLIntf, Graphics, Themes, TmSchema, LCLType, LCLIntf, Graphics, Themes, TmSchema,
// widgetset // widgetset
InterfaceBase, QtObjects InterfaceBase, QtObjects
; ;
@ -333,7 +335,7 @@ begin
dx := ARect.Left; dx := ARect.Left;
dy := ARect.Top; dy := ARect.Top;
Context.translate(dx, dy); Context.translate(dx, dy);
OffsetRect(ARect, -dx, -dy); Types.OffsetRect(ARect, -dx, -dy);
QStyleOption_setRect(opt, @ARect); QStyleOption_setRect(opt, @ARect);
// issue #27182 qt5 does not implement splitter grabber in some themes. // issue #27182 qt5 does not implement splitter grabber in some themes.
@ -354,7 +356,7 @@ begin
begin begin
opt := QStyleOptionGroupBox_create(); opt := QStyleOptionGroupBox_create();
Context.translate(ARect.Left, ARect.Top); Context.translate(ARect.Left, ARect.Top);
OffsetRect(ARect, -ARect.Left, -ARect.Top); Types.OffsetRect(ARect, -ARect.Left, -ARect.Top);
end; end;
QStyleCC_ToolButton: QStyleCC_ToolButton:
begin begin
@ -395,7 +397,7 @@ begin
// workaround: qt has own minds about position of requested part - // workaround: qt has own minds about position of requested part -
// but we need a way to draw it at our position // but we need a way to draw it at our position
Context.translate(ARect.Left, ARect.Top); Context.translate(ARect.Left, ARect.Top);
OffsetRect(ARect, -ARect.Left, -ARect.Top); Types.OffsetRect(ARect, -ARect.Left, -ARect.Top);
end; end;
QStyleCC_Slider, QStyleCC_ScrollBar: QStyleCC_Slider, QStyleCC_ScrollBar:
begin begin
@ -495,7 +497,7 @@ begin
and (ARect.Top > 0) then and (ARect.Top > 0) then
begin begin
ClipR.Left := (ARect.Right - ARect.Left + 1) div 3; ClipR.Left := (ARect.Right - ARect.Left + 1) div 3;
OffsetRect(ARect, -ClipR.Left, -1); Types.OffsetRect(ARect, -ClipR.Left, -1);
end; end;
end; end;
{$ENDIF} {$ENDIF}
@ -736,7 +738,7 @@ begin
begin begin
Context.Translate(R.Left, R.Top); Context.Translate(R.Left, R.Top);
Context.Rotate(-0.1 * Context.Font.Angle); Context.Rotate(-0.1 * Context.Font.Angle);
OffsetRect(R, -R.Left, -R.Top); Types.OffsetRect(R, -R.Left, -R.Top);
end; end;
if (Details.Element = teEdit) then if (Details.Element = teEdit) then

View File

@ -27,6 +27,8 @@ uses
qtobjects, qtint, qtobjects, qtint,
// Free Pascal // Free Pascal
Classes, SysUtils, Types, Classes, SysUtils, Types,
// LazUtils
LazLoggerBase,
// LCL // LCL
LCLType, LCLProc, LazUTF8, LazStringUtils, LCLIntf, LMessages, Graphics, Forms, Controls, LCLType, LCLProc, LazUTF8, LazStringUtils, LCLIntf, LMessages, Graphics, Forms, Controls,
ComCtrls, ExtCtrls, StdCtrls, Menus, Dialogs, ImgList; ComCtrls, ExtCtrls, StdCtrls, Menus, Dialogs, ImgList;
@ -7381,7 +7383,7 @@ begin
begin begin
R1 := ARect^; R1 := ARect^;
QWidget_geometry(MDIAreaHandle.Widget, @R); QWidget_geometry(MDIAreaHandle.Widget, @R);
OffsetRect(R1, -R.Left, -R.Top); Types.OffsetRect(R1, -R.Left, -R.Top);
QWidget_update(MDIAreaHandle.viewportWidget, @R1); QWidget_update(MDIAreaHandle.viewportWidget, @R1);
end; end;
end else end else
@ -7401,7 +7403,7 @@ begin
begin begin
QRegion_boundingRect(ARgn, @R1); QRegion_boundingRect(ARgn, @R1);
QWidget_geometry(MDIAreaHandle.Widget, @R); QWidget_geometry(MDIAreaHandle.Widget, @R);
OffsetRect(R1, -R.Left, -R.Top); Types.OffsetRect(R1, -R.Left, -R.Top);
ANewRgn := QRegion_create(PRect(@R1)); ANewRgn := QRegion_create(PRect(@R1));
QWidget_update(MDIAreaHandle.viewportWidget, ANewRgn); QWidget_update(MDIAreaHandle.viewportWidget, ANewRgn);
QRegion_destroy(ANewRgn); QRegion_destroy(ANewRgn);
@ -7422,7 +7424,7 @@ begin
begin begin
R1 := ARect^; R1 := ARect^;
QWidget_geometry(MDIAreaHandle.Widget, @R); QWidget_geometry(MDIAreaHandle.Widget, @R);
OffsetRect(R1, -R.Left, -R.Top); Types.OffsetRect(R1, -R.Left, -R.Top);
QWidget_repaint(MDIAreaHandle.viewportWidget, @R1); QWidget_repaint(MDIAreaHandle.viewportWidget, @R1);
end; end;
end else end else
@ -8524,7 +8526,7 @@ begin
else else
R1 := Rect(0, 0, 0, 0); R1 := Rect(0, 0, 0, 0);
Result := R; Result := R;
OffsetRect(Result, -Result.Left, -Result.Top); Types.OffsetRect(Result, -Result.Left, -Result.Top);
{$IFNDEF HASX11} {$IFNDEF HASX11}
if testAttribute(QtWA_Mapped) and QWidget_testAttribute(FCentralWidget, QtWA_Mapped) then if testAttribute(QtWA_Mapped) and QWidget_testAttribute(FCentralWidget, QtWA_Mapped) then
QWidget_rect(FCentralWidget, @Result) QWidget_rect(FCentralWidget, @Result)
@ -8614,7 +8616,7 @@ begin
begin begin
P := getClientOffset; P := getClientOffset;
R := ARect^; R := ARect^;
OffsetRect(R, -P.X, -P.Y); Types.OffsetRect(R, -P.X, -P.Y);
QWidget_update(FCentralWidget, @R); QWidget_update(FCentralWidget, @R);
end else end else
QWidget_update(FCentralWidget); QWidget_update(FCentralWidget);
@ -8650,7 +8652,7 @@ begin
begin begin
P := getClientOffset; P := getClientOffset;
R := ARect^; R := ARect^;
OffsetRect(R, -P.X, -P.Y); Types.OffsetRect(R, -P.X, -P.Y);
QWidget_repaint(FCentralWidget, @R); QWidget_repaint(FCentralWidget, @R);
end else end else
QWidget_repaint(FCentralWidget); QWidget_repaint(FCentralWidget);
@ -10361,7 +10363,7 @@ begin
if Assigned(FOwner) then if Assigned(FOwner) then
begin begin
Pt := TabBarOffset; Pt := TabBarOffset;
OffsetRect(Result, Pt.X, Pt.Y); Types.OffsetRect(Result, Pt.X, Pt.Y);
end; end;
end; end;
@ -11656,7 +11658,7 @@ begin
end else end else
begin begin
ButtonRect := R; ButtonRect := R;
OffsetRect(ButtonRect, -R.Left, -R.Top); Types.OffsetRect(ButtonRect, -R.Left, -R.Top);
end; end;
if PtInRect(ButtonRect, Pt) then if PtInRect(ButtonRect, Pt) then
@ -17355,7 +17357,7 @@ begin
if HaveBar and (horizontalScrollBar.getVisibleTo(Widget)) then if HaveBar and (horizontalScrollBar.getVisibleTo(Widget)) then
dec(Result.Bottom, horizontalScrollBar.getHeight); dec(Result.Bottom, horizontalScrollBar.getHeight);
end; end;
OffsetRect(Result, -Result.Left, -Result.Top); Types.OffsetRect(Result, -Result.Left, -Result.Top);
{$IF DEFINED(VerboseQtResize) OR DEFINED(VerboseQScrollBarShowHide)} {$IF DEFINED(VerboseQtResize) OR DEFINED(VerboseQScrollBarShowHide)}
DebugLn('TQtAbstractScrollArea.GetClientBounds(not mapped): ',dbgsName(LCLObject),':',dbgsName(Self),' ',dbgs(Result),' ChildComplex=',dbgs(Ord(ChildOfComplexWidget))); DebugLn('TQtAbstractScrollArea.GetClientBounds(not mapped): ',dbgsName(LCLObject),':',dbgsName(Self),' ',dbgs(Result),' ChildComplex=',dbgs(Ord(ChildOfComplexWidget)));
{$ENDIF} {$ENDIF}
@ -17581,7 +17583,7 @@ begin
if ARect <> nil then if ARect <> nil then
begin begin
P := getClientOffset; P := getClientOffset;
OffsetRect(ARect^, -P.X , -P.Y); Types.OffsetRect(ARect^, -P.X , -P.Y);
QWidget_update(viewportWidget, ARect); QWidget_update(viewportWidget, ARect);
end else end else
QWidget_update(viewportWidget); QWidget_update(viewportWidget);
@ -17602,7 +17604,7 @@ begin
if ARect <> nil then if ARect <> nil then
begin begin
P := getClientOffset; P := getClientOffset;
OffsetRect(ARect^, -P.X , -P.Y); Types.OffsetRect(ARect^, -P.X , -P.Y);
QWidget_repaint(viewportWidget, ARect); QWidget_repaint(viewportWidget, ARect);
end else end else
QWidget_repaint(viewportWidget); QWidget_repaint(viewportWidget);
@ -18486,13 +18488,13 @@ begin
if R.Bottom-R.Top > D.Bottom-D.Top then // check height if R.Bottom-R.Top > D.Bottom-D.Top then // check height
R.Bottom := R.Top + D.Bottom-D.Top; R.Bottom := R.Top + D.Bottom-D.Top;
if R.Left < D.Left then if R.Left < D.Left then
OffsetRect(R, D.Left-R.Left, 0); Types.OffsetRect(R, D.Left-R.Left, 0);
if R.Top < D.Top then if R.Top < D.Top then
OffsetRect(R, 0, D.Top-R.Top); Types.OffsetRect(R, 0, D.Top-R.Top);
if (R.Right > D.Right) then if (R.Right > D.Right) then
OffsetRect(R, D.Right-R.Right, 0); Types.OffsetRect(R, D.Right-R.Right, 0);
if (R.Bottom > D.Bottom) then if (R.Bottom > D.Bottom) then
OffsetRect(R, 0, D.Bottom-R.Bottom); Types.OffsetRect(R, 0, D.Bottom-R.Bottom);
move(R.Left, R.Top); move(R.Left, R.Top);
end; end;

View File

@ -2611,7 +2611,7 @@ begin
if Handle = 0 then if Handle = 0 then
Exit(False); Exit(False);
GetClientBounds(Handle, ARect); GetClientBounds(Handle, ARect);
OffsetRect(ARect, -ARect.Left, -ARect.Top); Types.OffsetRect(ARect, -ARect.Left, -ARect.Top);
Result := True; Result := True;
end; end;
@ -4966,19 +4966,19 @@ begin
if Rect <> nil then if Rect <> nil then
begin begin
with TQtWidget(aHandle).getClientOffset do with TQtWidget(aHandle).getClientOffset do
OffsetRect(Rect^, x, y); Types.OffsetRect(Rect^, x, y);
{$IFDEF QTSCROLLABLEFORMS} {$IFDEF QTSCROLLABLEFORMS}
if (TQtWidget(AHandle) is TQtMainWindow) and Assigned(TQtMainWindow(AHandle).ScrollArea) then if (TQtWidget(AHandle) is TQtMainWindow) and Assigned(TQtMainWindow(AHandle).ScrollArea) then
begin begin
Pt := TQtMainWindow(AHandle).ScrollArea.ScrolledOffset; Pt := TQtMainWindow(AHandle).ScrollArea.ScrolledOffset;
OffsetRect(Rect^, -Pt.X, -Pt.Y); Types.OffsetRect(Rect^, -Pt.X, -Pt.Y);
end else end else
{$ENDIF} {$ENDIF}
if TQtWidget(AHandle).ChildOfComplexWidget = ccwScrollingWinControl then if TQtWidget(AHandle).ChildOfComplexWidget = ccwScrollingWinControl then
begin begin
Pt := TQtCustomControl(AHandle).viewport.ScrolledOffset; Pt := TQtCustomControl(AHandle).viewport.ScrolledOffset;
OffsetRect(Rect^, -Pt.X, -Pt.Y); Types.OffsetRect(Rect^, -Pt.X, -Pt.Y);
end; end;
// no need to handle bErase. Qt automatically erase rect on paint event according to docs // no need to handle bErase. Qt automatically erase rect on paint event according to docs
@ -7119,7 +7119,7 @@ begin
DstQDC.getClipping and DstQDC.getClipRegion.containsRect(SrcRect) then DstQDC.getClipping and DstQDC.getClipRegion.containsRect(SrcRect) then
begin begin
AClipRect := DstQDC.getClipRegion.getBoundingRect; AClipRect := DstQDC.getClipRegion.getBoundingRect;
OffsetRect(AClipRect, -AClipRect.Left, -AClipRect.Top); Types.OffsetRect(AClipRect, -AClipRect.Left, -AClipRect.Top);
if (DstRect.Right - DstRect.Left <= AClipRect.Right) and if (DstRect.Right - DstRect.Left <= AClipRect.Right) and
(DstRect.Bottom - DstRect.Top <= AClipRect.Bottom) and (DstRect.Bottom - DstRect.Top <= AClipRect.Bottom) and

View File

@ -29,7 +29,7 @@ uses
SysUtils, Classes, Types, SysUtils, Classes, Types,
// LCL // LCL
ComCtrls, Controls, LCLType, Graphics, StdCtrls, ComCtrls, Controls, LCLType, Graphics, StdCtrls,
LCLProc, LCLIntf, Forms, ImgList, LCLIntf, Forms, ImgList,
// Widgetset // Widgetset
WSProc, WSComCtrls, WSLCLClasses; WSProc, WSComCtrls, WSLCLClasses;
@ -1791,7 +1791,7 @@ begin
(QtTreeWidget.OwnerData or QtTreeWidget.OwnerDrawn) then (QtTreeWidget.OwnerData or QtTreeWidget.OwnerDrawn) then
begin begin
IconRect := Rect(0, 0, ImgListRes.Width, ImgListRes.Height); IconRect := Rect(0, 0, ImgListRes.Width, ImgListRes.Height);
OffsetRect(IconRect, Result.Left, Result.Top + APixelMetric); Types.OffsetRect(IconRect, Result.Left, Result.Top + APixelMetric);
end; end;
IconRect.Left += APixelMetric + (ChkBoxRect.Right - ChkBoxRect.Left); IconRect.Left += APixelMetric + (ChkBoxRect.Right - ChkBoxRect.Left);
IconRect.Right += APixelMetric; IconRect.Right += APixelMetric;

View File

@ -311,7 +311,7 @@ begin
Exit; Exit;
ARect := TQtWidget(AWinControl.Handle).getClientBounds; ARect := TQtWidget(AWinControl.Handle).getClientBounds;
OffsetRect(ARect, -ARect.Left, -ARect.Top); Types.OffsetRect(ARect, -ARect.Left, -ARect.Top);
Result := True; Result := True;
end; end;

View File

@ -1041,7 +1041,7 @@ begin
ASize.cy := 0; ASize.cy := 0;
// we must use real geometry, and then exclude menubar height. // we must use real geometry, and then exclude menubar height.
aClientRect := AWin.getGeometry; aClientRect := AWin.getGeometry;
OffsetRect(aClientRect, -aClientRect.Left, -aClientRect.Top); Types.OffsetRect(aClientRect, -aClientRect.Left, -aClientRect.Top);
dec(AClientRect.Bottom, ASize.cy); dec(AClientRect.Bottom, ASize.cy);
{$IFDEF VerboseQtResize} {$IFDEF VerboseQtResize}
DebugLn('TQtWSCustomForm.getDefaultClientRect ',dbgsName(AWinControl),' ',dbgs(AWin.getClientBounds),' mnuBarHeight ',dbgs(AWin.MenuBar.getHeight),' ASize=',dbgs(ASize),' FINAL=',dbgs(AClientRect)); DebugLn('TQtWSCustomForm.getDefaultClientRect ',dbgsName(AWinControl),' ',dbgs(AWin.getClientBounds),' mnuBarHeight ',dbgs(AWin.MenuBar.getHeight),' ASize=',dbgs(ASize),' FINAL=',dbgs(AClientRect));

View File

@ -452,10 +452,10 @@ begin
Offs := TabWidget.getGeometry; Offs := TabWidget.getGeometry;
Result := TabWidget.TabBar.GetTabRect(AIndex); Result := TabWidget.TabBar.GetTabRect(AIndex);
case ATabControl.TabPosition of case ATabControl.TabPosition of
tpTop: OffsetRect(Result, 0, -Result.Bottom); tpTop: Types.OffsetRect(Result, 0, -Result.Bottom);
tpLeft: OffsetRect(Result, -Result.Right, 0); tpLeft: Types.OffsetRect(Result, -Result.Right, 0);
tpRight: OffsetRect(Result, Offs.Width - Result.Right, 0); tpRight: Types.OffsetRect(Result, Offs.Width - Result.Right, 0);
tpBottom: OffsetRect(Result, 0, Offs.Height - Result.Bottom); tpBottom: Types.OffsetRect(Result, 0, Offs.Height - Result.Bottom);
end; end;
end; end;

View File

@ -11,8 +11,10 @@ uses
Types, Classes, SysUtils, Types, Classes, SysUtils,
// qt bindings // qt bindings
qt6, qt6,
// LazUtils
LazLoggerBase,
// lcl // lcl
LCLType, LCLProc, LCLIntf, Graphics, Themes, TmSchema, LCLType, LCLIntf, Graphics, Themes, TmSchema,
// widgetset // widgetset
InterfaceBase, QtObjects InterfaceBase, QtObjects
; ;
@ -336,7 +338,7 @@ begin
dx := ARect.Left; dx := ARect.Left;
dy := ARect.Top; dy := ARect.Top;
Context.translate(dx, dy); Context.translate(dx, dy);
OffsetRect(ARect, -dx, -dy); Types.OffsetRect(ARect, -dx, -dy);
QStyleOption_setRect(opt, @ARect); QStyleOption_setRect(opt, @ARect);
// issue #27182 qt5 does not implement splitter grabber in some themes. // issue #27182 qt5 does not implement splitter grabber in some themes.
@ -357,7 +359,7 @@ begin
begin begin
opt := QStyleOptionGroupBox_create(); opt := QStyleOptionGroupBox_create();
Context.translate(ARect.Left, ARect.Top); Context.translate(ARect.Left, ARect.Top);
OffsetRect(ARect, -ARect.Left, -ARect.Top); Types.OffsetRect(ARect, -ARect.Left, -ARect.Top);
end; end;
QStyleCC_ToolButton: QStyleCC_ToolButton:
begin begin
@ -398,7 +400,7 @@ begin
// workaround: qt has own minds about position of requested part - // workaround: qt has own minds about position of requested part -
// but we need a way to draw it at our position // but we need a way to draw it at our position
Context.translate(ARect.Left, ARect.Top); Context.translate(ARect.Left, ARect.Top);
OffsetRect(ARect, -ARect.Left, -ARect.Top); Types.OffsetRect(ARect, -ARect.Left, -ARect.Top);
end; end;
QStyleCC_Slider, QStyleCC_ScrollBar: QStyleCC_Slider, QStyleCC_ScrollBar:
begin begin
@ -498,7 +500,7 @@ begin
and (ARect.Top > 0) then and (ARect.Top > 0) then
begin begin
ClipR.Left := (ARect.Right - ARect.Left + 1) div 3; ClipR.Left := (ARect.Right - ARect.Left + 1) div 3;
OffsetRect(ARect, -ClipR.Left, -1); Types.OffsetRect(ARect, -ClipR.Left, -1);
end; end;
end; end;
{$ENDIF} {$ENDIF}
@ -739,7 +741,7 @@ begin
begin begin
Context.Translate(R.Left, R.Top); Context.Translate(R.Left, R.Top);
Context.Rotate(-0.1 * Context.Font.Angle); Context.Rotate(-0.1 * Context.Font.Angle);
OffsetRect(R, -R.Left, -R.Top); Types.OffsetRect(R, -R.Left, -R.Top);
end; end;
if (Details.Element = teEdit) then if (Details.Element = teEdit) then

View File

@ -7408,7 +7408,7 @@ begin
begin begin
R1 := ARect^; R1 := ARect^;
QWidget_geometry(MDIAreaHandle.Widget, @R); QWidget_geometry(MDIAreaHandle.Widget, @R);
OffsetRect(R1, -R.Left, -R.Top); Types.OffsetRect(R1, -R.Left, -R.Top);
QWidget_update(MDIAreaHandle.viewportWidget, @R1); QWidget_update(MDIAreaHandle.viewportWidget, @R1);
end; end;
end else end else
@ -7428,7 +7428,7 @@ begin
begin begin
QRegion_boundingRect(ARgn, @R1); QRegion_boundingRect(ARgn, @R1);
QWidget_geometry(MDIAreaHandle.Widget, @R); QWidget_geometry(MDIAreaHandle.Widget, @R);
OffsetRect(R1, -R.Left, -R.Top); Types.OffsetRect(R1, -R.Left, -R.Top);
ANewRgn := QRegion_create(PRect(@R1)); ANewRgn := QRegion_create(PRect(@R1));
QWidget_update(MDIAreaHandle.viewportWidget, ANewRgn); QWidget_update(MDIAreaHandle.viewportWidget, ANewRgn);
QRegion_destroy(ANewRgn); QRegion_destroy(ANewRgn);
@ -7449,7 +7449,7 @@ begin
begin begin
R1 := ARect^; R1 := ARect^;
QWidget_geometry(MDIAreaHandle.Widget, @R); QWidget_geometry(MDIAreaHandle.Widget, @R);
OffsetRect(R1, -R.Left, -R.Top); Types.OffsetRect(R1, -R.Left, -R.Top);
QWidget_repaint(MDIAreaHandle.viewportWidget, @R1); QWidget_repaint(MDIAreaHandle.viewportWidget, @R1);
end; end;
end else end else
@ -8552,7 +8552,7 @@ begin
else else
R1 := Rect(0, 0, 0, 0); R1 := Rect(0, 0, 0, 0);
Result := R; Result := R;
OffsetRect(Result, -Result.Left, -Result.Top); Types.OffsetRect(Result, -Result.Left, -Result.Top);
{$IFNDEF HASX11} {$IFNDEF HASX11}
if testAttribute(QtWA_Mapped) and QWidget_testAttribute(FCentralWidget, QtWA_Mapped) then if testAttribute(QtWA_Mapped) and QWidget_testAttribute(FCentralWidget, QtWA_Mapped) then
QWidget_rect(FCentralWidget, @Result) QWidget_rect(FCentralWidget, @Result)
@ -8646,7 +8646,7 @@ begin
begin begin
P := getClientOffset; P := getClientOffset;
R := ARect^; R := ARect^;
OffsetRect(R, -P.X, -P.Y); Types.OffsetRect(R, -P.X, -P.Y);
QWidget_update(FCentralWidget, @R); QWidget_update(FCentralWidget, @R);
end else end else
QWidget_update(FCentralWidget); QWidget_update(FCentralWidget);
@ -8682,7 +8682,7 @@ begin
begin begin
P := getClientOffset; P := getClientOffset;
R := ARect^; R := ARect^;
OffsetRect(R, -P.X, -P.Y); Types.OffsetRect(R, -P.X, -P.Y);
QWidget_repaint(FCentralWidget, @R); QWidget_repaint(FCentralWidget, @R);
end else end else
QWidget_repaint(FCentralWidget); QWidget_repaint(FCentralWidget);
@ -10396,7 +10396,7 @@ begin
if Assigned(FOwner) then if Assigned(FOwner) then
begin begin
Pt := TabBarOffset; Pt := TabBarOffset;
OffsetRect(Result, Pt.X, Pt.Y); Types.OffsetRect(Result, Pt.X, Pt.Y);
end; end;
end; end;
@ -11691,7 +11691,7 @@ begin
end else end else
begin begin
ButtonRect := R; ButtonRect := R;
OffsetRect(ButtonRect, -R.Left, -R.Top); Types.OffsetRect(ButtonRect, -R.Left, -R.Top);
end; end;
if PtInRect(ButtonRect, Pt) then if PtInRect(ButtonRect, Pt) then
@ -17389,7 +17389,7 @@ begin
if HaveBar and (horizontalScrollBar.getVisibleTo(Widget)) then if HaveBar and (horizontalScrollBar.getVisibleTo(Widget)) then
dec(Result.Bottom, horizontalScrollBar.getHeight); dec(Result.Bottom, horizontalScrollBar.getHeight);
end; end;
OffsetRect(Result, -Result.Left, -Result.Top); Types.OffsetRect(Result, -Result.Left, -Result.Top);
{$IF DEFINED(VerboseQtResize) OR DEFINED(VerboseQScrollBarShowHide)} {$IF DEFINED(VerboseQtResize) OR DEFINED(VerboseQScrollBarShowHide)}
DebugLn('TQtAbstractScrollArea.GetClientBounds(not mapped): ',dbgsName(LCLObject),':',dbgsName(Self),' ',dbgs(Result),' ChildComplex=',dbgs(Ord(ChildOfComplexWidget))); DebugLn('TQtAbstractScrollArea.GetClientBounds(not mapped): ',dbgsName(LCLObject),':',dbgsName(Self),' ',dbgs(Result),' ChildComplex=',dbgs(Ord(ChildOfComplexWidget)));
{$ENDIF} {$ENDIF}
@ -17615,7 +17615,7 @@ begin
if ARect <> nil then if ARect <> nil then
begin begin
P := getClientOffset; P := getClientOffset;
OffsetRect(ARect^, -P.X , -P.Y); Types.OffsetRect(ARect^, -P.X , -P.Y);
QWidget_update(viewportWidget, ARect); QWidget_update(viewportWidget, ARect);
end else end else
QWidget_update(viewportWidget); QWidget_update(viewportWidget);
@ -17636,7 +17636,7 @@ begin
if ARect <> nil then if ARect <> nil then
begin begin
P := getClientOffset; P := getClientOffset;
OffsetRect(ARect^, -P.X , -P.Y); Types.OffsetRect(ARect^, -P.X , -P.Y);
QWidget_repaint(viewportWidget, ARect); QWidget_repaint(viewportWidget, ARect);
end else end else
QWidget_repaint(viewportWidget); QWidget_repaint(viewportWidget);
@ -18530,13 +18530,13 @@ begin
if R.Bottom-R.Top > D.Bottom-D.Top then // check height if R.Bottom-R.Top > D.Bottom-D.Top then // check height
R.Bottom := R.Top + D.Bottom-D.Top; R.Bottom := R.Top + D.Bottom-D.Top;
if R.Left < D.Left then if R.Left < D.Left then
OffsetRect(R, D.Left-R.Left, 0); Types.OffsetRect(R, D.Left-R.Left, 0);
if R.Top < D.Top then if R.Top < D.Top then
OffsetRect(R, 0, D.Top-R.Top); Types.OffsetRect(R, 0, D.Top-R.Top);
if (R.Right > D.Right) then if (R.Right > D.Right) then
OffsetRect(R, D.Right-R.Right, 0); Types.OffsetRect(R, D.Right-R.Right, 0);
if (R.Bottom > D.Bottom) then if (R.Bottom > D.Bottom) then
OffsetRect(R, 0, D.Bottom-R.Bottom); Types.OffsetRect(R, 0, D.Bottom-R.Bottom);
move(R.Left, R.Top); move(R.Left, R.Top);
end; end;

View File

@ -2608,7 +2608,7 @@ begin
if Handle = 0 then if Handle = 0 then
Exit(False); Exit(False);
GetClientBounds(Handle, ARect); GetClientBounds(Handle, ARect);
OffsetRect(ARect, -ARect.Left, -ARect.Top); Types.OffsetRect(ARect, -ARect.Left, -ARect.Top);
Result := True; Result := True;
end; end;
@ -4977,19 +4977,19 @@ begin
if Rect <> nil then if Rect <> nil then
begin begin
with TQtWidget(aHandle).getClientOffset do with TQtWidget(aHandle).getClientOffset do
OffsetRect(Rect^, x, y); Types.OffsetRect(Rect^, x, y);
{$IFDEF QTSCROLLABLEFORMS} {$IFDEF QTSCROLLABLEFORMS}
if (TQtWidget(AHandle) is TQtMainWindow) and Assigned(TQtMainWindow(AHandle).ScrollArea) then if (TQtWidget(AHandle) is TQtMainWindow) and Assigned(TQtMainWindow(AHandle).ScrollArea) then
begin begin
Pt := TQtMainWindow(AHandle).ScrollArea.ScrolledOffset; Pt := TQtMainWindow(AHandle).ScrollArea.ScrolledOffset;
OffsetRect(Rect^, -Pt.X, -Pt.Y); Types.OffsetRect(Rect^, -Pt.X, -Pt.Y);
end else end else
{$ENDIF} {$ENDIF}
if TQtWidget(AHandle).ChildOfComplexWidget = ccwScrollingWinControl then if TQtWidget(AHandle).ChildOfComplexWidget = ccwScrollingWinControl then
begin begin
Pt := TQtCustomControl(AHandle).viewport.ScrolledOffset; Pt := TQtCustomControl(AHandle).viewport.ScrolledOffset;
OffsetRect(Rect^, -Pt.X, -Pt.Y); Types.OffsetRect(Rect^, -Pt.X, -Pt.Y);
end; end;
// no need to handle bErase. Qt automatically erase rect on paint event according to docs // no need to handle bErase. Qt automatically erase rect on paint event according to docs
@ -7159,7 +7159,7 @@ begin
DstQDC.getClipping and DstQDC.getClipRegion.containsRect(SrcRect) then DstQDC.getClipping and DstQDC.getClipRegion.containsRect(SrcRect) then
begin begin
AClipRect := DstQDC.getClipRegion.getBoundingRect; AClipRect := DstQDC.getClipRegion.getBoundingRect;
OffsetRect(AClipRect, -AClipRect.Left, -AClipRect.Top); Types.OffsetRect(AClipRect, -AClipRect.Left, -AClipRect.Top);
if (DstRect.Right - DstRect.Left <= AClipRect.Right) and if (DstRect.Right - DstRect.Left <= AClipRect.Right) and
(DstRect.Bottom - DstRect.Top <= AClipRect.Bottom) and (DstRect.Bottom - DstRect.Top <= AClipRect.Bottom) and

View File

@ -27,7 +27,7 @@ uses
qtwidgets, qtobjects, qtproc, qtwidgets, qtobjects, qtproc,
// LCL // LCL
SysUtils, Classes, Types, ComCtrls, Controls, LCLType, Graphics, StdCtrls, SysUtils, Classes, Types, ComCtrls, Controls, LCLType, Graphics, StdCtrls,
LCLProc, LCLIntf, Forms, ImgList, LCLIntf, Forms, ImgList,
// Widgetset // Widgetset
WSProc, WSComCtrls, WSLCLClasses; WSProc, WSComCtrls, WSLCLClasses;
@ -1789,7 +1789,7 @@ begin
(QtTreeWidget.OwnerData or QtTreeWidget.OwnerDrawn) then (QtTreeWidget.OwnerData or QtTreeWidget.OwnerDrawn) then
begin begin
IconRect := Rect(0, 0, ImgListRes.Width, ImgListRes.Height); IconRect := Rect(0, 0, ImgListRes.Width, ImgListRes.Height);
OffsetRect(IconRect, Result.Left, Result.Top + APixelMetric); Types.OffsetRect(IconRect, Result.Left, Result.Top + APixelMetric);
end; end;
IconRect.Left += APixelMetric + (ChkBoxRect.Right - ChkBoxRect.Left); IconRect.Left += APixelMetric + (ChkBoxRect.Right - ChkBoxRect.Left);
IconRect.Right += APixelMetric; IconRect.Right += APixelMetric;

View File

@ -309,7 +309,7 @@ begin
Exit; Exit;
ARect := TQtWidget(AWinControl.Handle).getClientBounds; ARect := TQtWidget(AWinControl.Handle).getClientBounds;
OffsetRect(ARect, -ARect.Left, -ARect.Top); Types.OffsetRect(ARect, -ARect.Left, -ARect.Top);
Result := True; Result := True;
end; end;

View File

@ -1041,7 +1041,7 @@ begin
ASize.cy := 0; ASize.cy := 0;
// we must use real geometry, and then exclude menubar height. // we must use real geometry, and then exclude menubar height.
aClientRect := AWin.getGeometry; aClientRect := AWin.getGeometry;
OffsetRect(aClientRect, -aClientRect.Left, -aClientRect.Top); Types.OffsetRect(aClientRect, -aClientRect.Left, -aClientRect.Top);
dec(AClientRect.Bottom, ASize.cy); dec(AClientRect.Bottom, ASize.cy);
{$IFDEF VerboseQtResize} {$IFDEF VerboseQtResize}
DebugLn('TQtWSCustomForm.getDefaultClientRect ',dbgsName(AWinControl),' ',dbgs(AWin.getClientBounds),' mnuBarHeight ',dbgs(AWin.MenuBar.getHeight),' ASize=',dbgs(ASize),' FINAL=',dbgs(AClientRect)); DebugLn('TQtWSCustomForm.getDefaultClientRect ',dbgsName(AWinControl),' ',dbgs(AWin.getClientBounds),' mnuBarHeight ',dbgs(AWin.MenuBar.getHeight),' ASize=',dbgs(ASize),' FINAL=',dbgs(AClientRect));

View File

@ -2543,13 +2543,13 @@ var
theRect.Right := theRect.Left + Min(MaxWidth, AP.cX); theRect.Right := theRect.Left + Min(MaxWidth, AP.cX);
if (Flags and DT_VCENTER) > 0 then if (Flags and DT_VCENTER) > 0 then
begin begin
OffsetRect(theRect, 0, ((Rect.Bottom - Rect.Top) - Types.OffsetRect(theRect, 0, ((Rect.Bottom - Rect.Top) -
(theRect.Bottom - theRect.Top)) div 2); (theRect.Bottom - theRect.Top)) div 2);
end end
else else
if (Flags and DT_BOTTOM) > 0 then if (Flags and DT_BOTTOM) > 0 then
begin begin
OffsetRect(theRect, 0, (Rect.Bottom - Rect.Top) - Types.OffsetRect(theRect, 0, (Rect.Bottom - Rect.Top) -
(theRect.Bottom - theRect.Top)); (theRect.Bottom - theRect.Top));
end; end;
end; end;
@ -2592,12 +2592,12 @@ var
DT_CENTER: DT_CENTER:
begin begin
Offset := (Rect.Right - theRect.Right) div 2; Offset := (Rect.Right - theRect.Right) div 2;
OffsetRect(theRect, offset, 0); Types.OffsetRect(theRect, offset, 0);
end; end;
DT_RIGHT: DT_RIGHT:
begin begin
Offset := Rect.Right - theRect.Right; Offset := Rect.Right - theRect.Right;
OffsetRect(theRect, offset, 0); Types.OffsetRect(theRect, offset, 0);
end; end;
end; end;
end; end;
@ -2909,24 +2909,24 @@ begin
taRightJustify: taRightJustify:
begin begin
Offset := ARect.Right - fRect.Right; Offset := ARect.Right - fRect.Right;
OffsetRect(fRect, Offset, 0); Types.OffsetRect(fRect, Offset, 0);
end; end;
taCenter: taCenter:
begin begin
Offset := (ARect.Right - fRect.Right) div 2; Offset := (ARect.Right - fRect.Right) div 2;
OffsetRect(fRect, offset, 0); Types.OffsetRect(fRect, offset, 0);
end; end;
end; end;
case Style.Layout of case Style.Layout of
tlCenter: tlCenter:
begin begin
Offset := ((ARect.Bottom - ARect.Top) - (fRect.Bottom - fRect.Top)) div 2; Offset := ((ARect.Bottom - ARect.Top) - (fRect.Bottom - fRect.Top)) div 2;
OffsetRect(fRect, 0, offset); Types.OffsetRect(fRect, 0, offset);
end; end;
tlBottom: tlBottom:
begin begin
Offset := ARect.Bottom - fRect.Bottom; Offset := ARect.Bottom - fRect.Bottom;
OffsetRect(fRect, 0, offset); Types.OffsetRect(fRect, 0, offset);
end; end;
end; end;
end; end;

View File

@ -2456,10 +2456,10 @@ begin
else else
begin begin
Canvas.Font.Color := clBtnHighlight; Canvas.Font.Color := clBtnHighlight;
OffsetRect(R, 1, 1); Types.OffsetRect(R, 1, 1);
Canvas.TextRect(R, R.Left, R.Top, S, TXTStyle); Canvas.TextRect(R, R.Left, R.Top, S, TXTStyle);
Canvas.Font.Color := clBtnShadow; Canvas.Font.Color := clBtnShadow;
OffsetRect(R, -1, -1); Types.OffsetRect(R, -1, -1);
end; end;
if (Details.Element = teTreeview) and (Details.Part = TVP_TREEITEM) then if (Details.Element = teTreeview) and (Details.Part = TVP_TREEITEM) then
begin begin