void
DataTranslationsWindow::_ShowInfoView()
{
	if (fConfigView != NULL) {
		fRightBox->RemoveChild(fConfigView);
		delete fConfigView;
		fConfigView = NULL;
		fInfoText = NULL;
		if (fRelease != NULL) {
			fRelease->Release();
			fRelease = NULL;
		}
	}

	fInfoText = new BTextView("info text");
	fInfoText->MakeEditable(false);
	fInfoText->MakeSelectable(false);
	fInfoText->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
	fInfoText->SetText(B_TRANSLATE(
		"Use this control panel to set default values for translators, "
		"to be used when no other settings are specified by an application."));
	rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR);
	fInfoText->SetFontAndColor(be_plain_font, B_FONT_ALL, &textColor);

	BGroupView* group = new BGroupView(B_VERTICAL);
	group->AddChild(fInfoText);
	float spacing = be_control_look->DefaultItemSpacing();
	group->GroupLayout()->SetInsets(spacing, spacing, spacing, spacing);
	fRightBox->AddChild(group);
	fConfigView = group;
}
void
DataTranslationsWindow::_ShowInfoView()
{
	if (fConfigView) {
		fRightBox->RemoveChild(fConfigView);
		delete fConfigView;
		fConfigView = NULL;
	}

	BTextView* view = new BTextView("info text");
	view->MakeEditable(false);
	view->MakeSelectable(false);
	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	view->SetText(B_TRANSLATE(
		"Use this control panel to set default values for translators, "
		"to be used when no other settings are specified by an application."));

	BGroupView* group = new BGroupView(B_VERTICAL);
	group->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	group->AddChild(view);
	float spacing = be_control_look->DefaultItemSpacing();
	group->GroupLayout()->SetInsets(spacing, spacing, spacing, spacing);
	fRightBox->AddChild(group);
	fConfigView = group;
}
Beispiel #3
0
bool
ResultWindow::AddLocationChanges(const char* location,
	const PackageList& packagesToInstall,
	const PackageSet& packagesAlreadyAdded,
	const PackageList& packagesToUninstall,
	const PackageSet& packagesAlreadyRemoved)
{
	BGroupView* locationGroup = new BGroupView(B_VERTICAL);
	ObjectDeleter<BGroupView> locationGroupDeleter(locationGroup);

	locationGroup->GroupLayout()->SetInsets(B_USE_SMALL_INSETS);

	rgb_color background = ui_color(B_LIST_BACKGROUND_COLOR);
	if ((fContainerView->CountChildren() & 1) != 0)
		background = tint_color(background, 1.04);
	locationGroup->SetViewColor(background);

	BStringView* locationView = new BStringView(NULL,
		BString().SetToFormat("in %s:", location));
	locationGroup->AddChild(locationView);
	locationView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
	BFont locationFont;
	locationView->GetFont(&locationFont);
	locationFont.SetFace(B_BOLD_FACE);
	locationView->SetFont(&locationFont);

	BGroupLayout* packagesGroup = new BGroupLayout(B_VERTICAL);
	locationGroup->GroupLayout()->AddItem(packagesGroup);
	packagesGroup->SetInsets(20, 0, 0, 0);

	bool packagesAdded = _AddPackages(packagesGroup, packagesToInstall,
		packagesAlreadyAdded, true);
	packagesAdded |= _AddPackages(packagesGroup, packagesToUninstall,
		packagesAlreadyRemoved, false);

	if (!packagesAdded)
		return false;

	fContainerView->AddChild(locationGroup);
	locationGroupDeleter.Detach();

	return true;
}
Beispiel #4
0
NetworkView::NetworkView()
	:
	BView("NetworkView", 0, NULL)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));


	// build the GUI
	BGroupLayout* rootLayout = new BGroupLayout(B_VERTICAL);
	SetLayout(rootLayout);

	//BGridView* controlsGroup = new BGridView();
	//BGridLayout* layout = controlsGroup->GridLayout();

	// insets
	/*
	float inset = ceilf(be_plain_font->Size() * 0.7);
	rootLayout->SetInsets(inset, inset, inset, inset);
	rootLayout->SetSpacing(inset);
	layout->SetSpacing(inset, inset);
	*/
	// available network lists



	// button group
	BGroupView* buttonGroup = new BGroupView(B_HORIZONTAL);

	fRefreshButton = new BButton(B_TRANSLATE("Refresh"),
		new BMessage(kMsgRefresh));
	fRefreshButton->SetEnabled(false);
	buttonGroup->GroupLayout()->AddView(fRefreshButton);

	buttonGroup->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue());

	fNewNetworkButton = new BButton(B_TRANSLATE("New Network"), new BMessage(kMsgNewNetwork));
	fNewNetworkButton->SetEnabled(false);
	buttonGroup->GroupLayout()->AddView(fNewNetworkButton);

	//rootLayout->AddView(controlsGroup);
	rootLayout->AddView(buttonGroup);
}
Beispiel #5
0
Window::Window()
	:
	BWindow(BRect(100, 100, 520, 430), "ToolTip-Test",
		B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
{
	BView* simple = new BStringView("1", "Simple Tool Tip");
	simple->SetToolTip("This is a really\nsimple tool tip!");

	BView* custom = new BStringView("2", "Custom Tool Tip");
	custom->SetToolTip(new CustomToolTip("Custom tool tip!"));

	BView* changing = new BStringView("3", "Changing Tool Tip");
	changing->SetToolTip(new ChangingToolTip());

	BView* mouse = new BStringView("4", "Mouse Tool Tip (sticky)");
	mouse->SetToolTip(new MouseToolTip());

	BView* immediate = new ImmediateView("5", "Immediate Tool Tip (sticky)");

	BView* pulseString = new PulseStringView("pulseString",
		"Periodically changing tool tip text");

	BView* pulseToolTip = new PulseToolTipView("pulseToolTip",
		"Periodically changing tool tip");

	BGroupView* nested = new BGroupView();
	nested->SetViewColor(50, 50, 90);
	nested->GroupLayout()->SetInsets(30);
	nested->SetToolTip("The outer view has a tool tip,\n"
		"the inner one doesn't.");
	nested->AddChild(new BGroupView("inner"));

	BLayoutBuilder::Group<>(this, B_HORIZONTAL)
		.SetInsets(B_USE_DEFAULT_SPACING)
		.AddGroup(B_VERTICAL)
			.Add(simple)
			.Add(custom)
			.Add(changing)
			.Add(mouse)
			.Add(immediate)
			.End()
		.AddGroup(B_VERTICAL)
			.Add(pulseString)
			.Add(pulseToolTip)
			.Add(nested);

	SetPulseRate(1000000LL);
}
Beispiel #6
0
// AddGroup
BGroupLayoutBuilder&
BGroupLayoutBuilder::AddGroup(enum orientation orientation,
	float spacing, float weight)
{
	if (BGroupLayout* layout = TopLayout()) {
		BGroupView* group = new(nothrow) BGroupView(orientation, spacing);
		if (group) {
			if (layout->AddView(group, weight))
				_PushLayout(group->GroupLayout());
			else
				delete group;
		}
	}

	return *this;
}
Beispiel #7
0
ExtendedInfoWindow::ExtendedInfoWindow(PowerStatusDriverInterface* interface)
	:
	BWindow(BRect(100, 150, 500, 500), "Extended battery info", B_TITLED_WINDOW,
		B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AVOID_FRONT |
		B_ASYNCHRONOUS_CONTROLS),
	fDriverInterface(interface),
	fSelectedView(NULL)
{
	fDriverInterface->AcquireReference();

	BView *view = new BView(Bounds(), "view", B_FOLLOW_ALL, 0);
	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(view);

	BGroupLayout* mainLayout = new BGroupLayout(B_VERTICAL);
	mainLayout->SetSpacing(10);
	mainLayout->SetInsets(10, 10, 10, 10);
	view->SetLayout(mainLayout);

	BRect rect = Bounds();
	rect.InsetBy(5, 5);
	BBox *infoBox = new BBox(rect, "Power status box");
	infoBox->SetLabel("Battery info");
	BGroupLayout* infoLayout = new BGroupLayout(B_HORIZONTAL);
	infoLayout->SetInsets(10, infoBox->TopBorderOffset() * 2 + 10, 10, 10);
	infoLayout->SetSpacing(10);
	infoBox->SetLayout(infoLayout);
	mainLayout->AddView(infoBox);

	BGroupView* batteryView = new BGroupView(B_VERTICAL);
	batteryView->GroupLayout()->SetSpacing(10);
	infoLayout->AddView(batteryView);

	// create before the battery views
	fBatteryInfoView = new BatteryInfoView();

	BGroupLayout* batteryLayout = batteryView->GroupLayout();
	BRect batteryRect(0, 0, 50, 30);
	for (int i = 0; i < interface->GetBatteryCount(); i++) {
		ExtPowerStatusView* view = new ExtPowerStatusView(interface,
			batteryRect, B_FOLLOW_NONE, i, this);
		view->SetExplicitMaxSize(BSize(70, 80));
		view->SetExplicitMinSize(BSize(70, 80));

		batteryLayout->AddView(view);
		fBatteryViewList.AddItem(view);
		fDriverInterface->StartWatching(view);
		if (!view->IsCritical())
			fSelectedView = view;
	}

	batteryLayout->AddItem(BSpaceLayoutItem::CreateGlue());

	infoLayout->AddView(fBatteryInfoView);

	if (!fSelectedView && fBatteryViewList.CountItems() > 0)
		fSelectedView = fBatteryViewList.ItemAt(0);
	fSelectedView->Select();

	BSize size = mainLayout->PreferredSize();
	ResizeTo(size.width, size.height);
}
Beispiel #8
0
	KeyRequestView()
		:
		BView("KeyRequestView", B_WILL_DRAW),
		fPassword(NULL)
	{
		SetViewUIColor(B_PANEL_BACKGROUND_COLOR);

		BGroupLayout* rootLayout = new(std::nothrow) BGroupLayout(B_VERTICAL);
		if (rootLayout == NULL)
			return;

		SetLayout(rootLayout);

		BGridView* controls = new(std::nothrow) BGridView();
		if (controls == NULL)
			return;

		BGridLayout* layout = controls->GridLayout();

		float inset = ceilf(be_plain_font->Size() * 0.7);
		rootLayout->SetInsets(inset, inset, inset, inset);
		rootLayout->SetSpacing(inset);
		layout->SetSpacing(inset, inset);

		BStringView* label = new(std::nothrow) BStringView("keyringLabel",
			B_TRANSLATE("Keyring:"));
		if (label == NULL)
			return;

		int32 row = 0;
		layout->AddView(label, 0, row);

		fKeyringName = new(std::nothrow) BStringView("keyringName", "");
		if (fKeyringName == NULL)
			return;

		layout->AddView(fKeyringName, 1, row++);

		fPassword = new(std::nothrow) BTextControl(B_TRANSLATE("Password:"******"", NULL);
		if (fPassword == NULL)
			return;

		BLayoutItem* layoutItem = fPassword->CreateTextViewLayoutItem();
		layoutItem->SetExplicitMinSize(BSize(fPassword->StringWidth(
				"0123456789012345678901234567890123456789") + inset,
			B_SIZE_UNSET));

		layout->AddItem(fPassword->CreateLabelLayoutItem(), 0, row);
		layout->AddItem(layoutItem, 1, row++);

		BGroupView* buttons = new(std::nothrow) BGroupView(B_HORIZONTAL);
		if (buttons == NULL)
			return;

		fCancelButton = new(std::nothrow) BButton(B_TRANSLATE("Cancel"),
			new BMessage(kMessageCancel));
		buttons->GroupLayout()->AddView(fCancelButton);

		buttons->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue());

		fUnlockButton = new(std::nothrow) BButton(B_TRANSLATE("Unlock"),
			new BMessage(kMessageUnlock));
		buttons->GroupLayout()->AddView(fUnlockButton);

		BTextView* message = new(std::nothrow) BTextView("message");
		message->SetText(B_TRANSLATE("An application wants to access the "
			"keyring below, but it is locked with a passphrase. Please enter "
			"the passphrase to unlock the keyring.\n"
			"If you unlock the keyring, it stays unlocked until the system is "
			"shut down or the keyring is manually locked again.\n"
			"If you cancel this dialog the keyring will remain locked."));
		message->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
		rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR);
		message->SetFontAndColor(be_plain_font, B_FONT_ALL, &textColor);
		message->MakeEditable(false);
		message->MakeSelectable(false);
		message->SetWordWrap(true);

		rootLayout->AddView(message);
		rootLayout->AddView(controls);
		rootLayout->AddView(buttons);
	}
