| 6 |
|
MPHexEditor, ToolWin, ImgList, Tabs, |
| 7 |
|
MDITab, TB2Item, TB2Dock, TB2Toolbar, TB2MDI, OneInst, |
| 8 |
|
Data, TypeDefs, ConnectionManager, |
| 9 |
< |
// Functions, Exporters, DataStructures, |
| 10 |
< |
Functions, |
| 11 |
< |
Settings, {Helper_LevelDB, } |
| 12 |
< |
Template, |
| 9 |
> |
Functions, Settings, Template, |
| 10 |
|
RawEdit, BinEdit, Extractor, Preview, TxmpReplace; |
| 11 |
|
|
| 12 |
|
type |
| 134 |
|
|
| 135 |
|
implementation |
| 136 |
|
|
| 137 |
+ |
uses |
| 138 |
+ |
LevelDB, MetaEditor; |
| 139 |
+ |
|
| 140 |
|
{$R *.dfm} |
| 141 |
|
|
| 142 |
|
|
| 254 |
|
end |
| 255 |
|
else |
| 256 |
|
begin |
| 257 |
+ |
ShowMessage('Warning!' + #13#10 + |
| 258 |
+ |
'It seems like this is the first time you OUP.' + #13#10 + |
| 259 |
+ |
'I do not take any responsibility for messed up data files' + #13+#10 + |
| 260 |
+ |
'Do not forget to make backup copies of your *.dat/*.raw/*.sep files!'); |
| 261 |
|
AppSettings.DatPath := ExtractFilepath(Application.EXEname); |
| 262 |
|
AppSettings.ExtractPath := ExtractFilepath(Application.EXEname) + '\extract'; |
| 263 |
|
AppSettings.CharSet := DEFAULT_CHARSET; |
| 414 |
|
tb_rawedit.Enabled := active; |
| 415 |
|
tb_txmpreplacer.Enabled := active; |
| 416 |
|
tb_extractor.Enabled := active; |
| 417 |
+ |
tb_meta.Enabled := active; |
| 418 |
|
// tb_compare.Enabled := active; |
| 419 |
|
// tb_structure.Enabled := active; |
| 420 |
|
end; |
| 552 |
|
{####################################} |
| 553 |
|
procedure TForm_Main.menu_createdbClick(Sender: TObject); |
| 554 |
|
begin |
| 555 |
< |
ShowMessage('Not yet usable'); |
| 556 |
< |
{ |
| 555 |
> |
// ShowMessage('Not yet usable'); |
| 556 |
> |
|
| 557 |
|
opend.Filter := 'Oni-Dat-Files|*.dat'; |
| 558 |
|
saved.Filter := 'OUP-Level-DB (*.oldb)|*.oldb'; |
| 559 |
|
saved.DefaultExt := 'oldb'; |
| 560 |
|
if opend.Execute then |
| 561 |
|
if saved.Execute then |
| 562 |
|
Form_LevelDB.CreateDatabase(opend.FileName, saved.FileName); |
| 558 |
– |
} |
| 563 |
|
end; |
| 564 |
|
|
| 565 |
|
|
| 566 |
|
procedure TForm_Main.menu_createlvlClick(Sender: TObject); |
| 567 |
|
begin |
| 568 |
< |
ShowMessage('Not yet usable'); |
| 569 |
< |
{ |
| 568 |
> |
// ShowMessage('Not yet usable'); |
| 569 |
> |
|
| 570 |
|
opend.Filter := 'OUP-Level-DB (*.oldb)|*.oldb'; |
| 571 |
|
saved.Filter := 'Oni-Dat-Files|*.dat'; |
| 572 |
|
saved.DefaultExt := 'dat'; |
| 573 |
|
if opend.Execute then |
| 574 |
|
if saved.Execute then |
| 575 |
|
Form_LevelDB.CreateLevel(opend.FileName, saved.FileName); |
| 572 |
– |
} |
| 576 |
|
end; |
| 577 |
|
|
| 578 |
|
|
| 605 |
|
end; |
| 606 |
|
|
| 607 |
|
procedure TForm_Main.menu_metaClick(Sender: TObject); |
| 608 |
+ |
var |
| 609 |
+ |
toolform: TForm_Meta; |
| 610 |
+ |
i: Integer; |
| 611 |
+ |
tag: Integer; |
| 612 |
+ |
iconindex: Integer; |
| 613 |
|
begin |
| 614 |
< |
ShowMessage('TBD'); |
| 614 |
> |
tag := 1; |
| 615 |
> |
if MDIChildCount > 0 then |
| 616 |
> |
for i := 0 to MDIChildCount - 1 do |
| 617 |
> |
if MDIChildren[i].Tag >= tag then |
| 618 |
> |
tag := MDIChildren[i].Tag + 1; |
| 619 |
> |
|
| 620 |
> |
iconindex := -1; |
| 621 |
> |
|
| 622 |
> |
toolform := nil; |
| 623 |
> |
|
| 624 |
> |
toolform := TForm_Meta.Create(Self); |
| 625 |
> |
toolform.Caption := 'MetaEditor' + ' ' + IntToStr(tag) + ' '; |
| 626 |
> |
iconindex := 11; |
| 627 |
> |
|
| 628 |
> |
if Assigned(toolform) then |
| 629 |
> |
begin |
| 630 |
> |
toolform.Name := 'meta' + IntToStr(tag); |
| 631 |
> |
toolform.Tag := tag; |
| 632 |
> |
MDITab.AddTab(TForm(toolform), iconindex); |
| 633 |
> |
toolform.Caption := AnsiReplaceStr(toolform.Caption, ' ', ''); |
| 634 |
> |
end; |
| 635 |
|
end; |
| 636 |
|
|
| 637 |
|
procedure TForm_Main.menu_filecompareClick(Sender: TObject); |
| 753 |
|
|
| 754 |
|
|
| 755 |
|
function TForm_Main.open_child(window_context: String; connection, fileid: Integer): TForm_ToolTemplate; |
| 756 |
+ |
type |
| 757 |
+ |
TTemplate = class of TForm_ToolTemplate; |
| 758 |
+ |
TTool = record |
| 759 |
+ |
name: String; |
| 760 |
+ |
icon: Integer; |
| 761 |
+ |
caption: String; |
| 762 |
+ |
classt: TTemplate; |
| 763 |
+ |
end; |
| 764 |
+ |
const |
| 765 |
+ |
Tools: array[0..4] of TTool = ( |
| 766 |
+ |
(name: 'binedit'; icon: 5; caption: 'Binary .dat-Editor'; classt: TForm_BinEdit), |
| 767 |
+ |
(name: 'extractor'; icon: 8; caption: 'Extractor'; classt: TForm_Extractor), |
| 768 |
+ |
(name: 'preview'; icon: 4; caption: 'Preview-Window'; classt: TForm_Preview), |
| 769 |
+ |
(name: 'rawedit'; icon: 6; caption: 'Binary .raw-Editor'; classt: TForm_RawEdit), |
| 770 |
+ |
(name: 'txmpreplace'; icon: 7; caption: 'TXMP Replacer'; classt: TForm_TxmpReplace) |
| 771 |
+ |
); |
| 772 |
|
var |
| 773 |
|
toolform: TForm_ToolTemplate; |
| 774 |
|
i: Integer; |
| 775 |
|
tag: Integer; |
| 732 |
– |
caption_end: String; |
| 776 |
|
iconindex: Integer; |
| 777 |
|
begin |
| 778 |
|
Result := nil; |
| 784 |
|
tag := MDIChildren[i].Tag + 1; |
| 785 |
|
|
| 786 |
|
iconindex := -1; |
| 744 |
– |
caption_end := IntToStr(tag) + ' '; |
| 787 |
|
|
| 788 |
|
toolform := nil; |
| 789 |
|
|
| 790 |
< |
if window_context = 'binedit' then |
| 791 |
< |
begin |
| 792 |
< |
toolform := TForm_BinEdit.Create(Self); |
| 793 |
< |
toolform.Caption := 'Binary .dat-Editor ' + caption_end; |
| 794 |
< |
iconindex := 5; |
| 795 |
< |
end; |
| 796 |
< |
if window_context = 'extractor' then |
| 797 |
< |
begin |
| 798 |
< |
toolform := TForm_Extractor.Create(Self); |
| 799 |
< |
toolform.Caption := 'Extractor ' + caption_end; |
| 758 |
< |
iconindex := 8; |
| 759 |
< |
end; |
| 760 |
< |
if window_context = 'preview' then |
| 761 |
< |
begin |
| 762 |
< |
toolform := TForm_Preview.Create(Self); |
| 763 |
< |
toolform.Caption := 'Preview-Window ' + caption_end; |
| 764 |
< |
iconindex := 4; |
| 765 |
< |
end; |
| 766 |
< |
if window_context = 'rawedit' then |
| 767 |
< |
begin |
| 768 |
< |
toolform := TForm_RawEdit.Create(Self); |
| 769 |
< |
toolform.Caption := 'Binary .raw-Editor ' + caption_end; |
| 770 |
< |
iconindex := 6; |
| 771 |
< |
end; |
| 772 |
< |
if window_context = 'txmpreplace' then |
| 773 |
< |
begin |
| 774 |
< |
toolform := TForm_TxmpReplace.Create(Self); |
| 775 |
< |
toolform.Caption := 'TXMP Replacer ' + caption_end; |
| 776 |
< |
iconindex := 7; |
| 790 |
> |
for i := 0 to High(Tools) do |
| 791 |
> |
if Tools[i].name = window_context then |
| 792 |
> |
Break; |
| 793 |
> |
if i < Length(Tools) then |
| 794 |
> |
begin |
| 795 |
> |
toolform := TTemplate(Tools[i].classt).Create(Self); |
| 796 |
> |
toolform.Caption := Tools[i].caption + ' ' + IntToStr(tag) + ' '; |
| 797 |
> |
iconindex := Tools[i].icon; |
| 798 |
> |
end else begin |
| 799 |
> |
ShowMessage('WindowContext not found!'); |
| 800 |
|
end; |
| 801 |
|
|
| 802 |
|
if Assigned(toolform) then |