Update layout building code in FileTypes preflet.
Signed-off-by: Alex Wilson <yourpalal2@gmail.com>
This commit is contained in:
parent
7d48219b47
commit
be887b8b13
@ -20,8 +20,6 @@
|
||||
#include <CheckBox.h>
|
||||
#include <ControlLook.h>
|
||||
#include <File.h>
|
||||
#include <GridLayoutBuilder.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <GroupView.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <ListView.h>
|
||||
@ -340,12 +338,11 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
|
||||
fBackgroundAppCheckBox = new BCheckBox("background",
|
||||
B_TRANSLATE("Background app"), new BMessage(kMsgAppFlagsChanged));
|
||||
|
||||
flagsBox->AddChild(BGridLayoutBuilder(0, 0)
|
||||
BLayoutBuilder::Grid<>(flagsBox, 0, 0)
|
||||
.SetInsets(padding, padding * 2, padding, padding)
|
||||
.Add(fSingleLaunchButton, 0, 0).Add(fArgsOnlyCheckBox, 1, 0)
|
||||
.Add(fMultipleLaunchButton, 0, 1).Add(fBackgroundAppCheckBox, 1, 1)
|
||||
.Add(fExclusiveLaunchButton, 0, 2)
|
||||
.SetInsets(padding, padding / 2, padding, padding)
|
||||
.View());
|
||||
.Add(fExclusiveLaunchButton, 0, 2);
|
||||
flagsBox->SetLabel(fFlagsCheckBox);
|
||||
|
||||
// "Icon" group
|
||||
@ -354,10 +351,9 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
|
||||
iconBox->SetLabel(B_TRANSLATE("Icon"));
|
||||
fIconView = new IconView("icon");
|
||||
fIconView->SetModificationMessage(new BMessage(kMsgIconChanged));
|
||||
iconBox->AddChild(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.Add(fIconView)
|
||||
.SetInsets(padding, padding, padding, padding)
|
||||
.TopView());
|
||||
BLayoutBuilder::Group<>(iconBox, B_HORIZONTAL)
|
||||
.SetInsets(padding, padding * 2, padding, padding)
|
||||
.Add(fIconView);
|
||||
|
||||
// "Supported Types" group
|
||||
|
||||
@ -382,16 +378,16 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
|
||||
iconHolder->AddChild(fTypeIconView);
|
||||
fTypeIconView->SetModificationMessage(new BMessage(kMsgTypeIconsChanged));
|
||||
|
||||
typeBox->AddChild(BGridLayoutBuilder(padding, padding)
|
||||
BLayoutBuilder::Grid<>(typeBox, padding, padding)
|
||||
.SetInsets(padding, padding * 2, padding, padding)
|
||||
.Add(scrollView, 0, 0, 1, 4)
|
||||
.Add(fAddTypeButton, 1, 0, 1, 2)
|
||||
.Add(fRemoveTypeButton, 1, 2, 1, 2)
|
||||
.Add(iconHolder, 2, 1, 1, 2)
|
||||
.SetInsets(padding, padding / 2, padding, padding)
|
||||
.SetColumnWeight(0, 3)
|
||||
.SetColumnWeight(1, 2)
|
||||
.SetColumnWeight(2, 1)
|
||||
.View());
|
||||
.SetColumnWeight(2, 1);
|
||||
|
||||
iconHolder->SetExplicitAlignment(
|
||||
BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE));
|
||||
|
||||
@ -456,7 +452,8 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
|
||||
fInternalVersionControl->TextView()->SetExplicitMinSize(
|
||||
BSize(width, fInternalVersionControl->MinSize().height));
|
||||
|
||||
versionBox->AddChild(BGridLayoutBuilder(padding / 2, padding / 2)
|
||||
BLayoutBuilder::Grid<>(versionBox, padding / 2, padding / 2)
|
||||
.SetInsets(padding, padding * 2, padding, padding)
|
||||
.Add(fMajorVersionControl->CreateLabelLayoutItem(), 0, 0)
|
||||
.Add(fMajorVersionControl->CreateTextViewLayoutItem(), 1, 0)
|
||||
.Add(fMiddleVersionControl, 2, 0, 2)
|
||||
@ -467,9 +464,7 @@ ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
|
||||
.Add(fShortDescriptionControl->CreateTextViewLayoutItem(), 1, 1, 10)
|
||||
.Add(longLabel, 0, 2)
|
||||
.Add(scrollView, 1, 2, 10, 3)
|
||||
.SetInsets(padding, padding / 2, padding, padding)
|
||||
.SetRowWeight(3, 3)
|
||||
.View());
|
||||
.SetRowWeight(3, 3);
|
||||
|
||||
// put it all together
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||
|
@ -17,8 +17,6 @@
|
||||
#include <Button.h>
|
||||
#include <Catalog.h>
|
||||
#include <ControlLook.h>
|
||||
#include <GridLayoutBuilder.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <Locale.h>
|
||||
#include <MenuField.h>
|
||||
@ -205,15 +203,14 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage& settings)
|
||||
fPathView->TextView()->SetExplicitAlignment(labelAlignment);
|
||||
fPathView->LabelView()->SetExplicitAlignment(labelAlignment);
|
||||
|
||||
infoBox->AddChild(BGridLayoutBuilder(padding, padding)
|
||||
BLayoutBuilder::Grid<>(infoBox, padding, padding)
|
||||
.SetInsets(padding, padding * 2, padding, padding)
|
||||
.Add(fNameView->LabelView(), 0, 0)
|
||||
.Add(fNameView->TextView(), 1, 0, 2)
|
||||
.Add(fSignatureView->LabelView(), 0, 1)
|
||||
.Add(fSignatureView->TextView(), 1, 1, 2)
|
||||
.Add(fPathView->LabelView(), 0, 2)
|
||||
.Add(fPathView->TextView(), 1, 2, 2)
|
||||
.SetInsets(padding, padding, padding, padding)
|
||||
.View());
|
||||
.Add(fPathView->TextView(), 1, 2, 2);
|
||||
|
||||
// "Version" group
|
||||
|
||||
@ -231,13 +228,12 @@ ApplicationTypesWindow::ApplicationTypesWindow(const BMessage& settings)
|
||||
fDescriptionView->SetLowColor(fDescriptionView->ViewColor());
|
||||
fDescriptionView->MakeEditable(false);
|
||||
|
||||
versionBox->AddChild(BGridLayoutBuilder(padding, padding)
|
||||
BLayoutBuilder::Grid<>(versionBox, padding, padding)
|
||||
.SetInsets(padding, padding * 2, padding, padding)
|
||||
.Add(fVersionView->LabelView(), 0, 0)
|
||||
.Add(fVersionView->TextView(), 1, 0)
|
||||
.Add(fDescriptionLabel->LabelView(), 0, 1)
|
||||
.Add(fDescriptionView, 1, 1, 2, 2)
|
||||
.SetInsets(padding, padding, padding, padding)
|
||||
.View());
|
||||
.Add(fDescriptionView, 1, 1, 2, 2);
|
||||
|
||||
// Launch and Tracker buttons
|
||||
|
||||
|
@ -13,8 +13,6 @@
|
||||
#include <Catalog.h>
|
||||
#include <CheckBox.h>
|
||||
#include <ControlLook.h>
|
||||
#include <GridLayoutBuilder.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <Locale.h>
|
||||
#include <MenuField.h>
|
||||
@ -254,7 +252,7 @@ AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
|
||||
.View())
|
||||
)
|
||||
.AddGroup(B_HORIZONTAL, padding)
|
||||
.Add(BSpaceLayoutItem::CreateGlue())
|
||||
.AddGlue()
|
||||
.Add(cancelButton)
|
||||
.Add(fAcceptButton);
|
||||
|
||||
|
@ -17,8 +17,6 @@
|
||||
#include <Catalog.h>
|
||||
#include <ControlLook.h>
|
||||
#include <File.h>
|
||||
#include <GridLayoutBuilder.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <Locale.h>
|
||||
#include <MenuField.h>
|
||||
@ -79,22 +77,20 @@ FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs)
|
||||
B_TRANSLATE_COMMENT("Same as" B_UTF8_ELLIPSIS,
|
||||
"The same TYPE as ..."), new BMessage(kMsgSameTypeAs));
|
||||
|
||||
fileTypeBox->AddChild(BGridLayoutBuilder(padding, padding)
|
||||
BLayoutBuilder::Grid<>(fileTypeBox, padding, padding)
|
||||
.SetInsets(padding, padding * 2, padding, padding)
|
||||
.Add(fTypeControl, 0, 0, 2, 1)
|
||||
.Add(fSelectTypeButton, 0, 1)
|
||||
.Add(fSameTypeAsButton, 1, 1)
|
||||
.SetInsets(padding, padding, padding, padding)
|
||||
.View());
|
||||
.Add(fSameTypeAsButton, 1, 1);
|
||||
|
||||
// "Icon" group
|
||||
|
||||
BBox* iconBox = new BBox("icon BBox");
|
||||
iconBox->SetLabel(B_TRANSLATE("Icon"));
|
||||
fIconView = new IconView("icon");
|
||||
iconBox->AddChild(BGroupLayoutBuilder(B_HORIZONTAL)
|
||||
.Add(fIconView)
|
||||
.SetInsets(padding, padding, padding, padding)
|
||||
.TopView());
|
||||
BLayoutBuilder::Group<>(iconBox, B_HORIZONTAL)
|
||||
.SetInsets(padding, padding * 2, padding, padding)
|
||||
.Add(fIconView);
|
||||
|
||||
// "Preferred Application" group
|
||||
|
||||
@ -118,15 +114,14 @@ FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs)
|
||||
"The same APPLICATION as ..."),
|
||||
new BMessage(kMsgSamePreferredAppAs));
|
||||
|
||||
preferredBox->AddChild(BGridLayoutBuilder(padding, padding)
|
||||
BLayoutBuilder::Grid<>(preferredBox, padding, padding)
|
||||
.SetInsets(padding, padding * 2, padding, padding)
|
||||
.Add(fPreferredField, 0, 0, 2, 1)
|
||||
.Add(fSelectAppButton, 0, 1)
|
||||
.Add(fSameAppAsButton, 1, 1)
|
||||
.SetInsets(padding, padding, padding, padding)
|
||||
.View());
|
||||
.Add(fSameAppAsButton, 1, 1);
|
||||
|
||||
BLayoutBuilder::Group<>(this, B_HORIZONTAL, padding)
|
||||
.SetInsets(padding, padding, padding, padding)
|
||||
.SetInsets(padding)
|
||||
.AddGroup(B_VERTICAL, padding)
|
||||
.Add(fileTypeBox)
|
||||
.Add(preferredBox)
|
||||
|
@ -24,8 +24,6 @@
|
||||
#include <Button.h>
|
||||
#include <Catalog.h>
|
||||
#include <ControlLook.h>
|
||||
#include <GridLayoutBuilder.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <ListView.h>
|
||||
#include <Locale.h>
|
||||
@ -404,12 +402,11 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
|
||||
fIconView = new TypeIconView("icon");
|
||||
fIconBox = new BBox("Icon BBox");
|
||||
fIconBox->SetLabel(B_TRANSLATE("Icon"));
|
||||
fIconBox->AddChild(BGroupLayoutBuilder(B_VERTICAL, padding)
|
||||
.Add(BSpaceLayoutItem::CreateGlue(), 1)
|
||||
BLayoutBuilder::Group<>(fIconBox, B_VERTICAL, padding)
|
||||
.SetInsets(padding)
|
||||
.AddGlue(1)
|
||||
.Add(fIconView, 3)
|
||||
.Add(BSpaceLayoutItem::CreateGlue(), 1)
|
||||
.SetInsets(padding, padding, padding, padding)
|
||||
.TopView());
|
||||
.AddGlue(1);
|
||||
|
||||
// "File Recognition" group
|
||||
|
||||
@ -443,16 +440,13 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
|
||||
fRuleControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
|
||||
fRuleControl->Hide();
|
||||
|
||||
BGridView* recognitionBoxGrid = new BGridView(padding, padding / 2);
|
||||
BGridLayoutBuilder(recognitionBoxGrid)
|
||||
BLayoutBuilder::Grid<>(fRecognitionBox, padding, padding / 2)
|
||||
.SetInsets(padding, padding * 2, padding, padding)
|
||||
.Add(fExtensionLabel->LabelView(), 0, 0)
|
||||
.Add(scrollView, 0, 1, 2, 3)
|
||||
.Add(scrollView, 0, 1, 2, 2)
|
||||
.Add(fAddExtensionButton, 2, 1)
|
||||
.Add(fRemoveExtensionButton, 2, 2)
|
||||
.Add(fRuleControl, 0, 4, 3, 1)
|
||||
.SetInsets(padding, padding, padding, padding);
|
||||
|
||||
fRecognitionBox->AddChild(recognitionBoxGrid);
|
||||
.Add(fRuleControl, 0, 3, 3, 1);
|
||||
|
||||
// "Description" group
|
||||
|
||||
@ -467,15 +461,14 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
|
||||
fDescriptionControl = new BTextControl("description",
|
||||
B_TRANSLATE("Description:"), "", new BMessage(kMsgDescriptionEntered));
|
||||
|
||||
fDescriptionBox->AddChild(BGridLayoutBuilder(padding / 2, padding / 2)
|
||||
BLayoutBuilder::Grid<>(fDescriptionBox, padding / 2, padding / 2)
|
||||
.SetInsets(padding, padding * 2, padding, padding)
|
||||
.Add(fInternalNameView->LabelView(), 0, 0)
|
||||
.Add(fInternalNameView->TextView(), 1, 0)
|
||||
.Add(fTypeNameControl->CreateLabelLayoutItem(), 0, 1)
|
||||
.Add(fTypeNameControl->CreateTextViewLayoutItem(), 1, 1, 2)
|
||||
.Add(fDescriptionControl->CreateLabelLayoutItem(), 0, 2)
|
||||
.Add(fDescriptionControl->CreateTextViewLayoutItem(), 1, 2, 2)
|
||||
.SetInsets(padding, padding, padding, padding)
|
||||
.View());
|
||||
.Add(fDescriptionControl->CreateTextViewLayoutItem(), 1, 2, 2);
|
||||
|
||||
// "Preferred Application" group
|
||||
|
||||
@ -496,12 +489,11 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
|
||||
B_TRANSLATE("Same as" B_UTF8_ELLIPSIS),
|
||||
new BMessage(kMsgSamePreferredAppAs));
|
||||
|
||||
fPreferredBox->AddChild(BGroupLayoutBuilder(B_HORIZONTAL, padding)
|
||||
BLayoutBuilder::Group<>(fPreferredBox, B_HORIZONTAL, padding)
|
||||
.SetInsets(padding, padding * 2, padding, padding)
|
||||
.Add(fPreferredField)
|
||||
.Add(fSelectButton)
|
||||
.Add(fSameAsButton)
|
||||
.SetInsets(padding, padding, padding, padding)
|
||||
.TopView());
|
||||
.Add(fSameAsButton);
|
||||
|
||||
// "Extra Attributes" group
|
||||
|
||||
@ -536,23 +528,22 @@ FileTypesWindow::FileTypesWindow(const BMessage& settings)
|
||||
BScrollView* attributesScroller = new BScrollView("scrollview attr",
|
||||
fAttributeListView, B_FRAME_EVENTS | B_WILL_DRAW, false, true);
|
||||
|
||||
fAttributeBox->AddChild(BGroupLayoutBuilder(B_HORIZONTAL, padding)
|
||||
BLayoutBuilder::Group<>(fAttributeBox, B_HORIZONTAL, padding)
|
||||
.SetInsets(padding, padding * 2, padding, padding)
|
||||
.Add(attributesScroller, 1.0f)
|
||||
.AddGroup(B_VERTICAL, padding / 2, 0.0f)
|
||||
.SetInsets(0)
|
||||
.Add(fAddAttributeButton)
|
||||
.Add(fRemoveAttributeButton)
|
||||
.AddStrut(padding)
|
||||
.Add(fMoveUpAttributeButton)
|
||||
.Add(fMoveDownAttributeButton)
|
||||
.AddGlue()
|
||||
.End()
|
||||
.SetInsets(padding, padding, padding, padding)
|
||||
.TopView());
|
||||
.AddGlue();
|
||||
|
||||
fMainSplitView = new BSplitView(B_HORIZONTAL, floorf(padding / 2));
|
||||
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
||||
.SetInsets(0, 0, 0, 0)
|
||||
.SetInsets(0)
|
||||
.Add(menuBar)
|
||||
.AddGroup(B_HORIZONTAL, 0)
|
||||
.SetInsets(padding, padding, padding, padding)
|
||||
|
@ -11,8 +11,7 @@
|
||||
#include <Button.h>
|
||||
#include <Catalog.h>
|
||||
#include <ControlLook.h>
|
||||
#include <GroupLayout.h>
|
||||
#include <GridLayoutBuilder.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <Locale.h>
|
||||
#include <MenuBar.h>
|
||||
#include <MenuField.h>
|
||||
@ -94,9 +93,8 @@ NewFileTypeWindow::NewFileTypeWindow(FileTypesWindow* target,
|
||||
|
||||
float padding = be_control_look->DefaultItemSpacing();
|
||||
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
AddChild(BGridLayoutBuilder(padding, padding)
|
||||
.SetInsets(padding, padding, padding, padding)
|
||||
BLayoutBuilder::Grid<>(this, padding, padding)
|
||||
.SetInsets(padding)
|
||||
.Add(typesMenuLabel, 0, 0)
|
||||
.Add(typesMenuField, 1, 0, 2)
|
||||
.Add(fNameControl->CreateLabelLayoutItem(), 0, 1)
|
||||
@ -105,7 +103,7 @@ NewFileTypeWindow::NewFileTypeWindow(FileTypesWindow* target,
|
||||
.Add(new BButton(B_TRANSLATE("Cancel"),
|
||||
new BMessage(B_QUIT_REQUESTED)), 1, 2)
|
||||
.Add(fAddButton, 2, 2)
|
||||
.SetColumnWeight(0, 3));
|
||||
.SetColumnWeight(0, 3);
|
||||
|
||||
BAlignment fullSize = BAlignment(B_ALIGN_USE_FULL_WIDTH,
|
||||
B_ALIGN_USE_FULL_HEIGHT);
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <Button.h>
|
||||
#include <Catalog.h>
|
||||
#include <ControlLook.h>
|
||||
#include <GroupLayoutBuilder.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <Locale.h>
|
||||
#include <ScrollView.h>
|
||||
|
||||
@ -52,15 +52,12 @@ TypeListWindow::TypeListWindow(const char* currentType, uint32 what,
|
||||
BScrollView* scrollView = new BScrollView("scrollview", fListView,
|
||||
B_FRAME_EVENTS | B_WILL_DRAW, false, true);
|
||||
|
||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||
AddChild(BGroupLayoutBuilder(B_VERTICAL, padding)
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL, padding)
|
||||
.SetInsets(padding)
|
||||
.Add(scrollView)
|
||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, padding)
|
||||
.AddGroup(B_HORIZONTAL, padding)
|
||||
.Add(button)
|
||||
.Add(fSelectButton)
|
||||
)
|
||||
.SetInsets(padding, padding, padding, padding)
|
||||
);
|
||||
.Add(fSelectButton);
|
||||
|
||||
BAlignment buttonAlignment =
|
||||
BAlignment(B_ALIGN_USE_FULL_WIDTH, B_ALIGN_VERTICAL_CENTER);
|
||||
|
Loading…
Reference in New Issue
Block a user