Aligned strings and sliders by pushing them a few pixels here and there. But really, the whole app is in need of proper layouting using the layout API...

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41208 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Joachim Seemer 2011-04-09 12:34:32 +00:00
parent fe02d18b1d
commit a4cf8811e5

View File

@ -683,8 +683,20 @@ ScreenSaverWindow::_SetupFadeTab(BRect rect)
{ {
fFadeView = new FadeView(rect, B_TRANSLATE("General"), fSettings); fFadeView = new FadeView(rect, B_TRANSLATE("General"), fSettings);
float labelWidth = be_plain_font->StringWidth(B_TRANSLATE("Turn off " float StringWidth1 = be_plain_font->StringWidth(B_TRANSLATE
"screen")) + 20.0f; ("Start screensaver"));
float StringWidth2 = be_plain_font->StringWidth(B_TRANSLATE
("Turn off screen"));
float StringWidth3 = be_plain_font->StringWidth(B_TRANSLATE
("Password lock"));
float labelWidth = StringWidth1;
if (labelWidth < StringWidth2)
labelWidth = StringWidth2;
if (labelWidth < StringWidth3)
labelWidth = StringWidth3;
labelWidth += 20.0f;
font_height fontHeight; font_height fontHeight;
be_plain_font->GetHeight(&fontHeight); be_plain_font->GetHeight(&fontHeight);
@ -704,8 +716,8 @@ ScreenSaverWindow::_SetupFadeTab(BRect rect)
box->SetLabel(fEnableCheckBox); box->SetLabel(fEnableCheckBox);
fFadeView->AddChild(box); fFadeView->AddChild(box);
// Run Module // Start Screensaver
rect.left += radioButtonOffset; rect.left += radioButtonOffset + 6;
rect.top = fEnableCheckBox->Bounds().bottom + 8.0f; rect.top = fEnableCheckBox->Bounds().bottom + 8.0f;
rect.right = box->Bounds().right - 8; rect.right = box->Bounds().right - 8;
BStringView* stringView = new BStringView(rect, NULL, BStringView* stringView = new BStringView(rect, NULL,
@ -713,7 +725,7 @@ ScreenSaverWindow::_SetupFadeTab(BRect rect)
stringView->ResizeToPreferred(); stringView->ResizeToPreferred();
box->AddChild(stringView); box->AddChild(stringView);
rect.left += labelWidth; rect.left += labelWidth - 4;
fRunSlider = new TimeSlider(rect, "RunSlider", kMsgRunSliderChanged, fRunSlider = new TimeSlider(rect, "RunSlider", kMsgRunSliderChanged,
kMsgRunSliderUpdate); kMsgRunSliderUpdate);
float width, height; float width, height;
@ -722,13 +734,14 @@ ScreenSaverWindow::_SetupFadeTab(BRect rect)
box->AddChild(fRunSlider); box->AddChild(fRunSlider);
// Turn Off // Turn Off
rect.left = 8; rect.left = 10;
rect.OffsetBy(0, fRunSlider->Bounds().Height() + 4.0f); rect.OffsetBy(0, fRunSlider->Bounds().Height() + 4.0f);
fTurnOffCheckBox = new BCheckBox(rect, "TurnOffScreenCheckBox", fTurnOffCheckBox = new BCheckBox(rect, "TurnOffScreenCheckBox",
B_TRANSLATE("Turn off screen"), new BMessage(kMsgTurnOffCheckBox)); B_TRANSLATE("Turn off screen"), new BMessage(kMsgTurnOffCheckBox));
fTurnOffCheckBox->ResizeToPreferred(); fTurnOffCheckBox->ResizeToPreferred();
box->AddChild(fTurnOffCheckBox); box->AddChild(fTurnOffCheckBox);
rect.top += 3;
rect.left += radioButtonOffset + labelWidth; rect.left += radioButtonOffset + labelWidth;
fTurnOffSlider = new TimeSlider(rect, "TurnOffSlider", fTurnOffSlider = new TimeSlider(rect, "TurnOffSlider",
kMsgTurnOffSliderChanged, kMsgTurnOffSliderUpdate); kMsgTurnOffSliderChanged, kMsgTurnOffSliderUpdate);
@ -751,13 +764,14 @@ ScreenSaverWindow::_SetupFadeTab(BRect rect)
box->AddChild(fTurnOffNotSupported); box->AddChild(fTurnOffNotSupported);
// Password // Password
rect.left = 8; rect.left = 10;
rect.OffsetBy(0, fTurnOffSlider->Bounds().Height() + 4.0f); rect.OffsetBy(0, fTurnOffSlider->Bounds().Height() + 4.0f);
fPasswordCheckBox = new BCheckBox(rect, "PasswordCheckbox", fPasswordCheckBox = new BCheckBox(rect, "PasswordCheckbox",
B_TRANSLATE("Password lock"), new BMessage(kMsgPasswordCheckBox)); B_TRANSLATE("Password lock"), new BMessage(kMsgPasswordCheckBox));
fPasswordCheckBox->ResizeToPreferred(); fPasswordCheckBox->ResizeToPreferred();
box->AddChild(fPasswordCheckBox); box->AddChild(fPasswordCheckBox);
rect.top += 3;
rect.left += radioButtonOffset + labelWidth; rect.left += radioButtonOffset + labelWidth;
fPasswordSlider = new TimeSlider(rect, "PasswordSlider", fPasswordSlider = new TimeSlider(rect, "PasswordSlider",
kMsgPasswordSliderChanged, kMsgPasswordSliderUpdate); kMsgPasswordSliderChanged, kMsgPasswordSliderUpdate);
@ -777,7 +791,7 @@ ScreenSaverWindow::_SetupFadeTab(BRect rect)
float monitorHeight = 10 + textHeight * 3; float monitorHeight = 10 + textHeight * 3;
float monitorWidth = monitorHeight * 4 / 3; float monitorWidth = monitorHeight * 4 / 3;
rect.left = 15; rect.left = 11;
rect.top = box->Bounds().Height() - 15 - monitorHeight; rect.top = box->Bounds().Height() - 15 - monitorHeight;
rect.right = rect.left + monitorWidth; rect.right = rect.left + monitorWidth;
rect.bottom = rect.top + monitorHeight; rect.bottom = rect.top + monitorHeight;