rejetto forum

Testing build #253

rejetto · 17 · 7496

0 Members and 1 Guest are viewing this topic.

Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 1995
    • View Profile
For you who likes the simplicity, this solution should delight you.   ;D



When loading a new or recent VFS , if the actual is modified , there was nothing to ask saving before.

From now on it will exist in the future build. ;)

Quote
procedure TmainFrm.Loadfilesystem1Click(Sender: TObject);
var
  fn: string;
begin
if blockLoadSave() then exit;
if VFSModified then
 case msgDlg('VFS has changed, save current file system before open new?',MB_ICONINFORMATION+MB_YESNOCANCEL) of
    IDYES: begin
           mainfrm.saveVFS(lastFileOpen);
           if not VFSModified then msgDlg('The VFS was correctly saved,'#13#13'click on OK to continue', MB_ICONASTERISK);
           end;
    IDNO: ; // just go on
    IDCANCEL: exit;
    end;
fn:='';
if PromptForFileName(fn, 'VirtualFileSystem|*.vfs', 'vfs', 'Open VFS file') then
  loadVFS(fn);
end;

............

procedure Tmainfrm.recentsClick(sender:Tobject);
var
  i: integer;
begin
if blockLoadSave() then exit;
i:=strToInt((sender as Tmenuitem).Caption[3]);
if i > length(recentFiles) then exit;
dec(i); // convert to zero based
if FileExists(recentFiles) then
  if vfsmodified then
  case msgDlg('VFS has changed, save current file system before select new file?',MB_ICONINFORMATION+MB_YESNOCANCEL) of
    IDYES: begin
           mainfrm.saveVFS(lastFileOpen);
           if not VFSModified then msgDlg('The VFS was correctly saved,'#13#13'click on OK to continue', MB_ICONASTERISK);
           end;
    IDNO: begin        
           loadVFS(recentFiles)
           end;
    IDCANCEL: exit;
    end
  else
  loadVFS(recentFiles)
else
  begin
  msgDlg('The file does not exist anymore', MB_ICONERROR);
  removeString(recentFiles, i);
  updateRecentFilesMenu();
  end;
end;

« Last Edit: February 15, 2010, 12:08:46 PM by SilentPliz »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13304
    • View Profile
good point mars.

but i opted for adding just this line to both procedures:
if not checkVfsOnQuit() then exit;

isn't it enough?