IDE: designer: selection checks parent level for non visual icons

git-svn-id: trunk@23023 -
This commit is contained in:
mattias 2009-12-08 11:07:05 +00:00
parent fa76b6d423
commit 69219dadbc

View File

@ -393,7 +393,9 @@ type
TComponentSearch = class(TComponent) TComponentSearch = class(TComponent)
public public
Best: TComponent; Best: TComponent;
BestLevel: integer;
BestIsNonVisual: boolean; BestIsNonVisual: boolean;
Level: integer;
AtPos: TPoint; AtPos: TPoint;
MinClass: TComponentClass; MinClass: TComponentClass;
IgnoreHidden: boolean; IgnoreHidden: boolean;
@ -413,7 +415,7 @@ var
OldRoot: TComponent; OldRoot: TComponent;
IsNonVisual: Boolean; IsNonVisual: Boolean;
begin begin
if (Best<>nil) and BestIsNonVisual then exit; if (Best<>nil) and BestIsNonVisual and (BestLevel<=Level) then exit;
{$IFDEF VerboseDesignerSelect} {$IFDEF VerboseDesignerSelect}
DebugLn(['TComponentSearch.Gather ',DbgSName(Child),' ',dbgs(AtPos),' MinClass=',DbgSName(MinClass)]); DebugLn(['TComponentSearch.Gather ',DbgSName(Child),' ',dbgs(AtPos),' MinClass=',DbgSName(MinClass)]);
{$ENDIF} {$ENDIF}
@ -444,6 +446,7 @@ begin
{$ENDIF} {$ENDIF}
OldRoot:=Root; OldRoot:=Root;
try try
inc(Level);
if csInline in Child.ComponentState then if csInline in Child.ComponentState then
Root:=Child; Root:=Child;
{$IFDEF VerboseDesignerSelect} {$IFDEF VerboseDesignerSelect}
@ -451,6 +454,7 @@ begin
{$ENDIF} {$ENDIF}
TComponentSearch(Child).GetChildren(@Gather,Root); TComponentSearch(Child).GetChildren(@Gather,Root);
finally finally
dec(Level);
Root:=OldRoot; Root:=OldRoot;
end; end;
{$IFDEF VerboseDesignerSelect} {$IFDEF VerboseDesignerSelect}
@ -468,6 +472,8 @@ begin
if not Child.InheritsFrom(MinClass) then exit; if not Child.InheritsFrom(MinClass) then exit;
if OnlyNonVisual and not IsNonVisual then exit; if OnlyNonVisual and not IsNonVisual then exit;
Best:=Child; Best:=Child;
BestIsNonVisual:=IsNonVisual;
BestLevel:=Level;
{$IFDEF VerboseDesignerSelect} {$IFDEF VerboseDesignerSelect}
DebugLn(['TComponentSearch.Gather Best=',DbgSName(Best)]); DebugLn(['TComponentSearch.Gather Best=',DbgSName(Best)]);
{$ENDIF} {$ENDIF}
@ -477,7 +483,9 @@ end;
procedure TComponentSearch.Search(ARoot: TComponent); procedure TComponentSearch.Search(ARoot: TComponent);
begin begin
Root:=ARoot; Root:=ARoot;
Level:=1;
TComponentSearch(Root).GetChildren(@Gather,Root); TComponentSearch(Root).GetChildren(@Gather,Root);
Level:=0;
end; end;
const const