--- oup/rewrite/Main.pas 2007/01/22 23:05:45 97 +++ oup/current/Main.pas 2007/02/25 17:20:22 113 @@ -10,8 +10,7 @@ uses Functions, Settings, {Helper_LevelDB, } Template, - Preview; -// BinEdit, Extractor, RawEdit, TxmpReplace; + RawEdit, BinEdit, Extractor, Preview, TxmpReplace; type TForm_Main = class(TForm) @@ -161,6 +160,7 @@ begin if RepMsg = SM_OK then begin UpdateStatBar; + UpdateConLists; end; end; @@ -169,6 +169,7 @@ var i: Integer; toolform: TForm_ToolTemplate; begin + Result := True; if MDITab.MDIChildCount > 0 then begin for i := 0 to MDITab.MDIChildCount - 1 do @@ -179,7 +180,10 @@ begin if toolform.ConnectionID = ConManager.ConnectionByIndex[index].ConnectionID then begin if not toolform.Closeable then - ShowMessage('Can not close toolwindow: ' + toolform.Caption); + begin + ShowMessage('Can not close toolwindow: ' + toolform.Caption); + Result := False; + end; end; end; end; @@ -234,8 +238,6 @@ end; procedure TForm_Main.FormCreate(Sender: TObject); -var - RepMsg: TStatusMessages; begin Self.Caption := 'Oni Un/Packer ' + version; Self.FormResize(Self); @@ -254,7 +256,6 @@ begin begin AppSettings.DatPath := ExtractFilepath(Application.EXEname); AppSettings.ExtractPath := ExtractFilepath(Application.EXEname) + '\extract'; - AppSettings.FilenumbersAsHex := False; AppSettings.CharSet := DEFAULT_CHARSET; AppSettings.HideUnusedData := False; end; @@ -441,7 +442,6 @@ var position: TTBDockPosition; mode: TTBItemDisplayMode; i: Integer; - isEnabled: Boolean; begin toolbar := TTBToolbar(Sender); if toolbar.Floating then @@ -496,7 +496,7 @@ end; procedure TForm_Main.LoadFile(typedb: Boolean); var - ext: String; + i: Integer; begin opend.InitialDir := AppSettings.DatPath; opend.Filter := 'Compatible level files|*.dat;*.oldb|Oni level (*.dat)|*.dat|OUP level database (*.oldb)|*.oldb|Any (*.*)|*'; @@ -506,15 +506,9 @@ begin opend.FilterIndex := 2; if opend.Execute then begin - ext := ExtractFileExt(opend.FileName); - if ext = '.dat' then - begin - CreateConnection(opend.FileName); - end else if ext = '.oldb' then - begin - CreateConnection(opend.FileName); - end else - ShowMessage('Incompatible file'); + if opend.Files.Count > 0 then + for i := 0 to opend.Files.Count - 1 do + CreateConnection(opend.Files.Strings[i]); AppSettings.DatPath := ExtractFilepath(opend.FileName); end; UpdateStatBar; @@ -680,7 +674,6 @@ end; procedure TForm_Main.menu_conns_itemClick(Sender: TObject); var name: String; - i: Integer; index: Integer; RepMsg: TStatusMessages; begin @@ -692,6 +685,8 @@ begin begin CheckConnectionCloseable(index); ConManager.CloseConnectionByIndex(index, RepMsg); + ShowOpenMsg(RepMsg); + UpdateConLists; end; UpdateStatBar; end; @@ -748,15 +743,17 @@ begin iconindex := -1; caption_end := IntToStr(tag) + ' '; + toolform := nil; + if window_context = 'binedit' then begin -// toolform := TForm_BinEdit.Create(Self); + toolform := TForm_BinEdit.Create(Self); toolform.Caption := 'Binary .dat-Editor ' + caption_end; iconindex := 5; end; if window_context = 'extractor' then begin -// toolform := TForm_Extractor.Create(Self); + toolform := TForm_Extractor.Create(Self); toolform.Caption := 'Extractor ' + caption_end; iconindex := 8; end; @@ -768,13 +765,13 @@ begin end; if window_context = 'rawedit' then begin -// toolform := TForm_RawEdit.Create(Self); + toolform := TForm_RawEdit.Create(Self); toolform.Caption := 'Binary .raw-Editor ' + caption_end; iconindex := 6; end; if window_context = 'txmpreplace' then begin -// toolform := TForm_TxmpReplace.Create(Application); + toolform := TForm_TxmpReplace.Create(Self); toolform.Caption := 'TXMP Replacer ' + caption_end; iconindex := 7; end;