| 1 | 
   | 
 unit MetaEditor; | 
 
 
 
 
 
 
 
 
 | 2 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 3 | 
   | 
 interface | 
 
 
 
 
 
 
 
 
 | 4 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 5 | 
   | 
 uses | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 6 | 
   | 
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, | 
 
 
 
 
 
 
 
 
 
 
 
 | 7 | 
 < | 
   Dialogs, VirtualTrees, _MetaManager, StdCtrls, ExtCtrls; | 
 
 
 
 
 
 
 
 
 
 | 7 | 
 > | 
   Dialogs, _BaseTemplate, ExtCtrls, VirtualTrees, StdCtrls; | 
 
 
 
 
 
 
 
 
 
 
 
 | 8 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 9 | 
   | 
 type | 
 
 
 
 
 
 
 
 
 
 
 
 | 10 | 
 < | 
   TForm_Meta = class(TForm) | 
 
 
 
 
 
 
 
 
 
 | 10 | 
 > | 
   TForm_Meta = class(TForm_BaseTemplate) | 
 
 
 
 
 
 
 
 
 
 
 
 | 11 | 
   | 
     VST: TVirtualStringTree; | 
 
 
 
 
 
 
 
 
 
 | 10 | 
 – | 
     Panel1: TPanel; | 
 
 
 
 
 
 
 
 
 
 | 11 | 
 – | 
     Button1: TButton; | 
 
 
 
 
 
 
 
 
 
 | 12 | 
 – | 
     combo_connection: TComboBox; | 
 
 
 
 
 
 
 
 
 
 | 13 | 
 – | 
     Label3: TLabel; | 
 
 
 
 
 
 
 
 
 
 | 14 | 
 – | 
     Splitter1: TSplitter; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 12 | 
   | 
     Panel2: TPanel; | 
 
 
 
 
 
 
 
 
 
 
 
 | 13 | 
 < | 
     procedure FormClose(Sender: TObject; var Action: TCloseAction); | 
 
 
 
 
 
 
 
 
 
 | 13 | 
 > | 
     splitter: TSplitter; | 
 
 
 
 
 
 
 
 
 
 
 
 | 14 | 
   | 
     procedure FormCreate(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 | 18 | 
 – | 
     procedure VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; | 
 
 
 
 
 
 
 
 
 
 | 19 | 
 – | 
       Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString); | 
 
 
 
 
 
 
 
 
 
 | 20 | 
 – | 
     procedure Button1Click(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 15 | 
   | 
     procedure VSTInitChildren(Sender: TBaseVirtualTree; Node: PVirtualNode; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 16 | 
   | 
       var ChildCount: Cardinal); | 
 
 
 
 
 
 
 
 
 
 
 
 | 17 | 
 < | 
     procedure VSTPaintText(Sender: TBaseVirtualTree; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 24 | 
 < | 
       const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 25 | 
 < | 
       TextType: TVSTTextType); | 
 
 
 
 
 
 
 
 
 
 | 17 | 
 > | 
     procedure FormClose(Sender: TObject; var Action: TCloseAction); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 18 | 
   | 
     procedure VSTFocusChanged(Sender: TBaseVirtualTree; Node: PVirtualNode; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 19 | 
   | 
       Column: TColumnIndex); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 20 | 
   | 
     procedure VSTFocusChanging(Sender: TBaseVirtualTree; OldNode, | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 21 | 
   | 
       NewNode: PVirtualNode; OldColumn, NewColumn: TColumnIndex; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 22 | 
   | 
       var Allowed: Boolean); | 
 
 
 
 
 
 
 
 
 | 23 | 
 + | 
     procedure VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; | 
 
 
 
 
 
 
 
 
 | 24 | 
 + | 
       Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString); | 
 
 
 
 
 
 
 
 
 | 25 | 
 + | 
     procedure VSTPaintText(Sender: TBaseVirtualTree; | 
 
 
 
 
 
 
 
 
 | 26 | 
 + | 
       const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; | 
 
 
 
 
 
 
 
 
 | 27 | 
 + | 
       TextType: TVSTTextType); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 28 | 
   | 
   private | 
 
 
 
 
 
 
 
 
 | 29 | 
 + | 
     procedure NewCon(ID: Integer); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 30 | 
   | 
   public | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 31 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 32 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 | 35 | 
 – | 
 var | 
 
 
 
 
 
 
 
 
 
 | 36 | 
 – | 
   Form_Meta: TForm_Meta; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 33 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 34 | 
   | 
 implementation | 
 
 
 
 
 
 
 
 
 
 | 39 | 
 – | 
 uses | 
 
 
 
 
 
 
 
 
 
 | 40 | 
 – | 
   Data, _DataTypes, _FileTypes, ConnectionManager, TypeDefs, StrUtils; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 35 | 
   | 
 {$R *.dfm} | 
 
 
 
 
 
 
 
 
 | 36 | 
 + | 
 uses _MetaManager, _MetaTypes, ConnectionManager, Data; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 37 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 38 | 
   | 
 type | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 39 | 
   | 
   PNodeData = ^TNodeData; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 54 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 55 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 56 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 57 | 
 < | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 63 | 
 < | 
 procedure TForm_Meta.VSTInitChildren(Sender: TBaseVirtualTree; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 64 | 
 < | 
   Node: PVirtualNode; var ChildCount: Cardinal); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 65 | 
 < | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 66 | 
 < | 
   data: PNodeData; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 67 | 
 < | 
   newdata: TNodeData; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 68 | 
 < | 
   newnode: PVirtualNode; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 69 | 
 < | 
   i: Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 70 | 
 < | 
   id: Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 71 | 
 < | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 72 | 
 < | 
   data := VST.GetNodeData(node); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 73 | 
 < | 
   for i := 0 to Meta.FileById[TFile(data.Field).FileID].ChildCount - 1 do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 74 | 
 < | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 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 Meta.FileById[id].ChildCount > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 80 | 
 < | 
       VST.HasChildren[newnode] := True; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 81 | 
 < | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 82 | 
 < | 
   ChildCount := Meta.FileById[TFile(data.Field).FileID].ChildCount; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 83 | 
 < | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 84 | 
 < | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 85 | 
 < | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 86 | 
 < | 
 procedure TForm_Meta.Button1Click(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 | 57 | 
 > | 
 procedure TForm_Meta.NewCon(ID: Integer); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 58 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 | 88 | 
 – | 
   name: String; | 
 
 
 
 
 
 
 
 
 
 | 89 | 
 – | 
   conid: Integer; | 
 
 
 
 
 
 
 
 
 
 | 90 | 
 – | 
  | 
 
 
 
 
 
 
 
 
 
 | 91 | 
 – | 
   a,b,c: Int64; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 59 | 
   | 
   i: Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 60 | 
   | 
   data: TNodeData; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 61 | 
   | 
   node: PVirtualNode; | 
 
 
 
 
 
 
 
 
 | 62 | 
 + | 
   Meta: TMetaManager; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 63 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 64 | 
 < | 
   if combo_connection.ItemIndex >= 0 then | 
 
 
 
 
 
 
 
 
 
 | 64 | 
 > | 
   if ID >= 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 | 65 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 
 | 98 | 
 – | 
     name := combo_connection.Items.Strings[combo_connection.ItemIndex]; | 
 
 
 
 
 
 
 
 
 
 | 99 | 
 – | 
     conid := StrToInt(MidStr(name, Pos('[', name) + 1, Pos(']', name) - Pos('[', name)  - 1)); | 
 
 
 
 
 
 
 
 
 
 | 100 | 
 – | 
  | 
 
 
 
 
 
 
 
 
 
 | 101 | 
 – | 
     QueryPerformanceFrequency(c); | 
 
 
 
 
 
 
 
 
 
 | 102 | 
 – | 
     QueryPerformanceCounter(a); | 
 
 
 
 
 
 
 
 
 
 | 103 | 
 – | 
     if not Assigned(Meta) then | 
 
 
 
 
 
 
 
 
 
 | 104 | 
 – | 
       Meta := TMetaManager.Create(conid); | 
 
 
 
 
 
 
 
 
 
 | 105 | 
 – | 
     QueryPerformanceCounter(b); | 
 
 
 
 
 
 
 
 
 
 | 106 | 
 – | 
     ShowMessage('Loading Done - ' + FloatToStr((b-a)/c) + 's'); | 
 
 
 
 
 
 
 
 
 
 | 107 | 
 – | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 66 | 
   | 
     VST.Clear; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 67 | 
   | 
     VST.BeginUpdate; | 
 
 
 
 
 
 
 
 
 | 68 | 
 + | 
     Meta := ConManager.Connection[ID].MetaData; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 69 | 
   | 
     for i := 0 to Meta.FileCount - 1 do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 70 | 
   | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 71 | 
   | 
       if Assigned(Meta.FileById[i]) then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 80 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 81 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 82 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 | 124 | 
 – | 
 procedure TForm_Meta.FormClose(Sender: TObject; var Action: TCloseAction); | 
 
 
 
 
 
 
 
 
 
 | 125 | 
 – | 
 begin | 
 
 
 
 
 
 
 
 
 
 | 126 | 
 – | 
   Meta.Free; | 
 
 
 
 
 
 
 
 
 
 | 127 | 
 – | 
   Action := caFree; | 
 
 
 
 
 
 
 
 
 
 | 128 | 
 – | 
 end; | 
 
 
 
 
 
 
 
 
 
 | 129 | 
 – | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 83 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 84 | 
 < | 
 procedure TForm_Meta.FormCreate(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 84 | 
 > | 
 procedure TForm_Meta.VSTInitChildren(Sender: TBaseVirtualTree; | 
 
 
 
 
 
 | 85 | 
 > | 
   Node: PVirtualNode; var ChildCount: Cardinal); | 
 
 
 
 
 
 
 
 
 
 
 
 | 86 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 | 87 | 
 + | 
   data: PNodeData; | 
 
 
 
 
 
 
 
 
 | 88 | 
 + | 
   newdata: TNodeData; | 
 
 
 
 
 
 
 
 
 | 89 | 
 + | 
   newnode: PVirtualNode; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 90 | 
   | 
   i: Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 | 91 | 
 < | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 92 | 
 < | 
   fn, datatype, boxstring: String; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 136 | 
 < | 
   level: Integer; | 
 
 
 
 
 
 
 
 
 
 | 91 | 
 > | 
   id: Integer; | 
 
 
 
 
 
 | 92 | 
 > | 
   Meta: TMetaManager; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 93 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 94 | 
 < | 
   combo_connection.ItemIndex := -1; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 95 | 
 < | 
   combo_connection.Items.Clear; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 96 | 
 < | 
   if ConManager.Count > 0 then | 
 
 
 
 
 
 
 
 
 
 | 94 | 
 > | 
   data := Sender.GetNodeData(node); | 
 
 
 
 
 
 | 95 | 
 > | 
   Meta := ConManager.Connection[ID].MetaData; | 
 
 
 
 
 
 | 96 | 
 > | 
   for i := 0 to TFile(data.Field).ChildCount - 1 do | 
 
 
 
 
 
 
 
 
 
 
 
 | 97 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 98 | 
 < | 
     for i := 0 to ConManager.Count - 1 do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 99 | 
 < | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 100 | 
 < | 
       level := ConManager.ConnectionByIndex[i].LevelNumber; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 101 | 
 < | 
       fn := ExtractFileName(ConManager.ConnectionByIndex[i].FileName); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 102 | 
 < | 
       if ConManager.ConnectionByIndex[i].Backend = DB_ONI then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 103 | 
 < | 
         datatype := 'ONI-.dat: ' | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 148 | 
 < | 
       else if ConManager.ConnectionByIndex[i].Backend = DB_ADB then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 149 | 
 < | 
         datatype := 'OUP-DB: ' | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 150 | 
 < | 
       else | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 151 | 
 < | 
         datatype := 'Unknown: '; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 152 | 
 < | 
       boxstring := datatype + fn + ' (Level: ' + IntToStr(level) + ') [' + IntToStr(ConManager.ConnectionByIndex[i].ConnectionID) + ']'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 153 | 
 < | 
       combo_connection.Items.Add(boxstring); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 154 | 
 < | 
     end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 155 | 
 < | 
     if combo_connection.ItemIndex = -1 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 156 | 
 < | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 157 | 
 < | 
       combo_connection.ItemIndex := 0; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 158 | 
 < | 
     end; | 
 
 
 
 
 
 
 
 
 
 | 98 | 
 > | 
     id := TFile(data.Field).LinkByIndex[i].DestID; | 
 
 
 
 
 
 | 99 | 
 > | 
     Meta.InitFile(id); | 
 
 
 
 
 
 | 100 | 
 > | 
     newdata.Field := Meta.FileById[id]; | 
 
 
 
 
 
 | 101 | 
 > | 
     newnode := AddVSTEntry(TCustomVirtualStringTree(Sender), Node, newdata); | 
 
 
 
 
 
 | 102 | 
 > | 
     if Meta.FileById[id].ChildCount > 0 then | 
 
 
 
 
 
 | 103 | 
 > | 
       Sender.HasChildren[newnode] := True; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 104 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 | 105 | 
 < | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 161 | 
 < | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 162 | 
 < | 
   VST.NodeDataSize := SizeOf(TNodeData); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 163 | 
 < | 
   VST.Font.Charset := AppSettings.CharSet; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 164 | 
 < | 
   VST.Clear; | 
 
 
 
 
 
 
 
 
 
 | 105 | 
 > | 
   ChildCount := Sender.ChildCount[Node]; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 106 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 107 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 108 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 | 168 | 
 – | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 109 | 
   | 
 procedure TForm_Meta.VSTFocusChanged(Sender: TBaseVirtualTree; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 110 | 
   | 
   Node: PVirtualNode; Column: TColumnIndex); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 111 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 123 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 124 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 125 | 
   | 
  | 
 
 
 
 
 
 
 
 
 | 126 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 127 | 
   | 
 procedure TForm_Meta.VSTFocusChanging(Sender: TBaseVirtualTree; OldNode, | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 128 | 
   | 
   NewNode: PVirtualNode; OldColumn, NewColumn: TColumnIndex; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 129 | 
   | 
   var Allowed: Boolean); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 156 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 157 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 158 | 
   | 
  | 
 
 
 
 
 
 
 
 
 | 159 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 160 | 
   | 
 procedure TForm_Meta.VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 161 | 
   | 
   Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 162 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 171 | 
   | 
         begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 172 | 
   | 
           if Data.Field is TFile then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 173 | 
   | 
           begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 174 | 
 < | 
             CellText := TFile(Data.Field).FileName; | 
 
 
 
 
 
 
 
 
 
 | 174 | 
 > | 
             CellText := TFile(Data.Field).FileInfo.Name; | 
 
 
 
 
 
 
 
 
 
 
 
 | 175 | 
   | 
             if CellText = '' then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 176 | 
   | 
               CellText := 'Unnamed'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 177 | 
   | 
           end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 179 | 
   | 
       1: | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 180 | 
   | 
         begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 181 | 
   | 
           if Data.Field is TFile then | 
 
 
 
 
 
 
 
 
 
 
 
 | 182 | 
 < | 
             CellText := TFile(Data.Field).FileExt; | 
 
 
 
 
 
 
 
 
 
 | 182 | 
 > | 
             CellText := TFile(Data.Field).FileInfo.Extension; | 
 
 
 
 
 
 
 
 
 
 
 
 | 183 | 
   | 
         end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 184 | 
   | 
       2: | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 185 | 
   | 
         begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 186 | 
   | 
           if Data.Field is TFile then | 
 
 
 
 
 
 
 
 
 
 
 
 | 187 | 
 < | 
             CellText := IntToStr(TFile(Data.Field).FileID); | 
 
 
 
 
 
 
 
 
 
 | 187 | 
 > | 
             CellText := IntToStr(TFile(Data.Field).FileInfo.ID); | 
 
 
 
 
 
 
 
 
 
 
 
 | 188 | 
   | 
         end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 189 | 
   | 
     end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 190 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 191 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 192 | 
   | 
  | 
 
 
 
 
 
 
 
 
 | 193 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 194 | 
   | 
 procedure TForm_Meta.VSTPaintText(Sender: TBaseVirtualTree; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 195 | 
   | 
   const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 196 | 
   | 
   TextType: TVSTTextType); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 205 | 
   | 
         begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 206 | 
   | 
           if Data.Field is TFile then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 207 | 
   | 
           begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 208 | 
 < | 
             if Length(TFile(Data.Field).FileName) = 0 then | 
 
 
 
 
 
 
 
 
 
 | 208 | 
 > | 
             if Length(TFile(Data.Field).FileInfo.Name) = 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 | 209 | 
   | 
               TargetCanvas.Font.Color := $C06060; | 
 
 
 
 
 
 
 
 
 
 
 
 | 210 | 
 < | 
             if TFile(Data.Field).FileSize = 0 then | 
 
 
 
 
 
 
 
 
 
 | 210 | 
 > | 
             if TFile(Data.Field).FileInfo.Size = 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 | 211 | 
   | 
               TargetCanvas.Font.Color := $2020A0; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 212 | 
   | 
           end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 213 | 
   | 
         end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 215 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 216 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 217 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 | 275 | 
 – | 
 { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 218 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 219 | 
 < | 
 procedure WriteStructureInfos; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 220 | 
 < | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 279 | 
 < | 
   i, j:    Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 280 | 
 < | 
   pdata:   PNodeData; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 281 | 
 < | 
   Data:    TNodeData; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 282 | 
 < | 
   node:    PVirtualNode; | 
 
 
 
 
 
 
 
 
 
 | 219 | 
 > | 
  | 
 
 
 
 
 
 | 220 | 
 > | 
 procedure TForm_Meta.FormClose(Sender: TObject; var Action: TCloseAction); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 221 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 222 | 
 < | 
   VST.BeginUpdate; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 223 | 
 < | 
   if VST.RootNodeCount = 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 286 | 
 < | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 287 | 
 < | 
     structs := LoadStructureDefinition(ConID, fileid); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 288 | 
 < | 
     if structs.Data then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 289 | 
 < | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 290 | 
 < | 
       if Length(structs.Global) > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 291 | 
 < | 
       begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 292 | 
 < | 
         for i := 0 to High(structs.Global) do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 293 | 
 < | 
         begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 294 | 
 < | 
           Data.Caption  := structs.Global[i].Name; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 295 | 
 < | 
           Data.Offset   := structs.Global[i].offset; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 296 | 
 < | 
           Data.DataType := structs.Global[i].datatype; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 297 | 
 < | 
           Data.Value    := GetValue(structs.Global[i].datatype, structs.Global[i].offset); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 298 | 
 < | 
           Data.Description := structs.Global[i].description; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 299 | 
 < | 
           AddVSTEntry(VST, nil, Data); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 300 | 
 < | 
         end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 301 | 
 < | 
       end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 302 | 
 < | 
       if Length(structs.Subs) > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 303 | 
 < | 
       begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 304 | 
 < | 
         for i := 0 to High(structs.Subs) do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 305 | 
 < | 
         begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 306 | 
 < | 
           with structs.Subs[i] do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 307 | 
 < | 
           begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 308 | 
 < | 
             if Length(Entries) > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 309 | 
 < | 
             begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 310 | 
 < | 
               if Pos('#', SubName) > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 311 | 
 < | 
               begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 312 | 
 < | 
                 Data.Offset  := StrToInt('$'+MidStr(SubName, Pos('#', SubName) + 1, 8)); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 313 | 
 < | 
                 Data.Value   := '$' + | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 314 | 
 < | 
                   MidStr(SubName, PosEx('#', SubName, Pos('#', SubName) + 1) + 1, 8); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 315 | 
 < | 
                 Data.Caption := MidStr(SubName, 1, Pos('#', SubName) - 1); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 316 | 
 < | 
                 Data.Description := SubDesc; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 317 | 
 < | 
               end | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 318 | 
 < | 
               else | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 319 | 
 < | 
               begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 320 | 
 < | 
                 Data.Caption := SubName; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 321 | 
 < | 
                 Data.Description := SubDesc; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 322 | 
 < | 
                 Data.Offset := 0; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 323 | 
 < | 
                 Data.Value := ''; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 324 | 
 < | 
               end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 325 | 
 < | 
               Data.DataType := 0; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 326 | 
 < | 
               node := AddVSTEntry(VST, nil, Data); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 327 | 
 < | 
               Data.Description := ''; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 328 | 
 < | 
               for j := 0 to High(Entries) do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 329 | 
 < | 
               begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 330 | 
 < | 
                 Data.Caption  := Entries[j].Name; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 331 | 
 < | 
                 Data.Offset   := Entries[j].offset; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 332 | 
 < | 
                 Data.DataType := Entries[j].datatype; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 333 | 
 < | 
                 Data.Value    := GetValue(Entries[j].datatype, Entries[j].offset); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 334 | 
 < | 
                 Data.Description := Entries[j].description; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 335 | 
 < | 
                 AddVSTEntry(VST, node, Data); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 336 | 
 < | 
               end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 337 | 
 < | 
             end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 338 | 
 < | 
           end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 339 | 
 < | 
         end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 340 | 
 < | 
       end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 341 | 
 < | 
     end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 342 | 
 < | 
     if VST.RootNodeCount > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 343 | 
 < | 
       VST.FocusedNode := VST.GetFirst; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 344 | 
 < | 
   end | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 345 | 
 < | 
   else | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 346 | 
 < | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 347 | 
 < | 
     Node := VST.GetFirst; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 348 | 
 < | 
     while Assigned(Node) do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 349 | 
 < | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 350 | 
 < | 
       pdata := VST.GetNodeData(Node); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 351 | 
 < | 
       if pdata.DataType > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 352 | 
 < | 
         pdata.Value := GetValue(pdata.Datatype, pdata.Offset); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 353 | 
 < | 
       Node := VST.GetNext(Node); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 354 | 
 < | 
     end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 355 | 
 < | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 356 | 
 < | 
   VST.EndUpdate; | 
 
 
 
 
 
 
 
 
 
 | 222 | 
 > | 
 //  Meta.Free; | 
 
 
 
 
 
 | 223 | 
 > | 
   inherited; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 224 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 | 225 | 
 < | 
 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 225 | 
 > | 
  | 
 
 
 
 
 
 | 226 | 
 > | 
 procedure TForm_Meta.FormCreate(Sender: TObject); | 
 
 
 
 
 
 | 227 | 
 > | 
 begin | 
 
 
 
 
 
 | 228 | 
 > | 
   inherited; | 
 
 
 
 
 
 | 229 | 
 > | 
   OnNewConnection := NewCon; | 
 
 
 
 
 
 | 230 | 
 > | 
  | 
 
 
 
 
 
 | 231 | 
 > | 
   VST.NodeDataSize := SizeOf(TNodeData); | 
 
 
 
 
 
 | 232 | 
 > | 
   VST.Font.Charset := AppSettings.CharSet; | 
 
 
 
 
 
 | 233 | 
 > | 
   VST.Clear; | 
 
 
 
 
 
 | 234 | 
 > | 
  | 
 
 
 
 
 
 | 235 | 
 > | 
   UpdateConList; | 
 
 
 
 
 
 | 236 | 
 > | 
 end; | 
 
 
 
 
 
 | 237 | 
 > | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 238 | 
   | 
 end. |