Exemple #1
0
void MediaJack::showContextMenu(
	BPoint point)
{
	D_METHOD(("MediaJack::showContextMenu()\n"));

	BPopUpMenu *menu = new BPopUpMenu("MediaJack PopUp", false, false, B_ITEMS_IN_COLUMN);
	menu->SetFont(be_plain_font);
	BMenuItem *item;

	// add the "Get Info" item
	if (isInput())
	{
		media_input input;
		getInput(&input);
		BMessage *message = new BMessage(InfoWindowManager::M_INFO_WINDOW_REQUESTED);
		message->AddData("input", B_RAW_TYPE,
						 reinterpret_cast<const void *>(&input), sizeof(input));
		menu->AddItem(item = new BMenuItem("Get info", message));
	}
	else if (isOutput())
	{
		media_output output;
		getOutput(&output);
		BMessage *message = new BMessage(InfoWindowManager::M_INFO_WINDOW_REQUESTED);
		message->AddData("output", B_RAW_TYPE,
						 reinterpret_cast<const void *>(&output), sizeof(output));
		menu->AddItem(item = new BMenuItem("Get info", message));
	}

	menu->SetTargetForItems(view());
	view()->ConvertToScreen(&point);
	point -= BPoint(1.0, 1.0);
	menu->Go(point, true, true, true);
}
Exemple #2
0
//! Track the mouse without blocking the window
void
CPUButton::MouseDown(BPoint point)
{
    BPoint mousePosition;
    uint32 mouseButtons;

    GetMouse(&mousePosition, &mouseButtons);

    if ((B_PRIMARY_MOUSE_BUTTON & mouseButtons) != 0) {
        SetValue(!Value());
        SetTracking(true);
        SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
    } else if ((B_SECONDARY_MOUSE_BUTTON & mouseButtons) != 0
               && fReplicantInDeskbar) {
        BPopUpMenu *menu = new BPopUpMenu(B_TRANSLATE("Deskbar menu"));
        menu->AddItem(new BMenuItem(B_TRANSLATE("About Pulse" B_UTF8_ELLIPSIS),
                                    new BMessage(B_ABOUT_REQUESTED)));
        menu->AddSeparatorItem();
        menu->AddItem(new BMenuItem(B_TRANSLATE("Remove replicant"),
                                    new BMessage(kDeleteReplicant)));
        menu->SetTargetForItems(this);

        ConvertToScreen(&point);
        menu->Go(point, true, true, true);
    }
}
Exemple #3
0
BPopUpMenu*	AmTrackInfoView::NewPropertiesMenu() const
{
	BPopUpMenu*				menu = new BPopUpMenu( "properties menu" );
	if( !menu ) return 0;
	BMenuItem*				item;
	/* The Duplicate menu item.
	 */
	BMessage*				msg = new BMessage( DUPLICATE_INFO_MSG );
	if( msg && (item = new BMenuItem( "Duplicate", msg )) ) {
		msg->AddPointer( SZ_VIEW_ID, this );
		msg->AddString( SZ_FACTORY_SIGNATURE, mFactorySignature.String() );
		msg->AddString( SZ_FACTORY_VIEW_NAME, mViewName.String() );
		menu->AddItem( item );
	}
	/* The Change View menu item.
	 */
	if( (item = NewChangeViewItem()) ) menu->AddItem( item );
	/* The Remove menu item.
	 */
	msg = new BMessage( REMOVE_INFO_MSG );
	if( msg && (item = new BMenuItem( "Remove", msg )) ) {
		msg->AddPointer( SZ_VIEW_ID, this );
		menu->AddItem( item );
	}
	return menu;
}
Exemple #4
0
BPopUpMenu*
TPrefsWindow::_BuildButtonBarMenu(uint8 show)
{
	BMenuItem* item;
	BMessage* msg;
	BPopUpMenu* menu = new BPopUpMenu("");

	msg = new BMessage(P_BUTTON_BAR);
	msg->AddInt8("bar", kShowToolBar);
	menu->AddItem(item = new BMenuItem(
		B_TRANSLATE("Show icons & labels"), msg));
	if (show & 1)
		item->SetMarked(true);

	msg = new BMessage(P_BUTTON_BAR);
	msg->AddInt8("bar", kShowToolBarIconsOnly);
	menu->AddItem(item = new BMenuItem(B_TRANSLATE("Show icons only"), msg));
	if (show & 2)
		item->SetMarked(true);

	msg = new BMessage(P_BUTTON_BAR);
	msg->AddInt8("bar", kHideToolBar);
	menu->AddItem(item = new BMenuItem(B_TRANSLATE("Hide"), msg));
	if (!show)
		item->SetMarked(true);

	return menu;
}
Exemple #5
0
void
TTimeView::ShowTimeOptions(BPoint point)
{
	BPopUpMenu* menu = new BPopUpMenu("", false, false);
	menu->SetFont(be_plain_font);
	BMenuItem* item;

	item = new BMenuItem(B_TRANSLATE("Time preferences" B_UTF8_ELLIPSIS),
		new BMessage(kChangeTime));
	menu->AddItem(item);

	item = new BMenuItem(B_TRANSLATE("Hide time"),
		new BMessage(kShowHideTime));
	menu->AddItem(item);

	item = new BMenuItem(B_TRANSLATE("Show calendar" B_UTF8_ELLIPSIS),
		new BMessage(kShowCalendar));
	menu->AddItem(item);

	menu->SetTargetForItems(this);
	// Changed to accept screen coord system point;
	// not constrained to this view now
	menu->Go(point, true, true, BRect(point.x - 4, point.y - 4,
		point.x + 4, point.y +4), true);
}
Exemple #6
0
BPopUpMenu*
MenuBuilder::_BuildPopUpMenu(KeyBind* bind, BView* target)
{
	if (bind == NULL)
		return NULL;

	// The first item describe the menu
	BPopUpMenu* menu = new BPopUpMenu(bind[0].label);
	BObjectList<BPopUpMenu> menuList(false);
	menuList.AddItem(menu);

	for (int i = 1; bind[i].message != FABER_EOF; i++) {

		menu = menuList.ItemAt(menuList.CountItems()-1);

		if (bind[i].message == FABER_ITEM_START) {
			BPopUpMenu* subMenu = new BPopUpMenu(bind[i].label);
			menu->AddItem(subMenu);
			menuList.AddItem(subMenu);
		}  else if (bind[i].message == FABER_ITEM_END) {
			if (menuList.CountItems() > 1)
				menuList.RemoveItemAt(menuList.CountItems()-1);
		} else {
			BMenuItem* item = _BuildMenuItem(bind[i].message, bind[i].label);
			if (target != NULL)
				item->SetTarget(target);

			menu->AddItem(item);
		}
	}
	return menuList.ItemAt(0);
}
Exemple #7
0
BPopUpMenu*
TPrefsWindow::_BuildAccountMenu(uint32 account)
{
    BPopUpMenu* menu = new BPopUpMenu("");
    BMenuItem* item;

    //menu->SetRadioMode(true);
    BList chains;
    if (GetOutboundMailChains(&chains) < B_OK) {
        menu->AddItem(item = new BMenuItem("<no account found>", NULL));
        item->SetEnabled(false);
        return menu;
    }

    BMessage* msg;
    for (int32 i = 0; i < chains.CountItems(); i++) {
        BMailChain* chain = (BMailChain*)chains.ItemAt(i);
        item = new BMenuItem(chain->Name(), msg = new BMessage(P_ACCOUNT));

        msg->AddInt32("id",chain->ID());

        if (account == chain->ID())
            item->SetMarked(true);

        menu->AddItem(item);
        delete chain;
    }
    return menu;
}
Exemple #8
0
void
Panel::RunControlMenu(BPoint where)
{
	BPopUpMenu	*qMenu = new BPopUpMenu("env sel", true, FALSE);
	
	BPoint			orig = where;
	ConvertToScreen(&where);
	
	BMessage	*msg;
	BMenuItem	*item;
	
	if (displayMode != PANEL_DISPLAY_SMALL) {
		msg = new BMessage(SET_DISPLAY_MODE);
		msg->AddInt32("display mode", PANEL_DISPLAY_SMALL);
		item = new BMenuItem("Close", msg);
		qMenu->AddItem(item);
		item->SetTarget(this);
	}
	if (displayMode != PANEL_DISPLAY_BIG) {
		msg = new BMessage(SET_DISPLAY_MODE);
		msg->AddInt32("display mode", PANEL_DISPLAY_BIG);
		item = new BMenuItem("Open", msg);
		qMenu->AddItem(item);
		item->SetTarget(this);
	}
		
	qMenu->SetAsyncAutoDestruct(true);
	qMenu->Go(where, true, false, true);
}
void
MidiPlayerWindow::CreateReverbMenu()
{
	BPopUpMenu* reverbPopUp = new BPopUpMenu("reverbPopUp");
	reverbNone = new BMenuItem(
		B_TRANSLATE("None"), new BMessage(MSG_REVERB_NONE));
	reverbCloset = new BMenuItem(
		B_TRANSLATE("Closet"), new BMessage(MSG_REVERB_CLOSET));
	reverbGarage = new BMenuItem(
		B_TRANSLATE("Garage"), new BMessage(MSG_REVERB_GARAGE));
	reverbIgor = new BMenuItem(
		B_TRANSLATE("Igor's lab"), new BMessage(MSG_REVERB_IGOR));
	reverbCavern = new BMenuItem(
		B_TRANSLATE("Cavern"), new BMessage(MSG_REVERB_CAVERN));
	reverbDungeon = new BMenuItem(
		B_TRANSLATE("Dungeon"), new BMessage(MSG_REVERB_DUNGEON));

	reverbPopUp->AddItem(reverbNone);
	reverbPopUp->AddItem(reverbCloset);
	reverbPopUp->AddItem(reverbGarage);
	reverbPopUp->AddItem(reverbIgor);
	reverbPopUp->AddItem(reverbCavern);
	reverbPopUp->AddItem(reverbDungeon);

	reverbMenu = new BMenuField(B_TRANSLATE("Reverb:"), reverbPopUp);
}
Exemple #10
0
BPopUpMenu*
TPrefsWindow::_BuildAccountMenu(int32 account)
{
	BPopUpMenu* menu = new BPopUpMenu("");
	BMenuItem* item;

	//menu->SetRadioMode(true);
	BMailAccounts accounts;
	if (accounts.CountAccounts() == 0) {
		menu->AddItem(item = new BMenuItem(B_TRANSLATE("<no account found>"), NULL));
		item->SetEnabled(false);
		return menu;
	}

	BMessage* msg;
	for (int32 i = 0; i < accounts.CountAccounts(); i++) {
		BMailAccountSettings* settings = accounts.AccountAt(i);
		item = new BMenuItem(settings->Name(), msg = new BMessage(P_ACCOUNT));

		msg->AddInt32("id", settings->AccountID());

		if (account == settings->AccountID())
			item->SetMarked(true);

		menu->AddItem(item);
	}
	return menu;
}
Exemple #11
0
// ShowContextMenu
bool
PathManipulator::ShowContextMenu(BPoint where)
{
	// Change the selection to the current point if it isn't currently
	// selected. This could will only be chosen if the user right-clicked
	// a path point directly. 
	if (fCurrentPathPoint >= 0 && !fSelection->Contains(fCurrentPathPoint)) {
		fSelection->MakeEmpty();
		_UpdateSelection();
		*fOldSelection = *fSelection;
		_Select(fCurrentPathPoint, false);
	}

	BPopUpMenu* menu = new BPopUpMenu("context menu", false, false);
	BMessage* message;
	BMenuItem* item;

	bool hasSelection = fSelection->CountItems() > 0;

	if (fCurrentPathPoint < 0) {
		message = new BMessage(B_SELECT_ALL);
		item = new BMenuItem("Select All", message, 'A');
		menu->AddItem(item);
	
		menu->AddSeparatorItem();
	}

	message = new BMessage(MSG_TRANSFORM);
	item = new BMenuItem("Transform", message, 'T');
	item->SetEnabled(hasSelection);
	menu->AddItem(item);

	message = new BMessage(MSG_SPLIT_POINTS);
	item = new BMenuItem("Split", message);
	item->SetEnabled(hasSelection);
	menu->AddItem(item);

	message = new BMessage(MSG_FLIP_POINTS);
	item = new BMenuItem("Flip", message);
	item->SetEnabled(hasSelection);
	menu->AddItem(item);

	message = new BMessage(MSG_REMOVE_POINTS);
	item = new BMenuItem("Remove", message);
	item->SetEnabled(hasSelection);
	menu->AddItem(item);

	// go
	menu->SetTargetForItems(fCanvasView);
	menu->SetAsyncAutoDestruct(true);
	menu->SetFont(be_plain_font);
	where = fCanvasView->ConvertToScreen(where);
	BRect mouseRect(where, where);
	mouseRect.InsetBy(-10.0, -10.0);
	where += BPoint(5.0, 5.0);
	menu->Go(where, true, false, mouseRect, true);

	return true;
}
ExpMixerUI::ExpMixerUI(BRect frame, const char *name, ExpMix *mix)
: BView(frame, name, B_FOLLOW_ALL, B_WILL_DRAW)
{
	BMessage *msg;
	BRect rect;
	
	// build a BStringView
	rect.Set(5.0,5.0, frame.Width()/2.0, 20.0);
	AddChild(new BStringView(rect, "string", "Background:"));
	
	// build our radio buttons
	// source 1
	rect.Set(rect.left, rect.bottom + 5.0, rect.right, rect.bottom + 20.0);
	msg = new BMessage(EM_SET_BACKGROUND);
	msg->AddInt32("which", 0);
	AddChild(radio1 = new BRadioButton(rect, "radio1", "Source 1", msg));
	// source 2
	rect.Set(rect.left, rect.bottom + 5.0, rect.right, rect.bottom + 20.0);
	msg = new BMessage(EM_SET_BACKGROUND);
	msg->AddInt32("which", 1);
	AddChild(radio2 = new BRadioButton(rect, "radio2", "Source 2", msg));
	// turn radio1 on
	radio1->SetValue(1);
	
	// build our op menu
	BPopUpMenu *menu = new BPopUpMenu("op menu");
	// add op
	msg = new BMessage(EM_SET_OP);
	msg->AddInt32("which", 0);
	menu->AddItem(new BMenuItem("add", msg));
	// sub op
	msg = new BMessage(EM_SET_OP);
	msg->AddInt32("which", 1);
	menu->AddItem(new BMenuItem("sub", msg));
	// max op
	msg = new BMessage(EM_SET_OP);
	msg->AddInt32("which", 2);
	menu->AddItem(new BMenuItem("max", msg));
	// min op
	msg = new BMessage(EM_SET_OP);
	msg->AddInt32("which", 3);
	menu->AddItem(new BMenuItem("min", msg));
	// now add it to a menu field
	rect.Set(frame.Width()/2. + 20., 25., frame.Width() - 10., 50.);
	AddChild(opMenu = new BMenuField(rect, "menu", "Op: ", menu));
	
	// cache our initial width and height
	width = frame.Width();
	height = frame.Height();
	
	// background defaults to 0 (source 1)
	backWhich = 0;
	
	// know thy mixer
	theMixer = mix;
	
	// set the view color
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
}
void
IconView::MouseDown(BPoint where)
{
	if (!IsEnabled())
		return;

	int32 buttons = B_PRIMARY_MOUSE_BUTTON;
	int32 clicks = 1;
	if (Looper() != NULL && Looper()->CurrentMessage() != NULL) {
		if (Looper()->CurrentMessage()->FindInt32("buttons", &buttons) != B_OK)
			buttons = B_PRIMARY_MOUSE_BUTTON;
		if (Looper()->CurrentMessage()->FindInt32("clicks", &clicks) != B_OK)
			clicks = 1;
	}

	if ((buttons & B_PRIMARY_MOUSE_BUTTON) != 0
		&& BitmapRect().Contains(where)) {
		if (clicks == 2) {
			// double click - open Icon-O-Matic
			Invoke();
		} else if (fIcon != NULL) {
			// start tracking - this icon might be dragged around
			fDragPoint = where;
			fTracking = true;
			SetMouseEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY);
		}
	}

	if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0) {
		// show context menu

		ConvertToScreen(&where);

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

		bool hasIcon = fHasType ? fSource == kOwnIcon : fIcon != NULL;
		if (hasIcon) {
			menu->AddItem(new BMenuItem(
				B_TRANSLATE("Edit icon" B_UTF8_ELLIPSIS),
				new BMessage(kMsgEditIcon)));
		} else {
			menu->AddItem(new BMenuItem(
				B_TRANSLATE("Add icon" B_UTF8_ELLIPSIS),
				new BMessage(kMsgAddIcon)));
		}

		BMenuItem* item = new BMenuItem(
			B_TRANSLATE("Remove icon"), new BMessage(kMsgRemoveIcon));
		if (!hasIcon)
			item->SetEnabled(false);

		menu->AddItem(item);
		menu->SetTargetForItems(fTarget);

		menu->Go(where, true, false, true);
	}
}
Exemple #14
0
MainWindow::MainWindow()
	:
	BWindow(BRect(0, 0, 300, 400), "Caya", B_TITLED_WINDOW, 0),
	fWorkspaceChanged(false)
{
	fStatusView = new StatusView("statusView");

	SearchBarTextControl* searchBox = 
		new SearchBarTextControl(new BMessage(kSearchContact));

	fListView = new RosterListView("buddyView");
	fListView->SetInvocationMessage(new BMessage(CAYA_OPEN_CHAT_WINDOW));
	BScrollView* scrollView = new BScrollView("scrollview", fListView,
		B_WILL_DRAW, false, true);

	// Wrench menu
	BPopUpMenu* wrenchMenu = new BPopUpMenu("Wrench");
	(void)wrenchMenu->AddItem(new BMenuItem("About" B_UTF8_ELLIPSIS,
		new BMessage(B_ABOUT_REQUESTED)));
	(void)wrenchMenu->AddItem(new BSeparatorItem());
	(void)wrenchMenu->AddItem(new BMenuItem("Preferences" B_UTF8_ELLIPSIS,
		new BMessage(CAYA_SHOW_SETTINGS)));
	(void)wrenchMenu->AddItem(new BSeparatorItem());
	(void)wrenchMenu->AddItem(new BMenuItem("Quit",
		new BMessage(B_QUIT_REQUESTED)));
	wrenchMenu->SetTargetForItems(this);

	// Tool icon
	BResources* res = CayaResources();
	BBitmap* toolIcon = IconFromResources(res, kToolIcon);
	delete res;

	// Wrench tool button
	ToolButton* wrench = new ToolButton(NULL, NULL);
	wrench->SetBitmap(toolIcon);
	wrench->SetMenu(wrenchMenu);

	SetLayout(new BGridLayout(1, 2));
	AddChild(BGridLayoutBuilder(1, 2)
		.Add(searchBox, 0, 0)
		.Add(wrench, 1, 0)
		.Add(scrollView, 0, 1, 2)
		.Add(fStatusView, 0, 2, 2)
		.SetInsets(5, 5, 5, 10)
	);

	AddShortcut('a', B_COMMAND_KEY, new BMessage(B_ABOUT_REQUESTED));
	MoveTo(BAlert::AlertPosition(Bounds().Width(), Bounds().Height() / 2));

	// Filter messages using Server
	fServer = new Server();
	AddFilter(fServer);

	CenterOnScreen();

	//TODO check for errors here
	ReplicantStatusView::InstallReplicant();
}
Exemple #15
0
// DisplayPopupMenu
bool
SplitManipulator::DisplayPopupMenu(BPoint where)
{
	BPopUpMenu* menu = new BPopUpMenu("item popup", false, false);

	BMessage* message;
	BMenuItem* item;

	bool separator = false;

	if (fItem->HasVideo()) {
		message = new BMessage(MSG_SET_VIDEO_MUTED);
		message->AddPointer("item", fItem);
		item = new BMenuItem("Enabled Video", message);
		item->SetMarked(!fItem->IsVideoMuted());
		menu->AddItem(item);
		separator = true;
	}

	if (fItem->HasAudio()) {
		message = new BMessage(MSG_SET_AUDIO_MUTED);
		message->AddPointer("item", fItem);
		item = new BMenuItem("Enabled Audio", message);
		item->SetMarked(!fItem->IsAudioMuted());
		menu->AddItem(item);
		separator = true;
	}

	if (separator)
		menu->AddSeparatorItem();

	BMenuItem* selectClipItem = NULL;
	if (ClipPlaylistItem* clipItem = dynamic_cast<ClipPlaylistItem*>(fItem)) {
		message = new BMessage(MSG_SELECT_AND_SHOW_CLIP);
		message->AddPointer("clip", clipItem->Clip());
		selectClipItem = new BMenuItem("Select Clip", message);
		menu->AddItem(selectClipItem);
	} else
		separator = false;

	if (separator)
		menu->AddSeparatorItem();

	message = new BMessage(MSG_REMOVE_ITEM);
	message->AddPointer("item", fItem);
	item = new BMenuItem("Remove Clip", message);
	menu->AddItem(item);

	menu->SetTargetForItems(fView);
	if (selectClipItem)
		selectClipItem->SetTarget(fView->Window());

	show_popup_menu(menu, where, fView, false);

	return true;
}
Exemple #16
0
void
URLInputGroup::URLTextView::MouseDown(BPoint where)
{
	bool wasFocus = IsFocus();
	if (!wasFocus)
		MakeFocus(true);

	int32 buttons;
	if (Window()->CurrentMessage()->FindInt32("buttons", &buttons) != B_OK)
		buttons = B_PRIMARY_MOUSE_BUTTON;

	if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0) {
		// Display context menu
		int32 selectionStart;
		int32 selectionEnd;
		GetSelection(&selectionStart, &selectionEnd);
		bool canCutOrCopy = selectionEnd > selectionStart;

		bool canPaste = false;
		if (be_clipboard->Lock()) {
			if (BMessage* data = be_clipboard->Data())
				canPaste = data->HasData("text/plain", B_MIME_TYPE);
			be_clipboard->Unlock();
		}

		BMenuItem* cutItem = new BMenuItem(B_TRANSLATE("Cut"),
			new BMessage(B_CUT));
		BMenuItem* copyItem = new BMenuItem(B_TRANSLATE("Copy"),
			new BMessage(B_COPY));
		BMenuItem* pasteItem = new BMenuItem(B_TRANSLATE("Paste"),
			new BMessage(B_PASTE));
		BMenuItem* clearItem = new BMenuItem(B_TRANSLATE("Clear"),
			new BMessage(MSG_CLEAR));
		cutItem->SetEnabled(canCutOrCopy);
		copyItem->SetEnabled(canCutOrCopy);
		pasteItem->SetEnabled(canPaste);
		clearItem->SetEnabled(strlen(Text()) > 0);

		BPopUpMenu* menu = new BPopUpMenu("url context");
		menu->AddItem(cutItem);
		menu->AddItem(copyItem);
		menu->AddItem(pasteItem);
		menu->AddItem(clearItem);

		menu->SetTargetForItems(this);
		menu->Go(ConvertToScreen(where), true, true, true);
		return;
	}

	// Only pass through to base class if we already have focus.
	if (!wasFocus)
		return;

	BTextView::MouseDown(where);
}
Exemple #17
0
void
QuaSymbolBridge::MouseDown(BPoint where)
{
	long		channel, quant;
	BRect		area = Bounds();

	ulong		mods = modifiers(); // Key mods???
	ulong		buts;
	BMessage	*msg;
	BPoint		pt;
	drawing_mode	cur_mode = DrawingMode();
	long		clicks;
	
	GetMouse(&pt, &buts);
	msg = Window()->CurrentMessage();
	
	if ((clicks=msg->FindInt32("clicks")) == 1) {
		if (buts & B_SECONDARY_MOUSE_BUTTON) {
			BPopUpMenu	*qMenu = new BPopUpMenu("env sel", true, FALSE);
			
			BPoint			orig = where;
			ConvertToScreen(&where);
			
			BMessage	*msg = new BMessage(SET_DISPLAY_MODE);
			msg->AddInt32("display mode", OBJECT_DISPLAY_SMALL);
			BMenuItem	*item = new BMenuItem("Small", msg);
			qMenu->AddItem(item);
			item->SetTarget(this);
		
			msg = new BMessage(SET_DISPLAY_MODE);
			msg->AddInt32("display mode", OBJECT_DISPLAY_BIG);
			item = new BMenuItem("Large", msg);
			qMenu->AddItem(item);
			item->SetTarget(this);
		
			qMenu->SetAsyncAutoDestruct(true);
			qMenu->Go(where, true, false, true);
		} else {
			msg = new BMessage(MOVE_OBJECT);
		 	msg->AddPointer("sym_object", this);
		 	
			if (mods & B_SHIFT_KEY) {
				((ObjectViewContainer *)Parent())->AddSelection(this);
			} else {
				((ObjectViewContainer *)Parent())->Select(this);
			}
		
			DragMessage(msg, area);
		}
	} else if (clicks > 1) {	// edit object
		Edit();
	} else {
	}
}
void
InitializeBFSEditor::_CreateViewControls()
{
	fNameControl = new BTextControl(B_TRANSLATE("Name:"), "Haiku", NULL);
	fNameControl->SetModificationMessage(new BMessage(MSG_NAME_CHANGED));
	fNameControl->TextView()->SetMaxBytes(31);

	BPopUpMenu* blocksizeMenu = new BPopUpMenu("blocksize");
	BMessage* message = new BMessage(MSG_BLOCK_SIZE);
	message->AddString("size", "1024");
	blocksizeMenu->AddItem(new BMenuItem(
		B_TRANSLATE("1024 (Mostly small files)"), message));
	message = new BMessage(MSG_BLOCK_SIZE);
	message->AddString("size", "2048");
	BMenuItem* defaultItem = new BMenuItem(B_TRANSLATE("2048 (Recommended)"),
		message);
	blocksizeMenu->AddItem(defaultItem);
	message = new BMessage(MSG_BLOCK_SIZE);
	message->AddString("size", "4096");
	blocksizeMenu->AddItem(new BMenuItem("4096", message));
	message = new BMessage(MSG_BLOCK_SIZE);
	message->AddString("size", "8192");
	blocksizeMenu->AddItem(new BMenuItem(
		B_TRANSLATE("8192 (Mostly large files)"), message));

	fBlockSizeMenuField = new BMenuField(B_TRANSLATE("Blocksize:"),
		blocksizeMenu);
	defaultItem->SetMarked(true);

	fUseIndicesCheckBox = new BCheckBox(B_TRANSLATE("Enable query support"),
		NULL);
	fUseIndicesCheckBox->SetValue(true);
	fUseIndicesCheckBox->SetToolTip(B_TRANSLATE("Disabling query support may "
		"speed up certain file system operations, but should only be used "
		"if one is absolutely certain that one will not need queries.\n"
		"Any volume that is intended for booting Haiku must have query "
		"support enabled."));

	float spacing = be_control_look->DefaultItemSpacing();

	fView = BGridLayoutBuilder(spacing, spacing)
		// row 1
		.Add(fNameControl->CreateLabelLayoutItem(), 0, 0)
		.Add(fNameControl->CreateTextViewLayoutItem(), 1, 0)

		// row 2
		.Add(fBlockSizeMenuField->CreateLabelLayoutItem(), 0, 1)
		.Add(fBlockSizeMenuField->CreateMenuBarLayoutItem(), 1, 1)

		// row 3
		.Add(fUseIndicesCheckBox, 0, 2, 2).View()
	;
}
Exemple #19
0
BMenuField*
KeymapWindow::_CreateDeadKeyMenuField()
{
	BPopUpMenu* deadKeyMenu = new BPopUpMenu(B_TRANSLATE("Select dead keys"),
		false, false);

	fAcuteMenu = new BMenu(B_TRANSLATE("Acute trigger"));
	fAcuteMenu->SetRadioMode(true);
	fAcuteMenu->AddItem(new BMenuItem("\xC2\xB4",
		new BMessage(kMsgDeadKeyAcuteChanged)));
	fAcuteMenu->AddItem(new BMenuItem("'",
		new BMessage(kMsgDeadKeyAcuteChanged)));
	fAcuteMenu->AddItem(new BMenuItem(kDeadKeyTriggerNone,
		new BMessage(kMsgDeadKeyAcuteChanged)));
	deadKeyMenu->AddItem(fAcuteMenu);

	fCircumflexMenu = new BMenu(B_TRANSLATE("Circumflex trigger"));
	fCircumflexMenu->SetRadioMode(true);
	fCircumflexMenu->AddItem(new BMenuItem("^",
		new BMessage(kMsgDeadKeyCircumflexChanged)));
	fCircumflexMenu->AddItem(new BMenuItem(kDeadKeyTriggerNone,
		new BMessage(kMsgDeadKeyCircumflexChanged)));
	deadKeyMenu->AddItem(fCircumflexMenu);

	fDiaeresisMenu = new BMenu(B_TRANSLATE("Diaeresis trigger"));
	fDiaeresisMenu->SetRadioMode(true);
	fDiaeresisMenu->AddItem(new BMenuItem("\xC2\xA8",
		new BMessage(kMsgDeadKeyDiaeresisChanged)));
	fDiaeresisMenu->AddItem(new BMenuItem("\"",
		new BMessage(kMsgDeadKeyDiaeresisChanged)));
	fDiaeresisMenu->AddItem(new BMenuItem(kDeadKeyTriggerNone,
		new BMessage(kMsgDeadKeyDiaeresisChanged)));
	deadKeyMenu->AddItem(fDiaeresisMenu);

	fGraveMenu = new BMenu(B_TRANSLATE("Grave trigger"));
	fGraveMenu->SetRadioMode(true);
	fGraveMenu->AddItem(new BMenuItem("`",
		new BMessage(kMsgDeadKeyGraveChanged)));
	fGraveMenu->AddItem(new BMenuItem(kDeadKeyTriggerNone,
		new BMessage(kMsgDeadKeyGraveChanged)));
	deadKeyMenu->AddItem(fGraveMenu);

	fTildeMenu = new BMenu(B_TRANSLATE("Tilde trigger"));
	fTildeMenu->SetRadioMode(true);
	fTildeMenu->AddItem(new BMenuItem("~",
		new BMessage(kMsgDeadKeyTildeChanged)));
	fTildeMenu->AddItem(new BMenuItem(kDeadKeyTriggerNone,
		new BMessage(kMsgDeadKeyTildeChanged)));
	deadKeyMenu->AddItem(fTildeMenu);

	return new BMenuField(NULL, deadKeyMenu);
}
void
MediaReplicant::MouseDown(BPoint point)
{
	int32 buttons = B_PRIMARY_MOUSE_BUTTON;
	if (Looper() != NULL && Looper()->CurrentMessage() != NULL)
		Looper()->CurrentMessage()->FindInt32("buttons", &buttons);

	BPoint where = ConvertToScreen(point);

	if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0) {
		BPopUpMenu* menu = new BPopUpMenu("", false, false);
		menu->SetFont(be_plain_font);

		menu->AddItem(new BMenuItem(
			B_TRANSLATE("Media preferences" B_UTF8_ELLIPSIS),
			new BMessage(kMsgOpenMediaSettings)));
		menu->AddItem(new BMenuItem(
			B_TRANSLATE("Sound preferences" B_UTF8_ELLIPSIS),
			new BMessage(kMsgOpenSoundSettings)));

		menu->AddSeparatorItem();

		menu->AddItem(new BMenuItem(B_TRANSLATE("Open MediaPlayer"),
			new BMessage(kMsgOpenMediaPlayer)));

		menu->AddSeparatorItem();

		BMenu* subMenu = new BMenu(B_TRANSLATE("Options"));
		menu->AddItem(subMenu);

		BMenuItem* item = new BMenuItem(B_TRANSLATE("Control physical output"),
			new BMessage(kMsgVolumeWhich));
		item->SetMarked(fVolumeWhich == VOLUME_USE_PHYS_OUTPUT);
		subMenu->AddItem(item);

		item = new BMenuItem(B_TRANSLATE("Beep"),
			new BMessage(kMsgToggleBeep));
		item->SetMarked(!fDontBeep);
		subMenu->AddItem(item);

		menu->SetTargetForItems(this);
		subMenu->SetTargetForItems(this);

		menu->Go(where, true, true, BRect(where - BPoint(4, 4),
			where + BPoint(4, 4)));
	} else {
		// Show VolumeWindow
		fVolumeSlider = new VolumeWindow(BRect(where.x, where.y,
			where.x + 207, where.y + 19), fDontBeep, fVolumeWhich);
		fVolumeSlider->Show();
	}
}
void
NetPulseView::MouseDown(BPoint where)
{
	int32 buttons;
	int32 clicks;
	if (Window()->CurrentMessage()->FindInt32("buttons", &buttons) != B_OK
		|| Window()->CurrentMessage()->FindInt32("clicks", &clicks) != B_OK) {
		return;
	}

	if (buttons == B_SECONDARY_MOUSE_BUTTON) {	
		BPopUpMenu* popUpMenu = new BPopUpMenu("NetPulseMenu");

		popUpMenu->AddItem(new BMenuItem("Connect",
			new BMessage(kMsgConnect)));
		popUpMenu->AddItem(new BMenuItem("Disconnect",
			new BMessage(kMsgDisconnect)));
		popUpMenu->AddSeparatorItem();

		popUpMenu->AddItem(new BMenuItem("Statistics...",
			new BMessage(kMsgStatistics)));
		popUpMenu->AddSeparatorItem();

		uint32 cookie = 0;
		BNetworkInterface interface;
		BNetworkRoster& roster = BNetworkRoster::Default();
		while (roster.GetNextInterface(&cookie, interface) == B_OK) {
			const char* name = interface.Name();
			if (strncmp(name, "loop", 4) != 0) {
				BMenuItem* menuItem = new BMenuItem(name,
					new BMessage(kMsgChangeInterface + cookie));
				menuItem->SetMarked(cookie == fCookie);
				popUpMenu->AddItem(menuItem);
			}
		}

		popUpMenu->AddSeparatorItem();
		popUpMenu->AddItem(new BMenuItem("Quit", new BMessage(kMsgQuit)));
		popUpMenu->SetTargetForItems(this);

		popUpMenu->FindItem(kMsgConnect)->SetEnabled(!fEnable && fCookie != 0);
		popUpMenu->FindItem(kMsgDisconnect)->SetEnabled(fEnable && fCookie != 0);
		popUpMenu->FindItem(kMsgStatistics)->SetEnabled(fEnable && fCookie != 0);

		popUpMenu->Go(ConvertToScreen(BPoint(0, 0)), true, false, false);
		delete popUpMenu;
	} else if (buttons == B_PRIMARY_MOUSE_BUTTON && clicks == 2)
		be_roster->Launch("application/x-vnd.Haiku-Network");
}
Renamer_Remove::Renamer_Remove()
	: Renamer()
{
	fName = B_TRANSLATE("Remove");

	fPosition1 = new BSpinner(NULL,	B_TRANSLATE("Remove from position"),
		new BMessage(MSG_RENAME_SETTINGS));
	fPosition1->SetMinValue(0);
	fPosition1->SetValue(0);

	BPopUpMenu* myMenu;
	myMenu = new BPopUpMenu(B_TRANSLATE("Please select"));
	myMenu->AddItem(new BMenuItem(B_TRANSLATE("from the front (left)"),
		new BMessage(MSG_RENAME_SETTINGS)));
	myMenu->AddItem(new BMenuItem(B_TRANSLATE("from the back (right)"),
		new BMessage(MSG_RENAME_SETTINGS)));

	myMenu->ItemAt(0)->SetMarked(true);

	fDirection1 = new BMenuField(NULL, NULL, myMenu);

	fPosition2 = new BSpinner(NULL, B_TRANSLATE("To position"),
		new BMessage(MSG_RENAME_SETTINGS));
	fPosition2->SetMinValue(0);
	fPosition2->SetValue(0);

	myMenu = new BPopUpMenu(B_TRANSLATE("Please select"));
	myMenu->AddItem(new BMenuItem(B_TRANSLATE("from the front (left)"),
		new BMessage(MSG_RENAME_SETTINGS)));
	myMenu->AddItem(new BMenuItem(B_TRANSLATE("from the back (right)"),
		new BMessage(MSG_RENAME_SETTINGS)));

	myMenu->ItemAt(0)->SetMarked(true);

	fDirection2 = new BMenuField(NULL, NULL, myMenu);

	BLayoutBuilder::Group<>(this, B_VERTICAL)
		.SetInsets(B_USE_WINDOW_INSETS)
		.AddGroup(B_HORIZONTAL)
			.Add(fPosition1)
			.Add(fDirection1)
		.End()
		.AddGroup(B_HORIZONTAL)
			.Add(fPosition2)
			.Add(fDirection2)
		.End()
		.AddGlue();
}
Exemple #23
0
ConfigView::ConfigView()
	:	BView(BRect(0,0,10,10),"notifier_config",B_FOLLOW_LEFT | B_FOLLOW_TOP,0)
{
	SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	// determine font height
	font_height fontHeight;
	GetFontHeight(&fontHeight);
	float itemHeight = (int32)(fontHeight.ascent + fontHeight.descent + fontHeight.leading) + 6;
	
	BRect frame(5,2,250,itemHeight + 2);
	BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING,false,false);

	const char *notifyMethods[] = {
		MDR_DIALECT_CHOICE ("Beep","音"),
		MDR_DIALECT_CHOICE ("Alert","窓(メール毎)"),
		MDR_DIALECT_CHOICE ("Keyboard LEDs","キーボードLED"),
		MDR_DIALECT_CHOICE ("Central alert","窓(一括)"),
		"Central beep","Log window"};
	for (int32 i = 0,j = 1;i < 6;i++,j *= 2)
		menu->AddItem(new BMenuItem(notifyMethods[i],new BMessage(kMsgNotifyMethod)));

	BMenuField *field = new BMenuField(frame,"notify",
		MDR_DIALECT_CHOICE ("Method:","方法:"),menu);
	field->ResizeToPreferred();
	field->SetDivider(field->StringWidth(
		MDR_DIALECT_CHOICE ("Method:","方法:")) + 6);
	AddChild(field);

	ResizeToPreferred();
}		
Exemple #24
0
void
StatusView::MouseDown(BPoint where)
{
	if (!fReadOnly)
		return;

	float left = fCellWidth[kPositionCell] + fCellWidth[kEncodingCell];
	if (where.x < left)
		return;

	int32 clicks = 0;
	BMessage* message = Window()->CurrentMessage();
	if (message != NULL
		&& message->FindInt32("clicks", &clicks) == B_OK && clicks > 1)
			return;

	BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING, false, false);
	menu->AddItem(new BMenuItem(B_TRANSLATE("Unlock file"),
					new BMessage(UNLOCK_FILE)));
	where.x = left;
	where.y = Bounds().bottom;

	ConvertToScreen(&where);
	menu->SetTargetForItems(this);
	menu->Go(where, true, true,	true);
}
Exemple #25
0
/*static*/ BPopUpMenu*
AppearancePrefView::_MakeMenu(uint32 msg, const char** items,
	const char* defaultItemName)
{
	BPopUpMenu* menu = new BPopUpMenu("");

	int32 i = 0;
	while (*items) {
		if (!strcmp((*items), ""))
			menu->AddSeparatorItem();
		else {
			BMessage* message = new BMessage(msg);
			menu->AddItem(new BMenuItem((*items), message));
		}

		items++;
		i++;
	}

	BMenuItem* defaultItem = menu->FindItem(defaultItemName);
	if (defaultItem)
		defaultItem->SetMarked(true);

	return menu;
}
Exemple #26
0
BPopUpMenu *TPrefsWindow::BuildFontMenu(BFont *font)
{
	char		label[512];
	int32		family_count;
	int32		family_loop;
	int32		style_count;
	int32		style_loop;
	BMenuItem	*item;
	BMessage	*msg;
	BPopUpMenu	*menu;
	font_family	def_family;
	font_family	f_family;
	font_style	def_style;
	font_style	f_style;

	menu = new BPopUpMenu("");
	font->GetFamilyAndStyle(&def_family, &def_style);
	family_count = count_font_families();
	for (family_loop = 0; family_loop < family_count; family_loop++) {
		get_font_family(family_loop, &f_family);
		style_count = count_font_styles(f_family);
		for (style_loop = 0; style_loop < style_count; style_loop++) {
			get_font_style(f_family, style_loop, &f_style);
			msg = new BMessage(P_FONT);
			msg->AddString("font", f_family);
			msg->AddString("style", f_style);
			sprintf(label, "%s %s", f_family, f_style);
			menu->AddItem(item = new BMenuItem(label, msg));
			if ((!strcmp(def_family, f_family)) && (!strcmp(def_style, f_style)))
				item->SetMarked(true);
			item->SetTarget(this);
		}
	}
	return menu;
}
Exemple #27
0
void SplitWindow::AddCat()
{
	ResizeBy(0, 25);
	uint16 xpos = 20;
	uint16 width = 150;
	BTextControl* tc = new BTextControl(BRect(xpos - 5, ypos + 10, 
		xpos + width, ypos + 10), "CatField", "", "", 0);
	xpos += width;
	tc->SetDivider(0);
	catTexts.push_back(tc);
	v->AddChild(tc);
	BPopUpMenu* pu = new BPopUpMenu("", true, false);
	BMenuField* mf = new BMenuField(BRect(xpos + 2, ypos + 9, 
		xpos + 2, ypos + 9), "CatMenu", "", pu);
	mf->SetDivider(0);
	v->AddChild(mf);
	xpos += 30;
	tc = new BTextControl(BRect(xpos - 5, ypos + 10, 
		xpos + 75, ypos + 10), "AmountField", "", "", 0);
	tc->SetDivider(0);
	tc->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT);
	tc->SetModificationMessage(new BMessage(AmountModifiedMSG));
	amtTexts.push_back(tc);
	v->AddChild(tc);
	ypos += 25;

	for (cas::iterator ci = catS->begin(); ci != catS->end(); ci++)
	{
		if ((*ci)->IsRoot())
		{
			pu->AddItem(MakeCatMenu(*ci));
		}
	}
	catnum++;
}
Exemple #28
0
void StatusItem::GeneratePopUp(BPoint point, BRect openrect)
{
	BString str(value);
	str.Append(" ");
	BString url;
	URLCrunch crunch(str.String(), str.Length());
	BPopUpMenu* menu = new BPopUpMenu("URLs");
	BMessage msg(M_LOAD_URL);
	BMessage* allocmsg(NULL);
	BMenuItem* item(NULL);

	while (crunch.Crunch(&url) != B_ERROR) {
		allocmsg = new BMessage(msg);
		allocmsg->AddString("url", url.String());
		item = new BMenuItem(url.String(), allocmsg);
		menu->AddItem(item);
		allocmsg = NULL;
	}

	if (menu->CountItems() > 0) {
		menu->SetTargetForItems(be_app);
		menu->SetAsyncAutoDestruct(true);
		menu->Go(point, true, true, openrect, true);
	} else {
		delete menu;
	}
}
BPopUpMenu* AmControlChangeInfoView::NewPropertiesMenu() const
{
	BPopUpMenu*		menu = inherited::NewPropertiesMenu();
	if (!menu) return menu;
	mCachedControlMenu = NewControlMenu();

	if (!mCachedControlMenu) return menu;
	BMenuItem*		item;
	if (mCachedControlMenu->CountItems() < 1 ) {
		item = new _AmActiveControlItem( "<track has no output filter>", new BMessage('null') );
		if (item) {
			item->SetEnabled( false );
			mCachedControlMenu->AddItem(item);
		}
	}
	item = new BMenuItem(mCachedControlMenu);
	if (!item) {
		delete mCachedControlMenu;
		mCachedControlMenu = NULL;
		return menu;
	}
	menu->AddSeparatorItem();
	menu->AddItem(item);
	return menu;
}
BPopUpMenu*
DefaultPartitionPage::_CreatePopUpMenu()
{
	int32 defaultPartitionIndex;
	fSettings->FindInt32("defaultPartition", &defaultPartitionIndex);

	BMenuItem* selectedItem = NULL;
	int32 selectedItemIndex = 0;

	BPopUpMenu* menu = new BPopUpMenu(B_TRANSLATE_COMMENT("Partitions",
		"Pop up menu title"));
	BMessage message;
	for (int32 i = 0; fSettings->FindMessage("partition", i, &message) == B_OK;
			i++) {
		bool show;
		if (message.FindBool("show", &show) != B_OK || !show)
			continue;

		BString name;
		message.FindString("name", &name);

		BMessage* msg = new BMessage(kMsgPartition);
		msg->AddInt32("index", i);
		BMenuItem* item = new BMenuItem(name.String(), msg);
		menu->AddItem(item);
		if (defaultPartitionIndex == i || selectedItem == NULL) {
			selectedItem = item;
			selectedItemIndex = i;
		}
	}
	fSettings->ReplaceInt32("defaultPartition", selectedItemIndex);
	selectedItem->SetMarked(true);
	return menu;
}