IdeIntf: propedits: always write property values to objects. The property setter method has to decide about the need of update, not the propedit code.

git-svn-id: trunk@54954 -
This commit is contained in:
ondrej 2017-05-17 14:57:07 +00:00
parent fa6f0296b6
commit 697a3ee6fa

View File

@ -2984,175 +2984,111 @@ end;
procedure TPropertyEditor.SetFloatValue(const NewValue: Extended); procedure TPropertyEditor.SetFloatValue(const NewValue: Extended);
var var
I: Integer; I: Integer;
Changed: boolean;
begin begin
Changed:=false;
for I:=0 to FPropCount-1 do for I:=0 to FPropCount-1 do
with FPropList^[I] do with FPropList^[I] do begin
Changed:=Changed or (GetFloatProp(Instance,PropInfo)<>NewValue); SetFloatProp(Instance,PropInfo,NewValue);
if Changed then Modified(PropInfo^.Name);
for I:=0 to FPropCount-1 do end;
with FPropList^[I] do begin
SetFloatProp(Instance,PropInfo,NewValue);
Modified(PropInfo^.Name);
end;
end; end;
procedure TPropertyEditor.SetMethodValue(const NewValue: TMethod); procedure TPropertyEditor.SetMethodValue(const NewValue: TMethod);
var var
I: Integer; I: Integer;
Changed: boolean;
AMethod: TMethod;
begin begin
Changed:=false;
for I:=0 to FPropCount-1 do for I:=0 to FPropCount-1 do
with FPropList^[I] do begin with FPropList^[I] do begin
AMethod:=LazGetMethodProp(Instance,PropInfo); LazSetMethodProp(Instance,PropInfo,NewValue);
Changed:=Changed or not CompareMem(@AMethod,@NewValue,SizeOf(TMethod)); Modified(PropInfo^.Name);
end; end;
if Changed then
for I:=0 to FPropCount-1 do
with FPropList^[I] do begin
LazSetMethodProp(Instance,PropInfo,NewValue);
Modified(PropInfo^.Name);
end;
end; end;
procedure TPropertyEditor.SetInt64Value(const NewValue: Int64); procedure TPropertyEditor.SetInt64Value(const NewValue: Int64);
var var
I: Integer; I: Integer;
Changed: boolean;
begin begin
Changed:=false;
for I:=0 to FPropCount-1 do for I:=0 to FPropCount-1 do
with FPropList^[I] do with FPropList^[I] do begin
Changed:=Changed or (GetInt64Prop(Instance,PropInfo)<>NewValue); SetInt64Prop(Instance,PropInfo,NewValue);
if Changed then Modified(PropInfo^.Name);
for I:=0 to FPropCount-1 do end;
with FPropList^[I] do begin
SetInt64Prop(Instance,PropInfo,NewValue);
Modified(PropInfo^.Name);
end;
end; end;
procedure TPropertyEditor.SetIntfValue(const NewValue: IInterface); procedure TPropertyEditor.SetIntfValue(const NewValue: IInterface);
var var
I: Integer; I: Integer;
Changed: boolean;
begin begin
Changed := False;
for I := 0 to FPropCount - 1 do for I := 0 to FPropCount - 1 do
with FPropList^[I] do with FPropList^[I] do begin
Changed := Changed or (GetInterfaceProp(Instance, PropInfo) <> NewValue); SetInterfaceProp(Instance, PropInfo, NewValue);
if Changed then Modified(PropInfo^.Name);
for I := 0 to FPropCount - 1 do end;
with FPropList^[I] do begin
SetInterfaceProp(Instance, PropInfo, NewValue);
Modified(PropInfo^.Name);
end;
end; end;
procedure TPropertyEditor.SetOrdValue(const NewValue: Longint); procedure TPropertyEditor.SetOrdValue(const NewValue: Longint);
var var
I: Integer; I: Integer;
Changed: boolean;
begin begin
Changed := False;
for I := 0 to FPropCount - 1 do for I := 0 to FPropCount - 1 do
with FPropList^[I] do with FPropList^[I] do begin
Changed := Changed or (GetOrdProp(Instance, PropInfo) <> NewValue); SetOrdProp(Instance, PropInfo, NewValue);
if Changed then Modified(PropInfo^.Name);
for I := 0 to FPropCount - 1 do end;
with FPropList^[I] do begin
SetOrdProp(Instance, PropInfo, NewValue);
Modified(PropInfo^.Name);
end;
end; end;
procedure TPropertyEditor.SetPtrValue(const NewValue: Pointer); procedure TPropertyEditor.SetPtrValue(const NewValue: Pointer);
var var
I: Integer; I: Integer;
Changed: boolean;
begin begin
Changed := False;
for I := 0 to FPropCount - 1 do for I := 0 to FPropCount - 1 do
with FPropList^[I] do with FPropList^[I] do begin
Changed := Changed or (GetOrdProp(Instance, PropInfo) <> PtrInt({%H-}PtrUInt(NewValue))); SetOrdProp(Instance, PropInfo, PtrInt({%H-}PtrUInt(NewValue)));
if Changed then Modified(PropInfo^.Name);
for I := 0 to FPropCount - 1 do end;
with FPropList^[I] do begin
SetOrdProp(Instance, PropInfo, PtrInt({%H-}PtrUInt(NewValue)));
Modified(PropInfo^.Name);
end;
end; end;
procedure TPropertyEditor.SetStrValue(const NewValue: AnsiString); procedure TPropertyEditor.SetStrValue(const NewValue: AnsiString);
var var
I: Integer; I: Integer;
Changed: boolean;
begin begin
Changed:=false;
for I:=0 to FPropCount-1 do for I:=0 to FPropCount-1 do
with FPropList^[I] do with FPropList^[I] do begin
Changed:=Changed or (GetStrProp(Instance,PropInfo)<>NewValue); SetStrProp(Instance,PropInfo,NewValue);
if Changed then Modified(PropInfo^.Name);
for I:=0 to FPropCount-1 do end;
with FPropList^[I] do begin
SetStrProp(Instance,PropInfo,NewValue);
Modified(PropInfo^.Name);
end;
end; end;
procedure TPropertyEditor.SetWideStrValue(const NewValue: WideString); procedure TPropertyEditor.SetWideStrValue(const NewValue: WideString);
var var
I: Integer; I: Integer;
Changed: boolean;
begin begin
Changed:=false;
for I:=0 to FPropCount-1 do for I:=0 to FPropCount-1 do
with FPropList^[I] do with FPropList^[I] do begin
Changed:=Changed or (GetWideStrProp(Instance,PropInfo)<>NewValue); SetWideStrProp(Instance,PropInfo,NewValue);
if Changed then Modified(PropInfo^.Name);
for I:=0 to FPropCount-1 do end;
with FPropList^[I] do begin
SetWideStrProp(Instance,PropInfo,NewValue);
Modified(PropInfo^.Name);
end;
end; end;
procedure TPropertyEditor.SetUnicodeStrValue(const NewValue: UnicodeString); procedure TPropertyEditor.SetUnicodeStrValue(const NewValue: UnicodeString);
var var
I: Integer; I: Integer;
Changed: boolean;
begin begin
Changed:=false;
for I:=0 to FPropCount-1 do for I:=0 to FPropCount-1 do
with FPropList^[I] do with FPropList^[I] do begin
Changed:=Changed or (GetUnicodeStrProp(Instance,PropInfo)<>NewValue); SetUnicodeStrProp(Instance,PropInfo,NewValue);
if Changed then Modified(PropInfo^.Name);
for I:=0 to FPropCount-1 do end;
with FPropList^[I] do begin
SetUnicodeStrProp(Instance,PropInfo,NewValue);
Modified(PropInfo^.Name);
end;
end; end;
procedure TPropertyEditor.SetVarValue(const NewValue: Variant); procedure TPropertyEditor.SetVarValue(const NewValue: Variant);
var var
I: Integer; I: Integer;
Changed: boolean;
begin begin
Changed:=false;
for I:=0 to FPropCount-1 do for I:=0 to FPropCount-1 do
with FPropList^[I] do with FPropList^[I] do begin
Changed:=Changed or (GetVariantProp(Instance,PropInfo)<>NewValue) SetVariantProp(Instance,PropInfo,NewValue);
or (VarType(GetVariantProp(Instance,PropInfo))<>VarType(NewValue)); Modified(PropInfo^.Name);
if Changed then end;
for I:=0 to FPropCount-1 do
with FPropList^[I] do begin
SetVariantProp(Instance,PropInfo,NewValue);
Modified(PropInfo^.Name);
end;
end; end;
procedure TPropertyEditor.Revert; procedure TPropertyEditor.Revert;