Index: oup/current/Main.pas
===================================================================
--- oup/current/Main.pas	(revision 84)
+++ oup/current/Main.pas	(revision 86)
@@ -75,4 +75,5 @@
     tb_opendb: TTBItem;
     Images_Close: TImageList;
+    procedure UpdateConLists;
     procedure LoadFile(typedb: Boolean);
     function TryCloseAll: Boolean;
@@ -154,5 +155,5 @@
   else if MidStr(ParamStr(1), 1, 4) = 'oldb' then
   begin
-    if not CreateDataConnection(ParamStr(2), ODB_ADB) then
+    if CreateDataConnection(ParamStr(2), ODB_ADB) = nil then
       ShowMessage('Error while loading the file:' + CrLf + ParamStr(
         2) + CrLf + 'Perhaps not an OniUnPacker-LevelDatabase-file?');
@@ -160,5 +161,5 @@
   else if MidStr(ParamStr(1), 1, 3) = 'dat' then
   begin
-    if not CreateDataConnection(ParamStr(2), ODB_Dat) then
+    if CreateDataConnection(ParamStr(2), ODB_Dat) = nil then
       ShowMessage('Error while loading the file:' + CrLf + ParamStr(
         2) + CrLf + 'Perhaps not an Oni-.dat-file?');
@@ -263,6 +264,7 @@
   pt.Y := Y;
   tabIndex := MDITab.GetTabAtPos(pt);
-  if (Button = mbRight) and (tabIndex >= 0) then
-    MDITab.MDIChildren[tabIndex].Close;
+
+//  if (Button = mbRight) and (tabIndex >= 0) then
+//    MDITab.MDIChildren[tabIndex].Close;
 
   if (Button = mbLeft) and (tabIndex >= 0) then
@@ -309,28 +311,9 @@
 procedure TForm_Main.UpdateStatBar;
 begin
-  if Assigned(OniDataConnection) then
-  begin
-    Self.Caption      := 'Oni Un/Packer ' + version + ' (' + ExtractFileName(
-      OniDataConnection.FileName) + ')';
+  if Length(DataConnections) > 0 then
+  begin
+    Self.Caption      := 'Oni Un/Packer ' + version;
     ActivateTools(True);
-    statbar.Panels.Items[1].Text := 'Files: ' + IntToStr(OniDataConnection.GetFilesCount);
-    statbar.Panels.Items[2].Text :=
-      'Extensions: ' + IntToStr(Length(OniDataConnection.GetExtensionsList));
-    case OniDataConnection.Backend of
-      ODB_Dat:
-        begin
-          statbar.Panels.Items[0].Text := '.dat loaded: ' + OniDataConnection.FileName;
-        end;
-      ODB_ADB:
-        begin
-          statbar.Panels.Items[0].Text := 'OLDB loaded: ' + OniDataConnection.FileName;
-        end;
-    else
-      Self.Caption      := 'Oni Un/Packer ' + version;
-      statbar.Panels.Items[0].Text := 'Nothing loaded';
-      statbar.Panels.Items[1].Text := 'Files: -';
-      statbar.Panels.Items[2].Text := 'Extensions: -';
-      ActivateTools(False);
-    end;
+    statbar.Panels.Items[1].Text := 'Connections: ' + IntToStr(Length(DataConnections));
   end
   else
@@ -380,4 +363,13 @@
 
 
+procedure TForm_Main.UpdateConLists;
+var
+  i: Integer;
+begin
+  for i := 0 to MDITab.MDIChildCount - 1 do
+    if MDITab.MDIChildren[i] is TForm_ToolTemplate then
+      TForm_ToolTemplate(MDITab.MDIChildren[i]).UpdateList;
+end;
+
 
 procedure TForm_Main.LoadFile(typedb: Boolean);
@@ -385,30 +377,24 @@
   ext: String;
 begin
-  if TryCloseAll then
-  begin
-    CloseDataConnection;
-    opend.InitialDir := AppSettings.DatPath;
-    opend.Filter     := 'Compatible level files|*.dat;*.oldb|Oni level (*.dat)|*.dat|OUP level database (*.oldb)|*.oldb|Any (*.*)|*';
-    if typedb then
-      opend.FilterIndex := 3
-    else
-      opend.FilterIndex := 2;
-    if opend.Execute then
+  opend.InitialDir := AppSettings.DatPath;
+  opend.Filter     := 'Compatible level files|*.dat;*.oldb|Oni level (*.dat)|*.dat|OUP level database (*.oldb)|*.oldb|Any (*.*)|*';
+  if typedb then
+    opend.FilterIndex := 3
+  else
+    opend.FilterIndex := 2;
+  if opend.Execute then
+  begin
+    ext := ExtractFileExt(opend.FileName);
+    if ext = '.dat' then
     begin
-      ext := ExtractFileExt(opend.FileName);
-      if ext = '.dat' then
-      begin
-        if not CreateDataConnection(opend.FileName, ODB_Dat) then
-          ShowMessage('Error while loading the file:' + CrLf + opend.FileName +
-            CrLf + 'Perhaps not an Oni-.dat-file?');
-      end else if ext = '.oldb' then
-      begin
-        if not CreateDataConnection(opend.FileName, ODB_ADB) then
-          ShowMessage('Error while loading the file:' + CrLf + opend.FileName +
-            CrLf + 'Perhaps not an OniUnPacker-LevelDatabase-file?');
-      end else
-        ShowMessage('Incompatible file');
-      AppSettings.DatPath := ExtractFilepath(opend.FileName);
-    end;
+      if CreateDataConnection(opend.FileName, ODB_Dat) <> nil then
+        UpdateConLists;
+    end else if ext = '.oldb' then
+    begin
+      if CreateDataConnection(opend.FileName, ODB_ADB) <> nil then
+        UpdateConLists;
+    end else
+      ShowMessage('Incompatible file');
+    AppSettings.DatPath := ExtractFilepath(opend.FileName);
   end;
   UpdateStatBar;
@@ -451,5 +437,5 @@
 procedure TForm_Main.menu_createdbClick(Sender: TObject);
 begin
-  if Assigned(OniDataConnection) then
+{  if Assigned(OniDataConnection) then
     if MessageBox(Self.Handle, PChar('You have currently opened a level-file. ' +
           'Do you want to close it to continue?'), PChar('Close file?'),
@@ -470,5 +456,5 @@
     if saved.Execute then
       Form_LevelDB.CreateDatabase(opend.FileName, saved.FileName);
-end;
+}end;
 
 
@@ -477,5 +463,5 @@
 procedure TForm_Main.menu_createlvlClick(Sender: TObject);
 begin
-  if Assigned(OniDataConnection) then
+{  if Assigned(OniDataConnection) then
     if MessageBox(Self.Handle, PChar('You have currently opened a level-file. ' +
           'Do you want to close it to continue?'), PChar('Close file?'),
@@ -496,5 +482,5 @@
     if saved.Execute then
       Form_LevelDB.CreateLevel(opend.FileName, saved.FileName);
-end;
+}end;
 
  {#################################}
