| 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; |
| 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; |
| 551 |
|
{####################################} |
| 552 |
|
procedure TForm_Main.menu_createdbClick(Sender: TObject); |
| 553 |
|
begin |
| 554 |
< |
ShowMessage('Not yet usable'); |
| 555 |
< |
{ |
| 554 |
> |
// ShowMessage('Not yet usable'); |
| 555 |
> |
|
| 556 |
|
opend.Filter := 'Oni-Dat-Files|*.dat'; |
| 557 |
|
saved.Filter := 'OUP-Level-DB (*.oldb)|*.oldb'; |
| 558 |
|
saved.DefaultExt := 'oldb'; |
| 559 |
|
if opend.Execute then |
| 560 |
|
if saved.Execute then |
| 561 |
|
Form_LevelDB.CreateDatabase(opend.FileName, saved.FileName); |
| 558 |
– |
} |
| 562 |
|
end; |
| 563 |
|
|
| 564 |
|
|
| 565 |
|
procedure TForm_Main.menu_createlvlClick(Sender: TObject); |
| 566 |
|
begin |
| 567 |
< |
ShowMessage('Not yet usable'); |
| 568 |
< |
{ |
| 567 |
> |
// ShowMessage('Not yet usable'); |
| 568 |
> |
|
| 569 |
|
opend.Filter := 'OUP-Level-DB (*.oldb)|*.oldb'; |
| 570 |
|
saved.Filter := 'Oni-Dat-Files|*.dat'; |
| 571 |
|
saved.DefaultExt := 'dat'; |
| 572 |
|
if opend.Execute then |
| 573 |
|
if saved.Execute then |
| 574 |
|
Form_LevelDB.CreateLevel(opend.FileName, saved.FileName); |
| 572 |
– |
} |
| 575 |
|
end; |
| 576 |
|
|
| 577 |
|
|
| 727 |
|
|
| 728 |
|
|
| 729 |
|
function TForm_Main.open_child(window_context: String; connection, fileid: Integer): TForm_ToolTemplate; |
| 730 |
+ |
type |
| 731 |
+ |
TTemplate = class of TForm_ToolTemplate; |
| 732 |
+ |
TTool = record |
| 733 |
+ |
name: String; |
| 734 |
+ |
icon: Integer; |
| 735 |
+ |
caption: String; |
| 736 |
+ |
classt: TTemplate; |
| 737 |
+ |
end; |
| 738 |
+ |
const |
| 739 |
+ |
Tools: array[0..4] of TTool = ( |
| 740 |
+ |
(name: 'binedit'; icon: 5; caption: 'Binary .dat-Editor'; classt: TForm_BinEdit), |
| 741 |
+ |
(name: 'extractor'; icon: 8; caption: 'Extractor'; classt: TForm_Extractor), |
| 742 |
+ |
(name: 'preview'; icon: 4; caption: 'Preview-Window'; classt: TForm_Preview), |
| 743 |
+ |
(name: 'rawedit'; icon: 6; caption: 'Binary .raw-Editor'; classt: TForm_RawEdit), |
| 744 |
+ |
(name: 'txmpreplace'; icon: 7; caption: 'TXMP Replacer'; classt: TForm_TxmpReplace) |
| 745 |
+ |
); |
| 746 |
|
var |
| 747 |
|
toolform: TForm_ToolTemplate; |
| 748 |
|
i: Integer; |
| 749 |
|
tag: Integer; |
| 732 |
– |
caption_end: String; |
| 750 |
|
iconindex: Integer; |
| 751 |
|
begin |
| 752 |
|
Result := nil; |
| 758 |
|
tag := MDIChildren[i].Tag + 1; |
| 759 |
|
|
| 760 |
|
iconindex := -1; |
| 744 |
– |
caption_end := IntToStr(tag) + ' '; |
| 761 |
|
|
| 762 |
|
toolform := nil; |
| 763 |
|
|
| 764 |
< |
if window_context = 'binedit' then |
| 765 |
< |
begin |
| 766 |
< |
toolform := TForm_BinEdit.Create(Self); |
| 767 |
< |
toolform.Caption := 'Binary .dat-Editor ' + caption_end; |
| 768 |
< |
iconindex := 5; |
| 769 |
< |
end; |
| 770 |
< |
if window_context = 'extractor' then |
| 771 |
< |
begin |
| 772 |
< |
toolform := TForm_Extractor.Create(Self); |
| 773 |
< |
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; |
| 764 |
> |
for i := 0 to High(Tools) do |
| 765 |
> |
if Tools[i].name = window_context then |
| 766 |
> |
Break; |
| 767 |
> |
if i < Length(Tools) then |
| 768 |
> |
begin |
| 769 |
> |
toolform := TTemplate(Tools[i].classt).Create(Self); |
| 770 |
> |
toolform.Caption := Tools[i].caption + ' ' + IntToStr(tag) + ' '; |
| 771 |
> |
iconindex := Tools[i].icon; |
| 772 |
> |
end else begin |
| 773 |
> |
ShowMessage('WindowContext not found!'); |
| 774 |
|
end; |
| 775 |
|
|
| 776 |
|
if Assigned(toolform) then |