Revert "Grids: uses const paramterers for strings where applicable. Patch by Alexey Torgashin. Issue #39851."

This reverts commit 72344a65f7.

These changes break compatibility (change signatures of virtual
methods), potentially unsafe (these strings can be potentially changed
through user callbacks and this will lead to crashes) and provide very
little (if at all) performance improvements.

(cherry picked from commit dbfbdee461)
This commit is contained in:
Maxim Ganetsky 2023-07-08 18:35:38 +03:00
parent 6045132105
commit 53aaae9c5e
2 changed files with 26 additions and 26 deletions

View File

@ -439,9 +439,9 @@ type
procedure DoOnChangeBounds; override;
procedure DoPrepareCanvas(aCol,aRow:Integer; aState: TGridDrawState); override;
procedure DoLoadColumn(sender: TCustomGrid; aColumn: TGridColumn; aColIndex: Integer;
aCfg: TXMLConfig; aVersion: Integer; const aPath: string); override;
aCfg: TXMLConfig; aVersion: Integer; aPath: string); override;
procedure DoSaveColumn(sender: TCustomGrid; aColumn: TGridColumn; aColIndex: Integer;
aCfg: TXMLConfig; aVersion: Integer; const aPath: string); override;
aCfg: TXMLConfig; aVersion: Integer; aPath: string); override;
procedure DrawAllRows; override;
procedure DrawFocusRect(aCol,aRow:Integer; ARect:TRect); override;
procedure DrawRow(ARow: Integer); override;
@ -552,9 +552,9 @@ type
function ExecuteAction(AAction: TBasicAction): Boolean; override;
function UpdateAction(AAction: TBasicAction): Boolean; override;
procedure SaveToFile(const FileName: string); override;
procedure SaveToFile(FileName: string); override;
procedure SaveToStream(AStream: TStream); override;
procedure LoadFromFile(const FileName: string); override;
procedure LoadFromFile(FileName: string); override;
procedure LoadFromStream(AStream: TStream); override;
property AllowOutboundEvents;
@ -2302,7 +2302,7 @@ begin
end;
procedure TCustomDBGrid.DoLoadColumn(sender: TCustomGrid; aColumn: TGridColumn;
aColIndex: Integer; aCfg: TXMLConfig; aVersion: Integer; const aPath: string);
aColIndex: Integer; aCfg: TXMLConfig; aVersion: Integer; aPath: string);
var
c: TColumn;
s: string;
@ -2318,7 +2318,7 @@ begin
end;
procedure TCustomDBGrid.DoSaveColumn(sender: TCustomGrid; aColumn: TGridColumn;
aColIndex: Integer; aCfg: TXMLConfig; aVersion: Integer; const aPath: string);
aColIndex: Integer; aCfg: TXMLConfig; aVersion: Integer; aPath: string);
var
c: TColumn;
begin
@ -3952,7 +3952,7 @@ begin
and DataLink.UpdateAction(AAction);
end;
procedure TCustomDBGrid.SaveToFile(const FileName: string);
procedure TCustomDBGrid.SaveToFile(FileName: string);
begin
SaveOptions:=[ soDesign ];
inherited SaveToFile(Filename);
@ -3964,7 +3964,7 @@ begin
inherited SaveToStream(AStream);
end;
procedure TCustomDBGrid.LoadFromFile(const FileName: string);
procedure TCustomDBGrid.LoadFromFile(FileName: string);
begin
SaveOptions:=[ soDesign ];
Include(FGridStatus, gsLoadingGrid);

View File

