예제 #1
0
MainWindow::MainWindow()
	: BWindow(BRect(0, 0, 1, 1), TR("Fonts"), B_TITLED_WINDOW,
		B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
{
	fDefaultsButton = new BButton("defaults", TR("Defaults"),
		new BMessage(kMsgSetDefaults), B_WILL_DRAW);
	fDefaultsButton->SetEnabled(false);

	fRevertButton = new BButton("revert", TR("Revert"),
		new BMessage(kMsgRevert), B_WILL_DRAW);
	fRevertButton->SetEnabled(false);	

//	BTabView* tabView = new BTabView("tabview", B_WIDTH_FROM_LABEL);

	BBox* box = new BBox(B_FANCY_BORDER, NULL);

	fFontsView = new FontView();

//	tabView->AddTab(fFontsView);
	box->AddChild(fFontsView);

	fFontsView->UpdateFonts();

	SetLayout(new BGroupLayout(B_VERTICAL));

	const float kInset = 10;

	AddChild(BGroupLayoutBuilder(B_VERTICAL)
		.Add(box)
//		.Add(tabView)
		.Add(BSpaceLayoutItem::CreateVerticalStrut(kInset))
		.Add(BGroupLayoutBuilder(B_HORIZONTAL)
			.Add(fDefaultsButton)
			.Add(BSpaceLayoutItem::CreateHorizontalStrut(kInset))
			.Add(fRevertButton)
			.Add(BSpaceLayoutItem::CreateGlue())
		)
		.SetInsets(kInset, kInset, kInset, kInset)
	);

	if (fSettings.WindowCorner() == BPoint(-1, -1)) {
		// center window on screen
		CenterOnScreen();
	} else {
		MoveTo(fSettings.WindowCorner());

		// make sure window is on screen
		BScreen screen(this);
		if (!screen.Frame().InsetByCopy(10, 10).Intersects(Frame()))
			CenterOnScreen();
	}

	fRunner = new BMessageRunner(this, new BMessage(kMsgCheckFonts), 3000000);
		// every 3 seconds

	fDefaultsButton->SetEnabled(fFontsView->IsDefaultable());
}
KeyboardWindow::KeyboardWindow()
	:
	BWindow(BRect(0, 0, 200, 200), B_TRANSLATE_SYSTEM_NAME("Keyboard"),
		B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
		| B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
{
	MoveTo(fSettings.WindowCorner());

	// Add the main settings view
	fSettingsView = new KeyboardView();
	BBox* fSettingsBox = new BBox("keyboard_box");
	fSettingsBox->AddChild(fSettingsView);

	// Add the "Default" button..
	fDefaultsButton = new BButton(B_TRANSLATE("Defaults"), new BMessage(BUTTON_DEFAULTS));

	// Add the "Revert" button...
	fRevertButton = new BButton(B_TRANSLATE("Revert"), new BMessage(BUTTON_REVERT));
	fRevertButton->SetEnabled(false);

	// Build the layout
	SetLayout(new BGroupLayout(B_VERTICAL));

	AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
		.Add(fSettingsBox)
		.AddGroup(B_HORIZONTAL, 7)
			.Add(fDefaultsButton)
			.Add(fRevertButton)
			.AddGlue()
		.End()
		.SetInsets(10, 10, 10, 10)
	);

	BSlider* slider = (BSlider* )FindView("key_repeat_rate");
	if (slider !=NULL)
		slider->SetValue(fSettings.KeyboardRepeatRate());

	slider = (BSlider* )FindView("delay_until_key_repeat");
	if (slider !=NULL)
		slider->SetValue(fSettings.KeyboardRepeatDelay());

	fDefaultsButton->SetEnabled(fSettings.IsDefaultable());

	// center window if it would be off-screen
	BScreen screen;
	if (screen.Frame().right < Frame().right
		|| screen.Frame().bottom < Frame().bottom) {
		CenterOnScreen();
	}

#ifdef DEBUG
	fSettings.Dump();
#endif

	Show();
}
예제 #3
0
AttribFill::AttribFill ()
: AttribView (BRect (0, 0, 146, 146), lstring (24, "Fill"))
{
	SetViewColor (LightGrey);
	BBox *tolSets = new BBox (BRect (4, 4, 142, 142), "tol");
	tolSets->SetLabel (lstring (338, "Tolerance"));
	AddChild (tolSets);
	tol = new BRadioButton (BRect (8, 13, 124, 30), "tol", lstring (339, "Visual Distance"), new BMessage ('AFtV'));
	rgb = new BRadioButton (BRect (8, 30, 124, 46), "rgb", lstring (340, "Absolute RGB"), new BMessage ('AFtS'));
	tol->SetValue (B_CONTROL_ON);
	tolSets->AddChild (tol);
	tolSets->AddChild (rgb);
	TabView *bgTab = new TabView (BRect (4, 50, 132, 134), "AttribFill Tab");
	tolSets->AddChild (bgTab);
	BView *tolTab = new BView (BRect (2, TAB_HEIGHT + 4, 126, TAB_HEIGHT + 63), "tol View", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
	BView *rgbTab = new BView (BRect (2, TAB_HEIGHT + 4, 126, TAB_HEIGHT + 63), "rgb View", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
	tolTab->SetViewColor (LightGrey);
	rgbTab->SetViewColor (LightGrey);
	bgTab->AddView (tolTab, lstring (341, "Visual"));
	bgTab->AddView (rgbTab, lstring (342, "RGB"));
	BStringView *explD = new BStringView (BRect (2, 8, 122, 20), "explD", lstring (343, "Visual Factors:"));
	BStringView *facD = new BStringView (BRect (2, 20, 122, 32), "facD", lstring (344, "R: 0.213 G: 0.715 B: 0.072"));
	explD->SetFontSize (10);
	facD->SetFontSize (10);
	sT = new Slider (BRect (4, 42, 122, 58), 10, "D", 0, 255, 1, new BMessage ('AFcT'));
	sR = new Slider (BRect (4,  2, 122, 18), 10, "R", 0, 255, 1, new BMessage ('AFcR'));
	sG = new Slider (BRect (4, 22, 122, 38), 10, "G", 0, 255, 1, new BMessage ('AFcG'));
	sB = new Slider (BRect (4, 42, 122, 58), 10, "B", 0, 255, 1, new BMessage ('AFcB'));
	tolTab->AddChild (sT);
	tolTab->AddChild (explD);
	tolTab->AddChild (facD);
	rgbTab->AddChild (sR);
	rgbTab->AddChild (sG);
	rgbTab->AddChild (sB);
	fTolMode = FILLTOL_TOL;
	fTolerance = 0;
	fToleranceRGB.red = 0;
	fToleranceRGB.green = 0;
	fToleranceRGB.blue = 0;
	fCurrentProperty = 0;
}
예제 #4
0
PaletteWindow::PaletteWindow(BPoint point, BHandler *target_i)
			 :BWindow(BRect(point.x, point.y, point.x+100, point.y+100), "Palette", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS),
			  target(target_i)
{
	BBox *box = new BBox(Bounds(), NULL, B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_PLAIN_BORDER);
	AddChild(box);

	color_ctrl = new CControl(BPoint(5, 5), new BMessage(M_PALETTE));
	box->AddChild(color_ctrl);
	color_ctrl->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	color_ctrl->SetTarget(target);
	int32 c = (ui_color(B_PANEL_BACKGROUND_COLOR).red << 24)
			+ (ui_color(B_PANEL_BACKGROUND_COLOR).green << 16)
			+ (ui_color(B_PANEL_BACKGROUND_COLOR).blue << 8);
	color_ctrl->SetValue(c);
	ResizeTo(color_ctrl->Bounds().Width() + 10, color_ctrl->Bounds().Height() + 10);

	BScreen screen(this);
	if (!screen.Frame().Contains(Frame())) {
		BRect scrrect = screen.Frame();
		BRect winrect = Frame();
		float offx = 0;
		float offy = 0;
		if (winrect.left < scrrect.left) {
			offx = scrrect.left - winrect.left;
		}
		else {
			if (winrect.right > scrrect.right) {
				offx = scrrect.right - winrect.right;
			}
		}
		if (winrect.top < scrrect.top) {
			offy = scrrect.top - winrect.top;
		}
		else {
			if (winrect.bottom > scrrect.bottom) {
				offy = scrrect.bottom - winrect.bottom;
			}
		}
//		MoveTo(winrect.left + offx, offy);
		MoveTo(winrect.left + offx, winrect.top + offy);
		if (Debug) {
			_sPrintf("intersection!\n");
			_sPrintf("offx: %f!\n", offx);
			_sPrintf("offy: %f!\n", offy);
			_sPrintf("old winrect - x1: %f, y1: %f, x2: %f, y2: %f\n", winrect.left, winrect.top, winrect.right, winrect.bottom);
			_sPrintf("new winrect - x1: %f, y1: %f, x2: %f, y2: %f\n", winrect.left + offx, winrect.top + offy, winrect.right + offx, winrect.bottom + offy);
		}
	}
}
예제 #5
0
void TVideoCompressionView::AttachedToWindow()
{			
	printf("TVideoCompressionView::AttachedToWindow()\n");
	
	//	Get pointer to previewView and attach to BBox
	BBox *previewBox = (BBox *)FindView("PreviewBox");		
	TVideoPreviewView *previewView = m_Parent->GetParent()->GetParent()->PreviewView();	
	if (previewView)
	{
		previewBox->AddChild(previewView);
		previewView->MoveTo(m_PreviewRect.left, m_PreviewRect.top);
		previewView->ResizeTo(m_PreviewRect.Width(), m_PreviewRect.Height());
		previewView->Show();
	}
	
	BView::Show();
}
예제 #6
0
SpaceBarSettingsView::SpaceBarSettingsView()
	:
	SettingsView("SpaceBarSettingsView")
{
	fSpaceBarShowCheckBox = new BCheckBox("",
		B_TRANSLATE("Show space bars on volumes"),
		new BMessage(kUpdateVolumeSpaceBar));

	BPopUpMenu* menu = new BPopUpMenu(B_EMPTY_STRING);
	menu->SetFont(be_plain_font);

	BMenuItem* item;
	menu->AddItem(item = new BMenuItem(
		B_TRANSLATE("Used space color"),
		new BMessage(kSpaceBarSwitchColor)));
	item->SetMarked(true);
	fCurrentColor = 0;
	menu->AddItem(new BMenuItem(
		B_TRANSLATE("Free space color"),
		new BMessage(kSpaceBarSwitchColor)));
	menu->AddItem(new BMenuItem(
		B_TRANSLATE("Warning space color"),
		new BMessage(kSpaceBarSwitchColor)));

	BBox* box = new BBox("box");
	box->SetLabel(fColorPicker = new BMenuField("menu", NULL, menu));

	fColorControl = new BColorControl(BPoint(8,
			fColorPicker->Bounds().Height() + 8 + kItemExtraSpacing),
		B_CELLS_16x16, 1, "SpaceColorControl",
		new BMessage(kSpaceBarColorChanged));
	fColorControl->SetValue(TrackerSettings().UsedSpaceColor());
	box->AddChild(fColorControl);

	const float spacing = be_control_look->DefaultItemSpacing();

	BGroupLayout* layout = GroupLayout();
	layout->SetOrientation(B_VERTICAL);
	layout->SetSpacing(0);
	BGroupLayoutBuilder(layout)
		.Add(fSpaceBarShowCheckBox)
		.Add(box)
		.AddGlue()
		.SetInsets(spacing, spacing, spacing, spacing);

}
예제 #7
0
void
ModulesView::_OpenSaver()
{
	// create new screen saver preview & config

	BView* view = fPreviewView->AddPreview();
	fCurrentName = fSettings.ModuleName();
	fSaverRunner = new ScreenSaverRunner(view->Window(), view, fSettings);

#ifdef __HAIKU__
	BRect rect = fSettingsBox->InnerFrame().InsetByCopy(4, 4);
#else
	BRect rect = fSettingsBox->Bounds().InsetByCopy(4, 4);
	rect.top += 14;
#endif
	fSettingsView = new BView(rect, "SettingsView", B_FOLLOW_ALL, B_WILL_DRAW);

	fSettingsView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	fSettingsBox->AddChild(fSettingsView);

	BScreenSaver* saver = ScreenSaver();
	if (saver != NULL && fSettingsView != NULL) {
		saver->StartConfig(fSettingsView);
		if (saver->StartSaver(view, true) == B_OK) {
			fPreviewView->HideNoPreview();
			fSaverRunner->Run();
		} else
			fPreviewView->ShowNoPreview();
	} else {
		// Failed to load OR this is the "Darkness" screensaver. Show a black
		// preview (this is what will happen in both cases when screen_blanker
		// runs).
		fPreviewView->HideNoPreview();
	}

	if (fSettingsView->ChildAt(0) == NULL) {
		// There are no settings at all, we add the module name here to
		// let it look a bit better at least.
		BPrivate::BuildScreenSaverDefaultSettingsView(fSettingsView,
			fSettings.ModuleName()[0] ? fSettings.ModuleName()
				: B_TRANSLATE("Blackness"),
				saver != NULL || !fSettings.ModuleName()[0]
					? B_TRANSLATE("No options available")
					: B_TRANSLATE("Could not load screen saver"));
	}
}
예제 #8
0
SpaceBarSettingsView::SpaceBarSettingsView()
	:
	SettingsView("SpaceBarSettingsView")
{
	fSpaceBarShowCheckBox = new BCheckBox("",
		B_TRANSLATE("Show space bars on volumes"),
		new BMessage(kUpdateVolumeSpaceBar));

	BPopUpMenu* menu = new BPopUpMenu(B_EMPTY_STRING);
	menu->SetFont(be_plain_font);

	BMenuItem* item;
	menu->AddItem(item = new BMenuItem(
		B_TRANSLATE("Used space color"),
		new BMessage(kSpaceBarSwitchColor)));
	item->SetMarked(true);
	fCurrentColor = 0;
	menu->AddItem(new BMenuItem(
		B_TRANSLATE("Free space color"),
		new BMessage(kSpaceBarSwitchColor)));
	menu->AddItem(new BMenuItem(
		B_TRANSLATE("Warning space color"),
		new BMessage(kSpaceBarSwitchColor)));

	fColorPicker = new BMenuField("menu", NULL, menu);

	fColorControl = new BColorControl(BPoint(0, 0),
		B_CELLS_16x16, 1, "SpaceColorControl",
		new BMessage(kSpaceBarColorChanged));
	fColorControl->SetValue(TrackerSettings().UsedSpaceColor());

	BBox* box = new BBox("box");
	box->SetLabel(fColorPicker);
	box->AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL)
		.Add(fColorControl)
		.SetInsets(B_USE_DEFAULT_SPACING)
		.View());

	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.Add(fSpaceBarShowCheckBox)
		.Add(box)
		.AddGlue()
		.SetInsets(B_USE_DEFAULT_SPACING);
}
예제 #9
0
void HexKeyView::AttachedToWindow() 
{
    
    BBox *aBox;
    BRect aBoxRect;
	aBoxRect.Set(10, 10, 370, 270);
    
    aBox = new BBox(aBoxRect, "Box1", B_FOLLOW_NONE);
    aBox->SetLabel(LABEL_BOX_TITLE);
    AddChild(aBox);
    
    BRect drawRect;
	drawRect.Set(10, 10, 340, 240);
	
	DrawView *drawView;
	drawView = new DrawView(drawRect, "DrawView");
	drawView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	drawView->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	aBox->AddChild(drawView);
	
}
예제 #10
0
ClockView::ClockView(const char* name)
	:
	BView(name, 0),
	fCachedShowClock(B_CONTROL_ON),
	fCachedShowSeconds(B_CONTROL_OFF),
	fCachedShowDayOfWeek(B_CONTROL_OFF),
	fCachedShowTimeZone(B_CONTROL_OFF)
{
	fShowClock = new BCheckBox(B_TRANSLATE("Show clock in Deskbar"),
		new BMessage(kShowHideTime));
	fShowSeconds = new BCheckBox(B_TRANSLATE("Display time with seconds"),
		new BMessage(kShowSeconds));
	fShowDayOfWeek = new BCheckBox(B_TRANSLATE("Show day of week"),
		new BMessage(kShowDayOfWeek));
	fShowTimeZone = new BCheckBox(B_TRANSLATE("Show time zone"),
		new BMessage(kShowTimeZone));

	BView* view = BLayoutBuilder::Group<>(B_VERTICAL, 0)
		.SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET))
		.Add(fShowSeconds)
		.Add(fShowDayOfWeek)
		.Add(fShowTimeZone)
		.AddGlue()
		.SetInsets(B_USE_DEFAULT_SPACING)
		.View();

	BBox* showClockBox = new BBox("show clock box");
	showClockBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
	showClockBox->SetLabel(fShowClock);
	showClockBox->AddChild(view);

	BLayoutBuilder::Group<>(this)
		.AddGroup(B_VERTICAL, 0)
			.Add(showClockBox)
		.End()
		.SetInsets(B_USE_WINDOW_SPACING, B_USE_WINDOW_SPACING,
			B_USE_WINDOW_SPACING, B_USE_DEFAULT_SPACING);
}
예제 #11
0
VolumeWindow::VolumeWindow(BRect frame, bool dontBeep, int32 volumeWhich)
	: BWindow(frame, "VolumeWindow", B_BORDERED_WINDOW_LOOK,
		B_FLOATING_ALL_WINDOW_FEEL,
		B_ASYNCHRONOUS_CONTROLS | B_WILL_ACCEPT_FIRST_CLICK
		| B_AUTO_UPDATE_SIZE_LIMITS, 0),
	fUpdatedCount(0)
{
	SetLayout(new BGroupLayout(B_HORIZONTAL));

	BGroupLayout* layout = new BGroupLayout(B_HORIZONTAL);
	layout->SetInsets(5, 5, 5, 5);

	BBox* box = new BBox("sliderbox");
	box->SetLayout(layout);
	box->SetBorder(B_PLAIN_BORDER);
	AddChild(box);

	BSlider* slider = new VolumeControl(volumeWhich, !dontBeep,
		new BMessage(kMsgVolumeChanged));
	slider->SetModificationMessage(new BMessage(kMsgVolumeUpdate));
	box->AddChild(slider);

	slider->SetTarget(this);
	ResizeTo(300, 50);

	// Make sure it's not outside the screen.
	const int32 kMargin = 3;
	BRect windowRect = Frame();
	BRect screenFrame(BScreen(B_MAIN_SCREEN_ID).Frame());
	if (screenFrame.right < windowRect.right + kMargin)
		MoveBy(- kMargin - windowRect.right + screenFrame.right, 0);
	if (screenFrame.bottom < windowRect.bottom + kMargin)
		MoveBy(0, - kMargin - windowRect.bottom + screenFrame.bottom);
	if (screenFrame.left > windowRect.left - kMargin)
		MoveBy(kMargin + screenFrame.left - windowRect.left, 0);
	if (screenFrame.top > windowRect.top - kMargin)
		MoveBy(0, kMargin + screenFrame.top - windowRect.top);
}
예제 #12
0
BView* PrefsWindow::constructGeneralBox(BRect frame)
{
	BBox* generalBox = new BBox(frame);
	generalBox->SetLabel("General");
	
	float 	offset = 30.0f,
			bwidth = 80.0f,
			bheight = 30.0f,
			bspacing = 10.0f,
			cbheight = 14.0f,
			adjust = 5.0f
			;
			
	float controlX = (offset * 2.0f / 3.0f);
	BRect bubbleFrame = BRect(controlX, offset - adjust, offset + 150.0f, offset + cbheight - adjust);	
	
	ColourButton *bubbleColourButton = new ColourButton(bubbleFrame, GetPrefsMessage(K_BUBBLE_COLOUR), ColourConstants::K_BLACK, "Tooltips");
	generalBox->AddChild(bubbleColourButton);
		
	BRect recentDocsPathFrame(controlX, 50.0f, controlX + 150.0f, 70.0f);
	BCheckBox *showRecentDocsPath = new BCheckBox(recentDocsPathFrame, K_IS_RECENT_DOCS_SHOWN, "Show Path in Recent Docs", GetPrefsMessage(K_IS_RECENT_DOCS_SHOWN));
	generalBox->AddChild(showRecentDocsPath);
	
	BRect isActivationFrame(controlX, 80.0f, controlX + 190.0f, 100.0f);
	BCheckBox *isActivationOk = new BCheckBox(isActivationFrame, K_IS_ACTIVATION_OK, "Activate Window on Opening Docs", GetPrefsMessage(K_IS_ACTIVATION_OK));	
	generalBox->AddChild(isActivationOk);
	
	BRect recentDocsFrame(controlX, 110.0f, controlX + 150.0f, 120.0f);
	BTextControl *numRecentDocs = new BTextControl(recentDocsFrame, K_NUM_RECENT_DOCS, "Number of Recent Docs", "", GetPrefsMessage(K_NUM_RECENT_DOCS));
	numRecentDocs->SetDivider(120.0f);
	numRecentDocs->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
	generalBox->AddChild(numRecentDocs);
	
	BRect insertDateFrame(controlX, 140.0f, controlX + 200.0f, 150.0f);
	BTextControl *insertDateFlags = new BTextControl(insertDateFrame, K_DATE_FLAGS, "Insert Date Flags", "", GetPrefsMessage(K_DATE_FLAGS));
	generalBox->AddChild(insertDateFlags);	
	
	BRect generalRect = generalBox->Bounds();
	BRect generalbtnRect(generalRect.right - bspacing - bwidth, generalRect.bottom - bspacing - bheight, generalRect.right - bspacing, generalRect.bottom - bspacing);
	BButton *resetGeneralDefaults = new BButton(generalbtnRect,"fResetGeneralDefaults","Defaults",new BMessage(PrefsConstants::K_PREFS_VIEW_RESET_GENERAL_DEFAULTS));
	generalBox->AddChild(resetGeneralDefaults);
	
	return generalBox;
}
예제 #13
0
SpaceBarSettingsView::SpaceBarSettingsView(BRect rect)
	: SettingsView(rect, "SpaceBarSettingsView")
{
	rect.OffsetTo(B_ORIGIN);
	fSpaceBarShowCheckBox = new BCheckBox(rect, "", "Show space bars on volumes",
		new BMessage(kUpdateVolumeSpaceBar));
	fSpaceBarShowCheckBox->ResizeToPreferred();
	AddChild(fSpaceBarShowCheckBox);

	rect = fSpaceBarShowCheckBox->Frame();
	rect.OffsetBy(0, fSpaceBarShowCheckBox->Bounds().Height() + kItemExtraSpacing);

	BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING);
	menu->SetFont(be_plain_font);

	BMenuItem *item;
	menu->AddItem(item = new BMenuItem("Used space color", new BMessage(kSpaceBarSwitchColor)));
	item->SetMarked(true);
	fCurrentColor = 0;
	menu->AddItem(new BMenuItem("Free space color", new BMessage(kSpaceBarSwitchColor)));
	menu->AddItem(new BMenuItem("Warning space color", new BMessage(kSpaceBarSwitchColor)));

	BBox *box = new BBox(rect);
	box->SetLabel(fColorPicker = new BMenuField(rect, NULL, NULL, menu));
	AddChild(box);

	fColorControl = new BColorControl(BPoint(8, fColorPicker->Bounds().Height()
			+ 8 + kItemExtraSpacing),
		B_CELLS_16x16, 1, "SpaceColorControl", new BMessage(kSpaceBarColorChanged));
	fColorControl->SetValue(TrackerSettings().UsedSpaceColor());
	fColorControl->ResizeToPreferred();
	box->AddChild(fColorControl);

	box->ResizeTo(fColorControl->Bounds().Width() + 16,
		fColorControl->Frame().bottom + 8);
}
예제 #14
0
OutputView::OutputView(Controller *controller)
	:
	BView("Capture Options", B_WILL_DRAW),
	fController(controller)
{
	SetLayout(new BGroupLayout(B_VERTICAL));
	
	BBox *selectBox = new BBox("selection");
	selectBox->SetLabel("Selection");
	selectBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
	AddChild(selectBox);
	
	BBox *outputBox = new BBox("output");
	outputBox->SetLabel("Output");
	outputBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));
	AddChild(outputBox);

	Settings settings;
	
	const char *kTCLabel = "File name:"; 
	const char *fileName = NULL;
	settings.GetOutputFileName(&fileName);
	fFileName = new BTextControl("file name",
			kTCLabel, fileName, new BMessage(kFileNameChanged));
	
	const char *kOutputMenuLabel = "Output Format:";
	fOutputFileType = new BOptionPopUp("OutFormat",
			kOutputMenuLabel, new BMessage(kFileTypeChanged));
						
	const char *kCodecMenuLabel = "Codec:";
	BPopUpMenu *popUpMenu = new BPopUpMenu("Codecs");
	fCodecMenu = new BMenuField("OutCodec", kCodecMenuLabel, popUpMenu);
	
	fWholeScreen = new BRadioButton("screen frame", "Whole screen",
		new BMessage(kCheckBoxAreaSelectionChanged));
	fCustomArea = new BRadioButton("custom area",
		"Custom Area", new BMessage(kCheckBoxAreaSelectionChanged));
	fSelectArea = new BButton("select area", "Select", new BMessage(kSelectArea));
	fSelectArea->SetEnabled(false);
	
	fMinimizeOnStart = new BCheckBox("Minimize on start",
		"Minimize on recording", new BMessage(kMinimizeOnRecording));
	
	fRectView = new PreviewView();
	
	BView *layoutView = BLayoutBuilder::Group<>()
		.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
			B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
		.AddGroup(B_VERTICAL, B_USE_DEFAULT_SPACING)
			.Add(fFileName)
			.Add(fOutputFileType)
			.Add(fCodecMenu)
			.Add(fMinimizeOnStart)
		.End()	
		.View();

	outputBox->AddChild(layoutView);

	layoutView = BLayoutBuilder::Group<>()
		.SetInsets(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING,
			B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING)
		.AddGroup(B_VERTICAL)
			.AddGroup(B_HORIZONTAL)
				.AddGroup(B_VERTICAL, 0)
					.Add(fWholeScreen)
					.Add(fCustomArea)
				.End()
				.AddGroup(B_VERTICAL)
					.AddGlue()
					.Add(fSelectArea)
				.End()
			.End()
			.Add(fRectView)
		.End()
		.View();
	
	selectBox->AddChild(layoutView);

	fMinimizeOnStart->SetValue(settings.MinimizeOnRecording() ? B_CONTROL_ON : B_CONTROL_OFF);
	
	// fill in the list of available file formats
	media_file_format mff;
	
	int32 cookie = 0;
	bool firstFound = true;
	while (get_next_file_format(&cookie, &mff) == B_OK) {
		if (mff.capabilities & media_file_format::B_KNOWS_ENCODED_VIDEO) {
			fOutputFileType->AddOption(mff.pretty_name, mff.family);
			if (firstFound) {
				fOutputFileType->MenuField()->Menu()->ItemAt(0)->SetMarked(true);
				firstFound = false;
			}
		}	
	}
	
	fWholeScreen->SetValue(B_CONTROL_ON);
	
	UpdateSettings();
	
	fController->SetCaptureArea(BScreen(Window()).Frame());
	fController->SetMediaFormatFamily(FormatFamily());
	fController->SetOutputFileName(fFileName->Text());
}
예제 #15
0
NetPrefsServerView::NetPrefsServerView (BRect bounds, const char *name, BMessenger target)
  :  BView (
	  bounds,
	  name,
	  B_FOLLOW_ALL_SIDES,
	  B_WILL_DRAW),
  fEntryWin (NULL),
  fNetWin (target)
{
  SetViewColor (ui_color (B_PANEL_BACKGROUND_COLOR));
  BRect boundsRect (Bounds ());
  BBox *mainBox (new BBox (bounds.InsetByCopy (-1, -1), NULL, B_FOLLOW_ALL_SIDES));
  AddChild (mainBox);
  fSelectTitleString = new BStringView (BRect (0, 0, 0, 0), NULL, "Select servers for");
  fSelectTitleString->ResizeToPreferred ();
  mainBox->AddChild (fSelectTitleString);
  fSelectTitleString->MoveTo (11, 11);
  fServerList = new BColumnListView (BRect (0, 0, boundsRect.Width () - 10,
    boundsRect.Height () / 2), "fServerList", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW,
    B_PLAIN_BORDER);
  fServerList->SetSelectionMessage (new BMessage (M_SERVER_ITEM_SELECTED));
  mainBox->AddChild (fServerList);
  fServerList->MoveTo (5, fSelectTitleString->Frame ().bottom + 3);
  BStringColumn *status (new BStringColumn (S_PREFSERVER_STATUS_COLUMN, be_plain_font->StringWidth ("Status") * 2,
    0, bounds.Width (), 0, B_ALIGN_CENTER));
  fServerList->AddColumn (status, 0);
  BStringColumn *data (new BStringColumn (S_PREFSERVER_SERVER_COLUMN, be_plain_font->StringWidth ("Server") * 2,
    0, bounds.Width (), 0));
  fServerList->AddColumn (data, 1);
  BStringColumn *port (new BStringColumn (S_PREFSERVER_PORT_COLUMN, be_plain_font->StringWidth ("Port") * 2,
    0, bounds.Width (), 0));
  fServerList->AddColumn (port, 2);
  fAddButton = new BButton (BRect (0, 0, 0, 0), NULL, S_PREFSERVER_ADD_BUTTON B_UTF8_ELLIPSIS,
    new BMessage (M_SERVER_ADD_ITEM));
  fRemoveButton = new BButton (BRect (0, 0, 0, 0), NULL, S_PREFSERVER_REMOVE_BUTTON,
    new BMessage (M_SERVER_REMOVE_ITEM));
  fEditButton = new BButton (BRect (0, 0, 0, 0), NULL, S_PREFSERVER_EDIT_BUTTON B_UTF8_ELLIPSIS,
    new BMessage (M_SERVER_EDIT_ITEM));
  fAddButton->ResizeToPreferred ();
  fRemoveButton->ResizeToPreferred ();
  fEditButton->ResizeToPreferred ();
  fRemoveButton->MoveTo (fServerList->Frame ().right - fRemoveButton->Frame ().Width (),
   fServerList->Frame ().bottom + 5);
  mainBox->AddChild (fRemoveButton);
  fAddButton->MoveTo (fRemoveButton->Frame ().left - (fAddButton->Frame ().Width () + 5),
    fRemoveButton->Frame ().top);
  mainBox->AddChild (fAddButton);
  fEditButton->MoveTo (fAddButton->Frame ().left - (fEditButton->Frame ().Width () + 15),
    fAddButton->Frame ().top);
  mainBox->AddChild (fEditButton);
  BStringView *legend1 = new BStringView (BRect (0, 0, 0, 0), "str1", S_PREFSERVER_DESC1);
  legend1->ResizeToPreferred ();
  mainBox->AddChild (legend1);
  legend1->MoveTo (fServerList->Frame ().left + 5, fAddButton->Frame ().bottom + 5);
  BStringView *legend2 = new BStringView (BRect (0, 0, 0, 0), "str1", S_PREFSERVER_DESC2);
  legend2->ResizeToPreferred ();
  mainBox->AddChild (legend2);
  legend2->MoveTo (legend1->Frame ().left, legend1->Frame ().bottom);
  BStringView *legend3 = new BStringView (BRect (0, 0, 0, 0), "str1", S_PREFSERVER_DESC3);
  legend3->ResizeToPreferred ();
  mainBox->AddChild (legend3);
  legend3->MoveTo (legend2->Frame ().left, legend2->Frame ().bottom);
  fLegend4 = new BStringView (BRect (0, 0, 0, 0), "str1", S_PREFSERVER_DESC4);
  fLegend4->ResizeToPreferred ();
  mainBox->AddChild (fLegend4);
  fLegend4->MoveTo (legend3->Frame ().left, legend3->Frame ().bottom);
  fOkButton = new BButton (BRect (0, 0, 0, 0), NULL, S_PREFSERVER_OK_BUTTON,
    new BMessage (B_QUIT_REQUESTED));
  fOkButton->ResizeToPreferred ();
  mainBox->AddChild (fOkButton);
  fOkButton->MoveTo (fServerList->Frame ().right - fOkButton->Frame ().Width (),
    fLegend4->Frame ().bottom + 5);
}
예제 #16
0
FadeView::FadeView(const char* name, ScreenSaverSettings& settings)
	:
	BView(name, B_WILL_DRAW),
	fSettings(settings)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	font_height fontHeight;
	be_plain_font->GetHeight(&fontHeight);
	float textHeight = ceilf(fontHeight.ascent + fontHeight.descent);

	fEnableCheckBox = new BCheckBox("EnableCheckBox",
		B_TRANSLATE("Enable screensaver"),
		new BMessage(kMsgEnableScreenSaverBox));

	BBox* box = new BBox("EnableScreenSaverBox");
	box->SetLabel(fEnableCheckBox);

	// Start Screensaver
	BStringView* startScreenSaver = new BStringView("startScreenSaver",
		B_TRANSLATE("Start screensaver"));
	startScreenSaver->SetAlignment(B_ALIGN_RIGHT);

	fRunSlider = new TimeSlider("RunSlider", kMsgRunSliderChanged,
		kMsgRunSliderUpdate);

	// Turn Off
	rgb_color textColor = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
		B_DISABLED_LABEL_TINT);
	fTurnOffNotSupported = new BTextView("not_supported", be_plain_font,
		&textColor, B_WILL_DRAW);
	fTurnOffNotSupported->SetExplicitMinSize(BSize(B_SIZE_UNSET,
		3 + textHeight * 3));
	fTurnOffNotSupported->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	fTurnOffNotSupported->MakeEditable(false);
	fTurnOffNotSupported->MakeSelectable(false);
	fTurnOffNotSupported->SetText(
		B_TRANSLATE("Display Power Management Signaling not available"));

	fTurnOffCheckBox = new BCheckBox("TurnOffScreenCheckBox",
		B_TRANSLATE("Turn off screen"), new BMessage(kMsgTurnOffCheckBox));
	fTurnOffCheckBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
		B_ALIGN_VERTICAL_CENTER));

	fTurnOffSlider = new TimeSlider("TurnOffSlider", kMsgTurnOffSliderChanged,
		kMsgTurnOffSliderUpdate);

	// Password
	fPasswordCheckBox = new BCheckBox("PasswordCheckbox",
		B_TRANSLATE("Password lock"), new BMessage(kMsgPasswordCheckBox));
	fPasswordCheckBox->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
		B_ALIGN_VERTICAL_CENTER));

	fPasswordSlider = new TimeSlider("PasswordSlider",
		kMsgPasswordSliderChanged, kMsgPasswordSliderUpdate);

	fPasswordButton = new BButton("PasswordButton",
		B_TRANSLATE("Password" B_UTF8_ELLIPSIS),
		new BMessage(kMsgChangePassword));

	// Bottom
	float monitorHeight = 10 + textHeight * 3;
	float aspectRatio = 4.0f / 3.0f;
	float monitorWidth = monitorHeight * aspectRatio;
	BRect monitorRect = BRect(0, 0, monitorWidth, monitorHeight);

	fFadeNow = new ScreenCornerSelector(monitorRect, "FadeNow",
		new BMessage(kMsgFadeCornerChanged), B_FOLLOW_NONE);
	BTextView* fadeNowText = new BTextView("FadeNowText", B_WILL_DRAW);
	fadeNowText->SetExplicitMinSize(BSize(B_SIZE_UNSET,
		4 + textHeight * 4));
	fadeNowText->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	fadeNowText->MakeEditable(false);
	fadeNowText->MakeSelectable(false);
	fadeNowText->SetText(B_TRANSLATE("Fade now when mouse is here"));

	fFadeNever = new ScreenCornerSelector(monitorRect, "FadeNever",
		new BMessage(kMsgNeverFadeCornerChanged), B_FOLLOW_NONE);
	BTextView* fadeNeverText = new BTextView("FadeNeverText", B_WILL_DRAW);
	fadeNeverText->SetExplicitMinSize(BSize(B_SIZE_UNSET,
		4 + textHeight * 4));
	fadeNeverText->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	fadeNeverText->MakeEditable(false);
	fadeNeverText->MakeSelectable(false);
	fadeNeverText->SetText(B_TRANSLATE("Don't fade when mouse is here"));

	box->AddChild(BLayoutBuilder::Group<>(B_VERTICAL)
		.SetInsets(B_USE_DEFAULT_SPACING, 0, B_USE_DEFAULT_SPACING,
			B_USE_DEFAULT_SPACING)
		.AddGrid(B_USE_DEFAULT_SPACING, B_USE_SMALL_SPACING)
			.Add(startScreenSaver, 0, 0)
			.Add(fRunSlider, 1, 0)
			.Add(fTurnOffCheckBox, 0, 1)
			.Add(BLayoutBuilder::Group<>(B_VERTICAL)
				.Add(fTurnOffNotSupported)
				.Add(fTurnOffSlider)
				.View(), 1, 1)
			.Add(fPasswordCheckBox, 0, 2)
			.Add(fPasswordSlider, 1, 2)
			.End()
		.AddGroup(B_HORIZONTAL)
			.AddGlue()
			.Add(fPasswordButton)
			.End()
		.AddGlue()
		.AddGroup(B_HORIZONTAL)
			.Add(fFadeNow)
			.AddGroup(B_VERTICAL, 0)
				.Add(fadeNowText)
				.AddGlue()
				.End()
			.Add(fFadeNever)
			.AddGroup(B_VERTICAL, 0)
				.Add(fadeNeverText)
				.AddGlue()
				.End()
			.End()
		.AddGlue()
		.View());

	BLayoutBuilder::Group<>(this, B_HORIZONTAL)
		.SetInsets(B_USE_SMALL_SPACING)
		.Add(box)
		.End();
}
예제 #17
0
VideoWindow::VideoWindow(const char* title, window_type type,
		uint32 flags, port_id* consumerPort)
	:
	BWindow(BRect(50, 50, 50, 50), title, type, flags),
	fPortPtr(consumerPort),
	fVideoView(NULL)
{
	fFtpInfo.port = 0;
	fFtpInfo.rate = 0x7fffffff;
	fFtpInfo.imageFormat = 0;
	fFtpInfo.translator = 0;
	fFtpInfo.passiveFtp = true;
	fFtpInfo.uploadClient = 0;
	strcpy(fFtpInfo.fileNameText, "filename");
	strcpy(fFtpInfo.serverText, "server");
	strcpy(fFtpInfo.loginText, "login");
	strcpy(fFtpInfo.passwordText, "password");
	strcpy(fFtpInfo.directoryText, "directory");

	_SetUpSettings("codycam", "");

	BMenuBar* menuBar = new BMenuBar("menu bar");

	BMenuItem* menuItem;
	fMenu = new BMenu(B_TRANSLATE("File"));

	menuItem = new BMenuItem(B_TRANSLATE("Video settings"),
		new BMessage(msg_video), 'P');
	menuItem->SetTarget(be_app);
	fMenu->AddItem(menuItem);

	fMenu->AddSeparatorItem();

	menuItem = new BMenuItem(B_TRANSLATE("Start video"),
		new BMessage(msg_start), 'A');
	menuItem->SetTarget(be_app);
	fMenu->AddItem(menuItem);

	menuItem = new BMenuItem(B_TRANSLATE("Stop video"),
		new BMessage(msg_stop), 'O');
	menuItem->SetTarget(be_app);
	fMenu->AddItem(menuItem);

	fMenu->AddSeparatorItem();

	menuItem = new BMenuItem(B_TRANSLATE("Quit"),
		new BMessage(B_QUIT_REQUESTED), 'Q');
	menuItem->SetTarget(be_app);
	fMenu->AddItem(menuItem);

	menuBar->AddItem(fMenu);

	/* add some controls */
	_BuildCaptureControls();

	BBox* box = new BBox("box");
	box->AddChild(fVideoView);

	BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
		.Add(menuBar)
		.AddGroup(B_VERTICAL)
			.SetInsets(B_USE_WINDOW_SPACING)
			.Add(box)
			.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
				.Add(fCaptureSetupBox)
				.Add(fFtpSetupBox)
				.End()
			.Add(fStatusLine)
			.End()
		.AddGlue();

	Show();
}
예제 #18
0
ConfigWindow::ConfigWindow()
		: BWindow(BRect(200.0, 200.0, 640.0, 640.0),
				  "E-mail", B_TITLED_WINDOW,
				  B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE),
		fLastSelectedAccount(NULL),
		fSaveSettings(false)
{
	/*** create controls ***/

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

	// determine font height
	font_height fontHeight;
	top->GetFontHeight(&fontHeight);
	int32 height = (int32)(fontHeight.ascent + fontHeight.descent + fontHeight.leading) + 5;

	rect.InsetBy(5,5);	rect.bottom -= 11 + height;
	BTabView *tabView = new BTabView(rect,NULL);

	BView *view,*generalView;
	rect = tabView->Bounds();  rect.bottom -= tabView->TabHeight() + 4;
	tabView->AddTab(view = new BView(rect,NULL,B_FOLLOW_ALL,0));
	tabView->TabAt(0)->SetLabel(MDR_DIALECT_CHOICE ("Accounts","アカウント"));
	view->SetViewColor(top->ViewColor());

	// accounts listview

	rect = view->Bounds().InsetByCopy(8,8);
	rect.right = 140 - B_V_SCROLL_BAR_WIDTH;
	rect.bottom -= height + 12;
	fAccountsListView = new AccountsListView(rect);
	view->AddChild(new BScrollView(NULL,fAccountsListView,B_FOLLOW_ALL,0,false,true));
	rect.right += B_V_SCROLL_BAR_WIDTH;

	rect.top = rect.bottom + 8;  rect.bottom = rect.top + height;
	BRect sizeRect = rect;
	sizeRect.right = sizeRect.left + 30 + view->StringWidth(MDR_DIALECT_CHOICE ("Add","追加"));
	view->AddChild(new BButton(sizeRect,NULL,MDR_DIALECT_CHOICE ("Add","追加"),
		new BMessage(kMsgAddAccount),B_FOLLOW_BOTTOM));

	sizeRect.left = sizeRect.right+3;
	sizeRect.right = sizeRect.left + 30 + view->StringWidth(MDR_DIALECT_CHOICE ("Remove","削除"));
	view->AddChild(fRemoveButton = new BButton(sizeRect,NULL,MDR_DIALECT_CHOICE ("Remove","削除"),
		new BMessage(kMsgRemoveAccount),B_FOLLOW_BOTTOM));

	// accounts config view
	rect = view->Bounds();
	rect.left = fAccountsListView->Frame().right + B_V_SCROLL_BAR_WIDTH + 16;
	rect.right -= 10;
	view->AddChild(fConfigView = new CenterContainer(rect));

	MakeHowToView();

	// general settings

	rect = tabView->Bounds();	rect.bottom -= tabView->TabHeight() + 4;
	tabView->AddTab(view = new CenterContainer(rect));
	tabView->TabAt(1)->SetLabel(MDR_DIALECT_CHOICE ("General","一般"));

	rect = view->Bounds().InsetByCopy(8,8);
	rect.right -= 1;	rect.bottom = rect.top + height * 5 + 15;
	BBox *box = new BBox(rect);
	box->SetLabel(MDR_DIALECT_CHOICE ("Retrieval Frequency","メールチェック間隔"));
	view->AddChild(box);

	rect = box->Bounds().InsetByCopy(8,8);
	rect.top += 7;	rect.bottom = rect.top + height + 5;
	BRect tile = rect.OffsetByCopy(0,1);
	int32 labelWidth = (int32)view->StringWidth(MDR_DIALECT_CHOICE ("Check every:","メールチェック間隔:"))+6;
	tile.right = 80 + labelWidth;
	fIntervalControl = new BTextControl(tile,"time",MDR_DIALECT_CHOICE ("Check every:","メールチェック間隔:"),
	NULL,NULL);
	fIntervalControl->SetDivider(labelWidth);
	box->AddChild(fIntervalControl);

	BPopUpMenu *frequencyPopUp = new BPopUpMenu(B_EMPTY_STRING);
	const char *frequencyStrings[] = {
		MDR_DIALECT_CHOICE ("Never","チェックしない"),
		MDR_DIALECT_CHOICE ("Minutes","分毎チェック"),
		MDR_DIALECT_CHOICE ("Hours","時間毎チェック"),
		MDR_DIALECT_CHOICE ("Days","日間毎チェック")};
	BMenuItem *item;
	for (int32 i = 0;i < 4;i++)
	{
		frequencyPopUp->AddItem(item = new BMenuItem(frequencyStrings[i],new BMessage(kMsgIntervalUnitChanged)));
		if (i == 1)
			item->SetMarked(true);
	}
	tile.left = tile.right + 5;  tile.right = rect.right;
	tile.OffsetBy(0,-1);
	fIntervalUnitField = new BMenuField(tile,"frequency", B_EMPTY_STRING, frequencyPopUp);
	fIntervalUnitField->SetDivider(0.0);
	box->AddChild(fIntervalUnitField);

	rect.OffsetBy(0,height + 9);	rect.bottom -= 2;
	fPPPActiveCheckBox = new BCheckBox(rect,"ppp active",
		MDR_DIALECT_CHOICE ("only when PPP is active","PPP接続中時のみ"), NULL);
	box->AddChild(fPPPActiveCheckBox);
	
	rect.OffsetBy(0,height + 9);	rect.bottom -= 2;
	fPPPActiveSendCheckBox = new BCheckBox(rect,"ppp activesend",
		MDR_DIALECT_CHOICE ("Queue outgoing mail when PPP is inactive","PPP切断時、送信メールを送信箱に入れる"), NULL);
	box->AddChild(fPPPActiveSendCheckBox);

	rect = box->Frame();  rect.bottom = rect.top + 4*height + 20;
	box = new BBox(rect);
	box->SetLabel(MDR_DIALECT_CHOICE ("Status Window","送受信状況の表示"));
	view->AddChild(box);

	BPopUpMenu *statusPopUp = new BPopUpMenu(B_EMPTY_STRING);
	const char *statusModes[] = {
		MDR_DIALECT_CHOICE ("Never","表示しない"),
		MDR_DIALECT_CHOICE ("While Sending","送信時"),
		MDR_DIALECT_CHOICE ("While Sending / Fetching","送受信時"),
		MDR_DIALECT_CHOICE ("Always","常に表示")};
	BMessage *msg;
	for (int32 i = 0;i < 4;i++)
	{
		statusPopUp->AddItem(item = new BMenuItem(statusModes[i],msg = new BMessage(kMsgShowStatusWindowChanged)));
		msg->AddInt32("ShowStatusWindow",i);
		if (i == 0)
			item->SetMarked(true);
	}
	rect = box->Bounds().InsetByCopy(8,8);
	rect.top += 7;	rect.bottom = rect.top + height + 5;
	labelWidth = (int32)view->StringWidth(
		MDR_DIALECT_CHOICE ("Show Status Window:","ステータスの表示:")) + 8;
	fStatusModeField = new BMenuField(rect,"show status",
		MDR_DIALECT_CHOICE ("Show Status Window:","ステータスの表示:"),
	statusPopUp);
	fStatusModeField->SetDivider(labelWidth);
	box->AddChild(fStatusModeField);

	BPopUpMenu *lookPopUp = new BPopUpMenu(B_EMPTY_STRING);
	const char *windowLookStrings[] = {
		MDR_DIALECT_CHOICE ("Normal, With Tab","タブ付通常"),
		MDR_DIALECT_CHOICE ("Normal, Border Only","ボーダーのみ通常"),
		MDR_DIALECT_CHOICE ("Floating","フローティング"),
		MDR_DIALECT_CHOICE ("Thin Border","細いボーダー"),
		MDR_DIALECT_CHOICE ("No Border","ボーダー無し")};
	for (int32 i = 0;i < 5;i++)
	{
		lookPopUp->AddItem(item = new BMenuItem(windowLookStrings[i],msg = new BMessage(kMsgStatusLookChanged)));
		msg->AddInt32("StatusWindowLook",i);
		if (i == 0)
			item->SetMarked(true);
	}
	rect.OffsetBy(0, height + 6);
	fStatusLookField = new BMenuField(rect,"status look",
		MDR_DIALECT_CHOICE ("Window Look:","ウィンドウ外観:"),lookPopUp);
	fStatusLookField->SetDivider(labelWidth);
	box->AddChild(fStatusLookField);

	BPopUpMenu *workspacesPopUp = new BPopUpMenu(B_EMPTY_STRING);
	workspacesPopUp->AddItem(item = new BMenuItem(
		MDR_DIALECT_CHOICE ("Current Workspace","使用中ワークスペース"),
		msg = new BMessage(kMsgStatusWorkspaceChanged)));
	msg->AddInt32("StatusWindowWorkSpace", 0);
	workspacesPopUp->AddItem(item = new BMenuItem(
		MDR_DIALECT_CHOICE ("All Workspaces","全てのワークスペース"),
		msg = new BMessage(kMsgStatusWorkspaceChanged)));
	msg->AddInt32("StatusWindowWorkSpace", -1);

	rect.OffsetBy(0,height + 6);
	fStatusWorkspaceField = new BMenuField(rect,"status workspace",
		MDR_DIALECT_CHOICE ("Window visible on:","表示場所:"),workspacesPopUp);
	fStatusWorkspaceField->SetDivider(labelWidth);
	box->AddChild(fStatusWorkspaceField);

	rect = box->Frame();  rect.bottom = rect.top + 3*height + 13;
	box = new BBox(rect);
	box->SetLabel(MDR_DIALECT_CHOICE ("Deskbar Icon","デスクバーアイコンリンク"));
	view->AddChild(box);

	rect = box->Bounds().InsetByCopy(8,8);
	rect.top += 7;	rect.bottom = rect.top + height + 5;
	BStringView *stringView = new BStringView(rect,B_EMPTY_STRING, MDR_DIALECT_CHOICE (
		"The menu links are links to folders in a real folder like the Be menu.",
		"デスクバーで表示する項目の設定"));
	box->AddChild(stringView);
	stringView->SetAlignment(B_ALIGN_CENTER);
	stringView->ResizeToPreferred();
	// BStringView::ResizeToPreferred() changes the width, so that the
	// alignment has no effect anymore
	stringView->ResizeTo(rect.Width(), stringView->Bounds().Height());

	rect.left += 100;  rect.right -= 100;
	rect.OffsetBy(0,height + 1);
	BButton *button = new BButton(rect,B_EMPTY_STRING,
		MDR_DIALECT_CHOICE ("Configure Menu Links","メニューリンクの設定"),
		msg = new BMessage(B_REFS_RECEIVED));
	box->AddChild(button);
	button->SetTarget(BMessenger("application/x-vnd.Be-TRAK"));

	BPath path;
	find_directory(B_USER_SETTINGS_DIRECTORY, &path);
	path.Append("Mail/Menu Links");
	BEntry entry(path.Path());
	if (entry.InitCheck() == B_OK && entry.Exists()) {
		entry_ref ref;
		entry.GetRef(&ref);
		msg->AddRef("refs", &ref);
	}
	else
		button->SetEnabled(false);

	rect = box->Frame();  rect.bottom = rect.top + 2*height + 6;
	box = new BBox(rect);
	box->SetLabel(MDR_DIALECT_CHOICE ("Misc.","その他の設定"));
	view->AddChild(box);

	rect = box->Bounds().InsetByCopy(8,8);
	rect.top += 7;	rect.bottom = rect.top + height + 5;
	fAutoStartCheckBox = new BCheckBox(rect,"start daemon",
		MDR_DIALECT_CHOICE ("Auto-Start Mail Daemon","Mail Daemonを自動起動"),NULL);
	box->AddChild(fAutoStartCheckBox);

	// about page

	rect = tabView->Bounds();	rect.bottom -= tabView->TabHeight() + 4;
	tabView->AddTab(view = new BView(rect,NULL,B_FOLLOW_ALL,0));
	tabView->TabAt(2)->SetLabel(MDR_DIALECT_CHOICE ("About","情報"));
	view->SetViewColor(top->ViewColor());

	AboutTextView *about = new AboutTextView(rect);
	about->SetViewColor(top->ViewColor());
	view->AddChild(about);

	// save/cancel/revert buttons

	top->AddChild(tabView);

	rect = tabView->Frame();
	rect.top = rect.bottom + 5;  rect.bottom = rect.top + height + 5;
	BButton *saveButton = new BButton(rect,"save",
		MDR_DIALECT_CHOICE ("Save","保存"),
		new BMessage(kMsgSaveSettings));
	float w,h;
	saveButton->GetPreferredSize(&w,&h);
	saveButton->ResizeTo(w,h);
	saveButton->MoveTo(rect.right - w, rect.top);
	top->AddChild(saveButton);

	BButton *cancelButton = new BButton(rect,"cancel",
		MDR_DIALECT_CHOICE ("Cancel","中止"),
		new BMessage(kMsgCancelSettings));
	cancelButton->GetPreferredSize(&w,&h);
	cancelButton->ResizeTo(w,h);
#ifdef HAVE_APPLY_BUTTON
	cancelButton->MoveTo(saveButton->Frame().left - w - 5,rect.top);
#else
	cancelButton->MoveTo(saveButton->Frame().left - w - 20,rect.top);
#endif
	top->AddChild(cancelButton);

#ifdef HAVE_APPLY_BUTTON
	BButton *applyButton = new BButton(rect,"apply",
		MDR_DIALECT_CHOICE ("Apply","適用"),
		new BMessage(kMsgApplySettings));
	applyButton->GetPreferredSize(&w,&h);
	applyButton->ResizeTo(w,h);
	applyButton->MoveTo(cancelButton->Frame().left - w - 20,rect.top);
	top->AddChild(applyButton);
#endif

	BButton *revertButton = new BButton(rect,"revert",
		MDR_DIALECT_CHOICE ("Revert","復元"),
		new BMessage(kMsgRevertSettings));
	revertButton->GetPreferredSize(&w,&h);
	revertButton->ResizeTo(w,h);
#ifdef HAVE_APPLY_BUTTON
	revertButton->MoveTo(applyButton->Frame().left - w - 5,rect.top);
#else
	revertButton->MoveTo(cancelButton->Frame().left - w - 6,rect.top);
#endif
	top->AddChild(revertButton);

	LoadSettings();

	fAccountsListView->SetSelectionMessage(new BMessage(kMsgAccountSelected));
}
예제 #19
0
JoyWin::JoyWin(BRect frame, const char *title)
	: BWindow(frame, title, B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
		B_NOT_ZOOMABLE), fSystemUsedSelect(false),
		fJoystick(new BJoystick)
{
	fProbeButton = new BButton(BRect(15.00, 260.00, 115.00, 285.00),
		"ProbeButton", "Probe", new BMessage(PROBE));

	fCalibrateButton = new BButton(BRect(270.00, 260.00, 370.00, 285.00),
		"CalibrateButton", "Calibrate", new BMessage(CALIBRATE));

	fGamePortL = new BListView(BRect(15.00, 30.00, 145.00, 250.00),
		"gamePort");
	fGamePortL->SetSelectionMessage(new BMessage(PORT_SELECTED));
	fGamePortL->SetInvocationMessage(new BMessage(PORT_INVOKE));

	fConControllerL = new BListView(BRect(175.00,30.00,370.00,250.00),
		"conController");
	fConControllerL->SetSelectionMessage(new BMessage(JOY_SELECTED));
	fConControllerL->SetInvocationMessage(new BMessage(JOY_INVOKE));

	fGamePortS = new BStringView(BRect(15, 5, 160, 25), "gpString",
		"Game port");
	fGamePortS->SetFont(be_bold_font);
	fConControllerS = new BStringView(BRect(170, 5, 330, 25), "ccString",
		"Connected controller");

	fConControllerS->SetFont(be_bold_font);

	fCheckbox = new BCheckBox(BRect(131.00, 260.00, 227.00, 280.00),
		"Disabled", "Disabled", new BMessage(DISABLEPORT));
	BBox *box = new BBox( Bounds(),"box", B_FOLLOW_ALL,
		B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE,
		B_PLAIN_BORDER);

	box->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	// Add listViews with their scrolls
	box->AddChild(new BScrollView("PortScroll", fGamePortL,
		B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW, false, true));

	box->AddChild(new BScrollView("ConScroll", fConControllerL, B_FOLLOW_ALL,
		B_WILL_DRAW, false, true));

	// Adding object
	box->AddChild(fCheckbox);
	box->AddChild(fGamePortS);
	box->AddChild(fConControllerS);
	box->AddChild(fProbeButton);
	box->AddChild(fCalibrateButton);
	AddChild(box);

	SetSizeLimits(400, 600, Bounds().Height(), Bounds().Height());

	/* Add all the devices */
	int32 nr = fJoystick->CountDevices();
	for (int32 i = 0; i < nr;i++) {
		//BString str(path.Path());
		char buf[B_OS_NAME_LENGTH];
		fJoystick->GetDeviceName(i, buf, B_OS_NAME_LENGTH);
		fGamePortL->AddItem(new PortItem(buf));
	}
	fGamePortL->Select(0);

	/* Add the joysticks specifications */
	_AddToList(fConControllerL, JOY_SELECTED, JOYSTICKFILEPATH);

	_GetSettings();
}
예제 #20
0
void BeKESAMainWindow::initTab4(BTabView *tv) {
	BTab *tab;
	BBox *box;
	BRect r,s,sl,sr;

	r = tv->Bounds();
	r.InsetBy(5,10);
	BView *view = new BView(r, "viewtab4", B_FOLLOW_ALL_SIDES, 0);
	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	tab = new BTab(view);
	tv->AddTab(view, tab);
	tab->SetLabel("Teren/Gleba");

	r = view->Bounds();
	r.top = 10; r.left = 10; r.right -= 10;
	r.bottom = r.top + 140;
	box = new BBox(r, "box4x1");
	box->SetLabel("Dostępność terenu");
	view->AddChild(box);

	sl = box->Bounds();
	sl.InsetBy(10,20);
	sl.right = sl.left + sl.Width()/2;
	sl.bottom = sl.top + 20;

	BPopUpMenu *menu;
	BMenuItem *item;
	BMessage *msg;
	menu = new BPopUpMenu("t3mzabudowa");
	msg = new BMessage(TC4Z); msg->AddInt32("_item", 0);
	item = new BMenuItem("[brak]", msg); item->SetMarked(true); menu->AddItem(item);
	t3zabitems[0] = item;
	msg = new BMessage(TC4Z); msg->AddInt32("_item", 1);
	item = new BMenuItem("niezabudowany", msg); menu->AddItem(item);
	t3zabitems[1] = item;
	msg = new BMessage(TC4Z); msg->AddInt32("_item", 2);
	item = new BMenuItem("średniozabudowany", msg); menu->AddItem(item);
	t3zabitems[2] = item;
	msg = new BMessage(TC4Z); msg->AddInt32("_item", 3);
	item = new BMenuItem("zabudowany", msg); menu->AddItem(item);
	t3zabitems[3] = item;
	BMenuField *t3zabudowa = new BMenuField(sl, "t3zabudowa", "Dostępność", menu, B_FOLLOW_LEFT, B_WILL_DRAW);
	t3zabudowa->SetDivider(100);
	box->AddChild(t3zabudowa);

	s = box->Bounds();
	s.InsetBy(10,20);
	s.top = s.top + sl.Height() + 5;
	s.right = s.left + s.Width()/3;
	s.bottom = s.top + 20;
	sl = s;
	s.OffsetBy(s.Width(), 0);
	sr = s;
	sr.OffsetBy(s.Width(), 0);
	t3tl = new BCheckBox(sl, "t3tl", "las", new BMessage(TC4));
	t3ts = new BCheckBox(s,  "t3ts", "sad", new BMessage(TC4));
	t3tp = new BCheckBox(sr, "t3tp", "park", new BMessage(TC4));
	sl.OffsetBy(0,20); s.OffsetBy(0,20); sr.OffsetBy(0,20);
	t3to = new BCheckBox(sl, "t3to", "pole orne", new BMessage(TC4));
	t3ta = new BCheckBox(s,  "t3ta", "łąka", new BMessage(TC4));
	t3tr = new BCheckBox(sr, "t3tr", "ter. roln. prywatny", new BMessage(TC4));
	sl.OffsetBy(0,20); s.OffsetBy(0,20); sr.OffsetBy(0,20);
	t3te = new BCheckBox(sl, "t3te", "ter. roln. społeczny", new BMessage(TC4));
	t3tz = new BCheckBox(s,  "t3tz", "teren przemysłowy", new BMessage(TC4));

	box->AddChild(t3tl); box->AddChild(t3ts); box->AddChild(t3tp);
	box->AddChild(t3to); box->AddChild(t3ta); box->AddChild(t3tr);
	box->AddChild(t3te); box->AddChild(t3tz);

	s = box->Bounds();
	s.InsetBy(10,20);
	sl.right = sl.left + s.Width();
	sl.OffsetBy(0,25);
	t3tokr = new BTextControl(sl, "t3tokr", "Okr. bliższe", NULL, new BMessage(TC4));
	t3tokr->SetDivider(100);
	box->AddChild(t3tokr);

	r.top += 145; r.bottom += 100;
	box = new BBox(r, "box4x2");
	box->SetLabel("Gleba");
	view->AddChild(box);

	sl = box->Bounds();
	sl.InsetBy(10,20);
	sl.right = sl.left + sl.Width()/3;
	sl.bottom = sl.top + 20;
	s = sl; s.OffsetBy(sl.Width(),0);
	sr = s; sr.OffsetBy(sl.Width(),0);
	sl.OffsetBy(0,10); sr.OffsetBy(0,10);

	menu = new BPopUpMenu("t3mkam");
	msg = new BMessage(TC4K); msg->AddInt32("_item", 0);
	item = new BMenuItem("[brak]", msg); item->SetMarked(true); menu->AddItem(item);
	t3kamitems[0] = item;
	msg = new BMessage(TC4K); msg->AddInt32("_item", 1);
	item = new BMenuItem("mała", msg); menu->AddItem(item);
	t3kamitems[1] = item;
	msg = new BMessage(TC4K); msg->AddInt32("_item", 2);
	item = new BMenuItem("średnia", msg); menu->AddItem(item);
	t3kamitems[2] = item;
	msg = new BMessage(TC4K); msg->AddInt32("_item", 3);
	item = new BMenuItem("duża", msg); menu->AddItem(item);
	t3kamitems[3] = item;
	BMenuField *t3kamienie = new BMenuField(sl, "t3kamienie", "Kamienistość", menu, B_FOLLOW_LEFT, B_WILL_DRAW);
	t3kamienie->SetDivider(70);
	box->AddChild(t3kamienie);

	t3gp = new BCheckBox(s, "t3gp", "piaszczysta", new BMessage(TC4));
	s.OffsetBy(0,20);
	t3gg = new BCheckBox(s, "t3gg", "gliniasta", new BMessage(TC4));
	t3gt = new BCheckBox(sr, "t3gt", "torfowo-bagnista", new BMessage(TC4));

	box->AddChild(t3gp); box->AddChild(t3gg); box->AddChild(t3gt);

	s = box->Bounds();
	s.InsetBy(10,20);
	sl.right = sl.left + s.Width();
	sl.OffsetBy(0,35);
	t3gokr = new BTextControl(sl, "t3gokr", "Okr. specj.", NULL, new BMessage(TC4));
	t3gokr->SetDivider(100);
	box->AddChild(t3gokr);

	updateTab4();
}
예제 #21
0
SettingsWindow::SettingsWindow(BRect frame)
 	: BWindow(frame, "MediaPlayer settings", B_FLOATING_WINDOW_LOOK,
 		B_FLOATING_APP_WINDOW_FEEL,
 		B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE
#ifdef __ANTARES__
 			| B_AUTO_UPDATE_SIZE_LIMITS)
