mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 21:39:11 +02:00
lcl: grids: less withs for FPC 3.1.1
git-svn-id: trunk@50281 -
This commit is contained in:
parent
63a617d5db
commit
7d29d577e1
@ -3368,12 +3368,11 @@ begin
|
|||||||
[X,Y,Left,Top,Right,Bottom,XInc,YInc,TLColOff,TLRowOff]);
|
[X,Y,Left,Top,Right,Bottom,XInc,YInc,TLColOff,TLRowOff]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
with FTopLeft do
|
|
||||||
if ((XInc=0)and(YInc=0)) or // the cell is already visible
|
if ((XInc=0)and(YInc=0)) or // the cell is already visible
|
||||||
((X=aCol)and(Y=aRow)) or // the cell is visible by definition
|
((FTopLeft.X=aCol)and(FTopLeft.Y=aRow)) or // the cell is visible by definition
|
||||||
((X+XInc<0)or(Y+Yinc<0)) or // topleft can't be lower 0
|
((FTopLeft.X+XInc<0)or(FTopLeft.Y+Yinc<0)) or // topleft can't be lower 0
|
||||||
((X+XInc>=ColCount)) or // leftmost column can't be equal/higher than colcount
|
((FTopLeft.X+XInc>=ColCount)) or // leftmost column can't be equal/higher than colcount
|
||||||
((Y+Yinc>=RowCount)) // topmost column can't be equal/higher than rowcount
|
((FTopLeft.Y+Yinc>=RowCount)) // topmost column can't be equal/higher than rowcount
|
||||||
then
|
then
|
||||||
Break;
|
Break;
|
||||||
Inc(FTopLeft.x, XInc);
|
Inc(FTopLeft.x, XInc);
|
||||||
@ -5272,7 +5271,7 @@ end;
|
|||||||
{ Save to the cache the current visible grid (excluding fixed cells) }
|
{ Save to the cache the current visible grid (excluding fixed cells) }
|
||||||
procedure TCustomGrid.CacheVisibleGrid;
|
procedure TCustomGrid.CacheVisibleGrid;
|
||||||
var
|
var
|
||||||
R: TRect;
|
CellR, GridR: TRect;
|
||||||
begin
|
begin
|
||||||
with FGCache do begin
|
with FGCache do begin
|
||||||
VisibleGrid:=GetVisibleGrid;
|
VisibleGrid:=GetVisibleGrid;
|
||||||
@ -5282,20 +5281,20 @@ begin
|
|||||||
ValidGrid := ValidRows and ValidCols;
|
ValidGrid := ValidRows and ValidCols;
|
||||||
end;
|
end;
|
||||||
FullVisibleGrid := VisibleGrid;
|
FullVisibleGrid := VisibleGrid;
|
||||||
if ValidGrid then
|
if ValidGrid then begin
|
||||||
with FullVisibleGrid do begin
|
GridR := FullVisibleGrid;
|
||||||
if goSmoothScroll in Options then begin
|
if goSmoothScroll in Options then begin
|
||||||
if TLColOff>0 then
|
if TLColOff>0 then
|
||||||
Left := Min(Left+1, Right);
|
GridR.Left := Min(GridR.Left+1, GridR.Right);
|
||||||
if TLRowOff>0 then
|
if TLRowOff>0 then
|
||||||
Top := Min(Top+1, Bottom);
|
GridR.Top := Min(GridR.Top+1, GridR.Bottom);
|
||||||
end;
|
|
||||||
R := CellRect(Right, Bottom);
|
|
||||||
if R.Right>(ClientWidth+GetBorderWidth) then
|
|
||||||
Right := Max(Right-1, Left);
|
|
||||||
if R.Bottom>(ClientHeight+GetBorderWidth) then
|
|
||||||
Bottom := Max(Bottom-1, Top);
|
|
||||||
end;
|
end;
|
||||||
|
CellR := CellRect(GridR.Right, GridR.Bottom);
|
||||||
|
if CellR.Right>(ClientWidth+GetBorderWidth) then
|
||||||
|
GridR.Right := Max(GridR.Right-1, GridR.Left);
|
||||||
|
if CellR.Bottom>(ClientHeight+GetBorderWidth) then
|
||||||
|
GridR.Bottom := Max(GridR.Bottom-1, GridR.Top);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -7824,6 +7823,7 @@ end;
|
|||||||
procedure TCustomGrid.EditorPos;
|
procedure TCustomGrid.EditorPos;
|
||||||
var
|
var
|
||||||
msg: TGridMessage;
|
msg: TGridMessage;
|
||||||
|
CellR: TRect;
|
||||||
begin
|
begin
|
||||||
{$ifdef dbgGrid} DebugLn('Grid.EditorPos INIT');{$endif}
|
{$ifdef dbgGrid} DebugLn('Grid.EditorPos INIT');{$endif}
|
||||||
if FEditor<>nil then begin
|
if FEditor<>nil then begin
|
||||||
@ -7836,23 +7836,24 @@ begin
|
|||||||
FEditor.Dispatch(Msg);
|
FEditor.Dispatch(Msg);
|
||||||
|
|
||||||
// send editor bounds
|
// send editor bounds
|
||||||
Msg.CellRect:=CellRect(FCol,FRow);
|
CellR:=CellRect(FCol,FRow);
|
||||||
|
|
||||||
with msg.CellRect do
|
if (CellR.Top<FGCache.FixedHeight) or (CellR.Top>FGCache.ClientHeight) or
|
||||||
if (Top<FGCache.FixedHeight) or (Top>FGCache.ClientHeight) or
|
(UseRightToLeftAlignment and ((CellR.Right-1>FlipX(FGCache.FixedWidth)) or (CellR.Right<0))) or
|
||||||
(UseRightToLeftAlignment and ((Right-1>FlipX(FGCache.FixedWidth)) or (Right<0))) or
|
(not UseRightToLeftAlignment and ((CellR.Left<FGCache.FixedWidth) or (CellR.Left>FGCache.ClientWidth)))
|
||||||
(not UseRightToLeftAlignment and ((Left<FGCache.FixedWidth) or (Left>FGCache.ClientWidth))) then
|
then
|
||||||
// if editor will be out of sight, make the out of sight coords fixed
|
// if editor will be out of sight, make the out of sight coords fixed
|
||||||
// this should avoid range check errors on widgetsets that can't handle
|
// this should avoid range check errors on widgetsets that can't handle
|
||||||
// high control coords (like GTK2)
|
// high control coords (like GTK2)
|
||||||
Msg.CellRect := Bounds(-FEditor.Width-100, -FEditor.Height-100, Right-Left, Bottom-Top);
|
CellR := Bounds(-FEditor.Width-100, -FEditor.Height-100, CellR.Right-CellR.Left, CellR.Bottom-CellR.Top);
|
||||||
|
|
||||||
if FEditorOptions and EO_AUTOSIZE = EO_AUTOSIZE then begin
|
if FEditorOptions and EO_AUTOSIZE = EO_AUTOSIZE then begin
|
||||||
if EditorBorderStyle = bsNone then
|
if EditorBorderStyle = bsNone then
|
||||||
InflateRect(Msg.CellRect, -1, -1);
|
InflateRect(CellR, -1, -1);
|
||||||
FEditor.BoundsRect := Msg.CellRect;
|
FEditor.BoundsRect := CellR;
|
||||||
end else begin
|
end else begin
|
||||||
Msg.LclMsg.msg:=GM_SETBOUNDS;
|
Msg.LclMsg.msg:=GM_SETBOUNDS;
|
||||||
|
Msg.CellRect:=CellR;
|
||||||
Msg.Grid:=Self;
|
Msg.Grid:=Self;
|
||||||
Msg.Col:=FCol;
|
Msg.Col:=FCol;
|
||||||
Msg.Row:=FRow;
|
Msg.Row:=FRow;
|
||||||
@ -10806,7 +10807,7 @@ end;
|
|||||||
procedure TCustomStringGrid.Clean(aRect: TRect; CleanOptions: TGridZoneSet);
|
procedure TCustomStringGrid.Clean(aRect: TRect; CleanOptions: TGridZoneSet);
|
||||||
begin
|
begin
|
||||||
with aRect do
|
with aRect do
|
||||||
Clean(Left, Top, Right, Bottom, CleanOptions);
|
Clean(Left, Top, Right, Bottom, CleanOptions);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomStringGrid.Clean(StartCol, StartRow, EndCol, EndRow: integer;
|
procedure TCustomStringGrid.Clean(StartCol, StartRow, EndCol, EndRow: integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user