[haiku-commits] haiku: hrev45980 - src/preferences/screen

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 20 Aug 2013 20:49:32 +0200 (CEST)

hrev45980 adds 1 changeset to branch 'master'
old head: ffd71d3d19742cef58981cd7cba8e22d79320128
new head: 6048f54145df1c26c3590e7a1613f7cda70eee81
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=6048f54+%5Effd71d3

----------------------------------------------------------------------------

6048f54: Screen prefs: Use menu field layout methods
  
  ... to layout the menu field label and menu in the grid. This makes
  the label and grid layout correctly, the AddMenuField() method should
  be deprecated or fixed as it lays out the menu field differently.
  
  Also replace numeric spacing units with font relative spacing units.

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev45980
Commit:      6048f54145df1c26c3590e7a1613f7cda70eee81
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6048f54
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Tue Aug 20 18:43:16 2013 UTC

----------------------------------------------------------------------------

1 file changed, 24 insertions(+), 10 deletions(-)
src/preferences/screen/ScreenWindow.cpp | 34 ++++++++++++++++++++---------

----------------------------------------------------------------------------

diff --git a/src/preferences/screen/ScreenWindow.cpp 
b/src/preferences/screen/ScreenWindow.cpp
index 250766d..5fdaf84 100644
--- a/src/preferences/screen/ScreenWindow.cpp
+++ b/src/preferences/screen/ScreenWindow.cpp
@@ -272,8 +272,9 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
 
        BBox* controlsBox = new BBox("controls box");
        controlsBox->SetLabel(workspaceMenuField);
-       BGroupView* outerControlsView = new BGroupView(B_VERTICAL, 10.0);
-       outerControlsView->GroupLayout()->SetInsets(10, 10, 10, 10);
+       BGroupView* outerControlsView = new BGroupView(B_VERTICAL);
+       outerControlsView->GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING,
+               B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, 
B_USE_DEFAULT_SPACING);
        controlsBox->AddChild(outerControlsView);
 
        fResolutionMenu = new BPopUpMenu("resolution", true, true);
@@ -309,6 +310,7 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
 
        fResolutionField = new BMenuField("ResolutionMenu",
                B_TRANSLATE("Resolution:"), fResolutionMenu);
+       fResolutionField->SetAlignment(B_ALIGN_RIGHT);
 
        fColorsMenu = new BPopUpMenu("colors", true, false);
 
@@ -329,6 +331,7 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
 
        fColorsField = new BMenuField("ColorsMenu", B_TRANSLATE("Colors:"),
                fColorsMenu);
+       fColorsField->SetAlignment(B_ALIGN_RIGHT);
 
        fRefreshMenu = new BPopUpMenu("refresh rate", true, true);
 
@@ -378,6 +381,7 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
 
        fRefreshField = new BMenuField("RefreshMenu", B_TRANSLATE("Refresh 
rate:"),
                fRefreshMenu);
+       fRefreshField->SetAlignment(B_ALIGN_RIGHT);
 
        if (_IsVesa())
                fRefreshField->Hide();
@@ -410,6 +414,7 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
 
                fCombineField = new BMenuField("CombineMenu",
                        B_TRANSLATE("Combine displays:"), fCombineMenu);
+               fCombineField->SetAlignment(B_ALIGN_RIGHT);
 
                if (!multiMonSupport)
                        fCombineField->Hide();
@@ -428,6 +433,7 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
 
                fSwapDisplaysField = new BMenuField("SwapMenu",
                        B_TRANSLATE("Swap displays:"), fSwapDisplaysMenu);
+               fSwapDisplaysField->SetAlignment(B_ALIGN_RIGHT);
 
                if (!multiMonSupport)
                        fSwapDisplaysField->Hide();
@@ -448,6 +454,7 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
 
                fUseLaptopPanelField = new BMenuField("UseLaptopPanel",
                        B_TRANSLATE("Use laptop panel:"), fUseLaptopPanelMenu);
+               fUseLaptopPanelField->SetAlignment(B_ALIGN_RIGHT);
 
                if (!useLaptopPanelSupport)
                        fUseLaptopPanelField->Hide();
@@ -478,14 +485,21 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
        }
 
        BLayoutBuilder::Group<>(outerControlsView)
-               .AddGrid(5.0, 5.0)
-                       .AddMenuField(fResolutionField, 0, 0, B_ALIGN_RIGHT)
-                       .AddMenuField(fColorsField, 0, 1, B_ALIGN_RIGHT)
-                       .AddMenuField(fRefreshField, 0, 2, B_ALIGN_RIGHT)
-                       .AddMenuField(fCombineField, 0, 3, B_ALIGN_RIGHT)
-                       .AddMenuField(fSwapDisplaysField, 0, 4, B_ALIGN_RIGHT)
-                       .AddMenuField(fUseLaptopPanelField, 0, 5, B_ALIGN_RIGHT)
-                       .AddMenuField(fTVStandardField, 0, 6, B_ALIGN_RIGHT)
+               .AddGrid(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING)
+                       .Add(fResolutionField->CreateLabelLayoutItem(), 0, 0)
+                       .Add(fResolutionField->CreateMenuBarLayoutItem(), 1, 0)
+                       .Add(fColorsField->CreateLabelLayoutItem(), 0, 1)
+                       .Add(fColorsField->CreateMenuBarLayoutItem(), 1, 1)
+                       .Add(fRefreshField->CreateLabelLayoutItem(), 0, 2)
+                       .Add(fRefreshField->CreateMenuBarLayoutItem(), 1, 2)
+                       .Add(fCombineField->CreateLabelLayoutItem(), 0, 3)
+                       .Add(fCombineField->CreateMenuBarLayoutItem(), 1, 3)
+                       .Add(fSwapDisplaysField->CreateLabelLayoutItem(), 0, 4)
+                       .Add(fSwapDisplaysField->CreateMenuBarLayoutItem(), 1, 
4)
+                       .Add(fUseLaptopPanelField->CreateLabelLayoutItem(), 0, 
5)
+                       .Add(fUseLaptopPanelField->CreateMenuBarLayoutItem(), 
1, 5)
+                       .Add(fTVStandardField->CreateLabelLayoutItem(), 0, 6)
+                       .Add(fTVStandardField->CreateMenuBarLayoutItem(), 1, 6)
                .End();
 
        // TODO: we don't support getting the screen's preferred settings


Other related posts:

  • » [haiku-commits] haiku: hrev45980 - src/preferences/screen - jscipione