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.
This commit is contained in:
John Scipione 2012-11-23 18:33:07 -05:00
parent 7c3985c617
commit f496c69cb5
2 changed files with 16 additions and 13 deletions

View File

@ -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);
}

View File

@ -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();
}
}