From ae46afb7076959161316be1faf8a16ed21dbf854 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Thu, 19 Aug 2010 17:36:38 -0700 Subject: eliminated some WTF code --- indra/newview/llfavoritesbar.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'indra/newview/llfavoritesbar.cpp') diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 6b7a257a4b..98c6642e08 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -167,22 +167,13 @@ public: if (!region_name.empty()) { - LLToolTip::Params params; std::string extra_message = llformat("%s (%d, %d, %d)", region_name.c_str(), mLandmarkInfoGetter.getPosX(), mLandmarkInfoGetter.getPosY(), mLandmarkInfoGetter.getPosZ()); + LLToolTip::Params params; params.message = llformat("%s\n%s", getLabelSelected().c_str(), extra_message.c_str()); - - LLRect rect = calcScreenRect(); - LLFontGL* standart_font = LLFontGL::getFontSansSerif(); - if(standart_font) - { - S32 w = llmax((S32)(standart_font->getWidthF32(getLabelSelected())+0.5),(S32)(standart_font->getWidthF32(extra_message)+0.5)); - rect.mRight = rect.mLeft + w; - params.max_width = w; - } - - params.sticky_rect = rect; + params.max_width = 1000; + params.sticky_rect = calcScreenRect(); LLToolTipMgr::instance().show(params); } -- cgit v1.2.3 From 02d8197019dcecec7aee80a104c4644ddb4807ca Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Fri, 20 Aug 2010 10:14:28 -0700 Subject: changed buildPanel/buildFloater to member functions buildFromFile streamlined LLUICtrlFactory's interface --- indra/newview/llfavoritesbar.cpp | 45 +++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'indra/newview/llfavoritesbar.cpp') diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 6b7a257a4b..b8776d0af2 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -667,16 +667,22 @@ void LLFavoritesBarCtrl::draw() } } -LLXMLNodePtr LLFavoritesBarCtrl::getButtonXMLNode() +const LLButton::Params& LLFavoritesBarCtrl::getButtonParams() { - LLXMLNodePtr buttonXMLNode = NULL; - bool success = LLUICtrlFactory::getLayeredXMLNode("favorites_bar_button.xml", buttonXMLNode); - if (!success) + static LLButton::Params button_params; + static bool params_initialized = false; + + if (!params_initialized) { - llwarns << "Failed to create Favorites Bar button from favorites_bar_button.xml" << llendl; - buttonXMLNode = NULL; + LLXMLNodePtr button_xml_node; + if(LLUICtrlFactory::getLayeredXMLNode("favorites_bar_button.xml", button_xml_node)) + { + LLXUIParser::instance().readXUI(button_xml_node, button_params, "favorites_bar_button.xml"); + } + params_initialized = true; } - return buttonXMLNode; + + return button_params; } void LLFavoritesBarCtrl::updateButtons() @@ -688,11 +694,8 @@ void LLFavoritesBarCtrl::updateButtons() return; } - static LLXMLNodePtr buttonXMLNode = getButtonXMLNode(); - if (buttonXMLNode.isNull()) - { - return; - } + const LLButton::Params& button_params = getButtonParams(); + if(mItems.empty()) { mBarLabel->setVisible(TRUE); @@ -768,7 +771,7 @@ void LLFavoritesBarCtrl::updateButtons() int j = first_changed_item_index; for (; j < mItems.count(); j++) { - last_new_button = createButton(mItems[j], buttonXMLNode, last_right_edge); + last_new_button = createButton(mItems[j], button_params, last_right_edge); if (!last_new_button) { break; @@ -786,8 +789,7 @@ void LLFavoritesBarCtrl::updateButtons() //or there are some new favorites, or width had been changed // so if we need to display chevron button, we must update dropdown items too. mUpdateDropDownItems = true; - S32 buttonHGap = 2; // default value - buttonXMLNode->getAttributeS32("left", buttonHGap); + S32 buttonHGap = button_params.rect.left; // default value LLRect rect; // Chevron button should stay right aligned rect.setOriginAndSize(getRect().mRight - mChevronButton->getRect().getWidth() - buttonHGap, 0, @@ -814,12 +816,10 @@ void LLFavoritesBarCtrl::updateButtons() } } -LLButton* LLFavoritesBarCtrl::createButton(const LLPointer item, LLXMLNodePtr &buttonXMLNode, S32 x_offset) +LLButton* LLFavoritesBarCtrl::createButton(const LLPointer item, const LLButton::Params& button_params, S32 x_offset) { - S32 def_button_width = 120; - buttonXMLNode->getAttributeS32("width", def_button_width); - S32 button_x_delta = 2; // default value - buttonXMLNode->getAttributeS32("left", button_x_delta); + S32 def_button_width = button_params.rect.width; + S32 button_x_delta = button_params.rect.left; // default value S32 curr_x = x_offset; /** @@ -837,13 +837,16 @@ LLButton* LLFavoritesBarCtrl::createButton(const LLPointer(buttonXMLNode, this, NULL); + LLButton::Params fav_btn_params(button_params); + fav_btn = LLUICtrlFactory::create(fav_btn_params); if (NULL == fav_btn) { llwarns << "Unable to create LLFavoriteLandmarkButton widget: " << item->getName() << llendl; return NULL; } + addChild(fav_btn); + LLRect butt_rect (fav_btn->getRect()); fav_btn->setLandmarkID(item->getUUID()); butt_rect.setOriginAndSize(curr_x + button_x_delta, fav_btn->getRect().mBottom, width, fav_btn->getRect().getHeight()); -- cgit v1.2.3 From 0daa627db4f1bba2f69ec717426b26593674d14c Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Tue, 24 Aug 2010 11:44:28 -0700 Subject: removed LLLayoutStack::fromXML custom xml parsing --- indra/newview/llfavoritesbar.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfavoritesbar.cpp') diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 18a6ac031f..751d5b8fcd 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -667,9 +667,10 @@ const LLButton::Params& LLFavoritesBarCtrl::getButtonParams() { LLXMLNodePtr button_xml_node; if(LLUICtrlFactory::getLayeredXMLNode("favorites_bar_button.xml", button_xml_node)) - { - LLXUIParser::instance().readXUI(button_xml_node, button_params, "favorites_bar_button.xml"); - } + { + LLXUIParser parser; + parser.readXUI(button_xml_node, button_params, "favorites_bar_button.xml"); + } params_initialized = true; } -- cgit v1.2.3 From 49ae085d4c02045a70eeed3d8cd57c22d2594c0c Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Mon, 27 Sep 2010 22:32:01 +0300 Subject: STORM-207 FIXED Favorites overflow menu didn't close when you press ESC. Caused by the fix of EXT-4217 which I had to revert. --- indra/newview/llfavoritesbar.cpp | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'indra/newview/llfavoritesbar.cpp') diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index dd1f92a25c..3981b887ad 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -290,20 +290,6 @@ public: return TRUE; } - void setVisible(BOOL b) - { - // Overflow menu shouldn't hide when it still has focus. See EXT-4217. - if (!b && hasFocus()) - return; - LLToggleableMenu::setVisible(b); - setFocus(b); - } - - void onFocusLost() - { - setVisible(FALSE); - } - protected: LLFavoriteLandmarkToggleableMenu(const LLToggleableMenu::Params& p): LLToggleableMenu(p) @@ -790,7 +776,6 @@ void LLFavoritesBarCtrl::updateButtons() LLToggleableMenu* overflow_menu = static_cast (mPopupMenuHandle.get()); if (overflow_menu && overflow_menu->getVisible()) { - overflow_menu->setFocus(FALSE); overflow_menu->setVisible(FALSE); if (mUpdateDropDownItems) showDropDownMenu(); @@ -911,8 +896,6 @@ void LLFavoritesBarCtrl::showDropDownMenu() if (menu) { - // Release focus to allow changing of visibility. - menu->setFocus(FALSE); if (!menu->toggleVisibility()) return; @@ -1093,6 +1076,14 @@ void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata) { gInventory.removeItem(mSelectedItemID); } + + // Pop-up the overflow menu again (it gets hidden whenever the user clicks a context menu item). + // See EXT-4217 and STORM-207. + LLToggleableMenu* menu = (LLToggleableMenu*) mPopupMenuHandle.get(); + if (menu && !menu->getVisible()) + { + showDropDownMenu(); + } } BOOL LLFavoritesBarCtrl::isClipboardPasteable() const -- cgit v1.2.3