IDEIntf: TInterfacePropertyEditor, TPersistentPropertyEditor: check csDesigning if ComponentPropertyOnlyDesign

git-svn-id: trunk@58001 -
This commit is contained in:
mattias 2018-05-22 08:21:52 +00:00
parent 6a583d8bfb
commit 3df9ef6440
2 changed files with 15 additions and 5 deletions

View File

@ -1372,6 +1372,7 @@ type
TPropertyEditorHook = class(TComponent)
private
FComponentPropertyOnlyDesign: boolean;
FHandlers: array[TPropHookType] of TMethodList;
// lookup root
FLookupRoot: TPersistent;
@ -1446,6 +1447,7 @@ type
procedure Modified(Sender: TObject; PropName: ShortString = '');
procedure Revert(Instance: TPersistent; PropInfo: PPropInfo);
procedure RefreshPropertyValues;
property ComponentPropertyOnlyDesign: boolean read FComponentPropertyOnlyDesign write FComponentPropertyOnlyDesign;
// dependencies
procedure AddDependency(const AClass: TClass; const AnUnitname: shortstring);
// other
@ -3024,11 +3026,12 @@ end;
function TPropertyEditor.GetVisualValue: ansistring;
begin
if AllEqual then
{$IFDEF LCLCarbon}
Result:=StringReplace(GetValue,LineEnding,LineFeedSymbolUTF8,[rfReplaceAll])
{$ELSE}
begin
Result:=GetValue
{$IFDEF LCLCarbon}
Result:=StringReplace(Result,LineEnding,LineFeedSymbolUTF8,[rfReplaceAll])
{$ENDIF}
end
else
Result:='';
end;
@ -4937,7 +4940,10 @@ begin
for I := 1 to PropCount - 1 do
if TComponent(GetObjectValueAt(I)) <> AComponent then
Exit;
Result:=true;
if (PropertyHook<>nil) and PropertyHook.ComponentPropertyOnlyDesign then
Result:=(AComponent=nil) or (csDesigning in AComponent.ComponentState)
else
Result:=true;
end;
function TPersistentPropertyEditor.AllEqual: Boolean;
@ -5094,7 +5100,10 @@ begin
for I := 1 to PropCount - 1 do
if GetComponent(GetIntfValueAt(I)) <> Component then
Exit;
Result := True;
if (PropertyHook<>nil) and PropertyHook.ComponentPropertyOnlyDesign then
Result:=(Component=nil) or (csDesigning in Component.ComponentState)
else
Result := True;
end;
procedure TInterfacePropertyEditor.Edit;

View File

@ -2085,6 +2085,7 @@ end;
procedure TMainIDE.SetupFormEditor;
begin
GlobalDesignHook:=TPropertyEditorHook.Create(nil);
GlobalDesignHook.ComponentPropertyOnlyDesign:=true;
GlobalDesignHook.GetPrivateDirectory:=AppendPathDelim(GetPrimaryConfigPath);
GlobalDesignHook.AddHandlerGetMethodName(@PropHookGetMethodName);
GlobalDesignHook.AddHandlerGetCompatibleMethods(@PropHookGetCompatibleMethods);