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:
@@ -52,27 +52,26 @@ MonitorView::MouseDown(BPoint point)
|
|||||||
BRect
|
BRect
|
||||||
MonitorView::MonitorBounds()
|
MonitorView::MonitorBounds()
|
||||||
{
|
{
|
||||||
float maxWidth, maxHeight;
|
|
||||||
float picWidth, picHeight;
|
float picWidth, picHeight;
|
||||||
|
|
||||||
maxWidth = Bounds().Width();
|
float maxSize = min_c(Bounds().Width(), Bounds().Height());
|
||||||
maxHeight = Bounds().Height();
|
|
||||||
|
|
||||||
picWidth = maxWidth * fWidth / 1600;
|
picWidth = maxSize * fWidth / 1600;
|
||||||
picHeight = maxHeight * fHeight / 1200;
|
picHeight = maxSize * fHeight / 1600;
|
||||||
|
|
||||||
if (picWidth > maxWidth) {
|
if (picWidth > maxSize) {
|
||||||
picHeight = picHeight * maxWidth / picWidth;
|
picHeight = picHeight * maxSize / picWidth;
|
||||||
picWidth = maxWidth;
|
picWidth = maxSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (picHeight > maxHeight) {
|
if (picHeight > maxSize) {
|
||||||
picWidth = picWidth * maxHeight / picHeight;
|
picWidth = picWidth * maxSize / picHeight;
|
||||||
picHeight = maxHeight;
|
picHeight = maxSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
return BRect((maxWidth - picWidth) / 2, (maxHeight - picHeight) / 2,
|
BPoint size = BPoint(Bounds().Width(), Bounds().Height());
|
||||||
(maxWidth + picWidth) / 2, (maxHeight + picHeight) / 2);
|
return BRect((size.x - picWidth) / 2, (size.y - picHeight) / 2,
|
||||||
|
(size.x + picWidth) / 2, (size.y + picHeight) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -211,7 +211,8 @@ ScreenWindow::ScreenWindow(ScreenSettings *settings)
|
|||||||
if (item != NULL)
|
if (item != NULL)
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
|
|
||||||
rect = screenBox->Bounds().InsetByCopy(22, 22);
|
rect = screenBox->Bounds().InsetByCopy(8, 8);
|
||||||
|
rect.bottom -= height - 4;
|
||||||
fMonitorView = new MonitorView(rect, "monitor",
|
fMonitorView = new MonitorView(rect, "monitor",
|
||||||
screen.Frame().Width() + 1, screen.Frame().Height() + 1);
|
screen.Frame().Width() + 1, screen.Frame().Height() + 1);
|
||||||
screenBox->AddChild(fMonitorView);
|
screenBox->AddChild(fMonitorView);
|
||||||
|
|||||||
Reference in New Issue
Block a user