ShowImage: Set width and height attributes of the showed image.

* Fixes #8745.
This commit is contained in:
Janus
2015-04-21 08:42:05 +00:00
parent b526d04a5b
commit e62a697349
2 changed files with 28 additions and 0 deletions
+26
View File
@@ -647,6 +647,9 @@ ShowImageWindow::MessageReceived(BMessage* message)
Show(); Show();
} }
_UpdateRatingMenu(); _UpdateRatingMenu();
// Set width and height attributes of the currently showed file.
// This should only be a temporary solution.
_SaveWidthAndHeight();
break; 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 void
ShowImageWindow::_SetToolBarVisible(bool visible, bool animate) ShowImageWindow::_SetToolBarVisible(bool visible, bool animate)
{ {
+2
View File
@@ -108,6 +108,8 @@ private:
bool animate = false); bool animate = false);
void _SetToolBarBorder(bool visible); void _SetToolBarBorder(bool visible);
void _SaveWidthAndHeight();
private: private:
ImageFileNavigator fNavigator; ImageFileNavigator fNavigator;
BFilePanel* fSavePanel; BFilePanel* fSavePanel;