mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-30 17:35:57 +02:00
LCL: Refactor for Grids a little more. Issue #35561, patch from Alexey Tor.
git-svn-id: trunk@61273 -
This commit is contained in:
parent
9528c8e182
commit
0ba03cbbc3
@ -1093,6 +1093,8 @@ type
|
||||
procedure InvalidateFocused;
|
||||
function IsColumnIndexValid(AIndex: Integer): boolean; inline;
|
||||
function IsRowIndexValid(AIndex: Integer): boolean; inline;
|
||||
function IsColumnIndexVariable(AIndex: Integer): boolean; inline;
|
||||
function IsRowIndexVariable(AIndex: Integer): boolean; inline;
|
||||
function GetIsCellTitle(aCol,aRow: Integer): boolean; virtual;
|
||||
function GetIsCellSelected(aCol, aRow: Integer): boolean; virtual;
|
||||
function IsEmptyRow(ARow: Integer): Boolean;
|
||||
@ -2563,6 +2565,16 @@ begin
|
||||
Result := (AIndex>=0) and (AIndex<RowCount);
|
||||
end;
|
||||
|
||||
function TCustomGrid.IsColumnIndexVariable(AIndex: Integer): boolean;
|
||||
begin
|
||||
Result := (AIndex>=FFixedCols) and (AIndex<ColCount);
|
||||
end;
|
||||
|
||||
function TCustomGrid.IsRowIndexVariable(AIndex: Integer): boolean;
|
||||
begin
|
||||
Result := (AIndex>=FFixedRows) and (AIndex<RowCount);
|
||||
end;
|
||||
|
||||
function TCustomGrid.GetColWidths(Acol: Integer): Integer;
|
||||
var
|
||||
C: TGridColumn;
|
||||
@ -6160,13 +6172,13 @@ begin
|
||||
Exit;
|
||||
end;
|
||||
if IsCol then begin
|
||||
if index>=FFixedCols then begin
|
||||
if IsColumnIndexVariable(Index) then begin
|
||||
StartPos:=StartPos-AccumWidth[FTopLeft.X] + FixedWidth;
|
||||
if GetSmoothScroll(SB_Horz) then
|
||||
StartPos := StartPos - TLColOff;
|
||||
end;
|
||||
end else begin
|
||||
if index>=FFixedRows then begin
|
||||
if IsRowIndexVariable(Index) then begin
|
||||
StartPos:=StartPos-AccumHeight[FTopLeft.Y] + FixedHeight;
|
||||
if GetSmoothScroll(SB_Vert) then
|
||||
StartPos := StartPos - TLRowOff;
|
||||
@ -7784,8 +7796,8 @@ begin
|
||||
SelOk:=SelectCell(NCol,NRow);
|
||||
Result:=False;
|
||||
while not SelOk do begin
|
||||
if (NRow+RInc>RowCount-1)or(NRow+RInc<FFixedRows) or
|
||||
(NCol+CInc>ColCount-1)or(NCol+CInc<FFixedCols) then Exit;
|
||||
if not IsRowIndexVariable(NRow+RInc) or
|
||||
not IsColumnIndexVariable(NCol+CInc) then Exit;
|
||||
Inc(NCol, CInc);
|
||||
Inc(NRow, RInc);
|
||||
SelOk:=SelectCell(NCol, NRow);
|
||||
@ -9522,8 +9534,8 @@ begin
|
||||
end;
|
||||
i:=Cfg.GetValue('grid/position/col',-1);
|
||||
j:=Cfg.GetValue('grid/position/row',-1);
|
||||
if (i>=FFixedCols)and(i<=ColCount-1) and
|
||||
(j>=FFixedRows)and(j<=RowCount-1) then begin
|
||||
if IsColumnIndexVariable(i) and
|
||||
IsRowIndexVariable(j) then begin
|
||||
MoveExtend(false, i,j, True);
|
||||
end;
|
||||
if goRangeSelect in Options then begin
|
||||
|
Loading…
Reference in New Issue
Block a user