#else
 			)
#endif
{
#ifdef __ANTARES__

	BBox* settingsBox = new BBox(B_PLAIN_BORDER, NULL);
	BGroupLayout* settingsLayout = new BGroupLayout(B_VERTICAL, 5);
	settingsBox->SetLayout(settingsLayout);
	BBox* buttonBox = new BBox(B_PLAIN_BORDER, NULL);
	BGroupLayout* buttonLayout = new BGroupLayout(B_HORIZONTAL, 5);
	buttonBox->SetLayout(buttonLayout);

	BStringView* playModeLabel = new BStringView("stringViewPlayMode",
		"Play mode");
	BStringView* viewOptionsLabel = new BStringView("stringViewViewOpions", 
		"View options");
	BStringView* bgMoviesModeLabel = new BStringView("stringViewPlayBackg", 
		"Play background clips at");
	BAlignment alignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER);
	playModeLabel->SetExplicitAlignment(alignment);
	playModeLabel->SetFont(be_bold_font);
	viewOptionsLabel->SetExplicitAlignment(alignment);
	viewOptionsLabel->SetFont(be_bold_font);
	bgMoviesModeLabel->SetExplicitAlignment(alignment);
	bgMoviesModeLabel->SetFont(be_bold_font);

	fAutostartCB = new BCheckBox("chkboxAutostart", 
		"Automatically start playing", new BMessage(M_AUTOSTART));

	fCloseWindowMoviesCB = new BCheckBox("chkBoxCloseWindowMovies", 
		"Close window when done playing movies",
		new BMessage(M_CLOSE_WINDOW_MOVIE));
	fCloseWindowSoundsCB = new BCheckBox("chkBoxCloseWindowSounds", 
		"Close window when done playing sounds",
		new BMessage(M_CLOSE_WINDOW_SOUNDS));

	fLoopMoviesCB = new BCheckBox("chkBoxLoopMovie",
		"Loop movies by default", new BMessage(M_LOOP_MOVIE));
	fLoopSoundsCB = new BCheckBox("chkBoxLoopSounds",
		"Loop sounds by default", new BMessage(M_LOOP_SOUND));

	fUseOverlaysCB = new BCheckBox("chkBoxUseOverlays",
		"Use hardware video overlays if available",
		new BMessage(M_USE_OVERLAYS));
	fScaleBilinearCB = new BCheckBox("chkBoxScaleBilinear",
		"Scale movies smoothly (non-overlay mode)",
		new BMessage(M_SCALE_BILINEAR));

	fFullVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
		"Full volume", new BMessage(M_START_FULL_VOLUME));
	
	fHalfVolumeBGMoviesRB = new BRadioButton("rdbtnhalfvolume", 
		"Low volume", new BMessage(M_START_HALF_VOLUME));
	
	fMutedVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
		"Muted", new BMessage(M_START_MUTE_VOLUME));

	fRevertB = new BButton("revert", "Revert", 
		new BMessage(M_SETTINGS_REVERT));

	BButton* cancelButton = new BButton("cancel", "Cancel", 
		new BMessage(M_SETTINGS_CANCEL));

	BButton* okButton = new BButton("ok", "OK",
		new BMessage(M_SETTINGS_SAVE));
	okButton->MakeDefault(true);


	// Build the layout
	SetLayout(new BGroupLayout(B_HORIZONTAL));

	AddChild(BGroupLayoutBuilder(B_VERTICAL, 0)
		.Add(BGroupLayoutBuilder(settingsLayout)
			.Add(playModeLabel)
			.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
				.Add(BSpaceLayoutItem::CreateHorizontalStrut(10))
				.Add(BGroupLayoutBuilder(B_VERTICAL, 0)
					.Add(fAutostartCB)
					.Add(BGridLayoutBuilder(5, 0)
						.Add(BSpaceLayoutItem::CreateHorizontalStrut(10), 0, 0)
						.Add(fCloseWindowMoviesCB, 1, 0)
						.Add(BSpaceLayoutItem::CreateHorizontalStrut(10), 0, 1)
						.Add(fCloseWindowSoundsCB, 1, 1)
					)
					.Add(fLoopMoviesCB)
					.Add(fLoopSoundsCB)
				)
			)
			.Add(BSpaceLayoutItem::CreateVerticalStrut(5))

			.Add(viewOptionsLabel)
			.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
				.Add(BSpaceLayoutItem::CreateHorizontalStrut(10))
				.Add(BGroupLayoutBuilder(B_VERTICAL, 0)
					.Add(fUseOverlaysCB)
					.Add(fScaleBilinearCB)
				)
			)
			.Add(BSpaceLayoutItem::CreateVerticalStrut(5))

			.Add(bgMoviesModeLabel)
			.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
				.Add(BSpaceLayoutItem::CreateHorizontalStrut(10))
				.Add(BGroupLayoutBuilder(B_VERTICAL, 0)
					.Add(fFullVolumeBGMoviesRB)
					.Add(fHalfVolumeBGMoviesRB)
					.Add(fMutedVolumeBGMoviesRB)
				)
			)
			.Add(BSpaceLayoutItem::CreateVerticalStrut(5))

			.SetInsets(5, 5, 15, 5)
		)
		.Add(BGroupLayoutBuilder(buttonLayout)
			.Add(fRevertB)
			.AddGlue()
			.Add(cancelButton)
			.Add(okButton)
			.SetInsets(5, 5, 5, 5)
		)
	);

