Update screen prefs layout. Fixes #8817

* Center monitor info and Workspaces label.
* Use font-relative spacing.
* Update the header including copyright year, sort contributors by name and add
  myself as well.
This commit is contained in:
John Scipione
2013-03-16 10:15:30 -04:00
parent 4307b2e057
commit e1c882014b
+41 -19
View File
@@ -1,16 +1,17 @@
/*
* Copyright 2001-2012, Haiku.
* Copyright 2001-2013, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Rafael Romo
* Stefano Ceccherini ([email protected])
* Stephan Aßmus, [email protected]
* Andrew Bachmann
* Stefano Ceccherini, [email protected]
* Alexandre Deckner, [email protected]
* Axel Dörfler, [email protected]
* Rene Gollent, [email protected]
* Thomas Kurschel
* Axel Dörfler, [email protected]
* Stephan Aßmus <[email protected]>
* Alexandre Deckner, [email protected]
* Rafael Romo
* John Scipione, [email protected]
*/
@@ -25,6 +26,7 @@
#include <Box.h>
#include <Button.h>
#include <Catalog.h>
#include <ControlLook.h>
#include <Directory.h>
#include <File.h>
#include <FindDirectory.h>
@@ -37,6 +39,7 @@
#include <Path.h>
#include <PopUpMenu.h>
#include <Screen.h>
#include <SpaceLayoutItem.h>
#include <String.h>
#include <StringView.h>
#include <Roster.h>
@@ -209,11 +212,13 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
// box on the left with workspace count and monitor view
BBox* screenBox = new BBox("screen box");
BGroupLayout* layout = new BGroupLayout(B_VERTICAL, 5.0);
layout->SetInsets(10, 10, 10, 10);
BGroupLayout* layout = new BGroupLayout(B_VERTICAL, B_USE_SMALL_SPACING);
layout->SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
screenBox->SetLayout(layout);
fMonitorInfo = new BStringView("monitor info", "");
fMonitorInfo->SetAlignment(B_ALIGN_CENTER);
screenBox->AddChild(fMonitorInfo);
fMonitorView = new MonitorView(BRect(0.0, 0.0, 80.0, 80.0),
@@ -221,22 +226,39 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
screen.Frame().IntegerHeight() + 1);
screenBox->AddChild(fMonitorView);
BStringView* workspaces = new BStringView("workspaces",
B_TRANSLATE("Workspaces"));
workspaces->SetAlignment(B_ALIGN_CENTER);
fColumnsControl = new BTextControl(B_TRANSLATE("Columns:"), "0",
new BMessage(kMsgWorkspaceColumnsChanged));
fColumnsControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
fRowsControl = new BTextControl(B_TRANSLATE("Rows:"), "0",
new BMessage(kMsgWorkspaceRowsChanged));
fRowsControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
screenBox->AddChild(BLayoutBuilder::Grid<>(5.0, 5.0)
.Add(new BStringView("", B_TRANSLATE("Workspaces")), 0, 0, 3)
.AddTextControl(fColumnsControl, 0, 1, B_ALIGN_RIGHT)
.AddGroup(B_HORIZONTAL, 0, 2, 1)
.Add(_CreateColumnRowButton(true, false))
.Add(_CreateColumnRowButton(true, true))
.End()
.AddTextControl(fRowsControl, 0, 2, B_ALIGN_RIGHT)
.AddGroup(B_HORIZONTAL, 0, 2, 2)
.Add(_CreateColumnRowButton(false, false))
.Add(_CreateColumnRowButton(false, true))
float tiny = be_control_look->DefaultItemSpacing() / 4;
screenBox->AddChild(BLayoutBuilder::Group<>()
.AddGroup(B_VERTICAL, B_USE_SMALL_SPACING)
.Add(workspaces)
.AddGrid(0.0, tiny)
// columns
.Add(fColumnsControl->CreateLabelLayoutItem(), 0, 0)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(
B_USE_SMALL_SPACING), 1, 0)
.Add(fColumnsControl->CreateTextViewLayoutItem(), 2, 0)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(tiny), 3, 0)
.Add(_CreateColumnRowButton(true, false), 4, 0)
.Add(_CreateColumnRowButton(true, true), 5, 0)
// rows
.Add(fRowsControl->CreateLabelLayoutItem(), 0, 1)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(
B_USE_SMALL_SPACING), 1, 1)
.Add(fRowsControl->CreateTextViewLayoutItem(), 2, 1)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(tiny), 3, 1)
.Add(_CreateColumnRowButton(false, false), 4, 1)
.Add(_CreateColumnRowButton(false, true), 5, 1)
.End()
.End()
.View());