mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 10:18:15 +02:00
Replace locally implement operator overload for method comparison by already available SameMethod. Proposed by n7800 in MR !431
This commit is contained in:
parent
48e844f7f6
commit
4e939b31dd
@ -301,7 +301,7 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
LResources, Math, PropEdits,
|
||||
LResources, Math, LazMethodList, PropEdits,
|
||||
TAChartStrConsts, TAGeometry, TAMath;
|
||||
|
||||
var
|
||||
@ -1182,14 +1182,14 @@ end;
|
||||
|
||||
procedure TChartAxis.SetOnGetMarkText(AValue: TChartGetAxisMarkTextEvent);
|
||||
begin
|
||||
if TMethod(FOnGetMarkText) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnGetMarkText), TMethod(AValue)) then exit;
|
||||
FOnGetMarkText := AValue;
|
||||
StyleChanged(Self);
|
||||
end;
|
||||
|
||||
procedure TChartAxis.SetOnMarkToText(AValue: TChartAxisMarkToTextEvent);
|
||||
begin
|
||||
if TMethod(FOnMarkToText) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnMarkToText), TMethod(AValue)) then exit;
|
||||
FOnMarkToText := AValue;
|
||||
StyleChanged(Self);
|
||||
end;
|
||||
|
@ -31,7 +31,7 @@ interface
|
||||
|
||||
uses
|
||||
Classes, Controls, SysUtils, Types, Math,
|
||||
StdCtrls, Graphics, LCLIntf, LCLType, Themes,
|
||||
StdCtrls, Graphics, LCLIntf, LCLType, LazMethodList, Themes,
|
||||
IntegerList, LazUTF8,
|
||||
TAChartUtils, TACustomSeries, TALegend, TAGraph,
|
||||
TACustomSource, TADrawerCanvas, TADrawUtils, TAEnumerators, TAGeometry;
|
||||
@ -732,14 +732,14 @@ end;
|
||||
|
||||
procedure TChartListbox.SetOnAddSeries(AValue: TChartListboxAddSeriesEvent);
|
||||
begin
|
||||
if TMethod(FOnAddSeries) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnAddSeries), TMethod(AValue)) then exit;
|
||||
FOnAddSeries := AValue;
|
||||
Populate;
|
||||
end;
|
||||
|
||||
procedure TChartListbox.SetOnPopulate(AValue: TNotifyEvent);
|
||||
begin
|
||||
if TMethod(FOnPopulate) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnPopulate), TMethod(AValue)) then exit;
|
||||
FOnPopulate := AValue;
|
||||
Populate;
|
||||
end;
|
||||
|
@ -397,8 +397,6 @@ procedure UpdateMinMax(AValue: Integer; var AMin, AMax: Integer); overload;
|
||||
|
||||
function WeightedAverage(AX1, AX2, ACoeff: Double): Double; inline;
|
||||
|
||||
operator =(const A, B: TMethod): Boolean; overload; inline;
|
||||
|
||||
var
|
||||
DrawData: TDrawDataRegistry;
|
||||
ShowMessageProc: TShowMessageProc;
|
||||
@ -407,7 +405,7 @@ var
|
||||
implementation
|
||||
|
||||
uses
|
||||
StrUtils, TypInfo, TAChartStrConsts;
|
||||
StrUtils, TypInfo, LazMethodList, TAChartStrConsts;
|
||||
|
||||
function BoundsSize(ALeft, ATop: Integer; ASize: TSize): TRect; inline;
|
||||
begin
|
||||
@ -682,10 +680,6 @@ begin
|
||||
Result := AX1 * (1 - ACoeff) + AX2 * ACoeff;
|
||||
end;
|
||||
|
||||
operator = (const A, B: TMethod): Boolean;
|
||||
begin
|
||||
Result := (A.Code = B.Code) and (A.Data = B.Data);
|
||||
end;
|
||||
|
||||
{ THistory }
|
||||
|
||||
@ -870,7 +864,7 @@ end;
|
||||
|
||||
procedure TIntervalList.SetOnChange(AValue: TNotifyEvent);
|
||||
begin
|
||||
if TMethod(FOnChange) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnChange), TMethod(AValue)) then exit;
|
||||
FOnChange := AValue;
|
||||
end;
|
||||
|
||||
|
@ -370,7 +370,7 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math, PropEdits, StrUtils, LResources, Types, GraphUtil,
|
||||
Math, PropEdits, StrUtils, LResources, LazMethodList, Types, GraphUtil,
|
||||
TAChartStrConsts, TAGeometry, TAMath;
|
||||
|
||||
function CreateLazIntfImage(
|
||||
@ -1118,14 +1118,14 @@ end;
|
||||
|
||||
procedure TChartSeries.SetOnGetMark(AValue: TChartGetMarkEvent);
|
||||
begin
|
||||
if TMethod(FOnGetMark) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnGetMark), TMethod(AValue)) then exit;
|
||||
FOnGetMark := AValue;
|
||||
UpdateParentChart;
|
||||
end;
|
||||
|
||||
procedure TChartSeries.SetOnGetMarkText(AValue: TChartGetMarkTextEvent);
|
||||
begin
|
||||
if TMethod(FOnGetMarkText) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnGetMarkText), TMethod(AValue)) then exit;
|
||||
FOnGetMarkText := AValue;
|
||||
UpdateParentChart;
|
||||
end;
|
||||
|
@ -82,7 +82,7 @@ procedure Register;
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math, SysUtils, DateUtils, TAMath;
|
||||
Math, SysUtils, DateUtils, LazMethodList, TAMath;
|
||||
|
||||
type
|
||||
|
||||
@ -345,7 +345,7 @@ end;
|
||||
|
||||
procedure TDbChartSource.SetOnGetItem(AValue: TDbChartSourceGetItemEvent);
|
||||
begin
|
||||
if TMethod(FOnGetItem) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnGetItem), TMethod(AValue)) then exit;
|
||||
FOnGetItem := AValue;
|
||||
Reset;
|
||||
end;
|
||||
|
@ -499,7 +499,7 @@ implementation
|
||||
|
||||
uses
|
||||
ipf,
|
||||
GraphType, GraphUtil, Math, spe, StrUtils, SysUtils,
|
||||
GraphType, GraphUtil, Math, spe, StrUtils, SysUtils, LazMethodList,
|
||||
TAChartStrConsts, TAGeometry, TAGraph, TAMath;
|
||||
|
||||
const
|
||||
@ -776,7 +776,7 @@ end;
|
||||
|
||||
procedure TFuncSeries.SetOnCalculate(AValue: TFuncCalculateEvent);
|
||||
begin
|
||||
if TMethod(FOnCalculate) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnCalculate), TMethod(AValue)) then exit;
|
||||
FOnCalculate := AValue;
|
||||
UpdateParentChart;
|
||||
end;
|
||||
@ -897,7 +897,7 @@ end;
|
||||
procedure TParametricCurveSeries.SetOnCalculate(
|
||||
AValue: TParametricCurveCalculateEvent);
|
||||
begin
|
||||
if TMethod(FOnCalculate) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnCalculate), TMethod(AValue)) then exit;
|
||||
FOnCalculate := AValue;
|
||||
UpdateParentChart;
|
||||
end;
|
||||
@ -2879,7 +2879,7 @@ end;
|
||||
|
||||
procedure TColorMapSeries.SetOnCalculate(AValue: TFuncCalculate3DEvent);
|
||||
begin
|
||||
if TMethod(FOnCalculate) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnCalculate), TMethod(AValue)) then exit;
|
||||
FOnCalculate := AValue;
|
||||
InvalidateBufferImage;
|
||||
UpdateParentChart;
|
||||
|
@ -525,7 +525,7 @@ implementation
|
||||
|
||||
uses
|
||||
Math, Types,
|
||||
Clipbrd, Dialogs, LResources,
|
||||
Clipbrd, Dialogs, LResources, LazMethodList,
|
||||
TADrawerCanvas, TAGeometry, TAMath, TAStyles;
|
||||
|
||||
const
|
||||
@ -1835,77 +1835,77 @@ end;
|
||||
|
||||
procedure TChart.SetOnAfterDraw(AValue: TChartDrawEvent);
|
||||
begin
|
||||
if TMethod(FOnAfterDraw) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnAfterDraw), TMethod(AValue)) then exit;
|
||||
FOnAfterDraw := AValue;
|
||||
StyleChanged(Self);
|
||||
end;
|
||||
|
||||
procedure TChart.SetOnAfterCustomDrawBackground(AValue: TChartAfterCustomDrawEvent);
|
||||
begin
|
||||
if TMethod(FOnAfterCustomDrawBackground) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnAfterCustomDrawBackground), TMethod(AValue)) then exit;
|
||||
FOnAfterCustomDrawBackground := AValue;
|
||||
StyleChanged(Self);
|
||||
end;
|
||||
|
||||
procedure TChart.SetOnAfterCustomDrawBackWall(AValue: TChartAfterCustomDrawEvent);
|
||||
begin
|
||||
if TMethod(FOnAfterCustomDrawBackWall) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnAfterCustomDrawBackWall), TMethod(AValue)) then exit;
|
||||
FOnAfterCustomDrawBackWall := AValue;
|
||||
StyleChanged(Self);
|
||||
end;
|
||||
|
||||
procedure TChart.SetOnAfterDrawBackground(AValue: TChartAfterDrawEvent);
|
||||
begin
|
||||
if TMethod(FOnAfterDrawBackground) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnAfterDrawBackground), TMethod(AValue)) then exit;
|
||||
FOnAfterDrawBackground := AValue;
|
||||
StyleChanged(Self);
|
||||
end;
|
||||
|
||||
procedure TChart.SetOnAfterDrawBackWall(AValue: TChartAfterDrawEvent);
|
||||
begin
|
||||
if TMethod(FOnAfterDrawBackWall) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnAfterDrawBackWall), TMethod(AValue)) then exit;
|
||||
FOnAfterDrawBackWall := AValue;
|
||||
StyleChanged(Self);
|
||||
end;
|
||||
|
||||
procedure TChart.SetOnBeforeCustomDrawBackground(AValue: TChartBeforeCustomDrawEvent);
|
||||
begin
|
||||
if TMethod(FOnBeforeCustomDrawBackground) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnBeforeCustomDrawBackground), TMethod(AValue)) then exit;
|
||||
FOnBeforeCustomDrawBackground := AValue;
|
||||
StyleChanged(Self);
|
||||
end;
|
||||
|
||||
procedure TChart.SetOnBeforeCustomDrawBackWall(AValue: TChartBeforeCustomDrawEvent);
|
||||
begin
|
||||
if TMethod(FOnBeforeCustomDrawBackWall) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnBeforeCustomDrawBackWall), TMethod(AValue)) then exit;
|
||||
FOnBeforeCustomDrawBackWall := AValue;
|
||||
StyleChanged(Self);
|
||||
end;
|
||||
|
||||
procedure TChart.SetOnBeforeDrawBackground(AValue: TChartBeforeDrawEvent);
|
||||
begin
|
||||
if TMethod(FOnBeforeDrawBackground) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnBeforeDrawBackground), TMethod(AValue)) then exit;
|
||||
FOnBeforeDrawBackground := AValue;
|
||||
StyleChanged(Self);
|
||||
end;
|
||||
|
||||
procedure TChart.SetOnBeforeDrawBackWall(AValue: TChartBeforeDrawEvent);
|
||||
begin
|
||||
if TMethod(FOnBeforeDrawBackWall) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnBeforeDrawBackWall), TMethod(AValue)) then exit;
|
||||
FOnBeforeDrawBackWall := AValue;
|
||||
StyleChanged(Self);
|
||||
end;
|
||||
|
||||
procedure TChart.SetOnChartPaint(AValue: TChartPaintEvent);
|
||||
begin
|
||||
if TMethod(FOnChartPaint) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnChartPaint), TMethod(AValue)) then exit;
|
||||
FOnChartPaint := AValue;
|
||||
StyleChanged(Self);
|
||||
end;
|
||||
|
||||
procedure TChart.SetOnDrawLegend(AValue: TChartDrawLegendEvent);
|
||||
begin
|
||||
if TMethod(FOnDrawLegend) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnDrawLegend), TMethod(AValue)) then exit;
|
||||
FOnDrawLegend := AValue;
|
||||
StyleChanged(self);
|
||||
end;
|
||||
|
@ -339,7 +339,7 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math, PropEdits, Types, LResources,
|
||||
Math, PropEdits, Types, LResources, LazMethodList,
|
||||
TADrawerCanvas, TAGeometry;
|
||||
|
||||
const
|
||||
@ -1206,14 +1206,14 @@ end;
|
||||
|
||||
procedure TChartSeriesLegend.SetOnDraw(AValue: TLegendItemDrawEvent);
|
||||
begin
|
||||
if TMethod(FOnDraw) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnDraw), TMethod(AValue)) then exit;
|
||||
FOnDraw := AValue;
|
||||
StyleChanged(Self);
|
||||
end;
|
||||
|
||||
procedure TChartSeriesLegend.SetOnCreate(AValue: TLegendItemCreateEvent);
|
||||
begin
|
||||
if TMethod(FOnCreate) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnCreate), TMethod(AValue)) then exit;
|
||||
FOnCreate := AValue;
|
||||
StyleChanged(Self);
|
||||
end;
|
||||
|
@ -220,7 +220,7 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math,
|
||||
Math, LazMethodList,
|
||||
TAChartStrConsts, TATypes, TACustomSource, TAGeometry, TAGraph;
|
||||
|
||||
const
|
||||
@ -901,7 +901,7 @@ end;
|
||||
|
||||
procedure TCustomPieSeries.SetOnCustomDrawPie(AValue: TCustomDrawPieEvent);
|
||||
begin
|
||||
if TMethod(FOnCustomDrawPie) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnCustomDrawPie), TMethod(AValue)) then exit;
|
||||
FOnCustomDrawPie := AValue;
|
||||
UpdateParentChart;
|
||||
end;
|
||||
|
@ -410,7 +410,7 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
{GraphMath,} GraphType, IntfGraphics, LResources, Math, PropEdits, SysUtils,
|
||||
GraphType, IntfGraphics, LResources, LazMethodList, Math, PropEdits, SysUtils,
|
||||
TAChartStrConsts, TADrawerCanvas, TAGeometry, TACustomSource, TAGraph,
|
||||
TAMath, TAStyles;
|
||||
|
||||
@ -1898,14 +1898,14 @@ end;
|
||||
|
||||
procedure TBarSeries.SetOnBeforeDrawBar(AValue: TBeforeDrawBarEvent);
|
||||
begin
|
||||
if TMethod(FOnBeforeDrawBar) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnBeforeDrawBar), TMethod(AValue)) then exit;
|
||||
FOnBeforeDrawBar := AValue;
|
||||
UpdateParentChart;
|
||||
end;
|
||||
|
||||
procedure TBarSeries.SetOnCustomDrawBar(AValue: TCustomDrawBarEvent);
|
||||
begin
|
||||
if TMethod(FOnCustomDrawBar) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnCustomDrawBar), TMethod(AValue)) then exit;
|
||||
FOnCustomDrawBar := AValue;
|
||||
UpdateParentChart;
|
||||
end;
|
||||
@ -2520,14 +2520,14 @@ end;
|
||||
|
||||
procedure TUserDrawnSeries.SetOnDraw(AValue: TSeriesDrawEvent);
|
||||
begin
|
||||
if TMethod(FOnDraw) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnDraw), TMethod(AValue)) then exit;
|
||||
FOnDraw := AValue;
|
||||
UpdateParentChart;
|
||||
end;
|
||||
|
||||
procedure TUserDrawnSeries.SetOnGetBounds(AValue: TSeriesGetBoundsEvent);
|
||||
begin
|
||||
if TMethod(FOnGetBounds) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnGetBounds), TMethod(AValue)) then exit;
|
||||
FOnGetBounds := AValue;
|
||||
UpdateParentChart;
|
||||
end;
|
||||
|
@ -304,7 +304,7 @@ procedure Register;
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math, StrUtils, SysUtils, TAMath, TAChartStrConsts;
|
||||
Math, StrUtils, SysUtils, LazMethodList, TAMath, TAChartStrConsts;
|
||||
|
||||
type
|
||||
TCustomChartSourceAccess = class(TCustomChartSource);
|
||||
@ -1485,7 +1485,7 @@ end;
|
||||
procedure TUserDefinedChartSource.SetOnGetChartDataItem(
|
||||
AValue: TGetChartDataItemEvent);
|
||||
begin
|
||||
if TMethod(FOnGetChartDataItem) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnGetChartDataItem), TMethod(AValue)) then exit;
|
||||
FOnGetChartDataItem := AValue;
|
||||
Reset;
|
||||
end;
|
||||
|
@ -15,7 +15,7 @@ unit TATextElements;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, Graphics, Types,
|
||||
Classes, Graphics, Types, LazMethodList,
|
||||
TAChartUtils, TADrawUtils, TATypes,
|
||||
|
||||
// Workaround for issue #22850.
|
||||
@ -585,7 +585,7 @@ end;
|
||||
|
||||
procedure TChartTextElement.SetOnGetShape(AValue: TChartGetShapeEvent);
|
||||
begin
|
||||
if TMethod(FOnGetShape) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnGetShape), TMethod(AValue)) then exit;
|
||||
FOnGetShape := AValue;
|
||||
StyleChanged(Self);
|
||||
end;
|
||||
|
@ -202,7 +202,7 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
ComponentEditors, Forms, Math, PropEdits,
|
||||
ComponentEditors, Forms, Math, LazMethodList, PropEdits,
|
||||
TAChartStrConsts, TAMath, TASubcomponentsEditor;
|
||||
|
||||
type
|
||||
@ -797,14 +797,14 @@ end;
|
||||
|
||||
procedure TUserDefinedAxisTransform.SetOnAxisToGraph(AValue: TTransformEvent);
|
||||
begin
|
||||
if TMethod(FOnAxisToGraph) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnAxisToGraph), TMethod(AValue)) then exit;
|
||||
FOnAxisToGraph := AValue;
|
||||
Changed;
|
||||
end;
|
||||
|
||||
procedure TUserDefinedAxisTransform.SetOnGraphToAxis(AValue: TTransformEvent);
|
||||
begin
|
||||
if TMethod(FOnGraphToAxis) = TMethod(AValue) then exit;
|
||||
if SameMethod(TMethod(FOnGraphToAxis), TMethod(AValue)) then exit;
|
||||
FOnGraphToAxis := AValue;
|
||||
Changed;
|
||||
end;
|
||||
|
@ -422,7 +422,8 @@ procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
uses WSShellCtrls
|
||||
uses
|
||||
WSShellCtrls, LazMethodList
|
||||
{$ifdef windows}
|
||||
,Windows, ShellApi
|
||||
{$endif};
|
||||
@ -465,10 +466,6 @@ begin
|
||||
Result := Format(sShellCtrlsGB, [Format('%.1n', [AFileSize / ONE_GB])]);
|
||||
end;
|
||||
|
||||
operator = (const A, B: TMethod): Boolean;
|
||||
begin
|
||||
Result := (A.Code = B.Code) and (A.Data = B.Data);
|
||||
end;
|
||||
|
||||
{ TShellListItem }
|
||||
|
||||
@ -701,7 +698,7 @@ var
|
||||
RootNode: TTreeNode;
|
||||
CurrPath: String;
|
||||
begin
|
||||
if TMethod(AValue) = TMethod(FOnSortCompare) then
|
||||
if SameMethod(TMethod(AValue), TMethod(FOnSortCompare)) then
|
||||
Exit;
|
||||
|
||||
FOnSortCompare := AValue;
|
||||
@ -1776,7 +1773,8 @@ end;
|
||||
|
||||
procedure TCustomShellListView.SetOnSortCompare(AValue: TFileItemCompareEvent);
|
||||
begin
|
||||
if TMethod(AValue) = TMethod(FOnSortCompare) then Exit;
|
||||
if SameMethod(TMethod(AValue), TMethod(FOnSortCompare)) then
|
||||
Exit;
|
||||
FOnSortCompare:=AValue;
|
||||
Clear;
|
||||
Items.Clear;
|
||||
|
Loading…
Reference in New Issue
Block a user