mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 20:21:04 +02:00
IDEIntf: TInterfacePropertyEditor, TPersistentPropertyEditor: check csDesigning if ComponentPropertyOnlyDesign
git-svn-id: trunk@58001 -
This commit is contained in:
parent
6a583d8bfb
commit
3df9ef6440
@ -1372,6 +1372,7 @@ type
|
|||||||
|
|
||||||
TPropertyEditorHook = class(TComponent)
|
TPropertyEditorHook = class(TComponent)
|
||||||
private
|
private
|
||||||
|
FComponentPropertyOnlyDesign: boolean;
|
||||||
FHandlers: array[TPropHookType] of TMethodList;
|
FHandlers: array[TPropHookType] of TMethodList;
|
||||||
// lookup root
|
// lookup root
|
||||||
FLookupRoot: TPersistent;
|
FLookupRoot: TPersistent;
|
||||||
@ -1446,6 +1447,7 @@ type
|
|||||||
procedure Modified(Sender: TObject; PropName: ShortString = '');
|
procedure Modified(Sender: TObject; PropName: ShortString = '');
|
||||||
procedure Revert(Instance: TPersistent; PropInfo: PPropInfo);
|
procedure Revert(Instance: TPersistent; PropInfo: PPropInfo);
|
||||||
procedure RefreshPropertyValues;
|
procedure RefreshPropertyValues;
|
||||||
|
property ComponentPropertyOnlyDesign: boolean read FComponentPropertyOnlyDesign write FComponentPropertyOnlyDesign;
|
||||||
// dependencies
|
// dependencies
|
||||||
procedure AddDependency(const AClass: TClass; const AnUnitname: shortstring);
|
procedure AddDependency(const AClass: TClass; const AnUnitname: shortstring);
|
||||||
// other
|
// other
|
||||||
@ -3024,11 +3026,12 @@ end;
|
|||||||
function TPropertyEditor.GetVisualValue: ansistring;
|
function TPropertyEditor.GetVisualValue: ansistring;
|
||||||
begin
|
begin
|
||||||
if AllEqual then
|
if AllEqual then
|
||||||
{$IFDEF LCLCarbon}
|
begin
|
||||||
Result:=StringReplace(GetValue,LineEnding,LineFeedSymbolUTF8,[rfReplaceAll])
|
|
||||||
{$ELSE}
|
|
||||||
Result:=GetValue
|
Result:=GetValue
|
||||||
|
{$IFDEF LCLCarbon}
|
||||||
|
Result:=StringReplace(Result,LineEnding,LineFeedSymbolUTF8,[rfReplaceAll])
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
end
|
||||||
else
|
else
|
||||||
Result:='';
|
Result:='';
|
||||||
end;
|
end;
|
||||||
@ -4937,7 +4940,10 @@ begin
|
|||||||
for I := 1 to PropCount - 1 do
|
for I := 1 to PropCount - 1 do
|
||||||
if TComponent(GetObjectValueAt(I)) <> AComponent then
|
if TComponent(GetObjectValueAt(I)) <> AComponent then
|
||||||
Exit;
|
Exit;
|
||||||
Result:=true;
|
if (PropertyHook<>nil) and PropertyHook.ComponentPropertyOnlyDesign then
|
||||||
|
Result:=(AComponent=nil) or (csDesigning in AComponent.ComponentState)
|
||||||
|
else
|
||||||
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TPersistentPropertyEditor.AllEqual: Boolean;
|
function TPersistentPropertyEditor.AllEqual: Boolean;
|
||||||
@ -5094,7 +5100,10 @@ begin
|
|||||||
for I := 1 to PropCount - 1 do
|
for I := 1 to PropCount - 1 do
|
||||||
if GetComponent(GetIntfValueAt(I)) <> Component then
|
if GetComponent(GetIntfValueAt(I)) <> Component then
|
||||||
Exit;
|
Exit;
|
||||||
Result := True;
|
if (PropertyHook<>nil) and PropertyHook.ComponentPropertyOnlyDesign then
|
||||||
|
Result:=(Component=nil) or (csDesigning in Component.ComponentState)
|
||||||
|
else
|
||||||
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TInterfacePropertyEditor.Edit;
|
procedure TInterfacePropertyEditor.Edit;
|
||||||
|
@ -2085,6 +2085,7 @@ end;
|
|||||||
procedure TMainIDE.SetupFormEditor;
|
procedure TMainIDE.SetupFormEditor;
|
||||||
begin
|
begin
|
||||||
GlobalDesignHook:=TPropertyEditorHook.Create(nil);
|
GlobalDesignHook:=TPropertyEditorHook.Create(nil);
|
||||||
|
GlobalDesignHook.ComponentPropertyOnlyDesign:=true;
|
||||||
GlobalDesignHook.GetPrivateDirectory:=AppendPathDelim(GetPrimaryConfigPath);
|
GlobalDesignHook.GetPrivateDirectory:=AppendPathDelim(GetPrimaryConfigPath);
|
||||||
GlobalDesignHook.AddHandlerGetMethodName(@PropHookGetMethodName);
|
GlobalDesignHook.AddHandlerGetMethodName(@PropHookGetMethodName);
|
||||||
GlobalDesignHook.AddHandlerGetCompatibleMethods(@PropHookGetCompatibleMethods);
|
GlobalDesignHook.AddHandlerGetCompatibleMethods(@PropHookGetCompatibleMethods);
|
||||||
|
Loading…
Reference in New Issue
Block a user