#else

	frame = Bounds();
	BView* view = new BView(frame,"SettingsView",B_FOLLOW_ALL_SIDES,B_WILL_DRAW);
	view->SetViewColor(216, 216, 216);
	
	BRect btnRect(80.00, frame.bottom - (SPACE + BUTTONHEIGHT), 145.00, 
		frame.bottom-SPACE);

	fRevertB = new BButton(btnRect, "revert", "Revert", 
		new BMessage(M_SETTINGS_REVERT));
	view->AddChild(fRevertB);

	btnRect.OffsetBy(btnRect.Width() + SPACE, 0);
	BButton* btn = new BButton(btnRect, "btnCancel", "Cancel", 
		new BMessage(M_SETTINGS_CANCEL));
	view->AddChild(btn);
	
	btnRect.OffsetBy(btnRect.Width() + SPACE, 0);
	btn = new BButton(btnRect, "btnOK", "OK", new BMessage(M_SETTINGS_SAVE));
	view->AddChild(btn);
	
	BRect rectBox(frame.left + SPACE, frame.top + SPACE, frame.right - SPACE, 
		btnRect.top- SPACE);
	BBox* bbox = new BBox(rectBox, "box1", B_FOLLOW_ALL_SIDES,B_WILL_DRAW | B_NAVIGABLE,
		B_FANCY_BORDER);
	bbox->SetLabel("MediaPlayer Settings");
	
	BFont font;
	font_height fh1;
	font.GetHeight(&fh1);

	BString str("Play Mode:");
	BRect rect(rectBox.left, rectBox.top + SPACE, rectBox.right - (12*2), 
		rectBox.top + fh1.leading + fh1.ascent + 10);
	bbox->AddChild(new BStringView(rect, "stringViewPlayMode", str.String()));
	
	rect.OffsetBy(0, rect.Height());
	bbox->AddChild(fAutostartCB = new BCheckBox(rect, "chkboxAutostart", 
		"Automatically start playing", new BMessage(M_AUTOSTART)));

	rect.OffsetBy(SPACE, rect.Height() + SPACEING);
	bbox->AddChild(fCloseWindowMoviesCB = new BCheckBox(rect, "chkBoxCloseWindowMovies", 
		"Close window when done playing movies", new BMessage(M_CLOSE_WINDOW_MOVIE)));
	
	rect.OffsetBy(0, rect.Height() + SPACEING);
	bbox->AddChild(fCloseWindowSoundsCB = new BCheckBox(rect, "chkBoxCloseWindowSounds", 
		"Close window when done playing sounds", new BMessage(M_CLOSE_WINDOW_SOUNDS)));
	
	rect.OffsetBy(-SPACE, rect.Height() + SPACEING);
	bbox->AddChild(fLoopMoviesCB = new BCheckBox(rect, "chkBoxLoopMovie", "Loop movies by default",
		new BMessage(M_LOOP_MOVIE)));
	
	rect.OffsetBy(0, rect.Height() + SPACEING);
	bbox->AddChild(fLoopSoundsCB = new BCheckBox(rect, "chkBoxLoopSounds", "Loop sounds by default",
		new BMessage(M_LOOP_SOUND)));

	rect.OffsetBy(0, rect.Height() + SPACEING);
	bbox->AddChild(fUseOverlaysCB = new BCheckBox(rect, "chkBoxUseOverlays", "Use hardware video overlays if available",
		new BMessage(M_USE_OVERLAYS)));

	rect.OffsetBy(0, rect.Height() + SPACEING);
	bbox->AddChild(fScaleBilinearCB = new BCheckBox(rect, "chkBoxScaleBilinear", "Scale movies smoothly (non-overlay mode)",
		new BMessage(M_SCALE_BILINEAR)));

	rect.OffsetBy(0, rect.Height() + SPACE + SPACEING);
	bbox->AddChild(new BStringView(rect, "stringViewPlayBackg", 
		"Play backgrounds clips at:"));
	
	rect.OffsetBy(SPACE, rect.Height() + SPACEING);
	fFullVolumeBGMoviesRB = new BRadioButton(rect, "rdbtnfullvolume", 
		"Full Volume", new BMessage(M_START_FULL_VOLUME));
	bbox->AddChild(fFullVolumeBGMoviesRB);
	
	rect.OffsetBy(0, rect.Height() + SPACEING);
	fHalfVolumeBGMoviesRB = new BRadioButton(rect, "rdbtnhalfvolume", 
		"Low Volume", new BMessage(M_START_HALF_VOLUME));
	bbox->AddChild(fHalfVolumeBGMoviesRB);
	
	rect.OffsetBy(0, rect.Height() + SPACEING);
	fMutedVolumeBGMoviesRB = new BRadioButton(rect, "rdbtnfullvolume", "Muted",
		new BMessage(M_START_MUTE_VOLUME));
	bbox->AddChild(fMutedVolumeBGMoviesRB);

	view->AddChild(bbox);
	AddChild(view);
