Update CPUFrequency layout a bit

* Use font relative insets and spacing for window.
* Make the input box for Integration Time more reasonably sized and right
  align the label.
* Make the Install replicant into Deskbar button flush right.
* Use the standard amount of space between the Defaults and Revert buttons.
This commit is contained in:
John Scipione 2013-04-29 01:20:52 -04:00
parent ec63fd3249
commit ed08c5287a
2 changed files with 11 additions and 11 deletions

View File

@ -64,18 +64,21 @@ CPUFrequencyView::CPUFrequencyView(BRect frame,
BBox *dynamicBox = new BBox(rect, "dynamicBox"); BBox *dynamicBox = new BBox(rect, "dynamicBox");
dynamicBox->SetLabel(B_TRANSLATE("Dynamic stepping")); dynamicBox->SetLabel(B_TRANSLATE("Dynamic stepping"));
BGroupLayout* dynamicLayout = new BGroupLayout(B_VERTICAL); BGroupLayout* dynamicLayout = new BGroupLayout(B_VERTICAL);
dynamicLayout->SetInsets(10, dynamicBox->TopBorderOffset() * 2 + 10, 10, dynamicLayout->SetInsets(B_USE_DEFAULT_SPACING,
10); dynamicBox->TopBorderOffset() * 2 + 10,
dynamicLayout->SetSpacing(10); B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
dynamicLayout->SetSpacing(B_USE_DEFAULT_SPACING);
dynamicBox->SetLayout(dynamicLayout); dynamicBox->SetLayout(dynamicLayout);
mainLayout->AddView(dynamicBox); mainLayout->AddView(dynamicBox);
fColorStepView = new ColorStepView(frame); fColorStepView = new ColorStepView(frame);
fColorStepView->SetFrequencys(fDriverInterface.GetCpuFrequencyStates()); fColorStepView->SetFrequencys(fDriverInterface.GetCpuFrequencyStates());
fIntegrationTime = new BTextControl(BRect(0,0,Bounds().Width(),10), fIntegrationTime = new BTextControl(BRect(0, 0, Bounds().Width(), 10),
"intergal", B_TRANSLATE("Integration time [ms]: "), "", "intergal", B_TRANSLATE("Integration time [ms]: "), "",
new BMessage(kIntegrationTimeChanged)); new BMessage(kIntegrationTimeChanged));
fIntegrationTime->SetDivider(Bounds().Width() * 3 / 4);
fIntegrationTime->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
dynamicLayout->AddView(fColorStepView); dynamicLayout->AddView(fColorStepView);
dynamicLayout->AddView(fIntegrationTime); dynamicLayout->AddView(fIntegrationTime);
@ -97,8 +100,8 @@ CPUFrequencyView::CPUFrequencyView(BRect frame,
new BMessage(kInstallIntoDeskbar)); new BMessage(kInstallIntoDeskbar));
statusLayout->AddView(fStatusView); statusLayout->AddView(fStatusView);
statusLayout->AddView(fInstallButton);
statusLayout->AddItem(BSpaceLayoutItem::CreateGlue()); statusLayout->AddItem(BSpaceLayoutItem::CreateGlue());
statusLayout->AddView(fInstallButton);
} }

View File

@ -356,13 +356,10 @@ PreferencesWindow<Preferences>::PreferencesWindow(const char* title,
BGroupView* buttonView = new BGroupView(B_HORIZONTAL); BGroupView* buttonView = new BGroupView(B_HORIZONTAL);
fDefaultButton = new BButton(B_TRANSLATE("Defaults"), fDefaultButton = new BButton(B_TRANSLATE("Defaults"),
new BMessage(kDefaultMsg)); new BMessage(kDefaultMsg));
buttonView->AddChild(fDefaultButton); buttonView->AddChild(fDefaultButton);
buttonView->GetLayout()->AddItem(
BSpaceLayoutItem::CreateHorizontalStrut(7));
fRevertButton = new BButton(B_TRANSLATE("Revert"), fRevertButton = new BButton(B_TRANSLATE("Revert"),
new BMessage(kRevertMsg)); new BMessage(kRevertMsg));
buttonView->AddChild(fRevertButton); buttonView->AddChild(fRevertButton);
buttonView->GetLayout()->AddItem(BSpaceLayoutItem::CreateGlue()); buttonView->GetLayout()->AddItem(BSpaceLayoutItem::CreateGlue());
@ -370,8 +367,8 @@ PreferencesWindow<Preferences>::PreferencesWindow(const char* title,
SetLayout(new BGroupLayout(B_VERTICAL)); SetLayout(new BGroupLayout(B_VERTICAL));
fRootLayout = new BGroupLayout(B_VERTICAL); fRootLayout = new BGroupLayout(B_VERTICAL);
fRootLayout->SetInsets(10, 10, 10, 10); fRootLayout->SetInsets(B_USE_DEFAULT_SPACING);
fRootLayout->SetSpacing(10); fRootLayout->SetSpacing(B_USE_DEFAULT_SPACING);
BView* rootView = new BView("root view", 0, fRootLayout); BView* rootView = new BView("root view", 0, fRootLayout);
AddChild(rootView); AddChild(rootView);
rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));