Index: oup/current/Main.pas
===================================================================
--- oup/current/Main.pas	(revision 171)
+++ oup/current/Main.pas	(revision 172)
@@ -727,9 +727,24 @@
 
 function TForm_Main.open_child(window_context: String; connection, fileid: Integer): TForm_ToolTemplate;
+type
+  TTemplate = class of TForm_ToolTemplate;
+  TTool = record
+      name: String;
+      icon: Integer;
+      caption: String;
+      classt: TTemplate;
+  end;
+const
+  Tools: array[0..4] of TTool = (
+    (name: 'binedit';     icon: 5; caption: 'Binary .dat-Editor'; classt: TForm_BinEdit),
+    (name: 'extractor';   icon: 8; caption: 'Extractor';          classt: TForm_Extractor),
+    (name: 'preview';     icon: 4; caption: 'Preview-Window';     classt: TForm_Preview),
+    (name: 'rawedit';     icon: 6; caption: 'Binary .raw-Editor'; classt: TForm_RawEdit),
+    (name: 'txmpreplace'; icon: 7; caption: 'TXMP Replacer';      classt: TForm_TxmpReplace)
+  );
 var
   toolform:    TForm_ToolTemplate;
   i:           Integer;
   tag:         Integer;
-  caption_end: String;
   iconindex:   Integer;
 begin
@@ -743,37 +758,17 @@
 
   iconindex := -1;
-  caption_end := IntToStr(tag) + '       ';
 
   toolform := nil;
 
-  if window_context = 'binedit' then
-  begin
-    toolform         := TForm_BinEdit.Create(Self);
-    toolform.Caption := 'Binary .dat-Editor ' + caption_end;
-    iconindex        := 5;
-  end;
-  if window_context = 'extractor' then
-  begin
-    toolform         := TForm_Extractor.Create(Self);
-    toolform.Caption := 'Extractor ' + caption_end;
-    iconindex        := 8;
-  end;
-  if window_context = 'preview' then
-  begin
-    toolform         := TForm_Preview.Create(Self);
-    toolform.Caption := 'Preview-Window ' + caption_end;
-    iconindex        := 4;
-  end;
-  if window_context = 'rawedit' then
-  begin
-    toolform         := TForm_RawEdit.Create(Self);
-    toolform.Caption := 'Binary .raw-Editor ' + caption_end;
-    iconindex        := 6;
-  end;
-  if window_context = 'txmpreplace' then
-  begin
-    toolform         := TForm_TxmpReplace.Create(Self);
-    toolform.Caption := 'TXMP Replacer ' + caption_end;
-    iconindex        := 7;
+  for i := 0 to High(Tools) do
+    if Tools[i].name = window_context then
+      Break;
+  if i < Length(Tools) then
+  begin
+    toolform         := TTemplate(Tools[i].classt).Create(Self);
+    toolform.Caption := Tools[i].caption + ' ' + IntToStr(tag) + '       ';
+    iconindex        := Tools[i].icon;
+  end else begin
+    ShowMessage('WindowContext not found!');
   end;
 
