ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/oup/_old_/Main.pas
(Generate patch)

Comparing oup/current/Main.pas (file contents):
Revision 43 by alloc, Mon Dec 18 23:35:30 2006 UTC vs.
Revision 45 by alloc, Sat Dec 23 00:03:50 2006 UTC

# Line 6 | Line 6 | uses
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 >  Code_Functions, Data, Code_DataStructures, Code_OniDataClass,
11 >  Helper_LevelDB, Code_Exporters, Settings, Tool_Template,
12 >  Tool_BinEdit, Tool_Extractor, Tool_Preview, Tool_RawEdit, Tool_TxmpReplace;
13  
14   type
15    TForm_Main = class(TForm)
# Line 76 | Line 76 | type
76      procedure menu_windows_previousClick(Sender: TObject);
77      procedure menu_windows_nextClick(Sender: TObject);
78      procedure menu_windows_tileClick(Sender: TObject);
79 <    function open_child(window_context: String): Boolean;
79 >    function open_child(window_context: String; fileid: Integer): Boolean;
80      procedure menu_windows_closeallClick(Sender: TObject);
81      procedure menu_windows_cascadeClick(Sender: TObject);
82      procedure menu_bineditClick(Sender: TObject);
# Line 304 | Line 304 | begin
304      begin
305        ext := ExtractFileExt(opend.FileName);
306        if ext = '.dat' then
307 +      begin
308          if not CreateDataConnection(opend.FileName, ODB_Dat) then
309            ShowMessage('Error while loading the file:' + CrLf + opend.FileName +
310 <            CrLf + 'Perhaps not an Oni-.dat-file?')
311 <      else if ext = '.oldb' then
310 >            CrLf + 'Perhaps not an Oni-.dat-file?');
311 >      end else if ext = '.oldb' then
312 >      begin
313          if not CreateDataConnection(opend.FileName, ODB_ADB) then
314            ShowMessage('Error while loading the file:' + CrLf + opend.FileName +
315 <            CrLf + 'Perhaps not an OniUnPacker-LevelDatabase-file?')
316 <      else
315 >            CrLf + 'Perhaps not an OniUnPacker-LevelDatabase-file?');
316 >      end else
317          ShowMessage('Incompatible file');
318        AppSettings.DatPath := ExtractFilepath(opend.FileName);
319      end;
# Line 393 | Line 395 | end;
395   {#################################}
396   procedure TForm_Main.menu_previewClick(Sender: TObject);
397   begin
398 <  open_child('preview');
398 >  open_child('preview', -1);
399   end;
400  
401  
402   procedure TForm_Main.menu_txmpreplaceClick(Sender: TObject);
403   begin
404 <  open_child('txmpreplace');
404 >  open_child('txmpreplace', -1);
405   end;
406  
407  
408   procedure TForm_Main.menu_bineditClick(Sender: TObject);
409   begin
410 <  open_child('binedit');
410 >  open_child('binedit', -1);
411   end;
412  
413  
414   procedure TForm_Main.menu_raweditClick(Sender: TObject);
415   begin
416 <  open_child('rawedit');
416 >  open_child('rawedit', -1);
417   end;
418  
419  
420   procedure TForm_Main.menu_extractorClick(Sender: TObject);
421   begin
422 <  open_child('extractor');
422 >  open_child('extractor', -1);
423   end;
424  
425  
426   procedure TForm_Main.menu_filecompareClick(Sender: TObject);
427   begin
428 <  open_child('compare');
428 >  open_child('compare', -1);
429   end;
430  
431  
# Line 514 | Line 516 | end;
516  
517  
518  
519 < function TForm_Main.open_child(window_context: String): Boolean;
519 > function TForm_Main.open_child(window_context: String; fileid: Integer): Boolean;
520   var
521 <  form:    TCustomForm;
521 >  toolform: TForm_ToolTemplate;
522    i:       Integer;
523    tag:     Integer;
524    iconindex: Integer;
# Line 533 | Line 535 | begin
535  
536    if window_context = 'binedit' then
537    begin
538 <    form      := TForm_BinEdit.Create(Application);
539 <    TForm_BinEdit(form).Recreatelist;
540 <    form.Caption := 'Binary .dat-Editor ' + IntToStr(tag);
539 <    iconindex := 0;
538 >    toolform         := TForm_BinEdit.Create(Self);
539 >    toolform.Caption := 'Binary .dat-Editor ' + IntToStr(tag);
540 >    iconindex        := 0;
541    end;
542 <  if window_context = 'rawedit' then
542 >  if window_context = 'extractor' then
543    begin
544 <    form      := TForm_RawEdit.Create(Application);
545 <    TForm_RawEdit(form).Recreatelist;
545 <    form.Caption := 'Binary .raw-Editor ' + IntToStr(tag);
544 >    toolform         := TForm_Extractor.Create(Self);
545 >    toolform.Caption := 'Extractor ' + IntToStr(tag);
546    end;
547    if window_context = 'preview' then
548    begin
549 <    form      := TForm_Preview.Create(Application);
550 <    TForm_Preview(form).Recreatelist;
551 <    form.Caption := 'Preview-Window ' + IntToStr(tag);
549 >    toolform         := TForm_Preview.Create(Self);
550 >    toolform.Caption := 'Preview-Window ' + IntToStr(tag);
551    end;
552 <  if window_context = 'txmpreplace' then
552 >  if window_context = 'rawedit' then
553    begin
554 <    form      := TForm_TxmpReplace.Create(Application);
555 <    TForm_TxmpReplace(form).Recreatelist;
557 <    form.Caption := 'TXMP Replacer ' + IntToStr(tag);
554 >    toolform         := TForm_RawEdit.Create(Self);
555 >    toolform.Caption := 'Binary .raw-Editor ' + IntToStr(tag);
556    end;
557 <  if window_context = 'extractor' then
557 >  if window_context = 'txmpreplace' then
558    begin
559 <    form      := TForm_Extractor.Create(Application);
560 <    TForm_Extractor(form).Recreatelist;
563 <    form.Caption := 'Extractor ' + IntToStr(tag);
559 >    toolform         := TForm_TxmpReplace.Create(Application);
560 >    toolform.Caption := 'TXMP Replacer ' + IntToStr(tag);
561    end;
562  
563 <  form.Name := window_context + IntToStr(tag);
564 <  form.Tag  := tag;
565 <
566 <  MDITab.AddTab(TForm(form), iconindex);
563 >  if Assigned(toolform) then
564 >  begin
565 >    toolform.Name    := window_context + IntToStr(tag);
566 >    toolform.Tag     := tag;
567 >    MDITab.AddTab(TForm(toolform), iconindex);
568 >    if fileid > -1 then
569 >      toolform.SelectFileID(fileid);
570 >  end;
571   end;
572  
573   end.

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)