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

Comparing oup/current/Main.pas (file contents):
Revision 139 by alloc, Fri Mar 30 00:51:58 2007 UTC vs.
Revision 197 by alloc, Sat May 26 18:42:15 2007 UTC

# Line 6 | Line 6 | uses
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
# Line 257 | Line 254 | begin
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;
# Line 726 | Line 727 | end;
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;
733  caption_end: String;
750    iconindex:   Integer;
751   begin
752    Result := nil;
# Line 742 | Line 758 | begin
758          tag := MDIChildren[i].Tag + 1;
759  
760    iconindex := -1;
745  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;
759 <    iconindex        := 8;
760 <  end;
761 <  if window_context = 'preview' then
762 <  begin
763 <    toolform         := TForm_Preview.Create(Self);
764 <    toolform.Caption := 'Preview-Window ' + caption_end;
765 <    iconindex        := 4;
766 <  end;
767 <  if window_context = 'rawedit' then
768 <  begin
769 <    toolform         := TForm_RawEdit.Create(Self);
770 <    toolform.Caption := 'Binary .raw-Editor ' + caption_end;
771 <    iconindex        := 6;
772 <  end;
773 <  if window_context = 'txmpreplace' then
774 <  begin
775 <    toolform         := TForm_TxmpReplace.Create(Self);
776 <    toolform.Caption := 'TXMP Replacer ' + caption_end;
777 <    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

Diff Legend

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