You need something like this first in the plugin entry point function :
Code:
acreg13.accel.cmd=g_registered_cmd_SelectFirstTakeOfSelectedItems =rec->Register("command_id","XENAKIOS_SELECTFIRSTTAKEOFITEMS");
if (!g_registered_cmd_SelectFirstTakeOfSelectedItems ) {MessageBox(g_parent,"could not register cmd XENAKIOS_SELECTFIRSTTAKEOFITEMS!","BAD happened :(",MB_OK);return 0;}
rec->Register("gaccel",&acreg13);
rec->Register("hookcommand",hookCommandProc);
The hookcommand-thing is needed only once, it registers the function that actually handles the commands that looks something like :
Code:
bool hookCommandProc(int command, int flag)
{
if (g_registered_cmd_SelectFirstTakeOfSelectedItems && command == g_registered_cmd_SelectFirstTakeOfSelectedItems)
{
DoSelectTakeInSelectedItems(-1);
Undo_OnStateChange("Select First Takes",4,-1);
UpdateTimeline();
return true;
}
return false;
}
Global variable g_registered_cmd_SelectFirstTakeOfSelectedItems is of type int and global acreg13 is defined as :
Code:
gaccel_register_t acreg13=
{
{0,0,0},
"Xenakios Extensions : Select First Take Of Selected Items"
};
All this won't yet make anything appear in the menus, only in the actions lists of Reaper. I am bit uncertain right now how to add the code to add menu entries. (I recently switched to another way to register the commands and add menu entries that was provided by SWS. It maybe a bit more complex for you to try first, but it saves a lot of time and trouble when there's a lot of commands and menu entries to manage.) I'll post something about that later but you should first try/investigate the stuff above to register a keyboard shortcut/action list-only command...
Oh, and about translateaccel, you probably won't need it for this. (It's for your own floating dialog windows to handle keyboard passthrough to Reaper.)