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:
wp_xxyyzz
2014-11-04 21:56:24 +00:00
parent ae9f19553a
commit 2b4925f0a8
3 changed files with 30 additions and 30 deletions

View File

@ -510,8 +510,8 @@ type
FCells: TAvlTree; // Items are TCell
FCurrentNode: TAVLTreeNode; // For GetFirstCell and GetNextCell
FRows, FCols: TIndexedAVLTree; // This lists contain only rows or cols with styles different from default
FSelectedCellRow: Cardinal;
FSelectedCellCol: Cardinal;
FActiveCellRow: Cardinal;
FActiveCellCol: Cardinal;
FLeftPaneWidth: Integer;
FTopPaneHeight: Integer;
FOptions: TsSheetOptions;
@ -825,9 +825,9 @@ type
usage of frozen panes etc. }
property Options: TsSheetOptions read FOptions write FOptions;
{@@ 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 }
property SelectedCellRow: Cardinal read FSelectedCellRow;
property ActiveCellRow: Cardinal read FActiveCellRow;
{@@ Number of frozen columns which do not scroll }
property LeftPaneWidth: Integer read FLeftPaneWidth write FLeftPaneWidth;
{@@ Number of frozen rows which do not scroll }
@ -3524,10 +3524,10 @@ end;
-------------------------------------------------------------------------------}
procedure TsWorksheet.SelectCell(ARow, ACol: Cardinal);
begin
if (ARow <> FSelectedCellRow) or (ACol <> FSelectedCellCol) then
if (ARow <> FActiveCellRow) or (ACol <> FActiveCellCol) then
begin
FSelectedCellRow := ARow;
FSelectedCellCol := ACol;
FActiveCellRow := ARow;
FActiveCellCol := ACol;
if Assigned(FOnSelectCell) then FOnSelectCell(Self, ARow, ACol);
end;
end;

View File

