Fixed page changing, simplified entry_ref usage in SetImage()

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11366 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matthew Wilber 2005-02-13 17:57:38 +00:00
parent de0194f56b
commit 3a85b92372

View File

@ -336,11 +336,10 @@ void ShowImageView::DeleteSelBitmap()
status_t
ShowImageView::SetImage(const entry_ref *pref)
{
entry_ref ref;
if (!pref)
ref = fCurrentRef;
else
ref = *pref;
// If no file was specified, load the specified page of
// the current file.
if (pref == NULL)
pref = &fCurrentRef;
BTranslatorRoster *proster = BTranslatorRoster::Default();
if (!proster)
@ -350,11 +349,11 @@ ShowImageView::SetImage(const entry_ref *pref)
// if ref is erroneous or a directory, return error
return B_ERROR;
BFile file(&ref, B_READ_ONLY);
BFile file(pref, B_READ_ONLY);
translator_info info;
memset(&info, 0, sizeof(translator_info));
BMessage ioExtension;
if (ref != fCurrentRef)
if (pref != &fCurrentRef)
// if new image, reset to first document
fDocumentIndex = 1;
if (ioExtension.AddInt32("/documentIndex", fDocumentIndex) != B_OK)
@ -381,7 +380,7 @@ ShowImageView::SetImage(const entry_ref *pref)
DeleteBitmap();
fBitmap = newBitmap;
newBitmap = NULL;
fCurrentRef = ref;
fCurrentRef = *pref;
// restore orientation
int32 orientation;