示例#1
0
HMENU SWS_ProjectListWnd::OnContextMenu(int x, int y, bool* wantDefaultItems)
{
	HMENU hMenu = CreatePopupMenu();
	AddToMenu(hMenu, __localizeFunc(g_projMgrCmdTable[0].menuText,"sws_menu",0), g_projMgrCmdTable[0].accel.accel.cmd);
	AddToMenu(hMenu, __localizeFunc(g_projMgrCmdTable[1].menuText,"sws_menu",0), g_projMgrCmdTable[1].accel.accel.cmd);
	return hMenu;
}
示例#2
0
const char* GetSendTypeStr(int _type) 
{
	switch(_type) {
		case 1: return __localizeFunc("Post-Fader (Post-Pan)","common",0);
		case 2: return __localizeFunc("Pre-Fader (Post-FX)","common",0);
		case 3: return __localizeFunc("Pre-FX","common",0);
		default: return "";
	}
}
示例#3
0
文件: sws_util.cpp 项目: Lazzle/sws
// check that action tags ("SWS: ", "SWS/FNG: ", SWS/S&M: ", etc..) are preserved
const char* GetLocalizedActionName(const char* _defaultStr, int _flags, const char* _section)
{
#ifdef _SWS_LOCALIZATION
	const char* p = __localizeFunc(_defaultStr, _section, _flags);
	if (IsSwsAction(p))
		return p;
#endif
	return _defaultStr;
}
示例#4
0
static void menuhook(const char* menustr, HMENU hMenu, int flag)
{
	if (flag == 1)
	{
		// Delete all related project entries and regenerate
		int iFirstPos;

		hMenu = FindMenuItem(hMenu, g_projMgrCmdTable[g_iORPCmdIndex].accel.accel.cmd, &iFirstPos);

		if (hMenu)
		{
			int iSlot = 0;
			int iPos;
			while (true)
			{
				int iCmd = GetLoadCommandID(iSlot, false);
				if (iCmd)
				{
					if (FindMenuItem(hMenu, iCmd, &iPos))
						DeleteMenu(hMenu, iPos, MF_BYPOSITION);
					else
						break;
				}
				else
					break;
				iSlot++;
			}

			if (!g_relatedProjects.Get()->GetSize())
			{
				MENUITEMINFO mi={sizeof(MENUITEMINFO),};
				mi.fMask = MIIM_TYPE | MIIM_STATE | MIIM_ID;
				mi.fType = MFT_STRING;
				mi.fState = MFS_GRAYED;
				mi.dwTypeData = (char *)__localizeFunc(g_projMgrCmdTable[g_iORPCmdIndex].menuText,"sws_menu",0);
				mi.wID = g_projMgrCmdTable[g_iORPCmdIndex].accel.accel.cmd;
				InsertMenuItem(hMenu, iFirstPos, true, &mi);
			}
			else
			{
				for (int i = 0; i < g_relatedProjects.Get()->GetSize(); i++)
					AddToMenu(hMenu, g_relatedProjects.Get()->Get(i)->Get(), GetLoadCommandID(i, true), iFirstPos++, true, MFS_UNCHECKED);
			}
		}
	}
}
示例#5
0
文件: sws_util.cpp 项目: Lazzle/sws
TrackEnvelope* SWS_GetTrackEnvelopeByName(MediaTrack* track, const char* envname) {
	return GetTrackEnvelopeByName(track,  __localizeFunc(envname, "envname", 0));
}
示例#6
0
文件: sws_util.cpp 项目: Lazzle/sws
// wrappers to ignore localized envelope names
TrackEnvelope* SWS_GetTakeEnvelopeByName(MediaItem_Take* take, const char* envname) {
	return GetTakeEnvelopeByName(take, __localizeFunc(envname, "item", 0));
}
示例#7
0
文件: Color.cpp 项目: wolqws/sws
//JFB menu items are not localized here (ideally it should be done through __LOCALIZE() and not with the table command above).
static void menuhook(const char* menustr, HMENU hMenu, int flag)
{
	int menuid = -1;
	if (strcmp(menustr, "Track control panel context") == 0)
		menuid = 0;
	else if (strcmp(menustr, "Media item context") == 0)
		menuid = 1;

	if (menuid >= 0 && flag == 0)
	{	// Initialize the menu
		void (*pFirstCommand)(COMMAND_T*);
		void (*pLastCommand)(COMMAND_T*);
		if (menuid == 0)
		{
			pFirstCommand = TrackRandomCol;
			pLastCommand  = TrackCustCol;
		}
		else
		{
			pFirstCommand = ItemRandomCol;
			pLastCommand  = ItemCustCol;
		}

		HMENU hSubMenu = CreatePopupMenu();
		int i = 0;
		while (g_commandTable[i].doCommand != pFirstCommand)
			i++;
		do
		{
			AddToMenu(hSubMenu, __localizeFunc(g_commandTable[i].menuText,"sws_menu",0), g_commandTable[i].accel.accel.cmd);
			i++;
		}
		while (!(g_commandTable[i-1].doCommand == pLastCommand && g_commandTable[i-1].user == 15));

		// Finish with color dialog
		AddToMenu(hSubMenu, __localizeFunc(g_commandTable[0].menuText,"sws_menu",0), g_commandTable[0].accel.accel.cmd);

		if (menuid == 0)
			AddSubMenu(hMenu, hSubMenu, __LOCALIZE("SWS track color","sws_menu"), 40359);
		else
			AddSubMenu(hMenu, hSubMenu, __LOCALIZE("SWS item color","sws_menu"), 40707);
	}
#ifdef _WIN32
	else if (flag == 1)
	{	// Update the color swatches
		// Color commands can be anywhere on the menu, so find 'em no matter where
		static WDL_PtrList<void> pBitmaps;
		HDC hdcScreen = NULL;
		HDC hDC = NULL;
		
		if (pBitmaps.GetSize() == 0)
		{
			hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL); 
			int s = GetSystemMetrics(SM_CYMENUCHECK);
			UpdateCustomColors();
			for (int i = 0; i < 16; i++)
				pBitmaps.Add(CreateCompatibleBitmap(hdcScreen, s+3, s));
		}
		
		int iCommand1 = SWSGetCommandID(TrackCustCol, 0);
		int iCommand2 = SWSGetCommandID(ItemCustCol, 0);

		for (int i = 0; i < 32; i++)
		{
			int iPos;
			HMENU h;
			if (i < 16)
				h = FindMenuItem(hMenu, iCommand1 + i, &iPos);
			else
				h = FindMenuItem(hMenu, iCommand2 + i-16, &iPos);
			if (h)
			{
				if (!hDC)
				{	// Reduce thrashing
					UpdateCustomColors();
					if (!hdcScreen)
						hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL);
					hDC = CreateCompatibleDC(hdcScreen);
				}

				int s = GetSystemMetrics(SM_CYMENUCHECK);
				RECT rColor = { 0, 0, s, s };
				RECT rSpace = { s, 0, s+3, s };

				SelectObject(hDC, pBitmaps.Get(i%16));
				HBRUSH hb = CreateSolidBrush(g_custColors[i%16]);
				FillRect(hDC, &rColor, hb);
				DeleteObject(hb);
				FillRect(hDC, &rSpace, (HBRUSH)(COLOR_MENU+1));

				MENUITEMINFO mi={sizeof(MENUITEMINFO),};
				mi.fMask = MIIM_BITMAP;
				mi.hbmpItem = (HBITMAP)pBitmaps.Get(i%16);
				SetMenuItemInfo(h, iPos, true, &mi);
			}
		}
		if (hDC)
			DeleteDC(hDC);
		if (hdcScreen)
			DeleteDC(hdcScreen);
	}
#endif
}