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 129 by alloc, Wed Mar 28 01:12:22 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 567 | Line 564 | end;
564  
565   procedure TForm_Main.menu_createlvlClick(Sender: TObject);
566   begin
567 <  ShowMessage('Not yet usable');
568 < {
567 > //  ShowMessage('Not yet usable');
568 >
569    opend.Filter     := 'OUP-Level-DB (*.oldb)|*.oldb';
570    saved.Filter     := 'Oni-Dat-Files|*.dat';
571    saved.DefaultExt := 'dat';
572    if opend.Execute then
573      if saved.Execute then
574        Form_LevelDB.CreateLevel(opend.FileName, saved.FileName);
575 < }
575 >
576   end;
577  
578  
# Line 680 | Line 677 | end;
677   procedure TForm_Main.menu_conns_itemClick(Sender: TObject);
678   var
679    name: String;
683  i: Integer;
680    index: Integer;
681    RepMsg: TStatusMessages;
682   begin
# Line 692 | Line 688 | begin
688    begin
689      CheckConnectionCloseable(index);
690      ConManager.CloseConnectionByIndex(index, RepMsg);
691 +    ShowOpenMsg(RepMsg);
692 +    UpdateConLists;
693    end;
694    UpdateStatBar;
695   end;
# Line 748 | Line 746 | begin
746    iconindex := -1;
747    caption_end := IntToStr(tag) + '       ';
748  
749 +  toolform := nil;
750 +
751    if window_context = 'binedit' then
752    begin
753 < //    toolform         := TForm_BinEdit.Create(Self);
753 >    toolform         := TForm_BinEdit.Create(Self);
754      toolform.Caption := 'Binary .dat-Editor ' + caption_end;
755      iconindex        := 5;
756    end;
757    if window_context = 'extractor' then
758    begin
759 < //    toolform         := TForm_Extractor.Create(Self);
759 >    toolform         := TForm_Extractor.Create(Self);
760      toolform.Caption := 'Extractor ' + caption_end;
761      iconindex        := 8;
762    end;
# Line 768 | Line 768 | begin
768    end;
769    if window_context = 'rawedit' then
770    begin
771 < //    toolform         := TForm_RawEdit.Create(Self);
771 >    toolform         := TForm_RawEdit.Create(Self);
772      toolform.Caption := 'Binary .raw-Editor ' + caption_end;
773      iconindex        := 6;
774    end;
775    if window_context = 'txmpreplace' then
776    begin
777 < //    toolform         := TForm_TxmpReplace.Create(Application);
777 >    toolform         := TForm_TxmpReplace.Create(Self);
778      toolform.Caption := 'TXMP Replacer ' + caption_end;
779      iconindex        := 7;
780    end;

Diff Legend

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