[8] | 1 | UNIT Unit1_main;
|
---|
| 2 | INTERFACE
|
---|
| 3 | USES
|
---|
| 4 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
---|
| 5 | Dialogs, StdCtrls, StrUtils, Clipbrd, ExtCtrls, ComCtrls, Menus, Grids,
|
---|
| 6 | MPHexEditor, ToolWin, ImgList, Tabs,
|
---|
| 7 | Unit2_functions, Unit3_data,
|
---|
| 8 | Unit10_leveldb, Unit4_exporters,
|
---|
| 9 | Unit5_preview, Unit7_txmpreplace, Unit8_binedit, Unit11_extractor, Unit13_rawedit;
|
---|
| 10 |
|
---|
| 11 | TYPE
|
---|
| 12 | TForm1 = Class(TForm)
|
---|
| 13 | tabs: TTabSet;
|
---|
| 14 | saved: TSaveDialog;
|
---|
| 15 | opend: TOpenDialog;
|
---|
| 16 | statbar: TStatusBar;
|
---|
| 17 | menu: TMainMenu;
|
---|
| 18 | menu_main: TMenuItem;
|
---|
| 19 | menu_loaddat: TMenuItem;
|
---|
| 20 | menu_lvldb: TMenuItem;
|
---|
| 21 | menu_exit: TMenuItem;
|
---|
| 22 | menu_convert: TMenuItem;
|
---|
| 23 | menu_createdb: TMenuItem;
|
---|
| 24 | menu_createlvl: TMenuItem;
|
---|
| 25 | menu_tools: TMenuItem;
|
---|
| 26 | menu_preview: TMenuItem;
|
---|
| 27 | menu_txmpreplace: TMenuItem;
|
---|
| 28 | menu_binedit: TMenuItem;
|
---|
| 29 | menu_extractor: TMenuItem;
|
---|
| 30 | menu_windows: TMenuItem;
|
---|
| 31 | menu_windows_cascade: TMenuItem;
|
---|
| 32 | menu_windows_tile: TMenuItem;
|
---|
| 33 | menu_windows_closeall: TMenuItem;
|
---|
| 34 | menu_windows_next: TMenuItem;
|
---|
| 35 | menu_windows_previous: TMenuItem;
|
---|
| 36 | menu_sep1: TMenuItem;
|
---|
| 37 | menu_sep2: TMenuItem;
|
---|
| 38 | menu_sep3: TMenuItem;
|
---|
| 39 | menu_levelstructedit: TMenuItem;
|
---|
| 40 | menu_rawedit: TMenuItem;
|
---|
| 41 | menu_filecompare: TMenuItem;
|
---|
| 42 | ClosefileDB1: TMenuItem;
|
---|
| 43 | procedure ClosefileDB1Click(Sender: TObject);
|
---|
| 44 | procedure menu_filecompareClick(Sender: TObject);
|
---|
| 45 | PROCEDURE menu_raweditClick(Sender: TObject);
|
---|
| 46 | PROCEDURE menu_createlvlClick(Sender: TObject);
|
---|
| 47 | PROCEDURE menu_extractorClick(Sender: TObject);
|
---|
| 48 | PROCEDURE menu_lvldbClick(Sender: TObject);
|
---|
| 49 | PROCEDURE menu_createdbClick(Sender: TObject);
|
---|
| 50 | PROCEDURE SetActiveWindow(window_name:String);
|
---|
| 51 | PROCEDURE tabsChange(Sender: TObject; NewTab: Integer; var AllowChange: Boolean);
|
---|
| 52 | PROCEDURE close_window(window_name:String);
|
---|
| 53 | PROCEDURE menu_windows_previousClick(Sender: TObject);
|
---|
| 54 | PROCEDURE menu_windows_nextClick(Sender: TObject);
|
---|
| 55 | PROCEDURE menu_windows_tileClick(Sender: TObject);
|
---|
| 56 | FUNCTION open_child(window_context:String):Boolean;
|
---|
| 57 | PROCEDURE menu_windows_closeallClick(Sender: TObject);
|
---|
| 58 | PROCEDURE menu_windows_cascadeClick(Sender: TObject);
|
---|
| 59 | PROCEDURE menu_window_entryClick(Sender: TObject);
|
---|
| 60 | PROCEDURE menu_bineditClick(Sender: TObject);
|
---|
| 61 | PROCEDURE menu_loaddatClick(Sender: TObject);
|
---|
| 62 | PROCEDURE menu_txmpreplaceClick(Sender: TObject);
|
---|
| 63 | PROCEDURE menu_exitClick(Sender: TObject);
|
---|
| 64 | PROCEDURE menu_previewClick(Sender: TObject);
|
---|
| 65 | PROCEDURE FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
| 66 | PROCEDURE FormResize(Sender: TObject);
|
---|
| 67 | PROCEDURE FormCreate(Sender: TObject);
|
---|
| 68 | PRIVATE
|
---|
| 69 | PUBLIC
|
---|
| 70 | END;
|
---|
| 71 |
|
---|
| 72 | VAR
|
---|
| 73 | Form1: TForm1;
|
---|
| 74 |
|
---|
| 75 | IMPLEMENTATION
|
---|
| 76 | {$R *.dfm}
|
---|
| 77 | VAR
|
---|
| 78 | tablist:Array OF String;
|
---|
| 79 |
|
---|
| 80 | PROCEDURE TForm1.FormCreate(Sender: TObject);
|
---|
| 81 | BEGIN
|
---|
| 82 | Form1.Caption:='Oni Un/Packer '+version;
|
---|
| 83 | Form1.FormResize(Form1);
|
---|
| 84 |
|
---|
| 85 | IF FileExists(ExtractFilepath(Application.EXEname)+'\oniunpacker.ini') THEN BEGIN
|
---|
| 86 | AssignFile(AppSettingsFile,ExtractFilepath(Application.EXEname)+'\oniunpacker.ini');
|
---|
| 87 | Reset(AppSettingsFile);
|
---|
| 88 | Read(AppSettingsFile,AppSettings);
|
---|
| 89 | CloseFile(AppSettingsFile);
|
---|
| 90 | END ELSE BEGIN
|
---|
| 91 | AppSettings.DatPath:='D:\Spiele\Oni\GameDataFolder';
|
---|
| 92 | AppSettings.ExtractPath:='C:\Dokumente und Einstellungen\Administrator\Desktop';
|
---|
| 93 | END;
|
---|
| 94 | END;
|
---|
| 95 |
|
---|
| 96 | PROCEDURE TForm1.FormResize(Sender: TObject);
|
---|
| 97 | CONST
|
---|
| 98 | MinWidth:Integer=750;
|
---|
| 99 | MinHeight:Integer=500;
|
---|
| 100 | BEGIN
|
---|
| 101 | IF Form1.Width<MinWidth THEN Form1.Width:=MinWidth;
|
---|
| 102 | IF Form1.Height<MinHeight THEN Form1.Height:=MinHeight;
|
---|
| 103 | Form1.statbar.Panels.Items[0].Width:=Form1.Width-200;
|
---|
| 104 | END;
|
---|
| 105 |
|
---|
| 106 | PROCEDURE TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
|
---|
| 107 | BEGIN
|
---|
| 108 | AssignFile(AppSettingsFile,ExtractFilepath(Application.EXEname)+'\oniunpacker.ini');
|
---|
| 109 | IF FileExists(ExtractFilepath(Application.EXEname)+'\oniunpacker.ini') THEN
|
---|
| 110 | Reset(AppSettingsFile)
|
---|
| 111 | ELSE
|
---|
| 112 | Rewrite(AppSettingsFile);
|
---|
| 113 | Write(AppSettingsFile,AppSettings);
|
---|
| 114 | CloseFile(AppSettingsFile);
|
---|
| 115 | Action:=caFree;
|
---|
| 116 | END;
|
---|
| 117 |
|
---|
| 118 |
|
---|
| 119 | {#################################}
|
---|
| 120 | {##### Main-Menu-Handlers #####}
|
---|
| 121 | {#################################}
|
---|
| 122 | PROCEDURE TForm1.menu_loaddatClick(Sender: TObject);
|
---|
| 123 | VAR i:LongWord;
|
---|
| 124 | BEGIN
|
---|
| 125 | opend.InitialDir:=AppSettings.DatPath;
|
---|
| 126 | opend.Filter:='Oni-Dat-Files|*.dat';
|
---|
| 127 | IF opend.Execute THEN BEGIN
|
---|
| 128 | menu_windows_closeallClick(Form1);
|
---|
| 129 | IF Length(tablist)=0 THEN BEGIN
|
---|
| 130 | IF opened_state=opened_db THEN CloseDatabase;
|
---|
| 131 | Caption:='Oni Un/Packer '+version;
|
---|
| 132 | statbar.Panels.Items[0].Text:='Nothing loaded';
|
---|
| 133 | statbar.Panels.Items[1].Text:='Files: -';
|
---|
| 134 | statbar.Panels.Items[2].Text:='Extensions: -';
|
---|
| 135 | AppSettings.DatPath:=ExtractFilepath(opend.FileName);
|
---|
| 136 | IF LoadDatInfos(opend.FileName) THEN BEGIN
|
---|
| 137 | Form1.Caption:='Oni Un/Packer '+version+' ('+ExtractFileName(opend.FileName)+')';
|
---|
| 138 | statbar.Panels.Items[0].Text:='.dat loaded: '+dat_FileName;
|
---|
| 139 | statbar.Panels.Items[1].Text:='Files: '+IntToStr(dat_header.Files);
|
---|
| 140 | statbar.Panels.Items[2].Text:='Extensions: '+IntToStr(dat_header.Extensions);
|
---|
| 141 | menu_tools.Enabled:=True;
|
---|
| 142 | menu_convert.Enabled:=False;
|
---|
| 143 | END ELSE BEGIN
|
---|
| 144 | menu_convert.Enabled:=True;
|
---|
| 145 | ShowMessage('Error while loading the file:'+CrLf+opend.FileName+CrLf+'Perhaps not an Oni-.dat-file?');
|
---|
| 146 | END;
|
---|
| 147 | END;
|
---|
| 148 | END;
|
---|
| 149 | END;
|
---|
| 150 | PROCEDURE TForm1.menu_lvldbClick(Sender: TObject);
|
---|
| 151 | BEGIN
|
---|
| 152 | opend.InitialDir:=AppSettings.DatPath;
|
---|
| 153 | opend.Filter:='OUP-Level-DB (*.oldb)|*.oldb';
|
---|
| 154 | IF opend.Execute THEN BEGIN
|
---|
| 155 | menu_windows_closeallClick(Form1);
|
---|
| 156 | IF Length(tablist)=0 THEN BEGIN
|
---|
| 157 | IF opened_state=opened_db THEN CloseDatabase;
|
---|
| 158 | Form1.Caption:='Oni Un/Packer '+version;
|
---|
| 159 | opened_state:=opened_nothing;
|
---|
| 160 | statbar.Panels.Items[0].Text:='Nothing loaded';
|
---|
| 161 | statbar.Panels.Items[1].Text:='Files: -';
|
---|
| 162 | statbar.Panels.Items[2].Text:='Extensions: -';
|
---|
| 163 | OpenDatabase(opend.FileName);
|
---|
| 164 | IF opened_state=opened_db THEN BEGIN
|
---|
| 165 | menu_tools.Enabled:=True;
|
---|
| 166 | menu_convert.Enabled:=False;
|
---|
| 167 | statbar.Panels.Items[0].Text:='OLDB loaded: '+opend.FileName;
|
---|
| 168 | statbar.Panels.Items[1].Text:='Files: '+IntToStr(Length(GetFilesList('','',False)));
|
---|
| 169 | statbar.Panels.Items[2].Text:='Extensions: '+IntToStr(Length(GetExtensionsList));
|
---|
| 170 | END ELSE BEGIN
|
---|
| 171 | menu_tools.Enabled:=False;
|
---|
| 172 | menu_convert.Enabled:=True;
|
---|
| 173 | END;
|
---|
| 174 | END;
|
---|
| 175 | END;
|
---|
| 176 | END;
|
---|
| 177 | PROCEDURE TForm1.ClosefileDB1Click(Sender: TObject);
|
---|
| 178 | BEGIN
|
---|
| 179 | menu_windows_closeallClick(Form1);
|
---|
| 180 | IF Length(tablist)=0 THEN BEGIN
|
---|
| 181 | IF opened_state=opened_db THEN CloseDatabase;
|
---|
| 182 | Form1.Caption:='Oni Un/Packer '+version;
|
---|
| 183 | opened_state:=opened_nothing;
|
---|
| 184 | statbar.Panels.Items[0].Text:='Nothing loaded';
|
---|
| 185 | statbar.Panels.Items[1].Text:='Files: -';
|
---|
| 186 | statbar.Panels.Items[2].Text:='Extensions: -';
|
---|
| 187 | menu_tools.Enabled:=False;
|
---|
| 188 | menu_convert.Enabled:=True;
|
---|
| 189 | END;
|
---|
| 190 | END;
|
---|
| 191 | PROCEDURE TForm1.menu_exitClick(Sender: TObject);
|
---|
| 192 | BEGIN
|
---|
| 193 | Form1.Close;
|
---|
| 194 | END;
|
---|
| 195 |
|
---|
| 196 | {####################################}
|
---|
| 197 | {##### Converters-Menu-Handlers #####}
|
---|
| 198 | {####################################}
|
---|
| 199 | PROCEDURE TForm1.menu_createdbClick(Sender: TObject);
|
---|
| 200 | BEGIN
|
---|
| 201 | opend.Filter:='Oni-Dat-Files|*.dat';
|
---|
| 202 | saved.Filter:='OUP-Level-DB (*.oldb)|*.oldb';
|
---|
| 203 | saved.DefaultExt:='oldb';
|
---|
| 204 | IF opend.Execute THEN BEGIN
|
---|
| 205 | IF saved.Execute THEN BEGIN
|
---|
| 206 | Form10.CreateDatabase(opend.FileName,saved.FileName);
|
---|
| 207 | END;
|
---|
| 208 | END;
|
---|
| 209 | END;
|
---|
| 210 | PROCEDURE TForm1.menu_createlvlClick(Sender: TObject);
|
---|
| 211 | BEGIN
|
---|
| 212 | opend.Filter:='OUP-Level-DB (*.oldb)|*.oldb';
|
---|
| 213 | saved.Filter:='Oni-Dat-Files|*.dat';
|
---|
| 214 | saved.DefaultExt:='dat';
|
---|
| 215 | IF opend.Execute THEN BEGIN
|
---|
| 216 | IF saved.Execute THEN BEGIN
|
---|
| 217 | Form10.CreateLevel(opend.FileName,saved.FileName);
|
---|
| 218 | END;
|
---|
| 219 | END;
|
---|
| 220 | END;
|
---|
| 221 |
|
---|
| 222 | {#################################}
|
---|
| 223 | {##### Tools-Menu-Handlers #####}
|
---|
| 224 | {#################################}
|
---|
| 225 | PROCEDURE TForm1.menu_previewClick(Sender: TObject);
|
---|
| 226 | BEGIN
|
---|
| 227 | open_child('preview');
|
---|
| 228 | END;
|
---|
| 229 | PROCEDURE TForm1.menu_txmpreplaceClick(Sender: TObject);
|
---|
| 230 | BEGIN
|
---|
| 231 | open_child('txmpreplace');
|
---|
| 232 | END;
|
---|
| 233 | PROCEDURE TForm1.menu_bineditClick(Sender: TObject);
|
---|
| 234 | BEGIN
|
---|
| 235 | open_child('binedit');
|
---|
| 236 | END;
|
---|
| 237 | PROCEDURE TForm1.menu_raweditClick(Sender: TObject);
|
---|
| 238 | BEGIN
|
---|
| 239 | open_child('rawedit');
|
---|
| 240 | END;
|
---|
| 241 | PROCEDURE TForm1.menu_extractorClick(Sender: TObject);
|
---|
| 242 | BEGIN
|
---|
| 243 | open_child('extractor');
|
---|
| 244 | END;
|
---|
| 245 | PROCEDURE TForm1.menu_filecompareClick(Sender: TObject);
|
---|
| 246 | BEGIN
|
---|
| 247 | open_child('compare');
|
---|
| 248 | END;
|
---|
| 249 |
|
---|
| 250 |
|
---|
| 251 | {#################################}
|
---|
| 252 | {##### Window-Menu-Handlers #####}
|
---|
| 253 | {#################################}
|
---|
| 254 | PROCEDURE TForm1.menu_windows_cascadeClick(Sender: TObject);
|
---|
| 255 | BEGIN
|
---|
| 256 | Form1.Cascade;
|
---|
| 257 | END;
|
---|
| 258 | PROCEDURE TForm1.menu_windows_tileClick(Sender: TObject);
|
---|
| 259 | BEGIN
|
---|
| 260 | Form1.TileMode:=tbHorizontal;
|
---|
| 261 | Form1.Tile;
|
---|
| 262 | END;
|
---|
| 263 | PROCEDURE TForm1.menu_windows_closeallClick(Sender: TObject);
|
---|
| 264 | VAR
|
---|
| 265 | i:Byte;
|
---|
| 266 | BEGIN
|
---|
| 267 | IF MDIChildCount>0 THEN BEGIN
|
---|
| 268 | FOR i:=0 TO MDIChildCount-1 DO BEGIN
|
---|
| 269 | MDIChildren[i].Close;
|
---|
| 270 | END;
|
---|
| 271 | END;
|
---|
| 272 | tabs.Tabs.Clear;
|
---|
| 273 | END;
|
---|
| 274 | PROCEDURE TForm1.menu_windows_nextClick(Sender: TObject);
|
---|
| 275 | VAR i:Byte;
|
---|
| 276 | first_window:Byte;
|
---|
| 277 | current_focus:String;
|
---|
| 278 | BEGIN
|
---|
| 279 | IF MDIChildCount>1 THEN BEGIN
|
---|
| 280 | FOR i:=0 TO menu_windows.Count-1 DO BEGIN
|
---|
| 281 | IF Pos('menu_window_',menu_windows.Items[i].Name)=1 THEN BEGIN
|
---|
| 282 | first_window:=i;
|
---|
| 283 | Break;
|
---|
| 284 | END;
|
---|
| 285 | END;
|
---|
| 286 | current_focus:=ActiveMDIChild.Name;
|
---|
| 287 | FOR i:=first_window TO menu_windows.Count-1 DO
|
---|
| 288 | IF Pos(current_focus,menu_windows.Items[i].Name)>0 THEN
|
---|
| 289 | Break;
|
---|
| 290 | IF i=menu_windows.Count-1 THEN
|
---|
| 291 | menu_windows.Items[first_window].Click
|
---|
| 292 | ELSE
|
---|
| 293 | menu_windows.Items[i+1].Click;
|
---|
| 294 | FOR i:=0 TO High(tablist) DO BEGIN
|
---|
| 295 | IF tablist[i]=ActiveMDIChild.Name THEN BEGIN
|
---|
| 296 | tabs.TabIndex:=i;
|
---|
| 297 | END;
|
---|
| 298 | END;
|
---|
| 299 | END;
|
---|
| 300 | END;
|
---|
| 301 | PROCEDURE TForm1.menu_windows_previousClick(Sender: TObject);
|
---|
| 302 | VAR i:Byte;
|
---|
| 303 | first_window:Byte;
|
---|
| 304 | current_focus:String;
|
---|
| 305 | BEGIN
|
---|
| 306 | IF MDIChildCount>1 THEN BEGIN
|
---|
| 307 | FOR i:=0 TO menu_windows.Count-1 DO BEGIN
|
---|
| 308 | IF Pos('menu_window_',menu_windows.Items[i].Name)=1 THEN BEGIN
|
---|
| 309 | first_window:=i;
|
---|
| 310 | Break;
|
---|
| 311 | END;
|
---|
| 312 | END;
|
---|
| 313 | current_focus:=ActiveMDIChild.Name;
|
---|
| 314 | FOR i:=first_window TO menu_windows.Count-1 DO
|
---|
| 315 | IF Pos(current_focus,menu_windows.Items[i].Name)>0 THEN
|
---|
| 316 | Break;
|
---|
| 317 | IF i=first_window THEN
|
---|
| 318 | menu_windows.Items[menu_windows.Count-1].Click
|
---|
| 319 | ELSE
|
---|
| 320 | menu_windows.Items[i-1].Click;
|
---|
| 321 | FOR i:=0 TO High(tablist) DO BEGIN
|
---|
| 322 | IF tablist[i]=ActiveMDIChild.Name THEN BEGIN
|
---|
| 323 | tabs.TabIndex:=i;
|
---|
| 324 | END;
|
---|
| 325 | END;
|
---|
| 326 | END;
|
---|
| 327 | END;
|
---|
| 328 |
|
---|
| 329 | PROCEDURE TForm1.menu_window_entryClick(Sender: TObject);
|
---|
| 330 | VAR
|
---|
| 331 | i:Byte;
|
---|
| 332 | window_name:String;
|
---|
| 333 | BEGIN
|
---|
| 334 | window_name:=MidStr(TComponent(Sender).Name,Pos('window_',TComponent(Sender).Name)+7,Length(TComponent(Sender).Name)-Pos('window_',TComponent(Sender).Name)+7+1);
|
---|
| 335 | FOR i:=0 TO MDIChildCount-1 DO BEGIN
|
---|
| 336 | IF MDIChildren[i].Name=window_name THEN BEGIN
|
---|
| 337 | MDIChildren[i].BringToFront;
|
---|
| 338 | END;
|
---|
| 339 | END;
|
---|
| 340 | FOR i:=0 TO High(tablist) DO BEGIN
|
---|
| 341 | IF tablist[i]=ActiveMDIChild.Name THEN BEGIN
|
---|
| 342 | tabs.TabIndex:=i;
|
---|
| 343 | END;
|
---|
| 344 | END;
|
---|
| 345 | END;
|
---|
| 346 |
|
---|
| 347 |
|
---|
| 348 |
|
---|
| 349 | FUNCTION TForm1.open_child(window_context:String):Boolean;
|
---|
| 350 | VAR
|
---|
| 351 | rawEdit:TForm13;
|
---|
| 352 | binEdit:TForm8;
|
---|
| 353 | preview:TForm5;
|
---|
| 354 | txmpreplacer:TForm7;
|
---|
| 355 | extractor:TForm11;
|
---|
| 356 | menu_button:TMenuItem;
|
---|
| 357 | used:Array[1..9] OF Boolean;
|
---|
| 358 | i:Byte;
|
---|
| 359 | caption:String;
|
---|
| 360 | name:String;
|
---|
| 361 | BEGIN
|
---|
| 362 | Result:=True;
|
---|
| 363 | FOR i:=1 TO 9 DO used[i]:=False;
|
---|
| 364 | IF MDIChildCount>0 THEN
|
---|
| 365 | FOR i:=0 TO MDIChildCount-1 DO
|
---|
| 366 | IF Pos(window_context,Form1.MDIChildren[i].Name)=1 THEN
|
---|
| 367 | used[StrToInt(RightStr(Form1.MDIChildren[i].Caption,1))]:=True;
|
---|
| 368 | FOR i:=1 TO 10 DO
|
---|
| 369 | IF i=10 THEN
|
---|
| 370 | Break
|
---|
| 371 | ELSE
|
---|
| 372 | IF NOT used[i] THEN Break;
|
---|
| 373 |
|
---|
| 374 | IF i<10 THEN BEGIN
|
---|
| 375 | name:=window_context+IntToStr(i);
|
---|
| 376 | IF window_context='binedit' THEN
|
---|
| 377 | caption:='Binary .dat-Editor '+IntToStr(i);
|
---|
| 378 | IF window_context='rawedit' THEN
|
---|
| 379 | caption:='Binary .raw-Editor '+IntToStr(i);
|
---|
| 380 | IF window_context='preview' THEN
|
---|
| 381 | caption:='Preview-Window '+IntToStr(i);
|
---|
| 382 | IF window_context='txmpreplace' THEN
|
---|
| 383 | caption:='TXMP Replacer '+IntToStr(i);
|
---|
| 384 | IF window_context='extractor' THEN
|
---|
| 385 | caption:='Extractor '+IntToStr(i);
|
---|
| 386 |
|
---|
| 387 | menu_button:=TMenuItem.Create(menu_windows);
|
---|
| 388 | menu_button.Caption:=caption;
|
---|
| 389 | menu_button.Name:='menu_window_'+name;
|
---|
| 390 | menu_button.OnClick:=Form1.menu_window_entryClick;
|
---|
| 391 | menu_windows.Add(menu_button);
|
---|
| 392 |
|
---|
| 393 | SetLength(tablist,Length(tablist)+1);
|
---|
| 394 | tablist[High(tablist)]:=name;
|
---|
| 395 | tabs.Tabs.Add(caption);
|
---|
| 396 |
|
---|
| 397 | IF window_context='binedit' THEN BEGIN
|
---|
| 398 | binEdit:=TForm8.Create(Application);
|
---|
| 399 | binEdit.Name:=name;
|
---|
| 400 | binEdit.Caption:=caption;
|
---|
| 401 | binEdit.Recreatelist;
|
---|
| 402 | END;
|
---|
| 403 | IF window_context='rawedit' THEN BEGIN
|
---|
| 404 | rawEdit:=TForm13.Create(Application);
|
---|
| 405 | rawEdit.Name:=name;
|
---|
| 406 | rawEdit.Caption:=caption;
|
---|
| 407 | rawEdit.Recreatelist;
|
---|
| 408 | END;
|
---|
| 409 | IF window_context='preview' THEN BEGIN
|
---|
| 410 | preview:=TForm5.Create(Application);
|
---|
| 411 | preview.Name:=name;
|
---|
| 412 | preview.Caption:=caption;
|
---|
| 413 | preview.Recreatelist;
|
---|
| 414 | END;
|
---|
| 415 | IF window_context='txmpreplace' THEN BEGIN
|
---|
| 416 | txmpreplacer:=TForm7.Create(Application);
|
---|
| 417 | txmpreplacer.Name:=name;
|
---|
| 418 | txmpreplacer.Caption:=caption;
|
---|
| 419 | txmpreplacer.Recreatelist;
|
---|
| 420 | END;
|
---|
| 421 | IF window_context='extractor' THEN BEGIN
|
---|
| 422 | extractor:=TForm11.Create(Application);
|
---|
| 423 | extractor.Name:=name;
|
---|
| 424 | extractor.Caption:=caption;
|
---|
| 425 | extractor.Recreatelist;
|
---|
| 426 | END;
|
---|
| 427 |
|
---|
| 428 | tabs.TabIndex:=High(tablist);
|
---|
| 429 | IF MDIChildCount=9 THEN menu_tools.Enabled:=False;
|
---|
| 430 | END ELSE BEGIN
|
---|
| 431 | Result:=False;
|
---|
| 432 | END;
|
---|
| 433 | END;
|
---|
| 434 |
|
---|
| 435 |
|
---|
| 436 | PROCEDURE TForm1.close_window(window_name:String);
|
---|
| 437 | VAR
|
---|
| 438 | i,j:Byte;
|
---|
| 439 | BEGIN
|
---|
| 440 | FOR i:=0 TO menu_windows.Count-1 DO BEGIN
|
---|
| 441 | IF menu_windows.Items[i].Name='menu_window_'+window_name THEN BEGIN
|
---|
| 442 | menu_windows.Items[i].Free;
|
---|
| 443 | Break;
|
---|
| 444 | END;
|
---|
| 445 | END;
|
---|
| 446 | FOR i:=0 TO High(tablist) DO BEGIN
|
---|
| 447 | IF tablist[i]=window_name THEN BEGIN
|
---|
| 448 | tabs.Tabs.Delete(i);
|
---|
| 449 | IF High(tablist)>0 THEN
|
---|
| 450 | FOR j:=i TO High(tablist)-1 DO
|
---|
| 451 | tablist[j]:=tablist[j+1];
|
---|
| 452 | SetLength(tablist,Length(tablist)-1);
|
---|
| 453 | Break;
|
---|
| 454 | END;
|
---|
| 455 | END;
|
---|
| 456 | menu_tools.Enabled:=True;
|
---|
| 457 | END;
|
---|
| 458 |
|
---|
| 459 |
|
---|
| 460 | PROCEDURE TForm1.tabsChange(Sender: TObject; NewTab: Integer; var AllowChange: Boolean);
|
---|
| 461 | VAR
|
---|
| 462 | i:Byte;
|
---|
| 463 | BEGIN
|
---|
| 464 | FOR i:=0 TO MDIChildCount-1 DO BEGIN
|
---|
| 465 | IF MDIChildren[i].Name=tablist[NewTab] THEN
|
---|
| 466 | MDIChildren[i].BringToFront;
|
---|
| 467 | END;
|
---|
| 468 | END;
|
---|
| 469 |
|
---|
| 470 | PROCEDURE TForm1.SetActiveWindow(window_name:String);
|
---|
| 471 | VAR
|
---|
| 472 | i:Byte;
|
---|
| 473 | BEGIN
|
---|
| 474 | IF Length(tablist)>0 THEN
|
---|
| 475 | FOR i:=0 TO High(tablist) DO
|
---|
| 476 | IF tablist[i]=window_name THEN
|
---|
| 477 | tabs.TabIndex:=i;
|
---|
| 478 | END;
|
---|
| 479 |
|
---|
| 480 |
|
---|
| 481 | END.
|
---|