summaryrefslogtreecommitdiff
path: root/indra/newview/llnearbychatbar.cpp
diff options
context:
space:
mode:
authorPaul ProductEngine <pguslisty@productengine.com>2011-10-11 18:14:37 +0200
committerPaul ProductEngine <pguslisty@productengine.com>2011-10-11 18:14:37 +0200
commit8154c245dd2f7aaee390e0206f460b9dd5b9f693 (patch)
treeeb781b36ba45780c13a71dfdb049fc232d96a99f /indra/newview/llnearbychatbar.cpp
parentc845925eebb5cad3049ee0f3b1d0adea3e3a46b5 (diff)
EXP-1281 FIXED (As a FUI user, I want all bottom bar floaters to become independent)
Made bottom bar dependent floaters independent from it. Also some LLTransientDockableFloaters are just LLFLoaters now. Note: IM Floater and SysWellWindow will be made independent within EXP-1276
Diffstat (limited to 'indra/newview/llnearbychatbar.cpp')
-rw-r--r--indra/newview/llnearbychatbar.cpp353
1 files changed, 0 insertions, 353 deletions
diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp
index caa20b767c..3073a19d83 100644
--- a/indra/newview/llnearbychatbar.cpp
+++ b/indra/newview/llnearbychatbar.cpp
@@ -34,7 +34,6 @@
#include "llfirstuse.h"
#include "llnearbychatbar.h"
-#include "llbottomtray.h"
#include "llagent.h"
#include "llgesturemgr.h"
#include "llmultigesture.h"
@@ -58,8 +57,6 @@ const S32 EXPANDED_HEIGHT = 300;
// legacy callback glue
void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel);
-static LLDefaultChildRegistry::Register<LLGestureComboList> r("gesture_combo_list");
-
struct LLChatTypeTrigger {
std::string name;
EChatType type;
@@ -70,351 +67,6 @@ static LLChatTypeTrigger sChatTypeTriggers[] = {
{ "/shout" , CHAT_TYPE_SHOUT}
};
-//ext-7367
-//Problem: gesture list control (actually LLScrollListCtrl) didn't actually process mouse wheel message.
-// introduce new gesture list subclass to "eat" mouse wheel messages (and probably some other messages)
-class LLGestureScrollListCtrl: public LLScrollListCtrl
-{
-protected:
- friend class LLUICtrlFactory;
- LLGestureScrollListCtrl(const LLScrollListCtrl::Params& params)
- :LLScrollListCtrl(params)
- {
- }
-public:
- BOOL handleScrollWheel(S32 x, S32 y, S32 clicks)
- {
- LLScrollListCtrl::handleScrollWheel( x, y, clicks );
- return TRUE;
- }
- //See EXT-6598
- //Mouse hover over separator will result in not processing tooltip message
- //So eat this message
- BOOL handleToolTip(S32 x, S32 y, MASK mask)
- {
- LLScrollListCtrl::handleToolTip( x, y, mask );
- return TRUE;
- }
-};
-
-LLGestureComboList::Params::Params()
-: combo_button("combo_button"),
- combo_list("combo_list"),
- get_more("get_more", true),
- view_all("view_all", true)
-{
-}
-
-LLGestureComboList::LLGestureComboList(const LLGestureComboList::Params& p)
-: LLUICtrl(p),
- mLabel(p.label),
- mViewAllItemIndex(-1),
- mGetMoreItemIndex(-1),
- mShowViewAll(p.view_all),
- mShowGetMore(p.get_more)
-{
- LLBottomtrayButton::Params button_params = p.combo_button;
- button_params.follows.flags(FOLLOWS_LEFT|FOLLOWS_BOTTOM|FOLLOWS_RIGHT);
-
- mButton = LLUICtrlFactory::create<LLBottomtrayButton>(button_params);
- mButton->reshape(getRect().getWidth(),getRect().getHeight());
- mButton->setCommitCallback(boost::bind(&LLGestureComboList::onButtonCommit, this));
-
- addChild(mButton);
-
- LLGestureScrollListCtrl::Params params(p.combo_list);
-
- params.name("GestureComboList");
- params.commit_callback.function(boost::bind(&LLGestureComboList::onItemSelected, this, _2));
- params.visible(false);
- params.commit_on_keyboard_movement(false);
-
- mList = LLUICtrlFactory::create<LLGestureScrollListCtrl>(params);
- addChild(mList);
-
- //****************************Gesture Part********************************/
-
- setCommitCallback(boost::bind(&LLGestureComboList::onCommitGesture, this));
-
- // now register us as observer since we have a place to put the results
- LLGestureMgr::instance().addObserver(this);
-
- // refresh list from current active gestures
- refreshGestures();
-
- setFocusLostCallback(boost::bind(&LLGestureComboList::hideList, this));
-}
-
-BOOL LLGestureComboList::handleKeyHere(KEY key, MASK mask)
-{
- BOOL handled = FALSE;
-
- if (key == KEY_ESCAPE && mask == MASK_NONE )
- {
- hideList();
- handled = TRUE;
- }
- else
- {
- handled = mList->handleKeyHere(key, mask);
- }
-
- return handled;
-}
-
-void LLGestureComboList::draw()
-{
- LLUICtrl::draw();
-
- if(mButton->getToggleState())
- {
- showList();
- }
-}
-
-void LLGestureComboList::showList()
-{
- LLRect rect = mList->getRect();
- LLRect button_rect = mButton->getRect();
-
- // Calculating amount of space between the navigation bar and gestures combo
- LLNavigationBar* nb = LLNavigationBar::getInstance();
-
- S32 x, nb_bottom;
- nb->localPointToOtherView(0, 0, &x, &nb_bottom, this);
-
- S32 max_height = nb_bottom - button_rect.mTop;
- mList->calcColumnWidths();
- rect.setOriginAndSize(button_rect.mLeft, button_rect.mTop, llmax(mList->getMaxContentWidth(),mButton->getRect().getWidth()), max_height);
-
- mList->setRect(rect);
- mList->fitContents( llmax(mList->getMaxContentWidth(),mButton->getRect().getWidth()), max_height);
-
- gFocusMgr.setKeyboardFocus(this);
-
- // Show the list and push the button down
- mButton->setToggleState(TRUE);
- mList->setVisible(TRUE);
- sendChildToFront(mList);
- LLUI::addPopup(mList);
-}
-
-void LLGestureComboList::onButtonCommit()
-{
- if (!mList->getVisible())
- {
- // highlight the last selected item from the original selection before potentially selecting a new item
- // as visual cue to original value of combo box
- LLScrollListItem* last_selected_item = mList->getLastSelectedItem();
- if (last_selected_item)
- {
- mList->mouseOverHighlightNthItem(mList->getItemIndex(last_selected_item));
- }
-
- if (mList->getItemCount() != 0)
- {
- showList();
- }
- }
- else
- {
- hideList();
- }
-}
-
-void LLGestureComboList::hideList()
-{
- if (mList->getVisible())
- {
- mButton->setToggleState(FALSE);
- mList->setVisible(FALSE);
- mList->mouseOverHighlightNthItem(-1);
- LLUI::removePopup(mList);
- gFocusMgr.setKeyboardFocus(NULL);
- }
-}
-
-S32 LLGestureComboList::getCurrentIndex() const
-{
- LLScrollListItem* item = mList->getFirstSelected();
- if( item )
- {
- return mList->getItemIndex( item );
- }
- return -1;
-}
-
-void LLGestureComboList::onItemSelected(const LLSD& data)
-{
- const std::string name = mList->getSelectedItemLabel();
-
- S32 cur_id = getCurrentIndex();
- mLastSelectedIndex = cur_id;
- if (cur_id != mList->getItemCount()-1 && cur_id != -1)
- {
- mButton->setLabel(name);
- }
-
- // hiding the list reasserts the old value stored in the text editor/dropdown button
- hideList();
-
- // commit does the reverse, asserting the value in the list
- onCommit();
-}
-
-void LLGestureComboList::sortByName(bool ascending)
-{
- mList->sortOnce(0, ascending);
-}
-
-LLSD LLGestureComboList::getValue() const
-{
- LLScrollListItem* item = mList->getFirstSelected();
- if( item )
- {
- return item->getValue();
- }
- else
- {
- return LLSD();
- }
-}
-
-void LLGestureComboList::refreshGestures()
-{
- //store current selection so we can maintain it
- LLSD cur_gesture = getValue();
-
- mList->selectFirstItem();
- mList->clearRows();
- mGestures.clear();
-
- LLGestureMgr::item_map_t::const_iterator it;
- const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures();
- LLSD::Integer idx(0);
- for (it = active_gestures.begin(); it != active_gestures.end(); ++it)
- {
- LLMultiGesture* gesture = (*it).second;
- if (gesture)
- {
- mList->addSimpleElement(gesture->mName, ADD_BOTTOM, LLSD(idx));
- mGestures.push_back(gesture);
- idx++;
- }
- }
-
- sortByName();
-
- // store indices for Get More and View All items (idx is the index followed by the last added Gesture)
- if (mShowGetMore)
- {
- mGetMoreItemIndex = idx;
- mList->addSimpleElement(LLTrans::getString("GetMoreGestures"), ADD_BOTTOM, LLSD(mGetMoreItemIndex));
- }
- if (mShowViewAll)
- {
- mViewAllItemIndex = idx + 1;
- mList->addSimpleElement(LLTrans::getString("ViewAllGestures"), ADD_BOTTOM, LLSD(mViewAllItemIndex));
- }
-
- // Insert label after sorting, at top, with separator below it
- mList->addSeparator(ADD_TOP);
- mList->addSimpleElement(mLabel, ADD_TOP);
-
- if (cur_gesture.isDefined())
- {
- mList->selectByValue(cur_gesture);
-
- }
- else
- {
- mList->selectFirstItem();
- }
-
- LLCtrlListInterface* gestures = getListInterface();
- LLMultiGesture* gesture = NULL;
-
- if (gestures)
- {
- S32 sel_index = gestures->getFirstSelectedIndex();
- if (sel_index != 0)
- {
- S32 index = gestures->getSelectedValue().asInteger();
- if (index<0 || index >= (S32)mGestures.size())
- {
- llwarns << "out of range gesture access" << llendl;
- }
- else
- {
- gesture = mGestures.at(index);
- }
- }
- }
-
- if(gesture && LLGestureMgr::instance().isGesturePlaying(gesture))
- {
- return;
- }
-
- mButton->setLabel(mLabel);
-}
-
-void LLGestureComboList::onCommitGesture()
-{
- LLCtrlListInterface* gestures = getListInterface();
- if (gestures)
- {
- S32 sel_index = gestures->getFirstSelectedIndex();
- if (sel_index == 0)
- {
- return;
- }
-
- S32 index = gestures->getSelectedValue().asInteger();
-
- if (mViewAllItemIndex == index)
- {
- // The same behavior as Ctrl+G. EXT-823
- LLFloaterReg::toggleInstance("gestures");
- gestures->selectFirstItem();
- return;
- }
-
- if (mGetMoreItemIndex == index)
- {
- LLWeb::loadURLExternal(gSavedSettings.getString("GesturesMarketplaceURL"));
- return;
- }
-
- if (index<0 || index >= (S32)mGestures.size())
- {
- llwarns << "out of range gesture index" << llendl;
- }
- else
- {
- LLMultiGesture* gesture = mGestures.at(index);
- if(gesture)
- {
- LLGestureMgr::instance().playGesture(gesture);
- if(!gesture->mReplaceText.empty())
- {
- LLNearbyChatBar::sendChatFromViewer(gesture->mReplaceText, CHAT_TYPE_NORMAL, FALSE);
- }
- }
- }
- }
-}
-
-LLGestureComboList::~LLGestureComboList()
-{
- LLGestureMgr::instance().removeObserver(this);
-}
-
-LLCtrlListInterface* LLGestureComboList::getListInterface()
-{
- return mList;
-}
-
LLNearbyChatBar::LLNearbyChatBar(const LLSD& key)
: LLFloater(key),
mChatBox(NULL)
@@ -839,11 +491,6 @@ void LLNearbyChatBar::startChat(const char* line)
// static
void LLNearbyChatBar::stopChat()
{
- LLBottomTray *bt = LLBottomTray::getInstance();
-
- if (!bt)
- return;
-
LLNearbyChatBar* cb = LLNearbyChatBar::getInstance();
if (!cb)