Changeset 86 for oup/current/Main.pas
- Timestamp:
- Jan 14, 2007, 9:19:08 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
oup/current/Main.pas
r84 r86 75 75 tb_opendb: TTBItem; 76 76 Images_Close: TImageList; 77 procedure UpdateConLists; 77 78 procedure LoadFile(typedb: Boolean); 78 79 function TryCloseAll: Boolean; … … 154 155 else if MidStr(ParamStr(1), 1, 4) = 'oldb' then 155 156 begin 156 if not CreateDataConnection(ParamStr(2), ODB_ADB)then157 if CreateDataConnection(ParamStr(2), ODB_ADB) = nil then 157 158 ShowMessage('Error while loading the file:' + CrLf + ParamStr( 158 159 2) + CrLf + 'Perhaps not an OniUnPacker-LevelDatabase-file?'); … … 160 161 else if MidStr(ParamStr(1), 1, 3) = 'dat' then 161 162 begin 162 if not CreateDataConnection(ParamStr(2), ODB_Dat)then163 if CreateDataConnection(ParamStr(2), ODB_Dat) = nil then 163 164 ShowMessage('Error while loading the file:' + CrLf + ParamStr( 164 165 2) + CrLf + 'Perhaps not an Oni-.dat-file?'); … … 263 264 pt.Y := Y; 264 265 tabIndex := MDITab.GetTabAtPos(pt); 265 if (Button = mbRight) and (tabIndex >= 0) then 266 MDITab.MDIChildren[tabIndex].Close; 266 267 // if (Button = mbRight) and (tabIndex >= 0) then 268 // MDITab.MDIChildren[tabIndex].Close; 267 269 268 270 if (Button = mbLeft) and (tabIndex >= 0) then … … 309 311 procedure TForm_Main.UpdateStatBar; 310 312 begin 311 if Assigned(OniDataConnection) then 312 begin 313 Self.Caption := 'Oni Un/Packer ' + version + ' (' + ExtractFileName( 314 OniDataConnection.FileName) + ')'; 313 if Length(DataConnections) > 0 then 314 begin 315 Self.Caption := 'Oni Un/Packer ' + version; 315 316 ActivateTools(True); 316 statbar.Panels.Items[1].Text := 'Files: ' + IntToStr(OniDataConnection.GetFilesCount); 317 statbar.Panels.Items[2].Text := 318 'Extensions: ' + IntToStr(Length(OniDataConnection.GetExtensionsList)); 319 case OniDataConnection.Backend of 320 ODB_Dat: 321 begin 322 statbar.Panels.Items[0].Text := '.dat loaded: ' + OniDataConnection.FileName; 323 end; 324 ODB_ADB: 325 begin 326 statbar.Panels.Items[0].Text := 'OLDB loaded: ' + OniDataConnection.FileName; 327 end; 328 else 329 Self.Caption := 'Oni Un/Packer ' + version; 330 statbar.Panels.Items[0].Text := 'Nothing loaded'; 331 statbar.Panels.Items[1].Text := 'Files: -'; 332 statbar.Panels.Items[2].Text := 'Extensions: -'; 333 ActivateTools(False); 334 end; 317 statbar.Panels.Items[1].Text := 'Connections: ' + IntToStr(Length(DataConnections)); 335 318 end 336 319 else … … 380 363 381 364 365 procedure TForm_Main.UpdateConLists; 366 var 367 i: Integer; 368 begin 369 for i := 0 to MDITab.MDIChildCount - 1 do 370 if MDITab.MDIChildren[i] is TForm_ToolTemplate then 371 TForm_ToolTemplate(MDITab.MDIChildren[i]).UpdateList; 372 end; 373 382 374 383 375 procedure TForm_Main.LoadFile(typedb: Boolean); … … 385 377 ext: String; 386 378 begin 387 if TryCloseAll then388 begin389 CloseDataConnection;390 opend. InitialDir := AppSettings.DatPath;391 opend.Filter := 'Compatible level files|*.dat;*.oldb|Oni level (*.dat)|*.dat|OUP level database (*.oldb)|*.oldb|Any (*.*)|*';392 if typedb then393 opend.FilterIndex := 3394 else395 opend.FilterIndex := 2;396 if opend.Executethen379 opend.InitialDir := AppSettings.DatPath; 380 opend.Filter := 'Compatible level files|*.dat;*.oldb|Oni level (*.dat)|*.dat|OUP level database (*.oldb)|*.oldb|Any (*.*)|*'; 381 if typedb then 382 opend.FilterIndex := 3 383 else 384 opend.FilterIndex := 2; 385 if opend.Execute then 386 begin 387 ext := ExtractFileExt(opend.FileName); 388 if ext = '.dat' then 397 389 begin 398 ext := ExtractFileExt(opend.FileName); 399 if ext = '.dat' then 400 begin 401 if not CreateDataConnection(opend.FileName, ODB_Dat) then 402 ShowMessage('Error while loading the file:' + CrLf + opend.FileName + 403 CrLf + 'Perhaps not an Oni-.dat-file?'); 404 end else if ext = '.oldb' then 405 begin 406 if not CreateDataConnection(opend.FileName, ODB_ADB) then 407 ShowMessage('Error while loading the file:' + CrLf + opend.FileName + 408 CrLf + 'Perhaps not an OniUnPacker-LevelDatabase-file?'); 409 end else 410 ShowMessage('Incompatible file'); 411 AppSettings.DatPath := ExtractFilepath(opend.FileName); 412 end; 390 if CreateDataConnection(opend.FileName, ODB_Dat) <> nil then 391 UpdateConLists; 392 end else if ext = '.oldb' then 393 begin 394 if CreateDataConnection(opend.FileName, ODB_ADB) <> nil then 395 UpdateConLists; 396 end else 397 ShowMessage('Incompatible file'); 398 AppSettings.DatPath := ExtractFilepath(opend.FileName); 413 399 end; 414 400 UpdateStatBar; … … 451 437 procedure TForm_Main.menu_createdbClick(Sender: TObject); 452 438 begin 453 if Assigned(OniDataConnection) then439 { if Assigned(OniDataConnection) then 454 440 if MessageBox(Self.Handle, PChar('You have currently opened a level-file. ' + 455 441 'Do you want to close it to continue?'), PChar('Close file?'), … … 470 456 if saved.Execute then 471 457 Form_LevelDB.CreateDatabase(opend.FileName, saved.FileName); 472 end;458 }end; 473 459 474 460 … … 477 463 procedure TForm_Main.menu_createlvlClick(Sender: TObject); 478 464 begin 479 if Assigned(OniDataConnection) then465 { if Assigned(OniDataConnection) then 480 466 if MessageBox(Self.Handle, PChar('You have currently opened a level-file. ' + 481 467 'Do you want to close it to continue?'), PChar('Close file?'), … … 496 482 if saved.Execute then 497 483 Form_LevelDB.CreateLevel(opend.FileName, saved.FileName); 498 end;484 }end; 499 485 500 486 {#################################}
Note:
See TracChangeset
for help on using the changeset viewer.