ShowImage: Set width and height attributes of the showed image.
* Fixes #8745.
This commit is contained in:
@@ -647,6 +647,9 @@ ShowImageWindow::MessageReceived(BMessage* message)
|
||||
Show();
|
||||
}
|
||||
_UpdateRatingMenu();
|
||||
// Set width and height attributes of the currently showed file.
|
||||
// This should only be a temporary solution.
|
||||
_SaveWidthAndHeight();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1510,6 +1513,29 @@ ShowImageWindow::_UpdateRatingMenu()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ShowImageWindow::_SaveWidthAndHeight()
|
||||
{
|
||||
if (fNavigator.CurrentPage() != 1)
|
||||
return;
|
||||
|
||||
if (fImageView->Bitmap() == NULL)
|
||||
return;
|
||||
|
||||
BRect bounds = fImageView->Bitmap()->Bounds();
|
||||
int32 width, height;
|
||||
width = bounds.IntegerWidth() + 1;
|
||||
height = bounds.IntegerHeight() + 1;
|
||||
|
||||
BFile file(&fNavigator.CurrentRef(), B_WRITE_ONLY);
|
||||
if (file.InitCheck() != B_OK)
|
||||
return;
|
||||
|
||||
file.WriteAttr("Media:Width", B_INT32_TYPE, 0, &width, sizeof(width));
|
||||
file.WriteAttr("Media:Height", B_INT32_TYPE, 0, &height, sizeof(height));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ShowImageWindow::_SetToolBarVisible(bool visible, bool animate)
|
||||
{
|
||||
|
||||
@@ -108,6 +108,8 @@ private:
|
||||
bool animate = false);
|
||||
void _SetToolBarBorder(bool visible);
|
||||
|
||||
void _SaveWidthAndHeight();
|
||||
|
||||
private:
|
||||
ImageFileNavigator fNavigator;
|
||||
BFilePanel* fSavePanel;
|
||||
|
||||
Reference in New Issue
Block a user