Skip to content

Commit

Permalink
Error message now shown on attempt to load a non-existent project file
Browse files Browse the repository at this point in the history
  • Loading branch information
malcolmgp committed May 11, 2014
1 parent 964edfd commit bd82d91
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions MainUI.pas
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ procedure TMainForm.FormDestroy ( Sender: TObject ) ;
then FreeAndNil( CurrentProject );
if DeleteDirectory(Folder,True)
then RemoveDirUTF8(Folder);
Preferences.Free;
{$IFDEF HAS_LIBSANE}
if Assigned(ScannerHandle) then
begin
Expand Down Expand Up @@ -1451,19 +1452,23 @@ procedure TMainForm.OpenProject ( fn: TFilename ) ;
var
x: Integer;
begin
NewProjectMenuItemClick(nil);
if CurrentProject.LoadfromFile(fn)=0 then
if FileExistsUTF8(fn) then
begin
ICanvas.Scale := CurrentProject.ViewerScale;
ThumbnailListBox.Clear;
for x := 0 to CurrentProject.PageCount-1 do
ThumbnailListBox.Items.AddObject( CurrentProject.Pages[x].Title, CurrentProject.Pages[x].Thumbnail );
ThumbnailListBox.ItemIndex := CurrentProject.ItemIndex;
ThumbnailListBoxClick(ThumbnailListBox);
Caption := 'Ocrivist : ' + CurrentProject.Title;
RecentList.AddFile(fn);
DelPageButton.Enabled := CurrentProject.PageCount>0;
end;
NewProjectMenuItemClick(nil);
if CurrentProject.LoadfromFile(fn)=0 then
begin
ICanvas.Scale := CurrentProject.ViewerScale;
ThumbnailListBox.Clear;
for x := 0 to CurrentProject.PageCount-1 do
ThumbnailListBox.Items.AddObject( CurrentProject.Pages[x].Title, CurrentProject.Pages[x].Thumbnail );
ThumbnailListBox.ItemIndex := CurrentProject.ItemIndex;
ThumbnailListBoxClick(ThumbnailListBox);
Caption := 'Ocrivist : ' + CurrentProject.Title;
RecentList.AddFile(fn);
DelPageButton.Enabled := CurrentProject.PageCount>0;
end;
end
else MessageDlg('File not found', mtError, [mbOK], 0);
end;


Expand Down

0 comments on commit bd82d91

Please sign in to comment.