| 74 |
|
menu_loaddb: TTBItem; |
| 75 |
|
tb_opendb: TTBItem; |
| 76 |
|
Images_Close: TImageList; |
| 77 |
+ |
procedure UpdateConLists; |
| 78 |
|
procedure LoadFile(typedb: Boolean); |
| 79 |
|
function TryCloseAll: Boolean; |
| 80 |
|
procedure menu_AboutClick(Sender: TObject); |
| 154 |
|
end |
| 155 |
|
else if MidStr(ParamStr(1), 1, 4) = 'oldb' then |
| 156 |
|
begin |
| 157 |
< |
if not CreateDataConnection(ParamStr(2), ODB_ADB) then |
| 157 |
> |
if CreateDataConnection(ParamStr(2), ODB_ADB) = nil then |
| 158 |
|
ShowMessage('Error while loading the file:' + CrLf + ParamStr( |
| 159 |
|
2) + CrLf + 'Perhaps not an OniUnPacker-LevelDatabase-file?'); |
| 160 |
|
end |
| 161 |
|
else if MidStr(ParamStr(1), 1, 3) = 'dat' then |
| 162 |
|
begin |
| 163 |
< |
if not CreateDataConnection(ParamStr(2), ODB_Dat) then |
| 163 |
> |
if CreateDataConnection(ParamStr(2), ODB_Dat) = nil then |
| 164 |
|
ShowMessage('Error while loading the file:' + CrLf + ParamStr( |
| 165 |
|
2) + CrLf + 'Perhaps not an Oni-.dat-file?'); |
| 166 |
|
end; |
| 263 |
|
pt.X := X; |
| 264 |
|
pt.Y := Y; |
| 265 |
|
tabIndex := MDITab.GetTabAtPos(pt); |
| 266 |
< |
if (Button = mbRight) and (tabIndex >= 0) then |
| 267 |
< |
MDITab.MDIChildren[tabIndex].Close; |
| 266 |
> |
|
| 267 |
> |
// if (Button = mbRight) and (tabIndex >= 0) then |
| 268 |
> |
// MDITab.MDIChildren[tabIndex].Close; |
| 269 |
|
|
| 270 |
|
if (Button = mbLeft) and (tabIndex >= 0) then |
| 271 |
|
begin |
| 310 |
|
|
| 311 |
|
procedure TForm_Main.UpdateStatBar; |
| 312 |
|
begin |
| 313 |
< |
if Assigned(OniDataConnection) then |
| 313 |
> |
if Length(DataConnections) > 0 then |
| 314 |
|
begin |
| 315 |
< |
Self.Caption := 'Oni Un/Packer ' + version + ' (' + ExtractFileName( |
| 314 |
< |
OniDataConnection.FileName) + ')'; |
| 315 |
> |
Self.Caption := 'Oni Un/Packer ' + version; |
| 316 |
|
ActivateTools(True); |
| 317 |
< |
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)); |
| 318 |
|
end |
| 319 |
|
else |
| 320 |
|
begin |
| 362 |
|
end; |
| 363 |
|
|
| 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 |
+ |
|
| 374 |
|
|
| 375 |
|
procedure TForm_Main.LoadFile(typedb: Boolean); |
| 376 |
|
var |
| 377 |
|
ext: String; |
| 378 |
|
begin |
| 379 |
< |
if TryCloseAll then |
| 379 |
> |
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 |
< |
CloseDataConnection; |
| 388 |
< |
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 then |
| 393 |
< |
opend.FilterIndex := 3 |
| 394 |
< |
else |
| 395 |
< |
opend.FilterIndex := 2; |
| 396 |
< |
if opend.Execute then |
| 387 |
> |
ext := ExtractFileExt(opend.FileName); |
| 388 |
> |
if ext = '.dat' then |
| 389 |
|
begin |
| 390 |
< |
ext := ExtractFileExt(opend.FileName); |
| 391 |
< |
if ext = '.dat' then |
| 392 |
< |
begin |
| 393 |
< |
if not CreateDataConnection(opend.FileName, ODB_Dat) then |
| 394 |
< |
ShowMessage('Error while loading the file:' + CrLf + opend.FileName + |
| 395 |
< |
CrLf + 'Perhaps not an Oni-.dat-file?'); |
| 396 |
< |
end else if ext = '.oldb' then |
| 397 |
< |
begin |
| 398 |
< |
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); |
| 399 |
|
end; |
| 400 |
|
UpdateStatBar; |
| 401 |
|
end; |
| 436 |
|
{####################################} |
| 437 |
|
procedure TForm_Main.menu_createdbClick(Sender: TObject); |
| 438 |
|
begin |
| 439 |
< |
if Assigned(OniDataConnection) then |
| 439 |
> |
{ if Assigned(OniDataConnection) then |
| 440 |
|
if MessageBox(Self.Handle, PChar('You have currently opened a level-file. ' + |
| 441 |
|
'Do you want to close it to continue?'), PChar('Close file?'), |
| 442 |
|
MB_YESNO + MB_ICONQUESTION) = ID_NO then |
| 455 |
|
if opend.Execute then |
| 456 |
|
if saved.Execute then |
| 457 |
|
Form_LevelDB.CreateDatabase(opend.FileName, saved.FileName); |
| 458 |
< |
end; |
| 458 |
> |
}end; |
| 459 |
|
|
| 460 |
|
|
| 461 |
|
|
| 462 |
|
|
| 463 |
|
procedure TForm_Main.menu_createlvlClick(Sender: TObject); |
| 464 |
|
begin |
| 465 |
< |
if Assigned(OniDataConnection) then |
| 465 |
> |
{ if Assigned(OniDataConnection) then |
| 466 |
|
if MessageBox(Self.Handle, PChar('You have currently opened a level-file. ' + |
| 467 |
|
'Do you want to close it to continue?'), PChar('Close file?'), |
| 468 |
|
MB_YESNO + MB_ICONQUESTION) = ID_NO then |
| 481 |
|
if opend.Execute then |
| 482 |
|
if saved.Execute then |
| 483 |
|
Form_LevelDB.CreateLevel(opend.FileName, saved.FileName); |
| 484 |
< |
end; |
| 484 |
> |
}end; |
| 485 |
|
|
| 486 |
|
{#################################} |
| 487 |
|
{##### Tools-Menu-Handlers #####} |