From f496c69cb58dbd197aa0308976229701fcffc9d1 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Fri, 23 Nov 2012 18:33:07 -0500 Subject: [PATCH] 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. --- src/preferences/time/TimeWindow.cpp | 5 +++-- src/preferences/time/ZoneView.cpp | 24 +++++++++++++----------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/preferences/time/TimeWindow.cpp b/src/preferences/time/TimeWindow.cpp index 8b226ee4ae..2c7c6e48d2 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 41ed9d4281..c773de5645 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(); } } -