changed TPropertyEditor.GetComponent

git-svn-id: trunk@6232 -
This commit is contained in:
mattias 2004-11-11 18:45:24 +00:00
parent 2378a262fe
commit d5414fe864
3 changed files with 13 additions and 19 deletions

View File

@ -1321,7 +1321,7 @@ begin
FTIObject:=nil; FTIObject:=nil;
FTIPropertyName:=''; FTIPropertyName:='';
end else begin end else begin
FTIObject:=FEditor.GetPersistent(0); FTIObject:=FEditor.GetComponent(0);
FTIPropertyName:=FEditor.GetName; FTIPropertyName:=FEditor.GetName;
end; end;
end; end;
@ -1781,7 +1781,7 @@ var
begin begin
Result:=false; Result:=false;
for i:=0 to PropCount-1 do begin for i:=0 to PropCount-1 do begin
CurPersistent:=GetPersistent(i); CurPersistent:=GetComponent(i);
if (CurPersistent is TCustomPropertyLink) then begin if (CurPersistent is TCustomPropertyLink) then begin
ALink:=TCustomPropertyLink(CurPersistent); ALink:=TCustomPropertyLink(CurPersistent);
if Assigned(ALink.OnTestEditor) and (not ALink.OnTestEditor(Prop)) then if Assigned(ALink.OnTestEditor) and (not ALink.OnTestEditor(Prop)) then
@ -1815,7 +1815,7 @@ begin
// get every TIObject of every TCustomPropertyLink in the selection // get every TIObject of every TCustomPropertyLink in the selection
Filter:=AllTypeKinds; Filter:=AllTypeKinds;
for i:=0 to PropCount-1 do begin for i:=0 to PropCount-1 do begin
CurPersistent:=GetPersistent(i); CurPersistent:=GetComponent(i);
if (CurPersistent is TCustomPropertyLink) then begin if (CurPersistent is TCustomPropertyLink) then begin
ALink:=TCustomPropertyLink(CurPersistent); ALink:=TCustomPropertyLink(CurPersistent);
CurTIObject:=ALink.TIObject; CurTIObject:=ALink.TIObject;
@ -1858,7 +1858,7 @@ begin
FCollectedValues:=TAliasStrings.Create; FCollectedValues:=TAliasStrings.Create;
FCollectedValues.Text:=Memo.Text; FCollectedValues.Text:=Memo.Text;
for i:=0 to Editor.PropCount-1 do begin for i:=0 to Editor.PropCount-1 do begin
CurPersistent:=Editor.GetPersistent(i); CurPersistent:=Editor.GetComponent(i);
if (CurPersistent is TCustomPropertyLink) then begin if (CurPersistent is TCustomPropertyLink) then begin
ALink:=TCustomPropertyLink(CurPersistent); ALink:=TCustomPropertyLink(CurPersistent);
ALink.CreateEditor; ALink.CreateEditor;

View File

@ -800,7 +800,7 @@ var
APersistent: TPersistent; APersistent: TPersistent;
begin begin
Result := [paMultiSelect, paSubProperties, paDialog, paReadOnly]; Result := [paMultiSelect, paSubProperties, paDialog, paReadOnly];
APersistent:=GetPersistent(0); APersistent:=GetComponent(0);
if (APersistent<>nil) and (APersistent is TControl) if (APersistent<>nil) and (APersistent is TControl)
and (not (APersistent is TStaticText)) then and (not (APersistent is TStaticText)) then
Result:=Result+[paDisableSubProperties]-[paDialog]; Result:=Result+[paDisableSubProperties]-[paDialog];

View File

