mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-27 04:53:39 +02:00
ideintf: cleanup propedits - remove old workaround for typeinfo function
git-svn-id: trunk@22136 -
This commit is contained in:
parent
e9a1e8f8a1
commit
3b14fe2074
@ -1562,49 +1562,6 @@ function ClassTypeInfo(Value: TClass): PTypeInfo;
|
|||||||
function GetClassUnitName(Value: TClass): string;
|
function GetClassUnitName(Value: TClass): string;
|
||||||
procedure CreateComponentEvent(AComponent: TComponent; const EventName: string);
|
procedure CreateComponentEvent(AComponent: TComponent; const EventName: string);
|
||||||
|
|
||||||
|
|
||||||
//==============================================================================
|
|
||||||
// XXX
|
|
||||||
// This class is a workaround for the broken typeinfo function
|
|
||||||
type
|
|
||||||
|
|
||||||
{ TDummyClassForPropTypes }
|
|
||||||
|
|
||||||
TDummyClassForPropTypes = class(TPersistent)
|
|
||||||
private
|
|
||||||
FAnchorSide: TAnchorSide;
|
|
||||||
FDateTime: TDateTime;
|
|
||||||
FList:PPropList;
|
|
||||||
FCount:integer;
|
|
||||||
FComponent:TComponent;
|
|
||||||
FComponentName:TComponentName;
|
|
||||||
FCursor: TCursor;
|
|
||||||
FShortCut: TShortCut;
|
|
||||||
FTabOrder:integer;
|
|
||||||
FCaption: TCaption;
|
|
||||||
FLines:TStrings;
|
|
||||||
FColumns: TListColumns;
|
|
||||||
FModalResult:TModalResult;
|
|
||||||
public
|
|
||||||
function PTypeInfos(const PropName:shortstring): PTypeInfo;
|
|
||||||
constructor Create;
|
|
||||||
destructor Destroy; override;
|
|
||||||
published
|
|
||||||
property PropCount:integer read FCount;
|
|
||||||
property DummyComponent:TComponent read FComponent;
|
|
||||||
property DummyName:TComponentName read FComponentName;
|
|
||||||
property TabOrder:integer read FTabOrder;
|
|
||||||
property Caption:TCaption read FCaption;
|
|
||||||
property Cursor: TCursor read FCursor;
|
|
||||||
property Lines:TStrings read FLines;
|
|
||||||
property Columns:TListColumns read FColumns;
|
|
||||||
property ModalResult:TModalResult read FModalResult;
|
|
||||||
property ShortCut: TShortCut read FShortCut;
|
|
||||||
property DateTime: TDateTime read FDateTime;
|
|
||||||
property AnchorSide: TAnchorSide read FAnchorSide;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure LazSetMethodProp(Instance : TObject;PropInfo : PPropInfo; Value : TMethod);
|
procedure LazSetMethodProp(Instance : TObject;PropInfo : PPropInfo; Value : TMethod);
|
||||||
procedure WritePublishedProperties(Instance: TPersistent);
|
procedure WritePublishedProperties(Instance: TPersistent);
|
||||||
procedure EditCollection(AComponent: TComponent; ACollection: TCollection; APropertyName: String);
|
procedure EditCollection(AComponent: TComponent; ACollection: TCollection; APropertyName: String);
|
||||||
@ -6470,43 +6427,6 @@ begin
|
|||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//******************************************************************************
|
|
||||||
// XXX
|
|
||||||
// workaround for missing typeinfo function
|
|
||||||
constructor TDummyClassForPropTypes.Create;
|
|
||||||
var TypeInfo : PTypeInfo;
|
|
||||||
begin
|
|
||||||
inherited Create;
|
|
||||||
TypeInfo:=ClassInfo;
|
|
||||||
FCount:=GetTypeData(TypeInfo)^.Propcount;
|
|
||||||
GetMem(FList,FCount * SizeOf(Pointer));
|
|
||||||
GetPropInfos(TypeInfo,FList);
|
|
||||||
end;
|
|
||||||
|
|
||||||
destructor TDummyClassForPropTypes.Destroy;
|
|
||||||
begin
|
|
||||||
FreeMem(FList);
|
|
||||||
inherited Destroy;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TDummyClassForPropTypes.PTypeInfos(
|
|
||||||
const PropName:shortstring):PTypeInfo;
|
|
||||||
var Index:integer;
|
|
||||||
begin
|
|
||||||
Index:=FCount-1;
|
|
||||||
while (Index>=0) do begin
|
|
||||||
Result:=FList^[Index]^.PropType;
|
|
||||||
if (AnsiCompareText(Result^.Name,PropName)=0) then exit;
|
|
||||||
dec(Index);
|
|
||||||
end;
|
|
||||||
Result:=nil;
|
|
||||||
end;
|
|
||||||
|
|
||||||
var
|
|
||||||
DummyClassForPropTypes: TDummyClassForPropTypes;
|
|
||||||
|
|
||||||
//******************************************************************************
|
|
||||||
|
|
||||||
function GetLookupRootForComponent(APersistent: TPersistent): TPersistent;
|
function GetLookupRootForComponent(APersistent: TPersistent): TPersistent;
|
||||||
begin
|
begin
|
||||||
Result:=APersistent;
|
Result:=APersistent;
|
||||||
@ -6746,68 +6666,37 @@ begin
|
|||||||
PropertyEditorMapperList:=TList.Create;
|
PropertyEditorMapperList:=TList.Create;
|
||||||
// register the standard property editors
|
// register the standard property editors
|
||||||
|
|
||||||
// XXX workaround for buggy typinfo function
|
RegisterPropertyEditor(TypeInfo(AnsiString), TComponent, 'Name', TComponentNamePropertyEditor);
|
||||||
// Normally it should use something like this;
|
RegisterPropertyEditor(TypeInfo(TTranslateString), TCustomLabel, 'Caption', TStringMultilinePropertyEditor);
|
||||||
// RegisterPropertyEditor(TypeInfo(TColor),nil,'',TColorPropertyEditor);
|
RegisterPropertyEditor(TypeInfo(TTranslateString), TCustomStaticText, 'Caption', TStringMultilinePropertyEditor);
|
||||||
DummyClassForPropTypes:=TDummyClassForPropTypes.Create;
|
RegisterPropertyEditor(TypeInfo(TTranslateString), TCustomCheckBox, 'Caption', TStringMultilinePropertyEditor);
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('AnsiString'),
|
RegisterPropertyEditor(TypeInfo(TTranslateString), TControl, 'Hint', TStringMultilinePropertyEditor);
|
||||||
TComponent,'Name',TComponentNamePropertyEditor);
|
RegisterPropertyEditor(TypeInfo(LongInt), nil, 'Tag', TTabOrderPropertyEditor);
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TTranslateString'),
|
RegisterPropertyEditor(TypeInfo(ShortString), nil, '', TCaptionPropertyEditor);
|
||||||
TCustomLabel, 'Caption', TStringMultilinePropertyEditor);
|
RegisterPropertyEditor(TypeInfo(TStrings), nil, '', TStringsPropertyEditor);
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TTranslateString'),
|
RegisterPropertyEditor(TypeInfo(AnsiString), nil, 'SessionProperties', TSessionPropertiesPropertyEditor);
|
||||||
TCustomStaticText, 'Caption', TStringMultilinePropertyEditor);
|
RegisterPropertyEditor(TypeInfo(TModalResult), nil, 'ModalResult', TModalResultPropertyEditor);
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TTranslateString'),
|
RegisterPropertyEditor(TypeInfo(TShortCut), nil, '', TShortCutPropertyEditor);
|
||||||
TCustomCheckBox, 'Caption', TStringMultilinePropertyEditor);
|
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TTranslateString'),
|
|
||||||
TControl, 'Hint', TStringMultilinePropertyEditor);
|
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('longint'),
|
|
||||||
nil,'Tag',TTabOrderPropertyEditor);
|
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('shortstring'),
|
|
||||||
nil,'',TCaptionPropertyEditor);
|
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TStrings'),
|
|
||||||
nil,'',TStringsPropertyEditor);
|
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('AnsiString'),
|
|
||||||
nil,'SessionProperties',TSessionPropertiesPropertyEditor);
|
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TModalResult'),
|
|
||||||
nil,'ModalResult',TModalResultPropertyEditor);
|
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TShortCut'),
|
|
||||||
nil,'',TShortCutPropertyEditor);
|
|
||||||
//RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TDate'),
|
//RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TDate'),
|
||||||
// nil,'',TDatePropertyEditor);
|
// nil,'',TDatePropertyEditor);
|
||||||
//RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TTime'),
|
//RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TTime'),
|
||||||
// nil,'',TTimePropertyEditor);
|
// nil,'',TTimePropertyEditor);
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TDateTime'),
|
RegisterPropertyEditor(TypeInfo(TDateTime), nil, '', TDateTimePropertyEditor);
|
||||||
nil,'',TDateTimePropertyEditor);
|
RegisterPropertyEditor(TypeInfo(TCursor), nil, '', TCursorPropertyEditor);
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TCursor'),
|
RegisterPropertyEditor(TypeInfo(TComponent), nil, '', TComponentPropertyEditor);
|
||||||
nil,'',TCursorPropertyEditor);
|
RegisterPropertyEditor(TypeInfo(TCollection), nil, '', TCollectionPropertyEditor);
|
||||||
RegisterPropertyEditor(ClassTypeInfo(TComponent),nil
|
RegisterPropertyEditor(TypeInfo(AnsiString), TFileDialog, 'Filter', TFileDlgFilterProperty);
|
||||||
,'',TComponentPropertyEditor);
|
RegisterPropertyEditor(TypeInfo(AnsiString), TFileNameEdit, 'Filter', TFileDlgFilterProperty);
|
||||||
RegisterPropertyEditor(ClassTypeInfo(TCollection),
|
RegisterPropertyEditor(TypeInfo(AnsiString), TCustomPropertyStorage, 'Filename', TFileNamePropertyEditor);
|
||||||
nil,'',TCollectionPropertyEditor);
|
RegisterPropertyEditor(TypeInfo(TAnchorSide), TControl, 'AnchorSideLeft', THiddenPropertyEditor);
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('AnsiString'),
|
RegisterPropertyEditor(TypeInfo(TAnchorSide), TControl, 'AnchorSideTop', THiddenPropertyEditor);
|
||||||
TFileDialog, 'Filter', TFileDlgFilterProperty);
|
RegisterPropertyEditor(TypeInfo(TAnchorSide), TControl, 'AnchorSideRight', THiddenPropertyEditor);
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('AnsiString'),
|
RegisterPropertyEditor(TypeInfo(TAnchorSide), TControl, 'AnchorSideBottom', THiddenPropertyEditor);
|
||||||
TFileNameEdit, 'Filter', TFileDlgFilterProperty);
|
RegisterPropertyEditor(TypeInfo(LongInt), TControl, 'ClientWidth', THiddenPropertyEditor);
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('AnsiString'),
|
RegisterPropertyEditor(TypeInfo(LongInt), TControl, 'ClientHeight', THiddenPropertyEditor);
|
||||||
TCustomPropertyStorage, 'Filename', TFileNamePropertyEditor);
|
RegisterPropertyEditor(TypeInfo(AnsiString), TCustomForm, 'LCLVersion', THiddenPropertyEditor);
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TAnchorSide'),
|
RegisterPropertyEditor(TypeInfo(AnsiString), TCustomFrame, 'LCLVersion', THiddenPropertyEditor);
|
||||||
TControl, 'AnchorSideLeft', THiddenPropertyEditor);
|
RegisterPropertyEditor(TypeInfo(TCustomPage), TCustomNotebook, 'ActivePage', TNoteBookActiveControlPropertyEditor);
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TAnchorSide'),
|
|
||||||
TControl, 'AnchorSideTop', THiddenPropertyEditor);
|
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TAnchorSide'),
|
|
||||||
TControl, 'AnchorSideRight', THiddenPropertyEditor);
|
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('TAnchorSide'),
|
|
||||||
TControl, 'AnchorSideBottom', THiddenPropertyEditor);
|
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('longint'),
|
|
||||||
TControl, 'ClientWidth', THiddenPropertyEditor);
|
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('longint'),
|
|
||||||
TControl, 'ClientHeight', THiddenPropertyEditor);
|
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('AnsiString'),
|
|
||||||
TCustomForm, 'LCLVersion', THiddenPropertyEditor);
|
|
||||||
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('AnsiString'),
|
|
||||||
TCustomFrame, 'LCLVersion', THiddenPropertyEditor);
|
|
||||||
RegisterPropertyEditor(ClassTypeInfo(TCustomPage),
|
|
||||||
TCustomNotebook, 'ActivePage', TNoteBookActiveControlPropertyEditor);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure FinalPropEdits;
|
procedure FinalPropEdits;
|
||||||
@ -6831,9 +6720,6 @@ begin
|
|||||||
|
|
||||||
FreeAndNil(ListPropertyEditors);
|
FreeAndNil(ListPropertyEditors);
|
||||||
FreeAndNil(VirtualKeyStrings);
|
FreeAndNil(VirtualKeyStrings);
|
||||||
|
|
||||||
// XXX workaround for buggy typeinfo function
|
|
||||||
DummyClassForPropTypes.Free;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure EditCollection(AComponent: TComponent; ACollection: TCollection; APropertyName: String);
|
procedure EditCollection(AComponent: TComponent; ACollection: TCollection; APropertyName: String);
|
||||||
|
Loading…
Reference in New Issue
Block a user