@ -1030,9 +1030,9 @@ type
procedure DoExit; override;
procedure DoEnter; override;
procedure DoLoadColumn(Sender: TCustomGrid; aColumn: TGridColumn; aColIndex: Integer;
aCfg: TXMLConfig; aVersion: Integer; const aPath: string); virtual;
aCfg: TXMLConfig; aVersion: Integer; aPath: string); virtual;
procedure DoSaveColumn(Sender: TCustomGrid; aColumn: TGridColumn; aColIndex: Integer;
aCfg: TXMLConfig; aVersion: Integer; const aPath: string); virtual;
aCfg: TXMLConfig; aVersion: Integer; aPath: string); virtual;
function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;
function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
@ -1057,7 +1057,7 @@ type
procedure DrawCellGrid(aCol,aRow: Integer; aRect: TRect; aState: TGridDrawState); virtual;
procedure DrawTextInCell(aCol,aRow: Integer; aRect: TRect; aState: TGridDrawState); virtual;
procedure DrawThemedCell(aCol,aRow: Integer; aRect: TRect; aState: TGridDrawState);
procedure DrawCellText(aCol,aRow: Integer; aRect: TRect; aState: TGridDrawState; const aText: String); virtual;
procedure DrawCellText(aCol,aRow: Integer; aRect: TRect; aState: TGridDrawState; aText: String); virtual;
procedure DrawGridCheckboxBitmaps(const aCol,aRow: Integer; const aRect: TRect;
const aState: TCheckboxState); virtual;
procedure DrawButtonCell(const aCol,aRow: Integer; aRect: TRect; const aState:TGridDrawState);
@ -1360,14 +1360,14 @@ type
procedure InvalidateRow(ARow: Integer);
function IsCellVisible(aCol, aRow: Integer): Boolean;
function IsFixedCellVisible(aCol, aRow: Integer): boolean;
procedure LoadFromFile(const FileName: string); virtual;
procedure LoadFromFile(FileName: string); virtual;
procedure LoadFromStream(AStream: TStream); virtual;
function MouseCoord(X,Y: Integer): TGridCoord;
function MouseToCell(const Mouse: TPoint): TPoint; overload;
procedure MouseToCell(X,Y: Integer; out ACol,ARow: Longint); overload;
function MouseToLogcell(Mouse: TPoint): TPoint;
function MouseToGridZone(X,Y: Integer): TGridZone;
procedure SaveToFile(const FileName: string); virtual;
procedure SaveToFile(FileName: string); virtual;
procedure SaveToStream(AStream: TStream); virtual;
procedure ScaleFontsPPI(const AToPPI: Integer; const AProportion: Double); override;
procedure SetFocus; override;
@ -1787,8 +1787,8 @@ type
procedure SaveContent(cfg: TXMLConfig); override;
//procedure DrawInteriorCells; override;
//procedure SelectEditor; override;
procedure SelectionSetText(const TheText: String);
procedure SelectionSetHTML(const TheHTML: String; TheText: String);
procedure SelectionSetText(TheText: String);
procedure SelectionSetHTML(TheHTML, TheText: String);
procedure SetCells(ACol, ARow: Integer; const AValue: string); virtual;
procedure SetCheckboxState(const aCol, aRow:Integer; const aState: TCheckboxState); override;
procedure SetEditText(aCol, aRow: Longint; const aValue: string); override;
@ -1809,11 +1809,11 @@ type
procedure InsertRowWithValues(Index: Integer; Values: array of String);
procedure LoadFromCSVStream(AStream: TStream; ADelimiter: Char=',';
UseTitles: boolean=true; FromLine: Integer=0; SkipEmptyLines: Boolean=true); virtual;
procedure LoadFromCSVFile(const AFilename: string; ADelimiter: Char=',';
procedure LoadFromCSVFile(AFilename: string; ADelimiter: Char=',';
UseTitles: boolean=true; FromLine: Integer=0; SkipEmptyLines: Boolean=true);
procedure SaveToCSVStream(AStream: TStream; ADelimiter: Char=',';
WriteTitles: boolean=true; VisibleColumnsOnly: boolean=false);
procedure SaveToCSVFile(const AFileName: string; ADelimiter: Char=',';
procedure SaveToCSVFile(AFileName: string; ADelimiter: Char=',';
WriteTitles: boolean=true; VisibleColumnsOnly: boolean=false);
property Cells[ACol, ARow: Integer]: string read GetCells write SetCells;
@ -4738,7 +4738,7 @@ begin
end;
procedure TCustomGrid.DrawCellText(aCol, aRow: Integer; aRect: TRect;
aState: TGridDrawState; const aText: String);
aState: TGridDrawState; aText: String);
var
Rtxt, Rrot, R: TRect;
angle: Double;
@ -7585,14 +7585,14 @@ begin
end;
procedure TCustomGrid.DoLoadColumn(Sender: TCustomGrid; aColumn: TGridColumn;
aColIndex: Integer; aCfg: TXMLConfig; aVersion: Integer; const aPath: string);
aColIndex: Integer; aCfg: TXMLConfig; aVersion: Integer; aPath: string);
begin
if Assigned(FOnLoadColumn) then
FOnLoadColumn(Self, aColumn, aColIndex, aCfg, aVersion, aPath);
end;
procedure TCustomGrid.DoSaveColumn(Sender: TCustomGrid; aColumn: TGridColumn;
aColIndex: Integer; aCfg: TXMLConfig; aVersion: Integer; const aPath: string);
aColIndex: Integer; aCfg: TXMLConfig; aVersion: Integer; aPath: string);
begin
if Assigned(FOnSaveColumn) then
FOnSaveColumn(Self, aColumn, aColIndex, aCfg, aVersion, aPath);
@ -10108,7 +10108,7 @@ begin
end;
end;
procedure TCustomGrid.LoadFromFile(const FileName: string);
procedure TCustomGrid.LoadFromFile(FileName: string);
var
Cfg: TXMLConfig;
begin
@ -10136,7 +10136,7 @@ begin
end;
end;
procedure TCustomGrid.SaveToFile(const FileName: string);
procedure TCustomGrid.SaveToFile(FileName: string);
var
Cfg: TXMLConfig;
begin
@ -11845,7 +11845,7 @@ begin
end;
end;
procedure TCustomStringGrid.SelectionSetText(const TheText: String);
procedure TCustomStringGrid.SelectionSetText(TheText: String);
var
StartCol,StartRow: Integer;
Stream: TStringStream;
@ -11885,7 +11885,7 @@ begin
end;
procedure TCustomStringGrid.SelectionSetHTML(const TheHTML: String; TheText: String);
procedure TCustomStringGrid.SelectionSetHTML(TheHTML, TheText: String);
var
bStartCol, bStartRow, bCol, bRow: Integer;
bCellStr: string;
@ -12263,7 +12263,7 @@ begin
end;
end;
procedure TCustomStringGrid.LoadFromCSVFile(const AFilename: string;
procedure TCustomStringGrid.LoadFromCSVFile(AFilename: string;
ADelimiter: Char=','; UseTitles: boolean=true; FromLine: Integer=0;
SkipEmptyLines: Boolean=true);
var
@ -12349,7 +12349,7 @@ begin
end;
end;
procedure TCustomStringGrid.SaveToCSVFile(const AFileName: string; ADelimiter: Char;
procedure TCustomStringGrid.SaveToCSVFile(AFileName: string; ADelimiter: Char;
WriteTitles: boolean=true; VisibleColumnsOnly: boolean=false);
var
TheStream: TFileStream;