+ Patch for localization of string properties

This commit is contained in:
michael 2004-12-27 13:51:37 +00:00
parent 0a6f2109aa
commit 3eb1516253
3 changed files with 30 additions and 5 deletions

View File

@ -834,6 +834,10 @@ type
TCreateComponentEvent = procedure(Reader: TReader;
ComponentClass: TComponentClass; var Component: TComponent) of object;
TReadWriteStringPropertyEvent = procedure(Sender:TObject;
const Instance: TPersistent; PropInfo: PPropInfo;
var Content:string) of object;
TReader = class(TFiler)
private
FDriver: TAbstractObjectReader;
@ -852,6 +856,7 @@ type
FOnCreateComponent: TCreateComponentEvent;
FPropName: string;
FCanHandleExcepts: Boolean;
FOnReadStringProperty:TReadWriteStringPropertyEvent;
procedure DoFixupReferences;
procedure FreeFixups;
function FindComponentClass(const AClassName: string): TComponentClass;
@ -911,6 +916,7 @@ type
property OnAncestorNotFound: TAncestorNotFoundEvent read FOnAncestorNotFound write FOnAncestorNotFound;
property OnCreateComponent: TCreateComponentEvent read FOnCreateComponent write FOnCreateComponent;
property OnFindComponentClass: TFindComponentClassEvent read FOnFindComponentClass write FOnFindComponentClass;
property OnReadStringProperty: TReadWriteStringPropertyEvent read FOnReadStringProperty write FOnReadStringProperty;
end;
@ -1002,6 +1008,7 @@ type
FChildPos: Integer;
FOnFindAncestor: TFindAncestorEvent;
FOnWriteMethodProperty: TWriteMethodPropertyEvent;
FOnWriteStringProperty: TReadWriteStringPropertyEvent;
procedure AddToAncestorList(Component: TComponent);
procedure WriteComponentData(Instance: TComponent);
protected
@ -1039,6 +1046,7 @@ type
property RootAncestor: TComponent read FRootAncestor write FRootAncestor;
property OnFindAncestor: TFindAncestorEvent read FOnFindAncestor write FOnFindAncestor;
property OnWriteMethodProperty: TWriteMethodPropertyEvent read FOnWriteMethodProperty write FOnWriteMethodProperty;
property OnWriteStringProperty: TReadWriteStringPropertyEvent read FOnWriteStringProperty write FOnWriteStringProperty;
property Driver: TAbstractObjectWriter read FDriver;
end;
@ -1470,7 +1478,10 @@ function LineStart(Buffer, BufPos: PChar): PChar;
{
$Log$
Revision 1.3 2004-08-07 16:32:52 florian
Revision 1.4 2004-12-27 13:53:27 michael
+ Patch for localization of string properties
Revision 1.3 2004/08/07 16:32:52 florian
* tcomponent.destroying is now called in tcomponent.beforedestruction
Revision 1.2 2003/10/07 19:41:11 marco

View File

@ -1017,6 +1017,7 @@ var
Ident: String;
Method: TMethod;
Handled: Boolean;
TmpStr: String;
begin
if not Assigned(PPropInfo(PropInfo)^.SetProc) then
raise EReadError.Create(SReadOnlyProperty);
@ -1072,7 +1073,12 @@ begin
end;
end;
tkSString, tkLString, tkAString, tkWString:
SetStrProp(Instance, PropInfo, ReadString);
begin
TmpStr:=ReadString;
if Assigned(FOnReadStringProperty) then
FOnReadStringProperty(Self,Instance,PropInfo,TmpStr);
SetStrProp(Instance, PropInfo, TmpStr);
end;
{!!!: tkVariant}
tkClass:
case FDriver.NextValue of
@ -1304,7 +1310,10 @@ end;
{
$Log$
Revision 1.2 2003-12-15 08:57:24 michael
Revision 1.3 2004-12-27 13:53:27 michael
+ Patch for localization of string properties
Revision 1.2 2003/12/15 08:57:24 michael
Patch from Darek Mazur for reading idents from property stream
Revision 1.2 2003/12/15 08:55:56 michael
@ -1324,4 +1333,4 @@ end;
Revision 1.6 2002/09/07 15:15:25 peter
* old logs removed and tabs fixed
}
}

View File

@ -697,6 +697,8 @@ begin
if StrValue <> DefStrValue then
begin
Driver.BeginProperty(FPropPath + PPropInfo(PropInfo)^.Name);
if Assigned(FOnWriteStringProperty) then
FOnWriteStringProperty(Self,Instance,PropInfo,StrValue);
WriteString(StrValue);
Driver.EndProperty;
end;
@ -832,7 +834,10 @@ end;}
{
$Log$
Revision 1.1 2003-10-06 20:33:58 peter
Revision 1.2 2004-12-27 13:53:27 michael
+ Patch for localization of string properties
Revision 1.1 2003/10/06 20:33:58 peter
* classes moved to rtl for 1.1
* classes .inc and classes.pp files moved to fcl/classes for
backwards 1.0.x compatiblity to have it in the fcl