Don't reset the window size when playing a new file if it isn't necessary.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26286 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2008-07-07 08:33:03 +00:00
parent 591f4c05bc
commit 62bf33df96
+11 -9
View File
@@ -122,8 +122,8 @@ MainWin::MainWin()
, fNoMenu(false) , fNoMenu(false)
, fNoBorder(false) , fNoBorder(false)
, fNoControls(false) , fNoControls(false)
, fSourceWidth(0) , fSourceWidth(-1)
, fSourceHeight(0) , fSourceHeight(-1)
, fWidthScale(1.0) , fWidthScale(1.0)
, fHeightScale(1.0) , fHeightScale(1.0)
, fMouseDownTracking(false) , fMouseDownTracking(false)
@@ -849,10 +849,13 @@ MainWin::_SetupWindow()
fVideoMenu->SetEnabled(fHasVideo); fVideoMenu->SetEnabled(fHasVideo);
fAudioMenu->SetEnabled(fHasAudio); fAudioMenu->SetEnabled(fHasAudio);
// fDebugMenu->SetEnabled(fHasVideo); // fDebugMenu->SetEnabled(fHasVideo);
int previousSourceWidth = fSourceWidth;
int previousSourceHeight = fSourceHeight;
if (fHasVideo) { if (fHasVideo) {
fController->GetSize(&fSourceWidth, &fSourceHeight); fController->GetSize(&fSourceWidth, &fSourceHeight);
fWidthScale = 1.0; fWidthScale = 1.0;
fHeightScale = 1.0; fHeightScale = 1.0;
// TODO: implement aspect ratio
} else { } else {
fSourceWidth = 0; fSourceWidth = 0;
fSourceHeight = 0; fSourceHeight = 0;
@@ -861,9 +864,11 @@ MainWin::_SetupWindow()
} }
_UpdateControlsEnabledStatus(); _UpdateControlsEnabledStatus();
// TODO: Don't if the video size did not change! Also don't // adopt the size and window layout if necessary
// exit full screen mode. if (!fIsFullscreen && (previousSourceWidth != fSourceWidth
|| previousSourceHeight != fSourceHeight)) {
_ResizeWindow(100); _ResizeWindow(100);
}
fVideoView->MakeFocus(); fVideoView->MakeFocus();
} }
@@ -1024,12 +1029,9 @@ MainWin::_SetWindowSizeLimits()
void void
MainWin::_ResizeWindow(int percent) MainWin::_ResizeWindow(int percent)
{ {
int video_width;
int video_height;
// Get required window size // Get required window size
video_width = lround(fSourceWidth * fWidthScale); int video_width = lround(fSourceWidth * fWidthScale);
video_height = lround(fSourceHeight * fHeightScale); int video_height = lround(fSourceHeight * fHeightScale);
video_width = (video_width * percent) / 100; video_width = (video_width * percent) / 100;
video_height = (video_height * percent) / 100; video_height = (video_height * percent) / 100;