From ed08c5287ab44b9e5ea3c61ec15310646c0ab528 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Mon, 29 Apr 2013 01:20:52 -0400 Subject: [PATCH] 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. --- src/preferences/cpufrequency/CPUFrequencyView.cpp | 13 ++++++++----- src/preferences/cpufrequency/PreferencesWindow.h | 9 +++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/preferences/cpufrequency/CPUFrequencyView.cpp b/src/preferences/cpufrequency/CPUFrequencyView.cpp index 8ec880ec72..b0e1adf6c2 100644 --- a/src/preferences/cpufrequency/CPUFrequencyView.cpp +++ b/src/preferences/cpufrequency/CPUFrequencyView.cpp @@ -64,18 +64,21 @@ CPUFrequencyView::CPUFrequencyView(BRect frame, BBox *dynamicBox = new BBox(rect, "dynamicBox"); dynamicBox->SetLabel(B_TRANSLATE("Dynamic stepping")); BGroupLayout* dynamicLayout = new BGroupLayout(B_VERTICAL); - dynamicLayout->SetInsets(10, dynamicBox->TopBorderOffset() * 2 + 10, 10, - 10); - dynamicLayout->SetSpacing(10); + dynamicLayout->SetInsets(B_USE_DEFAULT_SPACING, + dynamicBox->TopBorderOffset() * 2 + 10, + B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING); + dynamicLayout->SetSpacing(B_USE_DEFAULT_SPACING); dynamicBox->SetLayout(dynamicLayout); mainLayout->AddView(dynamicBox); fColorStepView = new ColorStepView(frame); 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]: "), "", new BMessage(kIntegrationTimeChanged)); + fIntegrationTime->SetDivider(Bounds().Width() * 3 / 4); + fIntegrationTime->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT); dynamicLayout->AddView(fColorStepView); dynamicLayout->AddView(fIntegrationTime); @@ -97,8 +100,8 @@ CPUFrequencyView::CPUFrequencyView(BRect frame, new BMessage(kInstallIntoDeskbar)); statusLayout->AddView(fStatusView); - statusLayout->AddView(fInstallButton); statusLayout->AddItem(BSpaceLayoutItem::CreateGlue()); + statusLayout->AddView(fInstallButton); } diff --git a/src/preferences/cpufrequency/PreferencesWindow.h b/src/preferences/cpufrequency/PreferencesWindow.h index 914beec62b..03e99002a8 100644 --- a/src/preferences/cpufrequency/PreferencesWindow.h +++ b/src/preferences/cpufrequency/PreferencesWindow.h @@ -356,13 +356,10 @@ PreferencesWindow::PreferencesWindow(const char* title, BGroupView* buttonView = new BGroupView(B_HORIZONTAL); fDefaultButton = new BButton(B_TRANSLATE("Defaults"), new BMessage(kDefaultMsg)); - buttonView->AddChild(fDefaultButton); - buttonView->GetLayout()->AddItem( - BSpaceLayoutItem::CreateHorizontalStrut(7)); + fRevertButton = new BButton(B_TRANSLATE("Revert"), new BMessage(kRevertMsg)); - buttonView->AddChild(fRevertButton); buttonView->GetLayout()->AddItem(BSpaceLayoutItem::CreateGlue()); @@ -370,8 +367,8 @@ PreferencesWindow::PreferencesWindow(const char* title, SetLayout(new BGroupLayout(B_VERTICAL)); fRootLayout = new BGroupLayout(B_VERTICAL); - fRootLayout->SetInsets(10, 10, 10, 10); - fRootLayout->SetSpacing(10); + fRootLayout->SetInsets(B_USE_DEFAULT_SPACING); + fRootLayout->SetSpacing(B_USE_DEFAULT_SPACING); BView* rootView = new BView("root view", 0, fRootLayout); AddChild(rootView); rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));