Index: /oup/current/DataAccess/Access_OUP_ADB.pas
===================================================================
--- /oup/current/DataAccess/Access_OUP_ADB.pas	(revision 228)
+++ /oup/current/DataAccess/Access_OUP_ADB.pas	(revision 229)
@@ -113,4 +113,6 @@
 
   UpdateListCache;
+
+  inherited;
 end;
 
Index: /oup/current/DataAccess/Access_OniArchive.pas
===================================================================
--- /oup/current/DataAccess/Access_OniArchive.pas	(revision 228)
+++ /oup/current/DataAccess/Access_OniArchive.pas	(revision 229)
@@ -161,4 +161,6 @@
   FConnectionID := ConnectionID;
   FChangeRights := [CR_EditDat, CR_EditRaw, CR_AppendRaw];
+
+  inherited;
 end;
 
Index: /oup/current/DataAccess/DataAccess.pas
===================================================================
--- /oup/current/DataAccess/DataAccess.pas	(revision 228)
+++ /oup/current/DataAccess/DataAccess.pas	(revision 229)
@@ -25,5 +25,5 @@
     property MetaData:     TMetaManager read FMeta;
 
-    constructor Create(FileName: String; ConnectionID: Integer; var Msg: TStatusMessages); virtual; abstract;
+    constructor Create(FileName: String; ConnectionID: Integer; var Msg: TStatusMessages); virtual;
     procedure Close; virtual; abstract;
 
@@ -76,4 +76,12 @@
 *)
 
+constructor TDataAccess.Create(FileName: String; ConnectionID: Integer;
+  var Msg: TStatusMessages);
+begin
+  FMeta := TMetaManager.Create(FConnectionID, Self);
+end;
+
+
+
 function TDataAccess.ExtractFileIDOfName(Name: String): Integer;
 begin
Index: /oup/current/FileClasses/_Extensions.pas
===================================================================
--- /oup/current/FileClasses/_Extensions.pas	(revision 228)
+++ /oup/current/FileClasses/_Extensions.pas	(revision 229)
@@ -7,4 +7,5 @@
     private
       FConnectionID: Integer;
+      FExt: String;
       FFiles: array of Integer;
       function GetFile(ID: Integer): Integer;
@@ -13,7 +14,11 @@
       constructor Create(ConnectionID: Integer; Ext: String); virtual;
       procedure InitList;
+      property Ext: String read FExt;
       property Files[ID: Integer]: Integer read GetFile;
       property FileCount: Integer read GetFileCount;
   end;
+
+  TExtensions = array of TExtension;
+                      
 
 
@@ -26,4 +31,20 @@
 
 constructor TExtension.Create(ConnectionID: Integer; Ext: String);
+begin
+  FConnectionID := ConnectionID;
+  FExt := Ext;
+end;
+
+function TExtension.GetFile(ID: Integer): Integer;
+begin
+  Result := FFiles[ID];
+end;
+
+function TExtension.GetFileCount: Integer;
+begin
+  Result := Length(FFiles);
+end;
+
+procedure TExtension.InitList;
 var
   files: TStrings;
@@ -50,18 +71,3 @@
 end;
 
-function TExtension.GetFile(ID: Integer): Integer;
-begin
-  Result := FFiles[ID];
-end;
-
-function TExtension.GetFileCount: Integer;
-begin
-  Result := Length(FFiles);
-end;
-
-procedure TExtension.InitList;
-begin
-Exit;
-end;
-
 end.
Index: /oup/current/FileClasses/_MetaManager.pas
===================================================================
--- /oup/current/FileClasses/_MetaManager.pas	(revision 228)
+++ /oup/current/FileClasses/_MetaManager.pas	(revision 229)
@@ -8,34 +8,72 @@
     protected
       FFiles: array of TFile;
-      FRoot: array of TExtension;
+      FRoot: TExtensions;
       FConnectionID: Integer;
+      FDataAccess: TObject;
       function GetFileCount: Integer;
       function GetFileById(Id: Integer): TFile;
+      function GetExt(Ext: String): TExtension;
+      procedure AddExt(Ext: String);
     private
-      procedure InitRootFiles;
+      procedure InitExts;
     public