#endif

	// disable currently unsupported features
	fLoopMoviesCB->SetEnabled(false);
	fLoopSoundsCB->SetEnabled(false);
}
예제 #22
0
AttribRect::AttribRect ()
    : AttribView (BRect (0, 0, 148, 90), lstring (31, "Rectangles"))
{
    SetViewColor (LightGrey);
    lSlid = new Slider (BRect (8, 8, 140, 26), 60, lstring (310, "Pen Size"), 1, 50, 1, new BMessage ('ALpc'));
    AddChild (lSlid);
    fType = RECT_OUTFILL;
    fPenSize = 1;
    BBox *type = new BBox (BRect (18, 32, 130, 82), "type");
    type->SetLabel (lstring (311, "Type"));
    AddChild (type);
    BRect shape = BRect (3, 5, 27, 25);

    BWindow *picWindow = new BWindow (BRect (0, 0, 100, 100), "Temp Pic Window", B_BORDERED_WINDOW, uint32 (NULL), uint32 (NULL));
    BView *bg = new BView (BRect (0, 0, 100, 100), "Temp Pic View", uint32 (NULL), uint32 (NULL));
    picWindow->AddChild (bg);

    BPicture *p10;
    bg->BeginPicture (new BPicture);
    bg->SetLowColor (LightGrey);
    bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
    bg->SetLowColor (White);
    bg->FillRect (shape, B_SOLID_LOW);
    bg->StrokeRect (shape);
    p10 = bg->EndPicture();

    BPicture *p20;
    bg->BeginPicture (new BPicture);
    bg->SetLowColor (LightGrey);
    bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
    bg->SetHighColor (Black);
    bg->SetLowColor (White);
    bg->FillRect (shape, B_SOLID_LOW);
    p20 = bg->EndPicture();

    BPicture *p30;
    bg->BeginPicture (new BPicture);
    bg->SetLowColor (LightGrey);
    bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
    bg->SetHighColor (Black);
    bg->SetLowColor (White);
    bg->StrokeRect (shape);
    p30 = bg->EndPicture();

    BPicture *p11;
    bg->BeginPicture (new BPicture);
    bg->SetLowColor (DarkGrey);
    bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
    bg->SetHighColor (Black);
    bg->SetLowColor (White);
    bg->FillRect (shape, B_SOLID_LOW);
    bg->StrokeRect (shape);
    p11 = bg->EndPicture();

    BPicture *p21;
    bg->BeginPicture (new BPicture);
    bg->SetLowColor (DarkGrey);
    bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
    bg->SetHighColor (Black);
    bg->SetLowColor (White);
    bg->FillRect (shape, B_SOLID_LOW);
    p21 = bg->EndPicture();

    BPicture *p31;
    bg->BeginPicture (new BPicture);
    bg->SetLowColor (DarkGrey);
    bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
    bg->SetHighColor (Black);
    bg->SetLowColor (White);
    bg->StrokeRect (shape);
    p31 = bg->EndPicture();

    SetViewColor (LightGrey);
    delete picWindow;

    pT1 = new BPictureButton (BRect (4, 15, 34, 45), "APVt1", p10, p11, new BMessage ('pvT1'), B_TWO_STATE_BUTTON);
    pT2 = new BPictureButton (BRect (40, 15, 70, 45), "APVt2", p20, p21, new BMessage ('pvT2'), B_TWO_STATE_BUTTON);
    pT3 = new BPictureButton (BRect (76, 15, 106, 45), "APVt3", p30, p31, new BMessage ('pvT3'), B_TWO_STATE_BUTTON);
    type->AddChild (pT1);
    type->AddChild (pT2);
    type->AddChild (pT3);
    pT1->SetValue (B_CONTROL_ON);
    fCurrentProperty = 0;
}
예제 #23
0
ServerSettingsView::ServerSettingsView(const account_info &info)
	:
	BGroupView("server", B_VERTICAL),
	fInboundAccount(true),
	fOutboundAccount(true),
	fInboundAuthMenu(NULL),
	fOutboundAuthMenu(NULL),
	fInboundEncrItemStart(NULL),
	fOutboundEncrItemStart(NULL),
	fImageID(-1)
{
	SetViewUIColor(B_PANEL_BACKGROUND_COLOR);

	fInboundAccount = true;
	fOutboundAccount = true;

	// inbound
	BBox* box = new BBox("inbound");
	box->SetLabel(B_TRANSLATE("Incoming"));
	AddChild(box);

	BString serverName;
	if (info.inboundType == IMAP)
		serverName = info.providerInfo.imap_server;
	else
		serverName = info.providerInfo.pop_server;

	BGridView* grid = new BGridView("inner");
	grid->GridLayout()->SetInsets(B_USE_DEFAULT_SPACING);
	box->AddChild(grid);

	fInboundNameView = new BTextControl("inbound", B_TRANSLATE("Server Name:"),
		serverName, new BMessage(kServerChangedMsg));
	grid->GridLayout()->AddItem(fInboundNameView->CreateLabelLayoutItem(),
		0, 0);
	grid->GridLayout()->AddItem(fInboundNameView->CreateTextViewLayoutItem(),
		1, 0);

	int32 row = 1;

	_GetAuthEncrMenu(info.inboundProtocol, fInboundAuthMenu,
		fInboundEncryptionMenu);
	if (fInboundAuthMenu != NULL) {
		int authID = info.providerInfo.authentification_pop;
		if (info.inboundType == POP)
			fInboundAuthMenu->Menu()->ItemAt(authID)->SetMarked(true);
		fInboundAuthItemStart = fInboundAuthMenu->Menu()->FindMarked();

		grid->GridLayout()->AddItem(fInboundAuthMenu->CreateLabelLayoutItem(),
			0, row);
		grid->GridLayout()->AddItem(fInboundAuthMenu->CreateMenuBarLayoutItem(),
			1, row++);
	}
	if (fInboundEncryptionMenu != NULL) {
		BMenuItem *item = NULL;
		if (info.inboundType == POP) {
			item = fInboundEncryptionMenu->Menu()->ItemAt(
				info.providerInfo.ssl_pop);
			if (item != NULL)
				item->SetMarked(true);
		}
		if (info.inboundType == IMAP) {
			item = fInboundEncryptionMenu->Menu()->ItemAt(
				info.providerInfo.ssl_imap);
			if (item != NULL)
				item->SetMarked(true);
		}
		fInboundEncrItemStart = fInboundEncryptionMenu->Menu()->FindMarked();

		grid->GridLayout()->AddItem(
			fInboundEncryptionMenu->CreateLabelLayoutItem(), 0, row);
		grid->GridLayout()->AddItem(
			fInboundEncryptionMenu->CreateMenuBarLayoutItem(), 1, row++);
	}
	grid->GridLayout()->AddItem(BSpaceLayoutItem::CreateGlue(), 0, row);

	if (!fInboundAccount)
		box->Hide();

	// outbound
	box = new BBox("outbound");
	box->SetLabel(B_TRANSLATE("Outgoing"));
	AddChild(box);

	grid = new BGridView("inner");
	grid->GridLayout()->SetInsets(B_USE_DEFAULT_SPACING);
	box->AddChild(grid);

	serverName = info.providerInfo.smtp_server;
	fOutboundNameView = new BTextControl("outbound",
		B_TRANSLATE("Server name:"), serverName.String(),
		new BMessage(kServerChangedMsg));
	grid->GridLayout()->AddItem(fOutboundNameView->CreateLabelLayoutItem(),
		0, 0);
	grid->GridLayout()->AddItem(fOutboundNameView->CreateTextViewLayoutItem(),
		1, 0);

	row = 1;

	_GetAuthEncrMenu(info.outboundProtocol, fOutboundAuthMenu,
		fOutboundEncryptionMenu);
	if (fOutboundAuthMenu != NULL) {
		BMenuItem* item = fOutboundAuthMenu->Menu()->ItemAt(
			info.providerInfo.authentification_smtp);
		if (item != NULL)
			item->SetMarked(true);
		fOutboundAuthItemStart = item;

		grid->GridLayout()->AddItem(fOutboundAuthMenu->CreateLabelLayoutItem(),
			0, row);
		grid->GridLayout()->AddItem(
			fOutboundAuthMenu->CreateMenuBarLayoutItem(), 1, row++);
	}
	if (fOutboundEncryptionMenu != NULL) {
		BMenuItem* item = fOutboundEncryptionMenu->Menu()->ItemAt(
			info.providerInfo.ssl_smtp);
		if (item != NULL)
			item->SetMarked(true);
		fOutboundEncrItemStart = item;

		grid->GridLayout()->AddItem(
			fOutboundEncryptionMenu->CreateLabelLayoutItem(), 0, row);
		grid->GridLayout()->AddItem(
			fOutboundEncryptionMenu->CreateMenuBarLayoutItem(), 1, row++);
	}
	grid->GridLayout()->AddItem(BSpaceLayoutItem::CreateGlue(), 0, row);

	if (!fOutboundAccount)
		box->Hide();
}
예제 #24
0
BView* SeqPrefWin::NewFileView(BRect bounds, const BMessage& prefs) const
{
	BView*		v = new BView( bounds, FILE_STR, B_FOLLOW_ALL, 0 );
	if( !v ) return v;
	v->SetViewColor( Prefs().Color(AM_AUX_WINDOW_BG_C) );
	float		fh = view_font_height(v);
	float		bfh = bold_font_height();
	float		openH = bfh + 5 + fh + 5 + fh + 5 + fh;
	/* The Remember Open Songs preference.
	 */
	float		w = v->StringWidth("Remember open songs") + 25;
	BRect		f(bounds.left + 5, bounds.top + 5, bounds.left + 5 + w, bounds.top + 5 + fh);
	BCheckBox*	cb = new BCheckBox( f, REMEMBER_OPEN_STR, "Remember open songs", new BMessage(REMEMBER_OPEN_MSG) );
	if( cb ) {
		bool	b;
		if( prefs.FindBool(REMEBER_OPEN_SONGS_PREF, &b) != B_OK ) b = false;
		cb->SetValue( (b) ? B_CONTROL_ON : B_CONTROL_OFF );
		v->AddChild( cb );
	}
	/* The Skin preference.
	 */
	BMenu*		menu = new BMenu("skin_menu");
	BMessage	skinMsg(CHANGE_SKIN_MSG);
	BMenuItem*	item = new BMenuItem( "Default", new BMessage(CHANGE_SKIN_TO_DEFAULT_MSG) );
	item->SetMarked(true);
	menu->AddItem(item);
	menu->AddSeparatorItem();
	menu->SetLabelFromMarked(true);
	if( seq_make_skin_menu(menu, &skinMsg) == B_OK ) {
		const char*	label = "Choose skin:";
		f.Set(f.left, f.bottom + 8, bounds.right - 5, f.bottom + 8 + fh + 10);
		BMenuField*	field = new BMenuField(f, "skin_field", label, menu);
		if (field) {
			field->SetDivider( v->StringWidth(label) + 10 );
			v->AddChild(field);
		} else delete menu;
	} else delete menu;

	/* The Open New Songs preferences.
	 */
	f.Set(bounds.left + 5, f.bottom + 10, bounds.right - 5, f.bottom + 10 + openH + 10);
	BBox*		box = new BBox( f,
								"open_new_songs",
								B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
	if( box ) {
		box->SetLabel( "Open New Songs" );
		BRect		boxB = box->Bounds();
		BRect		sf(boxB.left + 5, boxB.top + 5 + bfh, boxB.right - 5, boxB.top + 5 + bfh + fh);
		const char*	choice;
		if( prefs.FindString(OPEN_NEW_SONG_PREF, &choice) != B_OK ) choice = 0;
		BRadioButton*	button = new BRadioButton( sf, OPEN_BLANK_STR, "Blank", new BMessage(OPEN_BLANK_MSG), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP );
		if( button ) {
			if( choice && strcmp(choice, "blank") == 0 ) button->SetValue( B_CONTROL_ON );
			box->AddChild( button );
		}
		sf.OffsetBy( 0, 5 + fh );
		button = new BRadioButton( sf, OPEN_FOUR_STR, "With two channels of each device", new BMessage(OPEN_FOUR_MSG), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP );
		if( button ) {
			if( choice && strcmp(choice, "channels") == 0 ) button->SetValue( B_CONTROL_ON );
			box->AddChild( button );
		}
		sf.OffsetBy( 0, 5 + fh );
		button = new BRadioButton( sf, OPEN_FILE_STR, "From file: <click to select>", new BMessage(OPEN_FILE_MSG), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP );
		if( button ) {
			if( choice && strcmp(choice, "file") == 0 ) button->SetValue( B_CONTROL_ON );
			entry_ref	ref;
			if( prefs.FindRef(OPEN_NEW_SONG_FILE_PREF, &ref) == B_OK )
				button->SetLabel( label_for_open_new_from_file(&ref).String() );
			box->AddChild( button );
		}
		v->AddChild( box );
		f.OffsetBy(0, f.bottom - f.top + 10 );
	}
	/* The Open From Query preferences
	 */
	f.bottom = bounds.bottom - 27;
	box = new BBox( f, "open_from_query", B_FOLLOW_ALL);
	if( box ) {
		box->SetLabel("Open From Query");

		BRect			boxB = box->Bounds();
		BRect			tableF(boxB.left + 5, boxB.top + 5 + bfh, boxB.right - 5, boxB.bottom - 35);
		mOwqTable = new _OwqList( tableF, mPreferences );
		if( mOwqTable ) {
			mOwqTable->SetLatchWidth( 0 );
			box->AddChild( mOwqTable );
			mOwqTable->AddColumn( new BStringColumn(ON_STR, 40, 20, 100, B_TRUNCATE_END), 0 );
			mOwqTable->AddColumn( new BStringColumn(NAME_STR, 100, 20, 150, B_TRUNCATE_END), 1 );
			mOwqTable->AddColumn( new BStringColumn(QUERY_STR, 180, 20, 450, B_TRUNCATE_MIDDLE), 2 );
//			mOwqTable->AddColumn( new BStringColumn(SKIP_TOP_LEVEL_STR, 100, 20, 250, B_TRUNCATE_END), 3 );
			mOwqTable->SetSortColumn(mOwqTable->ColumnAt(1), false, true);
//			mOwqTable->SetSortColumn(mOwqTable->ColumnAt(), true, true);
			mOwqTable->SetSelectionMode( B_SINGLE_SELECTION_LIST );

			BRect		bF(tableF.left, tableF.bottom + 5, tableF.left + 55, tableF.Height() - 10);
			BButton*	add = new BButton( bF, "owq_add", "Add", new BMessage(OWQ_INVOKE_ADD), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM );
			if( add ) box->AddChild( add );
			bF.OffsetBy( bF.Width() + 5, 0 );
			BButton*	change = new BButton( bF, "owq_change", "Change", new BMessage(OWQ_CHANGE), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM );
			if( change ) {
				change->SetEnabled( false );
				box->AddChild( change );
			}
			bF.OffsetBy( bF.Width() + 5, 0 );
			BButton*	remove = new BButton( bF, "owq_remove", "Remove", new BMessage(OWQ_REMOVE), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM );
			if( remove ) {
				remove->SetEnabled( false );
				box->AddChild( remove );
			}
			mOwqTable->SetButtons( add, change, remove );
		}
		v->AddChild( box );
	}
	return v;
}
예제 #25
0
ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
	const BEntry& entry)
	:
	BWindow(BRect(0.0f, 0.0f, 250.0f, 340.0f).OffsetBySelf(position),
		B_TRANSLATE("Application type"), B_TITLED_WINDOW,
		B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS |
			B_FRAME_EVENTS | B_AUTO_UPDATE_SIZE_LIMITS),
	fChangedProperties(0)
{
	float padding = be_control_look->DefaultItemSpacing();
	BAlignment labelAlignment = be_control_look->DefaultLabelAlignment();

	BMenuBar* menuBar = new BMenuBar((char*)NULL);
	menuBar->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT, B_ALIGN_TOP));

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

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

	// Signature

	fSignatureControl = new BTextControl(B_TRANSLATE("Signature:"), NULL,
		new BMessage(kMsgSignatureChanged));
	fSignatureControl->SetModificationMessage(
		new BMessage(kMsgSignatureChanged));

	// 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

	BBox* flagsBox = new BBox("flagsBox");

	fFlagsCheckBox = new BCheckBox("flags", B_TRANSLATE("Application flags"),
		new BMessage(kMsgToggleAppFlags));
	fFlagsCheckBox->SetValue(B_CONTROL_ON);

	fSingleLaunchButton = new BRadioButton("single",
		B_TRANSLATE("Single launch"), new BMessage(kMsgAppFlagsChanged));

	fMultipleLaunchButton = new BRadioButton("multiple",
		B_TRANSLATE("Multiple launch"), new BMessage(kMsgAppFlagsChanged));

	fExclusiveLaunchButton = new BRadioButton("exclusive",
		B_TRANSLATE("Exclusive launch"), new BMessage(kMsgAppFlagsChanged));

	fArgsOnlyCheckBox = new BCheckBox("args only", B_TRANSLATE("Args only"),
		new BMessage(kMsgAppFlagsChanged));

	fBackgroundAppCheckBox = new BCheckBox("background",
		B_TRANSLATE("Background app"), new BMessage(kMsgAppFlagsChanged));

	flagsBox->AddChild(BGridLayoutBuilder()
		.Add(fSingleLaunchButton, 0, 0).Add(fArgsOnlyCheckBox, 1, 0)
		.Add(fMultipleLaunchButton, 0, 1).Add(fBackgroundAppCheckBox, 1, 1)
		.Add(fExclusiveLaunchButton, 0, 2)
		.SetInsets(padding, padding, padding, padding));
	flagsBox->SetLabel(fFlagsCheckBox);

	// "Icon" group

	BBox* iconBox = new BBox("IconBox");
	iconBox->SetLabel(B_TRANSLATE("Icon"));
	fIconView = new IconView("icon");
	fIconView->SetModificationMessage(new BMessage(kMsgIconChanged));
	iconBox->AddChild(BGroupLayoutBuilder(B_HORIZONTAL)
		.Add(fIconView)
		.SetInsets(padding, padding, padding, padding));

	// "Supported Types" group

	BBox* typeBox = new BBox("typesBox");
	typeBox->SetLabel(B_TRANSLATE("Supported types"));

	fTypeListView = new SupportedTypeListView("Suppported Types",
		B_SINGLE_SELECTION_LIST);
	fTypeListView->SetSelectionMessage(new BMessage(kMsgTypeSelected));

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

	fAddTypeButton = new BButton("add type",
		B_TRANSLATE("Add" B_UTF8_ELLIPSIS), new BMessage(kMsgAddType));

	fRemoveTypeButton = new BButton("remove type", B_TRANSLATE("Remove"),
		new BMessage(kMsgRemoveType));

	fTypeIconView = new IconView("type icon");
	BView* iconHolder = BGroupLayoutBuilder(B_HORIZONTAL).Add(fTypeIconView);
	fTypeIconView->SetModificationMessage(new BMessage(kMsgTypeIconsChanged));

	typeBox->AddChild(BGridLayoutBuilder(padding, padding)
		.Add(scrollView, 0, 0, 1, 4)
		.Add(fAddTypeButton, 1, 0, 1, 2)
		.Add(fRemoveTypeButton, 1, 2, 1, 2)
		.Add(iconHolder, 2, 1, 1, 2)
		.SetInsets(padding, padding, padding, padding)
		.SetColumnWeight(0, 3)
		.SetColumnWeight(1, 2)
		.SetColumnWeight(2, 1));
	iconHolder->SetExplicitAlignment(
		BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE));

	// "Version Info" group

	BBox* versionBox = new BBox("versionBox");
	versionBox->SetLabel(B_TRANSLATE("Version info"));

	fMajorVersionControl = new BTextControl(B_TRANSLATE("Version:"),
		NULL, NULL);
	_MakeNumberTextControl(fMajorVersionControl);

	fMiddleVersionControl = new BTextControl(".", NULL, NULL);
	_MakeNumberTextControl(fMiddleVersionControl);

	fMinorVersionControl = new BTextControl(".", NULL, NULL);
	_MakeNumberTextControl(fMinorVersionControl);

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

	BMenuField* varietyField = new BMenuField("", fVarietyMenu);
	fInternalVersionControl = new BTextControl("/", NULL, NULL);
	fShortDescriptionControl =
		new BTextControl(B_TRANSLATE("Short description:"), NULL, NULL);

	// 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));

	BStringView* longLabel = new BStringView(NULL,
		B_TRANSLATE("Long description:"));
	longLabel->SetExplicitAlignment(labelAlignment);
	fLongDescriptionView = new TabFilteringTextView("long desc");
	fLongDescriptionView->SetMaxBytes(sizeof(versionInfo.long_info));

	scrollView = new BScrollView("desc scrollview", fLongDescriptionView,
		B_FRAME_EVENTS | B_WILL_DRAW, false, true);

	// TODO: remove workaround (bug #5678)
	BSize minScrollSize = scrollView->ScrollBar(B_VERTICAL)->MinSize();
	minScrollSize.width += fLongDescriptionView->MinSize().width;
	scrollView->SetExplicitMinSize(minScrollSize);

	versionBox->AddChild(BGridLayoutBuilder(padding / 2, padding)
		.Add(fMajorVersionControl->CreateLabelLayoutItem(), 0, 0)
		.Add(fMajorVersionControl->CreateTextViewLayoutItem(), 1, 0)
		.Add(fMiddleVersionControl, 2, 0, 2)
		.Add(fMinorVersionControl, 4, 0, 2)
		.Add(varietyField, 6, 0, 3)
		.Add(fInternalVersionControl, 9, 0, 2)
		.Add(fShortDescriptionControl->CreateLabelLayoutItem(), 0, 1)
		.Add(fShortDescriptionControl->CreateTextViewLayoutItem(), 1, 1, 10)
		.Add(longLabel, 0, 2)
		.Add(scrollView, 1, 2, 10, 3)
		.SetInsets(padding, padding, padding, padding)
		.SetRowWeight(3, 3));

	// put it all together
	SetLayout(new BGroupLayout(B_VERTICAL));
	AddChild(menuBar);
	AddChild(BGroupLayoutBuilder(B_VERTICAL, padding)
		.Add(fSignatureControl)
		.Add(BGroupLayoutBuilder(B_HORIZONTAL, padding)
			.Add(flagsBox, 3)
			.Add(iconBox, 1))
		.Add(typeBox)
		.Add(versionBox)
		.SetInsets(padding, padding, padding, padding));

	SetKeyMenuBar(menuBar);

	fSignatureControl->MakeFocus(true);
	BMimeType::StartWatching(this);
	_SetTo(entry);
}
예제 #26
0
// ResourceUsageWindow::InitWindow -- Initialization Commands here
void ResourceUsageWindow::InitWindow(BList &list)
{
	BRect rtab = Bounds();
	BRect rlist = Bounds();
	rtab.top += 10;
	rlist.top += 10;
	rlist.left += 12;
	rlist.right -= 15 + B_V_SCROLL_BAR_WIDTH;
	rlist.bottom -= 47;

	// Create the TabView and Tabs
	BTabView *tabView = new BTabView(rtab,"resource_usage_tabview");
	tabView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
	
	rtab = tabView->Bounds();
	rtab.InsetBy(5,5);
	
	// Create the ListViews
	BListView *IRQListView = new BListView(rlist, "IRQListView",
		B_SINGLE_SELECTION_LIST, B_FOLLOW_LEFT | B_FOLLOW_TOP,
		B_WILL_DRAW | B_NAVIGABLE);
	BListView *DMAListView = new BListView(rlist, "DMAListView",
		B_SINGLE_SELECTION_LIST, B_FOLLOW_LEFT | B_FOLLOW_TOP,
		B_WILL_DRAW | B_NAVIGABLE);
	BListView *IORangeListView = new BListView(rlist, "IORangeListView",
		B_SINGLE_SELECTION_LIST, B_FOLLOW_LEFT | B_FOLLOW_TOP,
		B_WILL_DRAW | B_NAVIGABLE);
	BListView *memoryListView = new BListView(rlist, "memoryListView",
		B_SINGLE_SELECTION_LIST, B_FOLLOW_LEFT | B_FOLLOW_TOP,
		B_WILL_DRAW | B_NAVIGABLE);
	
	BScrollView *IRQScrollView = new BScrollView("scroll_list1", IRQListView,
		B_FOLLOW_LEFT|B_FOLLOW_TOP, 0, false, true, B_FANCY_BORDER);
	BScrollView *DMAScrollView = new BScrollView("scroll_list2", DMAListView,
		B_FOLLOW_LEFT|B_FOLLOW_TOP, 0, false, true, B_FANCY_BORDER);
	BScrollView *IORangeScrollView = new BScrollView("scroll_list3",
		IORangeListView, B_FOLLOW_LEFT|B_FOLLOW_TOP, 0, false, true,
		B_FANCY_BORDER);
	BScrollView *memoryScrollView = new BScrollView("scroll_list4",
		memoryListView, B_FOLLOW_LEFT|B_FOLLOW_TOP, 0, false, true,
		B_FANCY_BORDER);
	
	BTab *tab = new BTab();
	tabView->AddTab(IRQScrollView, tab);
	tab->SetLabel(B_TRANSLATE("IRQ"));
	tab = new BTab();
	tabView->AddTab(DMAScrollView, tab);
	tab->SetLabel(B_TRANSLATE("DMA"));
	tab = new BTab();
	tabView->AddTab(IORangeScrollView, tab);
	tab->SetLabel(B_TRANSLATE("IO Range"));
	tab = new BTab();
	tabView->AddTab(memoryScrollView, tab);
	tab->SetLabel(B_TRANSLATE("Memory Range"));
	
	{
		uint32 mask = 1;
		
		for (int i=0;i<16;mask<<=1,i++) {
			bool first = true;
			
			for (int32 j=0; j<list.CountItems(); j++) {
				DevicesInfo *deviceInfo = (DevicesInfo *)list.ItemAt(j);
				struct device_configuration *current = deviceInfo->GetCurrent();
				resource_descriptor r;
				
				int32 num = count_resource_descriptors_of_type(current,
					B_IRQ_RESOURCE);
				
				for (int32 k=0;k<num;k++) {
					get_nth_resource_descriptor_of_type(current, k, B_IRQ_RESOURCE,
							&r, sizeof(resource_descriptor));
					
					if (mask & r.d.m.mask) {
						IRQListView->AddItem(new IRQDMAItem(first ? i : -1,
							deviceInfo->GetCardName()));
						first = false;
					}
				}
			}
			
			if (first) {
				IRQListView->AddItem(new IRQDMAItem(i, ""));
			}
		}
	}
	
	{
		uint32 mask = 1;
		
		for (int i=0;i<8;mask<<=1,i++) {
			bool first = true;
			
			for (int32 j=0; j<list.CountItems(); j++) {
				DevicesInfo *deviceInfo = (DevicesInfo *)list.ItemAt(j);
				struct device_configuration *current = deviceInfo->GetCurrent();
				resource_descriptor r;
				
				int32 num = count_resource_descriptors_of_type(current,
					B_DMA_RESOURCE);
				
				for (int32 k=0;k<num;k++) {
					get_nth_resource_descriptor_of_type(current, k,
						B_DMA_RESOURCE,	&r, sizeof(resource_descriptor));
					
					if (mask & r.d.m.mask) {
						DMAListView->AddItem(new IRQDMAItem(first ? i : -1,
							deviceInfo->GetCardName()));
						first = false;
					}
				}
			}
			
			if (first) {
				DMAListView->AddItem(new IRQDMAItem(i, ""));
			}
		}
	}

	{
		for (int32 j=0; j<list.CountItems(); j++) {
			DevicesInfo *deviceInfo = (DevicesInfo *)list.ItemAt(j);
			struct device_configuration *current = deviceInfo->GetCurrent();
			resource_descriptor r;
			
			int32 num = count_resource_descriptors_of_type(current,
				B_IO_PORT_RESOURCE);
			
			for (int32 k=0;k<num;k++) {
				get_nth_resource_descriptor_of_type(current, k,
					B_IO_PORT_RESOURCE,	&r, sizeof(resource_descriptor));
				
				IORangeListView->AddItem(new RangeItem(r.d.r.minbase, 
					r.d.r.minbase + r.d.r.len - 1, deviceInfo->GetCardName()));
			}
		}
	
		IORangeListView->SortItems(&RangeItem::Compare);
	}
	
	{
		for (int32 j=0; j<list.CountItems(); j++) {
			DevicesInfo *deviceInfo = (DevicesInfo *)list.ItemAt(j);
			struct device_configuration *current = deviceInfo->GetCurrent();
			resource_descriptor r;
			
			int32 num = count_resource_descriptors_of_type(current,
				B_MEMORY_RESOURCE);
			
			for (int32 k=0;k<num;k++) {
				get_nth_resource_descriptor_of_type(current, k, B_MEMORY_RESOURCE,
						&r, sizeof(resource_descriptor));
				
				memoryListView->AddItem(new RangeItem(r.d.r.minbase, 
					r.d.r.minbase + r.d.r.len - 1, deviceInfo->GetCardName()));
			}
		}
	
		memoryListView->SortItems(&RangeItem::Compare);
	}
	
	
	BBox *background = new BBox(Bounds(), "background");
	background->SetBorder(B_NO_BORDER);
	AddChild(background);
	background->AddChild(tabView);
}
예제 #27
0
AttributeWindow::AttributeWindow(FileTypesWindow* target, BMimeType& mimeType,
		AttributeItem* attributeItem)
	: BWindow(BRect(100, 100, 350, 200), "Attribute", B_MODAL_WINDOW_LOOK,
		B_MODAL_SUBSET_WINDOW_FEEL, B_NOT_ZOOMABLE | B_NOT_V_RESIZABLE
			| B_ASYNCHRONOUS_CONTROLS),
	fTarget(target),
	fMimeType(mimeType.Type())
{
	if (attributeItem != NULL)
		fAttribute = *attributeItem;

	BRect rect = Bounds();
	BView* topView = new BView(rect, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
	topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(topView);

	rect.InsetBy(8.0f, 8.0f);
	fPublicNameControl = new BTextControl(rect, "public", "Attribute name:",
		fAttribute.PublicName(), NULL, B_FOLLOW_LEFT_RIGHT);
	fPublicNameControl->SetModificationMessage(new BMessage(kMsgAttributeUpdated));

	float labelWidth = fPublicNameControl->StringWidth(fPublicNameControl->Label()) + 2.0f;
	fPublicNameControl->SetDivider(labelWidth);
	fPublicNameControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);

	float width, height;
	fPublicNameControl->GetPreferredSize(&width, &height);
	fPublicNameControl->ResizeTo(rect.Width(), height);
	topView->AddChild(fPublicNameControl);

	rect = fPublicNameControl->Frame();
	rect.OffsetBy(0.0f, rect.Height() + 5.0f);
	fAttributeControl = new BTextControl(rect, "internal", "Internal name:",
		fAttribute.Name(), NULL, B_FOLLOW_LEFT_RIGHT);
	fAttributeControl->SetModificationMessage(new BMessage(kMsgAttributeUpdated));
	fAttributeControl->SetDivider(labelWidth);
	fAttributeControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);

	// filter out invalid characters that can't be part of an attribute
	BTextView* textView = fAttributeControl->TextView();
	const char* disallowedCharacters = "/";
	for (int32 i = 0; disallowedCharacters[i]; i++) {
		textView->DisallowChar(disallowedCharacters[i]);
	}

	topView->AddChild(fAttributeControl);

	fTypeMenu = new BPopUpMenu("type");
	BMenuItem* item = NULL;
	for (int32 i = 0; kTypeMap[i].name != NULL; i++) {
		BMessage* message = new BMessage(kMsgTypeChosen);
		message->AddInt32("type", kTypeMap[i].type);

		item = new BMenuItem(kTypeMap[i].name, message);
		fTypeMenu->AddItem(item);

		if (kTypeMap[i].type == fAttribute.Type())
			item->SetMarked(true);
	}

	rect.OffsetBy(0.0f, rect.Height() + 4.0f);
	BMenuField* menuField = new BMenuField(rect, "types",
		"Type:", fTypeMenu);
	menuField->SetDivider(labelWidth);
	menuField->SetAlignment(B_ALIGN_RIGHT);
	menuField->GetPreferredSize(&width, &height);
	menuField->ResizeTo(rect.Width(), height);
	topView->AddChild(menuField);

	rect.OffsetBy(0.0f, rect.Height() + 4.0f);
	rect.bottom = rect.top + fAttributeControl->Bounds().Height() * 2.0f + 18.0f;
	BBox* box = new BBox(rect, "", B_FOLLOW_LEFT_RIGHT);
	topView->AddChild(box);

	fVisibleCheckBox = new BCheckBox(rect, "visible", "Visible",
		new BMessage(kMsgVisibilityChanged));
	fVisibleCheckBox->SetValue(fAttribute.Visible());
	fVisibleCheckBox->ResizeToPreferred();
	box->SetLabel(fVisibleCheckBox);

	labelWidth -= 8.0f;

	BMenu* menu = new BPopUpMenu("display as");
	for (int32 i = 0; kDisplayAsMap[i].name != NULL; i++) {
		BMessage* message = new BMessage(kMsgDisplayAsChosen);
		if (kDisplayAsMap[i].identifier != NULL) {
			message->AddString("identifier", kDisplayAsMap[i].identifier);
			for (int32 j = 0; kDisplayAsMap[i].supported[j]; j++) {
				message->AddInt32("supports", kDisplayAsMap[i].supported[j]);
			}
		}

		item = new BMenuItem(kDisplayAsMap[i].name, message);
		menu->AddItem(item);

		if (compare_display_as(kDisplayAsMap[i].identifier, fAttribute.DisplayAs()))
			item->SetMarked(true);
	}

	rect.OffsetTo(8.0f, fVisibleCheckBox->Bounds().Height());
	rect.right -= 18.0f;
	fDisplayAsMenuField = new BMenuField(rect, "display as",
		"Display as:", menu);
	fDisplayAsMenuField->SetDivider(labelWidth);
	fDisplayAsMenuField->SetAlignment(B_ALIGN_RIGHT);
	fDisplayAsMenuField->ResizeTo(rect.Width(), height);
	box->AddChild(fDisplayAsMenuField);

	fEditableCheckBox = new BCheckBox(rect, "editable", "Editable",
		new BMessage(kMsgAttributeUpdated), B_FOLLOW_RIGHT);
	fEditableCheckBox->SetValue(fAttribute.Editable());
	fEditableCheckBox->ResizeToPreferred();
	fEditableCheckBox->MoveTo(rect.right - fEditableCheckBox->Bounds().Width(),
		rect.top + (fDisplayAsMenuField->Bounds().Height()
		- fEditableCheckBox->Bounds().Height()) / 2.0f);
	box->AddChild(fEditableCheckBox);

	rect.OffsetBy(0.0f, menuField->Bounds().Height() + 4.0f);
	rect.bottom = rect.top + fPublicNameControl->Bounds().Height();
	fSpecialControl = new BTextControl(rect, "special", "Special:",
		display_as_parameter(fAttribute.DisplayAs()), NULL,
		B_FOLLOW_LEFT_RIGHT);
	fSpecialControl->SetModificationMessage(new BMessage(kMsgAttributeUpdated));
	fSpecialControl->SetDivider(labelWidth);
	fSpecialControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);
	fSpecialControl->SetEnabled(false);
	box->AddChild(fSpecialControl);

	char text[64];
	snprintf(text, sizeof(text), "%ld", fAttribute.Width());
	rect.OffsetBy(0.0f, fSpecialControl->Bounds().Height() + 4.0f);
	fWidthControl = new BTextControl(rect, "width", "Width:",
		text, NULL, B_FOLLOW_LEFT_RIGHT);
	fWidthControl->SetModificationMessage(new BMessage(kMsgAttributeUpdated));
	fWidthControl->SetDivider(labelWidth);
	fWidthControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT);

	// filter out invalid characters that can't be part of a width
	textView = fWidthControl->TextView();
	for (int32 i = 0; i < 256; i++) {
		if (!isdigit(i))
			textView->DisallowChar(i);
	}
	textView->SetMaxBytes(4);

	box->AddChild(fWidthControl);

	const struct alignment_map {
		int32		alignment;
		const char*	name;
	} kAlignmentMap[] = {
		{B_ALIGN_LEFT, "Left"},
		{B_ALIGN_RIGHT, "Right"},
		{B_ALIGN_CENTER, "Center"},
		{0, NULL}
	};

	menu = new BPopUpMenu("alignment");
	for (int32 i = 0; kAlignmentMap[i].name != NULL; i++) {
		BMessage* message = new BMessage(kMsgAlignmentChosen);
		message->AddInt32("alignment", kAlignmentMap[i].alignment);

		item = new BMenuItem(kAlignmentMap[i].name, message);
		menu->AddItem(item);

		if (kAlignmentMap[i].alignment == fAttribute.Alignment())
			item->SetMarked(true);
	}

	rect.OffsetBy(0.0f, menuField->Bounds().Height() + 1.0f);
	fAlignmentMenuField = new BMenuField(rect, "alignment",
		"Alignment:", menu);
	fAlignmentMenuField->SetDivider(labelWidth);
	fAlignmentMenuField->SetAlignment(B_ALIGN_RIGHT);
	fAlignmentMenuField->ResizeTo(rect.Width(), height);
	box->AddChild(fAlignmentMenuField);
	box->ResizeBy(0.0f, fAlignmentMenuField->Bounds().Height() * 2.0f
		+ fVisibleCheckBox->Bounds().Height());

	fAcceptButton = new BButton(rect, "add", item ? "Done" : "Add",
		new BMessage(kMsgAccept), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
	fAcceptButton->ResizeToPreferred();
	fAcceptButton->MoveTo(Bounds().Width() - 8.0f - fAcceptButton->Bounds().Width(),
		Bounds().Height() - 8.0f - fAcceptButton->Bounds().Height());
	fAcceptButton->SetEnabled(false);
	topView->AddChild(fAcceptButton);

	BButton* button = new BButton(rect, "cancel", "Cancel",
		new BMessage(B_QUIT_REQUESTED), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
	button->ResizeToPreferred();
	button->MoveTo(fAcceptButton->Frame().left - 10.0f - button->Bounds().Width(),
		fAcceptButton->Frame().top);
	topView->AddChild(button);

	ResizeTo(labelWidth * 4.0f + 24.0f, box->Frame().bottom
		+ button->Bounds().Height() + 20.0f);
	SetSizeLimits(fEditableCheckBox->Bounds().Width() + button->Bounds().Width()
		+ fAcceptButton->Bounds().Width() + labelWidth + 24.0f,
		32767.0f, Frame().Height(), Frame().Height());

	fAcceptButton->MakeDefault(true);
	fPublicNameControl->MakeFocus(true);

	target->PlaceSubWindow(this);
	AddToSubset(target);
}
예제 #28
0
AttribPolygon::AttribPolygon ()
: AttribView (BRect (0, 0, 148, 90), lstring (30, "Polygons"))
{
	SetViewColor (LightGrey);
	lSlid = new Slider (BRect (8, 8, 140, 26), 60, lstring (310, "Pen Size"), 1, 50, 1, new BMessage ('ALpc'));
	AddChild (lSlid);
	fPenSize = 1;
	fType = POLYGON_OUTFILL;
	BBox *type = new BBox (BRect (18, 32, 130, 82), "type");
	type->SetLabel (lstring (311, "Type"));
	AddChild (type);

	BPoint pointArray[] = {
		BPoint ( 2,  8),
		BPoint ( 9,  2),
		BPoint (27, 12),
		BPoint (19, 28),
		BPoint (14, 20),
		BPoint ( 9, 26)
		};
	BPolygon *poly = new BPolygon();
	poly->AddPoints(pointArray, 6);

	BWindow *picWindow = new BWindow (BRect (0, 0, 100, 100), "Temp Pic Window", B_BORDERED_WINDOW, uint32 (NULL), uint32 (NULL));
	BView *bg = new BView (BRect (0, 0, 100, 100), "Temp Pic View", uint32 (NULL), uint32 (NULL));
	picWindow->AddChild (bg);
	
	BPicture *p10;
	bg->BeginPicture (new BPicture);
	bg->SetLowColor (LightGrey);
	bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
	bg->SetLowColor (White);
	bg->FillPolygon (poly, B_SOLID_LOW);
	bg->StrokePolygon (poly);
	p10 = bg->EndPicture();
	
	BPicture *p20;
	bg->BeginPicture (new BPicture);
	bg->SetLowColor (LightGrey);
	bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
	bg->SetHighColor (Black);
	bg->SetLowColor (White);
	bg->FillPolygon (poly, B_SOLID_LOW);
	p20 = bg->EndPicture();
	
	BPicture *p30;
	bg->BeginPicture (new BPicture);
	bg->SetLowColor (LightGrey);
	bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
	bg->SetHighColor (Black);
	bg->SetLowColor (White);
	bg->StrokePolygon (poly);
	p30 = bg->EndPicture();

	BPicture *p11;
	bg->BeginPicture (new BPicture);
	bg->SetLowColor (DarkGrey);
	bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
	bg->SetHighColor (Black);
	bg->SetLowColor (White);
	bg->FillPolygon (poly, B_SOLID_LOW);
	bg->StrokePolygon (poly);
	p11 = bg->EndPicture();
	
	BPicture *p21;
	bg->BeginPicture (new BPicture);
	bg->SetLowColor (DarkGrey);
	bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
	bg->SetHighColor (Black);
	bg->SetLowColor (White);
	bg->FillPolygon (poly, B_SOLID_LOW);
	p21 = bg->EndPicture();
	
	BPicture *p31;
	bg->BeginPicture (new BPicture);
	bg->SetLowColor (DarkGrey);
	bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
	bg->SetHighColor (Black);
	bg->SetLowColor (White);
	bg->StrokePolygon (poly);
	p31 = bg->EndPicture();
	
	delete poly;
	delete picWindow;
	
	SetViewColor (LightGrey);
	
	pT1 = new BPictureButton (BRect (4, 15, 34, 45), "APVt1", p10, p11, new BMessage ('pvT1'), B_TWO_STATE_BUTTON);
	pT2 = new BPictureButton (BRect (40, 15, 70, 45), "APVt2", p20, p21, new BMessage ('pvT2'), B_TWO_STATE_BUTTON);
	pT3 = new BPictureButton (BRect (76, 15, 106, 45), "APVt3", p30, p31, new BMessage ('pvT3'), B_TWO_STATE_BUTTON);
	type->AddChild (pT1);
	type->AddChild (pT2);
	type->AddChild (pT3);
	pT1->SetValue (B_CONTROL_ON);
	fCurrentProperty = 0;
}
예제 #29
0
ConfigWindow::ConfigWindow()
    :
    BWindow(BRect(100.0, 100.0, 580.0, 540.0), "E-mail", B_TITLED_WINDOW,
           B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE),
    fLastSelectedAccount(NULL),
    fSaveSettings(false)
{
    // create controls

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

    // determine font height
    font_height fontHeight;
    top->GetFontHeight(&fontHeight);
    int32 height = (int32)(fontHeight.ascent + fontHeight.descent
                           + fontHeight.leading) + 5;

    rect.InsetBy(5, 5);
    rect.bottom -= 11 + height;
    BTabView *tabView = new BTabView(rect, NULL);

    BView *view;
    rect = tabView->Bounds();
    rect.bottom -= tabView->TabHeight() + 4;
    tabView->AddTab(view = new BView(rect, NULL, B_FOLLOW_ALL, 0));
    tabView->TabAt(0)->SetLabel(B_TRANSLATE("Accounts"));
    view->SetViewColor(top->ViewColor());

    // accounts listview

    rect = view->Bounds().InsetByCopy(8, 8);
    rect.right = 140 - B_V_SCROLL_BAR_WIDTH;
    rect.bottom -= height + 12;
    fAccountsListView = new AccountsListView(rect);
    view->AddChild(new BScrollView(NULL, fAccountsListView, B_FOLLOW_ALL, 0,
                                   false, true));
    rect.right += B_V_SCROLL_BAR_WIDTH;

    rect.top = rect.bottom + 8;
    rect.bottom = rect.top + height;
    BRect sizeRect = rect;
    sizeRect.right = sizeRect.left + 30 + view->StringWidth(
                         B_TRANSLATE("Add"));
    view->AddChild(new BButton(sizeRect, NULL, B_TRANSLATE("Add"),
                               new BMessage(kMsgAddAccount), B_FOLLOW_BOTTOM));

    sizeRect.left = sizeRect.right+3;
    sizeRect.right = sizeRect.left + 30 + view->StringWidth(
                         B_TRANSLATE("Remove"));
    view->AddChild(fRemoveButton = new BButton(
        sizeRect, NULL, B_TRANSLATE("Remove"),
        new BMessage(kMsgRemoveAccount), B_FOLLOW_BOTTOM));

    // accounts config view
    rect = view->Bounds();
    rect.left = fAccountsListView->Frame().right + B_V_SCROLL_BAR_WIDTH + 16;
    rect.right -= 10;
    view->AddChild(fConfigView = new CenterContainer(rect));

    MakeHowToView();

    // general settings

    rect = tabView->Bounds();
    rect.bottom -= tabView->TabHeight() + 4;
    tabView->AddTab(view = new CenterContainer(rect));
    tabView->TabAt(1)->SetLabel(B_TRANSLATE("Settings"));

    rect = view->Bounds().InsetByCopy(8, 8);
    rect.right -= 1;
    rect.bottom = rect.top + height * 5 + 15;
    BBox *box = new BBox(rect);
    box->SetLabel(B_TRANSLATE("Mail checking"));
    view->AddChild(box);

    rect = box->Bounds().InsetByCopy(8, 8);
    rect.top += 7;
    rect.bottom = rect.top + height + 5;
    BRect tile = rect.OffsetByCopy(0, 1);
    int32 labelWidth = (int32)view->StringWidth(B_TRANSLATE("Check every")) + 6;
    tile.right = 80 + labelWidth;
    fIntervalControl = new BTextControl(tile, "time",
                                        B_TRANSLATE("Check every"), NULL, NULL);
    fIntervalControl->SetDivider(labelWidth);
    box->AddChild(fIntervalControl);

    BPopUpMenu *frequencyPopUp = new BPopUpMenu(B_EMPTY_STRING);
    const char *frequencyStrings[] = {
        B_TRANSLATE("never"),
        B_TRANSLATE("minutes"),
        B_TRANSLATE("hours"),
        B_TRANSLATE("days")
    };
    BMenuItem *item;
    for (int32 i = 0; i < 4; i++) {
        frequencyPopUp->AddItem(item = new BMenuItem(frequencyStrings[i],
                new BMessage(kMsgIntervalUnitChanged)));
        if (i == 1)
            item->SetMarked(true);
    }
    tile.left = tile.right + 5;
    tile.right = rect.right;
    tile.OffsetBy(0,-1);
    fIntervalUnitField = new BMenuField(tile, "frequency", B_EMPTY_STRING,
                                        frequencyPopUp);
    fIntervalUnitField->SetDivider(0.0);
    box->AddChild(fIntervalUnitField);

    rect.OffsetBy(0,height + 9);
    rect.bottom -= 2;
    fPPPActiveCheckBox = new BCheckBox(rect, "ppp active",
                                       B_TRANSLATE("Only when dial-up is connected"), NULL);
    box->AddChild(fPPPActiveCheckBox);

    rect.OffsetBy(0,height + 9);
    rect.bottom -= 2;
    fPPPActiveSendCheckBox = new BCheckBox(rect, "ppp activesend",
                                           B_TRANSLATE("Schedule outgoing mail when dial-up is disconnected"),
                                           NULL);
    box->AddChild(fPPPActiveSendCheckBox);

    // Miscellaneous settings box

    rect = box->Frame();
    rect.bottom = rect.top + 3 * height + 30;
    box = new BBox(rect);
    box->SetLabel(B_TRANSLATE("Miscellaneous"));
    view->AddChild(box);

    BPopUpMenu *statusPopUp = new BPopUpMenu(B_EMPTY_STRING);
    const char *statusModes[] = {
        B_TRANSLATE("Never"),
        B_TRANSLATE("While sending"),
        B_TRANSLATE("While sending and receiving"),
        B_TRANSLATE("Always")
    };
    BMessage *msg;
    for (int32 i = 0; i < 4; i++) {
        statusPopUp->AddItem(item = new BMenuItem(statusModes[i],
                msg = new BMessage(kMsgShowStatusWindowChanged)));
        msg->AddInt32("ShowStatusWindow", i);
        if (i == 0)
            item->SetMarked(true);
    }
    rect = box->Bounds().InsetByCopy(8,8);
    rect.top += 7;
    rect.bottom = rect.top + height + 5;
    labelWidth
        = (int32)view->StringWidth(
              B_TRANSLATE("Show connection status window:"))	+ 8;
    fStatusModeField = new BMenuField(rect, "show status",
                                      B_TRANSLATE("Show connection status window:"), statusPopUp);
    fStatusModeField->SetDivider(labelWidth);
    box->AddChild(fStatusModeField);

    rect = fStatusModeField->Frame();;
    rect.OffsetBy(0, rect.Height() + 10);
    BButton *button = new BButton(rect, B_EMPTY_STRING,
                                  B_TRANSLATE("Edit mailbox menu…"),
                                  msg = new BMessage(B_REFS_RECEIVED));
    button->ResizeToPreferred();
    box->AddChild(button);
    button->SetTarget(BMessenger("application/x-vnd.Be-TRAK"));

    BPath path;
    find_directory(B_USER_SETTINGS_DIRECTORY, &path);
    path.Append("Mail/Menu Links");
    BEntry entry(path.Path());
    if (entry.InitCheck() == B_OK && entry.Exists()) {
        entry_ref ref;
        entry.GetRef(&ref);
        msg->AddRef("refs", &ref);
    }
    else
        button->SetEnabled(false);

    rect = button->Frame();
    rect.OffsetBy(rect.Width() + 30,0);
    fAutoStartCheckBox = new BCheckBox(rect, "start daemon",
                                       B_TRANSLATE("Start mail services on startup"), NULL);
    fAutoStartCheckBox->ResizeToPreferred();
    box->AddChild(fAutoStartCheckBox);

    // save/revert buttons

    top->AddChild(tabView);

    rect = tabView->Frame();
    rect.top = rect.bottom + 5;
    rect.bottom = rect.top + height + 5;
    BButton *saveButton = new BButton(rect, "apply", B_TRANSLATE("Apply"),
                                      new BMessage(kMsgSaveSettings));
    float w,h;
    saveButton->GetPreferredSize(&w, &h);
    saveButton->ResizeTo(w, h);
    saveButton->MoveTo(rect.right - w, rect.top);
    top->AddChild(saveButton);

    BButton *revertButton = new BButton(rect, "revert", B_TRANSLATE("Revert"),
                                        new BMessage(kMsgRevertSettings));
    revertButton->GetPreferredSize(&w, &h);
    revertButton->ResizeTo(w,h);
    revertButton->MoveTo(saveButton->Frame().left - 25 - w, rect.top);
    top->AddChild(revertButton);

    LoadSettings();
    // this will also move our window to the stored position

    fAccountsListView->SetSelectionMessage(new BMessage(kMsgAccountSelected));
    fAccountsListView->MakeFocus(true);
}
예제 #30
0
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);
}