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

Comparing:
oup/rewrite/Main.pas (file contents), Revision 97 by alloc, Mon Jan 22 23:05:45 2007 UTC vs.
oup/current/Main.pas (file contents), Revision 139 by alloc, Fri Mar 30 00:51:58 2007 UTC

# Line 10 | Line 10 | uses
10    Functions,
11    Settings, {Helper_LevelDB, }
12    Template,
13 <  Preview;
14 < //  BinEdit, Extractor, RawEdit, TxmpReplace;
13 >  RawEdit, BinEdit, Extractor, Preview, TxmpReplace;
14  
15   type
16    TForm_Main = class(TForm)
# Line 138 | Line 137 | var
137  
138   implementation
139  
140 + uses
141 +  LevelDB;
142 +
143   {$R *.dfm}
144  
145  
# Line 161 | Line 163 | begin
163    if RepMsg = SM_OK then
164    begin
165      UpdateStatBar;
166 +    UpdateConLists;
167    end;
168   end;
169  
# Line 169 | Line 172 | var
172    i: Integer;
173    toolform: TForm_ToolTemplate;
174   begin
175 +  Result := True;
176    if MDITab.MDIChildCount > 0 then
177    begin
178      for i := 0 to MDITab.MDIChildCount - 1 do
# Line 179 | Line 183 | begin
183          if toolform.ConnectionID = ConManager.ConnectionByIndex[index].ConnectionID then
184          begin
185            if not toolform.Closeable then
186 <            ShowMessage('Can not close toolwindow: ' + toolform.Caption);
186 >          begin
187 >            ShowMessage('Can not close toolwindow: ' + toolform.Caption);
188 >            Result := False;
189 >          end;
190          end;
191        end;
192      end;
# Line 234 | Line 241 | end;
241  
242  
243   procedure TForm_Main.FormCreate(Sender: TObject);
237 var
238  RepMsg: TStatusMessages;
244   begin
245    Self.Caption := 'Oni Un/Packer ' + version;
246    Self.FormResize(Self);
# Line 254 | Line 259 | begin
259    begin
260      AppSettings.DatPath        := ExtractFilepath(Application.EXEname);
261      AppSettings.ExtractPath    := ExtractFilepath(Application.EXEname) + '\extract';
257    AppSettings.FilenumbersAsHex := False;
262      AppSettings.CharSet        := DEFAULT_CHARSET;
263      AppSettings.HideUnusedData := False;
264    end;
# Line 441 | Line 445 | var
445    position: TTBDockPosition;
446    mode: TTBItemDisplayMode;
447    i: Integer;
444  isEnabled: Boolean;
448   begin
449    toolbar := TTBToolbar(Sender);
450    if toolbar.Floating then
# Line 496 | Line 499 | end;
499  
500   procedure TForm_Main.LoadFile(typedb: Boolean);
501   var
502 <  ext: String;
502 >  i: Integer;
503   begin
504    opend.InitialDir := AppSettings.DatPath;
505    opend.Filter     := 'Compatible level files|*.dat;*.oldb|Oni level (*.dat)|*.dat|OUP level database (*.oldb)|*.oldb|Any (*.*)|*';
# Line 506 | Line 509 | begin
509      opend.FilterIndex := 2;
510    if opend.Execute then
511    begin
512 <    ext := ExtractFileExt(opend.FileName);
513 <    if ext = '.dat' then
514 <    begin
512 <      CreateConnection(opend.FileName);
513 <    end else if ext = '.oldb' then
514 <    begin
515 <      CreateConnection(opend.FileName);
516 <    end else
517 <      ShowMessage('Incompatible file');
512 >    if opend.Files.Count > 0 then
513 >      for i := 0 to opend.Files.Count - 1 do
514 >        CreateConnection(opend.Files.Strings[i]);
515      AppSettings.DatPath := ExtractFilepath(opend.FileName);
516    end;
517    UpdateStatBar;
# Line 553 | 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);
564 }
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);
578 }
574   end;
575  
576  
# Line 680 | Line 675 | end;
675   procedure TForm_Main.menu_conns_itemClick(Sender: TObject);
676   var
677    name: String;
683  i: Integer;
678    index: Integer;
679    RepMsg: TStatusMessages;
680   begin
# Line 692 | Line 686 | begin
686    begin
687      CheckConnectionCloseable(index);
688      ConManager.CloseConnectionByIndex(index, RepMsg);
689 +    ShowOpenMsg(RepMsg);
690 +    UpdateConLists;
691    end;
692    UpdateStatBar;
693   end;
# Line 748 | Line 744 | begin
744    iconindex := -1;
745    caption_end := IntToStr(tag) + '       ';
746  
747 +  toolform := nil;
748 +
749    if window_context = 'binedit' then
750    begin
751 < //    toolform         := TForm_BinEdit.Create(Self);
751 >    toolform         := TForm_BinEdit.Create(Self);
752      toolform.Caption := 'Binary .dat-Editor ' + caption_end;
753      iconindex        := 5;
754    end;
755    if window_context = 'extractor' then
756    begin
757 < //    toolform         := TForm_Extractor.Create(Self);
757 >    toolform         := TForm_Extractor.Create(Self);
758      toolform.Caption := 'Extractor ' + caption_end;
759      iconindex        := 8;
760    end;
# Line 768 | Line 766 | begin
766    end;
767    if window_context = 'rawedit' then
768    begin
769 < //    toolform         := TForm_RawEdit.Create(Self);
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(Application);
775 >    toolform         := TForm_TxmpReplace.Create(Self);
776      toolform.Caption := 'TXMP Replacer ' + caption_end;
777      iconindex        := 7;
778    end;

Diff Legend

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