fpspreadsheet: Modify TsCellInspector to show size of last selected block. Restructure menu of fpsctrls demo.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3841 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2014-12-16 18:28:41 +00:00
parent 737808f57b
commit 42b8235d52
5 changed files with 637 additions and 722 deletions

File diff suppressed because it is too large Load Diff

View File

@ -122,7 +122,7 @@ type
MenuItem6: TMenuItem;
MenuItem7: TMenuItem;
MenuItem8: TMenuItem;
MenuItem9: TMenuItem;
MnuFormat: TMenuItem;
MnuFile: TMenuItem;
MnuWorksheet: TMenuItem;
MnuAddSheet: TMenuItem;

View File

@ -361,111 +361,6 @@ type
property Visible;
end;
(*
{ TsCellFontCombobox }
{@@ TsCellFontCombobox is a combobox for selecting various font properties }
TsCellFontCombobox = class(TsCellCombobox)
protected
function GetCellFont(ACell: PCell): TsFont;
published
{ inherited properties }
property Align;
property Anchors;
property ArrowKeysTraverseList;
property AutoComplete;
property AutoCompleteText;
property AutoDropDown;
property AutoSelect;
property AutoSize;// Note: windows has a fixed height in some styles
property BidiMode;
property BorderSpacing;
property BorderStyle;
property CharCase;
property Color;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property DropDownCount;
property Enabled;
property Font;
// property ItemHeight;
property ItemIndex;
// property Items;
property ItemWidth;
property MaxLength;
property OnChange;
property OnChangeBounds;
property OnClick;
property OnCloseUp;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnDrawItem;
property OnEndDrag;
property OnDropDown;
property OnEditingDone;
property OnEnter;
property OnExit;
property OnGetItems;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMeasureItem;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnMouseWheel;
property OnMouseWheelDown;
property OnMouseWheelUp;
property OnSelect;
property OnStartDrag;
property OnUTF8KeyPress;
property ParentBidiMode;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
// property ReadOnly;
property ShowHint;
property Sorted;
// property Style;
property TabOrder;
property TabStop;
property Text;
property Visible;
end;
{TsFontNameCombobox }
{@@ TsCellFontNameCombobox is for selection of a font name }
TsFontNameCombobox = class(TsCellFontCombobox)
protected
procedure ApplyFormatToCell(ACell: PCell); override;
procedure ExtractFromCell(ACell: PCell); override;
procedure Populate; override;
public
constructor Create(AOwner: TComponent); override;
end;
{TsFontSizeCombobox }
{@@ TsFontSizeCombobox is for selection of a font size }
TsFontSizeCombobox = class(TsCellFontCombobox)
protected
procedure ApplyFormatToCell(ACell: PCell); override;
procedure ExtractFromCell(ACell: PCell); override;
procedure Populate; override;
public
constructor Create(AOwner: TComponent); override;
end; *)
{ TsSpreadsheetInspector }
@ -1553,10 +1448,26 @@ end;
-------------------------------------------------------------------------------}
procedure TsCellIndicator.ListenerNotification(AChangedItems: TsNotificationItems;
AData: Pointer = nil);
var
sel: TsCellRangeArray;
s: String;
rng: TsCellRange;
numrows, numcols: Integer;
begin
Unused(AData);
if (lniSelection in AChangedItems) and (Worksheet <> nil) then
Text := GetCellString(Worksheet.ActiveCellRow, Worksheet.ActiveCellCol);
begin
s := GetCellString(Worksheet.ActiveCellRow, Worksheet.ActiveCellCol);
sel := Worksheet.GetSelection;
if Length(sel) > 0 then begin
rng := sel[High(sel)];
numrows := rng.Row2 - rng.Row1 + 1;
numcols := rng.Col2 - rng.Col1 + 1;
if (numrows <> 1) or (numcols <> 1) then
s := Format('%s (%d R x %d C)', [s, rng.Row2-rng.Row1+1, rng.Col2-rng.Col1+1]);
end;
Text := s;
end;
end;
{@@ ----------------------------------------------------------------------------

View File

@ -32,7 +32,7 @@ type
{ TsCustomWorksheetGrid }
{@@ TsCustomWorksheetGrid is the ancestor of TsWorkseetGrid and is able to
{@@ TsCustomWorksheetGrid is the ancestor of TsWorksheetGrid and is able to
display spreadsheet data along with their formatting. }
TsCustomWorksheetGrid = class(TCustomDrawGrid)
private
@ -3109,7 +3109,7 @@ end;
{@@ ----------------------------------------------------------------------------
Standard method inherited from TCustomGrid.
Notfies the WorkbookSource of the changed selected cell.
Notifies the WorkbookSource of the changed selected cell.
Repaints the grid after moving selection to avoid spurious rests of the
old thick selection border.
-------------------------------------------------------------------------------}

View File

@ -82,7 +82,8 @@ function ParseCellColString(const AStr: string;
out AResult: Cardinal): Boolean;
function GetColString(AColIndex: Integer): String;
function GetCellString(ARow,ACol: Cardinal; AFlags: TsRelFlags = [rfRelRow, rfRelCol]): String;
function GetCellString(ARow,ACol: Cardinal;
AFlags: TsRelFlags = [rfRelRow, rfRelCol]): String;
function GetCellRangeString(ARow1, ACol1, ARow2, ACol2: Cardinal;
AFlags: TsRelFlags = [rfRelRow, rfRelCol, rfRelRow2, rfRelCol2];
Compact: Boolean = false): String;
@ -733,6 +734,9 @@ end;
@param ACol2 Zero-based index of the last column in the range
@param AFlags A set containing an entry for first and last column and
row if their addresses are relative.
@param Compact If the range consists only of a single cell and compact
is true then the simple cell string is returned (e.g. A1).
If compact is false then the cell is repeated (e.g. A1:A1)
@return Excel type of cell address range containing '$' characters for absolute
address parts and a ':' to separate the first and last cells of the
range