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
This commit is contained in:
Axel Dörfler 2005-12-28 23:50:16 +00:00
parent 5a78744bed
commit ca8fc8c47c
2 changed files with 14 additions and 14 deletions

View File

@ -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);
}

View File

@ -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);