mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-25 23:28:14 +02:00
IDEIntf: OI: showing nested controls in component tree view
git-svn-id: trunk@15739 -
This commit is contained in:
parent
4d27d2dca5
commit
7d929286db
@ -121,8 +121,7 @@ begin
|
|||||||
AComponent:=TComponent(ANode.Data);
|
AComponent:=TComponent(ANode.Data);
|
||||||
if AComponent=nil then
|
if AComponent=nil then
|
||||||
RaiseGDBException('TComponentTreeView.DoSelectionChanged ANode.Data=nil');
|
RaiseGDBException('TComponentTreeView.DoSelectionChanged ANode.Data=nil');
|
||||||
if (AComponent=PropertyEditorHook.LookupRoot)
|
if GetLookupRootForComponent(AComponent)=PropertyEditorHook.LookupRoot
|
||||||
or (AComponent.Owner=PropertyEditorHook.LookupRoot)
|
|
||||||
then
|
then
|
||||||
NewSelection.Add(AComponent);
|
NewSelection.Add(AComponent);
|
||||||
ANode:=ANode.GetNextMultiSelected;
|
ANode:=ANode.GetNextMultiSelected;
|
||||||
@ -257,7 +256,7 @@ end;
|
|||||||
destructor TComponentTreeView.Destroy;
|
destructor TComponentTreeView.Destroy;
|
||||||
begin
|
begin
|
||||||
FreeThenNil(FComponentList);
|
FreeThenNil(FComponentList);
|
||||||
FImageList.Free;
|
FreeThenNil(FImageList);
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -277,7 +276,7 @@ var
|
|||||||
if AControl=nil then exit;
|
if AControl=nil then exit;
|
||||||
for i:=0 to AControl.ControlCount-1 do begin
|
for i:=0 to AControl.ControlCount-1 do begin
|
||||||
CurControl:=AControl.Controls[i];
|
CurControl:=AControl.Controls[i];
|
||||||
if CurControl.Owner<>AControl.Owner then continue;
|
if GetLookupRootForComponent(CurControl)<>RootComponent then continue;
|
||||||
AVLNode:=Candidates.FindKey(CurControl,
|
AVLNode:=Candidates.FindKey(CurControl,
|
||||||
TListSortCompare(@ComparePersistentWithComponentCandidate));
|
TListSortCompare(@ComparePersistentWithComponentCandidate));
|
||||||
Candidate:=TComponentCandidate(AVLNode.Data);
|
Candidate:=TComponentCandidate(AVLNode.Data);
|
||||||
@ -320,6 +319,28 @@ var
|
|||||||
end;
|
end;
|
||||||
ANode.Expanded:=true;
|
ANode.Expanded:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure AddCandidates(OwnerComponent: TComponent);
|
||||||
|
var
|
||||||
|
AComponent: TComponent;
|
||||||
|
Candidate: TComponentCandidate;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
if OwnerComponent=nil then exit;
|
||||||
|
for i:=0 to OwnerComponent.ComponentCount-1 do begin
|
||||||
|
AComponent:=OwnerComponent.Components[i];
|
||||||
|
Candidate:=TComponentCandidate.Create;
|
||||||
|
Candidate.APersistent:=AComponent;
|
||||||
|
if Candidates.Find(Candidate)<>nil then begin
|
||||||
|
DebugLn('WARNING: TComponentTreeView.RebuildComponentNodes doppelganger found ',AComponent.Name);
|
||||||
|
Candidate.Free;
|
||||||
|
end else begin
|
||||||
|
Candidates.Add(Candidate);
|
||||||
|
if csInline in AComponent.ComponentState then
|
||||||
|
AddCandidates(AComponent);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
OldExpanded: TTreeNodeExpandedState;
|
OldExpanded: TTreeNodeExpandedState;
|
||||||
@ -355,23 +376,11 @@ begin
|
|||||||
Candidate.Added:=true;
|
Candidate.Added:=true;
|
||||||
Candidates.Add(Candidate);
|
Candidates.Add(Candidate);
|
||||||
|
|
||||||
if RootObject is TComponent then begin
|
|
||||||
RootComponent:=TComponent(RootObject);
|
|
||||||
for i:=0 to RootComponent.ComponentCount-1 do begin
|
|
||||||
AComponent:=RootComponent.Components[i];
|
|
||||||
Candidate:=TComponentCandidate.Create;
|
|
||||||
Candidate.APersistent:=AComponent;
|
|
||||||
if Candidates.Find(Candidate)<>nil then begin
|
|
||||||
DebugLn('WARNING: TComponentTreeView.RebuildComponentNodes doppelganger found ',AComponent.Name);
|
|
||||||
Candidate.Free;
|
|
||||||
end else
|
|
||||||
Candidates.Add(Candidate);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// add components in creation order and TControl.Parent relationship
|
// add components in creation order and TControl.Parent relationship
|
||||||
if RootObject is TComponent then begin
|
if RootObject is TComponent then begin
|
||||||
RootComponent:=TComponent(RootObject);
|
RootComponent:=TComponent(RootObject);
|
||||||
|
AddCandidates(RootComponent);
|
||||||
|
|
||||||
for i:=0 to RootComponent.ComponentCount-1 do begin
|
for i:=0 to RootComponent.ComponentCount-1 do begin
|
||||||
AComponent:=RootComponent.Components[i];
|
AComponent:=RootComponent.Components[i];
|
||||||
AVLNode:=Candidates.FindKey(AComponent,
|
AVLNode:=Candidates.FindKey(AComponent,
|
||||||
|
Loading…
Reference in New Issue
Block a user