Beispiel #9
0
void
MainWindow::_CreateGUI()
{
    SetLayout(new BGroupLayout(B_HORIZONTAL));

    BGridLayout* layout = new BGridLayout();
    layout->SetSpacing(0, 0);
    BView* rootView = new BView("root view", 0, layout);
    AddChild(rootView);
    rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

    BGroupView* leftTopView = new BGroupView(B_VERTICAL, 0);
    layout->AddView(leftTopView, 0, 0);

    // views along the left side
    leftTopView->AddChild(_CreateMenuBar());

    float splitWidth = 13 * be_plain_font->Size();
    BSize minSize = leftTopView->MinSize();
    splitWidth = std::max(splitWidth, minSize.width);
    leftTopView->SetExplicitMaxSize(BSize(splitWidth, B_SIZE_UNSET));
    leftTopView->SetExplicitMinSize(BSize(splitWidth, B_SIZE_UNSET));

    BGroupView* iconPreviews = new BGroupView(B_HORIZONTAL);
    iconPreviews->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    iconPreviews->GroupLayout()->SetSpacing(5);

    // icon previews
    fIconPreview16Folder = new IconView(BRect(0, 0, 15, 15),
                                        "icon preview 16 folder");
    fIconPreview16Menu = new IconView(BRect(0, 0, 15, 15),
                                      "icon preview 16 menu");
    fIconPreview16Menu->SetLowColor(ui_color(B_MENU_BACKGROUND_COLOR));

    fIconPreview32Folder = new IconView(BRect(0, 0, 31, 31),
                                        "icon preview 32 folder");
    fIconPreview32Desktop = new IconView(BRect(0, 0, 31, 31),
                                         "icon preview 32 desktop");
    fIconPreview32Desktop->SetLowColor(ui_color(B_DESKTOP_COLOR));

    fIconPreview64 = new IconView(BRect(0, 0, 63, 63), "icon preview 64");
    fIconPreview64->SetLowColor(ui_color(B_DESKTOP_COLOR));


    BGroupView* smallPreviews = new BGroupView(B_VERTICAL);
    smallPreviews->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    smallPreviews->GroupLayout()->SetSpacing(5);

    smallPreviews->AddChild(fIconPreview16Folder);
    smallPreviews->AddChild(fIconPreview16Menu);

    BGroupView* mediumPreviews = new BGroupView(B_VERTICAL);
    mediumPreviews->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    mediumPreviews->GroupLayout()->SetSpacing(5);

    mediumPreviews->AddChild(fIconPreview32Folder);
    mediumPreviews->AddChild(fIconPreview32Desktop);

//	iconPreviews->AddChild(fIconPreview48);

    iconPreviews->AddChild(smallPreviews);
    iconPreviews->AddChild(mediumPreviews);
    iconPreviews->AddChild(fIconPreview64);
    iconPreviews->SetExplicitMaxSize(BSize(B_SIZE_UNSET, B_SIZE_UNLIMITED));

    leftTopView->AddChild(iconPreviews);


    BGroupView* leftSideView = new BGroupView(B_VERTICAL, 0);
    layout->AddView(leftSideView, 0, 1);
    leftSideView->SetExplicitMaxSize(BSize(splitWidth, B_SIZE_UNSET));

    // path menu and list view
    BMenuBar* menuBar = new BMenuBar("path menu bar");
    menuBar->AddItem(fPathMenu);
    leftSideView->AddChild(menuBar);

    fPathListView = new PathListView(BRect(0, 0, splitWidth, 100),
                                     "path list view", new BMessage(MSG_PATH_SELECTED), this);

    BView* scrollView = new BScrollView("path list scroll view",
                                        fPathListView, B_FOLLOW_NONE, 0, false, true, B_NO_BORDER);
    leftSideView->AddChild(scrollView);

    // shape list view
    menuBar = new BMenuBar("shape menu bar");
    menuBar->AddItem(fShapeMenu);
    leftSideView->AddChild(menuBar);

    fShapeListView = new ShapeListView(BRect(0, 0, splitWidth, 100),
                                       "shape list view", new BMessage(MSG_SHAPE_SELECTED), this);
    scrollView = new BScrollView("shape list scroll view",
                                 fShapeListView, B_FOLLOW_NONE, 0, false, true, B_NO_BORDER);
    leftSideView->AddChild(scrollView);

    // transformer list view
    menuBar = new BMenuBar("transformer menu bar");
    menuBar->AddItem(fTransformerMenu);
    leftSideView->AddChild(menuBar);

    fTransformerListView = new TransformerListView(BRect(0, 0, splitWidth, 100),
            "transformer list view");
    scrollView = new BScrollView("transformer list scroll view",
                                 fTransformerListView, B_FOLLOW_NONE, 0, false, true, B_NO_BORDER);
    leftSideView->AddChild(scrollView);

    // property list view
    menuBar = new BMenuBar("property menu bar");
    menuBar->AddItem(fPropertyMenu);
    leftSideView->AddChild(menuBar);

    fPropertyListView = new IconObjectListView();

    // scroll view around property list view
    ScrollView* propScrollView = new ScrollView(fPropertyListView,
            SCROLL_VERTICAL, BRect(0, 0, splitWidth, 100), "property scroll view",
            B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER,
            BORDER_RIGHT);
    leftSideView->AddChild(propScrollView);

    BGroupLayout* topSide = new BGroupLayout(B_HORIZONTAL);
    topSide->SetSpacing(0);
    BView* topSideView = new BView("top side view", 0, topSide);
    layout->AddView(topSideView, 1, 0);

    // canvas view
    BRect canvasBounds = BRect(0, 0, 200, 200);
    fCanvasView = new CanvasView(canvasBounds);

    // scroll view around canvas view
    canvasBounds.bottom += B_H_SCROLL_BAR_HEIGHT;
    canvasBounds.right += B_V_SCROLL_BAR_WIDTH;
    ScrollView* canvasScrollView = new ScrollView(fCanvasView, SCROLL_VERTICAL
            | SCROLL_HORIZONTAL | SCROLL_VISIBLE_RECT_IS_CHILD_BOUNDS,
            canvasBounds, "canvas scroll view", B_FOLLOW_NONE,
            B_WILL_DRAW | B_FRAME_EVENTS, B_NO_BORDER);
    layout->AddView(canvasScrollView, 1, 1);

    // views along the top

    BGroupLayout* styleGroup = new BGroupLayout(B_VERTICAL, 0);
    BView* styleGroupView = new BView("style group", 0, styleGroup);
    topSide->AddView(styleGroupView);

    // style list view
    menuBar = new BMenuBar("style menu bar");
    menuBar->AddItem(fStyleMenu);
    styleGroup->AddView(menuBar);

    fStyleListView = new StyleListView(BRect(0, 0, splitWidth, 100),
                                       "style list view", new BMessage(MSG_STYLE_SELECTED), this);
    scrollView = new BScrollView("style list scroll view", fStyleListView,
                                 B_FOLLOW_NONE, 0, false, true, B_NO_BORDER);
    scrollView->SetExplicitMaxSize(BSize(splitWidth, B_SIZE_UNLIMITED));
    styleGroup->AddView(scrollView);

    // style view
    fStyleView = new StyleView(BRect(0, 0, 200, 100));
    topSide->AddView(fStyleView);

    // swatch group
    BGroupLayout* swatchGroup = new BGroupLayout(B_VERTICAL);
    swatchGroup->SetSpacing(0);
    BView* swatchGroupView = new BView("swatch group", 0, swatchGroup);
    topSide->AddView(swatchGroupView);

    menuBar = new BMenuBar("swatches menu bar");
    menuBar->AddItem(fSwatchMenu);
    swatchGroup->AddView(menuBar);

    fSwatchGroup = new SwatchGroup(BRect(0, 0, 100, 100));
    swatchGroup->AddView(fSwatchGroup);

    swatchGroupView->SetExplicitMaxSize(swatchGroupView->MinSize());

    // make sure the top side has fixed height
    topSideView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED,
                                          swatchGroupView->MinSize().height));
}
Beispiel #10
0
void 
JobSetupView::AttachedToWindow()
{
	// quality
	BBox* qualityBox = new BBox("quality");
	qualityBox->SetLabel("Quality");

	// color
	fColorType = new BPopUpMenu("color");
	fColorType->SetRadioMode(true);
	FillCapabilityMenu(fColorType, kMsgQuality, PrinterCap::kColor,
		fJobData->GetColor());
	BMenuField* colorMenuField = new BMenuField("color", "Color:", fColorType);
	fColorType->SetTargetForItems(this);
	
	if (IsHalftoneConfigurationNeeded())
		CreateHalftoneConfigurationUI();

	// page range

	BBox* pageRangeBox = new BBox("pageRange");
	pageRangeBox->SetLabel("Page Range");

	fAll = new BRadioButton("all", "Print all Pages", new BMessage(kMsgRangeAll));

	BRadioButton *range = new BRadioButton("selection", "Print selected Pages:",
		new BMessage(kMsgRangeSelection));

	fFromPage = new BTextControl("from", "From:", "", NULL);
	fFromPage->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT);
	AllowOnlyDigits(fFromPage->TextView(), 6);

	fToPage = new BTextControl("to", "To:", "", NULL);
	fToPage->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT);
	AllowOnlyDigits(fToPage->TextView(), 6);

	int first_page = fJobData->GetFirstPage();
	int last_page  = fJobData->GetLastPage();

	if (first_page <= 1 && last_page <= 0) {
		fAll->SetValue(B_CONTROL_ON);
	} else {
		range->SetValue(B_CONTROL_ON);
		if (first_page < 1)
			first_page = 1;
		if (first_page > last_page)
			last_page = -1;

		BString oss1;
		oss1 << first_page;
		fFromPage->SetText(oss1.String());

		BString oss2;
		oss2 << last_page;
		fToPage->SetText(oss2.String());
	}

	fAll->SetTarget(this);
	range->SetTarget(this);

	// paper source
	fPaperFeed = new BPopUpMenu("");
	fPaperFeed->SetRadioMode(true);
	FillCapabilityMenu(fPaperFeed, kMsgNone, PrinterCap::kPaperSource,
		fJobData->GetPaperSource());
	BMenuField* paperSourceMenufield = new BMenuField("paperSource",
		"Paper Source:", fPaperFeed);

	// Pages per sheet
	fNup = new BPopUpMenu("");
	fNup->SetRadioMode(true);
	FillCapabilityMenu(fNup, kMsgNone, gNups,
		sizeof(gNups) / sizeof(gNups[0]), (int)fJobData->GetNup());
	BMenuField* pagesPerSheet = new BMenuField("pagesPerSheet",
		"Pages Per Sheet:", fNup);

	// duplex
	if (fPrinterCap->Supports(PrinterCap::kPrintStyle)) {
		fDuplex = new BCheckBox("duplex", "Duplex",
			new BMessage(kMsgDuplexChanged));
		if (fJobData->GetPrintStyle() != JobData::kSimplex) {
			fDuplex->SetValue(B_CONTROL_ON);
		}
		fDuplex->SetTarget(this);
	} else {
		fDuplex = NULL;
	}

	// copies
	fCopies = new BTextControl("copies", "Number of Copies:", "", NULL);
	AllowOnlyDigits(fCopies->TextView(), 3);

	BString copies;
	copies << fJobData->GetCopies();
	fCopies->SetText(copies.String());

	// collate
	fCollate = new BCheckBox("collate", "Collate",
		new BMessage(kMsgCollateChanged));
	if (fJobData->GetCollate()) {
		fCollate->SetValue(B_CONTROL_ON);
	}
	fCollate->SetTarget(this);

	// reverse
	fReverse = new BCheckBox("reverse", "Reverse Order",
		new BMessage(kMsgReverseChanged));
	if (fJobData->GetReverse()) {
		fReverse->SetValue(B_CONTROL_ON);
	}
	fReverse->SetTarget(this);

	// pages view
	// TODO make layout API compatible
	fPages = new PagesView(BRect(0, 0, 150, 40), "pages", B_FOLLOW_ALL,
		B_WILL_DRAW);
	fPages->SetCollate(fJobData->GetCollate());
	fPages->SetReverse(fJobData->GetReverse());
	fPages->SetExplicitMinSize(BSize(150, 40));
	fPages->SetExplicitMaxSize(BSize(150, 40));
	
	// page selection
	BBox* pageSelectionBox = new BBox("pageSelection");
	pageSelectionBox->SetLabel("Page Selection");
	
	fAllPages = CreatePageSelectionItem("allPages", "All Pages",
		JobData::kAllPages);
	fOddNumberedPages = CreatePageSelectionItem("oddPages",
		"Odd-Numbered Pages", JobData::kOddNumberedPages);
	fEvenNumberedPages = CreatePageSelectionItem("evenPages",
		"Even-Numbered Pages", JobData::kEvenNumberedPages);

	fPreview = new BCheckBox("preview", "Show preview before printing", NULL);
	if (fJobData->GetShowPreview())
		fPreview->SetValue(B_CONTROL_ON);

	// separator line
	BBox *separator = new BBox("separator");
	separator->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 1));

	// buttons
	BButton* cancel = new BButton("cancel", "Cancel",
		new BMessage(kMsgCancel));
	BButton* ok = new BButton("ok", "OK", new BMessage(kMsgOK));
	ok->MakeDefault(true);
	
	if (IsHalftoneConfigurationNeeded()) {
		BGroupView* halftoneGroup = new BGroupView(B_VERTICAL, 0);
		BGroupLayout* halftoneLayout = halftoneGroup->GroupLayout();
		halftoneLayout->AddView(fHalftone);
		fHalftoneBox->AddChild(halftoneGroup);
	}

	BGridView* qualityGrid = new BGridView();
	BGridLayout* qualityGridLayout = qualityGrid->GridLayout();
	qualityGridLayout->AddItem(colorMenuField->CreateLabelLayoutItem(), 0, 0);
	qualityGridLayout->AddItem(colorMenuField->CreateMenuBarLayoutItem(), 1, 0);
	if (IsHalftoneConfigurationNeeded()) {
		qualityGridLayout->AddItem(fDitherMenuField->CreateLabelLayoutItem(),
			0, 1);
		qualityGridLayout->AddItem(fDitherMenuField->CreateMenuBarLayoutItem(),
			1, 1);
		qualityGridLayout->AddView(fGamma, 0, 2, 2);
		qualityGridLayout->AddView(fInkDensity, 0, 3, 2);
		qualityGridLayout->AddView(fHalftoneBox, 0, 4, 2);
	} else {
		AddDriverSpecificSettings(qualityGridLayout, 1);
	}
	qualityGridLayout->SetSpacing(0, 0);
	qualityGridLayout->SetInsets(5, 5, 5, 5);
	qualityBox->AddChild(qualityGrid);
	// TODO put qualityGrid in a scroll view
	// the layout of the box surrounding the scroll view using the following
	// code is not correct; the box still has the size of the qualityGird;
	// and the scroll view is vertically centered inside the box!
	//BScrollView* qualityScroller = new BScrollView("qualityScroller",
	//	qualityGrid, 0, false, true);
	//qualityScroller->SetExplicitMaxSize(BSize(500, 500));
	//qualityBox->AddChild(qualityScroller);

	BGridView* pageRangeGrid = new BGridView();
	BGridLayout* pageRangeLayout = pageRangeGrid->GridLayout();
	pageRangeLayout->AddItem(fFromPage->CreateLabelLayoutItem(), 0, 0);
	pageRangeLayout->AddItem(fFromPage->CreateTextViewLayoutItem(), 1, 0);
	pageRangeLayout->AddItem(fToPage->CreateLabelLayoutItem(), 0, 1);
	pageRangeLayout->AddItem(fToPage->CreateTextViewLayoutItem(), 1, 1);
	pageRangeLayout->SetInsets(0, 0, 0, 0);
	pageRangeLayout->SetSpacing(0, 0);

	BGroupView* pageRangeGroup = new BGroupView(B_VERTICAL, 0);
	BGroupLayout* pageRangeGroupLayout = pageRangeGroup->GroupLayout();
	pageRangeGroupLayout->AddView(fAll);
	pageRangeGroupLayout->AddView(range);
	pageRangeGroupLayout->AddView(pageRangeGrid);
	pageRangeGroupLayout->SetInsets(5, 5, 5, 5);
	pageRangeBox->AddChild(pageRangeGroup);

	BGridView* settings = new BGridView();
	BGridLayout* settingsLayout = settings->GridLayout();
	settingsLayout->AddItem(paperSourceMenufield->CreateLabelLayoutItem(), 0,
		0);
	settingsLayout->AddItem(paperSourceMenufield->CreateMenuBarLayoutItem(), 1,
		0);
	settingsLayout->AddItem(pagesPerSheet->CreateLabelLayoutItem(), 0, 1);
	settingsLayout->AddItem(pagesPerSheet->CreateMenuBarLayoutItem(), 1, 1);
	int row = 2;
	if (fDuplex != NULL) {
		settingsLayout->AddView(fDuplex, 0, row, 2);
		row ++;
	}
	settingsLayout->AddItem(fCopies->CreateLabelLayoutItem(), 0, row);
	settingsLayout->AddItem(fCopies->CreateTextViewLayoutItem(), 1, row);
	settingsLayout->SetSpacing(0, 0);


	BGroupView* pageSelectionGroup = new BGroupView(B_VERTICAL, 0);
	BGroupLayout* groupLayout = pageSelectionGroup->GroupLayout();
	groupLayout->AddView(fAllPages);
	groupLayout->AddView(fOddNumberedPages);
	groupLayout->AddView(fEvenNumberedPages);
	groupLayout->SetInsets(5, 5, 5, 5);
	pageSelectionBox->AddChild(pageSelectionGroup);

	SetLayout(new BGroupLayout(B_VERTICAL));
	AddChild(BGroupLayoutBuilder(B_VERTICAL, 0)
		.AddGroup(B_HORIZONTAL, 10, 1.0f)
			.AddGroup(B_VERTICAL, 10, 1.0f)
				.Add(qualityBox)
				.Add(pageRangeBox)
				.AddGlue()
			.End()
			.AddGroup(B_VERTICAL, 0, 1.0f)
				.Add(settings)
				.AddStrut(5)
				.Add(fCollate)
				.Add(fReverse)
				.Add(fPages)
				.AddStrut(5)
				.Add(pageSelectionBox)
				.AddGlue()
			.End()
		.End()
		.Add(fPreview)
		.AddGlue()
		.Add(separator)
		.AddGroup(B_HORIZONTAL, 10, 1.0f)
			.AddGlue()
			.Add(cancel)
			.Add(ok)
		.End()
		.SetInsets(0, 0, 0, 0)
	);

	UpdateHalftonePreview();

	UpdateButtonEnabledState();
}
Beispiel #11
0
EthernetSettingsView::EthernetSettingsView()
    :
    BView("EthernetSettingsView", 0, NULL),
    fCurrentSettings(NULL)
{
    SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

    fSocket = socket(AF_INET, SOCK_DGRAM, 0);
    _GatherInterfaces();

    // build the GUI
    BGroupLayout* rootLayout = new BGroupLayout(B_VERTICAL);
    SetLayout(rootLayout);

    BGridView* controlsGroup = new BGridView();
    BGridLayout* layout = controlsGroup->GridLayout();

    // insets
    float inset = ceilf(be_plain_font->Size() * 0.7);
    rootLayout->SetInsets(inset, inset, inset, inset);
    rootLayout->SetSpacing(inset);
    layout->SetSpacing(inset, inset);

    BPopUpMenu* deviceMenu = new BPopUpMenu(B_TRANSLATE("<no adapter>"));
    for (int32 i = 0; i < fInterfaces.CountItems(); i++) {
        BString& name = *fInterfaces.ItemAt(i);
        BString label = name;
        BMessage* info = new BMessage(kMsgInfo);
        info->AddString("interface", name.String());
        BMenuItem* item = new BMenuItem(label.String(), info);
        deviceMenu->AddItem(item);
    }

    BPopUpMenu* modeMenu = new BPopUpMenu("modes");
    modeMenu->AddItem(new BMenuItem(B_TRANSLATE("Static"),
                                    new BMessage(kMsgStaticMode)));
    modeMenu->AddItem(new BMenuItem(B_TRANSLATE("DHCP"),
                                    new BMessage(kMsgDHCPMode)));
    modeMenu->AddSeparatorItem();
    modeMenu->AddItem(new BMenuItem(B_TRANSLATE("Disabled"),
                                    new BMessage(kMsgDisabledMode)));

    BPopUpMenu* networkMenu = new BPopUpMenu("networks");

    fDeviceMenuField = new BMenuField(B_TRANSLATE("Adapter:"), deviceMenu);
    layout->AddItem(fDeviceMenuField->CreateLabelLayoutItem(), 0, 0);
    layout->AddItem(fDeviceMenuField->CreateMenuBarLayoutItem(), 1, 0);

    fNetworkMenuField = new BMenuField(B_TRANSLATE("Network:"), networkMenu);
    layout->AddItem(fNetworkMenuField->CreateLabelLayoutItem(), 0, 1);
    layout->AddItem(fNetworkMenuField->CreateMenuBarLayoutItem(), 1, 1);

    fTypeMenuField = new BMenuField(B_TRANSLATE("Mode:"), modeMenu);
    layout->AddItem(fTypeMenuField->CreateLabelLayoutItem(), 0, 2);
    layout->AddItem(fTypeMenuField->CreateMenuBarLayoutItem(), 1, 2);

    fIPTextControl = new BTextControl(B_TRANSLATE("IP address:"), "", NULL);
    SetupTextControl(fIPTextControl);

    BLayoutItem* layoutItem = fIPTextControl->CreateTextViewLayoutItem();
    layoutItem->SetExplicitMinSize(BSize(
                                       fIPTextControl->StringWidth("XXX.XXX.XXX.XXX") + inset,
                                       B_SIZE_UNSET));

    layout->AddItem(fIPTextControl->CreateLabelLayoutItem(), 0, 3);
    layout->AddItem(layoutItem, 1, 3);

    fNetMaskTextControl = new BTextControl(B_TRANSLATE("Netmask:"), "", NULL);
    SetupTextControl(fNetMaskTextControl);
    layout->AddItem(fNetMaskTextControl->CreateLabelLayoutItem(), 0, 4);
    layout->AddItem(fNetMaskTextControl->CreateTextViewLayoutItem(), 1, 4);

    fGatewayTextControl = new BTextControl(B_TRANSLATE("Gateway:"), "", NULL);
    SetupTextControl(fGatewayTextControl);
    layout->AddItem(fGatewayTextControl->CreateLabelLayoutItem(), 0, 5);
    layout->AddItem(fGatewayTextControl->CreateTextViewLayoutItem(), 1, 5);

    // TODO: Replace the DNS text controls by a BListView with add/remove
    // functionality and so on...
    fPrimaryDNSTextControl = new BTextControl(B_TRANSLATE("DNS #1:"), "",
            NULL);
    SetupTextControl(fPrimaryDNSTextControl);
    layout->AddItem(fPrimaryDNSTextControl->CreateLabelLayoutItem(), 0, 6);
    layout->AddItem(fPrimaryDNSTextControl->CreateTextViewLayoutItem(), 1, 6);

    fSecondaryDNSTextControl = new BTextControl(B_TRANSLATE("DNS #2:"), "",
            NULL);
    SetupTextControl(fSecondaryDNSTextControl);
    layout->AddItem(fSecondaryDNSTextControl->CreateLabelLayoutItem(), 0, 7);
    layout->AddItem(fSecondaryDNSTextControl->CreateTextViewLayoutItem(), 1, 7);

    fDomainTextControl = new BTextControl(B_TRANSLATE("Domain:"), "", NULL);
    SetupTextControl(fDomainTextControl);
    layout->AddItem(fDomainTextControl->CreateLabelLayoutItem(), 0, 8);
    layout->AddItem(fDomainTextControl->CreateTextViewLayoutItem(), 1, 8);

    fErrorMessage = new BStringView("error", "");
    fErrorMessage->SetAlignment(B_ALIGN_LEFT);
    fErrorMessage->SetFont(be_bold_font);
    fErrorMessage->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));

    layout->AddView(fErrorMessage, 1, 9);

    // button group (TODO: move to window, but take care of
    // enabling/disabling)
    BGroupView* buttonGroup = new BGroupView(B_HORIZONTAL);

    fRevertButton = new BButton(B_TRANSLATE("Revert"),
                                new BMessage(kMsgRevert));
    fRevertButton->SetEnabled(false);
    buttonGroup->GroupLayout()->AddView(fRevertButton);

    buttonGroup->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue());

    fApplyButton = new BButton(B_TRANSLATE("Apply"), new BMessage(kMsgApply));
    fApplyButton->SetEnabled(false);
    buttonGroup->GroupLayout()->AddView(fApplyButton);

    rootLayout->AddView(controlsGroup);
    rootLayout->AddView(buttonGroup);
}
Beispiel #12
0
BSCWindow::BSCWindow()
	:
	BDirectWindow(kWindowRect, "BeScreenCapture", B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS|B_AUTO_UPDATE_SIZE_LIMITS),
	fController(dynamic_cast<Controller*>(gControllerLooper)),
	fCapturing(false)
{
	OutputView *outputView
		= new OutputView(fController);
	AdvancedOptionsView *advancedView 
		= new AdvancedOptionsView(fController);
	
	fStartStopButton = new BButton("Start", "Start Recording",
		new BMessage(kMsgGUIStartCapture)); 
	
	fStartStopButton->SetTarget(fController);
	fStartStopButton->SetExplicitAlignment(BAlignment(B_ALIGN_RIGHT, B_ALIGN_MIDDLE));
	
	fCardLayout = new BCardLayout();
	BView* cardsView = new BView("status", 0, fCardLayout);
	cardsView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	
	fCardLayout->AddView(fCamStatus = new CamStatusView("CamStatusView"));
	fCamStatus->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));
	
	BView* statusView = BLayoutBuilder::Group<>()
		.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
			B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
		.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
			.Add(fStringView = new BStringView("stringview", kEncodingString))
			.Add(fStatusBar = new BStatusBar("", ""))
		.End()
		.View();
	
	statusView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_MIDDLE));	
	fStatusBar->SetExplicitMinSize(BSize(100, 20));
	fCardLayout->AddView(statusView);
	
	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.AddGroup(B_VERTICAL, 1)
		.SetInsets(B_USE_DEFAULT_SPACING, 1,
			B_USE_DEFAULT_SPACING, 1)
			.Add(fTabView = new BTabView("Tab View", B_WIDTH_FROM_LABEL))
			.AddGroup(B_HORIZONTAL)
				.Add(cardsView)
				.Add(fStartStopButton)
			.End()
		.End();
	
	fCardLayout->SetVisibleItem((int32)0);
				
	BGroupView* outputGroup = new BGroupView(B_HORIZONTAL);
	outputGroup->SetName("Output");
	outputGroup->GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING,
		B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
	fTabView->AddTab(outputGroup);
	BLayoutBuilder::Group<>(outputGroup)
		.Add(outputView);
							
	BGroupView* advancedGroup = new BGroupView(B_HORIZONTAL);
	advancedGroup->SetName("Advanced Options");
	advancedGroup->GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING,
		B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
	fTabView->AddTab(advancedGroup);
	BLayoutBuilder::Group<>(advancedGroup)
		.Add(advancedView);
				
	if (fController->LockLooper()) {	
		// controller should watch for these messages
		//StartWatching(fController, kMsgGUIStartCapture);
		//StartWatching(fController, kMsgGUIStopCapture);
		StartWatching(fController, kSelectionWindowClosed);
		advancedView->StartWatching(fController, kClipSizeChanged);
		//StartWatching(fCamStatus, kMsgControllerCaptureResumed);	
		
		// watch Controller for these
		fController->StartWatching(this, B_UPDATE_STATUS_BAR);
		fController->StartWatching(this, B_RESET_STATUS_BAR);
		fController->StartWatching(this, kMsgControllerEncodeStarted);
		fController->StartWatching(this, kMsgControllerEncodeProgress);
		fController->StartWatching(this, kMsgControllerEncodeFinished);
		fController->StartWatching(this, kMsgControllerTargetFrameChanged);
		fController->StartWatching(this, kMsgControllerCaptureStarted);
		fController->StartWatching(this, kMsgControllerCaptureStopped);
		
		fController->StartWatching(fCamStatus, kMsgControllerCaptureStarted);
		fController->StartWatching(fCamStatus, kMsgControllerCaptureStopped);
		fController->StartWatching(fCamStatus, kMsgControllerCapturePaused);
		fController->StartWatching(fCamStatus, kMsgControllerCaptureResumed);
		
		fController->StartWatching(outputView, kMsgControllerTargetFrameChanged);
		fController->StartWatching(outputView, kMsgControllerCodecListUpdated);
			
		fController->UnlockLooper();
	}
	
	StartWatching(outputView, kSelectionWindowClosed);
	StartWatching(outputView, kClipSizeChanged);

	CenterOnScreen();
}
TransportControlGroup::TransportControlGroup(BRect frame,
		bool usePlaybackFrame, bool useSkipButtons, bool usePeakView,
		bool useWindButtons, bool useSeekSlider)
	:
	BGroupView(B_VERTICAL, 0),
	fSeekSlider(NULL),
	fPeakView(NULL),
	fPlaybackFrame(NULL),
	fVolumeSlider(NULL),
	fSkipBack(NULL),
	fSkipForward(NULL),
	fRewind(NULL),
	fForward(NULL),
	fPlayPause(NULL),
	fStop(NULL),
	fMute(NULL),
	fSeekLayout(NULL),
	fControlLayout(NULL),
	fSymbolScale(0.0f)
{
    // Seek slider
	if (useSeekSlider) {
		BGroupView* seekGroup = new BGroupView(B_HORIZONTAL, 0);
		fSeekLayout = seekGroup->GroupLayout();
		GroupLayout()->AddView(seekGroup);

		fSeekSlider = new SeekSlider("seek slider", new BMessage(MSG_SEEK),
			0, 10000);
		fSeekLayout->AddView(fSeekSlider);
	}

    // Buttons

	uint32 topBottomBorder = BControlLook::B_TOP_BORDER
		| BControlLook::B_BOTTOM_BORDER;

	if (useSkipButtons) {
		// Skip Back
		fSkipBack = new SymbolButton(B_EMPTY_STRING, NULL,
			new BMessage(MSG_SKIP_BACKWARDS),
			BControlLook::B_LEFT_BORDER | topBottomBorder);
		// Skip Foward
		fSkipForward = new SymbolButton(B_EMPTY_STRING, NULL,
			new BMessage(MSG_SKIP_FORWARD),
			BControlLook::B_RIGHT_BORDER | topBottomBorder);
	}

	if (useWindButtons) {
		// Rewind
		fRewind = new SymbolButton(B_EMPTY_STRING, NULL,
			new BMessage(MSG_REWIND), useSkipButtons ? topBottomBorder
				: BControlLook::B_LEFT_BORDER | topBottomBorder);
		// Forward
		fForward = new SymbolButton(B_EMPTY_STRING, NULL,
			new BMessage(MSG_FORWARD), useSkipButtons ? topBottomBorder
				: BControlLook::B_RIGHT_BORDER | topBottomBorder);
	}

	// Play Pause
	fPlayPause = new PlayPauseButton(B_EMPTY_STRING, NULL, NULL,
		new BMessage(MSG_PLAY), useWindButtons || useSkipButtons
			? topBottomBorder
			: topBottomBorder | BControlLook::B_LEFT_BORDER);

	// Stop
	fStop = new SymbolButton(B_EMPTY_STRING, NULL, new BMessage(MSG_STOP),
		useWindButtons || useSkipButtons ? topBottomBorder
			: topBottomBorder | BControlLook::B_RIGHT_BORDER);

	// Mute
	fMute = new SymbolButton(B_EMPTY_STRING, NULL, new BMessage(MSG_SET_MUTE),
		0);

	// Volume Slider
	fVolumeSlider = new VolumeSlider("volume slider",
		0, VIRTUAL_MAX_VOLUME, SNAP_VOLUME, new BMessage(MSG_SET_VOLUME));
	fVolumeSlider->SetValue(100);

	// Peak view
	if (usePeakView)
		fPeakView = new PeakView("peak view", false, false);

	// Playback Frame
	if (usePlaybackFrame)
	    fPlaybackFrame = new PlaybackFrameView();

	// Layout the controls

	BGroupView* buttonGroup = new BGroupView(B_HORIZONTAL, 0);
	BGroupLayout* buttonLayout = buttonGroup->GroupLayout();

	if (fSkipBack != NULL)
		buttonLayout->AddView(fSkipBack);
	if (fRewind != NULL)
		buttonLayout->AddView(fRewind);
	buttonLayout->AddView(fPlayPause);
	buttonLayout->AddView(fStop);
	if (fForward != NULL)
		buttonLayout->AddView(fForward);
	if (fSkipForward != NULL)
		buttonLayout->AddView(fSkipForward);

	BGroupView* controlGroup = new BGroupView(B_HORIZONTAL, 0);
	GroupLayout()->AddView(controlGroup);
	fControlLayout = controlGroup->GroupLayout();
	fControlLayout->AddView(buttonGroup, 0.6f);
	fControlLayout->AddItem(BSpaceLayoutItem::CreateHorizontalStrut(5));
	fControlLayout->AddView(fMute);
	fControlLayout->AddView(fVolumeSlider);
	if (fPeakView != NULL)
		fControlLayout->AddView(fPeakView, 0.6f);
	if (fPlaybackFrame != NULL) {
		fControlLayout->AddItem(BSpaceLayoutItem::CreateHorizontalStrut(5));
		fControlLayout->AddView(fPlaybackFrame, 0.0f);
	}

	BSize size = fControlLayout->MinSize();
	size.width *= 3;
	size.height = B_SIZE_UNSET;
	fControlLayout->SetExplicitMaxSize(size);
	fControlLayout->SetExplicitAlignment(BAlignment(B_ALIGN_CENTER,
		B_ALIGN_TOP));

	SetSymbolScale(1.0f);
}
TeamMonitorWindow::TeamMonitorWindow()
	:
	BWindow(BRect(0, 0, 350, 400), B_TRANSLATE("Team monitor"),
		B_TITLED_WINDOW_LOOK, B_MODAL_ALL_WINDOW_FEEL,
		B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS
			| B_CLOSE_ON_ESCAPE | B_AUTO_UPDATE_SIZE_LIMITS,
		B_ALL_WORKSPACES),
	fQuitting(false),
	fUpdateRunner(NULL)
{
	BGroupLayout* layout = new BGroupLayout(B_VERTICAL);
	float inset = 10;
	layout->SetInsets(inset, inset, inset, inset);
	layout->SetSpacing(inset);
	SetLayout(layout);

	layout->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	fListView = new BListView("teams");
	fListView->SetSelectionMessage(new BMessage(TM_SELECTED_TEAM));

	BScrollView* scrollView = new BScrollView("scroll_teams", fListView,
		0, B_SUPPORTS_LAYOUT, false, true, B_FANCY_BORDER);
	layout->AddView(scrollView);

	BGroupView* groupView = new BGroupView(B_HORIZONTAL);
	layout->AddView(groupView);

	fKillButton = new BButton("kill", B_TRANSLATE("Kill application"),
		new BMessage(TM_KILL_APPLICATION));
	groupView->AddChild(fKillButton);
	fKillButton->SetEnabled(false);
	
	fQuitButton = new BButton("quit", B_TRANSLATE("Quit application"),
		new BMessage(TM_QUIT_APPLICATION));
	groupView->AddChild(fQuitButton);
	fQuitButton->SetEnabled(false);

	groupView->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue());

	fDescriptionView = new TeamDescriptionView;
	layout->AddView(fDescriptionView);

	groupView = new BGroupView(B_HORIZONTAL);
	layout->AddView(groupView);

	BButton* forceReboot = new BButton("force", B_TRANSLATE("Force reboot"),
		new BMessage(TM_FORCE_REBOOT));
	groupView->GroupLayout()->AddView(forceReboot);

	BSpaceLayoutItem* glue = BSpaceLayoutItem::CreateGlue();
	glue->SetExplicitMinSize(BSize(inset, -1));
	groupView->GroupLayout()->AddItem(glue);

	fRestartButton = new BButton("restart", B_TRANSLATE("Restart the desktop"),
		new BMessage(TM_RESTART_DESKTOP));
	SetDefaultButton(fRestartButton);
	groupView->GroupLayout()->AddView(fRestartButton);

	glue = BSpaceLayoutItem::CreateGlue();
	glue->SetExplicitMinSize(BSize(inset, -1));
	groupView->GroupLayout()->AddItem(glue);

	fCancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
		new BMessage(TM_CANCEL));
	SetDefaultButton(fCancelButton);
	groupView->GroupLayout()->AddView(fCancelButton);

	BSize preferredSize = layout->View()->PreferredSize();
	if (preferredSize.width > Bounds().Width())
		ResizeTo(preferredSize.width, Bounds().Height());
	if (preferredSize.height > Bounds().Height())
		ResizeTo(Bounds().Width(), preferredSize.height);

	BRect screenFrame = BScreen(this).Frame();
	BPoint point;
	point.x = (screenFrame.Width() - Bounds().Width()) / 2;
	point.y = (screenFrame.Height() - Bounds().Height()) / 2;

	if (screenFrame.Contains(point))
		MoveTo(point);

	SetSizeLimits(Bounds().Width(), Bounds().Width() * 2,
		Bounds().Height(), screenFrame.Height());

	fRestartButton->Hide();

	AddShortcut('T', B_COMMAND_KEY | B_OPTION_KEY,
		new BMessage(kMsgLaunchTerminal));
	AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));

	gLocalizedNamePreferred
		= BLocaleRoster::Default()->IsFilesystemTranslationPreferred();

	gTeamMonitorWindow = this;

	if (be_app->Lock()) {
		be_app->AddCommonFilter(new BMessageFilter(B_ANY_DELIVERY,
			B_ANY_SOURCE, B_LOCALE_CHANGED, FilterLocaleChanged));
		be_app->Unlock();
	}
}
Beispiel #15
0
/**
 * _ConstructGUI()
 *
 * Creates the GUI for the View. MUST be called AFTER the View is attached to
 *	the Window, or will crash and/or create strange behaviour
 *
 * @param none
 * @return void
 */
