sws
04-29-2008, 08:37 AM
Xenakios, this is for you. :)
Let's say you want to add a submenu to the end of the REAPER Edit menu that gives you a list the commands you've defined in your plugin. In your entry point function, after you've defined all of your command accelerators and IDs, do this:
HMENU hSubMenu = CreatePopupMenu();
MENUITEMINFO mi={sizeof(MENUITEMINFO),};
mi.fMask = MIIM_TYPE | MIIM_ID;
mi.fType = MFT_STRING;
// Add a section like this for each of your commands
mi.wID = my_command_id_1;
mi.dwTypeData = "My command 1";
InsertMenuItem(hSubMenu, 0, TRUE, &mi);
// Here's command #2, make sure to increment InsertMenuItem index
mi.wID = my_command_id_2;
mi.dwTypeData = "My command 2";
InsertMenuItem(hSubMenu, 1, TRUE, &mi);
// add more commands as above, then add it to REAPER
// Index '1' in GetSubMenu returns the 2nd menu, in this case, the "Edit" menu
HMENU hMenu = GetSubMenu(GetMenu(GetMainHwnd()),1);
mi.fMask = MIIM_SUBMENU | MIIM_TYPE;
mi.hSubMenu = hSubMenu;
mi.dwTypeData = "My commands"; // Name of submenu
// Add to end of menu with GetMenuItemCount so if Justin adds/subtracts items nothing breaks
InsertMenuItem(hMenu, GetMenuItemCount(hMenu), TRUE, &mi);
Hope this helps!
Let's say you want to add a submenu to the end of the REAPER Edit menu that gives you a list the commands you've defined in your plugin. In your entry point function, after you've defined all of your command accelerators and IDs, do this:
HMENU hSubMenu = CreatePopupMenu();
MENUITEMINFO mi={sizeof(MENUITEMINFO),};
mi.fMask = MIIM_TYPE | MIIM_ID;
mi.fType = MFT_STRING;
// Add a section like this for each of your commands
mi.wID = my_command_id_1;
mi.dwTypeData = "My command 1";
InsertMenuItem(hSubMenu, 0, TRUE, &mi);
// Here's command #2, make sure to increment InsertMenuItem index
mi.wID = my_command_id_2;
mi.dwTypeData = "My command 2";
InsertMenuItem(hSubMenu, 1, TRUE, &mi);
// add more commands as above, then add it to REAPER
// Index '1' in GetSubMenu returns the 2nd menu, in this case, the "Edit" menu
HMENU hMenu = GetSubMenu(GetMenu(GetMainHwnd()),1);
mi.fMask = MIIM_SUBMENU | MIIM_TYPE;
mi.hSubMenu = hSubMenu;
mi.dwTypeData = "My commands"; // Name of submenu
// Add to end of menu with GetMenuItemCount so if Justin adds/subtracts items nothing breaks
InsertMenuItem(hMenu, GetMenuItemCount(hMenu), TRUE, &mi);
Hope this helps!