From 0041d485b1c5a1b18c9d5b2ae016f2c1e5ea6b8e Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Thu, 22 Oct 2009 00:21:18 +0000 Subject: Merging revisions 2129-2144 of https://svn.aws.productengine.com/secondlife/pe/stable-2 into P:\svn\viewer-2.0.0-3, respecting ancestry * Bugs: EXT-1293 EXT-1611 EXT-1613 EXT-1176 EXT-1724 EXT-1186 EXT-1662 EXT-1760 EXT-1720 * Dev: EXT-1575 EXT-1770 EXT-1232 EXT-1234 --- indra/newview/llpanelplaceinfo.cpp | 77 +++++++++++++++++++++++++++++++------- 1 file changed, 64 insertions(+), 13 deletions(-) (limited to 'indra/newview/llpanelplaceinfo.cpp') diff --git a/indra/newview/llpanelplaceinfo.cpp b/indra/newview/llpanelplaceinfo.cpp index 2372063fbd..609b205920 100644 --- a/indra/newview/llpanelplaceinfo.cpp +++ b/indra/newview/llpanelplaceinfo.cpp @@ -56,10 +56,12 @@ #include "llagentui.h" #include "llavatarpropertiesprocessor.h" #include "llfloaterworldmap.h" +#include "llfloaterbuycurrency.h" #include "llinventorymodel.h" #include "lllandmarkactions.h" #include "llpanelpick.h" #include "lltexturectrl.h" +#include "llstatusbar.h" #include "llviewerinventory.h" #include "llviewerparcelmgr.h" #include "llviewerregion.h" @@ -87,7 +89,10 @@ LLPanelPlaceInfo::LLPanelPlaceInfo() mMinHeight(0), mScrollingPanel(NULL), mInfoPanel(NULL), - mMediaPanel(NULL) + mMediaPanel(NULL), + mForSalePanel(NULL), + mYouAreHerePanel(NULL), + mSelectedParcelID(-1) {} LLPanelPlaceInfo::~LLPanelPlaceInfo() @@ -103,14 +108,15 @@ BOOL LLPanelPlaceInfo::postBuild() mTitle = getChild("panel_title"); mCurrentTitle = mTitle->getText(); - mForSaleIcon = getChild("icon_for_sale"); + mForSalePanel = getChild("for_sale_panel"); + mYouAreHerePanel = getChild("here_panel"); + LLViewerParcelMgr::getInstance()->addAgentParcelChangedCallback(boost::bind(&LLPanelPlaceInfo::updateYouAreHereBanner,this)); + + //Icon value should contain sale price of last selected parcel. + mForSalePanel->getChild("icon_for_sale")-> + setMouseDownCallback(boost::bind(&LLPanelPlaceInfo::onForSaleBannerClick, this)); - // Since this is only used in the directory browser, always - // disable the snapshot control. Otherwise clicking on it will - // open a texture picker. mSnapshotCtrl = getChild("logo"); - mSnapshotCtrl->setEnabled(FALSE); - mRegionName = getChild("region_title"); mParcelName = getChild("parcel_title"); mDescEditor = getChild("description"); @@ -266,7 +272,8 @@ void LLPanelPlaceInfo::resetLocation() mRequestedID.setNull(); mLandmarkID.setNull(); mPosRegion.clearVec(); - mForSaleIcon->setVisible(FALSE); + mForSalePanel->setVisible(FALSE); + mYouAreHerePanel->setVisible(FALSE); std::string not_available = getString("not_available"); mMaturityRatingText->setValue(not_available); mParcelOwner->setValue(not_available); @@ -479,9 +486,9 @@ void LLPanelPlaceInfo::processParcelInfo(const LLParcelData& parcel_data) //update for_sale banner, here we should use DFQ_FOR_SALE instead of PF_FOR_SALE //because we deal with remote parcel response format - bool isForSale = (parcel_data.flags & DFQ_FOR_SALE) && + bool is_for_sale = (parcel_data.flags & DFQ_FOR_SALE) && mInfoType == AGENT ? TRUE : FALSE; - mForSaleIcon->setVisible(isForSale); + mForSalePanel->setVisible(is_for_sale); S32 region_x; S32 region_y; @@ -797,11 +804,11 @@ void LLPanelPlaceInfo::displaySelectedParcelInfo(LLParcel* parcel, } } + mSelectedParcelID = parcel->getLocalID(); + mLastSelectedRegionID = region->getRegionID(); processParcelInfo(parcel_data); - // TODO: If agent is in currently within the selected parcel - // show the "You Are Here" banner. - + mYouAreHerePanel->setVisible(is_current_parcel); getChild("sales_tab")->setVisible(for_sale); } @@ -978,6 +985,50 @@ void LLPanelPlaceInfo::populateFoldersList() mFolderCombo->add(it->second, LLSD(it->first)); } +void LLPanelPlaceInfo::updateYouAreHereBanner() +{ + //YouAreHere Banner should be displayed only for selected places, + // If you want to display it for landmark or teleport history item, you should check by mParcelId + + bool is_you_are_here = false; + if (mSelectedParcelID != S32(-1) && !mLastSelectedRegionID.isNull()) + { + is_you_are_here = gAgent.getRegion()->getRegionID()== mLastSelectedRegionID && + mSelectedParcelID == LLViewerParcelMgr::getInstance()->getAgentParcel()->getLocalID(); + } + mYouAreHerePanel->setVisible(is_you_are_here); +} + +void LLPanelPlaceInfo::onForSaleBannerClick() +{ + LLViewerParcelMgr* mgr = LLViewerParcelMgr::getInstance(); + LLParcelSelectionHandle hParcel = mgr->getFloatingParcelSelection(); + LLViewerRegion* selected_region = mgr->getSelectionRegion(); + if(!hParcel.isNull() && selected_region) + { + if(hParcel->getParcel()->getLocalID() == mSelectedParcelID && + mLastSelectedRegionID ==selected_region->getRegionID()) + { + if(hParcel->getParcel()->getSalePrice() - gStatusBar->getBalance() > 0) + { + LLFloaterBuyCurrency::buyCurrency("Buying selected land ", hParcel->getParcel()->getSalePrice()); + } + else + { + LLViewerParcelMgr::getInstance()->startBuyLand(); + } + } + else + { + LL_WARNS("Places") << "User is trying to buy remote parcel.Operation is not supported"<< LL_ENDL; + } + + } + + +} + + static bool cmp_folders(const folder_pair_t& left, const folder_pair_t& right) { return left.second < right.second; -- cgit v1.2.3