コード例 #1
0
ファイル: BR_ContinuousActions.cpp プロジェクト: wolqws/sws
/******************************************************************************
* Continuous actions                                                          *
******************************************************************************/
bool ContinuousActionRegister (BR_ContinuousAction* action)
{
	if (action && kbd_getTextFromCmd(action->cmd, NULL) && g_actions.FindSorted(action, &CompareActionsByCmd) == -1)
	{
		g_actions.InsertSorted(action, &CompareActionsByCmd);
		return true;
	}
	else
		return false;
}
コード例 #2
0
ファイル: BR_ContinuousActions.cpp プロジェクト: wolqws/sws
bool ContinuousActionHook (int cmd, int flag)
{
	BR_ContinuousAction ca(cmd, NULL, NULL, NULL, NULL);
	int id = g_actions.FindSorted(&ca, &CompareActionsByCmd);
	if (id != -1)
	{
		if (!g_actionInProgress)
		{
			if (ContinuousActionInit(true, cmd, g_actions.Get(id)))
				return false; // all good, let it execute from the shortcut the first time
			else
				return true;
		}
		else
		{
			if (flag == ACTION_FLAG && g_actionInProgress->cmd == cmd) return false; // continuous action called from timer, let it pass
			else                                                       return true;
		}
	}
	return false;
}