From 81e0fb43caa27491fa18b17d6a05cafb0e20dfa6 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Fri, 9 Oct 2009 00:42:36 +0000 Subject: merge https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0@1943 https://svn.aws.productengine.com/secondlife/pe/stable-2@1958 -> viewer-2.0.0-3 * Bugs: EXT-1148 EXT-1330 EXT-990 EXT-1259 EXT-1184 EXT-1327 EXT-1389 EXT-1276 EXT-1390 EXT-1396 EXT-1050 EXT-1094 EXT-1166 EXT-1137 EXT-1327 EXT-782 EXT-1137 EXT-1394 EXT-1326 EXT-917 EXT-1262 * New Dev: EXT-1292 EXT-1139 --- indra/newview/llfavoritesbar.cpp | 72 +++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 35 deletions(-) (limited to 'indra/newview/llfavoritesbar.cpp') diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 48fcb6b6de..b06b4855ad 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -164,33 +164,6 @@ private: LLSLURLGetter mUrlGetter; }; -class LLFavoritesToggleableMenu : public LLToggleableMenu -{ -public: - virtual BOOL handleHover(S32 x, S32 y, MASK mask) - { - if (fb) - { - fb->handleHover(x, y, mask); - } - - return LLToggleableMenu::handleHover(x, y, mask); - } - - void initFavoritesBarPointer(LLFavoritesBarCtrl* fb) { this->fb = fb; } - -protected: - LLFavoritesToggleableMenu(const LLToggleableMenu::Params& p): - LLToggleableMenu(p) - { - } - - friend class LLUICtrlFactory; - -private: - LLFavoritesBarCtrl* fb; -}; - /** * This class is needed to override LLMenuItemCallGL default handleToolTip function and * show SLURL as button tooltip. @@ -221,6 +194,18 @@ public: return LLMenuItemCallGL::handleMouseUp(x, y, mask); } + virtual BOOL handleHover(S32 x, S32 y, MASK mask) + { + if (fb) + { + fb->handleHover(x, y, mask); + } + + return LLMenuItemCallGL::handleHover(x, y, mask); + } + + void initFavoritesBarPointer(LLFavoritesBarCtrl* fb) { this->fb = fb; } + protected: LLFavoriteLandmarkMenuItem(const LLMenuItemCallGL::Params& p) : LLMenuItemCallGL(p) {} @@ -228,6 +213,7 @@ protected: private: LLSLURLGetter mUrlGetter; + LLFavoritesBarCtrl* fb; }; /** @@ -312,8 +298,8 @@ LLFavoritesBarCtrl::LLFavoritesBarCtrl(const LLFavoritesBarCtrl::Params& p) boost::bind(&LLFavoritesBarCtrl::doToSelected, this, _2)); // Add this if we need to selectively enable items - //LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Favorites.EnableSelected", - // boost::bind(&LLFavoritesBarCtrl::enableSelected, this, _2)); + LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Favorites.EnableSelected", + boost::bind(&LLFavoritesBarCtrl::enableSelected, this, _2)); gInventory.addObserver(this); } @@ -433,7 +419,7 @@ void LLFavoritesBarCtrl::handleExistingFavoriteDragAndDrop(S32 x, S32 y) saveItemsOrder(mItems); - LLFavoritesToggleableMenu* menu = (LLFavoritesToggleableMenu*) mPopupMenuHandle.get(); + LLToggleableMenu* menu = (LLToggleableMenu*) mPopupMenuHandle.get(); if (menu && menu->getVisible()) { @@ -794,7 +780,7 @@ void LLFavoritesBarCtrl::showDropDownMenu() { if (mPopupMenuHandle.isDead()) { - LLFavoritesToggleableMenu::Params menu_p; + LLToggleableMenu::Params menu_p; menu_p.name("favorites menu"); menu_p.can_tear_off(false); menu_p.visible(false); @@ -802,12 +788,11 @@ void LLFavoritesBarCtrl::showDropDownMenu() menu_p.max_scrollable_items = 10; menu_p.preferred_width = DROP_DOWN_MENU_WIDTH; - LLFavoritesToggleableMenu* menu = LLUICtrlFactory::create(menu_p); - menu->initFavoritesBarPointer(this); + LLToggleableMenu* menu = LLUICtrlFactory::create(menu_p); mPopupMenuHandle = menu->getHandle(); } - LLFavoritesToggleableMenu* menu = (LLFavoritesToggleableMenu*)mPopupMenuHandle.get(); + LLToggleableMenu* menu = (LLToggleableMenu*)mPopupMenuHandle.get(); if(menu) { @@ -873,6 +858,7 @@ void LLFavoritesBarCtrl::showDropDownMenu() item_params.on_click.function(boost::bind(&LLFavoritesBarCtrl::onButtonClick, this, item->getUUID())); LLFavoriteLandmarkMenuItem *menu_item = LLUICtrlFactory::create(item_params); + menu_item->initFavoritesBarPointer(this); menu_item->setRightMouseDownCallback(boost::bind(&LLFavoritesBarCtrl::onButtonRightClick, this,item->getUUID(),_1,_2,_3,_4)); menu_item->LLUICtrl::setMouseDownCallback(boost::bind(&LLFavoritesBarCtrl::onButtonMouseDown, this, item->getUUID(), _1, _2, _3, _4)); menu_item->LLUICtrl::setMouseUpCallback(boost::bind(&LLFavoritesBarCtrl::onButtonMouseUp, this, item->getUUID(), _1, _2, _3, _4)); @@ -951,6 +937,18 @@ void copy_slurl_to_clipboard_cb(std::string& slurl) } +bool LLFavoritesBarCtrl::enableSelected(const LLSD& userdata) +{ + std::string param = userdata.asString(); + + if (param == std::string("can_paste")) + { + return isClipboardPasteable(); + } + + return false; +} + void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata) { std::string action = userdata.asString(); @@ -1072,6 +1070,7 @@ void LLFavoritesBarCtrl::pastFromClipboard() const void LLFavoritesBarCtrl::onButtonMouseDown(LLUUID id, LLUICtrl* ctrl, S32 x, S32 y, MASK mask) { mDragItemId = id; + mStartDrag = TRUE; S32 screenX, screenY; localPointToScreen(x, y, &screenX, &screenY); @@ -1081,6 +1080,7 @@ void LLFavoritesBarCtrl::onButtonMouseDown(LLUUID id, LLUICtrl* ctrl, S32 x, S32 void LLFavoritesBarCtrl::onButtonMouseUp(LLUUID id, LLUICtrl* ctrl, S32 x, S32 y, MASK mask) { + mStartDrag = FALSE; mDragItemId = LLUUID::null; } @@ -1095,7 +1095,7 @@ void LLFavoritesBarCtrl::onEndDrag() BOOL LLFavoritesBarCtrl::handleHover(S32 x, S32 y, MASK mask) { - if (mDragItemId != LLUUID::null) + if (mDragItemId != LLUUID::null && mStartDrag) { S32 screenX, screenY; localPointToScreen(x, y, &screenX, &screenY); @@ -1106,6 +1106,8 @@ BOOL LLFavoritesBarCtrl::handleHover(S32 x, S32 y, MASK mask) DAD_LANDMARK, mDragItemId, LLToolDragAndDrop::SOURCE_LIBRARY); + mStartDrag = FALSE; + return LLToolDragAndDrop::getInstance()->handleHover(x, y, mask); } } -- cgit v1.2.3 From 20e56a6925b4d4106059a73a22170beb5a38be1e Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Tue, 13 Oct 2009 16:25:48 +0000 Subject: merge https://svn.aws.productengine.com/secondlife/export-from-ll/viewer-2-0@1992 https://svn.aws.productengine.com/secondlife/pe/stable-2@2004 -> viewer-2.0.0-3 * Bugs: EXT-1091 EXT-1418 EXT-996 EXT-1150 EXT-1188 EXT-1417 EXT-1181 EXT-1058 EXT-1397 EXT-836 EXT-1437 EXT-1379 * Dev: EXT-1291 EXT-1255 EXT-992 EXT-96 EXT-1157 --- indra/newview/llfavoritesbar.cpp | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfavoritesbar.cpp') diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index b06b4855ad..007c6b2c4c 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -201,7 +201,7 @@ public: fb->handleHover(x, y, mask); } - return LLMenuItemCallGL::handleHover(x, y, mask); + return TRUE; } void initFavoritesBarPointer(LLFavoritesBarCtrl* fb) { this->fb = fb; } @@ -216,6 +216,35 @@ private: LLFavoritesBarCtrl* fb; }; +/** + * This class was introduced just for fixing the following issue: + * EXT-836 Nav bar: Favorites overflow menu passes left-mouse click through. + * We must explicitly handle drag and drop event by returning TRUE + * because otherwise LLToolDragAndDrop will initiate drag and drop operation + * with the world. + */ +class LLFavoriteLandmarkToggleableMenu : public LLToggleableMenu +{ +public: + virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) + { + *accept = ACCEPT_NO; + return TRUE; + } + +protected: + LLFavoriteLandmarkToggleableMenu(const LLToggleableMenu::Params& p): + LLToggleableMenu(p) + { + } + + friend class LLUICtrlFactory; +}; + /** * This class is needed to update an item being copied to the favorites folder * with a sort field value (required to save favorites bar's tabs order). @@ -788,7 +817,7 @@ void LLFavoritesBarCtrl::showDropDownMenu() menu_p.max_scrollable_items = 10; menu_p.preferred_width = DROP_DOWN_MENU_WIDTH; - LLToggleableMenu* menu = LLUICtrlFactory::create(menu_p); + LLToggleableMenu* menu = LLUICtrlFactory::create(menu_p); mPopupMenuHandle = menu->getHandle(); } -- cgit v1.2.3