Changeset 45 for oup/current/Main.pas


Ignore:
Timestamp:
Dec 23, 2006, 1:03:50 AM (16 years ago)
Author:
alloc
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • oup/current/Main.pas

    r43 r45  
    77  Dialogs, StdCtrls, StrUtils, Clipbrd, ExtCtrls, ComCtrls, Menus, Grids,
    88  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;
    1313
    1414type
     
    7777    procedure menu_windows_nextClick(Sender: TObject);
    7878    procedure menu_windows_tileClick(Sender: TObject);
    79     function open_child(window_context: String): Boolean;
     79    function open_child(window_context: String; fileid: Integer): Boolean;
    8080    procedure menu_windows_closeallClick(Sender: TObject);
    8181    procedure menu_windows_cascadeClick(Sender: TObject);
     
    305305      ext := ExtractFileExt(opend.FileName);
    306306      if ext = '.dat' then
     307      begin
    307308        if not CreateDataConnection(opend.FileName, ODB_Dat) then
    308309          ShowMessage('Error while loading the file:' + CrLf + opend.FileName +
    309             CrLf + 'Perhaps not an Oni-.dat-file?')
    310       else if ext = '.oldb' then
     310            CrLf + 'Perhaps not an Oni-.dat-file?');
     311      end else if ext = '.oldb' then
     312      begin
    311313        if not CreateDataConnection(opend.FileName, ODB_ADB) then
    312314          ShowMessage('Error while loading the file:' + CrLf + opend.FileName +
    313             CrLf + 'Perhaps not an OniUnPacker-LevelDatabase-file?')
    314       else
     315            CrLf + 'Perhaps not an OniUnPacker-LevelDatabase-file?');
     316      end else
    315317        ShowMessage('Incompatible file');
    316318      AppSettings.DatPath := ExtractFilepath(opend.FileName);
     
    394396procedure TForm_Main.menu_previewClick(Sender: TObject);
    395397begin
    396   open_child('preview');
     398  open_child('preview', -1);
    397399end;
    398400
     
    400402procedure TForm_Main.menu_txmpreplaceClick(Sender: TObject);
    401403begin
    402   open_child('txmpreplace');
     404  open_child('txmpreplace', -1);
    403405end;
    404406
     
    406408procedure TForm_Main.menu_bineditClick(Sender: TObject);
    407409begin
    408   open_child('binedit');
     410  open_child('binedit', -1);
    409411end;
    410412
     
    412414procedure TForm_Main.menu_raweditClick(Sender: TObject);
    413415begin
    414   open_child('rawedit');
     416  open_child('rawedit', -1);
    415417end;
    416418
     
    418420procedure TForm_Main.menu_extractorClick(Sender: TObject);
    419421begin
    420   open_child('extractor');
     422  open_child('extractor', -1);
    421423end;
    422424
     
    424426procedure TForm_Main.menu_filecompareClick(Sender: TObject);
    425427begin
    426   open_child('compare');
     428  open_child('compare', -1);
    427429end;
    428430
     
    515517
    516518
    517 function TForm_Main.open_child(window_context: String): Boolean;
     519function TForm_Main.open_child(window_context: String; fileid: Integer): Boolean;
    518520var
    519   form:    TCustomForm;
     521  toolform: TForm_ToolTemplate;
    520522  i:       Integer;
    521523  tag:     Integer;
     
    534536  if window_context = 'binedit' then
    535537  begin
    536     form      := TForm_BinEdit.Create(Application);
    537     TForm_BinEdit(form).Recreatelist;
    538     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 = 'extractor' then
     543  begin
     544    toolform         := TForm_Extractor.Create(Self);
     545    toolform.Caption := 'Extractor ' + IntToStr(tag);
     546  end;
     547  if window_context = 'preview' then
     548  begin
     549    toolform         := TForm_Preview.Create(Self);
     550    toolform.Caption := 'Preview-Window ' + IntToStr(tag);
    540551  end;
    541552  if window_context = 'rawedit' then
    542553  begin
    543     form      := TForm_RawEdit.Create(Application);
    544     TForm_RawEdit(form).Recreatelist;
    545     form.Caption := 'Binary .raw-Editor ' + 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);
     554    toolform         := TForm_RawEdit.Create(Self);
     555    toolform.Caption := 'Binary .raw-Editor ' + IntToStr(tag);
    552556  end;
    553557  if window_context = 'txmpreplace' then
    554558  begin
    555     form      := TForm_TxmpReplace.Create(Application);
    556     TForm_TxmpReplace(form).Recreatelist;
    557     form.Caption := 'TXMP Replacer ' + IntToStr(tag);
    558   end;
    559   if window_context = 'extractor' then
    560   begin
    561     form      := TForm_Extractor.Create(Application);
    562     TForm_Extractor(form).Recreatelist;
    563     form.Caption := 'Extractor ' + IntToStr(tag);
    564   end;
    565 
    566   form.Name := window_context + IntToStr(tag);
    567   form.Tag  := tag;
    568 
    569   MDITab.AddTab(TForm(form), iconindex);
     559    toolform         := TForm_TxmpReplace.Create(Application);
     560    toolform.Caption := 'TXMP Replacer ' + IntToStr(tag);
     561  end;
     562
     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;
    570571end;
    571572
Note: See TracChangeset for help on using the changeset viewer.