[haiku-commits] haiku: hrev44883 - src/preferences/time

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 24 Nov 2012 00:38:35 +0100 (CET)

hrev44883 adds 1 changeset to branch 'master'
old head: 7c3985c617ba8bf201fd928cccd6f726c747558b
new head: f496c69cb58dbd197aa0308976229701fcffc9d1
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=f496c69+%5E7c3985c

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

f496c69: Adjust time zone spacing so that the window doesn't resize.
  
  Adjust the spacing of the time zone settings in Time prefs so that
  switching between Local time and GMT time won't resize the window
  when hiding and showing the current and preview times. This means
  that the Time preferences window always stays a constant height
  without any tricks needed to adjust it after the fact. Before this
  change the Time preferences window would change height depending
  on the setting, which while not terrible, was probably not
  what the author intended.
  
  As a side note I adjusted the window to use B_USE_DEFAULT_SPACING
  instead of hardcoded 5px so that the window spacing will adjust to
  font size changes.

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

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

Revision:    hrev44883
Commit:      f496c69cb58dbd197aa0308976229701fcffc9d1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=f496c69
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Fri Nov 23 23:33:07 2012 UTC

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

2 files changed, 16 insertions(+), 13 deletions(-)
src/preferences/time/TimeWindow.cpp |  5 +++--
src/preferences/time/ZoneView.cpp   | 24 +++++++++++++-----------

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

diff --git a/src/preferences/time/TimeWindow.cpp 
b/src/preferences/time/TimeWindow.cpp
index 8b226ee..2c7c6e4 100644
--- a/src/preferences/time/TimeWindow.cpp
+++ b/src/preferences/time/TimeWindow.cpp
@@ -126,10 +126,11 @@ TTimeWindow::_InitWindow()
        fRevertButton->SetExplicitAlignment(
                BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
 
-       BLayoutBuilder::Group<>(this, B_VERTICAL, 5)
+       BLayoutBuilder::Group<>(this, B_VERTICAL, B_USE_DEFAULT_SPACING)
                .Add(fBaseView)
                .Add(fRevertButton)
-               .SetInsets(5, 5, 5, 5);
+               .SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
+                       B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
 }
 
 
diff --git a/src/preferences/time/ZoneView.cpp 
b/src/preferences/time/ZoneView.cpp
index 41ed9d4..c773de5 100644
--- a/src/preferences/time/ZoneView.cpp
+++ b/src/preferences/time/ZoneView.cpp
@@ -260,8 +260,6 @@ TimeZoneView::_InitView()
        fSetZone->SetExplicitAlignment(
                BAlignment(B_ALIGN_RIGHT, B_ALIGN_BOTTOM));
 
-       BStringView* text = new BStringView("clockSetTo",
-               B_TRANSLATE("Hardware clock set to:"));
        fLocalTime = new BRadioButton("localTime",
                B_TRANSLATE("Local time (Windows compatible)"), new 
BMessage(kRTCUpdate));
        fGmtTime = new BRadioButton("greenwichMeanTime",
@@ -274,22 +272,27 @@ TimeZoneView::_InitView()
        _ShowOrHidePreview();
        fOldUseGmtTime = fUseGmtTime;
 
-
-       const float kInset = be_control_look->DefaultItemSpacing();
+       const float kIndentSpacing
+               = be_control_look->DefaultItemSpacing() * 2;
        BLayoutBuilder::Group<>(this)
                .Add(scrollList)
-               .AddGroup(B_VERTICAL, kInset)
-                       .Add(text)
-                       .AddGroup(B_VERTICAL, kInset)
+               .AddGroup(B_VERTICAL, 0)
+                       .Add(new BStringView("clockSetTo",
+                               B_TRANSLATE("Hardware clock set to:")))
+                       .AddGroup(B_VERTICAL, 0)
                                .Add(fLocalTime)
                                .Add(fGmtTime)
+                               .SetInsets(kIndentSpacing, 0, 0, 0)
                        .End()
                        .AddGlue()
-                       .Add(fCurrent)
-                       .Add(fPreview)
+                       .AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING)
+                               .Add(fCurrent)
+                               .Add(fPreview)
+                       .End()
                        .Add(fSetZone)
                .End()
-               .SetInsets(kInset, kInset, kInset, kInset);
+               .SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
+                       B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
 }
 
 
@@ -652,4 +655,3 @@ TimeZoneView::_ShowOrHidePreview()
                fPreview->Hide();
        }
 }
-


Other related posts: