View Single Post
Old 04-01-2017, 09:54 PM   #74
ceanganb
Human being with feelings
 
Join Date: May 2009
Location: Brazil
Posts: 323
Default

Xenakios, I made some changes in ´action_entry´ to embrace other keyboard sections (MIDI Editor, mainly). Looking at SWS code, I made the following changes:

Code:
action_entry::action_entry(string description, string idstring, toggle_state togst, function<void(action_entry&)> func, int kbSecId):
	m_desc(description), m_id_string(idstring), m_func(func), m_togglestate(togst)
{
	if (g_plugin_info != nullptr)
	{
		m_accel_reg.accel = { 0,0,0 };
		if (kbSecId == KS_MAIN)
		{
			m_accel_reg.desc = m_desc.c_str();
			m_command_id = g_plugin_info->Register("command_id", (void*)m_id_string.c_str());
			m_accel_reg.accel.cmd = m_command_id;
			g_plugin_info->Register("gaccel", &m_accel_reg);
		}
		else
		{
			static custom_action_register_t s;
			memset(&s, 0, sizeof(custom_action_register_t));
			s.name = m_desc.c_str();
			s.idStr = m_id_string.c_str();
			s.uniqueSectionId = kbSecId;
			m_command_id = g_plugin_info->Register("custom_action", &s);
		}
	}
}
It works, apparently, first tests went ok. Is it the right way of handling it? Any observations?

I still don't understand why a non-static ´custom_action_register_t´ doesn't work.

Thanks.
__________________
Ceanganb
ceanganb is offline   Reply With Quote