diff options
| author | Leslie Linden <leslie@lindenlab.com> | 2011-09-22 15:43:08 -0700 |
|---|---|---|
| committer | Leslie Linden <leslie@lindenlab.com> | 2011-09-22 15:43:08 -0700 |
| commit | 565483ee1f2ea7b8d525c6d89700452216481c5e (patch) | |
| tree | ea7f3991deec677ddd775f8c3b80ed2fa7c9c92d /indra/llui/llcommandmanager.cpp | |
| parent | 6c209d0fc8c8b171262074e1970c4e9ff299f9f0 (diff) | |
EXP-1205 PROGRESS -- As a User, I want a toybox which will contain all buttons that I can d&d into the toolbars
EXP-1233 PROGRESS -- Populate the toybox floater window with all FUI toolbar buttons
EXP-1236 FIX -- The toybox floater should remember its position for the user
* Basic addCommand function to the LLToolBar. Need proper implementation.
* Added map for faster lookup of commands
* Toybox now adds commands to its toolbar for basic button setup
Reviewed by Richard.
Diffstat (limited to 'indra/llui/llcommandmanager.cpp')
| -rw-r--r-- | indra/llui/llcommandmanager.cpp | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index 306b357d6a..6be616b980 100644 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -72,9 +72,15 @@ LLCommandManager::LLCommandManager() LLCommandManager::~LLCommandManager() { + for (CommandVector::iterator cmdIt = mCommands.begin(); cmdIt != mCommands.end(); ++cmdIt) + { + LLCommand * command = *cmdIt; + + delete command; + } } -U32 LLCommandManager::count() const +U32 LLCommandManager::commandCount() const { return mCommands.size(); } @@ -88,20 +94,24 @@ LLCommand * LLCommandManager::getCommand(const std::string& commandName) { LLCommand * command_name_match = NULL; - for (CommandVector::iterator it = mCommands.begin(); it != mCommands.end(); ++it) + CommandIndexMap::const_iterator found = mCommandIndices.find(commandName); + + if (found != mCommandIndices.end()) { - LLCommand * command = *it; - - if (command->name() == commandName) - { - command_name_match = command; - break; - } + command_name_match = mCommands[found->second]; } return command_name_match; } +void LLCommandManager::addCommand(LLCommand * command) +{ + mCommandIndices[command->name()] = mCommands.size(); + mCommands.push_back(command); + + llinfos << "Successfully added command: " << command->name() << llendl; +} + //static bool LLCommandManager::load() { @@ -129,9 +139,7 @@ bool LLCommandManager::load() { LLCommand * command = new LLCommand(commandParams); - mgr.mCommands.push_back(command); - - llinfos << "Successfully loaded command: " << command->name() << llendl; + mgr.addCommand(command); } return true; |
