| 6 |
|
MPHexEditor, ToolWin, ImgList, Tabs, |
| 7 |
|
MDITab, TB2Item, TB2Dock, TB2Toolbar, TB2MDI, OneInst, |
| 8 |
|
Data, TypeDefs, ConnectionManager, |
| 9 |
< |
Functions, Settings, Template, |
| 10 |
< |
RawEdit, BinEdit, Extractor, Preview, TxmpReplace; |
| 9 |
> |
Functions, Settings, |
| 10 |
> |
RawEdit, BinEdit, Extractor, Preview, TxmpReplace, |
| 11 |
> |
_BaseTemplate, _TemplateFile, _TemplateFileList; |
| 12 |
|
|
| 13 |
|
type |
| 14 |
|
TForm_Main = class(TForm) |
| 108 |
|
procedure menu_txmpreplaceClick(Sender: TObject); |
| 109 |
|
procedure menu_previewClick(Sender: TObject); |
| 110 |
|
procedure menu_metaClick(Sender: TObject); |
| 110 |
– |
function open_child(window_context: String; connection, fileid: Integer): TForm_ToolTemplate; |
| 111 |
|
|
| 112 |
|
procedure menu_windows_cascadeClick(Sender: TObject); |
| 113 |
|
procedure menu_windows_tilevertClick(Sender: TObject); |
| 126 |
|
procedure WMCopyData(var Msg: TWMCopyData); message WM_COPYDATA; |
| 127 |
|
private |
| 128 |
|
public |
| 129 |
+ |
function open_child(window_context: String; Connection, FileID: Integer): TForm_BaseTemplate; overload; |
| 130 |
+ |
function open_child(window_context: String; Connection: Integer): TForm_BaseTemplate; overload; |
| 131 |
+ |
function open_child(window_context: String): TForm_BaseTemplate; overload; |
| 132 |
|
procedure DefaultHandler(var Message); override; |
| 133 |
|
end; |
| 134 |
|
|
| 170 |
|
function TForm_Main.CheckConnectionCloseable(index: Integer): Boolean; |
| 171 |
|
var |
| 172 |
|
i: Integer; |
| 173 |
< |
toolform: TForm_ToolTemplate; |
| 173 |
> |
toolform: TForm_BaseTemplate; |
| 174 |
|
begin |
| 175 |
|
Result := True; |
| 176 |
|
if MDITab.MDIChildCount > 0 then |
| 177 |
|
begin |
| 178 |
|
for i := 0 to MDITab.MDIChildCount - 1 do |
| 179 |
|
begin |
| 180 |
< |
if MDITab.MDIChildren[i] is TForm_ToolTemplate then |
| 180 |
> |
if MDITab.MDIChildren[i] is TForm_BaseTemplate then |
| 181 |
|
begin |
| 182 |
< |
toolform := TForm_ToolTemplate(MDITab.MDIChildren[i]); |
| 182 |
> |
toolform := TForm_BaseTemplate(MDITab.MDIChildren[i]); |
| 183 |
|
if toolform.ConnectionID = ConManager.ConnectionByIndex[index].ConnectionID then |
| 184 |
|
begin |
| 185 |
|
if not toolform.Closeable then |
| 325 |
|
pt: TPoint; |
| 326 |
|
tabIndex: Integer; |
| 327 |
|
hint: String; |
| 328 |
< |
tool: TForm_ToolTemplate; |
| 328 |
> |
tool: TForm_BaseTemplate; |
| 329 |
|
begin |
| 330 |
|
pt.X := X; |
| 331 |
|
pt.Y := Y; |
| 334 |
|
|
| 335 |
|
if tabIndex >= 0 then |
| 336 |
|
begin |
| 337 |
< |
if MDITab.MDIChildren[tabIndex] is TForm_ToolTemplate then |
| 337 |
> |
if MDITab.MDIChildren[tabIndex] is TForm_BaseTemplate then |
| 338 |
|
begin |
| 339 |
< |
tool := TForm_ToolTemplate(MDITab.MDIChildren[tabIndex]); |
| 339 |
> |
tool := TForm_BaseTemplate(MDITab.MDIChildren[tabIndex]); |
| 340 |
|
if tool.ConnectionID > -1 then |
| 341 |
|
hint := 'Connection: ' + |
| 342 |
< |
ExtractFileName(ConManager.Connection[tool.ConnectionID].FileName) + #13+#10 |
| 342 |
> |
ExtractFileName(ConManager.Connection[tool.ConnectionID].FileName) |
| 343 |
|
else |
| 344 |
< |
hint := 'Connection: none' + #13+#10; |
| 345 |
< |
if tool.SelectedFile.ID > -1 then |
| 346 |
< |
hint := hint + 'Selected File: ' + |
| 347 |
< |
FormatNumber(tool.SelectedFile.ID, 5, '0') + '-' + |
| 348 |
< |
tool.SelectedFile.Name + '.' + |
| 349 |
< |
tool.SelectedFile.Extension |
| 350 |
< |
else |
| 351 |
< |
hint := hint + 'Selected File: none'; |
| 344 |
> |
hint := 'Connection: none'; |
| 345 |
> |
if tool is TForm_TemplateFile then |
| 346 |
> |
begin |
| 347 |
> |
if TForm_TemplateFile(tool).SelectedFile.ID > -1 then |
| 348 |
> |
hint := hint + #13+#10 + 'Selected File: ' + |
| 349 |
> |
FormatNumber(TForm_TemplateFile(tool).SelectedFile.ID, 5, '0') + '-' + |
| 350 |
> |
TForm_TemplateFile(tool).SelectedFile.Name + '.' + |
| 351 |
> |
TForm_TemplateFile(tool).SelectedFile.Extension |
| 352 |
> |
else |
| 353 |
> |
hint := hint + #13+#10 + 'Selected File: none'; |
| 354 |
> |
end; |
| 355 |
|
end |
| 356 |
|
else |
| 357 |
|
hint := 'Window: ' + MDITab.MDIChildren[tabIndex].Caption; |
| 486 |
|
begin |
| 487 |
|
if MDITab.MDIChildCount > 0 then |
| 488 |
|
for i := 0 to MDITab.MDIChildCount - 1 do |
| 489 |
< |
if MDITab.MDIChildren[i] is TForm_ToolTemplate then |
| 490 |
< |
TForm_ToolTemplate(MDITab.MDIChildren[i]).UpdateConList; |
| 489 |
> |
if MDITab.MDIChildren[i] is TForm_BaseTemplate then |
| 490 |
> |
TForm_BaseTemplate(MDITab.MDIChildren[i]).UpdateConList; |
| 491 |
|
|
| 492 |
|
menu_conns.Clear; |
| 493 |
|
if ConManager.Count > 0 then |
| 558 |
|
{####################################} |
| 559 |
|
procedure TForm_Main.menu_createdbClick(Sender: TObject); |
| 560 |
|
begin |
| 555 |
– |
// ShowMessage('Not yet usable'); |
| 556 |
– |
|
| 561 |
|
opend.Filter := 'Oni-Dat-Files|*.dat'; |
| 562 |
|
saved.Filter := 'OUP-Level-DB (*.oldb)|*.oldb'; |
| 563 |
|
saved.DefaultExt := 'oldb'; |
| 569 |
|
|
| 570 |
|
procedure TForm_Main.menu_createlvlClick(Sender: TObject); |
| 571 |
|
begin |
| 568 |
– |
// ShowMessage('Not yet usable'); |
| 569 |
– |
|
| 572 |
|
opend.Filter := 'OUP-Level-DB (*.oldb)|*.oldb'; |
| 573 |
|
saved.Filter := 'Oni-Dat-Files|*.dat'; |
| 574 |
|
saved.DefaultExt := 'dat'; |
| 583 |
|
{#################################} |
| 584 |
|
procedure TForm_Main.menu_previewClick(Sender: TObject); |
| 585 |
|
begin |
| 586 |
< |
open_child('preview', -1, -1); |
| 586 |
> |
open_child('preview'); |
| 587 |
|
end; |
| 588 |
|
|
| 589 |
|
procedure TForm_Main.menu_bineditClick(Sender: TObject); |
| 590 |
|
begin |
| 591 |
< |
open_child('binedit', -1, -1); |
| 591 |
> |
open_child('binedit'); |
| 592 |
|
end; |
| 593 |
|
|
| 594 |
|
procedure TForm_Main.menu_raweditClick(Sender: TObject); |
| 595 |
|
begin |
| 596 |
< |
open_child('rawedit', -1, -1); |
| 596 |
> |
open_child('rawedit'); |
| 597 |
|
end; |
| 598 |
|
|
| 599 |
|
procedure TForm_Main.menu_txmpreplaceClick(Sender: TObject); |
| 600 |
|
begin |
| 601 |
< |
open_child('txmpreplace', -1, -1); |
| 601 |
> |
open_child('txmpreplace'); |
| 602 |
|
end; |
| 603 |
|
|
| 604 |
|
procedure TForm_Main.menu_extractorClick(Sender: TObject); |
| 605 |
|
begin |
| 606 |
< |
open_child('extractor', -1, -1); |
| 606 |
> |
open_child('extractor'); |
| 607 |
|
end; |
| 608 |
|
|
| 609 |
|
procedure TForm_Main.menu_metaClick(Sender: TObject); |
| 608 |
– |
var |
| 609 |
– |
toolform: TForm_Meta; |
| 610 |
– |
i: Integer; |
| 611 |
– |
tag: Integer; |
| 612 |
– |
iconindex: Integer; |
| 610 |
|
begin |
| 611 |
< |
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; |
| 611 |
> |
open_child('meta'); |
| 612 |
|
end; |
| 613 |
|
|
| 614 |
|
procedure TForm_Main.menu_filecompareClick(Sender: TObject); |
| 615 |
|
begin |
| 616 |
< |
open_child('compare', -1, -1); |
| 616 |
> |
open_child('compare'); |
| 617 |
|
end; |
| 618 |
|
|
| 619 |
|
|
| 682 |
|
index: Integer; |
| 683 |
|
RepMsg: TStatusMessages; |
| 684 |
|
begin |
| 708 |
– |
// name := TTBItem(Sender).Caption; |
| 685 |
|
index := TTBItem(Sender).Parent.IndexOf(TTBItem(Sender)); |
| 686 |
|
name := ExtractFileName(ConManager.ConnectionByIndex[index].FileName); |
| 687 |
|
if MessageBox(Handle, PChar('Do you really want to close data-connection to' +#13+#10+ |
| 728 |
|
|
| 729 |
|
|
| 730 |
|
|
| 731 |
< |
function TForm_Main.open_child(window_context: String; connection, fileid: Integer): TForm_ToolTemplate; |
| 731 |
> |
function TForm_Main.open_child(window_context: String; connection, fileid: Integer): TForm_BaseTemplate; |
| 732 |
|
type |
| 733 |
< |
TTemplate = class of TForm_ToolTemplate; |
| 733 |
> |
TTemplate = class of TForm_BaseTemplate; |
| 734 |
|
TTool = record |
| 735 |
|
name: String; |
| 736 |
|
icon: Integer; |
| 743 |
|
(name: 'extractor'; icon: 8; caption: 'Extractor'; classt: TForm_Extractor), |
| 744 |
|
(name: 'preview'; icon: 4; caption: 'Preview-Window'; classt: TForm_Preview), |
| 745 |
|
(name: 'rawedit'; icon: 6; caption: 'Binary .raw-Editor'; classt: TForm_RawEdit), |
| 746 |
< |
(name: 'txmpreplace'; icon: 7; caption: 'TXMP Replacer'; classt: TForm_TxmpReplace) |
| 746 |
> |
// (name: 'txmpreplace'; icon: 7; caption: 'TXMP Replacer'; classt: TForm_TxmpReplace), |
| 747 |
> |
(name: 'meta'; icon: 11; caption: 'MetaEditor'; classt: TForm_Meta) |
| 748 |
|
); |
| 749 |
|
var |
| 750 |
< |
toolform: TForm_ToolTemplate; |
| 750 |
> |
toolform: TForm_BaseTemplate; |
| 751 |
|
i: Integer; |
| 752 |
|
tag: Integer; |
| 753 |
|
iconindex: Integer; |
| 782 |
|
toolform.Tag := tag; |
| 783 |
|
MDITab.AddTab(TForm(toolform), iconindex); |
| 784 |
|
toolform.Caption := AnsiReplaceStr(toolform.Caption, ' ', ''); |
| 785 |
< |
if connection > -1 then |
| 785 |
> |
if Connection > -1 then |
| 786 |
|
begin |
| 787 |
|
toolform.SelectConnection(connection); |
| 788 |
< |
if fileid > -1 then |
| 789 |
< |
toolform.SelectFileID(connection, fileid); |
| 788 |
> |
if (FileID > -1) and (toolform is TForm_TemplateFile) then |
| 789 |
> |
TForm_TemplateFile(toolform).SelectFileID(Connection, FileID); |
| 790 |
|
end; |
| 791 |
|
Result := toolform; |
| 792 |
|
end; |
| 793 |
|
end; |
| 794 |
|
|
| 795 |
+ |
function TForm_Main.open_child(window_context: String; Connection: Integer): TForm_BaseTemplate; |
| 796 |
+ |
begin |
| 797 |
+ |
open_child(window_context, Connection, -1); |
| 798 |
+ |
end; |
| 799 |
+ |
|
| 800 |
+ |
function TForm_Main.open_child(window_context: String): TForm_BaseTemplate; |
| 801 |
+ |
begin |
| 802 |
+ |
open_child(window_context, -1, -1); |
| 803 |
+ |
end; |
| 804 |
+ |
|
| 805 |
|
end. |