Revert "Backgrounds: Resize menu fields to preferred width."

This reverts commit 19d9ad49ae.
This commit is contained in:
John Scipione 2013-05-31 15:22:26 -04:00
parent e339efbfef
commit 2f5349a40a
2 changed files with 24 additions and 40 deletions

View File

@ -1,11 +1,10 @@
/*
* Copyright 2002-2013 Haiku, Inc. All Rights Reserved.
* Copyright 2002-2009, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Jerome Duval (jerome.duval@free.fr)
* Axel Dörfler, axeld@pinc-software.de
* Jerome Duval, jerome.duval@free.fr
* John Scipione, jscipione@gmail.com
* Jonas Sundström, jonas@kirilla.se
*/
@ -24,6 +23,7 @@
#include <FindDirectory.h>
#include <LayoutBuilder.h>
#include <Locale.h>
#include <MenuField.h>
#include <Messenger.h>
#include <MimeType.h>
#include <Point.h>
@ -163,8 +163,9 @@ BackgroundsView::BackgroundsView()
fImageMenu->AddItem(new BMenuItem(B_TRANSLATE("Other" B_UTF8_ELLIPSIS),
new BMessage(kMsgOtherImage)));
fImageMenuField = new BMenuField(NULL, fImageMenu);
fImageMenuField->SetAlignment(B_ALIGN_RIGHT);
BMenuField* imageMenuField = new BMenuField(NULL, fImageMenu);
imageMenuField->SetAlignment(B_ALIGN_RIGHT);
imageMenuField->ResizeToPreferred();
fPlacementMenu = new BPopUpMenu(B_TRANSLATE("pick one"));
fPlacementMenu->AddItem(new BMenuItem(B_TRANSLATE("Manual"),
@ -176,8 +177,8 @@ BackgroundsView::BackgroundsView()
fPlacementMenu->AddItem(new BMenuItem(B_TRANSLATE("Tile"),
new BMessage(kMsgTilePlacement)));
fPlacementMenuField = new BMenuField(NULL, fPlacementMenu);
fPlacementMenuField->SetAlignment(B_ALIGN_RIGHT);
BMenuField* placementMenuField = new BMenuField(NULL, fPlacementMenu);
placementMenuField->SetAlignment(B_ALIGN_RIGHT);
fIconLabelOutline = new BCheckBox(B_TRANSLATE("Icon label outline"),
new BMessage(kMsgIconLabelOutline));
@ -197,18 +198,18 @@ BackgroundsView::BackgroundsView()
B_ALIGN_NO_VERTICAL));
view = BLayoutBuilder::Group<>()
.AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING)
.AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING)
.AddGrid(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING)
.AddGroup(B_VERTICAL, 10)
.AddGroup(B_VERTICAL, 10)
.AddGrid(10, 10)
.Add(imageStringView, 0, 0)
.Add(fImageMenuField, 1, 0)
.Add(placementStringView, 0, 1)
.Add(fPlacementMenuField, 1, 1)
.Add(fIconLabelOutline, 1, 2)
.Add(imageMenuField, 1, 0)
.Add(placementMenuField, 1, 1)
.End()
.Add(fIconLabelOutline)
.End()
.Add(fPicker)
.SetInsets(B_USE_DEFAULT_SPACING)
.SetInsets(10, 10, 10, 10)
.End()
.View();
@ -316,10 +317,13 @@ BackgroundsView::MessageReceived(BMessage* msg)
}
case kMsgManualPlacement:
_UpdatePreview();
_UpdateButtons();
break;
case kMsgTilePlacement:
case kMsgScalePlacement:
case kMsgCenterPlacement:
fPlacementMenuField->ResizeToPreferred();
_UpdatePreview();
_UpdateButtons();
break;
@ -385,8 +389,6 @@ BackgroundsView::MessageReceived(BMessage* msg)
case kMsgNoImage:
fLastImageIndex = ((BGImageMenuItem*)fImageMenu->FindMarked())
->ImageIndex();
fImageMenuField->ResizeToPreferred();
fPlacementMenuField->ResizeToPreferred();
_UpdatePreview();
_UpdateButtons();
break;
@ -828,19 +830,6 @@ BackgroundsView::_LoadSettings()
}
void
BackgroundsView::WindowActivated(bool active)
{
static bool firstRun = true;
if (firstRun) {
firstRun = false;
fImageMenuField->ResizeToPreferred();
fPlacementMenuField->ResizeToPreferred();
}
}
void
BackgroundsView::WorkspaceActivated(uint32 oldWorkspaces, bool active)
{

View File

@ -1,10 +1,9 @@
/*
* Copyright 2002-2013 Haiku, Inc. All Rights Reserved.
* Copyright 2002-2009, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Jerome Duval, jerome.duval@free.fr
* John Scipione, jscipione@gmail.com
* Jerome Duval (jerome.duval@free.fr)
*/
#ifndef BACKGROUNDS_VIEW_H
#define BACKGROUNDS_VIEW_H
@ -19,7 +18,6 @@
#include <Entry.h>
#include <FilePanel.h>
#include <Menu.h>
#include <MenuField.h>
#include <MenuItem.h>
#include <Message.h>
#include <Picture.h>
@ -112,7 +110,6 @@ public:
void RefsReceived(BMessage* msg);
void SaveSettings();
void WindowActivated(bool active);
void WorkspaceActivated(uint32 oldWorkspaces,
bool active);
int32 AddImage(BPath path);
@ -145,12 +142,10 @@ protected:
BColorControl* fPicker;
BButton* fApply;
BButton* fRevert;
BMenu* fWorkspaceMenu;
BMenu* fPlacementMenu;
BMenuField* fPlacementMenuField;
BMenu* fImageMenu;
BMenuField* fImageMenuField;
BCheckBox* fIconLabelOutline;
BMenu* fPlacementMenu;
BMenu* fImageMenu;
BMenu* fWorkspaceMenu;
BTextControl* fXPlacementText;
BTextControl* fYPlacementText;
Preview* fPreview;