void
MarginView::_ConstructGUI()
{
	fPage = new PageView();
	fPage->SetViewColor(ViewColor());

	fPageSize = new BStringView("pageSize", "?x?");

	BString str;
	// Create text fields

	// top
	str << fMargins.top/fUnitValue;
	fTop = new BTextControl("top", "Top:", str.String(), NULL);

	fTop->SetModificationMessage(new BMessage(TOP_MARGIN_CHANGED));
	fTop->SetTarget(this);
	_AllowOnlyNumbers(fTop, kNumCount);

	//left
    str = "";
	str << fMargins.left/fUnitValue;
	fLeft = new BTextControl("left", "Left:", str.String(), NULL);

	fLeft->SetModificationMessage(new BMessage(LEFT_MARGIN_CHANGED));
	fLeft->SetTarget(this);
	_AllowOnlyNumbers(fLeft, kNumCount);

	//bottom
    str = "";
	str << fMargins.bottom/fUnitValue;
	fBottom = new BTextControl("bottom", "Bottom:", str.String(), NULL);

	fBottom->SetModificationMessage(new BMessage(BOTTOM_MARGIN_CHANGED));
	fBottom->SetTarget(this);
	_AllowOnlyNumbers(fBottom, kNumCount);

	//right
    str = "";
	str << fMargins.right/fUnitValue;
	fRight = new BTextControl("right", "Right:", str.String(), NULL);

	fRight->SetModificationMessage(new BMessage(RIGHT_MARGIN_CHANGED));
	fRight->SetTarget(this);
	_AllowOnlyNumbers(fRight, kNumCount);

	// Create Units popup

	BPopUpMenu *menu = new BPopUpMenu("units");
	BMenuField *units = new BMenuField("units", "Units:", menu);

	BMenuItem *item;
	// Construct menu items
	for (int32 i = 0; kUnitNames[i] != NULL; i++) {
		BMessage *msg = new BMessage(MARGIN_UNIT_CHANGED);
		msg->AddInt32("marginUnit", kUnitMsg[i]);
		menu->AddItem(item = new BMenuItem(kUnitNames[i], msg));
		item->SetTarget(this);
		if (fMarginUnit == kUnitMsg[i])
			item->SetMarked(true);
	}

	BGridView* settings = new BGridView();
	BGridLayout* settingsLayout = settings->GridLayout();
	settingsLayout->AddItem(fTop->CreateLabelLayoutItem(), 0, 0);
	settingsLayout->AddItem(fTop->CreateTextViewLayoutItem(), 1, 0);
	settingsLayout->AddItem(fLeft->CreateLabelLayoutItem(), 0, 1);
	settingsLayout->AddItem(fLeft->CreateTextViewLayoutItem(), 1, 1);
	settingsLayout->AddItem(fBottom->CreateLabelLayoutItem(), 0, 2);
	settingsLayout->AddItem(fBottom->CreateTextViewLayoutItem(), 1, 2);
	settingsLayout->AddItem(fRight->CreateLabelLayoutItem(), 0, 3);
	settingsLayout->AddItem(fRight->CreateTextViewLayoutItem(), 1, 3);
	settingsLayout->AddItem(units->CreateLabelLayoutItem(), 0, 4);
	settingsLayout->AddItem(units->CreateMenuBarLayoutItem(), 1, 4);
	settingsLayout->SetSpacing(0, 0);

	BGroupView* groupView = new BGroupView(B_HORIZONTAL, 10);
	BGroupLayout* groupLayout = groupView->GroupLayout();
	groupLayout->AddView(BGroupLayoutBuilder(B_VERTICAL, 0)
		.Add(fPage)
		.Add(fPageSize)
		.SetInsets(0, 0, 0, 0)
		.TopView()
	);
	groupLayout->AddView(settings);
	groupLayout->SetInsets(5, 5, 5, 5);

	AddChild(groupView);

	UpdateView(MARGIN_CHANGED);
}
Beispiel #16
0
BSCWindow::BSCWindow()
	:
	BDirectWindow(kWindowRect, "BeScreenCapture", B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS|B_AUTO_UPDATE_SIZE_LIMITS),
	fController(dynamic_cast<Controller*>(gControllerLooper)),
	fCapturing(false)
{
	OutputView *outputView
		= new OutputView(fController);
	PostProcessingView *ppView 
		= new PostProcessingView("Post Processing");
	AdvancedOptionsView *advancedView 
		= new AdvancedOptionsView(fController);
	
	fStartStopButton = new BButton("Start", "Start Recording",
		new BMessage(kMsgGUIToggleCapture)); 
	
	const char *kString = "Encoding movie...";			
	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING)
		.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
				B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
			.Add(fTabView = new BTabView("Tab View", B_WIDTH_FROM_LABEL))
			.AddGroup(B_HORIZONTAL)
				.Add(fCamStatus = new CamStatusView("CamStatusView"))
				.Add(fStringView = new BStringView("stringview", kString))
				.Add(fStatusBar = new BStatusBar("", ""))
				.AddGlue(1)
				.Add(fStartStopButton)
			.End()
		.End();
				
	BGroupView* outputGroup = new BGroupView(B_HORIZONTAL);
	outputGroup->SetName("Output");
	outputGroup->GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING,
		B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
	fTabView->AddTab(outputGroup);
	BLayoutBuilder::Group<>(outputGroup)
		.Add(outputView);
					
	BGroupView* postGroup = new BGroupView(B_HORIZONTAL);
	postGroup->SetName("Post Processing");
	postGroup->GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING,
		B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
	fTabView->AddTab(postGroup);
	BLayoutBuilder::Group<>(postGroup)
		.Add(ppView);
		
	BGroupView* advancedGroup = new BGroupView(B_HORIZONTAL);
	advancedGroup->SetName("Advanced Options");
	advancedGroup->GroupLayout()->SetInsets(B_USE_DEFAULT_SPACING,
		B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING);
	fTabView->AddTab(advancedGroup);
	BLayoutBuilder::Group<>(advancedGroup)
		.Add(advancedView);
		
	fStatusBar->Hide();
	fStringView->Hide();
		
	if (fController->LockLooper()) {	
		// controller should watch for capture messages
		StartWatching(fController, kMsgGUIToggleCapture);
		StartWatching(fCamStatus, kAreaSelected);
		//StartWatching(fCamStatus, kMsgControllerCaptureResumed);	
		
		// watch Controller for these
		fController->StartWatching(this, B_UPDATE_STATUS_BAR);
		fController->StartWatching(this, B_RESET_STATUS_BAR);
		fController->StartWatching(this, kMsgControllerEncodeStarted);
		fController->StartWatching(this, kMsgControllerEncodeProgress);
		fController->StartWatching(this, kMsgControllerEncodeFinished);
		fController->UnlockLooper();
	}
	
	
	StartWatching(fCamStatus, kMsgGUIToggleCapture);

	CenterOnScreen();
}
ScreenWindow::ScreenWindow(ScreenSettings* settings)
	:
	BWindow(settings->WindowFrame(), B_TRANSLATE_SYSTEM_NAME("Screen"),
		B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
		| B_AUTO_UPDATE_SIZE_LIMITS, B_ALL_WORKSPACES),
	fIsVesa(false),
	fBootWorkspaceApplied(false),
	fOtherRefresh(NULL),
	fScreenMode(this),
	fUndoScreenMode(this),
	fModified(false)
{
	BScreen screen(this);

	accelerant_device_info info;
	if (screen.GetDeviceInfo(&info) == B_OK
		&& !strcasecmp(info.chipset, "VESA"))
		fIsVesa = true;

	_UpdateOriginal();
	_BuildSupportedColorSpaces();
	fActive = fSelected = fOriginal;

	fSettings = settings;

	// we need the "Current Workspace" first to get its height

	BPopUpMenu *popUpMenu = new BPopUpMenu(B_TRANSLATE("Current workspace"),
		true, true);
	fAllWorkspacesItem = new BMenuItem(B_TRANSLATE("All workspaces"),
		new BMessage(WORKSPACE_CHECK_MSG));
	popUpMenu->AddItem(fAllWorkspacesItem);
	BMenuItem *item = new BMenuItem(B_TRANSLATE("Current workspace"),
		new BMessage(WORKSPACE_CHECK_MSG));

	popUpMenu->AddItem(item);
	fAllWorkspacesItem->SetMarked(true);

	BMenuField* workspaceMenuField = new BMenuField("WorkspaceMenu", NULL,
		popUpMenu);
	workspaceMenuField->ResizeToPreferred();

	// box on the left with workspace count and monitor view

	BBox* screenBox = new BBox("screen box");
	BGroupLayout* layout = new BGroupLayout(B_VERTICAL, 5.0);
	layout->SetInsets(10, 10, 10, 10);
	screenBox->SetLayout(layout);

	fMonitorInfo = new BStringView("monitor info", "");
	screenBox->AddChild(fMonitorInfo);

	fMonitorView = new MonitorView(BRect(0.0, 0.0, 80.0, 80.0),
		"monitor", screen.Frame().IntegerWidth() + 1,
		screen.Frame().IntegerHeight() + 1);
	screenBox->AddChild(fMonitorView);

	fColumnsControl = new BTextControl(B_TRANSLATE("Columns:"), "0",
		new BMessage(kMsgWorkspaceColumnsChanged));
	fRowsControl = new BTextControl(B_TRANSLATE("Rows:"), "0",
		new BMessage(kMsgWorkspaceRowsChanged));

	screenBox->AddChild(BLayoutBuilder::Grid<>(5.0, 5.0)
		.Add(new BStringView("", B_TRANSLATE("Workspaces")), 0, 0, 3)
		.AddTextControl(fColumnsControl, 0, 1, B_ALIGN_RIGHT)
		.AddGroup(B_HORIZONTAL, 0, 2, 1)
			.Add(_CreateColumnRowButton(true, false))
			.Add(_CreateColumnRowButton(true, true))
			.End()
		.AddTextControl(fRowsControl, 0, 2, B_ALIGN_RIGHT)
		.AddGroup(B_HORIZONTAL, 0, 2, 2)
			.Add(_CreateColumnRowButton(false, false))
			.Add(_CreateColumnRowButton(false, true))
			.End()
		.View());

	fBackgroundsButton = new BButton("BackgroundsButton",
		B_TRANSLATE("Set background" B_UTF8_ELLIPSIS),
		new BMessage(BUTTON_LAUNCH_BACKGROUNDS_MSG));
	fBackgroundsButton->SetFontSize(be_plain_font->Size() * 0.9);
	screenBox->AddChild(fBackgroundsButton);

	// box on the right with screen resolution, etc.

	BBox* controlsBox = new BBox("controls box");
	controlsBox->SetLabel(workspaceMenuField);
	BGroupView* outerControlsView = new BGroupView(B_VERTICAL, 10.0);
	outerControlsView->GroupLayout()->SetInsets(10, 10, 10, 10);
	controlsBox->AddChild(outerControlsView);

	fResolutionMenu = new BPopUpMenu("resolution", true, true);

	uint16 maxWidth = 0;
	uint16 maxHeight = 0;
	uint16 previousWidth = 0;
	uint16 previousHeight = 0;
	for (int32 i = 0; i < fScreenMode.CountModes(); i++) {
		screen_mode mode = fScreenMode.ModeAt(i);

		if (mode.width == previousWidth && mode.height == previousHeight)
			continue;

		previousWidth = mode.width;
		previousHeight = mode.height;
		if (maxWidth < mode.width)
			maxWidth = mode.width;
		if (maxHeight < mode.height)
			maxHeight = mode.height;

		BMessage* message = new BMessage(POP_RESOLUTION_MSG);
		message->AddInt32("width", mode.width);
		message->AddInt32("height", mode.height);

		BString name;
		name << mode.width << " x " << mode.height;

		fResolutionMenu->AddItem(new BMenuItem(name.String(), message));
	}

	fMonitorView->SetMaxResolution(maxWidth, maxHeight);

	fResolutionField = new BMenuField("ResolutionMenu",
		B_TRANSLATE("Resolution:"), fResolutionMenu);

	fColorsMenu = new BPopUpMenu("colors", true, false);

	for (int32 i = 0; i < kColorSpaceCount; i++) {
		if ((fSupportedColorSpaces & (1 << i)) == 0)
			continue;

		BMessage* message = new BMessage(POP_COLORS_MSG);
		message->AddInt32("bits_per_pixel", kColorSpaces[i].bits_per_pixel);
		message->AddInt32("space", kColorSpaces[i].space);

		BMenuItem* item = new BMenuItem(kColorSpaces[i].label, message);
		if (kColorSpaces[i].space == screen.ColorSpace())
			fUserSelectedColorSpace = item;

		fColorsMenu->AddItem(item);
	}

	fColorsField = new BMenuField("ColorsMenu", B_TRANSLATE("Colors:"),
		fColorsMenu);

	fRefreshMenu = new BPopUpMenu("refresh rate", true, true);

	float min, max;
	if (fScreenMode.GetRefreshLimits(fActive, min, max) != B_OK) {
		// if we couldn't obtain the refresh limits, reset to the default
		// range. Constraints from detected monitors will fine-tune this
		// later.
		min = kRefreshRates[0];
		max = kRefreshRates[kRefreshRateCount - 1];
	}

	if (min == max) {
		// This is a special case for drivers that only support a single
		// frequency, like the VESA driver
		BString name;
		refresh_rate_to_string(min, name);
		BMessage *message = new BMessage(POP_REFRESH_MSG);
		message->AddFloat("refresh", min);
		BMenuItem *item = new BMenuItem(name.String(), message);
		fRefreshMenu->AddItem(item);
		item->SetEnabled(false);
	} else {
		monitor_info info;
		if (fScreenMode.GetMonitorInfo(info) == B_OK) {
			min = max_c(info.min_vertical_frequency, min);
			max = min_c(info.max_vertical_frequency, max);
		}

		for (int32 i = 0; i < kRefreshRateCount; ++i) {
			if (kRefreshRates[i] < min || kRefreshRates[i] > max)
				continue;

			BString name;
			name << kRefreshRates[i] << " " << B_TRANSLATE("Hz");

			BMessage *message = new BMessage(POP_REFRESH_MSG);
			message->AddFloat("refresh", kRefreshRates[i]);

			fRefreshMenu->AddItem(new BMenuItem(name.String(), message));
		}

		fOtherRefresh = new BMenuItem(B_TRANSLATE("Other" B_UTF8_ELLIPSIS),
			new BMessage(POP_OTHER_REFRESH_MSG));
		fRefreshMenu->AddItem(fOtherRefresh);
	}

	fRefreshField = new BMenuField("RefreshMenu", B_TRANSLATE("Refresh rate:"),
		fRefreshMenu);

	if (_IsVesa())
		fRefreshField->Hide();

	// enlarged area for multi-monitor settings
	{
		bool dummy;
		uint32 dummy32;
		bool multiMonSupport;
		bool useLaptopPanelSupport;
		bool tvStandardSupport;

		multiMonSupport = TestMultiMonSupport(&screen) == B_OK;
		useLaptopPanelSupport = GetUseLaptopPanel(&screen, &dummy) == B_OK;
		tvStandardSupport = GetTVStandard(&screen, &dummy32) == B_OK;

		// even if there is no support, we still create all controls
		// to make sure we don't access NULL pointers later on

		fCombineMenu = new BPopUpMenu("CombineDisplays",
			true, true);

		for (int32 i = 0; i < kCombineModeCount; i++) {
			BMessage *message = new BMessage(POP_COMBINE_DISPLAYS_MSG);
			message->AddInt32("mode", kCombineModes[i].mode);

			fCombineMenu->AddItem(new BMenuItem(kCombineModes[i].name,
				message));
		}

		fCombineField = new BMenuField("CombineMenu",
			B_TRANSLATE("Combine displays:"), fCombineMenu);

		if (!multiMonSupport)
			fCombineField->Hide();

		fSwapDisplaysMenu = new BPopUpMenu("SwapDisplays",
			true, true);

		// !order is important - we rely that boolean value == idx
		BMessage *message = new BMessage(POP_SWAP_DISPLAYS_MSG);
		message->AddBool("swap", false);
		fSwapDisplaysMenu->AddItem(new BMenuItem(B_TRANSLATE("no"), message));

		message = new BMessage(POP_SWAP_DISPLAYS_MSG);
		message->AddBool("swap", true);
		fSwapDisplaysMenu->AddItem(new BMenuItem(B_TRANSLATE("yes"), message));

		fSwapDisplaysField = new BMenuField("SwapMenu",
			B_TRANSLATE("Swap displays:"), fSwapDisplaysMenu);

		if (!multiMonSupport)
			fSwapDisplaysField->Hide();

		fUseLaptopPanelMenu = new BPopUpMenu("UseLaptopPanel",
			true, true);

		// !order is important - we rely that boolean value == idx
		message = new BMessage(POP_USE_LAPTOP_PANEL_MSG);
		message->AddBool("use", false);
		fUseLaptopPanelMenu->AddItem(new BMenuItem(B_TRANSLATE("if needed"),
			message));

		message = new BMessage(POP_USE_LAPTOP_PANEL_MSG);
		message->AddBool("use", true);
		fUseLaptopPanelMenu->AddItem(new BMenuItem(B_TRANSLATE("always"),
			message));

		fUseLaptopPanelField = new BMenuField("UseLaptopPanel",
			B_TRANSLATE("Use laptop panel:"), fUseLaptopPanelMenu);

		if (!useLaptopPanelSupport)
			fUseLaptopPanelField->Hide();

		fTVStandardMenu = new BPopUpMenu("TVStandard", true, true);

		// arbitrary limit
		uint32 i;
		for (i = 0; i < 100; ++i) {
			uint32 mode;
			if (GetNthSupportedTVStandard(&screen, i, &mode) != B_OK)
				break;

			BString name = tv_standard_to_string(mode);

			message = new BMessage(POP_TV_STANDARD_MSG);
			message->AddInt32("tv_standard", mode);

			fTVStandardMenu->AddItem(new BMenuItem(name.String(), message));
		}

		fTVStandardField = new BMenuField("tv standard",
			B_TRANSLATE("Video format:"), fTVStandardMenu);
		fTVStandardField->SetAlignment(B_ALIGN_RIGHT);

		if (!tvStandardSupport || i == 0)
			fTVStandardField->Hide();
	}

	BLayoutBuilder::Group<>(outerControlsView)
		.AddGrid(5.0, 5.0)
			.AddMenuField(fResolutionField, 0, 0, B_ALIGN_RIGHT)
			.AddMenuField(fColorsField, 0, 1, B_ALIGN_RIGHT)
			.AddMenuField(fRefreshField, 0, 2, B_ALIGN_RIGHT)
			.AddMenuField(fCombineField, 0, 3, B_ALIGN_RIGHT)
			.AddMenuField(fSwapDisplaysField, 0, 4, B_ALIGN_RIGHT)
			.AddMenuField(fUseLaptopPanelField, 0, 5, B_ALIGN_RIGHT)
			.AddMenuField(fTVStandardField, 0, 6, B_ALIGN_RIGHT)
		.End();

	// TODO: we don't support getting the screen's preferred settings
	/* fDefaultsButton = new BButton(buttonRect, "DefaultsButton", "Defaults",
		new BMessage(BUTTON_DEFAULTS_MSG));*/

	fApplyButton = new BButton("ApplyButton", B_TRANSLATE("Apply"),
		new BMessage(BUTTON_APPLY_MSG));
	fApplyButton->SetEnabled(false);
	BLayoutBuilder::Group<>(outerControlsView)
		.AddGlue()
			.AddGroup(B_HORIZONTAL)
			.AddGlue()
			.Add(fApplyButton);

	fRevertButton = new BButton("RevertButton", B_TRANSLATE("Revert"),
		new BMessage(BUTTON_REVERT_MSG));
	fRevertButton->SetEnabled(false);

	BLayoutBuilder::Group<>(this, B_VERTICAL, 10.0)
		.SetInsets(10, 10, 10, 10)
		.AddGroup(B_HORIZONTAL, 10.0)
			.AddGroup(B_VERTICAL)
				.AddStrut(floor(controlsBox->TopBorderOffset() / 16) - 1)
				.Add(screenBox)
			.End()
			.Add(controlsBox)
		.End()
		.AddGroup(B_HORIZONTAL, 10.0)
			.Add(fRevertButton)
			.AddGlue();

	_UpdateControls();
	_UpdateMonitor();
}