Example #1
0
void 
TSignatureView::AttachedToWindow()
{
	BRect	rect = Bounds();
	float	name_text_length = StringWidth(kNameText);
	float	sig_text_length = StringWidth(kSigText);
	float	divide_length;

	if (name_text_length > sig_text_length)
		divide_length = name_text_length;
	else
		divide_length = sig_text_length;

	rect.InsetBy(8,0);
	rect.top+= 8;
	
	fName = new TNameControl(rect, kNameText, new BMessage(NAME_FIELD));
	AddChild(fName);

	fName->SetDivider(divide_length + 10);
	fName->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);

	rect.OffsetBy(0,fName->Bounds().Height()+5);
	rect.bottom = rect.top + kSigHeight;
	rect.left = fName->TextView()->Frame().left;

	BRect text = rect;
	text.OffsetTo(10,0);
	fTextView = new TSigTextView(rect, text);
	BScrollView *scroller = new BScrollView("SigScroller", fTextView, B_FOLLOW_ALL, 0, false, true);
	AddChild(scroller);
	scroller->ResizeBy(-1 * scroller->ScrollBar(B_VERTICAL)->Frame().Width() - 9, 0);
	scroller->MoveBy(7,0);

	/* back up a bit to make room for the label */

	rect = scroller->Frame();
	BStringView *stringView = new BStringView(rect, "SigLabel", kSigText);
	AddChild(stringView);

	float tWidth, tHeight;
	stringView->GetPreferredSize(&tWidth, &tHeight);

	/* the 5 is for the spacer in the TextView */

	rect.OffsetBy(-1 *(tWidth) - 5, 0);
	rect.right = rect.left + tWidth;
	rect.bottom = rect.top + tHeight;

	stringView->MoveTo(rect.LeftTop());
	stringView->ResizeTo(rect.Width(), rect.Height());

	/* Resize the View to the correct height */
	scroller->SetResizingMode(B_FOLLOW_NONE);
	ResizeTo(Frame().Width(), scroller->Frame().bottom + 8);
	scroller->SetResizingMode(B_FOLLOW_ALL);
}
Example #2
0
StartWindow::StartWindow(void)
	:	DWindow(BRect(0,0,400,300),"Paladin",B_DOCUMENT_WINDOW, B_NOT_ZOOMABLE)
{
	RegisterWindow();
	AddShortcut('O',B_COMMAND_KEY, new BMessage(M_SHOW_OPEN_PROJECT));
	AddShortcut('N',B_COMMAND_KEY, new BMessage(M_NEW_PROJECT));
	AddShortcut('I',B_COMMAND_KEY, new BMessage(M_SHOW_IMPORT));
	
	AddCommonFilter(new EscapeCancelFilter());
	
	MakeCenteredOnShow(true);
	
	BView *top = GetBackgroundView();
	
	fNewButton = MakeButton("new","NewProjectButtonUp.png","NewProjectButtonDown.png",
							M_NEW_PROJECT);
	top->AddChild(fNewButton);
	fNewButton->MoveTo(10,10);
		
	ClickableStringView *label = MakeLabel(fNewButton,TR("Create a new project"));
	top->AddChild(label);
	label->SetMessage(new BMessage(M_NEW_PROJECT));
	
	fOpenButton = MakeButton("open","OpenProjectButtonUp.png",
							"OpenProjectButtonDown.png", M_SHOW_OPEN_PROJECT);
	top->AddChild(fOpenButton);
	fOpenButton->MoveTo(10,fNewButton->Frame().bottom + 10.0);
	
	label = MakeLabel(fOpenButton,"Open a project");
	top->AddChild(label);
	label->SetMessage(new BMessage(M_SHOW_OPEN_PROJECT));
	
	fOpenRecentButton = MakeButton("openrecent","OpenRecentButtonUp.png",
									"OpenRecentButtonDown.png", M_OPEN_SELECTION);
	top->AddChild(fOpenRecentButton);
	fOpenRecentButton->MoveTo(10,fOpenButton->Frame().bottom + 10.0);
	SetToolTip(fOpenRecentButton,TR("Open a project in the list on the right. You "
									"can also press Command + a number key."));
	
	label = MakeLabel(fOpenRecentButton,TR("Open the selected project"));
	top->AddChild(label);
	label->SetMessage(new BMessage(M_OPEN_SELECTION));
	
	BRect r(Bounds());
	r.left = label->Frame().right + 20.0;
	r.right -= B_V_SCROLL_BAR_WIDTH + 10.0;
	r.top += 10.0;
	r.bottom -= 10.0;
	
	fListView = new StartWindowList(r);
	BScrollView *scrollView = new BScrollView("scroller",fListView,0,
											B_FOLLOW_ALL, false, true);
	top->AddChild(scrollView);
	fListView->SetInvocationMessage(new BMessage(M_OPEN_SELECTION));
	SetToolTip(fListView, "Open a recent project. You can also press Command + a number key.");
	
	fQuickImportButton = MakeButton("quickimport","QuickImportButtonUp.png",
									"QuickImportButtonDown.png",M_SHOW_IMPORT);
	top->AddChild(fQuickImportButton);
	fQuickImportButton->MoveTo(10,fOpenRecentButton->Frame().bottom + 10.0);
	
	label = MakeLabel(fQuickImportButton,"Import an existing project");
	top->AddChild(label);
	label->SetMessage(new BMessage(M_SHOW_IMPORT));
	SetToolTip(label,TR("Quickly make a project by importing all source files and resource files.\n"
						"You can also import a BeIDE project."));
	SetToolTip(fQuickImportButton,
				TR("Quickly make a project by importing all source files and resource files.\n"
					"You can also import a BeIDE project."));	
	fOnlineImportButton = MakeButton("onlineimport","OnlineImportButtonUp.png",
									"OnlineImportButtonDown.png",M_ONLINE_IMPORT);
	top->AddChild(fOnlineImportButton);
	fOnlineImportButton->MoveTo(10,fQuickImportButton->Frame().bottom + 10.0);
	
	label = MakeLabel(fOnlineImportButton,"Import a project from online");
	top->AddChild(label);
	label->SetMessage(new BMessage(M_ONLINE_IMPORT));
	SetToolTip(label,TR("Import a project from an online repository"));
	SetToolTip(fQuickImportButton,
				TR("Import a project from an online repository"));

	
	#ifdef DISABLE_ONLINE_IMPORT
	
	fOnlineImportButton->Hide();
	SetSizeLimits(scrollView->Frame().left + 110.0,30000,
				fQuickImportButton->Frame().bottom + 10.0,30000);
	ResizeTo(scrollView->Frame().left + 160.0,fQuickImportButton->Frame().bottom + 10.0);
	
	#else
	
	SetSizeLimits(scrollView->Frame().left + 110.0,30000,
				fOnlineImportButton->Frame().bottom + 10.0,30000);
	ResizeTo(scrollView->Frame().left + 160.0,fOnlineImportButton->Frame().bottom + 10.0);
	
	#endif
	
	BMessenger msgr(this);
	BEntry entry(gProjectPath.GetFullPath());
	entry_ref ref;
	entry.GetRef(&ref);
	fOpenPanel = new BFilePanel(B_OPEN_PANEL,&msgr,&ref,B_FILE_NODE,true,
								new BMessage(M_OPEN_PROJECT));
	BString titleString(TR("Open Project"));
	titleString.Prepend("Paladin: ");
	fOpenPanel->Window()->SetTitle(titleString.String());
	
	fImportPanel = new BFilePanel(B_OPEN_PANEL,&msgr,&ref,B_DIRECTORY_NODE,true,
								new BMessage(M_QUICK_IMPORT));
	titleString = TR("Choose Project Folder");
	titleString.Prepend("Paladin: ");
	fImportPanel->Window()->SetTitle(titleString.String());
	
	gSettings.Lock();
	int32 index = 0;
	while (gSettings.FindRef("recentitems",index++,&ref) == B_OK)
	{
		if (!BEntry(&ref).Exists())
		{
			index--;
			gSettings.RemoveData("recentitems",index);
		}
		else
			fListView->AddItem(new RefStringItem(ref),0);
	}
	gSettings.Unlock();
	
	// Alt + number opens that number project from the list
	int32 count = (fListView->CountItems() > 9) ? 9 : fListView->CountItems();
	for (int32 i = 0; i < count; i++)
	{
		BMessage *listMsg = new BMessage(M_OPEN_FROM_LIST);
		listMsg->AddInt32("index", i);
		AddShortcut('1' + i, B_COMMAND_KEY, listMsg);
	}
	
	fNewButton->MakeFocus(true);
}
Example #3
0
SCMImportWindow::SCMImportWindow(void)
  :	DWindow(BRect(0,0,350,300), "Import from Repository")
{
	MakeCenteredOnShow(true);
	
	BView *top = GetBackgroundView();
	
	BMenu *menu = new BMenu("Providers");
	
	for (int32 i = 0; i < fProviderMgr.CountImporters(); i++)
	{
		SCMProjectImporter *importer = fProviderMgr.ImporterAt(i);
		if (!importer)
			continue;
		
		BMessage *msg = new BMessage(M_USE_PROVIDER);
		menu->AddItem(new BMenuItem(importer->GetName(), msg));
	}
	
	// Disable custom commands for now	
//	menu->AddSeparatorItem();
//	menu->AddItem(new BMenuItem("Custom", new BMessage(M_USE_CUSTOM_PROVIDER)));
	
	menu->SetLabelFromMarked(true);
	menu->ItemAt(0L)->SetMarked(true);
	
	BRect r(Bounds());
	r.InsetBy(10.0, 10.0);
	r.bottom = 40.0;
	fProviderField = new BMenuField(r, "repofield", "Provider: ", menu,
								B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
	float pw, ph;
	fProviderField->GetPreferredSize(&pw, &ph);
	fProviderField->ResizeTo(r.Width(), ph);
	top->AddChild(fProviderField);
	r = fProviderField->Frame();
	
	menu = new BMenu("Methods");
	if (gHgAvailable)
		menu->AddItem(new BMenuItem("Mercurial", new BMessage(M_UPDATE_COMMAND)));
	
	if (gGitAvailable)
		menu->AddItem(new BMenuItem("Git", new BMessage(M_UPDATE_COMMAND)));
	
	if (gSvnAvailable)
		menu->AddItem(new BMenuItem("Subversion", new BMessage(M_UPDATE_COMMAND)));
	menu->SetLabelFromMarked(true);
	menu->ItemAt(0L)->SetMarked(true);
	fProvider = fProviderMgr.ImporterAt(0);
		
	r.OffsetBy(0.0, r.Height() + 10.0);
	fSCMField = new BMenuField(r, "scmfield", "Method: ", menu,
								B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
	top->AddChild(fSCMField);
		
	r.OffsetBy(0.0, r.Height() + 10.0);
	fProjectBox = new AutoTextControl(r, "project", "Project: ", "",
									new BMessage(M_UPDATE_COMMAND),
									B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
	fProjectBox->GetPreferredSize(&pw, &ph);
	fProjectBox->ResizeTo(r.Width(), ph);
	r = fProjectBox->Frame();
	top->AddChild(fProjectBox);
	
	r.OffsetBy(0.0, r.Height() + 10.0);
	fAnonymousBox = new BCheckBox(r, "anonymous", "Anonymous check-out",
									new BMessage(M_TOGGLE_ANONYMOUS));
	top->AddChild(fAnonymousBox);
	fAnonymousBox->ResizeToPreferred();
	fAnonymousBox->SetValue(B_CONTROL_ON);
	
	r.OffsetBy(0.0, fAnonymousBox->Bounds().Height() + 10.0);
	fUserNameBox = new AutoTextControl(r, "username", "Username: "******"",
									new BMessage(M_UPDATE_COMMAND),
									B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
	top->AddChild(fUserNameBox);
	fUserNameBox->SetEnabled(false);
	
	r.OffsetBy(0.0, r.Height() + 10.0);
	fRepository = new AutoTextControl(r, "repository", "Repository (opt.): ", "",
									new BMessage(M_UPDATE_COMMAND),
									B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
	fRepository->GetPreferredSize(&pw, &ph);
	fRepository->ResizeTo(r.Width(), ph);
	r = fRepository->Frame();
	top->AddChild(fRepository);
	
	r.OffsetBy(0.0, r.Height() + 10.0);
	fCommandLabel = new BStringView(r, "commandlabel", "Command: ",
									B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
	fCommandLabel->ResizeToPreferred();
	top->AddChild(fCommandLabel);
	
	r.OffsetBy(0.0, fCommandLabel->Bounds().Height() + 5.0);
	r.bottom = r.top + 75.0;
	r.right -= B_V_SCROLL_BAR_WIDTH;
	BRect textRect = r.OffsetToCopy(0.0, 0.0).InsetByCopy(10.0, 10.0);
	fCommandView = new BTextView(r, "command", textRect, B_FOLLOW_ALL);
	
	BScrollView *scroll = new BScrollView("scrollview", fCommandView,
											B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
											0, false, true);
	top->AddChild(scroll);
	fCommandView->MakeEditable(false);
	
	fOK = new BButton(r, "ok", "Import", new BMessage(M_SCM_IMPORT),
					B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
	fOK->ResizeToPreferred();
	fOK->MoveTo(Bounds().right - 10.0 - fOK->Bounds().Width(),
				scroll->Frame().bottom + 10.0);
	
	ResizeTo(Bounds().Width(),  fOK->Frame().bottom + 10.0);
	scroll->SetResizingMode(B_FOLLOW_ALL);
	
	top->AddChild(fOK);
	fOK->MakeDefault(true);
	fOK->SetEnabled(false);
	
	UpdateCommand();
	fProviderField->MakeFocus(true);
}
ApplicationTypeWindow::ApplicationTypeWindow(BPoint position, const BEntry& entry)
	: BWindow(BRect(0.0f, 0.0f, 250.0f, 340.0f).OffsetBySelf(position),
		"Application Type", B_TITLED_WINDOW,
		B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS),
	fChangedProperties(0)
{
	// add the menu

	BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), NULL);
	AddChild(menuBar);

	BMenu* menu = new BMenu("File");
	fSaveMenuItem = new BMenuItem("Save", new BMessage(kMsgSave), 'S');
	fSaveMenuItem->SetEnabled(false);
	menu->AddItem(fSaveMenuItem);
	BMenuItem* item;
	menu->AddItem(item = new BMenuItem("Save into resource file" B_UTF8_ELLIPSIS,
		NULL));
	item->SetEnabled(false);

	menu->AddSeparatorItem();
	menu->AddItem(new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED),
		'W', B_COMMAND_KEY));
	menuBar->AddItem(menu);

	// Top view and signature

	BRect rect = Bounds();
	rect.top = menuBar->Bounds().Height() + 1.0f;
	BView* topView = new BView(rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
	topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(topView);

	rect = topView->Bounds().InsetByCopy(8.0f, 8.0f);
	fSignatureControl = new BTextControl(rect, "signature", "Signature:", NULL,
		new BMessage(kMsgSignatureChanged), B_FOLLOW_LEFT_RIGHT);
	fSignatureControl->SetModificationMessage(
		new BMessage(kMsgSignatureChanged));
	fSignatureControl->SetDivider(fSignatureControl->StringWidth(
		fSignatureControl->Label()) + 4.0f);
	float width, height;
	fSignatureControl->GetPreferredSize(&width, &height);
	fSignatureControl->ResizeTo(rect.Width(), height);
	topView->AddChild(fSignatureControl);

	// filter out invalid characters that can't be part of a MIME type name
	BTextView* textView = fSignatureControl->TextView();
	textView->SetMaxBytes(B_MIME_TYPE_LENGTH);
	const char* disallowedCharacters = "<>@,;:\"()[]?=";
	for (int32 i = 0; disallowedCharacters[i]; i++) {
		textView->DisallowChar(disallowedCharacters[i]);
	}

	// "Application Flags" group

	BFont font(be_bold_font);
	font_height fontHeight;
	font.GetHeight(&fontHeight);

	width = font.StringWidth("Icon") + 16.0f;
	if (width < B_LARGE_ICON + 16.0f)
		width = B_LARGE_ICON + 16.0f;

	rect.top = fSignatureControl->Frame().bottom + 4.0f;
	rect.bottom = rect.top + 100.0f;
	rect.right -= width + 8.0f;
	BBox* box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
	topView->AddChild(box);

	fFlagsCheckBox = new BCheckBox(rect, "flags", "Application flags",
		new BMessage(kMsgToggleAppFlags));
	fFlagsCheckBox->SetValue(B_CONTROL_ON);
	fFlagsCheckBox->ResizeToPreferred();
	box->SetLabel(fFlagsCheckBox);

	rect.top = fFlagsCheckBox->Bounds().Height() + 4.0f;
	fSingleLaunchButton = new BRadioButton(rect, "single", "Single launch",
		new BMessage(kMsgAppFlagsChanged));
	fSingleLaunchButton->ResizeToPreferred();
	box->AddChild(fSingleLaunchButton);

	rect.OffsetBy(0.0f, fSingleLaunchButton->Bounds().Height() + 0.0f);
	fMultipleLaunchButton = new BRadioButton(rect, "multiple",
		"Multiple launch", new BMessage(kMsgAppFlagsChanged));
	fMultipleLaunchButton->ResizeToPreferred();
	box->AddChild(fMultipleLaunchButton);

	rect.OffsetBy(0.0f, fSingleLaunchButton->Bounds().Height() + 0.0f);
	fExclusiveLaunchButton = new BRadioButton(rect, "exclusive",
		"Exclusive launch", new BMessage(kMsgAppFlagsChanged));
	fExclusiveLaunchButton->ResizeToPreferred();
	box->AddChild(fExclusiveLaunchButton);

	rect.top = fSingleLaunchButton->Frame().top;
	rect.left = fExclusiveLaunchButton->Frame().right + 4.0f;
	fArgsOnlyCheckBox = new BCheckBox(rect, "args only", "Args only",
		new BMessage(kMsgAppFlagsChanged));
	fArgsOnlyCheckBox->ResizeToPreferred();
	box->AddChild(fArgsOnlyCheckBox);

	rect.top += fArgsOnlyCheckBox->Bounds().Height();
	fBackgroundAppCheckBox = new BCheckBox(rect, "background",
		"Background app", new BMessage(kMsgAppFlagsChanged));
	fBackgroundAppCheckBox->ResizeToPreferred();
	box->AddChild(fBackgroundAppCheckBox);

	box->ResizeTo(box->Bounds().Width(),
		fExclusiveLaunchButton->Frame().bottom + 8.0f);

	// "Icon" group

	rect = box->Frame();
#ifdef __ANTARES__
	rect.top += box->TopBorderOffset();
#endif
	rect.left = rect.right + 8.0f;
	rect.right += width + 8.0f;
	float iconBoxWidth = rect.Width();
	box = new BBox(rect, NULL, B_FOLLOW_RIGHT | B_FOLLOW_TOP);
	box->SetLabel("Icon");
#ifdef __ANTARES__
	box->MoveBy(0.0f, -box->TopBorderOffset());
	box->ResizeBy(0.0f, box->TopBorderOffset());
#endif
	topView->AddChild(box);

	rect = BRect(8.0f, 0.0f, 7.0f + B_LARGE_ICON, B_LARGE_ICON - 1.0f);
#ifdef __ANTARES__
	rect.OffsetBy(0.0f, (box->Bounds().Height() + box->TopBorderOffset()
		- rect.Height()) / 2.0f);
#else
	rect.OffsetBy(0.0f, (box->Bounds().Height() - rect.Height()) / 2.0f);
#endif
	if (rect.top < fontHeight.ascent + fontHeight.descent + 4.0f)
		rect.top = fontHeight.ascent + fontHeight.descent + 4.0f;
	fIconView = new IconView(rect, "icon");
	fIconView->SetModificationMessage(new BMessage(kMsgIconChanged));
	box->AddChild(fIconView);

	// "Supported Types" group

	rect.top = box->Frame().bottom + 8.0f;
	rect.bottom = rect.top + box->Bounds().Height();
	rect.left = 8.0f;
	rect.right = Bounds().Width() - 8.0f;
	BBox* typeBox = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
	typeBox->SetLabel("Supported types");
	topView->AddChild(typeBox);

	rect = typeBox->Bounds().InsetByCopy(8.0f, 6.0f);
	rect.top += ceilf(fontHeight.ascent);
	fAddTypeButton = new BButton(rect, "add type", "Add" B_UTF8_ELLIPSIS,
		new BMessage(kMsgAddType), B_FOLLOW_RIGHT);
	fAddTypeButton->ResizeToPreferred();
	fAddTypeButton->MoveBy(rect.right - fAddTypeButton->Bounds().Width()
		- B_LARGE_ICON - 16.0f, 0.0f);
	typeBox->AddChild(fAddTypeButton);

	rect = fAddTypeButton->Frame();
	rect.OffsetBy(0, rect.Height() + 4.0f);
	fRemoveTypeButton = new BButton(rect, "remove type", "Remove",
		new BMessage(kMsgRemoveType), B_FOLLOW_RIGHT);
	typeBox->AddChild(fRemoveTypeButton);

	rect.right = rect.left - 10.0f - B_V_SCROLL_BAR_WIDTH;
	rect.left = 10.0f;
	rect.top = 8.0f + ceilf(fontHeight.ascent);
	rect.bottom -= 2.0f;
		// take scrollview border into account
	fTypeListView = new SupportedTypeListView(rect, "type listview",
		B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL);
	fTypeListView->SetSelectionMessage(new BMessage(kMsgTypeSelected));

	BScrollView* scrollView = new BScrollView("type scrollview", fTypeListView,
		B_FOLLOW_ALL, B_FRAME_EVENTS | B_WILL_DRAW, false, true);

	typeBox->ResizeTo(typeBox->Bounds().Width(), fRemoveTypeButton->Frame().bottom + 8.0f);
	typeBox->AddChild(scrollView);

	rect.left = fRemoveTypeButton->Frame().right + 8.0f;
#ifdef __ANTARES__
	rect.top = (box->Bounds().Height() + box->TopBorderOffset() - B_LARGE_ICON) / 2.0f;
#else
	rect.top = (box->Bounds().Height() - B_LARGE_ICON) / 2.0f;
#endif
	rect.right = rect.left + B_LARGE_ICON - 1.0f;
	rect.bottom = rect.top + B_LARGE_ICON - 1.0f;
	fTypeIconView = new IconView(rect, "type icon", B_FOLLOW_RIGHT | B_FOLLOW_TOP);
	fTypeIconView->SetModificationMessage(new BMessage(kMsgTypeIconsChanged));
	typeBox->AddChild(fTypeIconView);

	// "Version Info" group

	rect.top = typeBox->Frame().bottom + 8.0f;
	rect.bottom = rect.top + typeBox->Bounds().Height();
	rect.left = 8.0f;
	rect.right = Bounds().Width() - 8.0f;
	box = new BBox(rect, NULL, B_FOLLOW_LEFT_RIGHT);
		// the resizing mode will later also be set to B_FOLLOW_BOTTOM
	box->SetLabel("Version info");
	topView->AddChild(box);

	BMenuField* menuField;
#if 0
	BPopUpMenu *popUpMenu = new BPopUpMenu("version info", true, true);
	item = new BMenuItem("Version Info", NULL);
	item->SetMarked(true);
	popUpMenu->AddItem(item);
	item = new BMenuItem("System Version Info", NULL);
	popUpMenu->AddItem(item);

	menuField = new BMenuField(BRect(0, 0, 100, 15),
		"version kind", NULL, popUpMenu, true);
	menuField->ResizeToPreferred();
	box->SetLabel(menuField);
#endif

	rect.top = 4.0f + ceilf(fontHeight.ascent + fontHeight.descent);
	rect.bottom = rect.top + height;
	fMajorVersionControl = new BTextControl(rect, "major", "Version:", NULL,
		NULL);
	fMajorVersionControl->SetDivider(fMajorVersionControl->StringWidth(
		fMajorVersionControl->Label()) + 4.0f);
	fMajorVersionControl->GetPreferredSize(&width, &height);
	width = 12.0f + fMajorVersionControl->StringWidth("99");
	fMajorVersionControl->ResizeTo(fMajorVersionControl->Divider() + width, height);
	_MakeNumberTextControl(fMajorVersionControl);
	box->AddChild(fMajorVersionControl);

	rect.left = fMajorVersionControl->Frame().right + 1.0f;
	fMiddleVersionControl = new BTextControl(rect, "middle", ".", NULL,
		NULL);
	fMiddleVersionControl->SetDivider(fMiddleVersionControl->StringWidth(
		fMiddleVersionControl->Label()) + 4.0f);
	fMiddleVersionControl->ResizeTo(fMiddleVersionControl->Divider() + width, height);
	_MakeNumberTextControl(fMiddleVersionControl);
	box->AddChild(fMiddleVersionControl);

	rect.left = fMiddleVersionControl->Frame().right + 1.0f;
	fMinorVersionControl = new BTextControl(rect, "middle", ".", NULL,
		NULL);
	fMinorVersionControl->SetDivider(fMinorVersionControl->StringWidth(
		fMinorVersionControl->Label()) + 4.0f);
	fMinorVersionControl->ResizeTo(fMinorVersionControl->Divider() + width, height);
	_MakeNumberTextControl(fMinorVersionControl);
	box->AddChild(fMinorVersionControl);

	fVarietyMenu = new BPopUpMenu("variety", true, true);
	fVarietyMenu->AddItem(new BMenuItem("Development", NULL));
	fVarietyMenu->AddItem(new BMenuItem("Alpha", NULL));
	fVarietyMenu->AddItem(new BMenuItem("Beta", NULL));
	fVarietyMenu->AddItem(new BMenuItem("Gamma", NULL));
	fVarietyMenu->AddItem(item = new BMenuItem("Golden master", NULL));
	item->SetMarked(true);
	fVarietyMenu->AddItem(new BMenuItem("Final", NULL));

	rect.top--;
		// BMenuField oddity
	rect.left = fMinorVersionControl->Frame().right + 6.0f;
	menuField = new BMenuField(rect,
		"variety", NULL, fVarietyMenu, true);
	menuField->ResizeToPreferred();
	box->AddChild(menuField);

	rect.top++;
	rect.left = menuField->Frame().right;
	rect.right = rect.left + 30.0f;	
	fInternalVersionControl = new BTextControl(rect, "internal", "/", NULL,
		NULL);
	fInternalVersionControl->SetDivider(fInternalVersionControl->StringWidth(
		fInternalVersionControl->Label()) + 4.0f);
	fInternalVersionControl->ResizeTo(fInternalVersionControl->Divider() + width, height);
	box->AddChild(fInternalVersionControl);

	rect = box->Bounds().InsetByCopy(8.0f, 0.0f);
	rect.top = fInternalVersionControl->Frame().bottom + 8.0f;
	fShortDescriptionControl = new BTextControl(rect, "short desc", "Short description:",
		NULL, NULL, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
	float labelWidth = fShortDescriptionControl->StringWidth(
		fShortDescriptionControl->Label()) + 4.0f;
	fShortDescriptionControl->SetDivider(labelWidth);
	fShortDescriptionControl->GetPreferredSize(&width, &height);
	fShortDescriptionControl->ResizeTo(rect.Width(), height);

	// TODO: workaround for a GCC 4.1.0 bug? Or is that really what the standard says?
	version_info versionInfo;
	fShortDescriptionControl->TextView()->SetMaxBytes(sizeof(versionInfo.short_info));
	box->AddChild(fShortDescriptionControl);

	rect.OffsetBy(0.0f, fShortDescriptionControl->Bounds().Height() + 5.0f);
	rect.right = rect.left + labelWidth;
	StringView* label = new StringView(rect, NULL, "Long description:", NULL);
	label->SetDivider(labelWidth);
	box->AddChild(label);

	rect.left = rect.right + 3.0f;
	rect.top += 1.0f;
	rect.right = box->Bounds().Width() - 10.0f - B_V_SCROLL_BAR_WIDTH;
	rect.bottom = rect.top + fShortDescriptionControl->Bounds().Height() * 3.0f - 1.0f;
	fLongDescriptionView = new TabFilteringTextView(rect, "long desc",
		rect.OffsetToCopy(B_ORIGIN), B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS
		| B_NAVIGABLE);
	fLongDescriptionView->SetMaxBytes(sizeof(versionInfo.long_info));

	scrollView = new BScrollView("desc scrollview", fLongDescriptionView,
		B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP, B_FRAME_EVENTS | B_WILL_DRAW, false, true);
	box->ResizeTo(box->Bounds().Width(), scrollView->Frame().bottom + 8.0f);
	box->AddChild(scrollView);

	// Adjust window size and limits

	width = fInternalVersionControl->Frame().right + 16.0f;
	float minWidth = fBackgroundAppCheckBox->Frame().right + iconBoxWidth + 32.0f;
	if (width > minWidth)
		minWidth = width;

	ResizeTo(Bounds().Width() > minWidth ? Bounds().Width() : minWidth,
		box->Frame().bottom + topView->Frame().top + 8.0f);
	SetSizeLimits(minWidth, 32767.0f, Bounds().Height(), 32767.0f);
	typeBox->SetResizingMode(B_FOLLOW_ALL);
	box->SetResizingMode(B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM);

	fSignatureControl->MakeFocus(true);

	BMimeType::StartWatching(this);
	_SetTo(entry);
}
ShortcutsWindow::ShortcutsWindow()
	:
	BWindow(BRect(0, 0, 0, 0), B_TRANSLATE_SYSTEM_NAME("Shortcuts"),
		B_TITLED_WINDOW, 0L),
	fSavePanel(NULL), 
	fOpenPanel(NULL), 
	fSelectPanel(NULL), 
	fKeySetModified(false), 		
	fLastOpenWasAppend(false)
{
	ShortcutsSpec::InitializeMetaMaps();
	
	float spacing = be_control_look->DefaultItemSpacing();

	BView* top = new BView(Bounds(), NULL, B_FOLLOW_ALL_SIDES, 0);
	top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(top);

	BMenuBar* menuBar = new BMenuBar(BRect(0, 0, 0, 0), "Menu Bar");

	BMenu* fileMenu = new BMenu(B_TRANSLATE("File"));
	fileMenu->AddItem(new BMenuItem(B_TRANSLATE("Open KeySet" B_UTF8_ELLIPSIS),
		new BMessage(OPEN_KEYSET), 'O'));
	fileMenu->AddItem(new BMenuItem(
		B_TRANSLATE("Append KeySet" B_UTF8_ELLIPSIS),
		new BMessage(APPEND_KEYSET), 'A'));
	fileMenu->AddItem(new BMenuItem(B_TRANSLATE("Revert to saved"),
		new BMessage(REVERT_KEYSET), 'A'));
	fileMenu->AddItem(new BSeparatorItem);
	fileMenu->AddItem(new BMenuItem(
		B_TRANSLATE("Save KeySet as" B_UTF8_ELLIPSIS),
		new BMessage(SAVE_KEYSET_AS), 'S'));
	fileMenu->AddItem(new BSeparatorItem);
	fileMenu->AddItem(new BMenuItem(B_TRANSLATE("Quit"),
		new BMessage(B_QUIT_REQUESTED), 'Q'));
	menuBar->AddItem(fileMenu);

	top->AddChild(menuBar);

	BRect tableBounds = Bounds();
	tableBounds.top = menuBar->Bounds().bottom + 1;
	tableBounds.right -= B_V_SCROLL_BAR_WIDTH;
	tableBounds.bottom -= B_H_SCROLL_BAR_HEIGHT;

	BScrollView* containerView;
	fColumnListView = new ColumnListView(tableBounds, &containerView, NULL,
		B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE,
		B_SINGLE_SELECTION_LIST, true, true, true, B_NO_BORDER);

	fColumnListView->SetEditMessage(new BMessage(HOTKEY_ITEM_MODIFIED),
		BMessenger(this));

	float minListWidth = 0;
		// A running total is kept as the columns are created.
	float cellWidth = be_plain_font->StringWidth("Either") + 20;
		// ShortcutsSpec does not seem to translate the string "Either".

	for (int i = 0; i < ShortcutsSpec::NUM_META_COLUMNS; i++) {
		const char* name = ShortcutsSpec::GetColumnName(i);
		float headerWidth = be_plain_font->StringWidth(name) + 20;
		float width = max_c(headerWidth, cellWidth);
		minListWidth += width + 1;

		fColumnListView->AddColumn(
			new CLVColumn(name, CreateMetaPopUp(i), width, CLV_SORT_KEYABLE));
	}

	float keyCellWidth = be_plain_font->StringWidth("Caps Lock") + 20;
	fColumnListView->AddColumn(new CLVColumn(B_TRANSLATE("Key"),
		CreateKeysPopUp(), keyCellWidth, CLV_SORT_KEYABLE));
	minListWidth += keyCellWidth + 1;

	BPopUpMenu* popup = new BPopUpMenu(NULL, false);
	popup->AddItem(new BMenuItem(
		B_TRANSLATE("(Choose application with file requester)"), NULL));
	popup->AddItem(new BMenuItem(
		B_TRANSLATE("*InsertString \"Your Text Here\""), NULL));
	popup->AddItem(new BMenuItem(
		B_TRANSLATE("*MoveMouse +20 +0"), NULL));
	popup->AddItem(new BMenuItem(B_TRANSLATE("*MoveMouseTo 50% 50%"), NULL));
	popup->AddItem(new BMenuItem(B_TRANSLATE("*MouseButton 1"), NULL));
	popup->AddItem(new BMenuItem(
		B_TRANSLATE("*LaunchHandler text/html"), NULL));
	popup->AddItem(new BMenuItem(
		B_TRANSLATE("*Multi \"*MoveMouseTo 100% 0\" \"*MouseButton 1\""),
		NULL));
	popup->AddItem(new BMenuItem(B_TRANSLATE("*MouseDown"), NULL));
	popup->AddItem(new BMenuItem(B_TRANSLATE("*MouseUp"), NULL));
	popup->AddItem(new BMenuItem(
		B_TRANSLATE("*SendMessage application/x-vnd.Be-TRAK 'Tfnd'"), NULL));
	popup->AddItem(new BMenuItem(B_TRANSLATE("*Beep"), NULL));
	fColumnListView->AddColumn(new CLVColumn(B_TRANSLATE("Application"), popup,
		323.0, CLV_SORT_KEYABLE));
	minListWidth += 323.0 + 1;
	minListWidth += B_V_SCROLL_BAR_WIDTH;

	fColumnListView->SetSortFunction(ShortcutsSpec::MyCompare);
	top->AddChild(containerView);

	fColumnListView->SetSelectionMessage(new BMessage(HOTKEY_ITEM_SELECTED));
	fColumnListView->SetTarget(this);

	fAddButton = new BButton(BRect(0, 0, 0, 0), "add",
		B_TRANSLATE("Add new shortcut"), new BMessage(ADD_HOTKEY_ITEM),
		B_FOLLOW_BOTTOM);
	fAddButton->ResizeToPreferred();
	fAddButton->MoveBy(spacing,
		Bounds().bottom - fAddButton->Bounds().bottom - spacing);
	top->AddChild(fAddButton);

	fRemoveButton = new BButton(BRect(0, 0, 0, 0), "remove",
		B_TRANSLATE("Remove selected shortcut"),
		new BMessage(REMOVE_HOTKEY_ITEM), B_FOLLOW_BOTTOM);
	fRemoveButton->ResizeToPreferred();
	fRemoveButton->MoveBy(fAddButton->Frame().right + spacing,
		Bounds().bottom - fRemoveButton->Bounds().bottom - spacing);
	top->AddChild(fRemoveButton);

	fRemoveButton->SetEnabled(false);

	fSaveButton = new BButton(BRect(0, 0, 0, 0), "save",
		B_TRANSLATE("Save & apply"), new BMessage(SAVE_KEYSET),
		B_FOLLOW_BOTTOM | B_FOLLOW_RIGHT);
	fSaveButton->ResizeToPreferred();
	fSaveButton->MoveBy(Bounds().right - fSaveButton->Bounds().right - spacing,
		Bounds().bottom - fSaveButton->Bounds().bottom - spacing);
	top->AddChild(fSaveButton);

	fSaveButton->SetEnabled(false);

	containerView->ResizeBy(0,
		-(fAddButton->Bounds().bottom + 2 * spacing + 2));

	float minButtonBarWidth = fRemoveButton->Frame().right
		+ fSaveButton->Bounds().right + 2 * spacing;
	float minWidth = max_c(minListWidth, minButtonBarWidth);

	float menuBarHeight = menuBar->Bounds().bottom;
	float buttonBarHeight = Bounds().bottom - containerView->Frame().bottom;
	float minHeight = menuBarHeight + 200 + buttonBarHeight;

	SetSizeLimits(minWidth, MAX_WIDTH, minHeight, MAX_HEIGHT);
		// SetSizeLimits() will resize the window to the minimum size.

	CenterOnScreen();

	entry_ref windowSettingsRef;
	if (_GetWindowSettingsFile(&windowSettingsRef)) {
		// The window settings file is not accepted via B_REFS_RECEIVED; this
		// is a behind-the-scenes file that the user will never see or
		// interact with.
		BFile windowSettingsFile(&windowSettingsRef, B_READ_ONLY);
		BMessage loadMsg;
		if (loadMsg.Unflatten(&windowSettingsFile) == B_OK)
			_LoadWindowSettings(loadMsg);
	}

	entry_ref keySetRef;
	if (_GetSettingsFile(&keySetRef)) {
		BMessage msg(B_REFS_RECEIVED);
		msg.AddRef("refs", &keySetRef);
		msg.AddString("startupRef", "please");
		PostMessage(&msg);
			// Tell ourselves to load this file if it exists.
	}
	Show();
}
Example #6
0
RecipeEditor::RecipeEditor(const BRect &frame, const BMessenger &msgr,
						const int32 &number, const char *category)
 :	BWindow(frame,"Add Recipe",B_FLOATING_WINDOW_LOOK, B_MODAL_SUBSET_WINDOW_FEEL,
 			B_ASYNCHRONOUS_CONTROLS),
 	fMessenger(msgr),
 	fNumber(number),
 	fCategory(category)
{
	AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
	AddShortcut('Q', B_COMMAND_KEY, new BMessage(M_QUIT_APP));
	
	BView *back = new BView(Bounds(),"back",B_FOLLOW_ALL, B_WILL_DRAW);
	back->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(back);
	
	fCategories = new BMenu("Categories");
	CppSQLite3Query query = DBQuery("select category from categories order by category;",
									"RecipeEditor:get categories");
	while(!query.eof())
	{
		BString cat(DeescapeIllegalCharacters(query.getStringField(0)));
		BMessage *menumsg = new BMessage(M_CATEGORY_CHANGED);
		menumsg->AddString("name",cat);
		fCategories->AddItem(new BMenuItem(cat.String(),menumsg));
		query.nextRow();
	}
	fCategories->SetRadioMode(true);
	fCategories->SetLabelFromMarked(true);
	if(fCategories->CountItems()>0)
		fCategories->ItemAt(0)->SetMarked(true);
	BRect r(10,10,10 + fCategories->MaxContentWidth(),11);
	BMenuField *field = new BMenuField(r,"field","Category",fCategories,
										B_FOLLOW_LEFT | B_FOLLOW_TOP,
										B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP);
	back->AddChild(field);
	field->ResizeToPreferred();
	r = field->Frame();
	
	if(category)
	{
		BMenuItem *marked = fCategories->FindItem(category);
		if(marked)
			marked->SetMarked(true);
	}
	else
	{
		BMenuItem *marked = fCategories->ItemAt(0L);
		if(marked)
			marked->SetMarked(true);
	}
	
	r.OffsetBy(0,r.Height() + 10);
	fNameBox = new AutoTextControl(r,"namebox","Name: ",NULL,NULL,
									B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,
									B_WILL_DRAW | B_PULSE_NEEDED | B_NAVIGABLE |
									B_NAVIGABLE_JUMP);
	fNameBox->SetEscapeCancel(true);
	fNameBox->SetDivider(be_plain_font->StringWidth("Name ") + 5);
	back->AddChild(fNameBox);
	fNameBox->ResizeToPreferred();
	r = fNameBox->Frame();
	r.right = Bounds().right - 10;
	fNameBox->ResizeTo(r.Width(), r.Height());
	
	r.OffsetBy(0,r.Height() + 10);
	BStringView *label = new BStringView(r,"inglabel","Ingredients:");
	back->AddChild(label);
	
	r.OffsetBy(0,r.Height() + 10);
	r.bottom = r.top + 100;
	r.right -= B_V_SCROLL_BAR_WIDTH;
	
	BRect textrect = r.OffsetToCopy(0,0);
	textrect.InsetBy(10,10);
	fIngredientBox = new BTextView(r, "ingredients", textrect, B_FOLLOW_ALL,
									B_WILL_DRAW | B_PULSE_NEEDED | B_NAVIGABLE |
									B_NAVIGABLE_JUMP);
	fIngredientBox->SetDoesUndo(true);
	
	
	BScrollView *ingredscroll = new BScrollView("ingredients_scroller",fIngredientBox,
										B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,0,false, true);
	back->AddChild(ingredscroll);
	
	r = ingredscroll->Frame();
	
	label = new BStringView(BRect(10,10,11,11),"dirlabel","Directions:");
	label->ResizeToPreferred();
	label->MoveTo(10, r.bottom + 10);
	back->AddChild(label);
	
	r.OffsetBy(0,r.Height() + 20 + label->Frame().Height());
	r.right -= B_V_SCROLL_BAR_WIDTH;
	textrect = r.OffsetToCopy(0,0);
	textrect.InsetBy(10,10);
	fDirectionsBox = new BTextView(r, "directions", textrect, B_FOLLOW_ALL,
									B_WILL_DRAW | B_PULSE_NEEDED | B_NAVIGABLE |
									B_NAVIGABLE_JUMP);
	fDirectionsBox->SetDoesUndo(true);
	
	BScrollView *dirscroll = new BScrollView("directions_scroller",fDirectionsBox,
										B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP,0,false, true);
	back->AddChild(dirscroll);
	
	
	fOK = new BButton(BRect(10,10,11,11),"ok","Cancel", new BMessage(M_ADD_RECIPE),
							B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM, B_WILL_DRAW);
	fOK->ResizeToPreferred();
	fOK->SetLabel("OK");
	fOK->MoveTo(Bounds().right - fOK->Bounds().Width() - 10,
				Bounds().bottom - fOK->Bounds().Height() - 10);
	r = fOK->Frame();
	back->AddChild(fOK);
	
	r.OffsetBy(-r.Width() - 10, 0);
	fCancel = new BButton(r,"cancel","Cancel",new BMessage(B_QUIT_REQUESTED),
						B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM, B_WILL_DRAW);
	back->AddChild(fCancel);
	
	field->MakeFocus(true);
	
	ResizeTo(Bounds().Width(),
			fDirectionsBox->Parent()->Frame().bottom + 20 + fOK->Bounds().Height());
	
	dirscroll->SetResizingMode(B_FOLLOW_ALL);
	
	// This is the part that's different for editing a recipe as opposed to
	// just adding one to the database
	if(number >= 0 && category)
	{
		SetTitle("Edit Recipe");
		BString name, ingredients, directions;
		if(GetRecipe(number,category,name,ingredients,directions))
		{
			BMenuItem *item = fCategories->FindItem(category);
			if(item)
				item->SetMarked(true);
			
			fNameBox->SetText(name.String());
			fIngredientBox->SetText(ingredients.String());
			fDirectionsBox->SetText(directions.String());
			fOK->SetMessage(new BMessage(M_EDIT_RECIPE));
		}
	}
	
	AddShortcut(B_ENTER, B_COMMAND_KEY, new BMessage(fOK->Command()));
}
Example #7
0
NetworkPrefsView::NetworkPrefsView (BRect bounds, const char *name)
	: BView (
			bounds,
			name,
			B_FOLLOW_ALL_SIDES, B_WILL_DRAW),
				fNickUpButton (NULL),
				fNickDnButton (NULL),
				fNickPrompt (NULL),
					fNetPrompt (NULL),
					fDupePrompt (NULL),
					fServerPrefs (NULL)
{
	SetViewColor (ui_color (B_PANEL_BACKGROUND_COLOR));
	BMenu *menu (new BMenu (B_TRANSLATE("Network")));
	menu->AddItem (new BMenuItem (B_TRANSLATE("Defaults"), new BMessage (M_NETWORK_DEFAULTS)));
	menu->AddSeparatorItem ();
	BString itemText = B_TRANSLATE("Add network" B_UTF8_ELLIPSIS);
	menu->AddItem (new BMenuItem (itemText.String(), new BMessage (M_ADD_NEW_NETWORK)));
	menu->AddItem (fRemoveItem = new BMenuItem (B_TRANSLATE("Remove current network"), new BMessage (M_REMOVE_CURRENT_NETWORK)));
	itemText = B_TRANSLATE("Duplicate current network" B_UTF8_ELLIPSIS);
	menu->AddItem (fDupeItem = new BMenuItem (itemText.String(), new BMessage (M_DUPE_CURRENT_NETWORK)));
	fNetworkMenu = new BMenuField (BRect (0, 0, 100, 30), "NetList", NULL, menu);
	fMainNetBox = new BBox (Bounds ().InsetByCopy (5, 5));
	fMainNetBox->SetLabel (fNetworkMenu);
	AddChild (fMainNetBox);
	BRect boundsRect (Bounds ().InsetByCopy (10, 15));
	boundsRect.right /= 2;
	boundsRect.right -= 8;
	boundsRect.top += 15;
	boundsRect.bottom -= 30;
	fNetDetailsBox = new BBox (boundsRect);
	fNetDetailsBox->SetLabel (B_TRANSLATE("Network Details"));
	fMainNetBox->AddChild (fNetDetailsBox);
	fPersonalBox = new BBox (boundsRect);
	fPersonalBox->SetLabel (B_TRANSLATE("Personal Details"));
	fMainNetBox->AddChild (fPersonalBox);
	fPersonalBox->MoveBy (boundsRect.Width () + 16, 0);
	boundsRect.left += 10;
	boundsRect.right = boundsRect.left + 10;
	boundsRect.top = 10;
	boundsRect.bottom += 20;
	BStringView *stringView1 (new BStringView(boundsRect, NULL,
		B_TRANSLATE("Primary server: ")));
	stringView1->ResizeToPreferred();
	fNetDetailsBox->AddChild(stringView1);
	stringView1->MoveTo(fNetDetailsBox->Frame().left, fNetDetailsBox->Frame().top);
	fConnectServer = new BStringView(boundsRect, NULL, "irc.freenode.net");
	fConnectServer->ResizeToPreferred();
	fNetDetailsBox->AddChild(fConnectServer);
	fConnectServer->MoveTo(stringView1->Frame().left, stringView1->Frame().bottom);
	fAlternates = new BStringView(boundsRect, NULL, B_TRANSLATE("Fallbacks: %1"));
	fAlternates->ResizeToPreferred();
	fNetDetailsBox->AddChild(fAlternates);
	fAlternates->MoveTo(fConnectServer->Frame().left, fConnectServer->Frame().bottom);
	itemText = B_TRANSLATE("Edit servers" B_UTF8_ELLIPSIS);
	fServerButton = new BButton (boundsRect, NULL, itemText.String(),
						new BMessage (M_SERVER_DIALOG));
	fServerButton->ResizeToPreferred ();
	fServerButton->MoveTo (fNetDetailsBox->Frame().right - (fServerButton->Frame().Width() + 20),
			fAlternates->Frame().bottom + 10.0);
	fNetDetailsBox->AddChild (fServerButton);
	itemText = B_TRANSLATE("Autoexec");
	itemText += ":";
	BStringView *stringView4 (new BStringView (boundsRect, NULL, itemText.String()));
	stringView4->ResizeToPreferred ();
	stringView4->MoveTo (fNetDetailsBox->Frame().left, fServerButton->Frame ().bottom);
	fNetDetailsBox->AddChild (stringView4);
	boundsRect = fNetDetailsBox->Frame ();
	boundsRect.right -= (20 + B_V_SCROLL_BAR_WIDTH);;
	boundsRect.top = stringView4->Frame ().bottom + 5;
	boundsRect.bottom -= 65;
	fTextView = new InvokingTextView (boundsRect, NULL, new BMessage(M_NETPREFS_TEXT_INVOKE), this, B_FOLLOW_NONE, B_WILL_DRAW);
	BScrollView *scrollView (new BScrollView (NULL, fTextView, B_FOLLOW_LEFT | B_FOLLOW_TOP,
							0, false, true));
	fTextView->MakeEditable (true);
	fTextView->SetStylable (false);
	fNetDetailsBox->AddChild (scrollView);
	fLagCheckBox = new BCheckBox (boundsRect, NULL, B_TRANSLATE("Enable lag checking"),
									new BMessage (M_NET_CHECK_LAG));
	fLagCheckBox->ResizeToPreferred ();
	fLagCheckBox->MoveTo (scrollView->Frame().left,
		scrollView->Frame ().bottom + 5);
	fNetDetailsBox->AddChild (fLagCheckBox);
	fStartupBox = new BCheckBox (boundsRect, NULL, B_TRANSLATE("Connect to this network when Vision starts up"),
						new BMessage (M_CONNECT_ON_STARTUP));
	fStartupBox->ResizeToPreferred ();
	fStartupBox->MoveTo (fNetDetailsBox->Frame ().left, fMainNetBox->Frame ().bottom - (fStartupBox->Bounds ().Height () + 12));
	fMainNetBox->AddChild (fStartupBox);
	fNickDefaultsBox = new BCheckBox (boundsRect, NULL, B_TRANSLATE("Use Defaults"),
					 new BMessage (M_USE_NICK_DEFAULTS));
	fNickDefaultsBox->ResizeToPreferred ();
	fNickDefaultsBox->MoveTo (fNetDetailsBox->Frame ().left, fNetDetailsBox->Frame ().top);
	fPersonalBox->AddChild (fNickDefaultsBox);
	itemText = B_TRANSLATE("Preferred Nicknames:");
	BStringView *stringView5 (new BStringView (boundsRect, NULL, B_TRANSLATE("Preferred Nicknames:")));
	stringView5->ResizeToPreferred ();
	stringView5->MoveTo (fNetDetailsBox->Frame ().left, fNickDefaultsBox->Frame ().bottom + 5);
	fPersonalBox->AddChild (stringView5);
	fListView = new BListView (scrollView->Frame (), NULL);
	fListView->SetSelectionMessage (new BMessage (M_NICK_SELECTED));
	fListView->ResizeBy (-B_V_SCROLL_BAR_WIDTH, -10.0);
	fListView->MoveTo (fListView->Frame ().left, stringView5->Frame ().bottom + 5);
	BScrollView *listScroll (new BScrollView (NULL, fListView, B_FOLLOW_LEFT | B_FOLLOW_TOP,
							0, false, true));
	fPersonalBox->AddChild (listScroll);
	itemText = B_TRANSLATE("Add" B_UTF8_ELLIPSIS);
	fNickAddButton = new BButton (boundsRect, NULL, itemText.String(), new BMessage (M_ADD_NICK));
	fNickAddButton->ResizeToPreferred ();
	fNickRemoveButton = new BButton (boundsRect, NULL, B_TRANSLATE("Remove"), new BMessage (M_REMOVE_NICK));
	fNickRemoveButton->ResizeToPreferred ();
	fNickRemoveButton->MoveTo (listScroll->Frame ().right - fNickRemoveButton->Frame ().Width (),
					listScroll->Frame ().bottom + 5);
	fPersonalBox->AddChild (fNickRemoveButton);
	fNickAddButton->MoveTo (fNickRemoveButton->Frame ().left - (fNickAddButton->Frame ().Width () + 5),
			 fNickRemoveButton->Frame ().top);
	fPersonalBox->AddChild (fNickAddButton);
	BBitmap *bmp (BTranslationUtils::GetBitmap ('bits', "UpArrow"));
	if (bmp)
	{
		boundsRect = bmp->Bounds ().InsetByCopy (-2, -2);
		fNickUpButton = new TSpeedButton (boundsRect, NULL, NULL, new BMessage (M_NICK_UP), bmp);
		fNickUpButton->MoveTo (listScroll->Frame ().left, fNickAddButton->Frame ().top);
		fPersonalBox->AddChild (fNickUpButton);
		delete bmp;
	}
	bmp = BTranslationUtils::GetBitmap ('bits', "DownArrow");
	if (bmp)
	{
		boundsRect = bmp->Bounds ().InsetByCopy (-2, -2);
		fNickDnButton = new TSpeedButton (boundsRect, NULL, NULL, new BMessage (M_NICK_DOWN), bmp);
		fNickDnButton->MoveTo (fNickUpButton->Frame ().left, fNickUpButton->Frame ().bottom);
		fPersonalBox->AddChild (fNickDnButton);
		delete bmp;
	}
	itemText = B_TRANSLATE("Ident");
	itemText += ": ";
	fIdent = new BTextControl (listScroll->Frame (), NULL, itemText.String(), NULL, NULL);
	itemText = B_TRANSLATE("Real name");
	itemText += ": ";
	fRealName = new BTextControl (listScroll->Frame (), NULL, itemText.String(), NULL, NULL);
	fRealName->ResizeTo (listScroll->Frame ().Width (), fRealName->Frame ().Height ());
	fRealName->MoveTo (listScroll->Frame ().left, fNickAddButton->Frame ().bottom + 5);
	fRealName->SetDivider (fRealName->StringWidth (fRealName->Label ()) + 5);
	fPersonalBox->AddChild (fRealName);
	fIdent->ResizeTo (fRealName->Frame ().Width (), fRealName->Frame ().Height ());
	fIdent->MoveTo (listScroll->Frame ().left, fRealName->Frame ().bottom + 5);
	fIdent->SetDivider (fRealName->Divider ());
	fPersonalBox->AddChild (fIdent);
}