From 792ce273a75e97f34f8e099caf7404aa25e091b4 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Fri, 30 Jun 2023 15:12:43 +0000 Subject: [PATCH] NiceGrid: Less hints and warnings. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8869 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../Basic Demo/Project_Lazarus/basic_demo.lpi | 164 +++++++++--------- components/nicegrid/source/nicegrid.pas | 22 ++- 2 files changed, 98 insertions(+), 88 deletions(-) diff --git a/components/nicegrid/demos/Basic Demo/Project_Lazarus/basic_demo.lpi b/components/nicegrid/demos/Basic Demo/Project_Lazarus/basic_demo.lpi index a5e2688e9..820f93c98 100644 --- a/components/nicegrid/demos/Basic Demo/Project_Lazarus/basic_demo.lpi +++ b/components/nicegrid/demos/Basic Demo/Project_Lazarus/basic_demo.lpi @@ -67,8 +67,8 @@ - - + + @@ -112,8 +112,8 @@ - - + + @@ -161,124 +161,126 @@ - + - + - - + + - + + - - + + - + - + - + - + + - + - + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/nicegrid/source/nicegrid.pas b/components/nicegrid/source/nicegrid.pas index 3647e7205..945876bd9 100644 --- a/components/nicegrid/source/nicegrid.pas +++ b/components/nicegrid/source/nicegrid.pas @@ -320,7 +320,7 @@ type procedure SetDefColWidth(Value: Integer); procedure SetDefRowHeight(Value: Integer); procedure SetFlat(Value: Boolean); - procedure SetColor(Value: TColor); + procedure SetColor(Value: TColor); reintroduce; procedure SetAlternateColor(Value: TColor); procedure SetGridColor(Value: TColor); procedure SetShowGrid(Value: Boolean); @@ -692,7 +692,11 @@ end; procedure TNiceGrid.SetScrollBar(AKind, AMax, APos, AMask: Integer); var Info: TScrollInfo; begin + {$IFDEF FPC} + Info := Default(TScrollInfo); + {$ELSE} FillChar(Info, SizeOf(TScrollInfo), 0); + {$ENDIF} Info.cbSize := SizeOf(TScrollInfo); Info.nMin := 0; Info.nMax := AMax; @@ -1153,12 +1157,13 @@ var begin if (FGutterKind = gkNone) then Exit; - CopyRect(GutterBox, CellBox); + GutterBox := CellBox; GutterBox.Left := 0; for x := 0 to FRowCount-1 do begin R := Rect(-1, (x * FDefRowHeight) - 1, FGutterWidth, ((x + 1) * FDefRowHeight)); OffsetRect(R, 0, -FVertOffset + FixedHeight); + Dummy := Rect(0, 0, 0, 0); // to silence the compiler if IntersectRect(Dummy, R, GutterBox) then begin case FGutterKind of @@ -1209,6 +1214,7 @@ begin FDefRowHeight * (P^.Rc.Bottom + 1) ); OffsetRect(R, -FHorzOffset + FixedWidth, 0); + Dummy := Rect(0, 0, 0, 0); // to silence the compiler if IntersectRect(Dummy, R, ClientRect) then DrawFixCell(R, P^.Str, FHeaderFont, FOnDrawHeader); end; @@ -1229,6 +1235,7 @@ begin begin R := Rect(GetColCoord(x)-1, FooterTop, GetColCoord(x+1), FooterBottom); OffsetRect(R, -FHorzOffset + FixedWidth, 0); + Dummy := Rect(0, 0, 0, 0); // to silence the compiler if IntersectRect(Dummy, R, ClientRect) then DrawFixCell(R, FColumns[x].FFooter, FFooterFont, FOnDrawFooter); end; @@ -1241,14 +1248,14 @@ end; procedure TNiceGrid.DrawCell(X, Y: Integer); var - R, Rc, Dummy: TRect; + Rc, Dummy: TRect; Column: TNiceColumn; Handled: Boolean; begin Handled := False; Rc := GetCellRect(x, y); OffsetRect(Rc, -FHorzOffset + FixedWidth, -FVertOffset + FixedHeight); - R := Rc; + Dummy := Rect(0, 0, 0, 0); // to silence the compiler if IntersectRect(Dummy, Rc, CellBox) then begin Column := FColumns[x]; @@ -1297,6 +1304,7 @@ begin Result := Point(-1, -1); R := GetCellRect(x, y); OffsetRect(R, -FHorzOffset + FixedWidth, -FVertOffset + FixedHeight); + Dummy := Rect(0, 0, 0, 0); // to silence the compiler if IntersectRect(Dummy, R, CellBox) then begin Column := FColumns[x]; @@ -3678,7 +3686,7 @@ var begin for x := 0 to Mergeds.Count-1 do begin - CopyRect(Rc, TMergeCell(Mergeds[x]).Rc); + Rc := TMergeCell(Mergeds[x]).Rc; for y := Rc.Left to Rc.Right do begin if (y >= FColumns.Count) @@ -3695,7 +3703,7 @@ end; procedure TNiceGrid.DrawMergedCell(Index: Integer); var Data: TMergeCell; - R, Rc, Dummy: TRect; + Rc, Dummy: TRect; l1, l2, t, h: Integer; begin Data := TMergeCell(Mergeds[Index]); @@ -3705,7 +3713,7 @@ begin h := FDefRowHeight * (Data.Rc.Bottom - Data.Rc.Top + 1); Rc := Rect(l1-1, t-1, l2, t+h); OffsetRect(Rc, -FHorzOffset + FixedWidth, -FVertOffset + FixedHeight); - R := Rc; + Dummy := Rect(0, 0, 0, 0); // to silence the compiler if IntersectRect(Dummy, Rc, CellBox) then begin with Canvas do