-      constructor Create(ConnectionID: Integer);
+      constructor Create(ConnectionID: Integer; DataAccess: TObject);
+      procedure InitExtFiles(Ext: String);
       procedure InitFile(id: Integer);
       procedure InitFileFields(id: Integer);
 
+      property Root: TExtensions read FRoot;
+      property RootExt[Ext: String]: TExtension read GetExt;
       property FileCount: Integer read GetFileCount;
       property FileById[Id: Integer]: TFile read GetFileById;
   end;
 
-var
-  Meta: TMetaManager;
-
 implementation
 
 uses
   Classes, ConnectionManager, Access_OniArchive, TypeDefs,
-  Dialogs, SysUtils, StrUtils;
+  Dialogs, SysUtils, StrUtils, DataAccess;
 
 { TFileManager }
 
-constructor TMetaManager.Create(ConnectionID: Integer);
+constructor TMetaManager.Create(ConnectionID: Integer; DataAccess: TObject);
 begin
   FConnectionID := ConnectionID;
-  InitRootFiles;
+  FDataAccess := DataAccess;
+  SetLength(FFiles, TDataAccess(DataAccess).GetFileCount);
+  InitExts;
+end;
+
+function TMetaManager.GetExt(Ext: String): TExtension;
+var
+  i: Integer;
+begin
+  Result := nil;
+  if Length(FRoot) > 0 then
+    for i := 0 to High(FRoot) do
+      if FRoot[i].Ext = Ext then
+      begin
+        Result := FRoot[i];
+        Break;
+      end;
+end;
+
+procedure TMetaManager.AddExt(Ext: String);
+var
+  i: Integer;
+begin
+  SetLength(FRoot, Length(FRoot) + 1);
+  for i := High(FRoot) downto 1 do
+  begin
+    if FRoot[i-1].Ext < Ext then
+    begin
+      FRoot[i] := TExtension.Create(FConnectionID, Ext);
+      Break;
+    end
+    else
+      FRoot[i] := FRoot[i-1];
+  end;
+  if i = 0 then
+    FRoot[0] := TExtension.Create(FConnectionID, Ext);
 end;
 
@@ -92,5 +130,5 @@
 end;
 
-procedure TMetaManager.InitRootFiles;
+procedure TMetaManager.InitExtFiles(Ext: String);
 var
   files: TStrings;
@@ -136,3 +174,27 @@
 end;
 
+procedure TMetaManager.InitExts;
+var
+  files: TStrings;
+  i: Integer;
+  fid: Integer;
+  finfo: TFileInfo;
+begin
+  files := TStringList.Create;
+  files := TDataAccess(FDataAccess).GetFilesList('', '', False, ST_IDAsc);
+  SetLength(FRoot, 0);
+  if files.Count > 0 then
+  begin
+    for i := 0 to files.Count - 1 do
+    begin
+      fid := StrToInt(MidStr(files.Strings[i], 1, 5));
+      finfo := TDataAccess(FDataAccess).GetFileInfo(fid);
+      if Length(finfo.Name) > 0 then
+        if not Assigned(GetExt(finfo.Extension)) then
+          AddExt(finfo.Extension);
+    end;
+  end;
+  files.Free;
+end;
+
 end.
Index: /oup/current/FileClasses/_MetaTypes.pas
===================================================================
--- /oup/current/FileClasses/_MetaTypes.pas	(revision 228)
+++ /oup/current/FileClasses/_MetaTypes.pas	(revision 229)
@@ -19,4 +19,5 @@
   TFile_Empty = _EmptyFile.TFile_Empty;
   TExtension = _Extensions.TExtension;
+  TExtensions = _Extensions.TExtensions;
 
   TFileClass = class of TFile;
Index: /oup/current/Tools/MetaEditor.dfm
===================================================================
--- /oup/current/Tools/MetaEditor.dfm	(revision 228)
+++ /oup/current/Tools/MetaEditor.dfm	(revision 229)
@@ -4,10 +4,4 @@
   PixelsPerInch = 96
   TextHeight = 13
-  inherited panel_connection: TPanel
-    ExplicitWidth = 598
-    inherited combo_connection: TComboBox
-      ExplicitWidth = 532
-    end
-  end
   inherited panel_basecontent: TPanel
     ExplicitLeft = 0
