CommandManage request


#1

I don’t know if this is easy to do, or in the proper spirit of the thing, but would it be possible for ApplicationCommandManager to have a clearCommandsInCategory() method.

One section of my application has a dynamic command list, and to allow this command list to update during the lifetime of the application, I either need to clear all available commands and rebuild them when the dynamic command list updates, or spin the dynamic list off into another commandManager.


#2

Well I can offer you one of these:

[code]void ApplicationCommandManager::removeCommand (const CommandID commandID)
{
for (int i = commands.size(); --i >= 0;)
{
if (commands.getUnchecked (i)->commandID == commandID)
{
commands.remove (i);
triggerAsyncUpdate();

        const Array <KeyPress> keys (keyMappings->getKeyPressesAssignedToCommand (commandID));

        for (int j = keys.size(); --j >= 0;)
            keyMappings->removeKeyPress (keys.getReference (j));
    }
}

}
[/code]

So to remove all the commands in a category you’d just call getCommandsInCategory() and remove all the ones that it returns…
[/code]


#3

just what the doctor ordered.


#4