diff options
Diffstat (limited to 'indra/llui/lltoolbar.cpp')
-rw-r--r-- | indra/llui/lltoolbar.cpp | 55 |
1 files changed, 49 insertions, 6 deletions
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 629c7d9bc7..515605200e 100644 --- a/indra/llui/lltoolbar.cpp +++ b/indra/llui/lltoolbar.cpp @@ -217,7 +217,7 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank) if ((rank >= mButtonCommands.size()) || (rank == RANK_NONE)) { // In that case, back load - mButtonCommands.push_back(commandId); + mButtonCommands.push_back(command->id()); mButtons.push_back(button); } else @@ -232,7 +232,7 @@ bool LLToolBar::addCommand(const LLCommandId& commandId, int rank) rank--; } // ...then insert - mButtonCommands.insert(it_command,commandId); + mButtonCommands.insert(it_command, command->id()); mButtons.insert(it_button,button); } @@ -302,7 +302,50 @@ bool LLToolBar::enableCommand(const LLCommandId& commandId, bool enabled) command_id_map::iterator it = mButtonMap.find(commandId.uuid()); if (it != mButtonMap.end()) { - it->second->setEnabled(enabled); + command_button = it->second; + command_button->setEnabled(enabled); + } + } + + return (command_button != NULL); +} + +bool LLToolBar::stopCommandInProgress(const LLCommandId& commandId) +{ + // + // Note from Leslie: + // + // This implementation was largely put in place to handle EXP-1348 which is related to + // dragging and dropping the "speak" button. The "speak" button can be in one of two + // modes, i.e., either a toggle action or a push-to-talk action. Because of this it + // responds to mouse down and mouse up in different ways, based on which behavior the + // button is currently set to obey. This was the simplest way of getting the button + // to turn off the microphone for both behaviors without risking duplicate state. + // + + LLToolBarButton * command_button = NULL; + + if (commandId != LLCommandId::null) + { + LLCommand* command = LLCommandManager::instance().getCommand(commandId); + llassert(command); + + // If this command has an explicit function for execution stop + if (command->executeStopFunctionName().length() > 0) + { + command_id_map::iterator it = mButtonMap.find(commandId.uuid()); + if (it != mButtonMap.end()) + { + command_button = it->second; + llassert(command_button->mIsRunningSignal); + + // Check to see if it is running + if ((*command_button->mIsRunningSignal)(command_button, command->isRunningParameters())) + { + // Trigger an additional button commit, which calls mouse down, mouse up and commit + command_button->onCommit(); + } + } } } @@ -778,7 +821,7 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id) if (!commandp) return NULL; LLToolBarButton::Params button_p; - button_p.name = id.name(); + button_p.name = commandp->name(); button_p.label = LLTrans::getString(commandp->labelRef()); button_p.tool_tip = LLTrans::getString(commandp->tooltipRef()); button_p.image_overlay = LLUI::getUIImage(commandp->icon()); @@ -956,13 +999,13 @@ BOOL LLToolBarButton::handleHover(S32 x, S32 y, MASK mask) { if (!mIsDragged) { - mStartDragItemCallback(x,y,mId.uuid()); + mStartDragItemCallback(x, y, this); mIsDragged = true; handled = TRUE; } else { - handled = mHandleDragItemCallback(x,y,mId.uuid(),LLAssetType::AT_WIDGET); + handled = mHandleDragItemCallback(x, y, mId.uuid(), LLAssetType::AT_WIDGET); } } else |