@ -303,8 +303,7 @@ type
procedure Edit; virtual; procedure Edit; virtual;
function GetAttributes: TPropertyAttributes; virtual; function GetAttributes: TPropertyAttributes; virtual;
function IsReadOnly: boolean; virtual; function IsReadOnly: boolean; virtual;
function GetPersistent(Index: Integer): TPersistent; function GetComponent(Index: Integer): TPersistent;// for Delphi compatibility
function GetComponent(Index: Integer): TComponent;// for Delphi compatibility
function GetEditLimit: Integer; virtual; function GetEditLimit: Integer; virtual;
function GetName: shortstring; virtual; function GetName: shortstring; virtual;
procedure GetProperties(Proc: TGetPropEditProc); virtual; procedure GetProperties(Proc: TGetPropEditProc); virtual;
@ -1408,7 +1407,7 @@ begin
if ListPropertyEditors=nil then exit; if ListPropertyEditors=nil then exit;
for i:=0 to ListPropertyEditors.Count-1 do begin for i:=0 to ListPropertyEditors.Count-1 do begin
Editor:=TListPropertyEditor(ListPropertyEditors[i]); Editor:=TListPropertyEditor(ListPropertyEditors[i]);
if (Editor.GetPersistent(0)=AnObject) if (Editor.GetComponent(0)=AnObject)
and (Editor.OnSubPropertiesChanged<>nil) then and (Editor.OnSubPropertiesChanged<>nil) then
Editor.UpdateSubProperties; Editor.UpdateSubProperties;
end; end;
@ -1988,16 +1987,11 @@ begin
Result:=paReadOnly in GetAttributes; Result:=paReadOnly in GetAttributes;
end; end;
function TPropertyEditor.GetPersistent(Index: Integer): TPersistent; function TPropertyEditor.GetComponent(Index: Integer): TPersistent;
begin begin
Result:=FPropList^[Index].Instance; Result:=FPropList^[Index].Instance;
end; end;
function TPropertyEditor.GetComponent(Index: Integer): TComponent;
begin
Result:=TComponent(FPropList^[Index].Instance);
end;
function TPropertyEditor.GetFloatValue:Extended; function TPropertyEditor.GetFloatValue:Extended;
begin begin
Result:=GetFloatValueAt(0); Result:=GetFloatValueAt(0);
@ -3205,7 +3199,7 @@ begin
Result:=true; Result:=true;
if FSubPropertiesChanged then exit; if FSubPropertiesChanged then exit;
FSubPropertiesChanged:=true; FSubPropertiesChanged:=true;
if SavedList<>GetPersistent(0) then exit; if SavedList<>GetComponent(0) then exit;
if ReadElementCount<>SavedElements.Count then exit; if ReadElementCount<>SavedElements.Count then exit;
for i:=0 to SavedElements.Count-1 do for i:=0 to SavedElements.Count-1 do
if TPersistent(SavedElements[i])<>ReadElement(i) then exit; if TPersistent(SavedElements[i])<>ReadElement(i) then exit;
@ -3258,7 +3252,7 @@ procedure TListPropertyEditor.DoSaveElements;
var var
i, ElementCount: integer; i, ElementCount: integer;
begin begin
SavedList:=GetPersistent(0); SavedList:=GetComponent(0);
ElementCount:=GetElementCount; ElementCount:=GetElementCount;
SavedElements.Count:=ElementCount; SavedElements.Count:=ElementCount;
for i:=0 to ElementCount-1 do for i:=0 to ElementCount-1 do
@ -3789,12 +3783,12 @@ var I: Integer;
begin begin
Result:=''; Result:='';
if PropertyHook.LookupRoot=nil then exit; if PropertyHook.LookupRoot=nil then exit;
if GetPersistent(0) = PropertyHook.LookupRoot then begin if GetComponent(0) = PropertyHook.LookupRoot then begin
Result := PropertyHook.GetRootClassName; Result := PropertyHook.GetRootClassName;
if (Result <> '') and (Result[1] = 'T') then if (Result <> '') and (Result[1] = 'T') then
System.Delete(Result, 1, 1); System.Delete(Result, 1, 1);
end else begin end else begin
Result := PropertyHook.GetObjectName(GetPersistent(0)); Result := PropertyHook.GetObjectName(GetComponent(0));
for I := Length(Result) downto 1 do for I := Length(Result) downto 1 do
if Result[I] in ['.','[',']'] then if Result[I] in ['.','[',']'] then
System.Delete(Result, I, 1); System.Delete(Result, I, 1);
@ -4182,7 +4176,7 @@ begin
if (not IsValidIdent(NewValue)) or (NewValue='') then if (not IsValidIdent(NewValue)) or (NewValue='') then
raise Exception.Create('Component name "'+NewValue+'" is not a valid identifier'); raise Exception.Create('Component name "'+NewValue+'" is not a valid identifier');
inherited SetValue(NewValue); inherited SetValue(NewValue);
PropertyHook.ComponentRenamed(TComponent(GetPersistent(0))); PropertyHook.ComponentRenamed(TComponent(GetComponent(0)));
end; end;
{ TDatePropertyEditor } { TDatePropertyEditor }