From ca8fc8c47cd10122d37cec5e800098a18dc39f8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 28 Dec 2005 23:50:16 +0000 Subject: [PATCH] The aspect ratio of the monitor is now independent of the size of the MonitorView's bounds. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15704 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/screen/MonitorView.cpp | 25 ++++++++++++------------- src/preferences/screen/ScreenWindow.cpp | 3 ++- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/preferences/screen/MonitorView.cpp b/src/preferences/screen/MonitorView.cpp index a4b4f6a3b4..9c53671c40 100644 --- a/src/preferences/screen/MonitorView.cpp +++ b/src/preferences/screen/MonitorView.cpp @@ -52,27 +52,26 @@ MonitorView::MouseDown(BPoint point) BRect MonitorView::MonitorBounds() { - float maxWidth, maxHeight; float picWidth, picHeight; - maxWidth = Bounds().Width(); - maxHeight = Bounds().Height(); + float maxSize = min_c(Bounds().Width(), Bounds().Height()); - picWidth = maxWidth * fWidth / 1600; - picHeight = maxHeight * fHeight / 1200; + picWidth = maxSize * fWidth / 1600; + picHeight = maxSize * fHeight / 1600; - if (picWidth > maxWidth) { - picHeight = picHeight * maxWidth / picWidth; - picWidth = maxWidth; + if (picWidth > maxSize) { + picHeight = picHeight * maxSize / picWidth; + picWidth = maxSize; } - if (picHeight > maxHeight) { - picWidth = picWidth * maxHeight / picHeight; - picHeight = maxHeight; + if (picHeight > maxSize) { + picWidth = picWidth * maxSize / picHeight; + picHeight = maxSize; } - return BRect((maxWidth - picWidth) / 2, (maxHeight - picHeight) / 2, - (maxWidth + picWidth) / 2, (maxHeight + picHeight) / 2); + BPoint size = BPoint(Bounds().Width(), Bounds().Height()); + return BRect((size.x - picWidth) / 2, (size.y - picHeight) / 2, + (size.x + picWidth) / 2, (size.y + picHeight) / 2); } diff --git a/src/preferences/screen/ScreenWindow.cpp b/src/preferences/screen/ScreenWindow.cpp index 70e952ab59..2c477675b4 100644 --- a/src/preferences/screen/ScreenWindow.cpp +++ b/src/preferences/screen/ScreenWindow.cpp @@ -211,7 +211,8 @@ ScreenWindow::ScreenWindow(ScreenSettings *settings) if (item != NULL) item->SetMarked(true); - rect = screenBox->Bounds().InsetByCopy(22, 22); + rect = screenBox->Bounds().InsetByCopy(8, 8); + rect.bottom -= height - 4; fMonitorView = new MonitorView(rect, "monitor", screen.Frame().Width() + 1, screen.Frame().Height() + 1); screenBox->AddChild(fMonitorView);