Пример #1
0
BView* SeqEditMultiFilterWindow::NewGeneralView(BRect frame)
{
	BView*		v = new BView(frame, GENERAL_STR, B_FOLLOW_ALL, 0);
	if (!v) return NULL;
	v->SetViewColor( Prefs().Color(AM_AUX_WINDOW_BG_C) );
	float		fh = arp_get_font_height(v);
	float		spaceX = 5, spaceY = 5;
	float		divider = v->StringWidth("Author:") + 10;
	BRect		f(spaceX, 0, frame.Width() - spaceX, fh);
	/* The Name field.
	 */
	mNameCtrl = new BTextControl(f, "name_ctrl", "Name:", NULL, new BMessage(NAME_MSG), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
	if (mNameCtrl) {
		f.top = mNameCtrl->Frame().bottom;
		mNameCtrl->SetDivider(divider);
		mNameCtrl->MakeFocus(true);
		v->AddChild(mNameCtrl);
	}
	/* The Key field.
	 */
	f.top += spaceY;
	f.bottom = f.top + fh;
	mKeyCtrl = new BTextControl(f, "key_ctrl", "Key:", NULL, new BMessage(KEY_MSG), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
	if (mKeyCtrl) {
		f.top = mKeyCtrl->Frame().bottom;
		mKeyCtrl->SetDivider(divider);
		v->AddChild(mKeyCtrl);
	}
	/* The Author field.
	 */
	f.top += spaceY;
	f.bottom = f.top + fh;
	mAuthorCtrl = new BTextControl(f, "author_ctrl", "Author:", NULL, new BMessage(AUTHOR_MSG), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
	if (mAuthorCtrl) {
		f.top = mAuthorCtrl->Frame().bottom;
		mAuthorCtrl->SetDivider(divider);
		v->AddChild(mAuthorCtrl);
	}
	/* The Email field.
	 */
	f.top += spaceY;
	f.bottom = f.top + fh;
	mEmailCtrl = new BTextControl(f, "email_ctrl", "Email:", NULL, new BMessage(EMAIL_MSG), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
	if (mEmailCtrl) {
		f.top = mEmailCtrl->Frame().bottom;
		mEmailCtrl->SetDivider(divider);
		v->AddChild(mEmailCtrl);
	}

	return v;
}
Пример #2
0
ScreenSaverWindow::ScreenSaverWindow()
	:
	BWindow(BRect(50, 50, 496, 375), B_TRANSLATE_SYSTEM_NAME("ScreenSaver"),
		B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
{
	fSettings.Load();

	BRect rect = Bounds();
	fMinWidth = 430;
	fMinHeight = 325;

	// Create a background view
	BView *background = new BView(rect, "background", B_FOLLOW_ALL, 0);
	background->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(background);

	// Add the tab view to the background
	rect.top += 4;
	fTabView = new BTabView(rect, "tab_view");

	// Create the controls inside the tabs
	rect = fTabView->ContainerView()->Bounds();
	_SetupFadeTab(rect);
	fModulesView = new ModulesView(rect, B_TRANSLATE("Screensavers"), fSettings);

	fTabView->AddTab(fFadeView);
	fTabView->AddTab(fModulesView);
	background->AddChild(fTabView);

	// Create the password editing window
	fPasswordWindow = new PasswordWindow(fSettings);
	fPasswordWindow->Run();

	SetMinimalSizeLimit(fMinWidth, fMinHeight);
	MoveTo(fSettings.WindowFrame().left, fSettings.WindowFrame().top);
	ResizeTo(fSettings.WindowFrame().Width(), fSettings.WindowFrame().Height());

	fEnableCheckBox->SetValue(
		fSettings.TimeFlags() & ENABLE_SAVER ? B_CONTROL_ON : B_CONTROL_OFF);
	fRunSlider->SetTime(fSettings.BlankTime());
	fTurnOffSlider->SetTime(fSettings.OffTime() + fSettings.BlankTime());
	fFadeNow->SetCorner(fSettings.BlankCorner());
	fFadeNever->SetCorner(fSettings.NeverBlankCorner());
	fPasswordCheckBox->SetValue(fSettings.LockEnable());
	fPasswordSlider->SetTime(fSettings.PasswordTime());

	fTabView->Select(fSettings.WindowTab());

	_UpdateTurnOffScreen();
	_UpdateStatus();
}
MusicCollectionWindow::MusicCollectionWindow(BRect frame, const char* title)
	:
	BWindow(frame, title, B_DOCUMENT_WINDOW, B_AVOID_FRONT)
{
	BView* rootView = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW);
	AddChild(rootView);
	rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	fQueryField = new BTextControl("Search: ", "", NULL);
	fQueryField->SetExplicitAlignment(BAlignment(B_ALIGN_HORIZONTAL_CENTER,
		B_ALIGN_USE_FULL_HEIGHT));
	fQueryField->SetModificationMessage(new BMessage(kMsgQueryInput));

	fCountView = new BStringView("Count View", "Count:");

	fFileListView = new MusicFileListView("File List View");
	fFileListView->SetInvocationMessage(new BMessage(kMsgItemInvoked));
	BScrollView* scrollView = new BScrollView("list scroll", fFileListView, 0,
		true, true, B_PLAIN_BORDER);

	float spacing = be_control_look->DefaultItemSpacing() / 2;
	BALMLayout* layout = new BALMLayout(spacing);
	layout->SetInset(spacing);
	rootView->SetLayout(layout);

	layout->AddView(fQueryField, layout->Left(), layout->Top());
	layout->AddViewToRight(fCountView, layout->Right());
	layout->AddView(scrollView, layout->Left(),
		layout->AreaFor(fQueryField)->Bottom(), layout->Right(),
		layout->Bottom());

	Area* area = layout->AreaFor(scrollView);
	area->SetLeftInset(0);
	area->SetRightInset(0);
	area->SetBottomInset(0);

	BSize min = layout->MinSize();
	BSize max = layout->MaxSize();
	SetSizeLimits(min.Width(), max.Width(), min.Height(), max.Height());

	fEntryViewInterface = new ListViewListener<FileListItem>(fFileListView,
		fCountView);
	fQueryHandler = new QueryHandler(fEntryViewInterface);
	AddHandler(fQueryHandler);
	fQueryReader = new QueryReader(fQueryHandler);
	fQueryHandler->SetReadThread(fQueryReader);

	// start initial query
	PostMessage(kMsgQueryInput);
}
Пример #4
0
TeamDescriptionView::TeamDescriptionView()
	:
	BView("description view", B_WILL_DRAW),
	fItem(NULL),
	fSeconds(4),
	fRebootRunner(NULL)
{
	fInfoString = B_TRANSLATE(
		"Select an application from the list above and click one of "
		"the buttons 'Kill application' and 'Quit application' "
		"in order to close it.\n\n"
		"Hold CONTROL+ALT+DELETE for %ld seconds to reboot.");

	fTeamName = new BStringView("team name", "team name");
	fSysComponent = new BStringView("system component", B_TRANSLATE(
		"(This team is a system component)"));
	fQuitOverdue = new BStringView("quit overdue", B_TRANSLATE(
		"If the application will not quit you may have to kill it."));
	fQuitOverdue->SetFont(be_bold_font);

	fInfoTextView = new AllShowingTextView("info text");
	BGroupView* group = new BGroupView(B_VERTICAL);
	BGroupLayoutBuilder(group)
		.Add(fInfoTextView)
		.AddGlue();

	fIconView = new IconView();
	fIconView->SetExplicitAlignment(
		BAlignment(B_ALIGN_HORIZONTAL_UNSET, B_ALIGN_VERTICAL_CENTER));

	BView* teamPropertiesView = new BView("team properties", B_WILL_DRAW);
	teamPropertiesView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	BGroupLayout* layout = new BGroupLayout(B_HORIZONTAL);
	teamPropertiesView->SetLayout(layout);
	BGroupLayoutBuilder(layout)
		.Add(fIconView)
		.AddGroup(B_VERTICAL)
			.Add(fTeamName)
			.Add(fSysComponent)
			.Add(fQuitOverdue)
		.End()
		.AddGlue();

	fLayout = new BCardLayout();
	SetLayout(fLayout);
	fLayout->AddView(group);
	fLayout->AddView(teamPropertiesView);

	SetItem(NULL);
}
Пример #5
0
BFIV_PrefWin::BFIV_PrefWin(BRect frame)
    : BWindow(frame, "Preferences", B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NOT_RESIZABLE|B_NOT_ZOOMABLE)
{
    BRect rect = Bounds();
    BView *back;
    BTextControl *scratchPath;
    BButton *cancelButton, *okButton, *selectButton;
    font_height fontHeight;
    float fontSize, tmp;

    // private data
    filePanel = NULL;

    // some font voodoo
    be_plain_font->GetHeight(&fontHeight);
    fontSize = fontHeight.ascent + fontHeight.descent;

    // the background
    back = new BView(rect, "background", B_FOLLOW_ALL, 0);
    back->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    AddChild(back);

    // the select button
    tmp = be_plain_font->StringWidth("Select");
    rect.Set(frame.Width() - tmp - 20., 5., frame.Width() - 5., 5. + fontSize + 10.);
    selectButton = new BButton(rect, "select", "Select", new BMessage(SELECT_SCRATCH_PATH));
    back->AddChild(selectButton);

    // the path
    rect.Set(5.,5., selectButton->Frame().left - 5., 5. + fontSize + 10.);
    scratchPath = new BTextControl(rect, "path", "Scratch Location", NULL, NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
    back->AddChild(scratchPath);
    scratchPath->SetText(((BFIV_App *)be_app)->ScratchDirectory()); // current dir
    scratchPath->TextView()->MakeEditable(false); // only works after AddChild() (!!)


    // the ok button
    tmp = be_plain_font->StringWidth("OK");
    rect.Set(frame.Width() - tmp - 35., Frame().Height() - fontSize - 20., frame.Width() - 10., Frame().Height() - 10.);
    okButton = new BButton(rect, "ok", "OK", new BMessage(APPLY_PREFS_CHANGE));
    back->AddChild(okButton);
    okButton->MakeDefault(true);

    // the cancel button
    tmp = be_plain_font->StringWidth("Cancel");
    rect.Set(okButton->Frame().left - tmp - 20., okButton->Frame().top, okButton->Frame().left - 5., okButton->Frame().bottom);
    cancelButton = new BButton(rect, "cancel", "Cancel", new BMessage(B_QUIT_REQUESTED));
    back->AddChild(cancelButton);
}
Пример #6
0
StickItWindow::StickItWindow(BRect frame)
    : BWindow(frame, "StickIt", B_TITLED_WINDOW, NULL)
{
    frame = Bounds();
    frame.InsetBy(5, 5);
    BBox* box = new BBox(frame, NULL, B_FOLLOW_ALL_SIDES);


    // Allocate object
    BView* view = new BView(Bounds(), "", B_FOLLOW_ALL_SIDES, NULL);
    view->SetViewColor(216, 216, 216);
    view->SetLowColor(216, 216, 216);

    BRect rectString = BRect(frame.left, frame.top-10, frame.right -30, 30);
    BStringView* stringview1 = new BStringView(rectString,"StringView1",
            "This list, lists action that StickIt makes.");

    BRect rect = BRect(rectString.left, rectString.bottom + SPACE,
                       rectString.right, rectString.bottom + SPACE + 200);
    fListView1 = new BListView(rect,"ListView1");

    rectString = BRect(rect.left, rect.bottom + SPACE, rect.right,
                       rect.bottom + SPACE + 15);
    BStringView* stringview2 = new BStringView(rectString,"StringView2",
            "Choose Joystick below if any exists");

    rect = BRect(rectString.left, rectString.bottom + SPACE, rectString.right,
                 Bounds().bottom -20);
    fListView2 = new BListView(rect,"ListView2");
    fListView2->SetSelectionMessage(new BMessage(SELECTED));
    fListView2->SetInvocationMessage(new BMessage(INVOKE));


    // Adding object
    box->AddChild(new BScrollView("fListView1", fListView1,
                                  B_FOLLOW_LEFT_RIGHT, NULL, false, true));

    box->AddChild(new BScrollView("fListView2", fListView2,
                                  B_FOLLOW_ALL_SIDES, NULL, false, true));

    box->AddChild(stringview1);
    box->AddChild(stringview2);
    view->AddChild(box);
    AddChild(view);

    fJoystick = new BJoystick;
    PickJoystick(fJoystick);
}
Пример #7
0
AboutWindow::AboutWindow()
	:
	BWindow(BRect(250, 200, 650, 500), "AboutWindow", B_MODAL_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_NOT_CLOSABLE)
{
	BRect r;
	SetTitle("About");

	r = Bounds();
	BView* aroundView = new BView(r, "AroundView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
	aroundView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(aroundView);

	r = aroundView->Bounds();
	r.InsetBy(5.0, 5.0);
	aroundView->AddChild(new BButton(r, "close", "Close", new BMessage('ClWi')));
	aroundView->AddChild(new AboutView(r, "AboutView"));
}
Пример #8
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"));
	}
}
Пример #9
0
void SeqPrefWin::AddViews(const BMessage& prefs)
{
	BRect		b = Bounds();
	/* Add the bottom panel with the Cancel OK buttons.  When this
	 * block is done, it will adjust the bounds accordingly (i.e.,
	 * without the space used by this view).
	 */
	{
		float		buttonW = 60, buttonH = 24;
		float		edgeR = 8, edgeB = 8, edgeT = 8;
		BRect		f(b);
		f.top = f.bottom - edgeB - buttonH - edgeT;
		BView*		v = new BView( f, "button_panel", B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM, 0 );
		if( v ) {
			BRect		f( b.right - edgeR - buttonW, edgeT, b.right - edgeR, edgeT + buttonH );
			BButton*	button = new BButton( f, "ok_button", "OK", new BMessage( OK_MSG ), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM );
			if( button ) {
				v->AddChild( button );
				button->MakeDefault( true );
			}
			f.OffsetBy( 0-(buttonW + 10), 0 );	
			button = new BButton( f, "cancel_button", "Cancel", new BMessage( CANCEL_MSG ), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM );
			if( button ) v->AddChild( button );

			v->SetViewColor( Prefs().Color(AM_AUX_WINDOW_BG_C) );
			AddChild( v );
			b.bottom = b.bottom - edgeB - buttonH - edgeT - 1;
		}
	}
	BTabView*	tv = new BTabView(b, TABVIEW_STR);
	if (!tv) return;
	BView*		fileView = NewFileView(b, prefs);
	if (fileView) tv->AddTab(fileView);
	BView*		editView = NewEditView(b, prefs);
	if (editView) tv->AddTab(editView);
	BView*		playbackView = NewTrackView(b, prefs);
	if (playbackView) tv->AddTab(playbackView);
	mFactoryView = NewFactoriesView(b, prefs);
	if (mFactoryView) tv->AddTab(mFactoryView);

	AddChild(tv);
	/* NOTE:  Have to do this after the tab view's been added to the window or else
	 * you get a crash.  It's a bug in the tab view, nothing to be done about it.
	 */
	tv->SetTabWidth(B_WIDTH_FROM_WIDEST);
}
Пример #10
0
BView *PrefsWindow::create_volumes_pane(void)
{
	BView *pane = new BView(BRect(0, 0, top_frame.right-20, top_frame.bottom-80), GetString(STR_VOLUMES_PANE_TITLE), B_FOLLOW_NONE, B_WILL_DRAW);
	pane->SetViewColor(fill_color);
	float right = pane->Bounds().right-10;

	const char *str;
	int32 index = 0;
	volume_list = new VolumeListView(BRect(15, 10, pane->Bounds().right-30, 113), "volumes");
	while ((str = PrefsFindString("disk", index++)) != NULL)
		volume_list->AddItem(new BStringItem(str));
	volume_list->SetSelectionMessage(new BMessage(MSG_VOLUME_SELECTED));
	volume_list->SetInvocationMessage(new BMessage(MSG_VOLUME_INVOKED));
	pane->AddChild(new BScrollView("volumes_border", volume_list, B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true));

	pane->AddChild(new BButton(BRect(10, 118, pane->Bounds().right/3, 138), "add_volume", GetString(STR_ADD_VOLUME_BUTTON), new BMessage(MSG_ADD_VOLUME)));
	pane->AddChild(new BButton(BRect(pane->Bounds().right/3, 118, pane->Bounds().right*2/3, 138), "create_volume", GetString(STR_CREATE_VOLUME_BUTTON), new BMessage(MSG_CREATE_VOLUME)));
	pane->AddChild(new BButton(BRect(pane->Bounds().right*2/3, 118, pane->Bounds().right-11, 138), "remove_volume", GetString(STR_REMOVE_VOLUME_BUTTON), new BMessage(MSG_REMOVE_VOLUME)));

	extfs_control = new PathControl(true, BRect(10, 145, right, 160), "extfs", GetString(STR_EXTFS_CTRL), PrefsFindString("extfs"), NULL);
	extfs_control->SetDivider(90);
	pane->AddChild(extfs_control);

	BMenuField *menu_field;
	BPopUpMenu *menu = new BPopUpMenu("");
	menu_field = new BMenuField(BRect(10, 165, right, 180), "bootdriver", GetString(STR_BOOTDRIVER_CTRL), menu);
	menu_field->SetDivider(90);
	menu->AddItem(new BMenuItem(GetString(STR_BOOT_ANY_LAB), new BMessage(MSG_BOOT_ANY)));
	menu->AddItem(new BMenuItem(GetString(STR_BOOT_CDROM_LAB), new BMessage(MSG_BOOT_CDROM)));
	pane->AddChild(menu_field);
	int32 i32 = PrefsFindInt32("bootdriver");
	BMenuItem *item;
	if (i32 == 0) {
		if ((item = menu->FindItem(GetString(STR_BOOT_ANY_LAB))) != NULL)
			item->SetMarked(true);
	} else if (i32 == CDROMRefNum) {
		if ((item = menu->FindItem(GetString(STR_BOOT_CDROM_LAB))) != NULL)
			item->SetMarked(true);
	}

	nocdrom_checkbox = new BCheckBox(BRect(10, 185, right, 200), "nocdrom", GetString(STR_NOCDROM_CTRL), new BMessage(MSG_NOCDROM));
	pane->AddChild(nocdrom_checkbox);
	nocdrom_checkbox->SetValue(PrefsFindBool("nocdrom") ? B_CONTROL_ON : B_CONTROL_OFF);

	return pane;
}
Пример #11
0
PasswordWindow::PasswordWindow()
	: BWindow(BRect(100, 100, 400, 230), "Enter password",
		B_NO_BORDER_WINDOW_LOOK, kPasswordWindowFeel
			/* TODO: B_MODAL_APP_WINDOW_FEEL should also behave correctly */,
		B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE
		| B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS, B_ALL_WORKSPACES)
{
	BView* topView = new BView(Bounds(), "topView", B_FOLLOW_ALL, B_WILL_DRAW);
	topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(topView);

	BRect bounds(Bounds());
	bounds.InsetBy(10.0, 10.0);

	BBox *customBox = new BBox(bounds, "customBox", B_FOLLOW_NONE);
	topView->AddChild(customBox);
	customBox->SetLabel("Unlock screen saver");

	bounds.top += 10.0;
	fPassword = new BTextControl(bounds, "password", "Enter password:"******"VeryLongPasswordPossible", B_FOLLOW_NONE);
	customBox->AddChild(fPassword);
	fPassword->MakeFocus(true);
	fPassword->ResizeToPreferred();
	fPassword->TextView()->HideTyping(true);
	fPassword->SetDivider(be_plain_font->StringWidth("Enter password:"******"unlock", "Unlock",
		new BMessage(kMsgUnlock), B_FOLLOW_NONE);
	customBox->AddChild(button);
	button->MakeDefault(true);
	button->ResizeToPreferred();
	button->SetTarget(NULL, be_app);

	BRect frame = fPassword->Frame();
	button->MoveTo(frame.right - button->Bounds().Width(), frame.bottom + 10.0);
	customBox->ResizeTo(frame.right + 10.0,	button->Frame().bottom + 10.0);

	frame = customBox->Frame();
	ResizeTo(frame.right + 10.0, frame.bottom + 10.0);

	BScreen screen(this);
	MoveTo(screen.Frame().left + (screen.Frame().Width() - Bounds().Width()) / 2,
		screen.Frame().top + (screen.Frame().Height() - Bounds().Height()) / 2);
}
Пример #12
0
BView* SeqPrefWin::NewFactoriesView(BRect bounds, const BMessage& prefs)
{
	BView*		v = new BView(bounds, VIEWS_STR, B_FOLLOW_ALL, 0);
	if (!v) return v;
	v->SetViewColor( Prefs().Color(AM_AUX_WINDOW_BG_C) );
	float		sx = Prefs().Size(SPACE_X), sy = Prefs().Size(SPACE_Y);
	float		iH = Prefs().Size(INT_CTRL_Y);
	float		listB = (bounds.Height() * 0.5) - (sy * 2) - (iH * 3);
	/* The factory list.
	 */
	BRect		f(sx, sy, bounds.Width() - sx, sy + listB);
	mFactoryList = new SeqFactoryListView(f, VIEWS_STR);
	if (!mFactoryList) return v;
	mFactoryList->SetSelectionMessage(new BMessage(VIEW_ROW_SELECTED_MSG));
	v->AddChild(mFactoryList);

	return v;
}
Пример #13
0
BView* SeqEditMultiFilterWindow::NewIconView(BRect frame)
{
	BView*		v = new BView(frame, ICON_STR, B_FOLLOW_ALL, 0);
	if (!v) return NULL;
	v->SetViewColor( Prefs().Color(AM_AUX_WINDOW_BG_C) );

	/* The icon editor.
	 */
	BRect		f(5, 0, frame.Width(), frame.Height() );
	mIconEditor = new SeqBitmapEditor(f, ICON_STR, NULL, B_FOLLOW_ALL, new_icon_editor_menu() );
	if (mIconEditor) {
		mIconEditor->SetBitmapChangeMessage( new BMessage(BITMAP_CHANGE_MSG) );
		mIconEditor->SetViewColor( Prefs().Color(AM_AUX_WINDOW_BG_C) );
		v->AddChild(mIconEditor);
	}

	return v;
}
Пример #14
0
CColorPicker::CColorPicker(BRect frame, const char *name, bool stayOpen)
	: BWindow(frame, name, stayOpen ? B_TITLED_WINDOW : B_MODAL_WINDOW,
		B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
{
	fStayOpen = stayOpen;
	fCaller = NULL;
	
	BView *main = new BView(Bounds(), "main", 0, B_WILL_DRAW);
	AddChild(main);
	main->SetViewColor(kGray);
	
	BRect r(10, 10, 145, 130);
	fHSV = new CHSVView(r, "hsvview");
	main->AddChild(fHSV);
	
	r.Set(155, 10, 205, 130);
	fON = new CONView(r, "o&n");
	main->AddChild(fON);

	r.Set(215, 10, 380, 130);
	fRGB = new CRGBView(r, "rgbview");
	main->AddChild(fRGB);

	if (fStayOpen)
	{
		BRect b(Bounds());
		
		ResizeTo(b.Width(), b.Height() - 30);
	}
	else
	{
		r.Set(320, 140, 380, 160);
		BButton * ok = new BButton(r, "ok", "OK", new BMessage(msg_OK));
		main->AddChild(ok);
		ok->MakeDefault(true);
		
		r.Set(250, 140, 310, 160);
		main->AddChild(new BButton(r, "cancel", "Cancel", new BMessage(msg_Cancel)));

		// TPV 00-02-27
        KeyFilter * kf = new KeyFilter(B_ESCAPE, msg_Cancel) ;
        AddCommonFilter( kf ) ;
	}
} /* CColorPicker::CColorPicker */
FolderConfigWindow::FolderConfigWindow(BRect parent, const BMessage& settings)
	:
	BWindow(BRect(0, 0, 300, 300), B_TRANSLATE("IMAP Folders"),
		B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
		B_NO_WORKSPACE_ACTIVATION | B_NOT_ZOOMABLE | B_AVOID_FRONT),
	fSettings(settings)
{
	BView* rootView = new BView(Bounds(), "root", B_FOLLOW_ALL, B_WILL_DRAW);
	AddChild(rootView);
	rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	float spacing = be_control_look->DefaultItemSpacing();
	BALMLayout* layout = new BALMLayout(spacing);
	rootView->SetLayout(layout);
	layout->SetInset(spacing);

	fFolderListView = new EditListView(B_TRANSLATE("IMAP Folders"));
	fFolderListView->SetExplicitPreferredSize(BSize(B_SIZE_UNLIMITED,
		B_SIZE_UNLIMITED));
	fApplyButton = new BButton("Apply", B_TRANSLATE("Apply"),
		new BMessage(kMsgApplyButton));

	fQuotaView = new BStringView("quota view",
		B_TRANSLATE("Failed to fetch available storage."));
	fQuotaView->SetExplicitAlignment(BAlignment(B_ALIGN_LEFT,
		B_ALIGN_VERTICAL_CENTER));

	layout->AddView(fFolderListView, layout->Left(), layout->Top(),
		layout->Right(), layout->Bottom());

	GroupItem item = GroupItem(fQuotaView) / GroupItem(fFolderListView)
		/ (GroupItem(BSpaceLayoutItem::CreateGlue())
			| GroupItem(fApplyButton));
	layout->BuildLayout(item);

	PostMessage(kMsgInit);

	BSize min = layout->MinSize();
	BSize max = layout->MaxSize();
	SetSizeLimits(min.Width(), max.Width(), min.Height(), max.Height());

	CenterIn(parent);
}
Пример #16
0
BView*
NormalizeFilter::ConfigView()
{
	BRect r(0,0,180,80);

	BView *view = new BView(r, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	value = new SpinControl(NULL, B_TRANSLATE("Normalize Level (%)"),
		NULL, 1, 100, Prefs.filter_normalize, 1);

	value->SetDivider(120);

	BLayoutBuilder::Group<>(view, B_HORIZONTAL)
		.Add(value)
	.End();

	return view;
}
Пример #17
0
TChmodWindow::TChmodWindow(float ix, float iy, const char *title)
	:	BWindow(BRect(ix, iy, ix + 275, iy + 170), title,
			B_FLOATING_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
			B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_RESIZABLE)
{
	BView *bgView = new BView(Bounds(), "", 0, 0);
	bgView->SetViewColor(217,217,217);
	AddChild(bgView);
	
	float r = 40, w = 70, x = 100, ow = 80, gr = 140, ot = 200, xd = 15, yd = 15;
	bgView->AddChild(new BStringView(BRect(10, r, ow - 2, r + yd + 3), "", "Read:"));
	bgView->AddChild(new BStringView(BRect(10, w, ow - 2, w + yd + 3), "", "Write:"));
	bgView->AddChild(new BStringView(BRect(10, x, ow - 2, x + yd + 3), "", "Execute:"));
	bgView->AddChild(new BStringView(BRect(ow - 10, r - 20, ow + 30, r - 3), "", "Owner"));
	bgView->AddChild(new BStringView(BRect(gr - 10, r - 20, gr + 30, r - 3), "", "Group"));
	bgView->AddChild(new BStringView(BRect(ot - 10, r - 20, ot + 30, r - 3), "", "Other"));
	fOwnerRead  = new BCheckBox(BRect(ow, r, ow + xd, r + yd), "OwnerRead", "", NULL);
	fOwnerWrite = new BCheckBox(BRect(ow, w, ow + xd, w + yd), "OwnerWrite", "", NULL);
	fOwnerExec  = new BCheckBox(BRect(ow, x, ow + xd, x + yd), "OwnerExec", "", NULL);
	fGroupRead  = new BCheckBox(BRect(gr, r, gr + xd, r + yd), "GroupRead", "", NULL);
	fGroupWrite = new BCheckBox(BRect(gr, w, gr + xd, w + yd), "GroupWrite", "", NULL);
	fGroupExec  = new BCheckBox(BRect(gr, x, gr + xd, x + yd), "GroupROwner", "", NULL);
	fOtherRead  = new BCheckBox(BRect(ot, r, ot + xd, r + yd), "OtherRead", "", NULL);
	fOtherWrite = new BCheckBox(BRect(ot, w, ot + xd, w + yd), "OtherWrite", "", NULL);
	fOtherExec  = new BCheckBox(BRect(ot, x, ot + xd, x + yd), "OtherExec", "", NULL);
	bgView->AddChild(fOwnerRead);
	bgView->AddChild(fOwnerWrite);
	bgView->AddChild(fOwnerExec);
	bgView->AddChild(fGroupRead);
	bgView->AddChild(fGroupWrite);
	bgView->AddChild(fGroupExec);
	bgView->AddChild(fOtherRead);
	bgView->AddChild(fOtherWrite);
	bgView->AddChild(fOtherExec);
	fOKButton = new BButton(BRect(10, 140, 100, 160), "", "Change", new BMessage(OK_CLICKED));
	bgView->AddChild(fOKButton);
	fCancelButton = new BButton(BRect(170, 140, 260, 160), "", "Cancel", new BMessage(B_QUIT_REQUESTED));
	bgView->AddChild(fCancelButton);
	
	AddShortcut('W', 0, new BMessage(B_QUIT_REQUESTED));
	
	fStatus = B_BUSY;
}
Пример #18
0
// GetClipping -- this will return NULL if the user hasn't selected any region of
//                the screen. If she has, it will return a BBitmap representing that
//                selection. You MUST delete it. It's not mine.
//                Anything else, it returns NULL.
BBitmap * PictureViewer::GetClipping() {
        if (thePic == NULL) return NULL;
        if (clipping == false) return NULL;
         
        BBitmap *dragImage = new BBitmap(BRect(0,0,clippingRegion.Width(),clippingRegion.Height()), thePic->ColorSpace(),true,false);

        BView *tempView = new BView(dragImage->Bounds(),"yo",0,0);
           dragImage->AddChild(tempView);
           dragImage->Lock();
           tempView->SetViewColor(0,0,0);
           float left = -clippingRegion.left;
           float top = -clippingRegion.top;
           tempView->MovePenTo( left, top);
           tempView->DrawBitmap(thePic);
           dragImage->Unlock();
           dragImage->RemoveChild(tempView);
           delete tempView;
        return dragImage;
}
Пример #19
0
Window::Window()
	: BWindow(BRect(100, 100, 590, 260), "EventMask-Test",
			B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE | B_NOT_ZOOMABLE)
{
	BView* view = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW);
	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(view);

	BTextControl* textControl = new BTextControl(BRect(10, 10, 290, 30),
		"text", "Type to test focus suspending:", "", NULL, B_FOLLOW_LEFT_RIGHT);
	textControl->SetDivider(textControl->StringWidth(textControl->Label()) + 8);
	view->AddChild(textControl);

	textControl = new BTextControl(BRect(300, 10, 420, 30),
		"all", "All keys:", "", NULL, B_FOLLOW_LEFT_RIGHT);
	textControl->SetDivider(textControl->StringWidth(textControl->Label()) + 8);
	view->AddChild(textControl);
	textControl->TextView()->SetEventMask(B_KEYBOARD_EVENTS, 0);

	BRect rect(10, 40, 120, 120);
	for (int32 i = 0; i < 4; i++) {
		uint32 options = 0;
		switch (i) {
			case 1:
				options = B_SUSPEND_VIEW_FOCUS;
				break;
			case 2:
				options = B_LOCK_WINDOW_FOCUS;
				break;
			case 3:
				options = B_SUSPEND_VIEW_FOCUS | B_LOCK_WINDOW_FOCUS;
				break;
		}

		fViews[i] = new PositionView(rect, options);
		view->AddChild(fViews[i]);

		rect.OffsetBy(120, 0);
	}

	BCheckBox* checkBox = new BCheckBox(BRect(10, 130, 200, 160), "permanent", "Get all pointer events", new BMessage(kMsgPointerEvents));
	view->AddChild(checkBox);
}
Пример #20
0
ListChooseWindow::ListChooseWindow(list<string>* strL, string title, 
	string text1, string text2, string str) : 
	BWindow(BRect(200, 200, 415, 400), title.c_str(),
	B_FLOATING_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, 
	B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE | B_NOT_CLOSABLE)
{
	BRect rect(200, 200, 415, 400);
	rect.OffsetTo(0, 0);
	BView* backview = new BView(rect, "ListChooseBackView", 0, B_WILL_DRAW);
	backview->SetViewColor(222, 222, 222);
	AddChild(backview);
	
	BStringView* sv = new BStringView(BRect(15, 5, 185, 20),
		"ListChooseSV", text1.c_str());
	backview->AddChild(sv);
	sv = new BStringView(BRect(15, 20, 185, 33),
		"ListChooseSV", text2.c_str());
	backview->AddChild(sv);

	lv = new BListView(BRect(15, 40, 185, 153), "ListChooseLV");
	backview->AddChild(new BScrollView("scrollregister", lv,
		B_FOLLOW_LEFT | B_FOLLOW_TOP, 0, false, true));

	BStringItem* si;
	for (list<string>::iterator iter = strL->begin(); iter !=
		strL->end(); iter++)
	{
		si = new BStringItem((*iter).c_str());
		lv->AddItem(si);
		if (*iter == str)
			si->SetEnabled(false);
	}
	
	BButton* button = new BButton(BRect(15, 165, 95, 185), "okB",
		"OK", new BMessage(ListChooseOKMSG));
	backview->AddChild(button);
	button->MakeDefault(true);
	button = new BButton(BRect(105, 165, 200, 185), "cancelB",
		"Cancel", new BMessage(ListChooseCancelMSG));
	backview->AddChild(button);
	
	clickWait = create_sem(0, "clickWait");
}
Пример #21
0
void
BSlider::AttachedToWindow()
{
	ResizeToPreferred();

#if USE_OFF_SCREEN_VIEW
	BRect bounds(Bounds());

	if (!fOffScreenView) {
		fOffScreenView = new BView(bounds, "", B_FOLLOW_ALL, B_WILL_DRAW);

		BFont font;
		GetFont(&font);
		fOffScreenView->SetFont(&font);
	}

	if (!fOffScreenBits) {
		fOffScreenBits = new BBitmap(bounds, B_RGBA32, true, false);

		if (fOffScreenBits && fOffScreenView)
			fOffScreenBits->AddChild(fOffScreenView);

	} else if (fOffScreenView)
		fOffScreenBits->AddChild(fOffScreenView);
#endif // USE_OFF_SCREEN_VIEW

	BControl::AttachedToWindow();

	BView* view = OffscreenView();
	if (view && view->LockLooper()) {
		view->SetViewColor(B_TRANSPARENT_COLOR);
		view->SetLowColor(LowColor());
		view->UnlockLooper();
	}

	int32 value = Value();
	SetValue(value);
		// makes sure the value is within valid bounds
	_SetLocationForValue(Value());
		// makes sure the location is correct
	UpdateTextChanged();
}
Пример #22
0
MyWindow::MyWindow()
	: SWindow(BRect(200, 200, 600, 350), "Bitmap Test", B_TITLED_WINDOW, 0)
{
	BView *view = new BView(Bounds(), NULL, B_FOLLOW_ALL, 0);
	AddChild(view);

	rgb_color cl = {232, 232, 232, 255};
	view->SetViewColor(cl);

	SBitmapView *view1 = new SBitmapView(BRect(10, 10, 70, 70), "View 1", (const char**)xpm_question, "This is the bitmap view with XPM_QUESTION");
	view->AddChild(view1);

	SBitmapView *view2 = new SBitmapView(BRect(80, 80, 100, 100), "View 2", (const char**)xpm_yes, "XPM_YES");
	view->AddChild(view2);

	SBitmapView *view3 = new SBitmapView(BRect(10, 80, 30, 100), "View 3", (const char**)xpm_no);
	view->AddChild(view3);

	Run();
}
Пример #23
0
void ArpTextControl::copy_colors(BView* v)
{
	// Make no assumptions about the structure of the children.
	if( !v ) return;
	int32 num = v->CountChildren();
	for( int32 i=0; i<num; i++ ) {
		BView* child = v->ChildAt(i);
		if( child ) {
			copy_colors(child);
			BTextView* text = dynamic_cast<BTextView*>(child);
			if( text ) {
				text->SetFontAndColor(NULL, B_FONT_ALL, &PV_FillForeColor);
			}
			child->SetViewColor(PV_FillBackColor);
			child->SetLowColor(PV_FillBackColor);
			child->SetHighColor(PV_FillForeColor);
			child->Invalidate();
		}
	}
}
Пример #24
0
BView *ReverbWindow::ConfigView()
{
	BRect r(0,0,200,100);

	BView *view = new BView(r, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	r.InsetBy(8,8);
	r.bottom = r.top + 23;
	delay = new SpinSlider(r, NULL, Language.get("DELAY_MS"), new BMessage(CONTROL_CHANGED), 1, 500);
	delay->SetValue(Prefs.filter_reverb_delay * 1000);
	view->AddChild(delay);

	r.OffsetBy(0,40);
	gain = new SpinSlider(r, NULL, Language.get("GAIN"), new BMessage(CONTROL_CHANGED), 1, 100);
	gain->SetValue(Prefs.filter_reverb_gain * 200);
	view->AddChild(gain);

	return view;
}
Пример #25
0
BView *BassBoostFilter::ConfigView()
{
	BRect r(0,0,200,100);

	BView *view = new BView(r, NULL, B_FOLLOW_ALL, B_WILL_DRAW);
	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	r.InsetBy(8,8);
	r.bottom = r.top + 23;
	freq = new SpinSlider(r, NULL, Language.get("BB_FREQUENCY"), new BMessage(CONTROL_CHANGED), 1, 1000);
	freq->SetValue(Prefs.filter_bassboost_frequency);
	view->AddChild(freq);

	r.OffsetBy(0,40);
	boost = new SpinSlider(r, NULL, Language.get("BB_BOOST"), new BMessage(CONTROL_CHANGED), 0, 24);
	boost->SetValue(Prefs.filter_bassboost_boost);
	view->AddChild(boost);

	return view;
}
Пример #26
0
Window::Window()
	: BWindow(BRect(100, 100, 520, 200), "StatusBar-Test",
			B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS)
{
	BView* main = new BView(Bounds(), NULL, B_FOLLOW_ALL, B_WILL_DRAW);
	main->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(main);

	BRect rect(20, 10, 400, 30);
	fStatusBar = new BStatusBar(rect, NULL, "label", "trailing label");
	fStatusBar->SetResizingMode(B_FOLLOW_LEFT_RIGHT);
	//fStatusBar->ResizeToPreferred();
	float width, height;
	fStatusBar->GetPreferredSize(&width, &height);
	fStatusBar->ResizeTo(rect.Width(), height);
	fStatusBar->SetMaxValue(50.0f);
	main->AddChild(fStatusBar);

	BMessage update(kMsgUpdate);
	fUpdater = new BMessageRunner(this, &update, 10000LL);
}
Пример #27
0
BView *DelayWindow::ConfigView()
{
	BRect r(0,0,200,100);
	BView *view = new BView(r, "delayview", B_FOLLOW_ALL, B_WILL_DRAW);
	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	delay = new SpinSlider("delay", B_TRANSLATE("Delay (ms)"),
		new BMessage(CONTROL_CHANGED), 1, 500);
	delay->SetValue(Prefs.filter_delay_delay * 1000);

	gain = new SpinSlider("gain", B_TRANSLATE("Gain %"),
		new BMessage(CONTROL_CHANGED), 1, 200);
	gain->SetValue(Prefs.filter_delay_gain * 100);

	BLayoutBuilder::Group<>(view, B_VERTICAL, 2)
		.Add(delay, 0)
		.Add(gain, 1)
	.End();

	return view;
}
Пример #28
0
BView *RoomWindow::ConfigView()
{
	BView *view = new BView(NULL, B_WILL_DRAW);
	view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	delay = new SpinSlider(NULL, Language.get("DELAY_MS"), new BMessage(CONTROL_CHANGED), 1, 500);
	delay->SetValue(Prefs.filter_room_delay * 1000);

	damping = new SpinSlider(NULL, Language.get("DAMPING"), new BMessage(CONTROL_CHANGED), 1, 100);
	damping->SetValue(Prefs.filter_room_damping * 200);

	gain = new SpinSlider(NULL, Language.get("GAIN"), new BMessage(CONTROL_CHANGED), 1, 100);
	gain->SetValue(Prefs.filter_room_gain * 200);

	BLayoutBuilder::Group<>(view, B_VERTICAL)
		.Add(delay)
		.Add(damping)
		.Add(gain)
		.End();

	return view;
}
Пример #29
0
BBitmap *DragonView::_MakeNoneImage( void )
{
	// Draw an "empty" bitmap to represent "no image"; we'll use one
	// that tells the user what to do.
	BBitmap *bitmap = new BBitmap( BRect( 0, 0, 319, 199 ),
								   BScreen().ColorSpace(),
								   true );
	BView *view = new BView( bitmap->Bounds(),
							 "not a bitmap",
							 B_FOLLOW_ALL_SIDES, 0 );
	bitmap->AddChild( view );

	DragonApp *app = dynamic_cast<DragonApp *>( be_app );
	
	rgb_color White = { 255, 255, 255, 0 };
	rgb_color Black = { 0, 0, 0, 0 };
	
	bitmap->Lock();

	view->SetLowColor( White );
	view->SetViewColor( White );
	view->SetHighColor( Black );
	view->SetDrawingMode( B_OP_OVER );
	view->FillRect( view->Bounds(), B_SOLID_LOW );

	// Excercise for the reader here:  Read the old newsletter articles
	// about how to use the font metrics to find out how large a font is,
	// then center to font in the window dynamically no matter what font
	// settings the user has.

	view->SetFont( be_plain_font );
	view->MovePenTo( 5, 100 );
	view->DrawString( app->rsrc_strings->FindString( RSRC_Drop_an_image ) );
	view->Sync();
	
	bitmap->Unlock();

	return bitmap;
}
	StatusWindow(const char* text)
		:
		BWindow(BRect(0, 0, 10, 10), B_TRANSLATE("status"), B_MODAL_WINDOW_LOOK,
			B_MODAL_APP_WINDOW_FEEL, B_NO_WORKSPACE_ACTIVATION | B_NOT_ZOOMABLE
				| B_AVOID_FRONT | B_NOT_RESIZABLE)
	{
		BView* rootView = new BView(Bounds(), "root", B_FOLLOW_ALL,
			B_WILL_DRAW);
		AddChild(rootView);
		rootView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
		float spacing = be_control_look->DefaultItemSpacing();
		BALMLayout* layout = new BALMLayout(spacing);
		rootView->SetLayout(layout);
		layout->SetInset(spacing);

		BStringView* string = new BStringView("text", text);
		layout->AddView(string, layout->Left(), layout->Top(), layout->Right(),
			layout->Bottom());
		BSize min = layout->MinSize();
		ResizeTo(min.Width(), min.Height());
		CenterOnScreen();
	}