mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 04:19:12 +02:00
lcl: lcltranslator: fixed using property path, instead of subcomponent names, subcomponents names can be empty, same as IDE
git-svn-id: trunk@56121 -
This commit is contained in:
parent
d37434a214
commit
136dc9b9aa
@ -52,7 +52,7 @@ type
|
|||||||
TUpdateTranslator = class(TAbstractTranslator)
|
TUpdateTranslator = class(TAbstractTranslator)
|
||||||
private
|
private
|
||||||
FStackPath: string;
|
FStackPath: string;
|
||||||
procedure IntUpdateTranslation(AnInstance: TPersistent);
|
procedure IntUpdateTranslation(AnInstance: TPersistent; Level: integer = 0);
|
||||||
public
|
public
|
||||||
procedure UpdateTranslation(AnInstance: TPersistent);
|
procedure UpdateTranslation(AnInstance: TPersistent);
|
||||||
end;
|
end;
|
||||||
@ -316,7 +316,7 @@ var
|
|||||||
|
|
||||||
{ TUpdateTranslator }
|
{ TUpdateTranslator }
|
||||||
|
|
||||||
procedure TUpdateTranslator.IntUpdateTranslation(AnInstance: TPersistent);
|
procedure TUpdateTranslator.IntUpdateTranslation(AnInstance: TPersistent; Level: integer = 0);
|
||||||
var
|
var
|
||||||
i,j: integer;
|
i,j: integer;
|
||||||
APropCount: integer;
|
APropCount: integer;
|
||||||
@ -327,13 +327,16 @@ var
|
|||||||
StoreStackPath: string;
|
StoreStackPath: string;
|
||||||
AComponent, SubComponent: TComponent;
|
AComponent, SubComponent: TComponent;
|
||||||
begin
|
begin
|
||||||
|
{$IFDEF VerbosePOTranslator}
|
||||||
|
debugln(['TUpdateTranslator.IntUpdateTranslation START ',DbgSName(AnInstance),' Level=',Level]);
|
||||||
|
{$ENDIF}
|
||||||
APropCount := GetPropList(AnInstance.ClassInfo, APropList);
|
APropCount := GetPropList(AnInstance.ClassInfo, APropList);
|
||||||
try
|
try
|
||||||
for i := 0 to APropCount-1 do
|
for i := 0 to APropCount-1 do
|
||||||
begin
|
begin
|
||||||
APropInfo:=APropList^[i];
|
APropInfo:=APropList^[i];
|
||||||
if Assigned(PPropInfo(APropInfo)^.GetProc) and
|
if Assigned(PPropInfo(APropInfo)^.GetProc) and
|
||||||
assigned(APropInfo^.PropType) and
|
Assigned(APropInfo^.PropType) and
|
||||||
IsStoredProp(AnInstance, APropInfo) then
|
IsStoredProp(AnInstance, APropInfo) then
|
||||||
case APropInfo^.PropType^.Kind of
|
case APropInfo^.PropType^.Kind of
|
||||||
tkSString,
|
tkSString,
|
||||||
@ -360,7 +363,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
StoreStackPath:=FStackPath;
|
StoreStackPath:=FStackPath;
|
||||||
FStackPath:=FStackPath+'.'+APropInfo^.Name+'['+IntToStr(j)+']';
|
FStackPath:=FStackPath+'.'+APropInfo^.Name+'['+IntToStr(j)+']';
|
||||||
IntUpdateTranslation(TCollection(APersistentProp).Items[j]);
|
IntUpdateTranslation(TCollection(APersistentProp).Items[j],Level+1);
|
||||||
FStackPath:=StoreStackPath;
|
FStackPath:=StoreStackPath;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
@ -369,12 +372,11 @@ begin
|
|||||||
if APersistentProp is TComponent then
|
if APersistentProp is TComponent then
|
||||||
begin
|
begin
|
||||||
AComponent:=TComponent(APersistentProp);
|
AComponent:=TComponent(APersistentProp);
|
||||||
if AComponent.Name='' then continue;
|
|
||||||
if (csSubComponent in AComponent.ComponentStyle) then
|
if (csSubComponent in AComponent.ComponentStyle) then
|
||||||
begin
|
begin
|
||||||
StoreStackPath:=FStackPath;
|
StoreStackPath:=FStackPath;
|
||||||
FStackPath:=FStackPath+'.'+AComponent.Name;
|
FStackPath:=FStackPath+'.'+APropInfo^.Name;
|
||||||
IntUpdateTranslation(APersistentProp);
|
IntUpdateTranslation(APersistentProp,Level+1);
|
||||||
FStackPath:=StoreStackPath;
|
FStackPath:=StoreStackPath;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -382,7 +384,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
StoreStackPath:=FStackPath;
|
StoreStackPath:=FStackPath;
|
||||||
FStackPath:=FStackPath+'.'+APropInfo^.Name;
|
FStackPath:=FStackPath+'.'+APropInfo^.Name;
|
||||||
IntUpdateTranslation(APersistentProp);
|
IntUpdateTranslation(APersistentProp,Level+1);
|
||||||
FStackPath:=StoreStackPath;
|
FStackPath:=StoreStackPath;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -391,21 +393,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
freemem(APropList);
|
Freemem(APropList);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (AnInstance is TComponent) then
|
if (Level=0) and (AnInstance is TComponent) then
|
||||||
begin
|
begin
|
||||||
AComponent:=TComponent(AnInstance);
|
AComponent:=TComponent(AnInstance);
|
||||||
for i := 0 to AComponent.ComponentCount-1 do
|
for i := 0 to AComponent.ComponentCount-1 do
|
||||||
begin
|
begin
|
||||||
SubComponent:=AComponent.Components[i];
|
SubComponent:=AComponent.Components[i];
|
||||||
if SubComponent.Name='' then continue;
|
|
||||||
StoreStackPath:=FStackPath;
|
StoreStackPath:=FStackPath;
|
||||||
if SubComponent is TCustomFrame then
|
if SubComponent is TCustomFrame then
|
||||||
UpdateTranslation(SubComponent);
|
UpdateTranslation(SubComponent);
|
||||||
|
if SubComponent.Name='' then continue;
|
||||||
FStackPath:=StoreStackPath+'.'+SubComponent.Name;
|
FStackPath:=StoreStackPath+'.'+SubComponent.Name;
|
||||||
IntUpdateTranslation(SubComponent);
|
IntUpdateTranslation(SubComponent,Level+1);
|
||||||
FStackPath:=StoreStackPath;
|
FStackPath:=StoreStackPath;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user