You've already forked lazarus-ccr
fpspreadsheet: Rename the new properties SelectedCellCol/Row of TsWorksheet to ActiveCellCol/Row - the "selected" will become a more general meaning soon. Rename the "SelectedWorksheet" of TsWorkbookSource to "Worksheet" (less typing). Sorry for the inconvenience...
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3703 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -510,8 +510,8 @@ type
|
|||||||
FCells: TAvlTree; // Items are TCell
|
FCells: TAvlTree; // Items are TCell
|
||||||
FCurrentNode: TAVLTreeNode; // For GetFirstCell and GetNextCell
|
FCurrentNode: TAVLTreeNode; // For GetFirstCell and GetNextCell
|
||||||
FRows, FCols: TIndexedAVLTree; // This lists contain only rows or cols with styles different from default
|
FRows, FCols: TIndexedAVLTree; // This lists contain only rows or cols with styles different from default
|
||||||
FSelectedCellRow: Cardinal;
|
FActiveCellRow: Cardinal;
|
||||||
FSelectedCellCol: Cardinal;
|
FActiveCellCol: Cardinal;
|
||||||
FLeftPaneWidth: Integer;
|
FLeftPaneWidth: Integer;
|
||||||
FTopPaneHeight: Integer;
|
FTopPaneHeight: Integer;
|
||||||
FOptions: TsSheetOptions;
|
FOptions: TsSheetOptions;
|
||||||
@ -825,9 +825,9 @@ type
|
|||||||
usage of frozen panes etc. }
|
usage of frozen panes etc. }
|
||||||
property Options: TsSheetOptions read FOptions write FOptions;
|
property Options: TsSheetOptions read FOptions write FOptions;
|
||||||
{@@ Column index of the selected cell of this worksheet }
|
{@@ Column index of the selected cell of this worksheet }
|
||||||
property SelectedCellCol: Cardinal read FSelectedCellCol;
|
property ActiveCellCol: Cardinal read FActiveCellCol;
|
||||||
{@@ Row index of the selected cell of this worksheet }
|
{@@ Row index of the selected cell of this worksheet }
|
||||||
property SelectedCellRow: Cardinal read FSelectedCellRow;
|
property ActiveCellRow: Cardinal read FActiveCellRow;
|
||||||
{@@ Number of frozen columns which do not scroll }
|
{@@ Number of frozen columns which do not scroll }
|
||||||
property LeftPaneWidth: Integer read FLeftPaneWidth write FLeftPaneWidth;
|
property LeftPaneWidth: Integer read FLeftPaneWidth write FLeftPaneWidth;
|
||||||
{@@ Number of frozen rows which do not scroll }
|
{@@ Number of frozen rows which do not scroll }
|
||||||
@ -3524,10 +3524,10 @@ end;
|
|||||||
-------------------------------------------------------------------------------}
|
-------------------------------------------------------------------------------}
|
||||||
procedure TsWorksheet.SelectCell(ARow, ACol: Cardinal);
|
procedure TsWorksheet.SelectCell(ARow, ACol: Cardinal);
|
||||||
begin
|
begin
|
||||||
if (ARow <> FSelectedCellRow) or (ACol <> FSelectedCellCol) then
|
if (ARow <> FActiveCellRow) or (ACol <> FActiveCellCol) then
|
||||||
begin
|
begin
|
||||||
FSelectedCellRow := ARow;
|
FActiveCellRow := ARow;
|
||||||
FSelectedCellCol := ACol;
|
FActiveCellCol := ACol;
|
||||||
if Assigned(FOnSelectCell) then FOnSelectCell(Self, ARow, ACol);
|
if Assigned(FOnSelectCell) then FOnSelectCell(Self, ARow, ACol);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -21,7 +21,7 @@ type
|
|||||||
TsWorkbookSource = class(TComponent)
|
TsWorkbookSource = class(TComponent)
|
||||||
private
|
private
|
||||||
FWorkbook: TsWorkbook;
|
FWorkbook: TsWorkbook;
|
||||||
FSelectedWorksheet: TsWorksheet;
|
FWorksheet: TsWorksheet;
|
||||||
FListeners: TFPList;
|
FListeners: TFPList;
|
||||||
FAutoDetectFormat: Boolean;
|
FAutoDetectFormat: Boolean;
|
||||||
FFileName: TFileName;
|
FFileName: TFileName;
|
||||||
@ -67,7 +67,7 @@ type
|
|||||||
|
|
||||||
public
|
public
|
||||||
property Workbook: TsWorkbook read FWorkbook;
|
property Workbook: TsWorkbook read FWorkbook;
|
||||||
property SelectedWorksheet: TsWorksheet read FSelectedWorksheet;
|
property SelectedWorksheet: TsWorksheet read FWorksheet;
|
||||||
|
|
||||||
published
|
published
|
||||||
property AutoDetectFormat: Boolean read FAutoDetectFormat write FAutoDetectFormat;
|
property AutoDetectFormat: Boolean read FAutoDetectFormat write FAutoDetectFormat;
|
||||||
@ -263,8 +263,8 @@ end;
|
|||||||
procedure TsWorkbookSource.CellChangedHandler(Sender: TObject;
|
procedure TsWorkbookSource.CellChangedHandler(Sender: TObject;
|
||||||
ARow, ACol: Cardinal);
|
ARow, ACol: Cardinal);
|
||||||
begin
|
begin
|
||||||
if FSelectedWorksheet <> nil then
|
if FWorksheet <> nil then
|
||||||
NotifyListeners([lniCell], FSelectedWorksheet.FindCell(ARow, ACol));
|
NotifyListeners([lniCell], FWorksheet.FindCell(ARow, ACol));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
{@@ ----------------------------------------------------------------------------
|
||||||
@ -289,8 +289,8 @@ end;
|
|||||||
procedure TsWorkbookSource.CreateNewWorkbook;
|
procedure TsWorkbookSource.CreateNewWorkbook;
|
||||||
begin
|
begin
|
||||||
InternalCreateNewWorkbook;
|
InternalCreateNewWorkbook;
|
||||||
FSelectedWorksheet := FWorkbook.AddWorksheet('Sheet1');
|
FWorksheet := FWorkbook.AddWorksheet('Sheet1');
|
||||||
SelectWorksheet(FSelectedWorksheet);
|
SelectWorksheet(FWorksheet);
|
||||||
|
|
||||||
// notify dependent controls
|
// notify dependent controls
|
||||||
NotifyListeners([lniWorkbook, lniWorksheet, lniSelection]);
|
NotifyListeners([lniWorkbook, lniWorksheet, lniSelection]);
|
||||||
@ -313,7 +313,7 @@ end;
|
|||||||
procedure TsWorkbookSource.InternalCreateNewWorkbook;
|
procedure TsWorkbookSource.InternalCreateNewWorkbook;
|
||||||
begin
|
begin
|
||||||
FreeAndNil(FWorkbook);
|
FreeAndNil(FWorkbook);
|
||||||
FSelectedWorksheet := nil;
|
FWorksheet := nil;
|
||||||
FWorkbook := TsWorkbook.Create;
|
FWorkbook := TsWorkbook.Create;
|
||||||
FWorkbook.OnAddWorksheet := @WorksheetAddedHandler;
|
FWorkbook.OnAddWorksheet := @WorksheetAddedHandler;
|
||||||
FWorkbook.OnChangeWorksheet := @WorksheetChangedHandler;
|
FWorkbook.OnChangeWorksheet := @WorksheetChangedHandler;
|
||||||
@ -522,7 +522,7 @@ end;
|
|||||||
procedure TsWorkbookSource.SelectCell(ASheetRow, ASheetCol: Cardinal);
|
procedure TsWorkbookSource.SelectCell(ASheetRow, ASheetCol: Cardinal);
|
||||||
begin
|
begin
|
||||||
if SelectedWorksheet <> nil then
|
if SelectedWorksheet <> nil then
|
||||||
FSelectedWorksheet.SelectCell(ASheetRow, ASheetCol);
|
FWorksheet.SelectCell(ASheetRow, ASheetCol);
|
||||||
NotifyListeners([lniSelection]);
|
NotifyListeners([lniSelection]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -536,11 +536,11 @@ procedure TsWorkbookSource.SelectWorksheet(AWorkSheet: TsWorksheet);
|
|||||||
begin
|
begin
|
||||||
if AWorksheet = nil then
|
if AWorksheet = nil then
|
||||||
exit;
|
exit;
|
||||||
FSelectedWorksheet := AWorkSheet;
|
FWorksheet := AWorkSheet;
|
||||||
FSelectedWorksheet.OnChangeCell := @CellChangedHandler;
|
FWorksheet.OnChangeCell := @CellChangedHandler;
|
||||||
FSelectedWorksheet.OnSelectCell := @CellSelectedHandler;
|
FWorksheet.OnSelectCell := @CellSelectedHandler;
|
||||||
NotifyListeners([lniWorksheet]);
|
NotifyListeners([lniWorksheet]);
|
||||||
SelectCell(FSelectedWorksheet.SelectedCellRow, FSelectedWorksheet.SelectedCellCol);
|
SelectCell(FWorksheet.ActiveCellRow, FWorksheet.ActiveCellCol);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
{@@ ----------------------------------------------------------------------------
|
||||||
@ -617,7 +617,7 @@ var
|
|||||||
begin
|
begin
|
||||||
// It is very possible that the currently selected worksheet has been deleted.
|
// It is very possible that the currently selected worksheet has been deleted.
|
||||||
// Look for the selected worksheet in the workbook. Does it still exist? ...
|
// Look for the selected worksheet in the workbook. Does it still exist? ...
|
||||||
i := Workbook.GetWorksheetIndex(FSelectedWorksheet);
|
i := Workbook.GetWorksheetIndex(FWorksheet);
|
||||||
if i = -1 then
|
if i = -1 then
|
||||||
begin
|
begin
|
||||||
// ... no - it must have been the sheet deleted.
|
// ... no - it must have been the sheet deleted.
|
||||||
@ -628,7 +628,7 @@ begin
|
|||||||
else
|
else
|
||||||
sheet := Workbook.GetWorksheetbyIndex(ASheetIndex);
|
sheet := Workbook.GetWorksheetbyIndex(ASheetIndex);
|
||||||
end else
|
end else
|
||||||
sheet := FSelectedWorksheet;
|
sheet := FWorksheet;
|
||||||
NotifyListeners([lniWorkbook]);
|
NotifyListeners([lniWorkbook]);
|
||||||
SelectWorksheet(sheet);
|
SelectWorksheet(sheet);
|
||||||
end;
|
end;
|
||||||
@ -799,8 +799,8 @@ var
|
|||||||
begin
|
begin
|
||||||
if Worksheet = nil then
|
if Worksheet = nil then
|
||||||
exit;
|
exit;
|
||||||
r := Worksheet.SelectedCellRow;
|
r := Worksheet.ActiveCellRow;
|
||||||
c := Worksheet.SelectedCellCol;
|
c := Worksheet.ActiveCellCol;
|
||||||
s := Lines.Text;
|
s := Lines.Text;
|
||||||
if (s <> '') and (s[1] = '=') then
|
if (s <> '') and (s[1] = '=') then
|
||||||
Worksheet.WriteFormula(r, c, Copy(s, 2, Length(s)), true)
|
Worksheet.WriteFormula(r, c, Copy(s, 2, Length(s)), true)
|
||||||
@ -816,7 +816,7 @@ function TsCellEdit.GetSelectedCell: PCell;
|
|||||||
begin
|
begin
|
||||||
if (Worksheet <> nil) then
|
if (Worksheet <> nil) then
|
||||||
with Worksheet do
|
with Worksheet do
|
||||||
Result := FindCell(SelectedCellRow, SelectedCellCol)
|
Result := FindCell(ActiveCellRow, ActiveCellCol)
|
||||||
else
|
else
|
||||||
Result := nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
@ -977,7 +977,7 @@ procedure TsCellIndicator.ListenerNotification(AChangedItems: TsNotificationItem
|
|||||||
begin
|
begin
|
||||||
Unused(AData);
|
Unused(AData);
|
||||||
if (lniSelection in AChangedItems) and (Worksheet <> nil) then
|
if (lniSelection in AChangedItems) and (Worksheet <> nil) then
|
||||||
Text := GetCellString(Worksheet.SelectedCellRow, Worksheet.SelectedCellCol)
|
Text := GetCellString(Worksheet.ActiveCellRow, Worksheet.ActiveCellCol)
|
||||||
else
|
else
|
||||||
Text := '';
|
Text := '';
|
||||||
end;
|
end;
|
||||||
@ -1053,7 +1053,7 @@ begin
|
|||||||
book := FWorkbookSource.Workbook;
|
book := FWorkbookSource.Workbook;
|
||||||
sheet := FWorkbookSource.SelectedWorksheet;
|
sheet := FWorkbookSource.SelectedWorksheet;
|
||||||
if sheet <> nil then
|
if sheet <> nil then
|
||||||
cell := sheet.FindCell(sheet.SelectedCellRow, sheet.SelectedCellCol);
|
cell := sheet.FindCell(sheet.ActiveCellRow, sheet.ActiveCellCol);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
case FMode of
|
case FMode of
|
||||||
@ -1208,8 +1208,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
if Worksheet <> nil then
|
if Worksheet <> nil then
|
||||||
begin
|
begin
|
||||||
Strings.Add(Format('Row=%d', [Worksheet.SelectedCellRow]));
|
Strings.Add(Format('Row=%d', [Worksheet.ActiveCellRow]));
|
||||||
Strings.Add(Format('Col=%d', [Worksheet.SelectedCellCol]));
|
Strings.Add(Format('Col=%d', [Worksheet.ActiveCellCol]));
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
Strings.Add('Row=');
|
Strings.Add('Row=');
|
||||||
|
@ -3166,8 +3166,8 @@ begin
|
|||||||
// Selection changed
|
// Selection changed
|
||||||
if (lniSelection in AChangedItems) and (Worksheet <> nil) then
|
if (lniSelection in AChangedItems) and (Worksheet <> nil) then
|
||||||
begin
|
begin
|
||||||
grow := GetGridRow(Worksheet.SelectedCellRow);
|
grow := GetGridRow(Worksheet.ActiveCellRow);
|
||||||
gcol := GetGridCol(Worksheet.SelectedCellCol);
|
gcol := GetGridCol(Worksheet.ActiveCellCol);
|
||||||
if (grow <> Row) or (gcol <> Col) then
|
if (grow <> Row) or (gcol <> Col) then
|
||||||
MoveExtend(false, gcol, grow);
|
MoveExtend(false, gcol, grow);
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user