@ -21,7 +21,7 @@ type
TsWorkbookSource = class(TComponent)
private
FWorkbook: TsWorkbook;
FSelectedWorksheet: TsWorksheet;
FWorksheet: TsWorksheet;
FListeners: TFPList;
FAutoDetectFormat: Boolean;
FFileName: TFileName;
@ -67,7 +67,7 @@ type
public
property Workbook: TsWorkbook read FWorkbook;
property SelectedWorksheet: TsWorksheet read FSelectedWorksheet;
property SelectedWorksheet: TsWorksheet read FWorksheet;
published
property AutoDetectFormat: Boolean read FAutoDetectFormat write FAutoDetectFormat;
@ -263,8 +263,8 @@ end;
procedure TsWorkbookSource.CellChangedHandler(Sender: TObject;
ARow, ACol: Cardinal);
begin
if FSelectedWorksheet <> nil then
NotifyListeners([lniCell], FSelectedWorksheet.FindCell(ARow, ACol));
if FWorksheet <> nil then
NotifyListeners([lniCell], FWorksheet.FindCell(ARow, ACol));
end;
{@@ ----------------------------------------------------------------------------
@ -289,8 +289,8 @@ end;
procedure TsWorkbookSource.CreateNewWorkbook;
begin
InternalCreateNewWorkbook;
FSelectedWorksheet := FWorkbook.AddWorksheet('Sheet1');
SelectWorksheet(FSelectedWorksheet);
FWorksheet := FWorkbook.AddWorksheet('Sheet1');
SelectWorksheet(FWorksheet);
// notify dependent controls
NotifyListeners([lniWorkbook, lniWorksheet, lniSelection]);
@ -313,7 +313,7 @@ end;
procedure TsWorkbookSource.InternalCreateNewWorkbook;
begin
FreeAndNil(FWorkbook);
FSelectedWorksheet := nil;
FWorksheet := nil;
FWorkbook := TsWorkbook.Create;
FWorkbook.OnAddWorksheet := @WorksheetAddedHandler;
FWorkbook.OnChangeWorksheet := @WorksheetChangedHandler;
@ -522,7 +522,7 @@ end;
procedure TsWorkbookSource.SelectCell(ASheetRow, ASheetCol: Cardinal);
begin
if SelectedWorksheet <> nil then
FSelectedWorksheet.SelectCell(ASheetRow, ASheetCol);
FWorksheet.SelectCell(ASheetRow, ASheetCol);
NotifyListeners([lniSelection]);
end;
@ -536,11 +536,11 @@ procedure TsWorkbookSource.SelectWorksheet(AWorkSheet: TsWorksheet);
begin
if AWorksheet = nil then
exit;
FSelectedWorksheet := AWorkSheet;
FSelectedWorksheet.OnChangeCell := @CellChangedHandler;
FSelectedWorksheet.OnSelectCell := @CellSelectedHandler;
FWorksheet := AWorkSheet;
FWorksheet.OnChangeCell := @CellChangedHandler;
FWorksheet.OnSelectCell := @CellSelectedHandler;
NotifyListeners([lniWorksheet]);
SelectCell(FSelectedWorksheet.SelectedCellRow, FSelectedWorksheet.SelectedCellCol);
SelectCell(FWorksheet.ActiveCellRow, FWorksheet.ActiveCellCol);
end;
{@@ ----------------------------------------------------------------------------
@ -617,7 +617,7 @@ var
begin
// It is very possible that the currently selected worksheet has been deleted.
// Look for the selected worksheet in the workbook. Does it still exist? ...
i := Workbook.GetWorksheetIndex(FSelectedWorksheet);
i := Workbook.GetWorksheetIndex(FWorksheet);
if i = -1 then
begin
// ... no - it must have been the sheet deleted.
@ -628,7 +628,7 @@ begin
else
sheet := Workbook.GetWorksheetbyIndex(ASheetIndex);
end else
sheet := FSelectedWorksheet;
sheet := FWorksheet;
NotifyListeners([lniWorkbook]);
SelectWorksheet(sheet);
end;
@ -799,8 +799,8 @@ var
begin
if Worksheet = nil then
exit;
r := Worksheet.SelectedCellRow;
c := Worksheet.SelectedCellCol;
r := Worksheet.ActiveCellRow;
c := Worksheet.ActiveCellCol;
s := Lines.Text;
if (s <> '') and (s[1] = '=') then
Worksheet.WriteFormula(r, c, Copy(s, 2, Length(s)), true)
@ -816,7 +816,7 @@ function TsCellEdit.GetSelectedCell: PCell;
begin
if (Worksheet <> nil) then
with Worksheet do
Result := FindCell(SelectedCellRow, SelectedCellCol)
Result := FindCell(ActiveCellRow, ActiveCellCol)
else
Result := nil;
end;
@ -977,7 +977,7 @@ procedure TsCellIndicator.ListenerNotification(AChangedItems: TsNotificationItem
begin
Unused(AData);
if (lniSelection in AChangedItems) and (Worksheet <> nil) then
Text := GetCellString(Worksheet.SelectedCellRow, Worksheet.SelectedCellCol)
Text := GetCellString(Worksheet.ActiveCellRow, Worksheet.ActiveCellCol)
else
Text := '';
end;
@ -1053,7 +1053,7 @@ begin
book := FWorkbookSource.Workbook;
sheet := FWorkbookSource.SelectedWorksheet;
if sheet <> nil then
cell := sheet.FindCell(sheet.SelectedCellRow, sheet.SelectedCellCol);
cell := sheet.FindCell(sheet.ActiveCellRow, sheet.ActiveCellCol);
end;
case FMode of
@ -1208,8 +1208,8 @@ begin
begin
if Worksheet <> nil then
begin
Strings.Add(Format('Row=%d', [Worksheet.SelectedCellRow]));
Strings.Add(Format('Col=%d', [Worksheet.SelectedCellCol]));
Strings.Add(Format('Row=%d', [Worksheet.ActiveCellRow]));
Strings.Add(Format('Col=%d', [Worksheet.ActiveCellCol]));
end else
begin
Strings.Add('Row=');

View File

@ -3166,8 +3166,8 @@ begin
// Selection changed
if (lniSelection in AChangedItems) and (Worksheet <> nil) then
begin
grow := GetGridRow(Worksheet.SelectedCellRow);
gcol := GetGridCol(Worksheet.SelectedCellCol);
grow := GetGridRow(Worksheet.ActiveCellRow);
gcol := GetGridCol(Worksheet.ActiveCellCol);
if (grow <> Row) or (gcol <> Col) then
MoveExtend(false, gcol, grow);
end;