Exemplo n.º 1
0
void SeqPhraseMatrixView::ShowPopUp()
{
    BPoint	point;
    uint32	buttons;
    GetMouse(&point, &buttons, false);
    BPopUpMenu*		menu = new  BPopUpMenu( "", TRUE, TRUE, B_ITEMS_IN_COLUMN );
    BMenuItem*		item1 = new BMenuItem("Properties", new BMessage(PROPERTIES_MSG) );
//	BMenuItem*		item2 = new BMenuItem("Edit Name", new BMessage(EDIT_START_MSG) );
//	BMenuItem*		item3 = new BMenuItem("Remove", new BMessage(REMOVE_MSG) );
//	if (menu && item1 && item2 && item3) {
    if (menu && item1) {
        if (item1 && item1->Message() ) item1->Message()->AddPoint(WHERE_STR, point);
        menu->SetFontSize(10);
        menu->AddItem(item1);
//		menu->AddItem(item2);
//		menu->AddItem(item3);
        menu->SetTargetForItems(this);
        BRect	r(point, point);
        menu->Go( ConvertToScreen(point), true, false, ConvertToScreen(r), true );
    }
}
Exemplo n.º 2
0
void SeqMeasureControl::ShowTimeSignatureMenu(BPoint pt) const
{
	AmSignature		sig;
	if (SignatureForPt(pt, sig) != B_OK) return;
	BPopUpMenu*		menu = new BPopUpMenu("menu");
	if (!menu) return;
	menu->SetFontSize(10);
	menu->SetAsyncAutoDestruct(true);

	BMessage	signatureChoices;
	if (seq_get_message_preference(SIGNATURE_CHOICES_PREF, &signatureChoices) == B_OK) {
		int32	beats;
		for(int32 k = 0; signatureChoices.FindInt32("beats", k, &beats) == B_OK; k++) {
			int32	beatvalue;
			if (signatureChoices.FindInt32("beat value", k, &beatvalue) == B_OK) {
				BString		label;
				label << beats << " / " << beatvalue;
				BMessage*	msg = new BMessage(CHANGE_SIGNATURE_MSG);
				BMenuItem*	item;
				if (msg && (item = new BMenuItem(label.String(), msg)) ) {
					msg->AddInt32("measure", sig.Measure() );
					msg->AddInt32("beats", beats);
					msg->AddInt32("beat value", beatvalue);
					menu->AddItem(item);
					item->SetTarget(this);
				}
			}
		}
	}
	BMessage*		msg = new BMessage(CHANGE_SIGNATURE_MSG);
	BMenuItem*		item;
	if ( msg && (item = new BMenuItem("Other...", msg)) ) {
		msg->AddInt32("measure", sig.Measure() );
		msg->AddInt32("beats", sig.Beats() );
		msg->AddInt32("beat value", sig.BeatValue() );
		menu->AddItem(item);
		item->SetTarget( Window() );
	}
	/* If I'm a track measure control, add in my motion list.
	 */
	BMenu*		motionMenu = NULL;
	if (mTrackWinProps && (motionMenu = new BMenu("Motion")) ) {
		BMessage*		msg = new BMessage(CHANGE_MOTION_MSG);
		BMenuItem*		item;
		if (msg && (item = new BMenuItem(NONE_STR, msg)) ) {
			msg->AddInt32("code", MOTION_NONE);
			msg->AddInt32("measure", sig.Measure() );
			motionMenu->AddItem(item);
			item->SetTarget(this);
		}
		msg = new BMessage(CHANGE_MOTION_MSG);
		if (msg && (item = new BMenuItem(CLEAR_STR, msg)) ) {
			msg->AddInt32("code", MOTION_CLEAR);
			msg->AddInt32("measure", sig.Measure() );
			motionMenu->AddItem(item);
			item->SetTarget(this);
		}
		
		BString		label, key;
		for (uint32 k = 0; AmGlobals().GetMotionInfo(k, label, key) == B_OK; k++) {
			msg = new BMessage(CHANGE_MOTION_MSG);
			if (msg && (item = new BMenuItem(label.String(), msg)) ) {
				if (k == 0) motionMenu->AddSeparatorItem();
				msg->AddString(MOTION_KEY_STR, key);
				msg->AddInt32("measure", sig.Measure() );
				motionMenu->AddItem(item);
				item->SetTarget(this);
			}
		}
		if (motionMenu) {
			menu->AddSeparatorItem();
			BMenuItem*		i = new BMenuItem(motionMenu);
			if (i) menu->AddItem(i);
		}
	}
	
	BRect	frame(pt, pt);
	menu->Go( ConvertToScreen(pt), true, false, ConvertToScreen(frame), true);
}