From 39905b927d60e204438705728d2c214cb3f9ef81 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Thu, 2 Jul 2009 00:38:13 +0000 Subject: merge https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0@873 https://svn.aws.productengine.com/secondlife/pe/stable@888 -> viewer-2.0.0-pe-4 --- indra/newview/llbottomtray.cpp | 208 +++++++++++++++++++++++++++++++++++------ 1 file changed, 180 insertions(+), 28 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 616cbb1fdb..d26da81179 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -38,53 +38,81 @@ #include "llkeyboard.h" #include "llgesturemgr.h" #include "llanimationstates.h" +#include "llmultigesture.h" //FIXME: temporary, for send_chat_from_viewer() proto #include "llchatbar.h" +// +// Globals +// +//FIXME: made it adjustable +const F32 AGENT_TYPING_TIMEOUT = 5.f; // seconds + +LLBottomTray* gBottomTray = NULL; + LLBottomTray::LLBottomTray() - :mLastSpecialChatChannel(0) + : mLastSpecialChatChannel(0) + , mGestureLabelTimer() { LLUICtrlFactory::getInstance()->buildPanel(this,"panel_bottomtray.xml"); mChicletPanel = getChild("chiclet_list",TRUE,FALSE); + mIMWell = getChild("im_well",TRUE,FALSE); + mSysWell = getChild("sys_well",TRUE,FALSE); + mSeparator = getChild("well_separator",TRUE,FALSE); + mChatBox = getChild("chat_box",TRUE,FALSE); + + if (mChatBox) + { + mChatBox->setCommitCallback(boost::bind(&LLBottomTray::onChatBoxCommit, this)); + mChatBox->setKeystrokeCallback(&onChatBoxKeystroke, this); + mChatBox->setFocusLostCallback(&onChatBoxFocusLost, this); + + mChatBox->setIgnoreArrowKeys(TRUE); + mChatBox->setCommitOnFocusLost( FALSE ); + mChatBox->setRevertOnEsc( FALSE ); + mChatBox->setIgnoreTab(TRUE); + mChatBox->setPassDelete(TRUE); + mChatBox->setReplaceNewlinesWithSpaces(FALSE); + mChatBox->setMaxTextLength(1023); + mChatBox->setEnableLineHistory(TRUE); + + } + + mGestureCombo = getChild( "Gesture", TRUE, FALSE); + if (mGestureCombo) + { + mGestureCombo->setCommitCallback(boost::bind(&LLBottomTray::onCommitGesture, this, _1)); - LLLineEditor* chat_box = getChatBox(); - chat_box->setCommitCallback(boost::bind(&LLBottomTray::onChatBoxCommit, this)); - chat_box->setKeystrokeCallback(&onChatBoxKeystroke, this); - chat_box->setFocusLostCallback(&onChatBoxFocusLost, this); + // now register us as observer since we have a place to put the results + gGestureManager.addObserver(this); + + // refresh list from current active gestures + refreshGestures(); + } LLIMMgr::getInstance()->addSessionObserver(this); } LLBottomTray::~LLBottomTray() { + gGestureManager.removeObserver(this); if (!LLSingleton::destroyed()) { LLIMMgr::getInstance()->removeSessionObserver(this); } } -LLLineEditor* LLBottomTray::getChatBox() -{ - return getChild("chat_box",TRUE,FALSE); -} - void LLBottomTray::onChatBoxCommit() { - if (getChatBox()->getText().length() > 0) + if (mChatBox && mChatBox->getText().length() > 0) { sendChat(CHAT_TYPE_NORMAL); - - LLLineEditor* chat_box = getChatBox(); - - if (chat_box) - { - chat_box->setText(LLStringExplicit("")); - } - - gAgent.stopTyping(); + mChatBox->setText(LLStringExplicit("")); } + + gAgent.stopTyping(); } void LLBottomTray::sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate) @@ -219,6 +247,105 @@ void LLBottomTray::onChatBoxFocusLost(LLFocusableElement* caller, void* userdata gAgent.stopTyping(); } +void LLBottomTray::refresh() +{ + // HACK: Leave the name of the gesture in place for a few seconds. + const F32 SHOW_GESTURE_NAME_TIME = 2.f; + if (mGestureLabelTimer.getStarted() && mGestureLabelTimer.getElapsedTimeF32() > SHOW_GESTURE_NAME_TIME) + { + LLCtrlListInterface* gestures = mGestureCombo ? mGestureCombo->getListInterface() : NULL; + if (gestures) gestures->selectFirstItem(); + mGestureLabelTimer.stop(); + } + + if ((gAgent.getTypingTime() > AGENT_TYPING_TIMEOUT) && (gAgent.getRenderState() & AGENT_STATE_TYPING)) + { + gAgent.stopTyping(); + } +} + +void LLBottomTray::onCommitGesture(LLUICtrl* ctrl) +{ + LLCtrlListInterface* gestures = mGestureCombo ? mGestureCombo->getListInterface() : NULL; + if (gestures) + { + S32 index = gestures->getFirstSelectedIndex(); + if (index == 0) + { + 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; + gGestureManager.triggerAndReviseString(text, &revised_text); + + revised_text = utf8str_trim(revised_text); + if (!revised_text.empty()) + { + // Don't play nodding animation + sendChatFromViewer(revised_text, CHAT_TYPE_NORMAL, FALSE); + } + } + mGestureLabelTimer.start(); + if (mGestureCombo != NULL) + { + // free focus back to chat bar + mGestureCombo->setFocus(FALSE); + } +} + +void LLBottomTray::refreshGestures() +{ + if (mGestureCombo) + { + + //store current selection so we can maintain it + std::string cur_gesture = mGestureCombo->getValue().asString(); + mGestureCombo->selectFirstItem(); + std::string label = mGestureCombo->getValue().asString();; + // clear + mGestureCombo->clearRows(); + + // collect list of unique gestures + std::map unique; + LLGestureManager::item_map_t::iterator it; + for (it = gGestureManager.mActive.begin(); it != gGestureManager.mActive.end(); ++it) + { + LLMultiGesture* gesture = (*it).second; + if (gesture) + { + if (!gesture->mTrigger.empty()) + { + unique[gesture->mTrigger] = TRUE; + } + } + } + + // add unique gestures + std::map ::iterator it2; + for (it2 = unique.begin(); it2 != unique.end(); ++it2) + { + mGestureCombo->addSimpleElement((*it2).first); + } + + mGestureCombo->sortByName(); + // Insert label after sorting, at top, with separator below it + mGestureCombo->addSeparator(ADD_TOP); + mGestureCombo->addSimpleElement(getString("gesture_label"), ADD_TOP); + + if (!cur_gesture.empty()) + { + mGestureCombo->selectByValue(LLSD(cur_gesture)); + } + else + { + mGestureCombo->selectFirstItem(); + } + } +} //virtual void LLBottomTray::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) @@ -236,8 +363,6 @@ void LLBottomTray::sessionAdded(const LLUUID& session_id, const std::string& nam LLIMChiclet* chicklet = (LLIMChiclet *)getChicletPanel()->createChiclet(&sid); chicklet->setIMSessionName(name); chicklet->setOtherParticipantId(other_participant_id); - - getChicletPanel()->arrange(); } } } @@ -249,21 +374,48 @@ void LLBottomTray::sessionRemoved(const LLUUID& session_id) { LLSD sid(session_id); getChicletPanel()->removeIMChiclet(&sid); - getChicletPanel()->arrange(); } } -void LLBottomTray::sendChat( EChatType type ) +//virtual +void LLBottomTray::onFocusLost() +{ + if (gAgent.cameraMouselook()) + { + setVisible(FALSE); + } +} + +//virtual +void LLBottomTray::onVisibilityChange(BOOL curVisibilityIn) { - LLLineEditor* chat_box = getChatBox(); + BOOL visibility = gAgent.cameraMouselook() ? false : true; + + if (mChicletPanel && mChicletPanel->getVisible() == visibility) + return; + + if (mChicletPanel) + mChicletPanel->setVisible(visibility); + + if (mIMWell) + mIMWell->setVisible(visibility); - if (chat_box) + if (mSysWell) + mSysWell->setVisible(visibility); + + if (mSeparator) + mSeparator->setVisible(visibility); +} + +void LLBottomTray::sendChat( EChatType type ) +{ + if (mChatBox) { - LLWString text = chat_box->getConvertedText(); + LLWString text = mChatBox->getConvertedText(); if (!text.empty()) { // store sent line in history, duplicates will get filtered - chat_box->updateHistory(); + mChatBox->updateHistory(); // Check if this is destined for another channel S32 channel = 0; stripChannelNumber(text, &channel); -- cgit v1.2.3 From d6101558a171dbd2390792ac1e78d09fc2c27711 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 6 Jul 2009 21:58:04 +0000 Subject: Merge xui-army-5 to viewer-2, includes layout, art, and color changes, also UI color refactoring and new FreeType font library on Linux. svn merge -r126038:126164 svn+ssh://svn.lindenlab.com/svn/linden/branches/skinning/xui-army-5 --- indra/newview/llbottomtray.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index d26da81179..604a77dac0 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -93,6 +93,11 @@ LLBottomTray::LLBottomTray() } LLIMMgr::getInstance()->addSessionObserver(this); + + //this is to fix a crash that occurs because LLBottomTray is a singleton + //and thus is deleted at the end of the viewers lifetime, but to be cleanly + //destroyed LLBottomTray requires some subsystems that are long gone + LLUI::getRootView()->addChild(this); } LLBottomTray::~LLBottomTray() @@ -495,4 +500,3 @@ LLWString LLBottomTray::stripChannelNumber(const LLWString &mesg, S32* channel) return mesg; } } - -- cgit v1.2.3 From f26f7e3e29019abf3a10f6925e30baca19eb4e2d Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Wed, 8 Jul 2009 05:19:19 +0000 Subject: merge -r 889-936 https://svn.aws.productengine.com/secondlife/pe/stable/ -> viewer-2-0 Also: * Moved media remote shortcut to Communicate menu * Changed mini map menu to toggle instead of show --- indra/newview/llbottomtray.cpp | 91 +++++++++++++++++++++++++++++++++--------- 1 file changed, 72 insertions(+), 19 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 604a77dac0..136316fbbe 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -34,7 +34,8 @@ #include "llbottomtray.h" #include "llagent.h" #include "llchiclet.h" -#include "lllayoutstack.h" +#include "llfloaterreg.h" +#include "llflyoutbutton.h" #include "llkeyboard.h" #include "llgesturemgr.h" #include "llanimationstates.h" @@ -54,15 +55,22 @@ LLBottomTray* gBottomTray = NULL; LLBottomTray::LLBottomTray() : mLastSpecialChatChannel(0) , mGestureLabelTimer() + , mChatBox(NULL) + , mChicletPanel(NULL) + , mIMWell(NULL) + , mSysWell(NULL) + , mTalkBtn(NULL) + , mGestureCombo(NULL) { LLUICtrlFactory::getInstance()->buildPanel(this,"panel_bottomtray.xml"); mChicletPanel = getChild("chiclet_list",TRUE,FALSE); mIMWell = getChild("im_well",TRUE,FALSE); mSysWell = getChild("sys_well",TRUE,FALSE); - mSeparator = getChild("well_separator",TRUE,FALSE); mChatBox = getChild("chat_box",TRUE,FALSE); + mChicletPanel->setChicletClickCallback(boost::bind(&LLBottomTray::onChicletClick,this,_1)); + if (mChatBox) { mChatBox->setCommitCallback(boost::bind(&LLBottomTray::onChatBoxCommit, this)); @@ -109,12 +117,20 @@ LLBottomTray::~LLBottomTray() } } +void LLBottomTray::onChicletClick(LLUICtrl* ctrl) +{ + LLIMChiclet* chiclet = dynamic_cast(ctrl); + if (chiclet) + { + LLFloaterReg::showInstance("communicate", chiclet->getIMSessionId()); + } +} + void LLBottomTray::onChatBoxCommit() { if (mChatBox && mChatBox->getText().length() > 0) { sendChat(CHAT_TYPE_NORMAL); - mChatBox->setText(LLStringExplicit("")); } gAgent.stopTyping(); @@ -269,6 +285,17 @@ void LLBottomTray::refresh() } } +void LLBottomTray::updateRightPosition(const S32 new_right_position) +{ + LLRect rc = getRect(); + if (new_right_position != rc.mRight) + { + rc.mRight = new_right_position; + reshape(rc.getWidth(), rc.getHeight(), FALSE); + setRect(rc); + } +} + void LLBottomTray::onCommitGesture(LLUICtrl* ctrl) { LLCtrlListInterface* gestures = mGestureCombo ? mGestureCombo->getListInterface() : NULL; @@ -357,15 +384,13 @@ void LLBottomTray::sessionAdded(const LLUUID& session_id, const std::string& nam { if(getChicletPanel()) { - LLSD sid(session_id); - - if(getChicletPanel()->findIMChiclet(&sid)) + if(getChicletPanel()->findIMChiclet(session_id)) { } else { - LLIMChiclet* chicklet = (LLIMChiclet *)getChicletPanel()->createChiclet(&sid); + LLIMChiclet* chicklet = (LLIMChiclet *)getChicletPanel()->createChiclet(session_id); chicklet->setIMSessionName(name); chicklet->setOtherParticipantId(other_participant_id); } @@ -377,8 +402,7 @@ void LLBottomTray::sessionRemoved(const LLUUID& session_id) { if(getChicletPanel()) { - LLSD sid(session_id); - getChicletPanel()->removeIMChiclet(&sid); + getChicletPanel()->removeIMChiclet(session_id); } } @@ -391,25 +415,52 @@ void LLBottomTray::onFocusLost() } } +// virtual +BOOL LLBottomTray::handleKeyHere( KEY key, MASK mask ) +{ + BOOL handled = FALSE; + + // ALT-RETURN is reserved for windowed/fullscreen toggle + if( KEY_RETURN == key && mask == MASK_CONTROL) + { + // shout + sendChat(CHAT_TYPE_SHOUT); + handled = TRUE; + } + + return handled; +} + //virtual -void LLBottomTray::onVisibilityChange(BOOL curVisibilityIn) +// setVisible used instead of onVisibilityChange, since LLAgent calls it on entering/leaving mouselook mode. +// If bottom tray is already visible in mouselook mode, then onVisibilityChange will not be called from setVisible(true), +void LLBottomTray::setVisible(BOOL visible) { + LLPanel::setVisible(visible); + + BOOL visibility = gAgent.cameraMouselook() ? false : true; - if (mChicletPanel && mChicletPanel->getVisible() == visibility) + LLViewBorder* separator = getChild("well_separator",TRUE,FALSE); + + if (separator && separator->getVisible() == visibility) return; - if (mChicletPanel) - mChicletPanel->setVisible(visibility); + if (separator) + separator->setVisible(visibility); - if (mIMWell) - mIMWell->setVisible(visibility); + LLPanel* p = getChild("chiclet_list_panel",TRUE,FALSE); + if (p) + p->setVisible(visibility); - if (mSysWell) - mSysWell->setVisible(visibility); + p = getChild("im_well_panel",TRUE,FALSE); + if (p) + p->setVisible(visibility); + + p = getChild("sys_well_panel",TRUE,FALSE); + if (p) + p->setVisible(visibility); - if (mSeparator) - mSeparator->setVisible(visibility); } void LLBottomTray::sendChat( EChatType type ) @@ -446,6 +497,8 @@ void LLBottomTray::sendChat( EChatType type ) sendChatFromViewer(utf8_revised_text, type, TRUE); } } + + mChatBox->setText(LLStringExplicit("")); } gAgent.stopTyping(); -- cgit v1.2.3 From b90099b4b020579b6a1f650f0bfafc48142bad66 Mon Sep 17 00:00:00 2001 From: Jiao Li Date: Thu, 9 Jul 2009 07:00:30 +0000 Subject: 1. created prototype stand up button ins LLBottomTray 2. re-arranged LLFloaterReg::add alphabetically to be reviewed --- indra/newview/llbottomtray.cpp | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 136316fbbe..d7fd97e067 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -43,7 +43,9 @@ //FIXME: temporary, for send_chat_from_viewer() proto #include "llchatbar.h" - +//FIXME: temporary, for stand up proto +#include "llselectmgr.h" +#include "llvoavatarself.h" // // Globals // @@ -61,6 +63,7 @@ LLBottomTray::LLBottomTray() , mSysWell(NULL) , mTalkBtn(NULL) , mGestureCombo(NULL) + , mStandUpBtn(NULL) ////FIXME: temporary, for stand up proto { LLUICtrlFactory::getInstance()->buildPanel(this,"panel_bottomtray.xml"); @@ -100,6 +103,13 @@ LLBottomTray::LLBottomTray() refreshGestures(); } + ////FIXME: temporary, for stand up proto + mStandUpBtn = getChild ("stand", TRUE, FALSE); + if (mStandUpBtn) + { + mStandUpBtn->setCommitCallback(boost::bind(&LLBottomTray::onCommitStandUp, this, _1)); + } + LLIMMgr::getInstance()->addSessionObserver(this); //this is to fix a crash that occurs because LLBottomTray is a singleton @@ -283,8 +293,31 @@ void LLBottomTray::refresh() { gAgent.stopTyping(); } + + LLPanel::refresh(); } +void LLBottomTray::draw() +{ + refreshStandUp(); + LLPanel::draw(); +} +void LLBottomTray::refreshStandUp() +{ + //FIXME: temporary, for stand up proto + BOOL sitting = FALSE; + if (gAgent.getAvatarObject()) + { + sitting = gAgent.getAvatarObject()->mIsSitting; + } + + if (mStandUpBtn && mStandUpBtn->getVisible() != sitting) + { + mStandUpBtn->setVisible(sitting); + sendChildToFront(mStandUpBtn); + moveChildToBackOfTabGroup(mStandUpBtn); + } +} void LLBottomTray::updateRightPosition(const S32 new_right_position) { LLRect rc = getRect(); @@ -329,6 +362,13 @@ void LLBottomTray::onCommitGesture(LLUICtrl* ctrl) } } +//FIXME: temporary, for stand up proto +void LLBottomTray::onCommitStandUp(LLUICtrl* ctrl) +{ + LLSelectMgr::getInstance()->deselectAllForStandingUp(); + gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); +} + void LLBottomTray::refreshGestures() { if (mGestureCombo) -- cgit v1.2.3 From 73a97010e6c8c7874fdc1778ab46e492f77d9394 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Tue, 21 Jul 2009 00:57:23 +0000 Subject: merge https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0/indra@1059 https://svn.aws.productengine.com/secondlife/pe/stable-1/indra@1070 -> svn+ssh://svn.lindenlab.com/svn/linden/branches/viewer/viewer-2.0.0-3 --- indra/newview/llbottomtray.cpp | 361 +++++++++++++++++++++++++++-------------- 1 file changed, 236 insertions(+), 125 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index d7fd97e067..e37b660951 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -40,24 +40,133 @@ #include "llgesturemgr.h" #include "llanimationstates.h" #include "llmultigesture.h" +#include "llviewerstats.h" +#include "llcommandhandler.h" -//FIXME: temporary, for send_chat_from_viewer() proto -#include "llchatbar.h" //FIXME: temporary, for stand up proto #include "llselectmgr.h" #include "llvoavatarself.h" -// -// Globals -// -//FIXME: made it adjustable -const F32 AGENT_TYPING_TIMEOUT = 5.f; // seconds -LLBottomTray* gBottomTray = NULL; +S32 LLBottomTray::mLastSpecialChatChannel = 0; -LLBottomTray::LLBottomTray() - : mLastSpecialChatChannel(0) +// legacy calllback glue +void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); + +static LLDefaultChildRegistry::Register r("gesture_combo_box"); + +LLGestureComboBox::LLGestureComboBox(const LLComboBox::Params& p) + : LLComboBox(p) , mGestureLabelTimer() - , mChatBox(NULL) +{ + setCommitCallback(boost::bind(&LLGestureComboBox::onCommitGesture, this, _1)); + + // now register us as observer since we have a place to put the results + gGestureManager.addObserver(this); + + // refresh list from current active gestures + refreshGestures(); +} + +LLGestureComboBox::~LLGestureComboBox() +{ + gGestureManager.removeObserver(this); +} + +void LLGestureComboBox::refreshGestures() +{ + //store current selection so we can maintain it + std::string cur_gesture = getValue().asString(); + selectFirstItem(); + std::string label = getValue().asString();; + // clear + clearRows(); + + // collect list of unique gestures + std::map unique; + LLGestureManager::item_map_t::iterator it; + for (it = gGestureManager.mActive.begin(); it != gGestureManager.mActive.end(); ++it) + { + LLMultiGesture* gesture = (*it).second; + if (gesture) + { + if (!gesture->mTrigger.empty()) + { + unique[gesture->mTrigger] = TRUE; + } + } + } + + // add unique gestures + std::map ::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); + //FIXME: get it from xml + addSimpleElement("Gestures", ADD_TOP); + + if (!cur_gesture.empty()) + { + selectByValue(LLSD(cur_gesture)); + } + else + { + selectFirstItem(); + } +} + +void LLGestureComboBox::onCommitGesture(LLUICtrl* ctrl) +{ + LLCtrlListInterface* gestures = getListInterface(); + if (gestures) + { + S32 index = gestures->getFirstSelectedIndex(); + if (index == 0) + { + 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; + gGestureManager.triggerAndReviseString(text, &revised_text); + + revised_text = utf8str_trim(revised_text); + if (!revised_text.empty()) + { + // Don't play nodding animation + LLBottomTray::sendChatFromViewer(revised_text, CHAT_TYPE_NORMAL, FALSE); + } + } + + mGestureLabelTimer.start(); + // free focus back to chat bar + setFocus(FALSE); +} + +//virtual +void LLGestureComboBox::draw() +{ + // HACK: Leave the name of the gesture in place for a few seconds. + const F32 SHOW_GESTURE_NAME_TIME = 2.f; + if (mGestureLabelTimer.getStarted() && mGestureLabelTimer.getElapsedTimeF32() > SHOW_GESTURE_NAME_TIME) + { + LLCtrlListInterface* gestures = getListInterface(); + if (gestures) gestures->selectFirstItem(); + mGestureLabelTimer.stop(); + } + + LLComboBox::draw(); +} + +LLBottomTray::LLBottomTray(const LLSD&) + : mChatBox(NULL) , mChicletPanel(NULL) , mIMWell(NULL) , mSysWell(NULL) @@ -72,7 +181,7 @@ LLBottomTray::LLBottomTray() mSysWell = getChild("sys_well",TRUE,FALSE); mChatBox = getChild("chat_box",TRUE,FALSE); - mChicletPanel->setChicletClickCallback(boost::bind(&LLBottomTray::onChicletClick,this,_1)); + mChicletPanel->setChicletClickedCallback(boost::bind(&LLBottomTray::onChicletClick,this,_1)); if (mChatBox) { @@ -91,17 +200,7 @@ LLBottomTray::LLBottomTray() } - mGestureCombo = getChild( "Gesture", TRUE, FALSE); - if (mGestureCombo) - { - mGestureCombo->setCommitCallback(boost::bind(&LLBottomTray::onCommitGesture, this, _1)); - - // now register us as observer since we have a place to put the results - gGestureManager.addObserver(this); - - // refresh list from current active gestures - refreshGestures(); - } + mGestureCombo = getChild( "Gesture", TRUE, FALSE); ////FIXME: temporary, for stand up proto mStandUpBtn = getChild ("stand", TRUE, FALSE); @@ -116,11 +215,13 @@ LLBottomTray::LLBottomTray() //and thus is deleted at the end of the viewers lifetime, but to be cleanly //destroyed LLBottomTray requires some subsystems that are long gone LLUI::getRootView()->addChild(this); + + // Necessary for focus movement among child controls + setFocusRoot(TRUE); } LLBottomTray::~LLBottomTray() { - gGestureManager.removeObserver(this); if (!LLSingleton::destroyed()) { LLIMMgr::getInstance()->removeSessionObserver(this); @@ -132,7 +233,7 @@ void LLBottomTray::onChicletClick(LLUICtrl* ctrl) LLIMChiclet* chiclet = dynamic_cast(ctrl); if (chiclet) { - LLFloaterReg::showInstance("communicate", chiclet->getIMSessionId()); + LLFloaterReg::showInstance("communicate", chiclet->getSessionId()); } } @@ -278,30 +379,23 @@ void LLBottomTray::onChatBoxFocusLost(LLFocusableElement* caller, void* userdata gAgent.stopTyping(); } -void LLBottomTray::refresh() +BOOL LLBottomTray::inputEditorHasFocus() { - // HACK: Leave the name of the gesture in place for a few seconds. - const F32 SHOW_GESTURE_NAME_TIME = 2.f; - if (mGestureLabelTimer.getStarted() && mGestureLabelTimer.getElapsedTimeF32() > SHOW_GESTURE_NAME_TIME) - { - LLCtrlListInterface* gestures = mGestureCombo ? mGestureCombo->getListInterface() : NULL; - if (gestures) gestures->selectFirstItem(); - mGestureLabelTimer.stop(); - } + return mChatBox && mChatBox->hasFocus(); +} - if ((gAgent.getTypingTime() > AGENT_TYPING_TIMEOUT) && (gAgent.getRenderState() & AGENT_STATE_TYPING)) - { - gAgent.stopTyping(); - } - - LLPanel::refresh(); +std::string LLBottomTray::getCurrentChat() +{ + return mChatBox ? mChatBox->getText() : LLStringUtil::null; } +//virtual void LLBottomTray::draw() { refreshStandUp(); LLPanel::draw(); } + void LLBottomTray::refreshStandUp() { //FIXME: temporary, for stand up proto @@ -329,39 +423,6 @@ void LLBottomTray::updateRightPosition(const S32 new_right_position) } } -void LLBottomTray::onCommitGesture(LLUICtrl* ctrl) -{ - LLCtrlListInterface* gestures = mGestureCombo ? mGestureCombo->getListInterface() : NULL; - if (gestures) - { - S32 index = gestures->getFirstSelectedIndex(); - if (index == 0) - { - 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; - gGestureManager.triggerAndReviseString(text, &revised_text); - - revised_text = utf8str_trim(revised_text); - if (!revised_text.empty()) - { - // Don't play nodding animation - sendChatFromViewer(revised_text, CHAT_TYPE_NORMAL, FALSE); - } - } - mGestureLabelTimer.start(); - if (mGestureCombo != NULL) - { - // free focus back to chat bar - mGestureCombo->setFocus(FALSE); - } -} - //FIXME: temporary, for stand up proto void LLBottomTray::onCommitStandUp(LLUICtrl* ctrl) { @@ -369,80 +430,56 @@ void LLBottomTray::onCommitStandUp(LLUICtrl* ctrl) gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); } -void LLBottomTray::refreshGestures() +//virtual +void LLBottomTray::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { - if (mGestureCombo) + if(getChicletPanel()) { - - //store current selection so we can maintain it - std::string cur_gesture = mGestureCombo->getValue().asString(); - mGestureCombo->selectFirstItem(); - std::string label = mGestureCombo->getValue().asString();; - // clear - mGestureCombo->clearRows(); - - // collect list of unique gestures - std::map unique; - LLGestureManager::item_map_t::iterator it; - for (it = gGestureManager.mActive.begin(); it != gGestureManager.mActive.end(); ++it) - { - LLMultiGesture* gesture = (*it).second; - if (gesture) - { - if (!gesture->mTrigger.empty()) - { - unique[gesture->mTrigger] = TRUE; - } - } - } - - // add unique gestures - std::map ::iterator it2; - for (it2 = unique.begin(); it2 != unique.end(); ++it2) + if(getChicletPanel()->findChiclet(session_id)) { - mGestureCombo->addSimpleElement((*it2).first); - } - - mGestureCombo->sortByName(); - // Insert label after sorting, at top, with separator below it - mGestureCombo->addSeparator(ADD_TOP); - mGestureCombo->addSimpleElement(getString("gesture_label"), ADD_TOP); - - if (!cur_gesture.empty()) - { - mGestureCombo->selectByValue(LLSD(cur_gesture)); + } else { - mGestureCombo->selectFirstItem(); + LLIMChiclet* chicklet = getChicletPanel()->createChiclet(session_id); + chicklet->setIMSessionName(name); + chicklet->setOtherParticipantId(other_participant_id); + + if(getChicletPanel()->getChicletCount()) + { + setChicletPanelVisible(true); + } } } } //virtual -void LLBottomTray::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) +void LLBottomTray::sessionRemoved(const LLUUID& session_id) { if(getChicletPanel()) { - if(getChicletPanel()->findIMChiclet(session_id)) - { + getChicletPanel()->removeChiclet(session_id); - } - else + if(0 == getChicletPanel()->getChicletCount()) { - LLIMChiclet* chicklet = (LLIMChiclet *)getChicletPanel()->createChiclet(session_id); - chicklet->setIMSessionName(name); - chicklet->setOtherParticipantId(other_participant_id); + setChicletPanelVisible(false); } } } -//virtual -void LLBottomTray::sessionRemoved(const LLUUID& session_id) +void LLBottomTray::setChicletPanelVisible(bool visible) { - if(getChicletPanel()) + // Chiclet panel is placed in layout_panel, which is child of layout_stack. + // To gide chiclet panel we need to also hide layout_panel to make layout_stack resize its + // content. + getChicletPanel()->getParent()->setVisible(visible); + if(visible) { - getChicletPanel()->removeIMChiclet(session_id); + // Reshape layout stack after making chiclet panel visible + LLView* layout = getChild("toolbar_stack"); + LLRect rc = layout->getRect(); + layout->reshape(rc.getWidth(), rc.getHeight()); + layout->setRect(rc); } } @@ -503,6 +540,41 @@ void LLBottomTray::setVisible(BOOL visible) } +// static +void LLBottomTray::startChat(const char* line) +{ + LLBottomTray *bt = LLBottomTray::getInstance(); + + if(bt && bt->getChatBox()) + { + bt->setVisible(TRUE); + bt->getChatBox()->setFocus(TRUE); + + if (line) + { + std::string line_string(line); + bt->getChatBox()->setText(line_string); + } + + bt->getChatBox()->setCursorToEnd(); + } +} + +// Exit "chat mode" and do the appropriate focus changes +// static +void LLBottomTray::stopChat() +{ + LLBottomTray *bt = LLBottomTray::getInstance(); + + if(bt && bt->getChatBox()) + { + bt->getChatBox()->setFocus(FALSE); + } + + // stop typing animation + gAgent.stopTyping(); +} + void LLBottomTray::sendChat( EChatType type ) { if (mChatBox) @@ -593,3 +665,42 @@ LLWString LLBottomTray::stripChannelNumber(const LLWString &mesg, S32* channel) return mesg; } } + +void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel) +{ + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_ChatFromViewer); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_ChatData); + msg->addStringFast(_PREHASH_Message, utf8_out_text); + msg->addU8Fast(_PREHASH_Type, type); + msg->addS32("Channel", channel); + + gAgent.sendReliableMessage(); + + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CHAT_COUNT); +} + +class LLChatHandler : public LLCommandHandler +{ +public: + // not allowed from outside the app + LLChatHandler() : LLCommandHandler("chat", true) { } + + // Your code here + bool handle(const LLSD& tokens, const LLSD& query_map, + LLWebBrowserCtrl* web) + { + if (tokens.size() < 2) return false; + S32 channel = tokens[0].asInteger(); + std::string mesg = tokens[1].asString(); + send_chat_from_viewer(mesg, CHAT_TYPE_NORMAL, channel); + return true; + } +}; + +// Creating the object registers with the dispatcher. +LLChatHandler gChatHandler; + -- cgit v1.2.3 From cef46d16453873691406c22be39ce0ee5e8076d1 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Tue, 21 Jul 2009 00:59:14 +0000 Subject: merge https://svn.aws.productengine.com/secondlife/pe/stable-1/indra -r 1078-1091 -> viewer-2.0.0-3 --- indra/newview/llbottomtray.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index e37b660951..d84dd09812 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -47,7 +47,7 @@ #include "llselectmgr.h" #include "llvoavatarself.h" -S32 LLBottomTray::mLastSpecialChatChannel = 0; +S32 LLBottomTray::sLastSpecialChatChannel = 0; // legacy calllback glue void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); @@ -412,16 +412,6 @@ void LLBottomTray::refreshStandUp() moveChildToBackOfTabGroup(mStandUpBtn); } } -void LLBottomTray::updateRightPosition(const S32 new_right_position) -{ - LLRect rc = getRect(); - if (new_right_position != rc.mRight) - { - rc.mRight = new_right_position; - reshape(rc.getWidth(), rc.getHeight(), FALSE); - setRect(rc); - } -} //FIXME: temporary, for stand up proto void LLBottomTray::onCommitStandUp(LLUICtrl* ctrl) @@ -624,7 +614,7 @@ LLWString LLBottomTray::stripChannelNumber(const LLWString &mesg, S32* channel) && mesg[1] == '/') { // This is a "repeat channel send" - *channel = mLastSpecialChatChannel; + *channel = sLastSpecialChatChannel; return mesg.substr(2, mesg.length() - 2); } else if (mesg[0] == '/' @@ -654,8 +644,8 @@ LLWString LLBottomTray::stripChannelNumber(const LLWString &mesg, S32* channel) pos++; } - mLastSpecialChatChannel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10); - *channel = mLastSpecialChatChannel; + sLastSpecialChatChannel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10); + *channel = sLastSpecialChatChannel; return mesg.substr(pos, mesg.length() - pos); } else -- cgit v1.2.3 From 8f7ec64899c54dcee6caa0307510cc4003ba7bdd Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 27 Jul 2009 17:56:26 +0000 Subject: Merged skinning-17 into viewer-2 for bug fixes. Commented out new IM window for now, not complete. Merging revisions 127913-128319 of svn+ssh://svn.lindenlab.com/svn/linden/branches/skinning/skinning-17 into D:\viewer-2.0.0-3, respecting ancestry --- indra/newview/llbottomtray.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index d84dd09812..963946e888 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -32,11 +32,14 @@ #include "llviewerprecompiledheaders.h" // must be first include #include "llbottomtray.h" + #include "llagent.h" #include "llchiclet.h" #include "llfloaterreg.h" #include "llflyoutbutton.h" +#include "llimpanel.h" #include "llkeyboard.h" +#include "lllineeditor.h" #include "llgesturemgr.h" #include "llanimationstates.h" #include "llmultigesture.h" @@ -233,7 +236,13 @@ void LLBottomTray::onChicletClick(LLUICtrl* ctrl) LLIMChiclet* chiclet = dynamic_cast(ctrl); if (chiclet) { + // Until you can type into an IM Window and have a conversation, + // still show the old communicate window LLFloaterReg::showInstance("communicate", chiclet->getSessionId()); + // DISABLED IN VIEWER-2 BRANCH UNTIL FEATURE IS DONE -- James + //// Show after comm window so it is frontmost (and hence will not + //// auto-hide) + //LLIMFloater::show(chiclet->getSessionId()); } } -- cgit v1.2.3 From e97f7728a90dd66014f6b3f0cd5e8d4c71f48691 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Thu, 30 Jul 2009 23:22:41 +0000 Subject: merge https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0/indra@1170 https://svn.aws.productengine.com/secondlife/pe/stable-1/indra@1187 -> viewer-2.0.0-3 --- indra/newview/llbottomtray.cpp | 543 ++--------------------------------------- 1 file changed, 23 insertions(+), 520 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 963946e888..1781e6b3f1 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -37,174 +37,30 @@ #include "llchiclet.h" #include "llfloaterreg.h" #include "llflyoutbutton.h" -#include "llimpanel.h" -#include "llkeyboard.h" -#include "lllineeditor.h" -#include "llgesturemgr.h" -#include "llanimationstates.h" -#include "llmultigesture.h" -#include "llviewerstats.h" -#include "llcommandhandler.h" +#include "llnearbychatbar.h" //FIXME: temporary, for stand up proto #include "llselectmgr.h" #include "llvoavatarself.h" -S32 LLBottomTray::sLastSpecialChatChannel = 0; - -// legacy calllback glue -void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel); - -static LLDefaultChildRegistry::Register r("gesture_combo_box"); - -LLGestureComboBox::LLGestureComboBox(const LLComboBox::Params& p) - : LLComboBox(p) - , mGestureLabelTimer() -{ - setCommitCallback(boost::bind(&LLGestureComboBox::onCommitGesture, this, _1)); - - // now register us as observer since we have a place to put the results - gGestureManager.addObserver(this); - - // refresh list from current active gestures - refreshGestures(); -} - -LLGestureComboBox::~LLGestureComboBox() -{ - gGestureManager.removeObserver(this); -} - -void LLGestureComboBox::refreshGestures() -{ - //store current selection so we can maintain it - std::string cur_gesture = getValue().asString(); - selectFirstItem(); - std::string label = getValue().asString();; - // clear - clearRows(); - - // collect list of unique gestures - std::map unique; - LLGestureManager::item_map_t::iterator it; - for (it = gGestureManager.mActive.begin(); it != gGestureManager.mActive.end(); ++it) - { - LLMultiGesture* gesture = (*it).second; - if (gesture) - { - if (!gesture->mTrigger.empty()) - { - unique[gesture->mTrigger] = TRUE; - } - } - } - - // add unique gestures - std::map ::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); - //FIXME: get it from xml - addSimpleElement("Gestures", ADD_TOP); - - if (!cur_gesture.empty()) - { - selectByValue(LLSD(cur_gesture)); - } - else - { - selectFirstItem(); - } -} - -void LLGestureComboBox::onCommitGesture(LLUICtrl* ctrl) -{ - LLCtrlListInterface* gestures = getListInterface(); - if (gestures) - { - S32 index = gestures->getFirstSelectedIndex(); - if (index == 0) - { - 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; - gGestureManager.triggerAndReviseString(text, &revised_text); - - revised_text = utf8str_trim(revised_text); - if (!revised_text.empty()) - { - // Don't play nodding animation - LLBottomTray::sendChatFromViewer(revised_text, CHAT_TYPE_NORMAL, FALSE); - } - } - - mGestureLabelTimer.start(); - // free focus back to chat bar - setFocus(FALSE); -} - -//virtual -void LLGestureComboBox::draw() -{ - // HACK: Leave the name of the gesture in place for a few seconds. - const F32 SHOW_GESTURE_NAME_TIME = 2.f; - if (mGestureLabelTimer.getStarted() && mGestureLabelTimer.getElapsedTimeF32() > SHOW_GESTURE_NAME_TIME) - { - LLCtrlListInterface* gestures = getListInterface(); - if (gestures) gestures->selectFirstItem(); - mGestureLabelTimer.stop(); - } - - LLComboBox::draw(); -} - LLBottomTray::LLBottomTray(const LLSD&) - : mChatBox(NULL) - , mChicletPanel(NULL) + : mChicletPanel(NULL) , mIMWell(NULL) , mSysWell(NULL) , mTalkBtn(NULL) - , mGestureCombo(NULL) , mStandUpBtn(NULL) ////FIXME: temporary, for stand up proto + , mNearbyChatBar(NULL) { + mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL); + LLUICtrlFactory::getInstance()->buildPanel(this,"panel_bottomtray.xml"); mChicletPanel = getChild("chiclet_list",TRUE,FALSE); mIMWell = getChild("im_well",TRUE,FALSE); mSysWell = getChild("sys_well",TRUE,FALSE); - mChatBox = getChild("chat_box",TRUE,FALSE); mChicletPanel->setChicletClickedCallback(boost::bind(&LLBottomTray::onChicletClick,this,_1)); - if (mChatBox) - { - mChatBox->setCommitCallback(boost::bind(&LLBottomTray::onChatBoxCommit, this)); - mChatBox->setKeystrokeCallback(&onChatBoxKeystroke, this); - mChatBox->setFocusLostCallback(&onChatBoxFocusLost, this); - - mChatBox->setIgnoreArrowKeys(TRUE); - mChatBox->setCommitOnFocusLost( FALSE ); - mChatBox->setRevertOnEsc( FALSE ); - mChatBox->setIgnoreTab(TRUE); - mChatBox->setPassDelete(TRUE); - mChatBox->setReplaceNewlinesWithSpaces(FALSE); - mChatBox->setMaxTextLength(1023); - mChatBox->setEnableLineHistory(TRUE); - - } - - mGestureCombo = getChild( "Gesture", TRUE, FALSE); - ////FIXME: temporary, for stand up proto mStandUpBtn = getChild ("stand", TRUE, FALSE); if (mStandUpBtn) @@ -246,156 +102,15 @@ void LLBottomTray::onChicletClick(LLUICtrl* ctrl) } } -void LLBottomTray::onChatBoxCommit() -{ - if (mChatBox && mChatBox->getText().length() > 0) - { - sendChat(CHAT_TYPE_NORMAL); - } - - gAgent.stopTyping(); -} - -void LLBottomTray::sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate) -{ - sendChatFromViewer(utf8str_to_wstring(utf8text), type, animate); -} - -void LLBottomTray::sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate) -{ - // Look for "/20 foo" channel chats. - S32 channel = 0; - LLWString out_text = stripChannelNumber(wtext, &channel); - std::string utf8_out_text = wstring_to_utf8str(out_text); - std::string utf8_text = wstring_to_utf8str(wtext); - - utf8_text = utf8str_trim(utf8_text); - if (!utf8_text.empty()) - { - utf8_text = utf8str_truncate(utf8_text, MAX_STRING - 1); - } - - // Don't animate for chats people can't hear (chat to scripts) - if (animate && (channel == 0)) - { - if (type == CHAT_TYPE_WHISPER) - { - lldebugs << "You whisper " << utf8_text << llendl; - gAgent.sendAnimationRequest(ANIM_AGENT_WHISPER, ANIM_REQUEST_START); - } - else if (type == CHAT_TYPE_NORMAL) - { - lldebugs << "You say " << utf8_text << llendl; - gAgent.sendAnimationRequest(ANIM_AGENT_TALK, ANIM_REQUEST_START); - } - else if (type == CHAT_TYPE_SHOUT) - { - lldebugs << "You shout " << utf8_text << llendl; - gAgent.sendAnimationRequest(ANIM_AGENT_SHOUT, ANIM_REQUEST_START); - } - else - { - llinfos << "send_chat_from_viewer() - invalid volume" << llendl; - return; - } - } - else - { - if (type != CHAT_TYPE_START && type != CHAT_TYPE_STOP) - { - lldebugs << "Channel chat: " << utf8_text << llendl; - } - } - - send_chat_from_viewer(utf8_out_text, type, channel); -} - -// static -void LLBottomTray::onChatBoxKeystroke(LLLineEditor* caller, void* userdata) -{ - LLBottomTray* self = (LLBottomTray *)userdata; - - LLWString raw_text; - if (self->getChatBox()) raw_text = self->getChatBox()->getWText(); - - // Can't trim the end, because that will cause autocompletion - // to eat trailing spaces that might be part of a gesture. - LLWStringUtil::trimHead(raw_text); - - S32 length = raw_text.length(); - - if( (length > 0) && (raw_text[0] != '/') ) // forward slash is used for escape (eg. emote) sequences - { - gAgent.startTyping(); - } - else - { - gAgent.stopTyping(); - } - - /* Doesn't work -- can't tell the difference between a backspace - that killed the selection vs. backspace at the end of line. - if (length > 1 - && text[0] == '/' - && key == KEY_BACKSPACE) - { - // the selection will already be deleted, but we need to trim - // off the character before - std::string new_text = raw_text.substr(0, length-1); - self->mInputEditor->setText( new_text ); - self->mInputEditor->setCursorToEnd(); - length = length - 1; - } - */ - - KEY key = gKeyboard->currentKey(); - - // Ignore "special" keys, like backspace, arrows, etc. - if (length > 1 - && raw_text[0] == '/' - && key < KEY_SPECIAL) - { - // we're starting a gesture, attempt to autocomplete - - std::string utf8_trigger = wstring_to_utf8str(raw_text); - std::string utf8_out_str(utf8_trigger); - - if (gGestureManager.matchPrefix(utf8_trigger, &utf8_out_str)) - { - if (self->getChatBox()) - { - std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size()); - self->getChatBox()->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part - S32 outlength = self->getChatBox()->getLength(); // in characters - - // Select to end of line, starting from the character - // after the last one the user typed. - self->getChatBox()->setSelection(length, outlength); - } - } - - //llinfos << "GESTUREDEBUG " << trigger - // << " len " << length - // << " outlen " << out_str.getLength() - // << llendl; - } -} - -// static -void LLBottomTray::onChatBoxFocusLost(LLFocusableElement* caller, void* userdata) +void* LLBottomTray::createNearbyChatBar(void* userdata) { - // stop typing animation - gAgent.stopTyping(); -} + LLBottomTray *bt = LLBottomTray::getInstance(); + if (!bt) + return NULL; -BOOL LLBottomTray::inputEditorHasFocus() -{ - return mChatBox && mChatBox->hasFocus(); -} + bt->mNearbyChatBar = new LLNearbyChatBar(); -std::string LLBottomTray::getCurrentChat() -{ - return mChatBox ? mChatBox->getText() : LLStringUtil::null; + return bt->mNearbyChatBar; } //virtual @@ -440,14 +155,9 @@ void LLBottomTray::sessionAdded(const LLUUID& session_id, const std::string& nam } else { - LLIMChiclet* chicklet = getChicletPanel()->createChiclet(session_id); - chicklet->setIMSessionName(name); - chicklet->setOtherParticipantId(other_participant_id); - - if(getChicletPanel()->getChicletCount()) - { - setChicletPanelVisible(true); - } + LLIMChiclet* chiclet = getChicletPanel()->createChiclet(session_id); + chiclet->setIMSessionName(name); + chiclet->setOtherParticipantId(other_participant_id); } } } @@ -458,27 +168,6 @@ void LLBottomTray::sessionRemoved(const LLUUID& session_id) if(getChicletPanel()) { getChicletPanel()->removeChiclet(session_id); - - if(0 == getChicletPanel()->getChicletCount()) - { - setChicletPanelVisible(false); - } - } -} - -void LLBottomTray::setChicletPanelVisible(bool visible) -{ - // Chiclet panel is placed in layout_panel, which is child of layout_stack. - // To gide chiclet panel we need to also hide layout_panel to make layout_stack resize its - // content. - getChicletPanel()->getParent()->setVisible(visible); - if(visible) - { - // Reshape layout stack after making chiclet panel visible - LLView* layout = getChild("toolbar_stack"); - LLRect rc = layout->getRect(); - layout->reshape(rc.getWidth(), rc.getHeight()); - layout->setRect(rc); } } @@ -491,22 +180,6 @@ void LLBottomTray::onFocusLost() } } -// virtual -BOOL LLBottomTray::handleKeyHere( KEY key, MASK mask ) -{ - BOOL handled = FALSE; - - // ALT-RETURN is reserved for windowed/fullscreen toggle - if( KEY_RETURN == key && mask == MASK_CONTROL) - { - // shout - sendChat(CHAT_TYPE_SHOUT); - handled = TRUE; - } - - return handled; -} - //virtual // setVisible used instead of onVisibilityChange, since LLAgent calls it on entering/leaving mouselook mode. // If bottom tray is already visible in mouselook mode, then onVisibilityChange will not be called from setVisible(true), @@ -514,192 +187,22 @@ void LLBottomTray::setVisible(BOOL visible) { LLPanel::setVisible(visible); - - BOOL visibility = gAgent.cameraMouselook() ? false : true; + LLView* stack = getChild("toolbar_stack",TRUE,FALSE); - LLViewBorder* separator = getChild("well_separator",TRUE,FALSE); - - if (separator && separator->getVisible() == visibility) - return; - - if (separator) - separator->setVisible(visibility); - - LLPanel* p = getChild("chiclet_list_panel",TRUE,FALSE); - if (p) - p->setVisible(visibility); - - p = getChild("im_well_panel",TRUE,FALSE); - if (p) - p->setVisible(visibility); - - p = getChild("sys_well_panel",TRUE,FALSE); - if (p) - p->setVisible(visibility); - -} - -// static -void LLBottomTray::startChat(const char* line) -{ - LLBottomTray *bt = LLBottomTray::getInstance(); - - if(bt && bt->getChatBox()) + if (stack) { - bt->setVisible(TRUE); - bt->getChatBox()->setFocus(TRUE); + BOOL visibility = gAgent.cameraMouselook() ? false : true; - if (line) + for ( child_list_const_iter_t child_it = stack->getChildList()->begin(); child_it != stack->getChildList()->end(); child_it++) { - std::string line_string(line); - bt->getChatBox()->setText(line_string); - } - - bt->getChatBox()->setCursorToEnd(); - } -} - -// Exit "chat mode" and do the appropriate focus changes -// static -void LLBottomTray::stopChat() -{ - LLBottomTray *bt = LLBottomTray::getInstance(); - - if(bt && bt->getChatBox()) - { - bt->getChatBox()->setFocus(FALSE); - } - - // stop typing animation - gAgent.stopTyping(); -} - -void LLBottomTray::sendChat( EChatType type ) -{ - if (mChatBox) - { - LLWString text = mChatBox->getConvertedText(); - if (!text.empty()) - { - // store sent line in history, duplicates will get filtered - mChatBox->updateHistory(); - // Check if this is destined for another channel - S32 channel = 0; - stripChannelNumber(text, &channel); + LLView* viewp = *child_it; - std::string utf8text = wstring_to_utf8str(text); - // Try to trigger a gesture, if not chat to a script. - std::string utf8_revised_text; - if (0 == channel) - { - // discard returned "found" boolean - gGestureManager.triggerAndReviseString(utf8text, &utf8_revised_text); - } - else - { - utf8_revised_text = utf8text; - } - - utf8_revised_text = utf8str_trim(utf8_revised_text); - - if (!utf8_revised_text.empty()) + if ("chat_bar" == viewp->getName()) + continue; + else { - // Chat with animation - sendChatFromViewer(utf8_revised_text, type, TRUE); + viewp->setVisible(visibility); } } - - mChatBox->setText(LLStringExplicit("")); } - - gAgent.stopTyping(); } - -// If input of the form "/20foo" or "/20 foo", returns "foo" and channel 20. -// Otherwise returns input and channel 0. -LLWString LLBottomTray::stripChannelNumber(const LLWString &mesg, S32* channel) -{ - if (mesg[0] == '/' - && mesg[1] == '/') - { - // This is a "repeat channel send" - *channel = sLastSpecialChatChannel; - return mesg.substr(2, mesg.length() - 2); - } - else if (mesg[0] == '/' - && mesg[1] - && LLStringOps::isDigit(mesg[1])) - { - // This a special "/20" speak on a channel - S32 pos = 0; - - // Copy the channel number into a string - LLWString channel_string; - llwchar c; - do - { - c = mesg[pos+1]; - channel_string.push_back(c); - pos++; - } - while(c && pos < 64 && LLStringOps::isDigit(c)); - - // Move the pointer forward to the first non-whitespace char - // Check isspace before looping, so we can handle "/33foo" - // as well as "/33 foo" - while(c && iswspace(c)) - { - c = mesg[pos+1]; - pos++; - } - - sLastSpecialChatChannel = strtol(wstring_to_utf8str(channel_string).c_str(), NULL, 10); - *channel = sLastSpecialChatChannel; - return mesg.substr(pos, mesg.length() - pos); - } - else - { - // This is normal chat. - *channel = 0; - return mesg; - } -} - -void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel) -{ - LLMessageSystem* msg = gMessageSystem; - msg->newMessageFast(_PREHASH_ChatFromViewer); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_ChatData); - msg->addStringFast(_PREHASH_Message, utf8_out_text); - msg->addU8Fast(_PREHASH_Type, type); - msg->addS32("Channel", channel); - - gAgent.sendReliableMessage(); - - LLViewerStats::getInstance()->incStat(LLViewerStats::ST_CHAT_COUNT); -} - -class LLChatHandler : public LLCommandHandler -{ -public: - // not allowed from outside the app - LLChatHandler() : LLCommandHandler("chat", true) { } - - // Your code here - bool handle(const LLSD& tokens, const LLSD& query_map, - LLWebBrowserCtrl* web) - { - if (tokens.size() < 2) return false; - S32 channel = tokens[0].asInteger(); - std::string mesg = tokens[1].asString(); - send_chat_from_viewer(mesg, CHAT_TYPE_NORMAL, channel); - return true; - } -}; - -// Creating the object registers with the dispatcher. -LLChatHandler gChatHandler; - -- cgit v1.2.3 From db5cda26676f376f18816013c0c5e3fbad5b20d0 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Mon, 3 Aug 2009 22:25:48 +0000 Subject: merge https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0@1211 https://svn.aws.productengine.com/secondlife/pe/stable-1@1228 -> viewer-2.0.0-3 QA: New movement and camera controls. Test all movement and camera behavior against spec and expected behaviors, including sitting & standing. Many other changes to the bottom bar. Changes to local chat behavior. --- indra/newview/llbottomtray.cpp | 49 ++++++------------------------------------ 1 file changed, 6 insertions(+), 43 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 1781e6b3f1..8e1ae7d4f2 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -38,17 +38,14 @@ #include "llfloaterreg.h" #include "llflyoutbutton.h" #include "llnearbychatbar.h" - -//FIXME: temporary, for stand up proto -#include "llselectmgr.h" -#include "llvoavatarself.h" +#include "llsplitbutton.h" +#include "llfloatercamera.h" LLBottomTray::LLBottomTray(const LLSD&) : mChicletPanel(NULL) , mIMWell(NULL) , mSysWell(NULL) , mTalkBtn(NULL) - , mStandUpBtn(NULL) ////FIXME: temporary, for stand up proto , mNearbyChatBar(NULL) { mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL); @@ -61,13 +58,9 @@ LLBottomTray::LLBottomTray(const LLSD&) mChicletPanel->setChicletClickedCallback(boost::bind(&LLBottomTray::onChicletClick,this,_1)); - ////FIXME: temporary, for stand up proto - mStandUpBtn = getChild ("stand", TRUE, FALSE); - if (mStandUpBtn) - { - mStandUpBtn->setCommitCallback(boost::bind(&LLBottomTray::onCommitStandUp, this, _1)); - } - + LLSplitButton* presets = getChild("presets", TRUE, FALSE); + if (presets) presets->setSelectionCallback(LLFloaterCamera::onClickCameraPresets); + LLIMMgr::getInstance()->addSessionObserver(this); //this is to fix a crash that occurs because LLBottomTray is a singleton @@ -99,6 +92,7 @@ void LLBottomTray::onChicletClick(LLUICtrl* ctrl) //// Show after comm window so it is frontmost (and hence will not //// auto-hide) //LLIMFloater::show(chiclet->getSessionId()); + chiclet->setCounter(0); } } @@ -113,37 +107,6 @@ void* LLBottomTray::createNearbyChatBar(void* userdata) return bt->mNearbyChatBar; } -//virtual -void LLBottomTray::draw() -{ - refreshStandUp(); - LLPanel::draw(); -} - -void LLBottomTray::refreshStandUp() -{ - //FIXME: temporary, for stand up proto - BOOL sitting = FALSE; - if (gAgent.getAvatarObject()) - { - sitting = gAgent.getAvatarObject()->mIsSitting; - } - - if (mStandUpBtn && mStandUpBtn->getVisible() != sitting) - { - mStandUpBtn->setVisible(sitting); - sendChildToFront(mStandUpBtn); - moveChildToBackOfTabGroup(mStandUpBtn); - } -} - -//FIXME: temporary, for stand up proto -void LLBottomTray::onCommitStandUp(LLUICtrl* ctrl) -{ - LLSelectMgr::getInstance()->deselectAllForStandingUp(); - gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); -} - //virtual void LLBottomTray::sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) { -- cgit v1.2.3 From eb853f55c07ae4a3c3f2aa05fbabcf2e4b4dc115 Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Tue, 4 Aug 2009 01:12:59 +0000 Subject: svn merge -r 128442:129343 svn+ssh://svn.lindenlab.com/svn/linden/branches/skinning/skinning-18 into svn+ssh://svn.lindenlab.com/svn/linden/branches/viewer/viewer-2.0.0-3 --- indra/newview/llbottomtray.cpp | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'indra/newview/llbottomtray.cpp') diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 8e1ae7d4f2..9eb8369c4c 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -40,13 +40,14 @@ #include "llnearbychatbar.h" #include "llsplitbutton.h" #include "llfloatercamera.h" +#include "llimpanel.h" LLBottomTray::LLBottomTray(const LLSD&) - : mChicletPanel(NULL) - , mIMWell(NULL) - , mSysWell(NULL) - , mTalkBtn(NULL) - , mNearbyChatBar(NULL) +: mChicletPanel(NULL), + mIMWell(NULL), + mSysWell(NULL), + mTalkBtn(NULL), + mNearbyChatBar(NULL) { mFactoryMap["chat_bar"] = LLCallbackMap(LLBottomTray::createNearbyChatBar, NULL); @@ -72,6 +73,13 @@ LLBottomTray::LLBottomTray(const LLSD&) setFocusRoot(TRUE); } +BOOL LLBottomTray::postBuild() +{ + mNearbyChatBar = getChild("chat_bar"); + + return TRUE; +} + LLBottomTray::~LLBottomTray() { if (!LLSingleton::destroyed()) @@ -87,24 +95,18 @@ void LLBottomTray::onChicletClick(LLUICtrl* ctrl) { // Until you can type into an IM Window and have a conversation, // still show the old communicate window - LLFloaterReg::showInstance("communicate", chiclet->getSessionId()); - // DISABLED IN VIEWER-2 BRANCH UNTIL FEATURE IS DONE -- James - //// Show after comm window so it is frontmost (and hence will not - //// auto-hide) - //LLIMFloater::show(chiclet->getSessionId()); + //LLFloaterReg::showInstance("communicate", chiclet->getSessionId()); + + // Show after comm window so it is frontmost (and hence will not + // auto-hide) + LLIMFloater::show(chiclet->getSessionId()); chiclet->setCounter(0); } } void* LLBottomTray::createNearbyChatBar(void* userdata) { - LLBottomTray *bt = LLBottomTray::getInstance(); - if (!bt) - return NULL; - - bt->mNearbyChatBar = new LLNearbyChatBar(); - - return bt->mNearbyChatBar; + return new LLNearbyChatBar(); } //virtual -- cgit v1.2.3