Index: /oup/current/Tools/MetaEditor.pas
===================================================================
--- /oup/current/Tools/MetaEditor.pas	(revision 228)
+++ /oup/current/Tools/MetaEditor.pas	(revision 229)
@@ -31,6 +31,4 @@
   end;
 
-var
-  Form_Meta: TForm_Meta;
 
 implementation
@@ -64,4 +62,5 @@
   node: PVirtualNode;
 begin
+{
   if ID >= 0 then
   begin
@@ -69,5 +68,5 @@
     QueryPerformanceCounter(a);
     if not Assigned(Meta) then
-      Meta := TMetaManager.Create(ID);
+      Meta := TMetaManager.Create(ID, Self);
     QueryPerformanceCounter(b);
     ShowMessage('Loading Done - ' + FloatToStr((b-a)/c) + 's');
@@ -87,4 +86,5 @@
     VST.EndUpdate;
   end;
+}
 end;
 
@@ -99,4 +99,5 @@
   id: Integer;
 begin
+{
   data := VST.GetNodeData(node);
   for i := 0 to Meta.FileById[TFile(data.Field).FileID].ChildCount - 1 do
@@ -110,4 +111,5 @@
   end;
   ChildCount := Meta.FileById[TFile(data.Field).FileID].ChildCount;
+}
 end;
 
@@ -226,5 +228,5 @@
 procedure TForm_Meta.FormClose(Sender: TObject; var Action: TCloseAction);
 begin
-  Meta.Free;
+//  Meta.Free;
   inherited;
 end;
Index: /oup/current/Tools/_TemplateFileList.dfm
===================================================================
--- /oup/current/Tools/_TemplateFileList.dfm	(revision 228)
+++ /oup/current/Tools/_TemplateFileList.dfm	(revision 229)
@@ -33,5 +33,5 @@
         Margins.Right = 1
         Margins.Bottom = 0
-        ActivePage = tab_files
+        ActivePage = tab_meta
         Align = alClient
         TabOrder = 0
@@ -284,4 +284,7 @@
             Header.Options = [hoColumnResize, hoDrag]
             TabOrder = 0
+            OnGetText = filelist_metaGetText
+            OnPaintText = filelist_metaPaintText
+            OnInitChildren = filelist_metaInitChildren
             Columns = <>
           end
Index: /oup/current/Tools/_TemplateFileList.pas
===================================================================
--- /oup/current/Tools/_TemplateFileList.pas	(revision 228)
+++ /oup/current/Tools/_TemplateFileList.pas	(revision 229)
@@ -55,4 +55,11 @@
     procedure popup_linkshereClick(Sender: TObject);
     procedure filepopupPopup(Sender: TObject);
+    procedure filelist_metaGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
+      Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString);
+    procedure filelist_metaInitChildren(Sender: TBaseVirtualTree;
+      Node: PVirtualNode; var ChildCount: Cardinal);
+    procedure filelist_metaPaintText(Sender: TBaseVirtualTree;
+      const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
+      TextType: TVSTTextType);
   private
     FSortBy: TSortType;
@@ -73,5 +80,24 @@
 {$R *.dfm}
 uses ConnectionManager, Exporters, Functions, StrUtils, WhatLinksHere, Main,
-  _BaseTemplate;
+  _BaseTemplate, _MetaTypes, Data, _MetaManager, _FileTypes;
+
+type
+  PNodeData = ^TNodeData;
+
+  TNodeData = record
+    Field: TObject;
+  end;
+
+function AddVSTEntry(AVST: TCustomVirtualStringTree; ANode: PVirtualNode;
+  ARecord: TNodeData): PVirtualNode;
+var
+  Data: PNodeData;
+begin
+  Result := AVST.AddChild(ANode);
+  Data   := AVST.GetNodeData(Result);
+  AVST.ValidateNode(Result, False);
+  Data^ := ARecord;
+end;
+
 
 
@@ -108,4 +134,8 @@
   pattern: String;
   files: TStrings;
+  root: TExtensions;
+  i: Integer;
+  data: TNodeData;
+  node: PVirtualNode;
 begin
   if FConnectionID > -1 then
@@ -130,4 +160,16 @@
       filelist.Items.AddStrings(files);
     filelist.Visible := True;
