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 113 by alloc, Sun Feb 25 17:20:22 2007 UTC vs.
Revision 172 by alloc, Sun Apr 8 23:52:14 2007 UTC

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

Diff Legend

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