| 6 |
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, |
| 7 |
|
Dialogs, StdCtrls, StrUtils, Clipbrd, ExtCtrls, ComCtrls, Menus, Grids, |
| 8 |
|
MPHexEditor, ToolWin, ImgList, Tabs, |
| 9 |
< |
Code_Functions, Data, Code_DataStructures, |
| 10 |
< |
Helper_LevelDB, Code_Exporters, Settings, |
| 11 |
< |
Tool_Preview, Tool_TxmpReplace, Tool_BinEdit, Tool_Extractor, Tool_RawEdit, |
| 12 |
< |
Code_OniDataClass, MDITab, TB2Item, TB2Dock, TB2Toolbar, TB2MDI; |
| 9 |
> |
MDITab, TB2Item, TB2Dock, TB2Toolbar, TB2MDI, |
| 10 |
> |
Data, Functions, DataStructures, OniDataClass, Exporters, |
| 11 |
> |
Helper_LevelDB, Settings, Template, |
| 12 |
> |
BinEdit, Extractor, Preview, RawEdit, TxmpReplace; |
| 13 |
|
|
| 14 |
|
type |
| 15 |
|
TForm_Main = class(TForm) |
| 65 |
|
tb_txmpreplacer: TTBItem; |
| 66 |
|
tb_rawedit: TTBItem; |
| 67 |
|
tb_datedit: TTBItem; |
| 68 |
+ |
menu_windows_tilevert: TTBItem; |
| 69 |
|
function TryCloseAll: Boolean; |
| 70 |
|
procedure menu_AboutClick(Sender: TObject); |
| 71 |
|
procedure menu_settingsClick(Sender: TObject); |
| 77 |
|
procedure menu_windows_previousClick(Sender: TObject); |
| 78 |
|
procedure menu_windows_nextClick(Sender: TObject); |
| 79 |
|
procedure menu_windows_tileClick(Sender: TObject); |
| 80 |
< |
function open_child(window_context: String): Boolean; |
| 80 |
> |
function open_child(window_context: String; fileid: Integer): TForm_ToolTemplate; |
| 81 |
|
procedure menu_windows_closeallClick(Sender: TObject); |
| 82 |
|
procedure menu_windows_cascadeClick(Sender: TObject); |
| 83 |
|
procedure menu_bineditClick(Sender: TObject); |
| 97 |
|
procedure ActivateTools(active: Boolean); |
| 98 |
|
procedure MDITabMouseUp(Sender: TObject; Button: TMouseButton; |
| 99 |
|
Shift: TShiftState; X, Y: Integer); |
| 100 |
+ |
procedure menu_windows_tilevertClick(Sender: TObject); |
| 101 |
|
private |
| 102 |
|
public |
| 103 |
|
end; |
| 306 |
|
begin |
| 307 |
|
ext := ExtractFileExt(opend.FileName); |
| 308 |
|
if ext = '.dat' then |
| 309 |
+ |
begin |
| 310 |
|
if not CreateDataConnection(opend.FileName, ODB_Dat) then |
| 311 |
|
ShowMessage('Error while loading the file:' + CrLf + opend.FileName + |
| 312 |
< |
CrLf + 'Perhaps not an Oni-.dat-file?') |
| 313 |
< |
else if ext = '.oldb' then |
| 312 |
> |
CrLf + 'Perhaps not an Oni-.dat-file?'); |
| 313 |
> |
end else if ext = '.oldb' then |
| 314 |
> |
begin |
| 315 |
|
if not CreateDataConnection(opend.FileName, ODB_ADB) then |
| 316 |
|
ShowMessage('Error while loading the file:' + CrLf + opend.FileName + |
| 317 |
< |
CrLf + 'Perhaps not an OniUnPacker-LevelDatabase-file?') |
| 318 |
< |
else |
| 317 |
> |
CrLf + 'Perhaps not an OniUnPacker-LevelDatabase-file?'); |
| 318 |
> |
end else |
| 319 |
|
ShowMessage('Incompatible file'); |
| 320 |
|
AppSettings.DatPath := ExtractFilepath(opend.FileName); |
| 321 |
|
end; |
| 397 |
|
{#################################} |
| 398 |
|
procedure TForm_Main.menu_previewClick(Sender: TObject); |
| 399 |
|
begin |
| 400 |
< |
open_child('preview'); |
| 400 |
> |
open_child('preview', -1); |
| 401 |
|
end; |
| 402 |
|
|
| 403 |
|
|
| 404 |
|
procedure TForm_Main.menu_txmpreplaceClick(Sender: TObject); |
| 405 |
|
begin |
| 406 |
< |
open_child('txmpreplace'); |
| 406 |
> |
open_child('txmpreplace', -1); |
| 407 |
|
end; |
| 408 |
|
|
| 409 |
|
|
| 410 |
|
procedure TForm_Main.menu_bineditClick(Sender: TObject); |
| 411 |
|
begin |
| 412 |
< |
open_child('binedit'); |
| 412 |
> |
open_child('binedit', -1); |
| 413 |
|
end; |
| 414 |
|
|
| 415 |
|
|
| 416 |
|
procedure TForm_Main.menu_raweditClick(Sender: TObject); |
| 417 |
|
begin |
| 418 |
< |
open_child('rawedit'); |
| 418 |
> |
open_child('rawedit', -1); |
| 419 |
|
end; |
| 420 |
|
|
| 421 |
|
|
| 422 |
|
procedure TForm_Main.menu_extractorClick(Sender: TObject); |
| 423 |
|
begin |
| 424 |
< |
open_child('extractor'); |
| 424 |
> |
open_child('extractor', -1); |
| 425 |
|
end; |
| 426 |
|
|
| 427 |
|
|
| 428 |
|
procedure TForm_Main.menu_filecompareClick(Sender: TObject); |
| 429 |
|
begin |
| 430 |
< |
open_child('compare'); |
| 430 |
> |
open_child('compare', -1); |
| 431 |
|
end; |
| 432 |
|
|
| 433 |
|
|
| 476 |
|
Self.Tile; |
| 477 |
|
end; |
| 478 |
|
|
| 479 |
+ |
procedure TForm_Main.menu_windows_tilevertClick(Sender: TObject); |
| 480 |
+ |
begin |
| 481 |
+ |
Self.TileMode := tbVertical; |
| 482 |
+ |
Self.Tile; |
| 483 |
+ |
end; |
| 484 |
|
|
| 485 |
|
|
| 486 |
|
procedure TForm_Main.menu_windows_closeallClick(Sender: TObject); |
| 523 |
|
|
| 524 |
|
|
| 525 |
|
|
| 526 |
< |
function TForm_Main.open_child(window_context: String): Boolean; |
| 526 |
> |
function TForm_Main.open_child(window_context: String; fileid: Integer): TForm_ToolTemplate; |
| 527 |
|
var |
| 528 |
< |
form: TCustomForm; |
| 528 |
> |
toolform: TForm_ToolTemplate; |
| 529 |
|
i: Integer; |
| 530 |
|
tag: Integer; |
| 531 |
|
iconindex: Integer; |
| 532 |
|
begin |
| 533 |
< |
Result := True; |
| 533 |
> |
Result := nil; |
| 534 |
|
|
| 535 |
|
tag := 1; |
| 536 |
|
if MDIChildCount > 0 then |
| 542 |
|
|
| 543 |
|
if window_context = 'binedit' then |
| 544 |
|
begin |
| 545 |
< |
form := TForm_BinEdit.Create(Application); |
| 546 |
< |
TForm_BinEdit(form).Recreatelist; |
| 547 |
< |
form.Caption := 'Binary .dat-Editor ' + IntToStr(tag); |
| 539 |
< |
iconindex := 0; |
| 545 |
> |
toolform := TForm_BinEdit.Create(Self); |
| 546 |
> |
toolform.Caption := 'Binary .dat-Editor ' + IntToStr(tag); |
| 547 |
> |
iconindex := 4; |
| 548 |
|
end; |
| 549 |
< |
if window_context = 'rawedit' then |
| 549 |
> |
if window_context = 'extractor' then |
| 550 |
|
begin |
| 551 |
< |
form := TForm_RawEdit.Create(Application); |
| 552 |
< |
TForm_RawEdit(form).Recreatelist; |
| 553 |
< |
form.Caption := 'Binary .raw-Editor ' + IntToStr(tag); |
| 551 |
> |
toolform := TForm_Extractor.Create(Self); |
| 552 |
> |
toolform.Caption := 'Extractor ' + IntToStr(tag); |
| 553 |
> |
iconindex := 7; |
| 554 |
|
end; |
| 555 |
|
if window_context = 'preview' then |
| 556 |
|
begin |
| 557 |
< |
form := TForm_Preview.Create(Application); |
| 558 |
< |
TForm_Preview(form).Recreatelist; |
| 559 |
< |
form.Caption := 'Preview-Window ' + IntToStr(tag); |
| 557 |
> |
toolform := TForm_Preview.Create(Self); |
| 558 |
> |
toolform.Caption := 'Preview-Window ' + IntToStr(tag); |
| 559 |
> |
iconindex := 3; |
| 560 |
|
end; |
| 561 |
< |
if window_context = 'txmpreplace' then |
| 561 |
> |
if window_context = 'rawedit' then |
| 562 |
|
begin |
| 563 |
< |
form := TForm_TxmpReplace.Create(Application); |
| 564 |
< |
TForm_TxmpReplace(form).Recreatelist; |
| 565 |
< |
form.Caption := 'TXMP Replacer ' + IntToStr(tag); |
| 563 |
> |
toolform := TForm_RawEdit.Create(Self); |
| 564 |
> |
toolform.Caption := 'Binary .raw-Editor ' + IntToStr(tag); |
| 565 |
> |
iconindex := 5; |
| 566 |
|
end; |
| 567 |
< |
if window_context = 'extractor' then |
| 567 |
> |
if window_context = 'txmpreplace' then |
| 568 |
|
begin |
| 569 |
< |
form := TForm_Extractor.Create(Application); |
| 570 |
< |
TForm_Extractor(form).Recreatelist; |
| 571 |
< |
form.Caption := 'Extractor ' + IntToStr(tag); |
| 569 |
> |
toolform := TForm_TxmpReplace.Create(Application); |
| 570 |
> |
toolform.Caption := 'TXMP Replacer ' + IntToStr(tag); |
| 571 |
> |
iconindex := 6; |
| 572 |
|
end; |
| 573 |
|
|
| 574 |
< |
form.Name := window_context + IntToStr(tag); |
| 575 |
< |
form.Tag := tag; |
| 576 |
< |
|
| 577 |
< |
MDITab.AddTab(TForm(form), iconindex); |
| 574 |
> |
if Assigned(toolform) then |
| 575 |
> |
begin |
| 576 |
> |
toolform.Name := window_context + IntToStr(tag); |
| 577 |
> |
toolform.Tag := tag; |
| 578 |
> |
MDITab.AddTab(TForm(toolform), iconindex); |
| 579 |
> |
if fileid > -1 then |
| 580 |
> |
toolform.SelectFileID(fileid); |
| 581 |
> |
Result := toolform; |
| 582 |
> |
end; |
| 583 |
|
end; |
| 584 |
|
|
| 585 |
|
end. |