| 30 |
|
VTHPopup: TVTHeaderPopupMenu; |
| 31 |
|
btn_export: TButton; |
| 32 |
|
btn_import: TButton; |
| 33 |
+ |
vst_popup: TPopupMenu; |
| 34 |
+ |
vst_newRoot: TMenuItem; |
| 35 |
+ |
vst_setRoot: TMenuItem; |
| 36 |
|
procedure FormCreate(Sender: TObject); |
| 37 |
|
procedure VSTInitChildren(Sender: TBaseVirtualTree; Node: PVirtualNode; |
| 38 |
|
var ChildCount: Cardinal); |
| 47 |
|
procedure VSTPaintText(Sender: TBaseVirtualTree; |
| 48 |
|
const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; |
| 49 |
|
TextType: TVSTTextType); |
| 50 |
+ |
procedure VSTGetPopupMenu(Sender: TBaseVirtualTree; Node: PVirtualNode; |
| 51 |
+ |
Column: TColumnIndex; const P: TPoint; var AskParent: Boolean; |
| 52 |
+ |
var PopupMenu: TPopupMenu); |
| 53 |
+ |
procedure vst_setRootClick(Sender: TObject); |
| 54 |
|
private |
| 55 |
|
root: TTreeElement; |
| 56 |
|
procedure NewCon(ID: Integer); |
| 57 |
|
public |
| 58 |
+ |
procedure SetRoot(TreeElem: TTreeElement); |
| 59 |
|
end; |
| 60 |
|
|
| 61 |
|
|
| 83 |
|
|
| 84 |
|
|
| 85 |
|
procedure TForm_Meta.NewCon(ID: Integer); |
| 86 |
+ |
begin |
| 87 |
+ |
if ID >= 0 then |
| 88 |
+ |
SetRoot(ConManager.Connection[FConnectionID].MetaData.Root); |
| 89 |
+ |
end; |
| 90 |
+ |
|
| 91 |
+ |
|
| 92 |
+ |
procedure TForm_Meta.SetRoot(TreeElem: TTreeElement); |
| 93 |
|
var |
| 94 |
|
i: Integer; |
| 95 |
|
data: TNodeData; |
| 96 |
|
node: PVirtualNode; |
| 82 |
– |
Meta: TMetaManager; |
| 83 |
– |
root: TTreeElement; |
| 97 |
|
begin |
| 98 |
< |
if ID >= 0 then |
| 99 |
< |
begin |
| 100 |
< |
//VST |
| 101 |
< |
VST.Clear; |
| 102 |
< |
VST.BeginUpdate; |
| 103 |
< |
// root := ConManager.Connection[FConnectionID].MetaData.Root; |
| 104 |
< |
root := ConManager.Connection[FConnectionID].MetaData.FileById[454]; |
| 105 |
< |
for i := 0 to root.ChildCount - 1 do |
| 106 |
< |
begin |
| 107 |
< |
data.Field := root.Child[i]; |
| 95 |
< |
node := AddVSTEntry(VST, nil, data); |
| 98 |
> |
if FConnectionID <> TreeElem.ConnectionID then |
| 99 |
> |
SelectConnection(TreeElem.ConnectionID); |
| 100 |
> |
root := TreeElem; |
| 101 |
> |
VST.Clear; |
| 102 |
> |
VST.BeginUpdate; |
| 103 |
> |
for i := 0 to root.ChildCount - 1 do |
| 104 |
> |
begin |
| 105 |
> |
data.Field := root.Child[i]; |
| 106 |
> |
node := AddVSTEntry(VST, nil, data); |
| 107 |
> |
if data.Field.ChildCount > 0 then |
| 108 |
|
VST.HasChildren[node] := True; |
| 97 |
– |
end; |
| 98 |
– |
VST.EndUpdate; |
| 109 |
|
end; |
| 110 |
+ |
VST.EndUpdate; |
| 111 |
|
end; |
| 112 |
|
|
| 102 |
– |
|
| 113 |
|
procedure TForm_Meta.VSTInitChildren(Sender: TBaseVirtualTree; |
| 114 |
|
Node: PVirtualNode; var ChildCount: Cardinal); |
| 115 |
|
var |
| 248 |
|
|
| 249 |
|
|
| 250 |
|
|
| 251 |
+ |
procedure TForm_Meta.VSTGetPopupMenu(Sender: TBaseVirtualTree; |
| 252 |
+ |
Node: PVirtualNode; Column: TColumnIndex; const P: TPoint; |
| 253 |
+ |
var AskParent: Boolean; var PopupMenu: TPopupMenu); |
| 254 |
+ |
var |
| 255 |
+ |
data: PNodeData; |
| 256 |
+ |
begin |
| 257 |
+ |
inherited; |
| 258 |
+ |
AskParent := False; |
| 259 |
+ |
if Assigned(Node) then |
| 260 |
+ |
begin |
| 261 |
+ |
Sender.Selected[Node] := True; |
| 262 |
+ |
Sender.FocusedNode := Node; |
| 263 |
+ |
data := Sender.GetNodeData(Node); |
| 264 |
+ |
if Column = 0 then |
| 265 |
+ |
begin |
| 266 |
+ |
if TTreeElement(data.Field).GetChildCount > 0 then |
| 267 |
+ |
PopupMenu := vst_popup |
| 268 |
+ |
else |
| 269 |
+ |
PopupMenu := nil; |
| 270 |
+ |
end; |
| 271 |
+ |
end; |
| 272 |
+ |
end; |
| 273 |
+ |
|
| 274 |
+ |
procedure TForm_Meta.vst_setRootClick(Sender: TObject); |
| 275 |
+ |
var |
| 276 |
+ |
data: PNodeData; |
| 277 |
+ |
begin |
| 278 |
+ |
inherited; |
| 279 |
+ |
data := VST.GetNodeData(VST.FocusedNode); |
| 280 |
+ |
SetRoot(data.Field); |
| 281 |
+ |
end; |
| 282 |
+ |
|
| 283 |
|
procedure TForm_Meta.FormClose(Sender: TObject; var Action: TCloseAction); |
| 284 |
|
begin |
| 285 |
|
// Meta.Free; |