+
+    //VST
+    filelist_meta.Clear;
+    filelist_meta.BeginUpdate;
+    root := ConManager.Connection[FConnectionID].MetaData.Root;
+    for i := 0 to High(root) do
+    begin
+      data.Field := root[i];
+      node := AddVSTEntry(filelist_meta, nil, data);
+      filelist_meta.HasChildren[node] := True;
+    end;
+    filelist_meta.EndUpdate;
   end;
 end;
@@ -217,4 +259,5 @@
 end;
 
+
 procedure TForm_TemplateFileList.filepopupPopup(Sender: TObject);
 var
@@ -338,4 +381,8 @@
 begin
   inherited;
+  filelist_meta.NodeDataSize := SizeOf(TNodeData);
+  filelist_meta.Font.Charset := AppSettings.CharSet;
+  filelist_meta.Clear;
+
   FAllowedExts := '';
   FAllowMultiSelect := False;
@@ -356,3 +403,83 @@
 
 
+
+procedure TForm_TemplateFileList.filelist_metaGetText(Sender: TBaseVirtualTree;
+  Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
+  var CellText: WideString);
+var
+  data: PNodeData;
+begin
+  inherited;
+  data := Sender.GetNodeData(Node);
+  if data.Field is TExtension then
+  begin
+    CellText := TExtension(data.Field).Ext;
+  end;
+  if data.Field is TFile then
+  begin
+    if TFile(data.Field).FileName = '' then
+      CellText := TFile(data.Field).FileExt + ' (unnamed)'
+    else
+      CellText := TFile(data.Field).FileExt + ': ' + TFile(data.Field).FileName;
+  end;
+end;
+
+
+procedure TForm_TemplateFileList.filelist_metaInitChildren(
+  Sender: TBaseVirtualTree; Node: PVirtualNode; var ChildCount: Cardinal);
+var
+  data: PNodeData;
+  i: Integer;
+  newdata: TNodeData;
+  newnode: PVirtualNode;
+  id: Integer;
+begin
+  inherited;
+  data := Sender.GetNodeData(Node);
+  if data.Field is TExtension then
+  begin
+    if TExtension(data.Field).FileCount = 0 then
+      TExtension(data.Field).InitList;
+    for i := 0 to TExtension(data.Field).FileCount - 1 do
+    begin
+      id := TExtension(data.Field).Files[i];
+      ConManager.Connection[FConnectionID].MetaData.InitFile(id);
+      newdata.Field := ConManager.Connection[FConnectionID].MetaData.FileById[id];
+      newnode := AddVSTEntry(filelist_meta, Node, newdata);
+      if ConManager.Connection[FConnectionID].MetaData.FileById[id].ChildCount > 0 then
+        filelist_meta.HasChildren[newnode] := True;
+      ChildCount := filelist_meta.ChildCount[node];
+    end;
+  end;
+  if data.Field is TFile then
+  begin
+    for i := 0 to TFile(data.Field).ChildCount - 1 do
+    begin
+      id := TFile(data.Field).LinkByIndex[i].DestID;
+      ConManager.Connection[FConnectionID].MetaData.InitFile(id);
+      newdata.Field := ConManager.Connection[FConnectionID].MetaData.FileById[id];
+      newnode := AddVSTEntry(filelist_meta, Node, newdata);
+      if ConManager.Connection[FConnectionID].MetaData.FileById[id].ChildCount > 0 then
+        filelist_meta.HasChildren[newnode] := True;
+    end;
+    ChildCount := filelist_meta.ChildCount[node];
+  end;
+end;
+
+procedure TForm_TemplateFileList.filelist_metaPaintText(
+  Sender: TBaseVirtualTree; const TargetCanvas: TCanvas; Node: PVirtualNode;
+  Column: TColumnIndex; TextType: TVSTTextType);
+var
+  Data: PNodeData;
+begin
+  Data     := Sender.GetNodeData(Node);
+  if Data.Field is TFile then
+  begin
+    if Length(TFile(Data.Field).FileName) = 0 then
+      TargetCanvas.Font.Color := $C06060;
+    if TFile(Data.Field).FileSize = 0 then
+      TargetCanvas.Font.Color := $2020A0;
+  end;
+end;
+
 end.
