diff options
author | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-05-22 19:04:52 +0200 |
---|---|---|
committer | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-05-22 19:04:52 +0200 |
commit | 1b67dd855c41f5a0cda7ec2a68d98071986ca703 (patch) | |
tree | ab243607f74f78200787bba5b9b88f07ef1b966f /indra/newview/llpanelland.cpp | |
parent | 6d6eabca44d08d5b97bfe3e941d2b9687c2246ea (diff) | |
parent | e1623bb276f83a43ce7a197e388720c05bdefe61 (diff) |
Merge remote-tracking branch 'origin/main' into DRTVWR-600-maint-A
# Conflicts:
# autobuild.xml
# indra/cmake/CMakeLists.txt
# indra/cmake/GoogleMock.cmake
# indra/llaudio/llaudioengine_fmodstudio.cpp
# indra/llaudio/llaudioengine_fmodstudio.h
# indra/llaudio/lllistener_fmodstudio.cpp
# indra/llaudio/lllistener_fmodstudio.h
# indra/llaudio/llstreamingaudio_fmodstudio.cpp
# indra/llaudio/llstreamingaudio_fmodstudio.h
# indra/llcharacter/llmultigesture.cpp
# indra/llcharacter/llmultigesture.h
# indra/llimage/llimage.cpp
# indra/llimage/llimagepng.cpp
# indra/llimage/llimageworker.cpp
# indra/llimage/tests/llimageworker_test.cpp
# indra/llmessage/tests/llmockhttpclient.h
# indra/llprimitive/llgltfmaterial.h
# indra/llrender/llfontfreetype.cpp
# indra/llui/llcombobox.cpp
# indra/llui/llfolderview.cpp
# indra/llui/llfolderviewmodel.h
# indra/llui/lllineeditor.cpp
# indra/llui/lllineeditor.h
# indra/llui/lltextbase.cpp
# indra/llui/lltextbase.h
# indra/llui/lltexteditor.cpp
# indra/llui/lltextvalidate.cpp
# indra/llui/lltextvalidate.h
# indra/llui/lluictrl.h
# indra/llui/llview.cpp
# indra/llwindow/llwindowmacosx.cpp
# indra/newview/app_settings/settings.xml
# indra/newview/llappearancemgr.cpp
# indra/newview/llappearancemgr.h
# indra/newview/llavatarpropertiesprocessor.cpp
# indra/newview/llavatarpropertiesprocessor.h
# indra/newview/llbreadcrumbview.cpp
# indra/newview/llbreadcrumbview.h
# indra/newview/llbreastmotion.cpp
# indra/newview/llbreastmotion.h
# indra/newview/llconversationmodel.h
# indra/newview/lldensityctrl.cpp
# indra/newview/lldensityctrl.h
# indra/newview/llface.inl
# indra/newview/llfloatereditsky.cpp
# indra/newview/llfloatereditwater.cpp
# indra/newview/llfloateremojipicker.h
# indra/newview/llfloaterimsessiontab.cpp
# indra/newview/llfloaterprofiletexture.cpp
# indra/newview/llfloaterprofiletexture.h
# indra/newview/llgesturemgr.cpp
# indra/newview/llgesturemgr.h
# indra/newview/llimpanel.cpp
# indra/newview/llimpanel.h
# indra/newview/llinventorybridge.cpp
# indra/newview/llinventorybridge.h
# indra/newview/llinventoryclipboard.cpp
# indra/newview/llinventoryclipboard.h
# indra/newview/llinventoryfunctions.cpp
# indra/newview/llinventoryfunctions.h
# indra/newview/llinventorygallery.cpp
# indra/newview/lllistbrowser.cpp
# indra/newview/lllistbrowser.h
# indra/newview/llpanelobjectinventory.cpp
# indra/newview/llpanelprofile.cpp
# indra/newview/llpanelprofile.h
# indra/newview/llpreviewgesture.cpp
# indra/newview/llsavedsettingsglue.cpp
# indra/newview/llsavedsettingsglue.h
# indra/newview/lltooldraganddrop.cpp
# indra/newview/llurllineeditorctrl.cpp
# indra/newview/llvectorperfoptions.cpp
# indra/newview/llvectorperfoptions.h
# indra/newview/llviewerparceloverlay.cpp
# indra/newview/llviewertexlayer.cpp
# indra/newview/llviewertexturelist.cpp
# indra/newview/macmain.h
# indra/test/test.cpp
Diffstat (limited to 'indra/newview/llpanelland.cpp')
-rw-r--r-- | indra/newview/llpanelland.cpp | 518 |
1 files changed, 259 insertions, 259 deletions
diff --git a/indra/newview/llpanelland.cpp b/indra/newview/llpanelland.cpp index c7ced5699b..a76505f2de 100644 --- a/indra/newview/llpanelland.cpp +++ b/indra/newview/llpanelland.cpp @@ -1,259 +1,259 @@ -/** - * @file llpanelland.cpp - * @brief Land information in the tool floater, NOT the "About Land" floater - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#include "llviewerprecompiledheaders.h" - -#include "llpanelland.h" - -#include "llparcel.h" - -#include "llagent.h" -#include "llbutton.h" -#include "llcheckboxctrl.h" -#include "llfloaterland.h" -#include "llfloaterreg.h" -#include "lltextbox.h" -#include "llviewercontrol.h" -#include "llviewerparcelmgr.h" -#include "llviewerregion.h" -#include "llviewerwindow.h" -#include "roles_constants.h" - -#include "lluictrlfactory.h" - -LLPanelLandSelectObserver* LLPanelLandInfo::sObserver = NULL; -LLPanelLandInfo* LLPanelLandInfo::sInstance = NULL; - -class LLPanelLandSelectObserver : public LLParcelObserver -{ -public: - LLPanelLandSelectObserver() {} - virtual ~LLPanelLandSelectObserver() {} - virtual void changed() { LLPanelLandInfo::refreshAll(); } -}; - - -bool LLPanelLandInfo::postBuild() -{ - childSetAction("button buy land",boost::bind(onClickClaim)); - childSetAction("button abandon land", boost::bind(onClickRelease)); - childSetAction("button subdivide land", boost::bind(onClickDivide)); - childSetAction("button join land", boost::bind(onClickJoin)); - childSetAction("button about land", boost::bind(onClickAbout)); - - mCheckShowOwners = getChild<LLCheckBoxCtrl>("checkbox show owners"); - getChild<LLUICtrl>("checkbox show owners")->setValue(gSavedSettings.getBOOL("ShowParcelOwners")); - - return true; -} -// -// Methods -// -LLPanelLandInfo::LLPanelLandInfo() -: LLPanel(), - mCheckShowOwners(NULL) -{ - if (!sInstance) - { - sInstance = this; - } - if (!sObserver) - { - sObserver = new LLPanelLandSelectObserver(); - LLViewerParcelMgr::getInstance()->addObserver( sObserver ); - } - -} - - -// virtual -LLPanelLandInfo::~LLPanelLandInfo() -{ - LLViewerParcelMgr::getInstance()->removeObserver( sObserver ); - delete sObserver; - sObserver = NULL; - - sInstance = NULL; -} - - -// static -void LLPanelLandInfo::refreshAll() -{ - if (sInstance) - { - sInstance->refresh(); - } -} - - -// public -void LLPanelLandInfo::refresh() -{ - LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); - LLViewerRegion *regionp = LLViewerParcelMgr::getInstance()->getSelectionRegion(); - - if (!parcel || !regionp) - { - // nothing selected, disable panel - getChildView("label_area_price")->setVisible(false); - getChildView("label_area")->setVisible(false); - - //mTextPrice->setText(LLStringUtil::null); - getChild<LLUICtrl>("textbox price")->setValue(LLStringUtil::null); - - getChildView("button buy land")->setEnabled(false); - getChildView("button abandon land")->setEnabled(false); - getChildView("button subdivide land")->setEnabled(false); - getChildView("button join land")->setEnabled(false); - getChildView("button about land")->setEnabled(false); - } - else - { - // something selected, hooray! - const LLUUID& owner_id = parcel->getOwnerID(); - const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID(); - - bool is_public = parcel->isPublic(); - bool is_for_sale = parcel->getForSale() - && ((parcel->getSalePrice() > 0) || (auth_buyer_id.notNull())); - bool can_buy = (is_for_sale - && (owner_id != gAgent.getID()) - && ((gAgent.getID() == auth_buyer_id) - || (auth_buyer_id.isNull()))); - - if (is_public && !LLViewerParcelMgr::getInstance()->getParcelSelection()->getMultipleOwners()) - { - getChildView("button buy land")->setEnabled(true); - } - else - { - getChildView("button buy land")->setEnabled(can_buy); - } - - bool owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_RELEASE); - bool owner_divide = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_DIVIDE_JOIN); - - bool manager_releaseable = ( gAgent.canManageEstate() - && (parcel->getOwnerID() == regionp->getOwner()) ); - - bool manager_divideable = ( gAgent.canManageEstate() - && ((parcel->getOwnerID() == regionp->getOwner()) || owner_divide) ); - - getChildView("button abandon land")->setEnabled(owner_release || manager_releaseable || gAgent.isGodlike()); - - // only mainland sims are subdividable by owner - if (regionp->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES)) - { - getChildView("button subdivide land")->setEnabled(owner_divide || manager_divideable || gAgent.isGodlike()); - } - else - { - getChildView("button subdivide land")->setEnabled(manager_divideable || gAgent.isGodlike()); - } - - // To join land, must have something selected, - // not just a single unit of land, - // you must own part of it, - // and it must not be a whole parcel. - if (LLViewerParcelMgr::getInstance()->getSelectedArea() > PARCEL_UNIT_AREA - //&& LLViewerParcelMgr::getInstance()->getSelfCount() > 1 - && !LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected()) - { - getChildView("button join land")->setEnabled(true); - } - else - { - LL_DEBUGS() << "Invalid selection for joining land" << LL_ENDL; - getChildView("button join land")->setEnabled(false); - } - - getChildView("button about land")->setEnabled(true); - - // show pricing information - S32 area; - S32 claim_price; - S32 rent_price; - bool for_sale; - F32 dwell; - LLViewerParcelMgr::getInstance()->getDisplayInfo(&area, - &claim_price, - &rent_price, - &for_sale, - &dwell); - if(is_public || (is_for_sale && LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected())) - { - getChild<LLUICtrl>("label_area_price")->setTextArg("[PRICE]", llformat("%d",claim_price)); - getChild<LLUICtrl>("label_area_price")->setTextArg("[AREA]", llformat("%d",area)); - getChildView("label_area_price")->setVisible(true); - getChildView("label_area")->setVisible(false); - } - else - { - getChildView("label_area_price")->setVisible(false); - getChild<LLUICtrl>("label_area")->setTextArg("[AREA]", llformat("%d",area)); - getChildView("label_area")->setVisible(true); - } - } -} - - -//static -void LLPanelLandInfo::onClickClaim() -{ - LLViewerParcelMgr::getInstance()->startBuyLand(); -} - - -//static -void LLPanelLandInfo::onClickRelease() -{ - LLViewerParcelMgr::getInstance()->startReleaseLand(); -} - -// static -void LLPanelLandInfo::onClickDivide() -{ - LLViewerParcelMgr::getInstance()->startDivideLand(); -} - -// static -void LLPanelLandInfo::onClickJoin() -{ - LLViewerParcelMgr::getInstance()->startJoinLand(); -} - -//static -void LLPanelLandInfo::onClickAbout() -{ - // Promote the rectangle selection to a parcel selection - if (!LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected()) - { - LLViewerParcelMgr::getInstance()->selectParcelInRectangle(); - } - - LLFloaterReg::showInstance("about_land"); -} +/**
+ * @file llpanelland.cpp
+ * @brief Land information in the tool floater, NOT the "About Land" floater
+ *
+ * $LicenseInfo:firstyear=2002&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llpanelland.h"
+
+#include "llparcel.h"
+
+#include "llagent.h"
+#include "llbutton.h"
+#include "llcheckboxctrl.h"
+#include "llfloaterland.h"
+#include "llfloaterreg.h"
+#include "lltextbox.h"
+#include "llviewercontrol.h"
+#include "llviewerparcelmgr.h"
+#include "llviewerregion.h"
+#include "llviewerwindow.h"
+#include "roles_constants.h"
+
+#include "lluictrlfactory.h"
+
+LLPanelLandSelectObserver* LLPanelLandInfo::sObserver = NULL;
+LLPanelLandInfo* LLPanelLandInfo::sInstance = NULL;
+
+class LLPanelLandSelectObserver : public LLParcelObserver
+{
+public:
+ LLPanelLandSelectObserver() {}
+ virtual ~LLPanelLandSelectObserver() {}
+ virtual void changed() { LLPanelLandInfo::refreshAll(); }
+};
+
+
+bool LLPanelLandInfo::postBuild()
+{
+ childSetAction("button buy land",boost::bind(onClickClaim));
+ childSetAction("button abandon land", boost::bind(onClickRelease));
+ childSetAction("button subdivide land", boost::bind(onClickDivide));
+ childSetAction("button join land", boost::bind(onClickJoin));
+ childSetAction("button about land", boost::bind(onClickAbout));
+
+ mCheckShowOwners = getChild<LLCheckBoxCtrl>("checkbox show owners");
+ getChild<LLUICtrl>("checkbox show owners")->setValue(gSavedSettings.getBOOL("ShowParcelOwners"));
+
+ return true;
+}
+//
+// Methods
+//
+LLPanelLandInfo::LLPanelLandInfo()
+: LLPanel(),
+ mCheckShowOwners(NULL)
+{
+ if (!sInstance)
+ {
+ sInstance = this;
+ }
+ if (!sObserver)
+ {
+ sObserver = new LLPanelLandSelectObserver();
+ LLViewerParcelMgr::getInstance()->addObserver( sObserver );
+ }
+
+}
+
+
+// virtual
+LLPanelLandInfo::~LLPanelLandInfo()
+{
+ LLViewerParcelMgr::getInstance()->removeObserver( sObserver );
+ delete sObserver;
+ sObserver = NULL;
+
+ sInstance = NULL;
+}
+
+
+// static
+void LLPanelLandInfo::refreshAll()
+{
+ if (sInstance)
+ {
+ sInstance->refresh();
+ }
+}
+
+
+// public
+void LLPanelLandInfo::refresh()
+{
+ LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel();
+ LLViewerRegion *regionp = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+
+ if (!parcel || !regionp)
+ {
+ // nothing selected, disable panel
+ getChildView("label_area_price")->setVisible(false);
+ getChildView("label_area")->setVisible(false);
+
+ //mTextPrice->setText(LLStringUtil::null);
+ getChild<LLUICtrl>("textbox price")->setValue(LLStringUtil::null);
+
+ getChildView("button buy land")->setEnabled(false);
+ getChildView("button abandon land")->setEnabled(false);
+ getChildView("button subdivide land")->setEnabled(false);
+ getChildView("button join land")->setEnabled(false);
+ getChildView("button about land")->setEnabled(false);
+ }
+ else
+ {
+ // something selected, hooray!
+ const LLUUID& owner_id = parcel->getOwnerID();
+ const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID();
+
+ bool is_public = parcel->isPublic();
+ bool is_for_sale = parcel->getForSale()
+ && ((parcel->getSalePrice() > 0) || (auth_buyer_id.notNull()));
+ bool can_buy = (is_for_sale
+ && (owner_id != gAgent.getID())
+ && ((gAgent.getID() == auth_buyer_id)
+ || (auth_buyer_id.isNull())));
+
+ if (is_public && !LLViewerParcelMgr::getInstance()->getParcelSelection()->getMultipleOwners())
+ {
+ getChildView("button buy land")->setEnabled(true);
+ }
+ else
+ {
+ getChildView("button buy land")->setEnabled(can_buy);
+ }
+
+ bool owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_RELEASE);
+ bool owner_divide = LLViewerParcelMgr::isParcelOwnedByAgent(parcel, GP_LAND_DIVIDE_JOIN);
+
+ bool manager_releaseable = ( gAgent.canManageEstate()
+ && (parcel->getOwnerID() == regionp->getOwner()) );
+
+ bool manager_divideable = ( gAgent.canManageEstate()
+ && ((parcel->getOwnerID() == regionp->getOwner()) || owner_divide) );
+
+ getChildView("button abandon land")->setEnabled(owner_release || manager_releaseable || gAgent.isGodlike());
+
+ // only mainland sims are subdividable by owner
+ if (regionp->getRegionFlag(REGION_FLAGS_ALLOW_PARCEL_CHANGES))
+ {
+ getChildView("button subdivide land")->setEnabled(owner_divide || manager_divideable || gAgent.isGodlike());
+ }
+ else
+ {
+ getChildView("button subdivide land")->setEnabled(manager_divideable || gAgent.isGodlike());
+ }
+
+ // To join land, must have something selected,
+ // not just a single unit of land,
+ // you must own part of it,
+ // and it must not be a whole parcel.
+ if (LLViewerParcelMgr::getInstance()->getSelectedArea() > PARCEL_UNIT_AREA
+ //&& LLViewerParcelMgr::getInstance()->getSelfCount() > 1
+ && !LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected())
+ {
+ getChildView("button join land")->setEnabled(true);
+ }
+ else
+ {
+ LL_DEBUGS() << "Invalid selection for joining land" << LL_ENDL;
+ getChildView("button join land")->setEnabled(false);
+ }
+
+ getChildView("button about land")->setEnabled(true);
+
+ // show pricing information
+ S32 area;
+ S32 claim_price;
+ S32 rent_price;
+ bool for_sale;
+ F32 dwell;
+ LLViewerParcelMgr::getInstance()->getDisplayInfo(&area,
+ &claim_price,
+ &rent_price,
+ &for_sale,
+ &dwell);
+ if(is_public || (is_for_sale && LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected()))
+ {
+ getChild<LLUICtrl>("label_area_price")->setTextArg("[PRICE]", llformat("%d",claim_price));
+ getChild<LLUICtrl>("label_area_price")->setTextArg("[AREA]", llformat("%d",area));
+ getChildView("label_area_price")->setVisible(true);
+ getChildView("label_area")->setVisible(false);
+ }
+ else
+ {
+ getChildView("label_area_price")->setVisible(false);
+ getChild<LLUICtrl>("label_area")->setTextArg("[AREA]", llformat("%d",area));
+ getChildView("label_area")->setVisible(true);
+ }
+ }
+}
+
+
+//static
+void LLPanelLandInfo::onClickClaim()
+{
+ LLViewerParcelMgr::getInstance()->startBuyLand();
+}
+
+
+//static
+void LLPanelLandInfo::onClickRelease()
+{
+ LLViewerParcelMgr::getInstance()->startReleaseLand();
+}
+
+// static
+void LLPanelLandInfo::onClickDivide()
+{
+ LLViewerParcelMgr::getInstance()->startDivideLand();
+}
+
+// static
+void LLPanelLandInfo::onClickJoin()
+{
+ LLViewerParcelMgr::getInstance()->startJoinLand();
+}
+
+//static
+void LLPanelLandInfo::onClickAbout()
+{
+ // Promote the rectangle selection to a parcel selection
+ if (!LLViewerParcelMgr::getInstance()->getParcelSelection()->getWholeParcelSelected())
+ {
+ LLViewerParcelMgr::getInstance()->selectParcelInRectangle();
+ }
+
+ LLFloaterReg::showInstance("about_land");
+}
|