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