diff options
-rw-r--r-- | indra/newview/llpanellandmarks.cpp | 21 | ||||
-rw-r--r-- | indra/newview/llpanellandmarks.h | 1 | ||||
-rw-r--r-- | indra/newview/llpanelplaces.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llpanelplacestab.h | 1 | ||||
-rw-r--r-- | indra/newview/llpanelteleporthistory.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llpanelteleporthistory.h | 3 |
6 files changed, 46 insertions, 5 deletions
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp index 0a978d1b26..bcc852cf4c 100644 --- a/indra/newview/llpanellandmarks.cpp +++ b/indra/newview/llpanellandmarks.cpp @@ -309,6 +309,25 @@ void LLLandmarksPanel::onTeleport() } // virtual +bool LLLandmarksPanel::isSingleItemSelected() +{ + bool result = false; + + if (mCurrentSelectedList != NULL) + { + LLPlacesFolderView* root_view = + static_cast<LLPlacesFolderView*>(mCurrentSelectedList->getRootFolder()); + + if (root_view->getSelectedCount() == 1) + { + result = isLandmarkSelected(); + } + } + + return result; +} + +// virtual void LLLandmarksPanel::updateVerbs() { if (!isTabVisible()) @@ -316,8 +335,8 @@ void LLLandmarksPanel::updateVerbs() bool landmark_selected = isLandmarkSelected(); mTeleportBtn->setEnabled(landmark_selected && isActionEnabled("teleport")); - mShowOnMapBtn->setEnabled(landmark_selected && isActionEnabled("show_on_map")); mShowProfile->setEnabled(landmark_selected && isActionEnabled("more_info")); + mShowOnMapBtn->setEnabled(true); // TODO: mantipov: Uncomment when mShareBtn is supported // Share button should be enabled when neither a folder nor a landmark is selected diff --git a/indra/newview/llpanellandmarks.h b/indra/newview/llpanellandmarks.h index 2d1eb0f091..8f8d9c2708 100644 --- a/indra/newview/llpanellandmarks.h +++ b/indra/newview/llpanellandmarks.h @@ -60,6 +60,7 @@ public: /*virtual*/ void onShowProfile(); /*virtual*/ void onTeleport(); /*virtual*/ void updateVerbs(); + /*virtual*/ bool isSingleItemSelected(); void onSelectionChange(LLPlacesInventoryPanel* inventory_list, const std::deque<LLFolderViewItem*> &items, BOOL user_action); void onSelectorButtonClicked(); diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index 51a11e97e4..028440562d 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -615,8 +615,21 @@ void LLPanelPlaces::onShowOnMapButtonClicked() } else { - if (mActivePanel) + if (mActivePanel && mActivePanel->isSingleItemSelected()) + { mActivePanel->onShowOnMap(); + } + else + { + LLFloaterWorldMap* worldmap_instance = LLFloaterWorldMap::getInstance(); + LLVector3d global_pos = gAgent.getPositionGlobal(); + + if (!global_pos.isExactlyZero() && worldmap_instance) + { + worldmap_instance->trackLocation(global_pos); + LLFloaterReg::showInstance("world_map", "center"); + } + } } } @@ -1072,7 +1085,6 @@ void LLPanelPlaces::updateVerbs() mCloseBtn->setVisible(is_create_landmark_visible && !isLandmarkEditModeOn); mPlaceInfoBtn->setVisible(!is_place_info_visible && !is_create_landmark_visible && !isLandmarkEditModeOn); - mShowOnMapBtn->setEnabled(!is_create_landmark_visible && !isLandmarkEditModeOn && have_3d_pos); mPlaceInfoBtn->setEnabled(!is_create_landmark_visible && !isLandmarkEditModeOn && have_3d_pos); if (is_place_info_visible) diff --git a/indra/newview/llpanelplacestab.h b/indra/newview/llpanelplacestab.h index f4e93a7658..4a155afd71 100644 --- a/indra/newview/llpanelplacestab.h +++ b/indra/newview/llpanelplacestab.h @@ -47,6 +47,7 @@ public: virtual void onShowOnMap() = 0; virtual void onShowProfile() = 0; virtual void onTeleport() = 0; + virtual bool isSingleItemSelected() = 0; bool isTabVisible(); // Check if parent TabContainer is visible. diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp index c0b2244038..e8b6c6bfe5 100644 --- a/indra/newview/llpanelteleporthistory.cpp +++ b/indra/newview/llpanelteleporthistory.cpp @@ -477,6 +477,12 @@ void LLTeleportHistoryPanel::onSearchEdit(const std::string& string) } // virtual +bool LLTeleportHistoryPanel::isSingleItemSelected() +{ + return mLastSelectedFlatlList && mLastSelectedFlatlList->getSelectedItem(); +} + +// virtual void LLTeleportHistoryPanel::onShowOnMap() { if (!mLastSelectedFlatlList) @@ -557,7 +563,6 @@ void LLTeleportHistoryPanel::updateVerbs() if (!mLastSelectedFlatlList) { mTeleportBtn->setEnabled(false); - mShowOnMapBtn->setEnabled(false); mShowProfile->setEnabled(false); return; } @@ -565,8 +570,8 @@ void LLTeleportHistoryPanel::updateVerbs() LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem()); mTeleportBtn->setEnabled(NULL != itemp); - mShowOnMapBtn->setEnabled(NULL != itemp); mShowProfile->setEnabled(NULL != itemp); + mShowOnMapBtn->setEnabled(true); } void LLTeleportHistoryPanel::getNextTab(const LLDate& item_date, S32& tab_idx, LLDate& tab_date) diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h index a456ca506f..1f2be63dc2 100644 --- a/indra/newview/llpanelteleporthistory.h +++ b/indra/newview/llpanelteleporthistory.h @@ -77,6 +77,7 @@ public: /*virtual*/ void onTeleport(); ///*virtual*/ void onCopySLURL(); /*virtual*/ void updateVerbs(); + /*virtual*/ bool isSingleItemSelected(); private: @@ -123,4 +124,6 @@ private: LLHandle<LLView> mGearMenuHandle; }; + + #endif //LL_LLPANELTELEPORTHISTORY_H |