mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 17:39:16 +02:00
IdeIntf: OI: fix streamed property detection (default float values were highlighted).
git-svn-id: trunk@57606 -
This commit is contained in:
parent
81bee86e42
commit
cf03083224
@ -1908,7 +1908,7 @@ begin
|
|||||||
else
|
else
|
||||||
FCurrentEdit.Color:=FValueDifferBackgrndColor;
|
FCurrentEdit.Color:=FValueDifferBackgrndColor;
|
||||||
end;
|
end;
|
||||||
if NewRow.Editor.IsNotDefaultValue then
|
if NewRow.Editor.ValueIsStreamed then
|
||||||
FCurrentEdit.Font:=FValueFont
|
FCurrentEdit.Font:=FValueFont
|
||||||
else
|
else
|
||||||
FCurrentEdit.Font:=FDefaultValueFont;
|
FCurrentEdit.Font:=FDefaultValueFont;
|
||||||
@ -2410,7 +2410,7 @@ var
|
|||||||
if HintType<>pehValue then
|
if HintType<>pehValue then
|
||||||
HintFont := Screen.HintFont
|
HintFont := Screen.HintFont
|
||||||
else
|
else
|
||||||
if fPropRow.Editor.IsNotDefaultValue then
|
if fPropRow.Editor.ValueIsStreamed then
|
||||||
HintFont:=FValueFont
|
HintFont:=FValueFont
|
||||||
else
|
else
|
||||||
HintFont:=FDefaultValueFont;
|
HintFont:=FDefaultValueFont;
|
||||||
@ -2997,7 +2997,7 @@ var
|
|||||||
if ARow<>ItemIndex then
|
if ARow<>ItemIndex then
|
||||||
begin
|
begin
|
||||||
OldFont:=Canvas.Font;
|
OldFont:=Canvas.Font;
|
||||||
if CurRow.Editor.IsNotDefaultValue then
|
if CurRow.Editor.ValueIsStreamed then
|
||||||
Canvas.Font:=FValueFont
|
Canvas.Font:=FValueFont
|
||||||
else
|
else
|
||||||
Canvas.Font:=FDefaultValueFont;
|
Canvas.Font:=FDefaultValueFont;
|
||||||
@ -3326,7 +3326,7 @@ begin
|
|||||||
|
|
||||||
if (FItemIndex>=0) and (FItemIndex<RowCount) and Assigned(FCurrentEdit) then
|
if (FItemIndex>=0) and (FItemIndex<RowCount) and Assigned(FCurrentEdit) then
|
||||||
begin
|
begin
|
||||||
if Rows[FItemIndex].Editor.IsNotDefaultValue then
|
if Rows[FItemIndex].Editor.ValueIsStreamed then
|
||||||
FCurrentEdit.Font:=FValueFont
|
FCurrentEdit.Font:=FValueFont
|
||||||
else
|
else
|
||||||
FCurrentEdit.Font:=FDefaultValueFont;
|
FCurrentEdit.Font:=FDefaultValueFont;
|
||||||
|
@ -398,8 +398,7 @@ type
|
|||||||
{%H-}AState: TPropEditDrawState); virtual;
|
{%H-}AState: TPropEditDrawState); virtual;
|
||||||
procedure UpdateSubProperties; virtual;
|
procedure UpdateSubProperties; virtual;
|
||||||
function SubPropertiesNeedsUpdate: boolean; virtual;
|
function SubPropertiesNeedsUpdate: boolean; virtual;
|
||||||
function IsDefaultValue: boolean; virtual;
|
function ValueIsStreamed: boolean; virtual;
|
||||||
function IsNotDefaultValue: boolean;
|
|
||||||
function IsRevertableToInherited: boolean; virtual;
|
function IsRevertableToInherited: boolean; virtual;
|
||||||
// These are used for the popup menu in OI
|
// These are used for the popup menu in OI
|
||||||
function GetVerbCount: Integer; virtual;
|
function GetVerbCount: Integer; virtual;
|
||||||
@ -515,6 +514,8 @@ type
|
|||||||
TFloatPropertyEditor = class(TPropertyEditor)
|
TFloatPropertyEditor = class(TPropertyEditor)
|
||||||
public
|
public
|
||||||
function AllEqual: Boolean; override;
|
function AllEqual: Boolean; override;
|
||||||
|
function FormatValue(const AValue: Extended): ansistring;
|
||||||
|
function GetDefaultValue: ansistring; override;
|
||||||
function GetValue: ansistring; override;
|
function GetValue: ansistring; override;
|
||||||
procedure SetValue(const NewValue: ansistring); override;
|
procedure SetValue(const NewValue: ansistring); override;
|
||||||
end;
|
end;
|
||||||
@ -604,7 +605,7 @@ type
|
|||||||
function GetVisualValue: ansistring; override;
|
function GetVisualValue: ansistring; override;
|
||||||
procedure GetValues(Proc: TGetStrProc); override;
|
procedure GetValues(Proc: TGetStrProc); override;
|
||||||
procedure SetValue(const NewValue: ansistring); override;
|
procedure SetValue(const NewValue: ansistring); override;
|
||||||
function IsDefaultValue: boolean; override;
|
function ValueIsStreamed: boolean; override;
|
||||||
procedure PropDrawValue(ACanvas: TCanvas; const ARect: TRect;
|
procedure PropDrawValue(ACanvas: TCanvas; const ARect: TRect;
|
||||||
AState: TPropEditDrawState); override;
|
AState: TPropEditDrawState); override;
|
||||||
end;
|
end;
|
||||||
@ -643,7 +644,7 @@ type
|
|||||||
constructor Create(Hook: TPropertyEditorHook; APropCount: Integer); override;
|
constructor Create(Hook: TPropertyEditorHook; APropCount: Integer); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
function IsDefaultValue: boolean; override;
|
function ValueIsStreamed: boolean; override;
|
||||||
function AllEqual: Boolean; override;
|
function AllEqual: Boolean; override;
|
||||||
function GetAttributes: TPropertyAttributes; override;
|
function GetAttributes: TPropertyAttributes; override;
|
||||||
procedure GetProperties(Proc: TGetPropEditProc); override;
|
procedure GetProperties(Proc: TGetPropEditProc); override;
|
||||||
@ -3409,20 +3410,14 @@ begin
|
|||||||
Result:=false;
|
Result:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TPropertyEditor.IsDefaultValue: boolean;
|
function TPropertyEditor.ValueIsStreamed: boolean;
|
||||||
begin
|
begin
|
||||||
if HasDefaultValue then
|
|
||||||
Result := (GetDefaultValue=GetVisualValue)
|
|
||||||
else
|
|
||||||
if HasStoredFunction then
|
if HasStoredFunction then
|
||||||
Result := not CallStoredFunction
|
Result := CallStoredFunction
|
||||||
else
|
else
|
||||||
Result := False;
|
Result := True;
|
||||||
end;
|
if Result and HasDefaultValue then
|
||||||
|
Result := GetDefaultValue<>GetVisualValue;
|
||||||
function TPropertyEditor.IsNotDefaultValue: boolean;
|
|
||||||
begin
|
|
||||||
Result := not IsDefaultValue;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TPropertyEditor.IsRevertableToInherited: boolean;
|
function TPropertyEditor.IsRevertableToInherited: boolean;
|
||||||
@ -3790,7 +3785,7 @@ begin
|
|||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TFloatPropertyEditor.GetValue: ansistring;
|
function TFloatPropertyEditor.FormatValue(const AValue: Extended): ansistring;
|
||||||
const
|
const
|
||||||
Precisions: array[TFloatType] of Integer = (7, 15, 19, 19, 19);
|
Precisions: array[TFloatType] of Integer = (7, 15, 19, 19, 19);
|
||||||
var
|
var
|
||||||
@ -3798,10 +3793,22 @@ var
|
|||||||
begin
|
begin
|
||||||
FS := DefaultFormatSettings;
|
FS := DefaultFormatSettings;
|
||||||
FS.DecimalSeparator := '.'; //It's Pascal sourcecode representation of a float, not a textual (i18n) one
|
FS.DecimalSeparator := '.'; //It's Pascal sourcecode representation of a float, not a textual (i18n) one
|
||||||
Result := FloatToStrF(GetFloatValue, ffGeneral,
|
Result := FloatToStrF(AValue, ffGeneral,
|
||||||
Precisions[GetTypeData(GetPropType)^.FloatType], 0, FS);
|
Precisions[GetTypeData(GetPropType)^.FloatType], 0, FS);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TFloatPropertyEditor.GetDefaultValue: ansistring;
|
||||||
|
begin
|
||||||
|
if not HasDefaultValue then
|
||||||
|
raise EPropertyError.Create('No property default available');
|
||||||
|
Result:=FormatValue(0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TFloatPropertyEditor.GetValue: ansistring;
|
||||||
|
begin
|
||||||
|
Result := FormatValue(GetFloatValue);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TFloatPropertyEditor.SetValue(const NewValue: ansistring);
|
procedure TFloatPropertyEditor.SetValue(const NewValue: ansistring);
|
||||||
var
|
var
|
||||||
FS: TFormatSettings;
|
FS: TFormatSettings;
|
||||||
@ -4031,20 +4038,20 @@ begin
|
|||||||
SetOrdValue(Integer(S));
|
SetOrdValue(Integer(S));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSetElementPropertyEditor.IsDefaultValue: boolean;
|
function TSetElementPropertyEditor.ValueIsStreamed: boolean;
|
||||||
var
|
var
|
||||||
S1, S2: TIntegerSet;
|
S1, S2: TIntegerSet;
|
||||||
begin
|
begin
|
||||||
if HasDefaultValue then
|
if HasStoredFunction then
|
||||||
|
Result := CallStoredFunction
|
||||||
|
else
|
||||||
|
Result := True;
|
||||||
|
if Result and HasDefaultValue then
|
||||||
begin
|
begin
|
||||||
Integer(S1) := GetOrdValue;
|
Integer(S1) := GetOrdValue;
|
||||||
Integer(S2) := GetDefaultOrdValue;
|
Integer(S2) := GetDefaultOrdValue;
|
||||||
Result := (FElement in S1) = (FElement in S2);
|
Result := (FElement in S1) <> (FElement in S2);
|
||||||
end else
|
end;
|
||||||
if HasStoredFunction then
|
|
||||||
Result := not CallStoredFunction
|
|
||||||
else
|
|
||||||
Result := False;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSetElementPropertyEditor.PropDrawValue(ACanvas: TCanvas; const ARect: TRect;
|
procedure TSetElementPropertyEditor.PropDrawValue(ACanvas: TCanvas; const ARect: TRect;
|
||||||
@ -4536,12 +4543,12 @@ begin
|
|||||||
Result:='(' + GetPropType^.Name + ')';
|
Result:='(' + GetPropType^.Name + ')';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TClassPropertyEditor.IsDefaultValue: boolean;
|
function TClassPropertyEditor.ValueIsStreamed: boolean;
|
||||||
var
|
var
|
||||||
I: Integer;
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
Result := inherited IsDefaultValue;
|
Result := inherited ValueIsStreamed;
|
||||||
if Result then
|
if not Result then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
if FSubProps=nil then
|
if FSubProps=nil then
|
||||||
@ -4551,9 +4558,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
for I := 0 to FSubProps.Count-1 do
|
for I := 0 to FSubProps.Count-1 do
|
||||||
if not TPropertyEditor(FSubProps[I]).IsDefaultValue then
|
if TPropertyEditor(FSubProps[I]).ValueIsStreamed then
|
||||||
Exit(False);
|
Exit(True);
|
||||||
Result := True;
|
Result := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TClassPropertyEditor.ListSubProps(Prop: TPropertyEditor);
|
procedure TClassPropertyEditor.ListSubProps(Prop: TPropertyEditor);
|
||||||
|
Loading…
Reference in New Issue
Block a user