diff options
author | Richard Nelson <richard@lindenlab.com> | 2009-08-24 20:04:52 +0000 |
---|---|---|
committer | Richard Nelson <richard@lindenlab.com> | 2009-08-24 20:04:52 +0000 |
commit | 138bf1132262c479dbbd5c95195db46b1efd065f (patch) | |
tree | be2286f245865008b4ca6d738194133542822d65 /indra/newview/llnearbychatbar.cpp | |
parent | c2619694fd2f94ad7da2d6e936494f4c16601212 (diff) |
merge -r 130399-131510 skinning-21 -> viewer-2.0.0-3
DEV-11254 DEV-11254 DEV-2003: DEV-21567 DEV-37301 EXT-104 EXT-138 EXT-217 EXT-256 EXT-259 EXT-259 EXT-328 EXT-348 EXT-386 EXT-399 EXT-403 EXT-460 EXT-492 EXT-492 EXT-531 EXT-537 EXT-684
improved text editor (handles multiple fonts simultaneously as well as inline widgets)
Diffstat (limited to 'indra/newview/llnearbychatbar.cpp')
-rw-r--r-- | indra/newview/llnearbychatbar.cpp | 56 |
1 files changed, 21 insertions, 35 deletions
diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index 50e31e85e4..0696d41732 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -65,7 +65,7 @@ LLGestureComboBox::LLGestureComboBox(const LLGestureComboBox::Params& p) , mGestureLabelTimer() , mLabel(p.label) { - setCommitCallback(boost::bind(&LLGestureComboBox::onCommitGesture, this, _1)); + setCommitCallback(boost::bind(&LLGestureComboBox::onCommitGesture, this)); // now register us as observer since we have a place to put the results LLGestureManager::instance().addObserver(this); @@ -82,41 +82,33 @@ LLGestureComboBox::~LLGestureComboBox() void LLGestureComboBox::refreshGestures() { //store current selection so we can maintain it - std::string cur_gesture = getValue().asString(); + LLSD cur_gesture = getValue(); selectFirstItem(); // clear clearRows(); + mGestures.clear(); - // collect list of unique gestures - std::map <std::string, BOOL> unique; LLGestureManager::item_map_t::iterator it; + LLSD::Integer idx(0); for (it = LLGestureManager::instance().mActive.begin(); it != LLGestureManager::instance().mActive.end(); ++it) { LLMultiGesture* gesture = (*it).second; if (gesture) { - if (!gesture->mTrigger.empty()) - { - unique[gesture->mTrigger] = TRUE; - } + addSimpleElement(gesture->mName, ADD_BOTTOM, LLSD(idx)); + mGestures.push_back(gesture); + idx++; } } - // add unique gestures - std::map <std::string, BOOL>::iterator it2; - for (it2 = unique.begin(); it2 != unique.end(); ++it2) - { - addSimpleElement((*it2).first); - } - sortByName(); // Insert label after sorting, at top, with separator below it addSeparator(ADD_TOP); addSimpleElement(mLabel, ADD_TOP); - if (!cur_gesture.empty()) + if (cur_gesture.isDefined()) { - selectByValue(LLSD(cur_gesture)); + selectByValue(cur_gesture); } else { @@ -124,7 +116,7 @@ void LLGestureComboBox::refreshGestures() } } -void LLGestureComboBox::onCommitGesture(LLUICtrl* ctrl) +void LLGestureComboBox::onCommitGesture() { LLCtrlListInterface* gestures = getListInterface(); if (gestures) @@ -134,19 +126,16 @@ void LLGestureComboBox::onCommitGesture(LLUICtrl* ctrl) { return; } - const std::string& trigger = gestures->getSelectedValue().asString(); - // pretend the user chatted the trigger string, to invoke - // substitution and logging. - std::string text(trigger); - std::string revised_text; - LLGestureManager::instance().triggerAndReviseString(text, &revised_text); - - revised_text = utf8str_trim(revised_text); - if (!revised_text.empty()) + index = gestures->getSelectedValue().asInteger(); + LLMultiGesture* gesture = mGestures.at(index); + if(gesture) { - // Don't play nodding animation - LLNearbyChatBar::sendChatFromViewer(revised_text, CHAT_TYPE_NORMAL, FALSE); + LLGestureManager::instance().playGesture(gesture); + if(!gesture->mReplaceText.empty()) + { + LLNearbyChatBar::sendChatFromViewer(gesture->mReplaceText, CHAT_TYPE_NORMAL, FALSE); + } } } @@ -267,9 +256,6 @@ void LLNearbyChatBar::onChatBoxKeystroke(LLLineEditor* caller, void* userdata) LLNearbyChatBar* self = (LLNearbyChatBar *)userdata; - if (!self->mChatBox) - return; - LLWString raw_text = self->mChatBox->getWText(); // Can't trim the end, because that will cause autocompletion @@ -429,7 +415,7 @@ void LLNearbyChatBar::sendChat( EChatType type ) void LLNearbyChatBar::onChatBoxCommit() { - if (mChatBox && mChatBox->getText().length() > 0) + if (mChatBox->getText().length() > 0) { sendChat(CHAT_TYPE_NORMAL); } @@ -501,7 +487,7 @@ void LLNearbyChatBar::startChat(const char* line) LLNearbyChatBar* cb = bt->getNearbyChatBar(); - if (!cb || !cb->mChatBox) + if (!cb ) return; bt->setVisible(TRUE); @@ -527,7 +513,7 @@ void LLNearbyChatBar::stopChat() LLNearbyChatBar* cb = bt->getNearbyChatBar(); - if (!cb || !cb->mChatBox) + if (!cb) return; cb->mChatBox->setFocus(FALSE); |