예제 #1
0
void RunActionMarker(const char* cName)
{
	if (cName && cName[0] == '!' && !EnumProjects(0x40000000, NULL, 0)) // disabled while rendering (0x40000000 trick == rendered project, if any)
	{
		if (g_bIgnoreNext)
		{	// Ignore the entire marker action
			g_bIgnoreNext = false;
			return;
		}
		LineParser lp(false);
		lp.parse(&cName[1]);
		for (int i = 0; i < lp.getnumtokens(); i++)
		{
			int iCommand = lp.gettoken_int(i);
			if (!iCommand)
				iCommand = NamedCommandLookup(lp.gettoken_str(i));

			if (iCommand)
			{
				int iZero = 0;
				if (!kbd_RunCommandThroughHooks(NULL, &iCommand, &iZero, &iZero, &iZero, g_hwndParent))
				{
					KBD_OnMainActionEx(iCommand, 0, 0, 0, g_hwndParent, NULL);
				}
			}
		}
	}
}
bool hookCommandProc(int iCmd, int flag)
{
	static WDL_PtrList<const char> sReentrantCmds;

	// for Xen extensions
	g_KeyUpUndoHandler=0;

	// "Hack" to make actions will #s less than 1000 work with SendMessage (AHK)
	// no recursion check here: handled by REAPER
	if (iCmd < 1000)
		return KBD_OnMainActionEx(iCmd, 0, 0, 0, g_hwndParent, NULL) ? true : false; // C4800

	// Special case for checking recording
	if (iCmd == 1013 && !RecordInputCheck())
		return true;

	// Ignore commands that don't have anything to do with us from this point forward
	if (COMMAND_T* cmd = SWSGetCommandByID(iCmd))
	{
		if (cmd->accel.accel.cmd==iCmd && cmd->doCommand && cmd->doCommand!=SWS_NOOP)
		{
			if (sReentrantCmds.Find(cmd->id) == -1)
			{
				sReentrantCmds.Add(cmd->id);
				cmd->fakeToggle = !cmd->fakeToggle;
#ifndef DEBUG_PERFORMANCE_TIME
				cmd->doCommand(cmd);
#else
				CommandTimer(cmd);
#endif
				sReentrantCmds.Delete(sReentrantCmds.Find(cmd->id));
				return true;
			}
#ifdef ACTION_DEBUG
			else
			{
				OutputDebugString("hookCommandProc - recursive action: ");
				OutputDebugString(cmd->id);
				OutputDebugString("\n");
			}
#endif
		}
	}
	return false;
}
예제 #3
0
파일: SnM_Misc.cpp 프로젝트: AusRedNeck/sws
//increase/decrease the metronome volume
void ChangeMetronomeVolume(COMMAND_T* _ct) {
    KBD_OnMainActionEx(999, 0x40+(int)_ct->user, -1, 2, GetMainHwnd(), NULL);
}