mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-11 04:09:35 +01:00
SpinEx: let drived classes always implement SameValue, since it's wrong to use Math.SameValue on integer types. Also resolves #39792 and #39793.
This commit is contained in:
parent
b442769bb0
commit
bcda2c2047
@ -524,13 +524,10 @@ begin
|
||||
Result := AValue - FIncrement;
|
||||
end;
|
||||
|
||||
// Workaround for https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39490
|
||||
{$ifdef fpc_math_samevalue_bug}
|
||||
function TCustomFloatSpinEditEx.SameValue(AValue1, AValue2: Double): Boolean;
|
||||
begin
|
||||
Result := Math.SameValue(AValue1, AValue2);
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
procedure TCustomFloatSpinEditEx.SetDecimals(ADecimals: Integer);
|
||||
begin
|
||||
@ -671,13 +668,10 @@ begin
|
||||
Result := AValue - FIncrement;
|
||||
end;
|
||||
|
||||
// Workaround for https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/39490
|
||||
{$ifdef fpc_math_samevalue_bug}
|
||||
function TCustomSpinEditEx.SameValue(AValue1, AValue2: Int64): Boolean;
|
||||
begin
|
||||
Result := (AValue1 = AValue2);
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
function TCustomSpinEditEx.TextIsNumber(const S: String; out ANumber: Int64
|
||||
): Boolean;
|
||||
|
||||
@ -69,11 +69,6 @@ unit SpinEx;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
// Activates a workaround for issue #39490
|
||||
{$if FPC_FullVersion=30202}{$ifdef Win64}
|
||||
{$define fpc_math_samevalue_bug}
|
||||
{$endif}{$endif}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
@ -146,9 +141,7 @@ type
|
||||
procedure EditMouseWheelDown(Shift: TShiftState; MousePos: TPoint; var Handled: Boolean); override;
|
||||
function SafeInc(AValue: T): T; virtual; abstract;
|
||||
function SafeDec(AValue: T): T; virtual abstract;
|
||||
{$ifdef fpc_math_samevalue_bug}
|
||||
function SameValue(AValue1, AValue2: T): boolean; virtual; abstract;
|
||||
{$endif}
|
||||
function SameValue(AValue1, AValue2: T): boolean; virtual; abstract; //because it is wrong to use Math.SameValue for e.g. Integer derived classes.
|
||||
procedure SetValue(const AValue: T); virtual;
|
||||
procedure SetNullValue(AValue: T); virtual;
|
||||
procedure SetMaxValue(const AValue: T); virtual;
|
||||
@ -216,9 +209,7 @@ type
|
||||
function TextIsNumber(const S: String; out ANumber: Double): Boolean; override;
|
||||
function SafeInc(AValue: Double): Double; override;
|
||||
function SafeDec(AValue: Double): Double; override;
|
||||
{$ifdef fpc_math_samevalue_bug}
|
||||
function SameValue(AValue1, AValue2: Double): Boolean; override;
|
||||
{$endif}
|
||||
procedure SetDecimals(ADecimals: Integer); virtual;
|
||||
class procedure WSRegisterClass; override;
|
||||
public
|
||||
@ -330,9 +321,7 @@ type
|
||||
protected
|
||||
function SafeInc(AValue: Int64): Int64; override;
|
||||
function SafeDec(AValue: Int64): Int64; override;
|
||||
{$ifdef fpc_math_samevalue_bug}
|
||||
function SameValue(AValue1, AValue2: Int64): Boolean; override;
|
||||
{$endif}
|
||||
function TextIsNumber(const S: String; out ANumber: Int64): Boolean; override;
|
||||
public
|
||||
function ValueToStr(const AValue: Int64): String; override;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user