Exemple #1
0
BPopUpMenu*
TPrefsWindow::_BuildEncodingMenu(uint32 encoding)
{
    BMenuItem* item;
    BMessage* msg;
    BPopUpMenu* menu;

    menu = new BPopUpMenu("");

    BCharacterSetRoster roster;
    BCharacterSet charset;
    while (roster.GetNextCharacterSet(&charset) == B_NO_ERROR) {
        BString name(charset.GetPrintName());
        const char* mime = charset.GetMIMEName();
        if (mime)
            name << " (" << mime << ")";
        msg = new BMessage(P_ENC);
        uint32 convert_id;
        if ((mime == 0) || (strcasecmp(mime, "UTF-8") != 0))
            convert_id = charset.GetConversionID();
        else
            convert_id = B_MAIL_UTF8_CONVERSION;
        msg->AddInt32("encoding", convert_id);
        menu->AddItem(item = new BMenuItem(name.String(), msg));
        if (convert_id == encoding)
            item->SetMarked(true);
    }

    msg = new BMessage(P_ENC);
    msg->AddInt32("encoding", B_MAIL_US_ASCII_CONVERSION);
    menu->AddItem(item = new BMenuItem("US-ASCII", msg));
    if (encoding == B_MAIL_US_ASCII_CONVERSION)
        item->SetMarked(true);

    return menu;
}
Exemple #2
0
BPopUpMenu*
TPrefsWindow::_BuildAttachAttributesMenu(bool attachAttributes)
{
    BMenuItem* item;
    BMessage* msg;
    BPopUpMenu* menu;

    menu = new BPopUpMenu("");
    msg = new BMessage(P_ATTACH_ATTRIBUTES);
    msg->AddBool("attachAttributes", true);
    menu->AddItem(item = new BMenuItem(
        B_TRANSLATE("Include file attributes in attachments"), msg));
    if (attachAttributes)
        item->SetMarked(true);

    msg = new BMessage(P_ATTACH_ATTRIBUTES);
    msg->AddInt32("attachAttributes", false);
    menu->AddItem(item = new BMenuItem(
        B_TRANSLATE("No file attributes, just plain data"), msg));
    if (!attachAttributes)
        item->SetMarked(true);

    return menu;
}
Exemple #3
0
void
BNavMenu::DoneBuildingItemList()
{
	// add sorted items to menu
	if (TrackerSettings().SortFolderNamesFirst())
		fItemList->SortItems(CompareFolderNamesFirstOne);
	else
		fItemList->SortItems(CompareOne);
		
	// if the parent link should be shown, it will be the first
	// entry in the menu - but don't add the item if we're already
	// at the file system's root
	if (fFlags & kShowParent) {
		BDirectory directory(&fNavDir);
		BEntry entry(&fNavDir);
		if (!directory.IsRootDirectory()
			&& entry.GetParent(&entry) == B_OK) {
			Model model(&entry, true);
			BLooper *looper;
			AddNavParentDir(&model,fMessage.what,fMessenger.Target(&looper));
		}
	}

	int32 count = fItemList->CountItems();
	for (int32 index = 0; index < count; index++) 
		AddItem(fItemList->ItemAt(index));
	fItemList->MakeEmpty();

	if (!count) {
		BMenuItem *item = new BMenuItem("Empty Folder", 0);
		item->SetEnabled(false);
		AddItem(item);
	}

	SetTargetForItems(fMessenger);
}
Exemple #4
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);
}
Exemple #5
0
void
TDeskbarMenu::ResetTargets()
{
	// This method does not recurse into submenus
	// and does not affect menu items in submenus.
	// (e.g. "Restart System" and "Power Off")

	BNavMenu::ResetTargets();

	// if we are dragging, set the target to whatever was set
	// else set it to the default (Tracker)
	if (!fBarView->Dragging())
		SetTarget(DefaultTarget());

	// now set the target for the menuitems to the currently
	// set target, which may or may not be tracker
	SetTargetForItems(Target());

	for (int32 i = 0; ; i++) {
		BMenuItem* item = ItemAt(i);
		if (item == NULL)
			break;

		if (item->Message()) {
			switch (item->Message()->what) {
				case kFindButton:
					item->SetTarget(BMessenger(kTrackerSignature));
					break;

				case kShowSplash:
				case kToggleDraggers:
				case kConfigShow:
				case kAlwaysTop:
				case kExpandNewTeams:
				case kHideLabels:
				case kResizeTeamIcons:
				case kSortRunningApps:
				case kTrackerFirst:
				case kRebootSystem:
				case kSuspendSystem:
				case kShutdownSystem:
					item->SetTarget(be_app);
					break;

				case kShowHideTime:
				case kShowSeconds:
				case kShowDayOfWeek:
					item->SetTarget(fBarView->fReplicantTray);
					break;
			}
		}
	}
}
Exemple #6
0
void SerialWindow::MenusBeginning()
{
	// remove all items from the menu
	fConnectionMenu->RemoveItems(0, fConnectionMenu->CountItems(), true);

	// fill it with the (updated) serial port list
	BSerialPort serialPort;
	int deviceCount = serialPort.CountDevices();
	bool connected = false;

	for (int i = 0; i < deviceCount; i++)
	{
		char buffer[256];
		serialPort.GetDeviceName(i, buffer, 256);

		BMessage* message = new BMessage(kMsgOpenPort);
		message->AddString("port name", buffer);
		BMenuItem* portItem = new BMenuItem(buffer, message);
		portItem->SetTarget(be_app);

		const BString& connectedPort = ((SerialApp*)be_app)->GetPort();

		if (connectedPort == buffer) {
			connected = true;
			portItem->SetMarked(true);
		}

		fConnectionMenu->AddItem(portItem);
	}

	if (deviceCount > 0) {
		fConnectionMenu->AddSeparatorItem();

		BMenuItem* disconnect = new BMenuItem("Disconnect",
			new BMessage(kMsgOpenPort), 'Z', B_OPTION_KEY);
		if (!connected)
			disconnect->SetEnabled(false);
		fConnectionMenu->AddItem(disconnect);
	} else {
		BMenuItem* noDevices = new BMenuItem("<no serial port available>", NULL);
		noDevices->SetEnabled(false);
		fConnectionMenu->AddItem(noDevices);
	}
}
Exemple #7
0
void TeamListView::ItemsToPopUpPriorityMenu()
{
	BMenuField *Priority = (BMenuField *)slayer->mainWindow->FindView("MainPriorityField");
	BMenu *menu = Priority->Menu();
	BMenuItem *add;
	int32 i;
	for (i = 2; (add = menu->ItemAt(i)); i++) {
		BMenuItem *newItem;
		if (add->Label() && add->Label()[0])
			newItem = new BMenuItem(add->Label(), new BMessage(
				add->Command()));
		else
			newItem = new BSeparatorItem();
			
		newItem->SetTarget(slayer->mainWindow);
		priorityMenu->AddItem(newItem);
	}
		// priorityMenu->AddItem(add);
}
void
ControlView::_UpdateAndSendFamily(const BMessage* message)
{
    _DeselectOldItems();

    font_family family;
    font_style style;

    if (message->FindString("_family", (const char **)&family) == B_OK) {
        char* name;
        type_code typeFound = 0;
        int32 countFound = 0;
        if (message->GetInfo(B_ANY_TYPE, 0, &name, &typeFound,
                             &countFound) == B_OK) {
            if (typeFound == B_STRING_TYPE) {
                BString string;
                if (message->FindString(name, 0, &string) == B_OK)
                    printf("Family: %s\n", string.String());
            }
        }

        BMenuItem* markedItem = fFontFamilyMenu->FindItem(family);
        if (!markedItem)
            return;

        markedItem->SetMarked(true);

        get_font_style(family, 0, &style);

        BString string;
        string << family << " " << style;

        if (fFontMenuField)
            fFontMenuField->MenuItem()->SetLabel(string.String());

        BMenu* submenu = markedItem->Submenu();

        if (submenu) {
            BMenuItem* styleItem = submenu->FindItem(style);
            if (styleItem && !styleItem->IsMarked())
                styleItem->SetMarked(true);
        }

        BMessage fontMsg(FONTFAMILY_CHANGED_MSG);
        if (fontMsg.AddMessage("_fontMessage", message) == B_OK)
            fMessenger->SendMessage(&fontMsg);
    }
}
Exemple #9
0
void SeqToolBarView::ShowPropertyMenu(const AmTool* tool, BPoint where)
{
	BPopUpMenu*			menu = new BPopUpMenu("properties menu");
	if (!menu) return;
	BMessage*			msg = new BMessage(PROPERTIES_MSG);
	if (msg) {
		msg->AddString("tool_key", tool->Key() );
		BMenuItem*		item = new BMenuItem("Properties", msg);
		if (item) {
			item->SetTarget(this);
			menu->AddItem(item);
		}
	}
	msg = new BMessage(EDIT_MSG);
	if (msg) {
		msg->AddString("tool_key", tool->Key() );
		msg->AddString("path", tool->LocalFilePath() );
		BMenuItem*		item = new BMenuItem("Edit", msg);
		if (item) {
			item->SetTarget(this);
			if (tool->IsReadOnly() ) item->SetEnabled(false);
			menu->AddItem(item);
		}
	}

	menu->AddSeparatorItem();

	msg = new BMessage(REMOVE_FROM_TOOL_BAR_MSG);
	if (msg) {
		msg->AddString("tool_key", tool->Key() );
		msg->AddPointer("tool_id", tool->Id() );
		BMenuItem*		item = new BMenuItem("Remove From Tool Bar", msg);
		if (item) {
			item->SetTarget(this);
			menu->AddItem(item);
		}
	}

	menu->SetAsyncAutoDestruct(true);
	where = ConvertToScreen(where);
	BRect	sticky(where.x-5, where.y-5, where.x+5, where.y+5);
	menu->Go(where, true, false, sticky, true);
}
void
AddPrinterDialog::_HandleChangedTransport(BMessage *msg)
{
	BString name;
	if (msg->FindString("name", &name) != B_OK) {
		name = "";
	}
	fTransportText = name;

	BString path;
	if (msg->FindString("path", &path) == B_OK) {
		// transport path selected
		fTransportPathText = path;

		// mark sub menu
		void* pointer;
		if (msg->FindPointer("source", &pointer) == B_OK) {
			BMenuItem* item = (BMenuItem*)pointer;

			// Update printer name with Transport Path if not filled in
			if (strlen(fName->Text()) == 0)
				fName->SetText(item->Label());

			BMenu* menu = item->Menu();
			int32 index = fTransport->IndexOf(menu);
			item = fTransport->ItemAt(index);
			if (item != NULL)
				item->SetMarked(true);
		}
	} else {
		// transport selected
		fTransportPathText = "";

		// remove mark from item in sub menu of transport sub menu
		for (int32 i = fTransport->CountItems() - 1; i >= 0; i --) {
			BMenu* menu = fTransport->SubmenuAt(i);
			if (menu != NULL) {
				BMenuItem* item = menu->FindMarked();
				if (item != NULL)
					item->SetMarked(false);
			}
		}
	}
	_Update();
}
Exemple #11
0
TeamListView::TeamListView(BRect frame, const char *name, CLVContainerView **s)
	: ColumnListView(frame, s, name, B_FOLLOW_ALL_SIDES, B_WILL_DRAW|B_NAVIGABLE|B_FRAME_EVENTS,
	B_MULTIPLE_SELECTION_LIST, true, true, true, false, B_FANCY_BORDER)
{
	// add Columns...
	AddColumn(new CLVColumn(NULL, 20.0, CLV_EXPANDER|CLV_LOCK_AT_BEGINNING|CLV_NOT_MOVABLE));
	AddColumn(new CLVColumn(NULL, 20.0, CLV_LOCK_AT_BEGINNING|CLV_NOT_RESIZABLE|
		CLV_NOT_MOVABLE|CLV_MERGE_WITH_RIGHT));
	AddColumn(new CLVColumn("Name", 100.0, CLV_LOCK_AT_BEGINNING|CLV_NOT_MOVABLE));
	AddColumn(new CLVColumn("Id", 40.0));
	AddColumn(new CLVColumn("Priority", 50.0));
	AddColumn(new CLVColumn("State", 60.0));
	AddColumn(new CLVColumn("Memory", 60.0));
	AddColumn(new CLVColumn("CPU", 60.0));
	
	SetInvocationMessage(new BMessage(TEAM_INV));
	
	// create the PopUpMenu
	BMenuItem *inv;
	
	operationMenu = new BPopUpMenu("operationMenu", false, false);
	operationMenu->AddItem((inv = new BMenuItem("Kill",
		new BMessage(IE_MAINWINDOW_MAINKILL))));
		inv->SetTarget(slayer->mainWindow);
	operationMenu->AddItem((inv = new BMenuItem("Suspend",
		new BMessage(IE_MAINWINDOW_MAINSUSPEND))));
		inv->SetTarget(slayer->mainWindow);
	operationMenu->AddItem((inv = new BMenuItem("Resume",
		new BMessage(IE_MAINWINDOW_MAINRESUME))));
		inv->SetTarget(slayer->mainWindow);
	operationMenu->AddSeparatorItem();
	priorityMenu = new BMenu("PriorityMenu");
	BMenuItem *pr = new BMenuItem(priorityMenu); //, new BMessage('tmpj'));
	pr->SetLabel("Set priority");
	operationMenu->AddItem(pr);
	ItemsToPopUpPriorityMenu();

//	MakeFocus(true);
//	 = new BMenu("Set priority");
//	operationMenu->AddItem(setPriorityMenu);

//	operationMenu->AddSeparator
}
Exemple #12
0
void
JobSetupView::FillCapabilityMenu(BPopUpMenu* menu, uint32 message,
	const BaseCap** capabilities, int count, Predicate& predicate)
{
	bool marked = false;

	BMenuItem* firstItem = NULL;
	BMenuItem* defaultItem = NULL;
	BMenuItem* item = NULL;
	while (count--) {
		const EnumCap* capability = dynamic_cast<const EnumCap*>(*capabilities);
		if (message != kMsgNone)
			item = new BMenuItem(capability->fLabel.c_str(),
				new BMessage(message));
		else
			item = new BMenuItem(capability->fLabel.c_str(), NULL);

		menu->AddItem(item);

		if (firstItem == NULL)
			firstItem = item;

		if (capability->fIsDefault)
			defaultItem = item;


		if (predicate(capability)) {
			item->SetMarked(true);
			marked = true;
		}

		capabilities++;
	}

	if (marked)
		return;

	if (defaultItem != NULL)
		defaultItem->SetMarked(true);
	else if (firstItem != NULL)
		firstItem->SetMarked(true);
}
Exemple #13
0
/*!	Marks the menu items corresponding to the dead key state of the current
	key map.
*/
void
KeymapWindow::_UpdateDeadKeyMenu()
{
	BString trigger;
	fCurrentMap.GetDeadKeyTrigger(kDeadKeyAcute, trigger);
	if (!trigger.Length())
		trigger = kDeadKeyTriggerNone;
	BMenuItem* menuItem = fAcuteMenu->FindItem(trigger.String());
	if (menuItem)
		menuItem->SetMarked(true);

	fCurrentMap.GetDeadKeyTrigger(kDeadKeyCircumflex, trigger);
	if (!trigger.Length())
		trigger = kDeadKeyTriggerNone;
	menuItem = fCircumflexMenu->FindItem(trigger.String());
	if (menuItem)
		menuItem->SetMarked(true);

	fCurrentMap.GetDeadKeyTrigger(kDeadKeyDiaeresis, trigger);
	if (!trigger.Length())
		trigger = kDeadKeyTriggerNone;
	menuItem = fDiaeresisMenu->FindItem(trigger.String());
	if (menuItem)
		menuItem->SetMarked(true);

	fCurrentMap.GetDeadKeyTrigger(kDeadKeyGrave, trigger);
	if (!trigger.Length())
		trigger = kDeadKeyTriggerNone;
	menuItem = fGraveMenu->FindItem(trigger.String());
	if (menuItem)
		menuItem->SetMarked(true);

	fCurrentMap.GetDeadKeyTrigger(kDeadKeyTilde, trigger);
	if (!trigger.Length())
		trigger = kDeadKeyTriggerNone;
	menuItem = fTildeMenu->FindItem(trigger.String());
	if (menuItem)
		menuItem->SetMarked(true);
}
Exemple #14
0
void MainView::showPopUp(const BPoint& win_point)
{
	BMenuItem *item;
	BPoint point = ConvertFromScreen(win_point);
	if(menu != NULL) {
		delete menu;
	}
	menu = new BPopUpMenu("menu", false);

	BMessage *msg = new BMessage(MSG_ADD_GUIDE);
	msg->AddBool("orientation", true);
	msg->AddInt32("point", point.y);	
	item = new BMenuItem("Add Horizontal Guide", msg);
	item->SetTarget(this);
	menu->AddItem(item);
	
	msg = new BMessage(MSG_ADD_GUIDE);
	msg->AddBool("orientation", false);
	msg->AddInt32("point", point.x);
	item = new BMenuItem("Add Vertical Guide", msg);
	item->SetTarget(this);
	menu->AddItem(item);
	
	msg = new BMessage(MSG_MAIN_VIEW_SHOW_GUIDES);
	item = new BMenuItem("Show Guides", msg);
	item->SetTarget(this);
	menu->AddItem(item);
	
	msg = new BMessage(MSG_MAIN_VIEW_HIDE_GUIDES);
	item = new BMenuItem("Hide Guides", msg);
	item->SetTarget(this);
	menu->AddItem(item);
	
	item = new BMenuItem("Edit Guides", new BMessage(MSG_SHOW_GUIDES));
	item->SetTarget(Window());
	menu->AddItem(item);
	
	menu->Go(win_point, true);
}
Exemple #15
0
void CInfoDialog::UpdateFields()
{
	BMessage *msg = Looper()->CurrentMessage();

	const char *ff, *fs;
	if (msg->FindString("family", &ff) == B_NO_ERROR &&
		msg->FindString("style", &fs) == B_NO_ERROR)
	{
		BMenuItem *item;

		item = fMenu->FindMarked();
		if (item)
		{
			item = item->Submenu()->FindMarked();
			if (item) item->SetMarked(false);
			fMenu->FindMarked()->SetMarked(false);
		}

		item = fMenu->FindItem(ff);
		if (item)
		{
			item->SetMarked(true);
			item = item->Submenu()->FindItem(fs);
			if (item) item->SetMarked(true);
		}
	}

	if (strcmp(fTypes->FindMarked()->Label(), "undefined") == 0)
	{
		MWarningAlert a("Please choose a real mime type");
		a.Go();
	}

	SetEnabled("wrapfixedto", IsOn("wrapfixed"));

	SetEnabled("ok", true);
	SetEnabled("cancel", true);
} /* CInfoDialog::UpdateFields */
Exemple #16
0
void TCueSheetWindow::AdjustEditMenu()
{

	BMenu* theMenu = fAppMenu->GetEditMenu();
	if (theMenu) {
		//      Undo Item
		BMenuItem* undoItem = theMenu->FindItem(EDIT_UNDO_MSG);
		if (undoItem) {
			if (fUndoEngine->CanUndo())
				undoItem->SetEnabled(true);
			else
				undoItem->SetEnabled(false);
		}

		// Cut
		// Enable if any items are selected
		BMenuItem* cutItem = theMenu->FindItem(EDIT_CUT_MSG);
		if (cutItem)
			cutItem->SetEnabled( fCueSheetView->ItemsSelected() );

		// Copy
		// Enable if any items are selected
		BMenuItem* copyItem = theMenu->FindItem(EDIT_COPY_MSG);
		if (copyItem)
			copyItem->SetEnabled( fCueSheetView->ItemsSelected() );

		// Paste
		// Enable if there is anything on the clipboard
		BMenuItem* pasteItem = theMenu->FindItem(EDIT_PASTE_MSG);
		if (pasteItem)
			pasteItem->SetEnabled( static_cast<MuseumApp*>(be_app)->fClipboard->HasData() );

		// Clear
		BMenuItem* clearItem = theMenu->FindItem(EDIT_CLEAR_MSG);
		if (clearItem)
			clearItem->SetEnabled( fCueSheetView->ItemsSelected() );

		// Select All
		// Enable if there is anything to be selected
		BMenuItem* selectAllItem = theMenu->FindItem(EDIT_SELECTALL_MSG);
		if (selectAllItem) {
			// Enable this item if there are any cues to be selected
			selectAllItem->SetEnabled( fCueSheetView->HasCues() );
		}
	}
}
Exemple #17
0
void TCueSheetWindow::Save(BMessage* message)
{
	status_t myErr;
	entry_ref theRef;
	char* theString = NULL;

	// Get directory to save data to
	message->FindRef("directory", &theRef);

	// Get name of file to be saved as
	message->FindString("name", (const char**)&theString);

	// Set window title to new filename
	SetTitle(theString);

	// Create a BDirectory object
	BDirectory saveDir(&theRef);

	// Now create the file.  Create new file if fFile is unitialized.
	if (fFile)
		delete fFile;

	fFile = new BFile();

	myErr = saveDir.CreateFile(theString, fFile, false);

	if (myErr != B_OK)
		return;

	//	Write out file header
	//WriteHeader(fFile);

	BMessage archive;

	//	Archive CueSheetWindow and write to file
	BMessage cueSheetArchive;
	Archive(&cueSheetArchive, true);

	//	Flatten and write out to file
	ssize_t numBytes;
	cueSheetArchive.Flatten(fFile, &numBytes);

	// Set file type
	BNodeInfo info(fFile);
	if ( info.InitCheck() )
		return;

	myErr = info.SetType("application/x-mediapede-cuesheet");

	// Set icons
	BBitmap* smallIcon = GetMICNFromResource("application/x-mediapede-cuesheet");
	info.SetIcon( smallIcon, B_MINI_ICON);

	BBitmap* largeIcon = GetICONFromResource("application/x-mediapede-cuesheet");
	info.SetIcon( largeIcon, B_LARGE_ICON);

	delete smallIcon;
	delete largeIcon;

	// Update our entry in the Windows menu to reflect possible new filename
	BMenuItem* theItem = fAppMenu->GetWindowsMenu()->FindItem( Title());
	if (theItem)
		theItem->SetLabel(theString);

	// We aren't dirty now
	fCueSheetView->SetDirty(false);
}
Exemple #18
0
void TCueSheetWindow::AdjustWindowsMenu()
{

	//	Set up string buffers
	bool retVal;
	char* menuStr   = (char*)malloc( sizeof(char) * 256);

	// Get application
	MuseumApp* theApp = static_cast<MuseumApp*>(be_app);

	BMenu* theMenu = fAppMenu->GetWindowsMenu();
	if (theMenu) {
		//      Stage Item
		BMenuItem* stageItem = theMenu->FindItem(WINDOWS_STAGE_MSG);
		if (stageItem) {
			TStageWindow* stage = fStageWindow;
			if (stage) {
				stage->Lock();
				if (stage->IsHidden())
					retVal = GetString("WindowsMenuStrings", kWindowsShowStageItem, menuStr);
				else
					retVal = GetString("WindowsMenuStrings", kWindowsHideStageItem, menuStr);
				stage->Unlock();

				stageItem->SetLabel(menuStr);
			} else {
				retVal = GetString("WindowsMenuStrings", kWindowsShowStageItem, menuStr);
				stageItem->SetLabel(menuStr);
			}
		}

		// Browser Item
		BMenuItem* browserItem = theMenu->FindItem(WINDOWS_BROWSER_MSG);
		if (stageItem) {
			TBrowserWindow* browser = theApp->GetBrowser();
			if (browser) {
				browser->Lock();
				if (browser->IsHidden())
					retVal = GetString("WindowsMenuStrings", kWindowsShowBrowserItem, menuStr);
				else
					retVal = GetString("WindowsMenuStrings", kWindowsHideBrowserItem, menuStr);
				browser->Unlock();

				browserItem->SetLabel(menuStr);
			} else {
				retVal = GetString("WindowsMenuStrings", kWindowsShowBrowserItem, menuStr);
				browserItem->SetLabel(menuStr);
			}
		}

		//      Transport Item
		BMenuItem* transportItem = theMenu->FindItem(WINDOWS_TRANSPORT_MSG);
		if (transportItem) {
			TTransportPalette* transport = theApp->GetTransport();
			if (transport) {
				transport->Lock();
				if (transport->IsHidden())
					retVal = GetString("WindowsMenuStrings", kWindowsShowTransportItem, menuStr);
				else
					retVal = GetString("WindowsMenuStrings", kWindowsHideTransportItem, menuStr);
				transport->Unlock();

				transportItem->SetLabel(menuStr);
			} else {
				retVal = GetString("WindowsMenuStrings", kWindowsShowTransportItem, menuStr);
				transportItem->SetLabel(menuStr);
			}
		}

		//      Locator Item
		BMenuItem* counterItem = theMenu->FindItem(WINDOWS_COUNTER_MSG);
		if (counterItem) {
			TTimePalette* time = theApp->GetTimePalette();
			if (time) {
				time->Lock();
				if (time->IsHidden())
					retVal = GetString("WindowsMenuStrings", kWindowsShowLocatorItem, menuStr);
				else
					retVal = GetString("WindowsMenuStrings", kWindowsHideLocatorItem, menuStr);
				time->Unlock();

				counterItem->SetLabel(menuStr);
			} else {
				retVal = GetString("WindowsMenuStrings", kWindowsShowLocatorItem, menuStr);
				counterItem->SetLabel(menuStr);
			}
		}

		//      Media Cue Item
		BMenuItem* mediaItem = theMenu->FindItem(WINDOWS_MEDIA_MSG);
		if (mediaItem) {
			TMediaCuePalette* mediaPalette = theApp->GetMediaPalette();
			if (mediaPalette) {
				mediaPalette->Lock();
				if (mediaPalette->IsHidden())
					retVal = GetString("WindowsMenuStrings", kWindowsShowMediaItem, menuStr);
				else
					retVal = GetString("WindowsMenuStrings", kWindowsHideMediaItem, menuStr);
				mediaPalette->Unlock();

				mediaItem->SetLabel(menuStr);
			} else {
				retVal = GetString("WindowsMenuStrings", kWindowsShowMediaItem, menuStr);
				mediaItem->SetLabel(menuStr);
			}
		}
	}
}
Exemple #19
0
void TCueSheetWindow::AdjustCueMenu()
{
	BMenu* theMenu = fAppMenu->GetCueMenu();
	if (theMenu) {
		//	Get Cue Info
		// Enable if any items are selected
		BMenuItem* cueInfoItem = theMenu->FindItem(CUESHEET_GETINFO_MSG);
		if (cueInfoItem)
			cueInfoItem->SetEnabled( fCueSheetView->ItemsSelected() );

		//	Default Cue Setup
		// Enable if any items are selected
		//BMenuItem *cueInfoItem = theMenu->FindItem(CUESHEET_GETINFO_MSG);
		//if (cueInfoItem)
		//	cueInfoItem->SetEnabled( fCueSheetView->ItemsSelected() );

		//	Show Cue Contents
		// Enable if any items are selected
		BMenuItem* showContentsItem = theMenu->FindItem(CUESHEET_SHOWCONTENTS_MSG);
		if (showContentsItem)
			showContentsItem->SetEnabled( fCueSheetView->ItemsSelected() );

		//	Show All Cue Contents
		// Enable if we have cues
		BMenuItem* showAllContentsItem = theMenu->FindItem(CUESHEET_SHOWALLCONTENTS_MSG);
		if (showAllContentsItem)
			showAllContentsItem->SetEnabled( fCueSheetView->HasCues() );

		//	Hide All Cue Contents
		// Enable if we have cues
		BMenuItem* hideAllContentsItem = theMenu->FindItem(CUESHEET_HIDEALLCONTENTS_MSG);
		if (hideAllContentsItem)
			hideAllContentsItem->SetEnabled( fCueSheetView->HasCues() );

		//	Cue Setup
		// Enable if any items are selected
		BMenuItem* setupItem = theMenu->FindItem(CUESHEET_SETUP_MSG);
		if (setupItem)
			setupItem->SetEnabled( fCueSheetView->ItemsSelected() );

		//	Open Cue Editor
		// Enable if any items are selected
		BMenuItem* editItem = theMenu->FindItem(CUESHEET_EDIT_MSG);
		if (editItem)
			editItem->SetEnabled( fCueSheetView->ItemsSelected() );

		//	Add Keyframes
		// Enable if any items are selected
		BMenuItem* keyframeItem = theMenu->FindItem(CUESHEET_KEYFRAME_MSG);
		if (keyframeItem)
			keyframeItem->SetEnabled( fCueSheetView->ItemsSelected() );
	}
}
Exemple #20
0
CInfoDialog::CInfoDialog(BRect frame, const char *name, window_type type, int flags,
			BWindow *owner, BPositionIO* data)
	: HDialog(frame, name, type, flags, owner, data)
{
	fDoc = dynamic_cast<PDoc*>(owner);
	FailNil(fDoc);

	SetText("name", owner->Title());

	char s[32];
	sprintf(s, "%d", fDoc->TextView()->Size());
	SetText("docsize", s);

	sprintf(s, "%d", fDoc->TextView()->LineCount());
	SetText("lines", s);

	BMenuField *mf = dynamic_cast<BMenuField*>(FindView("mime"));
	FailNil(mf);
	fTypes = mf->Menu();

	const char *p;
	int i = 0;
	while ((p = gPrefs->GetIxPrefString(prf_X_Mimetype, i++)) != NULL)
		fTypes->AddItem(new BMenuItem(p, new BMessage(msg_FieldChanged)));

	if (i == 1)
		fTypes->AddItem(new BMenuItem("text/plain", new BMessage(msg_FieldChanged)));

	const char *mime = fDoc->MimeType();

	if (mime && mime[0])
	{
		for (i = 0; i < fTypes->CountItems(); i++)
		{
			BMenuItem *item = fTypes->ItemAt(i);
			if (strcmp(item->Label(), mime) == 0)
			{
				item->SetMarked(true);
				break;
			}
		}

		if (i == fTypes->CountItems())
		{
			fTypes->AddSeparatorItem();
			fTypes->AddItem(new BMenuItem(mime, new BMessage(msg_FieldChanged)));
			fTypes->ItemAt(fTypes->CountItems() - 1)->SetMarked(true);
		}
	}
	else
	{
		BMenuItem *item;
		fTypes->AddSeparatorItem();
		fTypes->AddItem(item = new BMenuItem("<undefined>", new BMessage(msg_FieldChanged)));
		item->SetMarked(true);
	}

	if (fDoc->EntryRef())
	{
		BNode node;
		FailOSErr(node.SetTo(fDoc->EntryRef()));

		time_t t;
		node.GetModificationTime(&t);

		char time[256];
		strcpy(time, ctime(&t));
		time[strlen(time) - 1] = 0;

		SetText("time", time);
	}
	else
	{
		//SetEnabled("mime", false);
		SetText("time", "Not Saved");
	}

	mf = dynamic_cast<BMenuField*>(FindView("font"));
	FailNil(mf);

	fMenu = mf->Menu();
	FailNil(fMenu);

	font_family ff;
	font_style fs;

	for (int i = 0; i < count_font_families(); i++)
	{
		get_font_family(i, &ff);
		BMenu *fontItem = new BMenu(ff);
		FailNil(fontItem);
		fMenu->AddItem(new BMenuItem(fontItem, new BMessage(msg_FieldChanged)));
		fontItem->SetFont(be_plain_font);

		for (int j = 0; j < count_font_styles(ff); j++)
		{
			get_font_style(ff, j, &fs);

			BMessage *msg = new BMessage(msg_FieldChanged);
			msg->AddString("family", ff);
			msg->AddString("style", fs);
			fontItem->AddItem(new BMenuItem(fs, msg));
		}
	}

	fMenu->SetRadioMode(true);

	mf = dynamic_cast<BMenuField*>(FindView("encoding"));
	FailNil(mf);
	fEncoding = mf->Menu();
	FailNil(fEncoding);
	fEncoding->SetRadioMode(true);

	mf = dynamic_cast<BMenuField*>(FindView("source encoding"));
	FailNil(mf);
	fSourceEncoding = mf->Menu();
	FailNil(fSourceEncoding);
	fSourceEncoding->SetRadioMode(true);

	mf = dynamic_cast<BMenuField*>(FindView("linebreaks"));
	FailNil(mf);
	fLineBreaks = mf->Menu();
	FailNil(fLineBreaks);
	fLineBreaks->SetRadioMode(true);

	BTextControl *tc = dynamic_cast<BTextControl*>(FindView("tabs"));
	if (tc) tc->SetDivider(be_plain_font->StringWidth(tc->Label()) + 4);

	BMenu *lang;
	mf = dynamic_cast<BMenuField*>(FindView("language"));
	FailNil(mf);
	lang = mf->Menu();

	CLanguageInterface *intf;
	int cookie = 0;
	while ((intf = CLanguageInterface::NextIntf(cookie)) != NULL)
		lang->AddItem(new BMenuItem(intf->Name(), new BMessage(msg_FieldChanged)));

	lang->SetRadioMode(true);
	int curLang = fDoc->TextView()->Language();
	SetValue("language", curLang >= 0 ? curLang + 3 : 1);

	CancelClicked();
} /* CInfoDialog::CInfoDialog */
Exemple #21
0
void
WorkspacesView::MouseDown(BPoint where)
{
	// With enabled auto-raise feature, we'll get mouse messages we don't
	// want to handle here.
	if (!Bounds().Contains(where))
		return;

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

	if ((buttons & B_SECONDARY_MOUSE_BUTTON) == 0)
		return;

	// open context menu

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

	// TODO: alternatively change the count here directly?
	BMenuItem* changeItem = new BMenuItem("Change workspace count"
		B_UTF8_ELLIPSIS, new BMessage(kMsgChangeCount));
	menu->AddItem(changeItem);

	WorkspacesWindow* window = dynamic_cast<WorkspacesWindow*>(Window());
	if (window != NULL) {
		BMenuItem* item;

		menu->AddSeparatorItem();
		menu->AddItem(item = new BMenuItem("Show window title",
			new BMessage(kMsgToggleTitle)));
		if (window->Look() == B_TITLED_WINDOW_LOOK)
			item->SetMarked(true);
		menu->AddItem(item = new BMenuItem("Show window border",
			new BMessage(kMsgToggleBorder)));
		if (window->Look() == B_TITLED_WINDOW_LOOK
			|| window->Look() == B_MODAL_WINDOW_LOOK)
			item->SetMarked(true);

		menu->AddSeparatorItem();
		menu->AddItem(item = new BMenuItem("Always on top",
			new BMessage(kMsgToggleAlwaysOnTop)));
		if (window->Feel() == B_FLOATING_ALL_WINDOW_FEEL)
			item->SetMarked(true);
		menu->AddItem(item = new BMenuItem("Auto-raise",
			new BMessage(kMsgToggleAutoRaise)));
		if (window->IsAutoRaising())
			item->SetMarked(true);

		menu->AddSeparatorItem();
		menu->AddItem(new BMenuItem("About Workspaces" B_UTF8_ELLIPSIS,
			new BMessage(B_ABOUT_REQUESTED)));
		menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED)));
		menu->SetTargetForItems(window);
	}

	changeItem->SetTarget(this);
	ConvertToScreen(&where);
	menu->Go(where, true, true, true);
}
Exemple #22
0
MainWindow::MainWindow(BRect frame)
	:	BWindow(frame,B_TRANSLATE_SYSTEM_NAME("BeMines"),B_TITLED_WINDOW, B_NOT_RESIZABLE),
		fSmileyState(FACE_NORMAL)
{
	LoadSettings();

	BView *top = new BView(Bounds(),"back",B_FOLLOW_ALL,B_WILL_DRAW);
	top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	AddChild(top);

	BRect r(Bounds());
	r.bottom = 20;
	fMenuBar = new BMenuBar(r, "menubar");

	BMenu *menu = new BMenu(B_TRANSLATE("Game"));
	menu->AddItem(new BMenuItem(B_TRANSLATE("New"),new BMessage(M_NEW_GAME),'N'));

	BMenu *submenu = NULL;

	menu->AddItem(new BMenuItem(B_TRANSLATE("Pause"),new BMessage(M_PAUSE_GAME),'P',
								B_COMMAND_KEY));

	menu->AddSeparatorItem();

	menu->AddItem(new BMenuItem(B_TRANSLATE("High scores"),new BMessage(M_SHOW_SCORES)));

	menu->AddSeparatorItem();

	menu->AddItem(new BMenuItem(B_TRANSLATE("Help"),new BMessage(M_SHOW_HELP)));
	menu->AddItem(new BMenuItem(B_TRANSLATE("About BeMines"),new BMessage(B_ABOUT_REQUESTED)));

	menu->AddSeparatorItem();

	menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"), new BMessage(B_QUIT_REQUESTED), 'Q'));

	fMenuBar->AddItem(menu);

	menu = new BMenu(B_TRANSLATE("Settings"));

	submenu = new BMenu(B_TRANSLATE("Difficulty"));

	BMessage *menumsg = new BMessage(M_SET_DIFFICULTY);
	menumsg->AddInt32("level",DIFFICULTY_BEGINNER);
	submenu->AddItem(new BMenuItem(B_TRANSLATE("Beginner"),menumsg));

	menumsg = new BMessage(M_SET_DIFFICULTY);
	menumsg->AddInt32("level",DIFFICULTY_INTERMEDIATE);
	submenu->AddItem(new BMenuItem(B_TRANSLATE("Intermediate"),menumsg));

	menumsg = new BMessage(M_SET_DIFFICULTY);
	menumsg->AddInt32("level",DIFFICULTY_EXPERT);
	submenu->AddItem(new BMenuItem(B_TRANSLATE("Expert"),menumsg));

	menumsg = new BMessage(M_SHOW_CUSTOM);
	submenu->AddItem(new BMenuItem(B_TRANSLATE("Custom" B_UTF8_ELLIPSIS),menumsg));
	menu->AddItem(submenu);

	BMenuItem *item = submenu->ItemAt(gDifficulty);
	if (item)
		item->SetMarked(true);

	submenu = new BMenu(B_TRANSLATE("Theme"));
	for (int32 i = 0; i < gGameStyle->CountStyles(); i++)
	{
		menumsg = new BMessage(M_SET_THEME);
		menumsg->AddString("name",gGameStyle->StyleAt(i));
		submenu->AddItem(new BMenuItem(TranslateWellKnownThemes(gGameStyle->StyleAt(i)),menumsg));
	}
	menu->AddItem(submenu);
	submenu->SetRadioMode(true);
	item = submenu->FindItem(TranslateWellKnownThemes(gGameStyle->StyleName()));
	if (item)
		item->SetMarked(true);

	menu->AddSeparatorItem();

	item = new BMenuItem(B_TRANSLATE("Sound effects"),new BMessage(M_TOGGLE_SOUNDS));
	menu->AddItem(item);
	item->SetMarked(gPlaySounds);

	fMenuBar->AddItem(menu);

	top->AddChild(fMenuBar);

	fCounterView = new CounterView();
	fCounterView->MoveTo(10,fMenuBar->Frame().bottom + 10);
	top->AddChild(fCounterView);

	r = gGameStyle->SmileyUp()->Bounds();
	fSmileyButton = new BitmapButton(r,"smiley",gGameStyle->SmileyUp(),
									gGameStyle->SmileyDown(), new BMessage(M_NEW_GAME),false,
									B_FOLLOW_TOP | B_FOLLOW_H_CENTER);
	top->AddChild(fSmileyButton);

	fTimerView = new TimerView();
	fTimerView->SetResizingMode(B_FOLLOW_RIGHT | B_FOLLOW_TOP);
	top->AddChild(fTimerView);

	fFieldView = new FieldView(gDifficulty);
	top->AddChild(fFieldView);
	fFieldView->MakeFocus(true);

	fCounterView->SetCount(fFieldView->MineCount());
	ResetLayout();

	AddCommonFilter(new SpaceBarFilter(M_NEW_GAME));
}
Exemple #23
0
void
MainWindow::MessageReceived(BMessage *msg)
{
	switch (msg->what)
	{
		case B_ABOUT_REQUESTED:
		{
			AboutRequested();
			break;
		}
		case M_SHOW_HELP:
		{
			HelpWindow *helpwin = new HelpWindow();
			helpwin->Show();
			break;
		}
		case M_SHOW_CUSTOM:
		{
			CustomWindow *cswin = new CustomWindow();
			cswin->Show();
			break;
		}
		case M_NEW_GAME:
		{
			SetFace(FACE_NORMAL);
			SetupGame();
			break;
		}
		case M_SHOW_SCORES:
		{
			ScoreWindow *scorewin = new ScoreWindow();
			scorewin->Show();
			break;
		}
		case M_PAUSE_GAME:
		{
			BMenuItem *item = fMenuBar->FindItem(M_PAUSE_GAME);
			if (fTimerView->GetState() == TIMER_START)
			{
				fTimerView->SetState(TIMER_STOP);
				if (item)
					item->SetMarked(true);
				fFieldView->SetPauseMode(true);
			}
			else
			{
				if (item->IsMarked())
				{
					fTimerView->SetState(TIMER_START);
					if (item)
						item->SetMarked(false);
					fFieldView->SetPauseMode(false);
				}
			}
			break;
		}
		case M_SET_DIFFICULTY:
		{
			int32 level;
			if (msg->FindInt32("level",&level) != B_OK)
				break;

			BMenuItem *item = fMenuBar->FindItem(M_SET_DIFFICULTY);
			BMenu *menu = item ? item->Menu() : NULL;

			item = menu->FindMarked();
			if (item)
				item->SetMarked(false);
			menu->ItemAt(level)->SetMarked(true);

			gDifficulty = level;
			SetupGame();
			fFieldView->SetPauseMode(false);
			break;
		}
		case M_UPDATE_COUNT:
		{
			fCounterView->SetCount(fFieldView->MineCount() - fFieldView->FlagCount());
			break;
		}
		case M_START_TIMER:
		{
			fTimerView->SetState(TIMER_RESET);
			fTimerView->SetState(TIMER_START);
			gGameState = GAME_STARTED;
			break;
		}
		case M_SONAR_PENALTY:
		{
			fTimerView->SetState(TIMER_STOP);
			if (fTimerView->GetTime() < 979)
				fTimerView->SetTime(fTimerView->GetTime() + 20);
			else
				fTimerView->SetTime(999);
			fTimerView->SetState(TIMER_START);
			if (fFieldView->CheckWin())
				fFieldView->DoWin();
			break;
		}
		case M_SIZE_CHANGED:
		{
			ResizeTo(fFieldView->Frame().right + 10,fFieldView->Frame().bottom + 10);
			break;
		}
		case M_SET_THEME:
		{
			BString name;
			if (msg->FindString("name",&name) == B_OK)
				SetTheme(name.String());

			break;
		}
		case M_TOGGLE_SOUNDS:
		{
			gPlaySounds = gPlaySounds ? false : true;
			BMenuItem *item = fMenuBar->FindItem(M_TOGGLE_SOUNDS);
			if (item)
				item->SetMarked(!item->IsMarked());
			break;
		}
		default:
		{
			BWindow::MessageReceived(msg);
			break;
		}
	}
}
Exemple #24
0
FileTypeWindow::FileTypeWindow(BPoint position, const BMessage& refs)
	:
	BWindow(BRect(0.0f, 0.0f, 300.0f, 200.0f).OffsetBySelf(position),
		B_TRANSLATE("File type"), B_TITLED_WINDOW,
		B_NOT_V_RESIZABLE | B_NOT_ZOOMABLE
			| B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
{
	float padding = be_control_look->DefaultItemSpacing();

	// "File Type" group
	BBox* fileTypeBox = new BBox("file type BBox");
	fileTypeBox->SetLabel(B_TRANSLATE("File type"));

	fTypeControl = new BTextControl("type", NULL, "Type Control",
		new BMessage(kMsgTypeEntered));

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

	fSelectTypeButton = new BButton("select type",
		B_TRANSLATE("Select" B_UTF8_ELLIPSIS), new BMessage(kMsgSelectType));

	fSameTypeAsButton = new BButton("same type as",
		B_TRANSLATE_COMMENT("Same as" B_UTF8_ELLIPSIS,
			"The same TYPE as ..."), new BMessage(kMsgSameTypeAs));

	BLayoutBuilder::Grid<>(fileTypeBox, padding, padding / 2)
		.SetInsets(padding, padding * 2, padding, padding)
		.Add(fTypeControl, 0, 0, 3, 1)
		.Add(fSelectTypeButton, 0, 1)
		.Add(fSameTypeAsButton, 1, 1);

	// "Icon" group

	BBox* iconBox = new BBox("icon BBox");
	iconBox->SetLabel(B_TRANSLATE("Icon"));
	fIconView = new IconView("icon");
	BLayoutBuilder::Group<>(iconBox, B_HORIZONTAL)
		.SetInsets(padding, padding * 2, padding, padding)
		.Add(fIconView);

	// "Preferred Application" group

	BBox* preferredBox = new BBox("preferred BBox");
	preferredBox->SetLabel(B_TRANSLATE("Preferred application"));

	BMenu* menu = new BPopUpMenu("preferred");
	BMenuItem* item;
	menu->AddItem(item = new BMenuItem(B_TRANSLATE("Default application"),
		new BMessage(kMsgPreferredAppChosen)));
	item->SetMarked(true);

	fPreferredField = new BMenuField("preferred", NULL, menu);

	fSelectAppButton = new BButton("select app",
		B_TRANSLATE("Select" B_UTF8_ELLIPSIS),
		new BMessage(kMsgSelectPreferredApp));

	fSameAppAsButton = new BButton("same app as",
		B_TRANSLATE_COMMENT("Same as" B_UTF8_ELLIPSIS,
			"The same APPLICATION as ..."),
			new BMessage(kMsgSamePreferredAppAs));

	BLayoutBuilder::Grid<>(preferredBox, padding, padding / 2)
		.SetInsets(padding, padding * 2, padding, padding)
		.Add(fPreferredField, 0, 0, 3, 1)
		.Add(fSelectAppButton, 0, 1)
		.Add(fSameAppAsButton, 1, 1);

	BLayoutBuilder::Grid<>(this)
		.SetInsets(padding)
		.Add(fileTypeBox, 0, 0, 2, 1)
		.Add(preferredBox, 0, 1, 1, 1)
		.Add(iconBox, 1, 1, 1, 1);

	fTypeControl->MakeFocus(true);
	BMimeType::StartWatching(this);
	_SetTo(refs);
}
Exemple #25
0
void TCueSheetWindow::AdjustCueSheetMenu()
{

	BMenu* theMenu = fAppMenu->GetCueSheetMenu();
	if (theMenu) {
		//      Setup Item
		BMenuItem* setupItem = theMenu->FindItem(CUE_SETUP_MSG);
		if (setupItem)
			;

		//      Time Base Item
		BMenuItem* timeBaseItem = theMenu->FindItem(CUE_TIMEBASE_MSG);
		if (timeBaseItem)
			;

		//      Zoom In Item
		BMenuItem* zoomInItem = theMenu->FindItem(CUE_ZOOMIN_MSG);
		if (zoomInItem)
			;

		//      Zoom Out Item
		BMenuItem* zoomOutItem = theMenu->FindItem(CUE_ZOOMOUT_MSG);
		if (zoomOutItem)
			;

		//      Show Durations Item
		//      Enable if there are any cues in the cue sheet
		BMenuItem* showDurationsItem = theMenu->FindItem(CUE_SHOWDURATIONS_MSG);
		if (showDurationsItem) {
			// Enable this item if there are any cues to be selected
			showDurationsItem->SetEnabled( fCueSheetView->HasCues() );
		}

		//      Show Stop Time Item
		BMenuItem* showStopTimeItem = theMenu->FindItem(CUE_SHOWSTOPTIMES_MSG);
		if (showStopTimeItem) {
			// Enable this item if there are any cues to be selected
			showStopTimeItem->SetEnabled( fCueSheetView->HasCues() );
		}


		//      Insert Channels Item
		BMenuItem* insertItem = theMenu->FindItem(CUE_INSERTCHANNELS_MSG);
		if (insertItem)
			;

		//      Delete Channels Item
		BMenuItem* deleteItem = theMenu->FindItem(CUE_DELETECHANNELS_MSG);
		if (deleteItem) {
			//  If we only have one channel, disable this item
			if (fCueSheetView->GetTotalChannels() > 1)
				deleteItem->SetEnabled(true);
			else
				deleteItem->SetEnabled(false);
		}

		//      Insert Time Item
		BMenuItem* insertTimeItem = theMenu->FindItem(CUE_INSERTTIME_MSG);
		if (insertTimeItem) {
			insertTimeItem->SetEnabled(false);
		}

		//      Align Start Item
		BMenuItem* startItem = theMenu->FindItem(CUE_ALIGNSTART_MSG);
		if (startItem) {
			//  A cue in two or more distinct channels must be selected for this
			//	command to be enable
			if ( fCueSheetView->HasMultipleCueChannelsSelected() )
				startItem->SetEnabled(true);
			else
				startItem->SetEnabled(false);
		}

		//      Align End Item
		BMenuItem* endItem = theMenu->FindItem(CUE_ALIGNEND_MSG);
		if (endItem) {
			//  A cue in two or more distinct channels must be selected for this
			//	command to be enable
			if ( fCueSheetView->HasMultipleCueChannelsSelected() )
				endItem->SetEnabled(true);
			else
				endItem->SetEnabled(false);
		}

		//      Collapse Item
		BMenuItem* collapseItem = theMenu->FindItem(CUE_COLLAPSEALL_MSG);
		if (collapseItem)
			;

		//      Jump To Item
		BMenuItem* jumpToItem = theMenu->FindItem(CUE_JUMPTO_MSG);
		if (jumpToItem)
			;


	}
}
Exemple #26
0
BPopUpMenu*
DeskbarView::_BuildMenu()
{
	BPopUpMenu* menu = new BPopUpMenu(B_EMPTY_STRING, false, false);
	menu->SetFont(be_plain_font);

	menu->AddItem(new BMenuItem(MDR_DIALECT_CHOICE (
		"Create new message", "N) 新規メッセージ作成")B_UTF8_ELLIPSIS,
		new BMessage(MD_OPEN_NEW)));
	menu->AddSeparatorItem();

	BMessenger tracker(kTrackerSignature);
	BNavMenu* navMenu;
	BMenuItem* item;
	BMessage* msg;
	entry_ref ref;

	BPath path;
	find_directory(B_USER_SETTINGS_DIRECTORY, &path);
	path.Append("Mail/Menu Links");

	BDirectory directory;
	if (_CreateMenuLinks(directory, path)) {
		int32 count = 0;

		while (directory.GetNextRef(&ref) == B_OK) {
			count++;

			path.SetTo(&ref);
			// the true here dereferences the symlinks all the way :)
			BEntry entry(&ref, true);

			// do we want to use the NavMenu, or just an ordinary BMenuItem?
			// we are using the NavMenu only for directories and queries
			bool useNavMenu = false;

			if (entry.InitCheck() == B_OK) {
				if (entry.IsDirectory())
					useNavMenu = true;
				else if (entry.IsFile()) {
					// Files should use the BMenuItem unless they are queries
					char mimeString[B_MIME_TYPE_LENGTH];
					BNode node(&entry);
					BNodeInfo info(&node);
					if (info.GetType(mimeString) == B_OK
						&& strcmp(mimeString, "application/x-vnd.Be-query")
							== 0)
						useNavMenu = true;
				}
				// clobber the existing ref only if the symlink derefernces
				// completely, otherwise we'll stick with what we have
				entry.GetRef(&ref);
			}

			msg = new BMessage(B_REFS_RECEIVED);
			msg->AddRef("refs", &ref);

			if (useNavMenu) {
				item = new BMenuItem(navMenu = new BNavMenu(path.Leaf(),
					B_REFS_RECEIVED, tracker), msg);
				navMenu->SetNavDir(&ref);
			} else
				item = new BMenuItem(path.Leaf(), msg);

			menu->AddItem(item);
			if(entry.InitCheck() != B_OK)
				item->SetEnabled(false);
		}
		if (count > 0)
			menu->AddSeparatorItem();
	}

	// Hack for R5's buggy Query Notification
	#ifdef HAIKU_TARGET_PLATFORM_BEOS
		menu->AddItem(new BMenuItem(
			MDR_DIALECT_CHOICE("Refresh New Mail Count",
				"未読メールカウントを更新"),
			new BMessage(MD_REFRESH_QUERY)));
	#endif

	// The New E-mail query

	if (fNewMessages > 0) {
		BString string;
		MDR_DIALECT_CHOICE(
			string << fNewMessages << " new message"
				<< (fNewMessages != 1 ? "s" : B_EMPTY_STRING),
			string << fNewMessages << " 通の未読メッセージ");

		_GetNewQueryRef(ref);

		item = new BMenuItem(navMenu = new BNavMenu(string.String(),
			B_REFS_RECEIVED, BMessenger(kTrackerSignature)),
			msg = new BMessage(B_REFS_RECEIVED));
		msg->AddRef("refs", &ref);
		navMenu->SetNavDir(&ref);

		menu->AddItem(item);
	} else {
		menu->AddItem(item = new BMenuItem(
			MDR_DIALECT_CHOICE ("No new messages","未読メッセージなし"), NULL));
		item->SetEnabled(false);
	}

	BMailAccounts accounts;
	if (modifiers() & B_SHIFT_KEY) {
		BMenu *accountMenu = new BMenu(
			MDR_DIALECT_CHOICE ("Check for mails only","R) メール受信のみ"));
		BFont font;
		menu->GetFont(&font);
		accountMenu->SetFont(&font);

		for (int32 i = 0; i < accounts.CountAccounts(); i++) {
			BMailAccountSettings* account = accounts.AccountAt(i);

			BMessage* message = new BMessage(MD_CHECK_FOR_MAILS);
			message->AddInt32("account", account->AccountID());

			accountMenu->AddItem(new BMenuItem(account->Name(), message));
		}
		if (accounts.CountAccounts() == 0) {
			item = new BMenuItem("<no accounts>", NULL);
			item->SetEnabled(false);
			accountMenu->AddItem(item);
		}
		accountMenu->SetTargetForItems(this);
		menu->AddItem(new BMenuItem(accountMenu,
			new BMessage(MD_CHECK_FOR_MAILS)));

		// Not used:
		// menu->AddItem(new BMenuItem(MDR_DIALECT_CHOICE (
		// "Check For Mails Only","メール受信のみ"), new BMessage(MD_CHECK_FOR_MAILS)));
		menu->AddItem(new BMenuItem(
			MDR_DIALECT_CHOICE ("Send pending mails", "M) 保留メールを送信"),
		new BMessage(MD_SEND_MAILS)));
	} else {
		menu->AddItem(item = new BMenuItem(
			MDR_DIALECT_CHOICE ("Check for mail now", "C) メールチェック"),
			new BMessage(MD_CHECK_SEND_NOW)));
		if (accounts.CountAccounts() == 0)
			item->SetEnabled(false);
	}

	menu->AddSeparatorItem();
	menu->AddItem(new BMenuItem(
		MDR_DIALECT_CHOICE ("Preferences", "P) メール環境設定") B_UTF8_ELLIPSIS,
		new BMessage(MD_OPEN_PREFS)));

	if (modifiers() & B_SHIFT_KEY) {
		menu->AddItem(new BMenuItem(
			MDR_DIALECT_CHOICE ("Shutdown mail services", "Q) 終了"),
			new BMessage(B_QUIT_REQUESTED)));
	}

	// Reset Item Targets (only those which aren't already set)

	for (int32 i = menu->CountItems(); i-- > 0;) {
		item = menu->ItemAt(i);
		if (item && (msg = item->Message()) != NULL) {
			if (msg->what == B_REFS_RECEIVED)
				item->SetTarget(tracker);
			else
				item->SetTarget(this);
		}
	}
	return menu;
}
Exemple #27
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);
}
Exemple #28
0
void
ActivityView::MouseDown(BPoint where)
{
	int32 buttons = B_SECONDARY_MOUSE_BUTTON;
	if (Looper() != NULL && Looper()->CurrentMessage() != NULL)
		Looper()->CurrentMessage()->FindInt32("buttons", &buttons);

	if (buttons == B_PRIMARY_MOUSE_BUTTON) {
		fZoomPoint = where;
		fOriginalResolution = fDrawResolution;
		fZooming = true;
		SetMouseEventMask(B_POINTER_EVENTS);
		return;
	}

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

	BMenu* additionalMenu = new BMenu(B_TRANSLATE("Additional items"));
	additionalMenu->SetFont(be_plain_font);

	SystemInfo info;
	BMenuItem* item;

	for (int32 i = 0; i < DataSource::CountSources(); i++) {
		const DataSource* source = DataSource::SourceAt(i);

		if (source->MultiCPUOnly() && info.CPUCount() == 1)
			continue;

		BMessage* message = new BMessage(kMsgToggleDataSource);
		message->AddInt32("index", i);

		item = new BMenuItem(source->Name(), message);
		if (FindDataSource(source))
			item->SetMarked(true);

		if (source->Primary())
			menu->AddItem(item);
		else
			additionalMenu->AddItem(item);
	}

	menu->AddItem(new BMenuItem(additionalMenu));
	menu->AddSeparatorItem();
	menu->AddItem(item = new BMenuItem(B_TRANSLATE("Show legend"),
		new BMessage(kMsgToggleLegend)));
	item->SetMarked(fShowLegend);

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

	ActivityWindow* window = dynamic_cast<ActivityWindow*>(Window());
	if (window != NULL && window->ActivityViewCount() > 1) {
		menu->AddSeparatorItem();
		BMessage* message = new BMessage(kMsgRemoveView);
		message->AddPointer("view", this);
		menu->AddItem(item = new BMenuItem(B_TRANSLATE("Remove graph"),
			message));
		item->SetTarget(window);
	}

	ConvertToScreen(&where);
	menu->Go(where, true, false, true);
}
Exemple #29
0
bool
FavoritesMenu::AddNextItem()
{
	// run the next chunk of code for a given item adding state

	if (fState == kStart) {
		fState = kAddingFavorites;
		fSectionItemCount = 0;
		fAddedSeparatorForSection = false;
		// set up adding the GoTo menu items

		try {
			BPath path;
			ThrowOnError(find_directory(B_USER_SETTINGS_DIRECTORY,
				&path, true));
			path.Append(kGoDirectory);
			mkdir(path.Path(), 0777);

			BEntry entry(path.Path());
			Model startModel(&entry, true);
			ThrowOnInitCheckError(&startModel);

			if (!startModel.IsContainer())
				throw B_ERROR;

			if (startModel.IsQuery())
				fContainer = new QueryEntryListCollection(&startModel);
			else
				fContainer = new DirectoryEntryList(*dynamic_cast<BDirectory*>
					(startModel.Node()));

			ThrowOnInitCheckError(fContainer);
			ThrowOnError( fContainer->Rewind() );

		} catch (...) {
			delete fContainer;
			fContainer = NULL;
		}
	}


	if (fState == kAddingFavorites) {
		entry_ref ref;
		if (fContainer
			&& fContainer->GetNextRef(&ref) == B_OK) {
			Model model(&ref, true);
			if (model.InitCheck() != B_OK)
				return true;

			if (!ShouldShowModel(&model))
				return true;

			BMenuItem* item = BNavMenu::NewModelItem(&model,
				model.IsDirectory() ? fOpenFolderMessage : fOpenFileMessage,
				fTarget);
				
			if (item == NULL)
				return true;

			item->SetLabel(ref.name);
				// this is the name of the link in the Go dir

			if (!fAddedSeparatorForSection) {
				fAddedSeparatorForSection = true;
				AddItem(new TitledSeparatorItem(B_TRANSLATE("Favorites")));
			}
			fUniqueRefCheck.push_back(*model.EntryRef());
			AddItem(item);
			fSectionItemCount++;
			return true;
		}

		// done with favorites, set up for adding recent files
		fState = kAddingFiles;

		fAddedSeparatorForSection = false;

		app_info info;
		be_app->GetAppInfo(&info);
		fItems.MakeEmpty();

		int32 apps, docs, folders;
		TrackerSettings().RecentCounts(&apps, &docs, &folders);

		BRoster().GetRecentDocuments(&fItems, docs, NULL, info.signature);
		fIndex = 0;
		fSectionItemCount = 0;
	}

	if (fState == kAddingFiles) {
		//	if this is a Save panel, not an Open panel
		//	then don't add the recent documents
		if (!fIsSavePanel) {
			for (;;) {
				entry_ref ref;
				if (fItems.FindRef("refs", fIndex++, &ref) != B_OK)
					break;

				Model model(&ref, true);
				if (model.InitCheck() != B_OK)
					return true;

				if (!ShouldShowModel(&model))
					return true;

				BMenuItem* item = BNavMenu::NewModelItem(&model,
					fOpenFileMessage, fTarget);
				if (item) {
					if (!fAddedSeparatorForSection) {
						fAddedSeparatorForSection = true;
						AddItem(new TitledSeparatorItem(
							B_TRANSLATE("Recent documents")));
					}
					AddItem(item);
					fSectionItemCount++;
					return true;
				}
			}
		}

		// done with recent files, set up for adding recent folders
		fState = kAddingFolders;

		fAddedSeparatorForSection = false;

		app_info info;
		be_app->GetAppInfo(&info);
		fItems.MakeEmpty();

		int32 apps, docs, folders;
		TrackerSettings().RecentCounts(&apps, &docs, &folders);

		BRoster().GetRecentFolders(&fItems, folders, info.signature);
		fIndex = 0;
	}

	if (fState == kAddingFolders) {
		for (;;) {
			entry_ref ref;
			if (fItems.FindRef("refs", fIndex++, &ref) != B_OK)
				break;

			// don't add folders that are already in the GoTo section
			if (find_if(fUniqueRefCheck.begin(), fUniqueRefCheck.end(),
				bind2nd(std::equal_to<entry_ref>(), ref))
					!= fUniqueRefCheck.end()) {
				continue;
			}

			Model model(&ref, true);
			if (model.InitCheck() != B_OK)
				return true;

			if (!ShouldShowModel(&model))
				return true;

			BMenuItem* item = BNavMenu::NewModelItem(&model,
				fOpenFolderMessage, fTarget, true);
			if (item) {
				if (!fAddedSeparatorForSection) {
					fAddedSeparatorForSection = true;
					AddItem(new TitledSeparatorItem(
						B_TRANSLATE("Recent folders")));
				}
				AddItem(item);
				item->SetEnabled(true);
					// BNavMenu::NewModelItem returns a disabled item here -
					// need to fix this in BNavMenu::NewModelItem
				return true;
			}
		}
	}
	return false;
}
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);
}