diff options
author | Yuri Chebotarev <ychebotarev@productengine.com> | 2009-11-02 14:38:13 +0200 |
---|---|---|
committer | Yuri Chebotarev <ychebotarev@productengine.com> | 2009-11-02 14:38:13 +0200 |
commit | 6bb24921564c05f8d3f83180e917421b3c27d28f (patch) | |
tree | c8089f60bbe8321ae32ec69e8562843543f1bc0c /indra | |
parent | 2e12c9a53acaf8e624f20dc23055151e79924d80 (diff) | |
parent | 49118ec3bccc47e618600e023adfaf5166c22632 (diff) |
merge
--HG--
branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llimfloater.cpp | 2 | ||||
-rw-r--r-- | indra/newview/lllandmarkactions.cpp | 37 | ||||
-rw-r--r-- | indra/newview/lllandmarkactions.h | 7 | ||||
-rw-r--r-- | indra/newview/lllocationinputctrl.cpp | 14 | ||||
-rw-r--r-- | indra/newview/lllocationinputctrl.h | 1 | ||||
-rw-r--r-- | indra/newview/llpanellandmarks.cpp | 5 |
6 files changed, 57 insertions, 9 deletions
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index b21df87093..f61a928813 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -265,7 +265,7 @@ void LLIMFloater::draw() } } - LLFloater::draw(); + LLTransientDockableFloater::draw(); } diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp index 091346d3b4..0b07dd4f21 100644 --- a/indra/newview/lllandmarkactions.cpp +++ b/indra/newview/lllandmarkactions.cpp @@ -133,6 +133,33 @@ public: } }; +// Returns true if the given inventory item is a landmark pointing to the current parcel. +// Used to find out if there is at least one landmark from current parcel. +class LLFistAgentParcelLandmark : public LLInventoryCollectFunctor +{ +private: + bool mFounded;// to avoid unnecessary check + +public: + LLFistAgentParcelLandmark(): mFounded(false){} + + /*virtual*/ bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) + { + if (mFounded || !item || item->getType() != LLAssetType::AT_LANDMARK) + return false; + + LLLandmark* landmark = gLandmarkList.getAsset(item->getAssetUUID()); + if (!landmark) // the landmark not been loaded yet + return false; + + LLVector3d landmark_global_pos; + if (!landmark->getGlobalPos(landmark_global_pos)) + return false; + mFounded = LLViewerParcelMgr::getInstance()->inAgentParcel(landmark_global_pos); + return mFounded; + } +}; + static void fetch_landmarks(LLInventoryModel::cat_array_t& cats, LLInventoryModel::item_array_t& items, LLInventoryCollectFunctor& add) @@ -172,6 +199,16 @@ bool LLLandmarkActions::landmarkAlreadyExists() return findLandmarkForAgentPos() != NULL; } +//static +bool LLLandmarkActions::hasParcelLandmark() +{ + LLFistAgentParcelLandmark get_first_agent_landmark; + LLInventoryModel::cat_array_t cats; + LLInventoryModel::item_array_t items; + fetch_landmarks(cats, items, get_first_agent_landmark); + return !items.empty(); + +} // *TODO: This could be made more efficient by only fetching the FIRST // landmark that meets the criteria diff --git a/indra/newview/lllandmarkactions.h b/indra/newview/lllandmarkactions.h index 32f05e702b..312426cab0 100644 --- a/indra/newview/lllandmarkactions.h +++ b/indra/newview/lllandmarkactions.h @@ -50,9 +50,14 @@ public: */ static LLInventoryModel::item_array_t fetchLandmarksByName(std::string& name, BOOL if_use_substring); /** - * @brief Checks whether landmark exists for current parcel. + * @brief Checks whether landmark exists for current agent position. */ static bool landmarkAlreadyExists(); + + /** + * @brief Checks whether landmark exists for current parcel. + */ + static bool hasParcelLandmark(); /** * @brief Searches landmark for global position. diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp index 00f12ae2eb..8fe317a292 100644 --- a/indra/newview/lllocationinputctrl.cpp +++ b/indra/newview/lllocationinputctrl.cpp @@ -294,6 +294,11 @@ void LLLocationInputCtrl::hideList() BOOL LLLocationInputCtrl::handleToolTip(S32 x, S32 y, MASK mask) { + + if(mAddLandmarkBtn->parentPointInView(x,y)) + { + updateAddLandmarkTooltip(); + } // Let the buttons show their tooltips. if (LLUICtrl::handleToolTip(x, y, mask)) { @@ -602,11 +607,12 @@ void LLLocationInputCtrl::enableAddLandmarkButton(bool val) // depending on whether current parcel has been landmarked. void LLLocationInputCtrl::updateAddLandmarkButton() { - bool landmark_exists = LLLandmarkActions::landmarkAlreadyExists(); - enableAddLandmarkButton(!landmark_exists); - + enableAddLandmarkButton(LLLandmarkActions::hasParcelLandmark()); +} +void LLLocationInputCtrl::updateAddLandmarkTooltip() +{ std::string tooltip; - if(landmark_exists) + if(LLLandmarkActions::landmarkAlreadyExists()) { tooltip = mEditLandmarkTooltip; } diff --git a/indra/newview/lllocationinputctrl.h b/indra/newview/lllocationinputctrl.h index c74a294ca3..44dc0cb251 100644 --- a/indra/newview/lllocationinputctrl.h +++ b/indra/newview/lllocationinputctrl.h @@ -107,6 +107,7 @@ private: bool findTeleportItemsByTitle(const LLTeleportHistoryItem& item, const std::string& filter); void setText(const LLStringExplicit& text); void updateAddLandmarkButton(); + void updateAddLandmarkTooltip(); void updateContextMenu(); void updateWidgetlayout(); void changeLocationPresentation(); diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index 48a93f0d42..6bff01ee5e 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -184,9 +184,8 @@ void LLLandmarksPanel::updateVerbs() if (!isTabVisible()) return; - BOOL enabled = isLandmarkSelected(); - mTeleportBtn->setEnabled(enabled); - mShowOnMapBtn->setEnabled(enabled); + mTeleportBtn->setEnabled(isActionEnabled("teleport")); + mShowOnMapBtn->setEnabled(isActionEnabled("show_on_map")); // TODO: mantipov: Uncomment when mShareBtn is supported // Share button should be enabled when neither a folder nor a landmark is selected |