| 2 | 
   | 
 interface | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 3 | 
   | 
 uses | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 4 | 
   | 
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, | 
 
 
 
 
 
 
 
 
 
 
 
 | 5 | 
 < | 
   Dialogs, VirtualTrees, _MetaManager, StdCtrls; | 
 
 
 
 
 
 
 
 
 
 | 5 | 
 > | 
   Dialogs, VirtualTrees, _MetaManager, StdCtrls, ExtCtrls; | 
 
 
 
 
 
 
 
 
 
 
 
 | 6 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 7 | 
   | 
 type | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 8 | 
   | 
   TForm_Meta = class(TForm) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 9 | 
   | 
     VST: TVirtualStringTree; | 
 
 
 
 
 
 
 
 
 | 10 | 
 + | 
     Panel1: TPanel; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 11 | 
   | 
     Button1: TButton; | 
 
 
 
 
 
 
 
 
 
 | 11 | 
 – | 
     Label3: TLabel; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 12 | 
   | 
     combo_connection: TComboBox; | 
 
 
 
 
 
 
 
 
 | 13 | 
 + | 
     Label3: TLabel; | 
 
 
 
 
 
 
 
 
 | 14 | 
 + | 
     Splitter1: TSplitter; | 
 
 
 
 
 
 
 
 
 | 15 | 
 + | 
     Panel2: TPanel; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 16 | 
   | 
     procedure FormClose(Sender: TObject; var Action: TCloseAction); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 17 | 
   | 
     procedure FormCreate(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 18 | 
   | 
     procedure VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 23 | 
   | 
     procedure VSTPaintText(Sender: TBaseVirtualTree; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 24 | 
   | 
       const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 25 | 
   | 
       TextType: TVSTTextType); | 
 
 
 
 
 
 
 
 
 | 26 | 
 + | 
     procedure VSTFocusChanged(Sender: TBaseVirtualTree; Node: PVirtualNode; | 
 
 
 
 
 
 
 
 
 | 27 | 
 + | 
       Column: TColumnIndex); | 
 
 
 
 
 
 
 
 
 | 28 | 
 + | 
     procedure VSTFocusChanging(Sender: TBaseVirtualTree; OldNode, | 
 
 
 
 
 
 
 
 
 | 29 | 
 + | 
       NewNode: PVirtualNode; OldColumn, NewColumn: TColumnIndex; | 
 
 
 
 
 
 
 
 
 | 30 | 
 + | 
       var Allowed: Boolean); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 31 | 
   | 
   private | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 32 | 
   | 
   public | 
 
 
 
 
 
 
 
 
 
 | 25 | 
 – | 
     MetaManager: TMetaManager; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 33 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 34 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 35 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 70 | 
   | 
   id: Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 71 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 72 | 
   | 
   data := VST.GetNodeData(node); | 
 
 
 
 
 
 
 
 
 
 
 
 | 73 | 
 < | 
   for i := 0 to MetaManager.FileById[TFile(data.Field).FileID].ChildCount - 1 do | 
 
 
 
 
 
 
 
 
 
 | 73 | 
 > | 
   for i := 0 to Meta.FileById[TFile(data.Field).FileID].ChildCount - 1 do | 
 
 
 
 
 
 
 
 
 
 
 
 | 74 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 75 | 
 < | 
     id := MetaManager.FileById[TFile(data.Field).FileID].LinkByIndex[i].DestID; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 76 | 
 < | 
     MetaManager.InitFile(id); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 77 | 
 < | 
     newdata.Field := MetaManager.FileById[id]; | 
 
 
 
 
 
 
 
 
 
 | 75 | 
 > | 
     id := Meta.FileById[TFile(data.Field).FileID].LinkByIndex[i].DestID; | 
 
 
 
 
 
 | 76 | 
 > | 
     Meta.InitFile(id); | 
 
 
 
 
 
 | 77 | 
 > | 
     newdata.Field := Meta.FileById[id]; | 
 
 
 
 
 
 
 
 
 
 
 
 | 78 | 
   | 
     newnode := AddVSTEntry(VST, Node, newdata); | 
 
 
 
 
 
 
 
 
 
 
 
 | 79 | 
 < | 
     if MetaManager.FileById[id].ChildCount > 0 then | 
 
 
 
 
 
 
 
 
 
 | 79 | 
 > | 
     if Meta.FileById[id].ChildCount > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 | 80 | 
   | 
       VST.HasChildren[newnode] := True; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 81 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 | 82 | 
 < | 
   ChildCount := MetaManager.FileById[TFile(data.Field).FileID].ChildCount; | 
 
 
 
 
 
 
 
 
 
 | 82 | 
 > | 
   ChildCount := Meta.FileById[TFile(data.Field).FileID].ChildCount; | 
 
 
 
 
 
 
 
 
 
 
 
 | 83 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 84 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 85 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 100 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 101 | 
   | 
     QueryPerformanceFrequency(c); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 102 | 
   | 
     QueryPerformanceCounter(a); | 
 
 
 
 
 
 
 
 
 
 
 
 | 103 | 
 < | 
     MetaManager := TMetaManager.Create(conid); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 103 | 
 > | 
     if not Assigned(Meta) then | 
 
 
 
 
 
 | 104 | 
 > | 
       Meta := TMetaManager.Create(conid); | 
 
 
 
 
 
 
 
 
 
 
 
 | 105 | 
   | 
     QueryPerformanceCounter(b); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 106 | 
   | 
     ShowMessage('Loading Done - ' + FloatToStr((b-a)/c) + 's'); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 107 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 108 | 
   | 
     VST.Clear; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 109 | 
   | 
     VST.BeginUpdate; | 
 
 
 
 
 
 
 
 
 
 
 
 | 110 | 
 < | 
     for i := 0 to MetaManager.FileCount - 1 do | 
 
 
 
 
 
 
 
 
 
 | 110 | 
 > | 
     for i := 0 to Meta.FileCount - 1 do | 
 
 
 
 
 
 
 
 
 
 
 
 | 111 | 
   | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 112 | 
 < | 
       if Assigned(MetaManager.FileById[i]) then | 
 
 
 
 
 
 
 
 
 
 | 112 | 
 > | 
       if Assigned(Meta.FileById[i]) then | 
 
 
 
 
 
 
 
 
 
 
 
 | 113 | 
   | 
       begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 114 | 
 < | 
         data.Field := MetaManager.FileById[i]; | 
 
 
 
 
 
 
 
 
 
 | 114 | 
 > | 
         data.Field := Meta.FileById[i]; | 
 
 
 
 
 
 
 
 
 
 
 
 | 115 | 
   | 
         node := AddVSTEntry(VST, nil, data); | 
 
 
 
 
 
 
 
 
 
 
 
 | 116 | 
 < | 
         if MetaManager.FileById[i].ChildCount > 0 then | 
 
 
 
 
 
 
 
 
 
 | 116 | 
 > | 
         if Meta.FileById[i].ChildCount > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 | 117 | 
   | 
           VST.HasChildren[node] := True; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 118 | 
   | 
       end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 119 | 
   | 
     end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 123 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 124 | 
   | 
 procedure TForm_Meta.FormClose(Sender: TObject; var Action: TCloseAction); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 125 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 126 | 
 < | 
   MetaManager.Free; | 
 
 
 
 
 
 
 
 
 
 | 126 | 
 > | 
   Meta.Free; | 
 
 
 
 
 
 
 
 
 
 
 
 | 127 | 
   | 
   Action := caFree; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 128 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 129 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 166 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 167 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 168 | 
   | 
  | 
 
 
 
 
 
 
 
 
 | 169 | 
 + | 
 procedure TForm_Meta.VSTFocusChanged(Sender: TBaseVirtualTree; | 
 
 
 
 
 
 
 
 
 | 170 | 
 + | 
   Node: PVirtualNode; Column: TColumnIndex); | 
 
 
 
 
 
 
 
 
 | 171 | 
 + | 
 var | 
 
 
 
 
 
 
 
 
 | 172 | 
 + | 
   data: PNodeData; | 
 
 
 
 
 
 
 
 
 | 173 | 
 + | 
 begin | 
 
 
 
 
 
 
 
 
 | 174 | 
 + | 
   data := Sender.GetNodeData(Node); | 
 
 
 
 
 
 
 
 
 | 175 | 
 + | 
   if data.Field is TFile then | 
 
 
 
 
 
 
 
 
 | 176 | 
 + | 
   begin | 
 
 
 
 
 
 
 
 
 | 177 | 
 + | 
     TFile(data.Field).InitEditor; | 
 
 
 
 
 
 
 
 
 | 178 | 
 + | 
     if Assigned(TFile(data.Field).Editor) then | 
 
 
 
 
 
 
 
 
 | 179 | 
 + | 
     begin | 
 
 
 
 
 
 
 
 
 | 180 | 
 + | 
       panel2.InsertControl(TFile(data.Field).Editor); | 
 
 
 
 
 
 
 
 
 | 181 | 
 + | 
       TFile(data.Field).Opened := True; | 
 
 
 
 
 
 
 
 
 | 182 | 
 + | 
     end; | 
 
 
 
 
 
 
 
 
 | 183 | 
 + | 
   end; | 
 
 
 
 
 
 
 
 
 | 184 | 
 + | 
 end; | 
 
 
 
 
 
 
 
 
 | 185 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 186 | 
 + | 
 procedure TForm_Meta.VSTFocusChanging(Sender: TBaseVirtualTree; OldNode, | 
 
 
 
 
 
 
 
 
 | 187 | 
 + | 
   NewNode: PVirtualNode; OldColumn, NewColumn: TColumnIndex; | 
 
 
 
 
 
 
 
 
 | 188 | 
 + | 
   var Allowed: Boolean); | 
 
 
 
 
 
 
 
 
 | 189 | 
 + | 
 var | 
 
 
 
 
 
 
 
 
 | 190 | 
 + | 
   data: PNodeData; | 
 
 
 
 
 
 
 
 
 | 191 | 
 + | 
   i: Integer; | 
 
 
 
 
 
 
 
 
 | 192 | 
 + | 
 begin | 
 
 
 
 
 
 
 
 
 | 193 | 
 + | 
   data := Sender.GetNodeData(NewNode); | 
 
 
 
 
 
 
 
 
 | 194 | 
 + | 
   if data.Field is TFile then | 
 
 
 
 
 
 
 
 
 | 195 | 
 + | 
   begin | 
 
 
 
 
 
 
 
 
 | 196 | 
 + | 
     TFile(data.Field).InitEditor; | 
 
 
 
 
 
 
 
 
 | 197 | 
 + | 
     if Assigned(TFile(data.Field).Editor) then | 
 
 
 
 
 
 
 
 
 | 198 | 
 + | 
       Allowed := not TFile(data.Field).Opened | 
 
 
 
 
 
 
 
 
 | 199 | 
 + | 
     else | 
 
 
 
 
 
 
 
 
 | 200 | 
 + | 
       Allowed := True; | 
 
 
 
 
 
 
 
 
 | 201 | 
 + | 
   end; | 
 
 
 
 
 
 
 
 
 | 202 | 
 + | 
   if Allowed and Assigned(OldNode) then | 
 
 
 
 
 
 
 
 
 | 203 | 
 + | 
   begin | 
 
 
 
 
 
 
 
 
 | 204 | 
 + | 
     data := Sender.GetNodeData(OldNode); | 
 
 
 
 
 
 
 
 
 | 205 | 
 + | 
     if data.Field is TFile then | 
 
 
 
 
 
 
 
 
 | 206 | 
 + | 
     begin | 
 
 
 
 
 
 
 
 
 | 207 | 
 + | 
       if TFile(data.Field).Opened then | 
 
 
 
 
 
 
 
 
 | 208 | 
 + | 
       begin | 
 
 
 
 
 
 
 
 
 | 209 | 
 + | 
         if panel2.ControlCount > 0 then | 
 
 
 
 
 
 
 
 
 | 210 | 
 + | 
           for i := 0 to panel2.ControlCount - 1 do | 
 
 
 
 
 
 
 
 
 | 211 | 
 + | 
             panel2.RemoveControl(panel2.Controls[i]); | 
 
 
 
 
 
 
 
 
 | 212 | 
 + | 
         TFile(data.Field).Opened := False; | 
 
 
 
 
 
 
 
 
 | 213 | 
 + | 
       end; | 
 
 
 
 
 
 
 
 
 | 214 | 
 + | 
     end; | 
 
 
 
 
 
 
 
 
 | 215 | 
 + | 
   end; | 
 
 
 
 
 
 
 
 
 | 216 | 
 + | 
 end; | 
 
 
 
 
 
 
 
 
 | 217 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 218 | 
   | 
 procedure TForm_Meta.VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 219 | 
   | 
   Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 220 | 
   | 
 var |