merge -r 56779:58057 /branches/selection_management

master
Richard Nelson 2007-02-17 03:02:16 +00:00
parent 12ac04231b
commit 73bc0fb42b
84 changed files with 2368 additions and 2152 deletions

View File

@ -10,6 +10,11 @@
#include "llmemory.h"
// not defining nullfunc will currently crash when trying to use a LLHandle
template< typename _Ty >
const typename LLHandle< _Ty >::NullFunc
LLHandle< _Ty >::sNullFunc = LLHandle< _Ty >::defaultNullFunc;
//----------------------------------------------------------------------------
//static

View File

@ -120,6 +120,7 @@ public:
}
return mRef;
}
S32 getNumRefs() const
{
return mRef;
@ -249,6 +250,154 @@ protected:
Type* mPointer;
};
//template <class Type>
//class LLPointerTraits
//{
// static Type* null();
//};
//
// Expands LLPointer to return a pointer to a special instance of class Type instead of NULL.
// This is useful in instances where operations on NULL pointers are semantically safe and/or
// when error checking occurs at a different granularity or in a different part of the code
// than when referencing an object via a LLHandle.
//
template <class Type>
class LLHandle
{
public:
LLHandle() :
mPointer(sNullFunc())
{
ref();
}
LLHandle(Type* ptr) :
mPointer(nonNull(ptr))
{
ref();
}
LLHandle(const LLHandle<Type>& ptr) :
mPointer(ptr.mPointer)
{
ref();
}
// support conversion up the type hierarchy. See Item 45 in Effective C++, 3rd Ed.
template<typename Subclass>
LLHandle(const LLPointer<Subclass>& ptr) :
mPointer(ptr.get())
{
ref();
}
~LLHandle()
{
unref();
}
Type* get() const { return mPointer; }
const Type* operator->() const { return mPointer; }
Type* operator->() { return mPointer; }
const Type& operator*() const { return *mPointer; }
Type& operator*() { return *mPointer; }
operator BOOL() const { return (mPointer != sNullFunc()); }
operator bool() const { return (mPointer != sNullFunc()); }
bool operator!() const { return (mPointer == sNullFunc()); }
bool isNull() const { return (mPointer == sNullFunc()); }
bool notNull() const { return (mPointer != sNullFunc()); }
operator Type*() const { return mPointer; }
operator const Type*() const { return mPointer; }
bool operator !=(Type* ptr) const { return (mPointer != nonNull(ptr)); }
bool operator ==(Type* ptr) const { return (mPointer == nonNull(ptr)); }
bool operator ==(const LLHandle<Type>& ptr) const { return (mPointer == ptr.mPointer); }
bool operator < (const LLHandle<Type>& ptr) const { return (mPointer < ptr.mPointer); }
bool operator > (const LLHandle<Type>& ptr) const { return (mPointer > ptr.mPointer); }
LLHandle<Type>& operator =(Type* ptr)
{
if( mPointer != ptr )
{
unref();
mPointer = nonNull(ptr);
ref();
}
return *this;
}
LLHandle<Type>& operator =(const LLHandle<Type>& ptr)
{
if( mPointer != ptr.mPointer )
{
unref();
mPointer = ptr.mPointer;
ref();
}
return *this;
}
// support assignment up the type hierarchy. See Item 45 in Effective C++, 3rd Ed.
template<typename Subclass>
LLHandle<Type>& operator =(const LLHandle<Subclass>& ptr)
{
if( mPointer != ptr.get() )
{
unref();
mPointer = ptr.get();
ref();
}
return *this;
}
public:
typedef Type* (*NullFunc)();
static const NullFunc sNullFunc;
protected:
void ref()
{
if (mPointer)
{
mPointer->ref();
}
}
void unref()
{
if (mPointer)
{
Type *tempp = mPointer;
mPointer = sNullFunc();
tempp->unref();
if (mPointer != sNullFunc())
{
llwarns << "Unreference did assignment to non-NULL because of destructor" << llendl;
unref();
}
}
}
static Type* nonNull(Type* ptr)
{
return ptr == NULL ? sNullFunc() : ptr;
}
static Type* defaultNullFunc()
{
llerrs << "No null value provided for LLHandle" << llendl;
return NULL;
}
protected:
Type* mPointer;
};
// LLInitializedPointer is just a pointer with a default constructor that initializes it to NULL
// NOT a smart pointer like LLPointer<>
// Useful for example in std::map<int,LLInitializedPointer<LLFoo> >

View File

@ -527,6 +527,8 @@ void LLFloater::open() /* Flawfinder: ignore */
make_ui_sound("UISndWindowOpen");
}
}
onOpen();
}
void LLFloater::close(bool app_quitting)
@ -1336,6 +1338,11 @@ void LLFloater::draw()
}
}
// virtual
void LLFloater::onOpen()
{
}
// virtual
void LLFloater::onClose(bool app_quitting)
{

View File

@ -157,6 +157,9 @@ public:
virtual void draw();
// does nothing by default
virtual void onOpen();
// Call destroy() to free memory, or setVisible(FALSE) to keep it
// If app_quitting, you might not want to save your visibility.
// Defaults to destroy().

View File

@ -385,11 +385,7 @@ void LLMenuItemGL::doIt( void )
{
// close all open menus by default
// if parent menu is actually visible (and we are not triggering menu item via accelerator)
// HACK: do not call hidemenus() from a pie menu item, as most pie menu operations
// assume that the thing you clicked on stays selected (parcel and/or object) after the
// pie menu is gone --RN
if (getMenu()->getWidgetType() != WIDGET_TYPE_PIE_MENU
&& !getMenu()->getTornOff()
if (!getMenu()->getTornOff()
&& getMenu()->getVisible())
{
LLMenuGL::sMenuContainer->hideMenus();
@ -3283,7 +3279,7 @@ void LLPieMenuBranch::doIt( void )
S32 center_y;
parent->localPointToScreen(rect.getWidth() / 2, rect.getHeight() / 2, &center_x, &center_y);
parent->hide(TRUE);
parent->hide(FALSE);
mBranch->show( center_x, center_y, FALSE );
}
@ -3473,6 +3469,11 @@ BOOL LLPieMenu::handleMouseDown( S32 x, S32 y, MASK mask )
// to make sure it's within the item's rectangle
handled = item->handleMouseDown( 0, 0, mask );
}
else if (!mRightMouseDown)
{
// call hidemenus to make sure transient selections get cleared
((LLMenuHolderGL*)getParent())->hideMenus();
}
// always handle mouse down as mouse up will close open menus
return handled;
@ -3546,6 +3547,11 @@ BOOL LLPieMenu::handleMouseUp( S32 x, S32 y, MASK mask )
hide(TRUE);
}
}
else if (!mRightMouseDown)
{
// call hidemenus to make sure transient selections get cleared
((LLMenuHolderGL*)getParent())->hideMenus();
}
if (handled)
{

View File

@ -462,17 +462,16 @@ void LLAgent::resetView(BOOL reset_camera)
if (!gNoRender)
{
gSelectMgr->deselectAll();
gSelectMgr->unhighlightAll();
// By popular request, keep land selection while walking around. JC
// gParcelMgr->deselectLand();
//FIXME: force deselect when walking? - RN
// gSelectMgr->deselectAll();
// Hide all popup menus
gPieSelf->hide(FALSE);
gPieAvatar->hide(FALSE);
gPieObject->hide(FALSE);
gPieLand->hide(FALSE);
gMenuHolder->hideMenus();
}
if (reset_camera && !gSavedSettings.getBOOL("FreezeTime"))
@ -1565,7 +1564,8 @@ F32 LLAgent::getCameraZoomFraction()
{
// 0.f -> camera zoomed all the way out
// 1.f -> camera zoomed all the way in
if (gSelectMgr->getObjectCount() && gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
LLObjectSelectionHandle selection = gSelectMgr->getSelection();
if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD)
{
// already [0,1]
return mAvatarObject->mHUDTargetZoom;
@ -1612,7 +1612,9 @@ void LLAgent::setCameraZoomFraction(F32 fraction)
{
// 0.f -> camera zoomed all the way out
// 1.f -> camera zoomed all the way in
if (gSelectMgr->getObjectCount() && gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
LLObjectSelectionHandle selection = gSelectMgr->getSelection();
if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD)
{
mAvatarObject->mHUDTargetZoom = fraction;
}
@ -1662,7 +1664,8 @@ void LLAgent::setCameraZoomFraction(F32 fraction)
//-----------------------------------------------------------------------------
void LLAgent::cameraOrbitAround(const F32 radians)
{
if (gSelectMgr->getObjectCount() && gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
LLObjectSelectionHandle selection = gSelectMgr->getSelection();
if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD)
{
// do nothing for hud selection
}
@ -1684,7 +1687,8 @@ void LLAgent::cameraOrbitAround(const F32 radians)
//-----------------------------------------------------------------------------
void LLAgent::cameraOrbitOver(const F32 angle)
{
if (gSelectMgr->getObjectCount() && gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
LLObjectSelectionHandle selection = gSelectMgr->getSelection();
if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD)
{
// do nothing for hud selection
}
@ -1718,7 +1722,8 @@ void LLAgent::cameraZoomIn(const F32 fraction)
return;
}
if (gSelectMgr->getObjectCount() && gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
LLObjectSelectionHandle selection = gSelectMgr->getSelection();
if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD)
{
// just update hud zoom level
mAvatarObject->mHUDTargetZoom /= fraction;
@ -2237,11 +2242,9 @@ void LLAgent::stopAutoPilot(BOOL user_cancel)
resetAxes(mAutoPilotTargetFacing);
}
//NB: auto pilot can terminate for a reason other than reaching the destination
//TODO: enforce rotation constraint here as well
if (mAutoPilotFinishedCallback &&
((mAutoPilotTargetDist < mAutoPilotStopDistance) || (mAutoPilotNoProgressFrameCount > AUTOPILOT_MAX_TIME_NO_PROGRESS * gFPSClamped)))
if (mAutoPilotFinishedCallback)
{
mAutoPilotFinishedCallback(!user_cancel && dist_vec(gAgent.getPositionGlobal(), mAutoPilotTargetGlobal) < mAutoPilotTargetDist, mAutoPilotCallbackData);
mAutoPilotFinishedCallback(!user_cancel && dist_vec(gAgent.getPositionGlobal(), mAutoPilotTargetGlobal) < mAutoPilotStopDistance, mAutoPilotCallbackData);
}
mLeaderID = LLUUID::null;
@ -2712,8 +2715,8 @@ U8 LLAgent::getRenderState()
stopTyping();
}
if ((!gSelectMgr->isEmpty() && gSelectMgr->shouldShowSelection())
|| gToolMgr->getCurrentTool( gKeyboard->currentMask(TRUE) )->isEditing() )
if ((!gSelectMgr->getSelection()->isEmpty() && gSelectMgr->shouldShowSelection())
|| gToolMgr->getCurrentTool()->isEditing() )
{
setRenderState(AGENT_STATE_EDITING);
}
@ -2755,8 +2758,7 @@ void LLAgent::endAnimationUpdateUI()
gMenuBarView->setVisible(TRUE);
gStatusBar->setVisibleForMouselook(true);
gCurrentToolset = gBasicToolset;
gToolMgr->useSelectedTool( gCurrentToolset );
gToolMgr->setCurrentToolset(gBasicToolset);
// Only pop if we have pushed...
if (TRUE == mViewsPushed)
@ -2804,8 +2806,7 @@ void LLAgent::endAnimationUpdateUI()
{
// make sure we ask to save changes
gCurrentToolset = gBasicToolset;
gToolMgr->useSelectedTool( gCurrentToolset );
gToolMgr->setCurrentToolset(gBasicToolset);
// HACK: If we're quitting, and we were in customize avatar, don't
// let the mini-map go visible again. JC
@ -2842,8 +2843,7 @@ void LLAgent::endAnimationUpdateUI()
// JC - Added for always chat in third person option
gFocusMgr.setKeyboardFocus(NULL, NULL);
gCurrentToolset = gMouselookToolset;
gToolMgr->useSelectedTool( gMouselookToolset );
gToolMgr->setCurrentToolset(gMouselookToolset);
mViewsPushed = TRUE;
@ -2901,8 +2901,7 @@ void LLAgent::endAnimationUpdateUI()
}
else if (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR)
{
gCurrentToolset = gFaceEditToolset;
gToolMgr->useSelectedTool( gFaceEditToolset );
gToolMgr->setCurrentToolset(gFaceEditToolset);
gFloaterMap->pushVisible(FALSE);
/*
@ -3854,6 +3853,7 @@ void LLAgent::handleScrollWheel(S32 clicks)
}
else
{
LLObjectSelectionHandle selection = gSelectMgr->getSelection();
const F32 ROOT_ROOT_TWO = sqrt(F_SQRT2);
// Block if camera is animating
@ -3862,7 +3862,7 @@ void LLAgent::handleScrollWheel(S32 clicks)
return;
}
if (gSelectMgr->getObjectCount() && gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (selection->getObjectCount() && selection->getSelectType() == SELECT_TYPE_HUD)
{
F32 zoom_factor = (F32)pow(0.8, -clicks);
cameraZoomIn(zoom_factor);
@ -3933,9 +3933,7 @@ void LLAgent::changeCameraToMouselook(BOOL animate)
// unpause avatar animation
mPauseRequest = NULL;
gCurrentToolset = gMouselookToolset;
gCurrentToolset->selectFirstTool();
gToolMgr->useSelectedTool( gCurrentToolset );
gToolMgr->setCurrentToolset(gMouselookToolset);
gSavedSettings.setBOOL("FirstPersonBtnState", FALSE);
gSavedSettings.setBOOL("MouselookBtnState", TRUE);
@ -4017,9 +4015,7 @@ void LLAgent::changeCameraToFollow(BOOL animate)
if (gBasicToolset)
{
gCurrentToolset = gBasicToolset;
gCurrentToolset->selectFirstTool();
gToolMgr->useSelectedTool( gCurrentToolset );
gToolMgr->setCurrentToolset(gBasicToolset);
}
if (mAvatarObject)
@ -4092,9 +4088,7 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate)
{
if (gBasicToolset)
{
gCurrentToolset = gBasicToolset;
gCurrentToolset->selectFirstTool();
gToolMgr->useSelectedTool( gCurrentToolset );
gToolMgr->setCurrentToolset(gBasicToolset);
}
mCameraLag.clearVec();
@ -4157,9 +4151,7 @@ void LLAgent::changeCameraToCustomizeAvatar(BOOL animate)
if (gFaceEditToolset)
{
gCurrentToolset = gFaceEditToolset;
gCurrentToolset->selectFirstTool();
gToolMgr->useSelectedTool( gCurrentToolset );
gToolMgr->setCurrentToolset(gFaceEditToolset);
}
gSavedSettings.setBOOL("FirstPersonBtnState", FALSE);

View File

@ -88,21 +88,22 @@ void LLFloaterAuction::show()
void LLFloaterAuction::initialize()
{
LLParcel* parcel = gParcelMgr->getSelectedParcel();
mParcelp = gParcelMgr->getParcelSelection();
LLViewerRegion* region = gParcelMgr->getSelectionRegion();
if(parcel && region && !parcel->getForSale())
LLParcel* parcelp = mParcelp->getParcel();
if(parcelp && region && !parcelp->getForSale())
{
mParcelHost = region->getHost();
mParcelID = parcel->getLocalID();
mParcelID = parcelp->getLocalID();
childSetText("parcel_text", parcel->getName());
childSetText("parcel_text", parcelp->getName());
childEnable("snapshot_btn");
childEnable("ok_btn");
}
else
{
mParcelHost.invalidate();
if(parcel && parcel->getForSale())
if(parcelp && parcelp->getForSale())
{
childSetText("parcel_text", childGetText("already for sale"));
}

View File

@ -20,6 +20,7 @@
//
// Class which holds the functionality to start auctions.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class LLParcelSelection;
class LLFloaterAuction : public LLFloater
{
@ -45,6 +46,7 @@ private:
LLTransactionID mTransactionID;
LLAssetID mImageID;
LLPointer<LLImageGL> mImage;
LLHandle<LLParcelSelection> mParcelp;
S32 mParcelID;
LLHost mParcelHost;
};

View File

@ -44,8 +44,6 @@ LLFloaterBuy::LLFloaterBuy()
LLFloaterBuy::~LLFloaterBuy()
{
gSelectMgr->deselectAll();
sInstance = NULL;
}
@ -61,7 +59,9 @@ void LLFloaterBuy::reset()
// static
void LLFloaterBuy::show(const LLSaleInfo& sale_info)
{
if (gSelectMgr->getRootObjectCount() != 1)
LLObjectSelectionHandle selection = gSelectMgr->getSelection();
if (selection->getRootObjectCount() != 1)
{
gViewerWindow->alertXml("BuyOneObjectOnly");
return;
@ -81,6 +81,7 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info)
sInstance->open(); /*Flawfinder: ignore*/
sInstance->setFocus(TRUE);
sInstance->mSaleInfo = sale_info;
sInstance->mObjectSelection = gSelectMgr->getEditSelection();
// Always center the dialog. User can change the size,
// but purchases are important and should be center screen.
@ -88,7 +89,7 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info)
// mid-session and the saved rect is off-center.
sInstance->center();
LLSelectNode* node = gSelectMgr->getFirstRootNode();
LLSelectNode* node = selection->getFirstRootNode();
if (!node) return;
// Set title based on sale type
@ -162,7 +163,7 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info)
// Must do this after the floater is created, because
// sometimes the inventory is already there and
// the callback is called immediately.
LLViewerObject* obj = gSelectMgr->getFirstRootObject();
LLViewerObject* obj = selection->getFirstRootObject();
sInstance->registerVOInventoryListener(obj,NULL);
sInstance->requestVOInventory();
}

View File

@ -22,6 +22,7 @@
class LLViewerObject;
class LLSaleInfo;
class LLObjectSelection;
class LLFloaterBuy
: public LLFloater, public LLVOInventoryListener
@ -47,6 +48,7 @@ protected:
private:
static LLFloaterBuy* sInstance;
LLHandle<LLObjectSelection> mObjectSelection;
LLSaleInfo mSaleInfo;
};

View File

@ -49,8 +49,6 @@ LLFloaterBuyContents::LLFloaterBuyContents()
LLFloaterBuyContents::~LLFloaterBuyContents()
{
gSelectMgr->deselectAll();
sInstance = NULL;
}
@ -58,7 +56,9 @@ LLFloaterBuyContents::~LLFloaterBuyContents()
// static
void LLFloaterBuyContents::show(const LLSaleInfo& sale_info)
{
if (gSelectMgr->getRootObjectCount() != 1)
LLObjectSelectionHandle selection = gSelectMgr->getSelection();
if (selection->getRootObjectCount() != 1)
{
gViewerWindow->alertXml("BuyContentsOneOnly");
return;
@ -77,6 +77,7 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info)
sInstance->open(); /*Flawfinder: ignore*/
sInstance->setFocus(TRUE);
sInstance->mObjectSelection = gSelectMgr->getEditSelection();
// Always center the dialog. User can change the size,
// but purchases are important and should be center screen.
@ -96,7 +97,7 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info)
sInstance->mSaleInfo = sale_info;
// Update the display
LLSelectNode* node = gSelectMgr->getFirstRootNode();
LLSelectNode* node = selection->getFirstRootNode();
if (!node) return;
if(node->mPermissions->isGroupOwned())
{
@ -112,7 +113,7 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info)
// Must do this after the floater is created, because
// sometimes the inventory is already there and
// the callback is called immediately.
LLViewerObject* obj = gSelectMgr->getFirstRootObject();
LLViewerObject* obj = selection->getFirstRootObject();
sInstance->registerVOInventoryListener(obj,NULL);
sInstance->requestVOInventory();
}

View File

@ -20,6 +20,7 @@
#include "llinventory.h"
class LLViewerObject;
class LLObjectSelection;
class LLFloaterBuyContents
: public LLFloater, public LLVOInventoryListener
@ -43,6 +44,7 @@ protected:
protected:
static LLFloaterBuyContents* sInstance;
LLHandle<LLObjectSelection> mObjectSelection;
LLSaleInfo mSaleInfo;
};

View File

@ -56,7 +56,7 @@ private:
virtual ~LLFloaterBuyLandUI();
LLViewerRegion* mRegion;
LLParcel* mParcel;
LLParcelSelectionHandle mParcel;
bool mIsClaim;
bool mIsForGroup;
@ -127,7 +127,7 @@ public:
static LLFloaterBuyLandUI* soleInstance(bool createIfNeeded);
void setForGroup(bool is_for_group);
void setParcel(LLViewerRegion* region, LLParcel* parcel);
void setParcel(LLViewerRegion* region, LLParcelSelectionHandle parcel);
void updateAgentInfo();
void updateParcelInfo();
@ -186,7 +186,7 @@ static void cacheNameUpdateRefreshesBuyLand(const LLUUID&,
// static
void LLFloaterBuyLand::buyLand(
LLViewerRegion* region, LLParcel* parcel, bool is_for_group)
LLViewerRegion* region, LLParcelSelectionHandle parcel, bool is_for_group)
{
if(is_for_group && !gAgent.hasPowerInActiveGroup(GP_LAND_DEED))
{
@ -331,7 +331,7 @@ void LLFloaterBuyLandUI::SelectionObserver::changed()
else {
ui->setParcel(
gParcelMgr->getSelectionRegion(),
gParcelMgr->getSelectedParcel());
gParcelMgr->getParcelSelection());
}
}
}
@ -349,7 +349,8 @@ void LLFloaterBuyLandUI::updateAgentInfo()
void LLFloaterBuyLandUI::updateParcelInfo()
{
mParcelValid = mParcel && mRegion;
LLParcel* parcel = mParcel->getParcel();
mParcelValid = parcel && mRegion;
mParcelIsForSale = false;
mParcelIsFirstLand = false;
mParcelIsGroupLand = false;
@ -372,42 +373,41 @@ void LLFloaterBuyLandUI::updateParcelInfo()
return;
}
if (gParcelMgr->getMultipleOwners())
if (mParcel->getMultipleOwners())
{
mCannotBuyReason = childGetText("multiple_parcels_selected");
return;
}
const LLUUID& parcelOwner = parcel->getOwnerID();
const LLUUID& parcelOwner = mParcel->getOwnerID();
mIsClaim = mParcel->isPublic();
mIsClaim = parcel->isPublic();
if (!mIsClaim)
{
mParcelActualArea = mParcel->getArea();
mParcelIsForSale = mParcel->getForSale();
mParcelIsFirstLand = mParcel->getReservedForNewbie();
mParcelIsGroupLand = mParcel->getIsGroupOwned();
mParcelPrice = mParcelIsForSale ? mParcel->getSalePrice() : 0;
mParcelActualArea = parcel->getArea();
mParcelIsForSale = parcel->getForSale();
mParcelIsFirstLand = parcel->getReservedForNewbie();
mParcelIsGroupLand = parcel->getIsGroupOwned();
mParcelPrice = mParcelIsForSale ? parcel->getSalePrice() : 0;
if (mParcelIsGroupLand)
{
LLUUID group_id = mParcel->getGroupID();
LLUUID group_id = parcel->getGroupID();
mParcelGroupContribution = gAgent.getGroupContribution(group_id);
}
}
else
{
mParcelActualArea = gParcelMgr->getClaimableArea();
mParcelActualArea = mParcel->getClaimableArea();
mParcelIsForSale = true;
mParcelPrice = mParcelActualArea * mParcel->getClaimPricePerMeter();
mParcelPrice = mParcelActualArea * parcel->getClaimPricePerMeter();
}
mParcelBillableArea =
llround(mRegion->getBillableFactor() * mParcelActualArea);
mParcelSupportedObjects = llround(
mParcel->getMaxPrimCapacity() * mParcel->getParcelPrimBonus());
parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus());
// Can't have more than region max tasks, regardless of parcel
// object bonus factor.
LLViewerRegion* region = gParcelMgr->getSelectionRegion();
@ -418,15 +418,16 @@ void LLFloaterBuyLandUI::updateParcelInfo()
mParcelSupportedObjects, max_tasks_per_region);
}
mParcelSoldWithObjects = mParcel->getSellWithObjects();
mParcelSoldWithObjects = parcel->getSellWithObjects();
LLVector3 center = mParcel->getCenterpoint();
LLVector3 center = parcel->getCenterpoint();
mParcelLocation = llformat("%s %d,%d",
mRegion->getName().c_str(),
(int)center[VX], (int)center[VY]
);
mParcelSnapshot = mParcel->getSnapshotID();
mParcelSnapshot = parcel->getSnapshotID();
updateNames();
@ -445,7 +446,7 @@ void LLFloaterBuyLandUI::updateParcelInfo()
if (!mIsClaim)
{
const LLUUID& authorizedBuyer = mParcel->getAuthorizedBuyerID();
const LLUUID& authorizedBuyer = parcel->getAuthorizedBuyerID();
const LLUUID buyer = gAgent.getID();
const LLUUID newOwner = mIsForGroup ? gAgent.getGroupID() : buyer;
@ -484,7 +485,7 @@ void LLFloaterBuyLandUI::updateParcelInfo()
return;
}
if (gParcelMgr->hasOthersSelected())
if (mParcel->hasOthersSelected())
{
// Policy: Must not have someone else's land selected
mCannotBuyReason = childGetText("not_owned_by_you");
@ -503,7 +504,7 @@ void LLFloaterBuyLandUI::updateParcelInfo()
}
*/
if (mParcel->getReservedForNewbie())
if (parcel->getReservedForNewbie())
{
if (mIsForGroup)
{
@ -814,7 +815,9 @@ void LLFloaterBuyLandUI::sendBuyLand()
void LLFloaterBuyLandUI::updateNames()
{
if (!mParcelValid)
LLParcel* parcelp = mParcel->getParcel();
if (!parcelp)
{
mParcelSellerName = "";
return;
@ -824,11 +827,11 @@ void LLFloaterBuyLandUI::updateNames()
{
mParcelSellerName = "Linden Lab";
}
else if (mParcel->getIsGroupOwned())
else if (parcelp->getIsGroupOwned())
{
char groupName[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
gCacheName->getGroupName(mParcel->getGroupID(), &groupName[0]);
gCacheName->getGroupName(parcelp->getGroupID(), &groupName[0]);
mParcelSellerName = groupName;
}
else
@ -836,7 +839,7 @@ void LLFloaterBuyLandUI::updateNames()
char firstName[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
char lastName[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
gCacheName->getName(mParcel->getOwnerID(), firstName, lastName);
gCacheName->getName(parcelp->getOwnerID(), firstName, lastName);
mParcelSellerName = llformat("%s %s", firstName, lastName);
}
}
@ -933,7 +936,7 @@ BOOL LLFloaterBuyLandUI::postBuild()
return TRUE;
}
void LLFloaterBuyLandUI::setParcel(LLViewerRegion* region, LLParcel* parcel)
void LLFloaterBuyLandUI::setParcel(LLViewerRegion* region, LLParcelSelectionHandle parcel)
{
if (mTransaction && mTransactionType == TransactionBuy)
{

View File

@ -9,15 +9,15 @@
#ifndef LL_LLFLOATERBUYLAND_H
#define LL_LLFLOATERBUYLAND_H
class LLParcel;
class LLViewerRegion;
class LLViewerTextEditor;
class LLParcelSelection;
class LLFloaterBuyLand
{
public:
static void buyLand(LLViewerRegion* region,
LLParcel* parcel,
LLHandle<LLParcelSelection> parcel,
bool is_for_group);
static void updateCovenantText(const std::string& string, const LLUUID& asset_id);
static void updateEstateName(const std::string& name);

View File

@ -616,7 +616,7 @@ void LLFloaterColorPicker::draw()
}
mPipetteBtn->setEnabled(gToolMgr != NULL);
mPipetteBtn->setToggleState(gToolMgr && gToolMgr->getCurrentTool(gKeyboard->currentMask(TRUE)) == gToolPipette);
mPipetteBtn->setToggleState(gToolMgr && gToolMgr->getCurrentTool() == gToolPipette);
mApplyImmediateCheck->setEnabled(mActive && mCanApplyImmediately);
mSelectBtn->setEnabled(mActive);
@ -1253,7 +1253,7 @@ void LLFloaterColorPicker::setActive(BOOL active)
void LLFloaterColorPicker::stopUsingPipette()
{
if (gToolMgr && gToolMgr->getCurrentTool(gKeyboard->currentMask(TRUE)) == gToolPipette)
if (gToolMgr && gToolMgr->getCurrentTool() == gToolPipette)
{
gToolMgr->clearTransientTool();
}

View File

@ -1237,8 +1237,8 @@ void LLPanelObjectTools::onClickSetBySelection(void* data)
LLPanelObjectTools* panelp = (LLPanelObjectTools*) data;
if (!panelp) return;
LLSelectNode* node = gSelectMgr->getFirstRootNode();
if (!node) node = gSelectMgr->getFirstNode();
LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
if (!node) node = gSelectMgr->getSelection()->getFirstNode();
if (!node) return;
LLString owner_name;

View File

@ -25,15 +25,12 @@ LLFloaterInspect::~LLFloaterInspect(void)
{
if(!gFloaterTools->getVisible())
{
if(gToolMgr->getCurrentTool(MASK_NONE) == gToolInspect)
if(gToolMgr->getBaseTool() == gToolInspect)
{
select_tool(gToolNull);
}
gSelectMgr->deselectAll();
// Switch back to basic toolset
gCurrentToolset = gBasicToolset;
gBasicToolset->selectFirstTool();
gToolMgr->useSelectedTool( gBasicToolset );
gToolMgr->setCurrentToolset(gBasicToolset);
}
else
{
@ -58,13 +55,16 @@ void LLFloaterInspect::show(void* ignored)
LLFloaterInspect* self = new LLFloaterInspect;
self->open();
}
sInstance->mObjectSelection = gSelectMgr->getSelection();
select_tool(gToolInspect);
sInstance->refresh();
}
void LLFloaterInspect::onClickCreatorProfile(void* ctrl)
{
if(sInstance->mObjectList->getAllSelected().size() == 0) return;
LLSelectNode* obj = gSelectMgr->getFirstNode();
LLSelectNode* obj = sInstance->mObjectSelection->getFirstNode();
LLUUID obj_id, creator_id;
obj_id = sInstance->mObjectList->getFirstSelected()->getUUID();
while(obj)
@ -74,7 +74,7 @@ void LLFloaterInspect::onClickCreatorProfile(void* ctrl)
creator_id = obj->mPermissions->getCreator();
break;
}
obj = gSelectMgr->getNextNode();
obj = sInstance->mObjectSelection->getNextNode();
}
if(obj)
{
@ -85,7 +85,7 @@ void LLFloaterInspect::onClickCreatorProfile(void* ctrl)
void LLFloaterInspect::onClickOwnerProfile(void* ctrl)
{
if(sInstance->mObjectList->getAllSelected().size() == 0) return;
LLSelectNode* obj = gSelectMgr->getFirstNode();
LLSelectNode* obj = sInstance->mObjectSelection->getFirstNode();
LLUUID obj_id, owner_id;
obj_id = sInstance->mObjectList->getFirstSelected()->getUUID();
while(obj)
@ -95,7 +95,7 @@ void LLFloaterInspect::onClickOwnerProfile(void* ctrl)
owner_id = obj->mPermissions->getOwner();
break;
}
obj = gSelectMgr->getNextNode();
obj = sInstance->mObjectSelection->getNextNode();
}
if(obj)
{
@ -109,7 +109,6 @@ BOOL LLFloaterInspect::postBuild()
childSetAction("button owner",onClickOwnerProfile, this);
childSetAction("button creator",onClickCreatorProfile, this);
childSetCommitCallback("object_list", onSelectObject);
refresh();
return TRUE;
}
@ -143,7 +142,7 @@ void LLFloaterInspect::refresh()
if(selected_index > -1) selected_uuid = mObjectList->getFirstSelected()->getUUID();
mObjectList->operateOnAll(LLScrollListCtrl::OP_DELETE);
//List all transient objects, then all linked objects
LLSelectNode* obj = gSelectMgr->getFirstNode();
LLSelectNode* obj = mObjectSelection->getFirstNode();
LLSD row;
while(obj)
{
@ -182,7 +181,7 @@ void LLFloaterInspect::refresh()
row["columns"][3]["type"] = "text";
row["columns"][3]["value"] = time;
mObjectList->addElement(row, ADD_TOP);
obj = gSelectMgr->getNextNode();
obj = mObjectSelection->getNextNode();
}
if(selected_index > -1 && mObjectList->getItemIndex(selected_uuid) == selected_index)
{
@ -218,4 +217,4 @@ void LLFloaterInspect::draw()
}
LLFloater::draw();
}
}

View File

@ -14,6 +14,7 @@
#include "llfloater.h"
//class LLTool;
class LLObjectSelection;
class LLScrollListCtrl;
class LLUICtrl;
@ -42,6 +43,8 @@ protected:
private:
// static data
static LLFloaterInspect* sInstance;
LLHandle<LLObjectSelection> mObjectSelection;
};
#endif //LL_LLFLOATERINSPECT_H
#endif //LL_LLFLOATERINSPECT_H

View File

@ -94,7 +94,7 @@ static const BOOL BUY_PERSONAL_LAND = FALSE;
LLFloaterLand* LLFloaterLand::sInstance = NULL;
LLParcelSelectionObserver* LLFloaterLand::sObserver = NULL;
S32 LLFloaterLand::sLastTab = 0;
BOOL LLFloaterLand::sRequestReplyOnUpdate = TRUE;
LLViewHandle LLPanelLandGeneral::sBuyPassDialogHandle;
// Local classes
@ -174,13 +174,11 @@ void LLFloaterLand::show()
// If we've already got the parcel data, fill the
// floater with it.
LLParcel *parcel = gParcelMgr->getSelectedParcel();
if (parcel)
sInstance->mParcel = gParcelMgr->getFloatingParcelSelection();
if (sInstance->mParcel->getParcel())
{
sInstance->refresh();
}
sRequestReplyOnUpdate = TRUE;
}
//static
@ -214,19 +212,6 @@ void LLFloaterLand::refreshAll()
}
}
// virtual
BOOL LLFloaterLand::canClose()
{
// canClose is checked as the first step of attempting to close
// the window, before focus is released from controls. Since we're
// closing the window and deselecting the land, we
// don't want replies to the upstream messages that get sent
// (because the reply will cause the land to be selected again).
sRequestReplyOnUpdate = FALSE;
return TRUE;
}
// virtual
void LLFloaterLand::onClose(bool app_quitting)
{
@ -234,10 +219,6 @@ void LLFloaterLand::onClose(bool app_quitting)
delete sObserver;
sObserver = NULL;
// Must do this after removing observer, otherwise
// infinite loops notifying and closing.
gParcelMgr->deselectLand();
// Might have been showing owned objects
gSelectMgr->unhighlightAll();
@ -302,7 +283,7 @@ void LLFloaterLand::refresh()
void* LLFloaterLand::createPanelLandGeneral(void* data)
{
LLFloaterLand* self = (LLFloaterLand*)data;
self->mPanelGeneral = new LLPanelLandGeneral();
self->mPanelGeneral = new LLPanelLandGeneral(self->mParcel);
return self->mPanelGeneral;
}
@ -312,7 +293,7 @@ void* LLFloaterLand::createPanelLandGeneral(void* data)
void* LLFloaterLand::createPanelLandCovenant(void* data)
{
LLFloaterLand* self = (LLFloaterLand*)data;
self->mPanelCovenant = new LLPanelLandCovenant();
self->mPanelCovenant = new LLPanelLandCovenant(self->mParcel);
return self->mPanelCovenant;
}
@ -321,7 +302,7 @@ void* LLFloaterLand::createPanelLandCovenant(void* data)
void* LLFloaterLand::createPanelLandObjects(void* data)
{
LLFloaterLand* self = (LLFloaterLand*)data;
self->mPanelObjects = new LLPanelLandObjects();
self->mPanelObjects = new LLPanelLandObjects(self->mParcel);
return self->mPanelObjects;
}
@ -329,7 +310,7 @@ void* LLFloaterLand::createPanelLandObjects(void* data)
void* LLFloaterLand::createPanelLandOptions(void* data)
{
LLFloaterLand* self = (LLFloaterLand*)data;
self->mPanelOptions = new LLPanelLandOptions();
self->mPanelOptions = new LLPanelLandOptions(self->mParcel);
return self->mPanelOptions;
}
@ -337,7 +318,7 @@ void* LLFloaterLand::createPanelLandOptions(void* data)
void* LLFloaterLand::createPanelLandMedia(void* data)
{
LLFloaterLand* self = (LLFloaterLand*)data;
self->mPanelMedia = new LLPanelLandMedia();
self->mPanelMedia = new LLPanelLandMedia(self->mParcel);
return self->mPanelMedia;
}
@ -345,7 +326,7 @@ void* LLFloaterLand::createPanelLandMedia(void* data)
void* LLFloaterLand::createPanelLandAccess(void* data)
{
LLFloaterLand* self = (LLFloaterLand*)data;
self->mPanelAccess = new LLPanelLandAccess();
self->mPanelAccess = new LLPanelLandAccess(self->mParcel);
return self->mPanelAccess;
}
@ -353,7 +334,7 @@ void* LLFloaterLand::createPanelLandAccess(void* data)
void* LLFloaterLand::createPanelLandBan(void* data)
{
LLFloaterLand* self = (LLFloaterLand*)data;
self->mPanelBan = new LLPanelLandBan();
self->mPanelBan = new LLPanelLandBan(self->mParcel);
return self->mPanelBan;
}
@ -363,8 +344,9 @@ void* LLFloaterLand::createPanelLandBan(void* data)
//---------------------------------------------------------------------------
LLPanelLandGeneral::LLPanelLandGeneral()
LLPanelLandGeneral::LLPanelLandGeneral(LLParcelSelectionHandle& parcel)
: LLPanel("land_general_panel"),
mParcel(parcel),
mUncheckedSell(FALSE)
{
}
@ -452,9 +434,8 @@ BOOL LLPanelLandGeneral::postBuild()
mBtnBuyGroupLand->setClickedCallback(onClickBuyLand, (void*)&BUY_GROUP_LAND);
static BOOL deselect_when_done = FALSE;
mBtnBuyPass = LLUICtrlFactory::getButtonByName(this, "Buy Pass...");
mBtnBuyPass->setClickedCallback(onClickBuyPass, &deselect_when_done);
mBtnBuyPass->setClickedCallback(onClickBuyPass, this);
mBtnReleaseLand = LLUICtrlFactory::getButtonByName(this, "Abandon Land...");
mBtnReleaseLand->setClickedCallback(onClickRelease, NULL);
@ -479,7 +460,7 @@ void LLPanelLandGeneral::refresh()
{
mBtnStartAuction->setVisible(gAgent.isGodlike());
LLParcel *parcel = gParcelMgr->getSelectedParcel();
LLParcel *parcel = mParcel->getParcel();
bool region_owner = false;
LLViewerRegion* regionp = gParcelMgr->getSelectionRegion();
if(regionp && (regionp->getOwner() == gAgent.getID()))
@ -761,7 +742,7 @@ void LLPanelLandGeneral::refresh()
// public
void LLPanelLandGeneral::refreshNames()
{
LLParcel *parcel = gParcelMgr->getSelectedParcel();
LLParcel *parcel = mParcel->getParcel();
if (!parcel)
{
mTextOwner->setText("");
@ -841,7 +822,8 @@ void LLPanelLandGeneral::onClickSetGroup(void* userdata)
// static
void LLPanelLandGeneral::onClickProfile(void* data)
{
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
LLParcel* parcel = panelp->mParcel->getParcel();
if (!parcel) return;
if (parcel->getIsGroupOwned())
@ -866,7 +848,7 @@ void LLPanelLandGeneral::cbGroupID(LLUUID group_id, void* userdata)
// public
void LLPanelLandGeneral::setGroup(const LLUUID& group_id)
{
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLParcel* parcel = mParcel->getParcel();
if (!parcel) return;
// Set parcel properties and send message
@ -875,7 +857,7 @@ void LLPanelLandGeneral::setGroup(const LLUUID& group_id)
//mTextGroup->setText(group_name);
// Send update
gParcelMgr->sendParcelPropertiesUpdate(parcel, LLFloaterLand::sRequestReplyOnUpdate);
gParcelMgr->sendParcelPropertiesUpdate(parcel);
// Update UI
refresh();
@ -888,16 +870,17 @@ void LLPanelLandGeneral::onClickBuyLand(void* data)
gParcelMgr->startBuyLand(*for_group);
}
BOOL LLPanelLandGeneral::enableDeedToGroup(void*)
BOOL LLPanelLandGeneral::enableDeedToGroup(void* data)
{
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
LLParcel* parcel = panelp->mParcel->getParcel();
return (parcel != NULL) && (parcel->getParcelFlag(PF_ALLOW_DEED_TO_GROUP));
}
// static
void LLPanelLandGeneral::onClickDeed(void*)
{
//LLParcel* parcel = gParcelMgr->getSelectedParcel();
//LLParcel* parcel = mParcel->getParcel();
//if (parcel)
//{
gParcelMgr->startDeedLandToGroup();
@ -918,17 +901,20 @@ void LLPanelLandGeneral::onClickReclaim(void*)
}
// static
BOOL LLPanelLandGeneral::enableBuyPass(void*)
BOOL LLPanelLandGeneral::enableBuyPass(void* data)
{
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
LLParcel* parcel = panelp != NULL ? panelp->mParcel->getParcel() : gParcelMgr->getParcelSelection()->getParcel();
return (parcel != NULL) && (parcel->getParcelFlag(PF_USE_PASS_LIST) && !gParcelMgr->isCollisionBanned());
}
// static
void LLPanelLandGeneral::onClickBuyPass(void* deselect_when_done)
void LLPanelLandGeneral::onClickBuyPass(void* data)
{
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
LLParcel* parcel = panelp != NULL ? panelp->mParcel->getParcel() : gParcelMgr->getParcelSelection()->getParcel();
if (!parcel) return;
S32 pass_price = parcel->getPassPrice();
@ -944,13 +930,14 @@ void LLPanelLandGeneral::onClickBuyPass(void* deselect_when_done)
args["[PARCEL_NAME]"] = parcel_name;
args["[TIME]"] = time;
sBuyPassDialogHandle = gViewerWindow->alertXml("LandBuyPass", args, cbBuyPass, deselect_when_done)->getHandle();
sBuyPassDialogHandle = gViewerWindow->alertXml("LandBuyPass", args, cbBuyPass)->getHandle();
}
// static
void LLPanelLandGeneral::onClickStartAuction(void*)
void LLPanelLandGeneral::onClickStartAuction(void* data)
{
LLParcel* parcelp = gParcelMgr->getSelectedParcel();
LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
LLParcel* parcelp = panelp->mParcel->getParcel();
if(parcelp)
{
if(parcelp->getForSale())
@ -967,18 +954,11 @@ void LLPanelLandGeneral::onClickStartAuction(void*)
// static
void LLPanelLandGeneral::cbBuyPass(S32 option, void* data)
{
BOOL deselect_when_done = (BOOL)(intptr_t)data;
if (0 == option)
{
// User clicked OK
gParcelMgr->buyPass();
}
if (deselect_when_done)
{
gParcelMgr->deselectLand();
}
}
//static
@ -992,7 +972,7 @@ void LLPanelLandGeneral::onCommitAny(LLUICtrl *ctrl, void *userdata)
{
LLPanelLandGeneral *panelp = (LLPanelLandGeneral *)userdata;
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLParcel* parcel = panelp->mParcel->getParcel();
if (!parcel)
{
return;
@ -1015,7 +995,7 @@ void LLPanelLandGeneral::onCommitAny(LLUICtrl *ctrl, void *userdata)
parcel->setContributeWithDeed(contribute_with_deed);
// Send update to server
gParcelMgr->sendParcelPropertiesUpdate( parcel, LLFloaterLand::sRequestReplyOnUpdate );
gParcelMgr->sendParcelPropertiesUpdate( parcel );
// Might have changed properties, so let's redraw!
panelp->refresh();
@ -1030,20 +1010,21 @@ void LLPanelLandGeneral::onClickSellLand(void* data)
// static
void LLPanelLandGeneral::onClickStopSellLand(void* data)
{
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)data;
LLParcel* parcel = panelp->mParcel->getParcel();
parcel->setParcelFlag(PF_FOR_SALE, FALSE);
parcel->setSalePrice(0);
parcel->setAuthorizedBuyerID(LLUUID::null);
gParcelMgr->sendParcelPropertiesUpdate(parcel, LLFloaterLand::sRequestReplyOnUpdate);
gParcelMgr->sendParcelPropertiesUpdate(parcel);
}
//---------------------------------------------------------------------------
// LLPanelLandObjects
//---------------------------------------------------------------------------
LLPanelLandObjects::LLPanelLandObjects()
: LLPanel("land_objects_panel")
LLPanelLandObjects::LLPanelLandObjects(LLParcelSelectionHandle& parcel)
: LLPanel("land_objects_panel"), mParcel(parcel)
{
}
@ -1211,7 +1192,7 @@ void LLPanelLandObjects::onDoubleClickOwner(void *userdata)
// public
void LLPanelLandObjects::refresh()
{
LLParcel *parcel = gParcelMgr->getSelectedParcel();
LLParcel *parcel = mParcel->getParcel();
mBtnShowOwnerObjects->setEnabled(FALSE);
mBtnShowGroupObjects->setEnabled(FALSE);
@ -1406,7 +1387,7 @@ void send_return_objects_message(S32 parcel_local_id, S32 return_type,
void LLPanelLandObjects::callbackReturnOwnerObjects(S32 option, void* userdata)
{
LLPanelLandObjects *lop = (LLPanelLandObjects *)userdata;
LLParcel *parcel = gParcelMgr->getSelectedParcel();
LLParcel *parcel = lop->mParcel->getParcel();
if (0 == option)
{
if (parcel)
@ -1431,7 +1412,7 @@ void LLPanelLandObjects::callbackReturnOwnerObjects(S32 option, void* userdata)
}
gSelectMgr->unhighlightAll();
gParcelMgr->sendParcelPropertiesUpdate( parcel, LLFloaterLand::sRequestReplyOnUpdate );
gParcelMgr->sendParcelPropertiesUpdate( parcel );
lop->refresh();
}
@ -1439,7 +1420,7 @@ void LLPanelLandObjects::callbackReturnOwnerObjects(S32 option, void* userdata)
void LLPanelLandObjects::callbackReturnGroupObjects(S32 option, void* userdata)
{
LLPanelLandObjects *lop = (LLPanelLandObjects *)userdata;
LLParcel *parcel = gParcelMgr->getSelectedParcel();
LLParcel *parcel = lop->mParcel->getParcel();
if (0 == option)
{
if (parcel)
@ -1453,7 +1434,7 @@ void LLPanelLandObjects::callbackReturnGroupObjects(S32 option, void* userdata)
}
}
gSelectMgr->unhighlightAll();
gParcelMgr->sendParcelPropertiesUpdate( parcel, LLFloaterLand::sRequestReplyOnUpdate );
gParcelMgr->sendParcelPropertiesUpdate( parcel );
lop->refresh();
}
@ -1461,7 +1442,7 @@ void LLPanelLandObjects::callbackReturnGroupObjects(S32 option, void* userdata)
void LLPanelLandObjects::callbackReturnOtherObjects(S32 option, void* userdata)
{
LLPanelLandObjects *lop = (LLPanelLandObjects *)userdata;
LLParcel *parcel = gParcelMgr->getSelectedParcel();
LLParcel *parcel = lop->mParcel->getParcel();
if (0 == option)
{
if (parcel)
@ -1471,7 +1452,7 @@ void LLPanelLandObjects::callbackReturnOtherObjects(S32 option, void* userdata)
}
}
gSelectMgr->unhighlightAll();
gParcelMgr->sendParcelPropertiesUpdate( parcel, LLFloaterLand::sRequestReplyOnUpdate );
gParcelMgr->sendParcelPropertiesUpdate( parcel );
lop->refresh();
}
@ -1479,7 +1460,7 @@ void LLPanelLandObjects::callbackReturnOtherObjects(S32 option, void* userdata)
void LLPanelLandObjects::callbackReturnOwnerList(S32 option, void* userdata)
{
LLPanelLandObjects *self = (LLPanelLandObjects *)userdata;
LLParcel *parcel = gParcelMgr->getSelectedParcel();
LLParcel *parcel = self->mParcel->getParcel();
if (0 == option)
{
if (parcel)
@ -1506,7 +1487,7 @@ void LLPanelLandObjects::callbackReturnOwnerList(S32 option, void* userdata)
}
}
gSelectMgr->unhighlightAll();
gParcelMgr->sendParcelPropertiesUpdate( parcel, LLFloaterLand::sRequestReplyOnUpdate );
gParcelMgr->sendParcelPropertiesUpdate( parcel );
self->refresh();
}
@ -1524,7 +1505,7 @@ void LLPanelLandObjects::onClickReturnOwnerList(void* userdata)
gParcelMgr->getPrimInfo(sw_max, sw_total, max, total, owned, group, other, selected, parcel_object_bonus, other_time);
LLParcel* parcelp = gParcelMgr->getSelectedParcel();
LLParcel* parcelp = self->mParcel->getParcel();
if (!parcelp) return;
// Make sure we have something selected.
@ -1558,7 +1539,7 @@ void LLPanelLandObjects::onClickRefresh(void* userdata)
LLMessageSystem *msg = gMessageSystem;
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLParcel* parcel = self->mParcel->getParcel();
if (!parcel) return;
LLViewerRegion* region = gParcelMgr->getSelectionRegion();
@ -1711,7 +1692,7 @@ void LLPanelLandObjects::onCommitList(LLUICtrl* ctrl, void* data)
self->mBtnReturnOwnerList->setEnabled(TRUE);
// Highlight this user's objects
clickShowCore(RT_LIST, &(self->mSelectedOwners));
clickShowCore(self, RT_LIST, &(self->mSelectedOwners));
}
}
@ -1738,30 +1719,30 @@ void LLPanelLandObjects::onClickName(void* userdata)
}
// static
void LLPanelLandObjects::clickShowCore(S32 return_type, uuid_list_t* list)
void LLPanelLandObjects::clickShowCore(LLPanelLandObjects* self, S32 return_type, uuid_list_t* list)
{
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLParcel* parcel = self->mParcel->getParcel();
if (!parcel) return;
send_parcel_select_objects(parcel->getLocalID(), return_type, list);
}
// static
void LLPanelLandObjects::onClickShowOwnerObjects(void*)
void LLPanelLandObjects::onClickShowOwnerObjects(void* userdata)
{
clickShowCore(RT_OWNER);
clickShowCore((LLPanelLandObjects*)userdata, RT_OWNER);
}
// static
void LLPanelLandObjects::onClickShowGroupObjects(void*)
void LLPanelLandObjects::onClickShowGroupObjects(void* userdata)
{
clickShowCore(RT_GROUP);
clickShowCore((LLPanelLandObjects*)userdata, (RT_GROUP));
}
// static
void LLPanelLandObjects::onClickShowOtherObjects(void*)
void LLPanelLandObjects::onClickShowOtherObjects(void* userdata)
{
clickShowCore(RT_OTHER);
clickShowCore((LLPanelLandObjects*)userdata, RT_OTHER);
}
// static
@ -1775,7 +1756,8 @@ void LLPanelLandObjects::onClickReturnOwnerObjects(void* userdata)
gParcelMgr->getPrimInfo(sw_max, sw_total, max, total, owned, group, other, selected, parcel_object_bonus, other_time);
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLPanelLandObjects* panelp = (LLPanelLandObjects*)userdata;
LLParcel* parcel = panelp->mParcel->getParcel();
if (!parcel) return;
send_parcel_select_objects(parcel->getLocalID(), RT_OWNER);
@ -1813,7 +1795,8 @@ void LLPanelLandObjects::onClickReturnGroupObjects(void* userdata)
gParcelMgr->getPrimInfo(sw_max, sw_total, max, total, owned, group, other, selected, parcel_object_bonus, other_time);
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLPanelLandObjects* panelp = (LLPanelLandObjects*)userdata;
LLParcel* parcel = panelp->mParcel->getParcel();
if (!parcel) return;
send_parcel_select_objects(parcel->getLocalID(), RT_GROUP);
@ -1840,7 +1823,8 @@ void LLPanelLandObjects::onClickReturnOtherObjects(void* userdata)
gParcelMgr->getPrimInfo(sw_max, sw_total, max, total, owned, group, other, selected, parcel_object_bonus, other_time);
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLPanelLandObjects* panelp = (LLPanelLandObjects*)userdata;
LLParcel* parcel = panelp->mParcel->getParcel();
if (!parcel) return;
send_parcel_select_objects(parcel->getLocalID(), RT_OTHER);
@ -1884,7 +1868,7 @@ void LLPanelLandObjects::onClickReturnOtherObjects(void* userdata)
void LLPanelLandObjects::onLostFocus(LLLineEditor *caller, void* user_data)
{
LLPanelLandObjects *lop = (LLPanelLandObjects *)user_data;
LLParcel *parcel = gParcelMgr->getSelectedParcel();
LLParcel* parcel = lop->mParcel->getParcel();
if (parcel)
{
lop->mOtherTime = atoi(lop->mCleanOtherObjectsTime->getText().c_str());
@ -1899,7 +1883,7 @@ void LLPanelLandObjects::onLostFocus(LLLineEditor *caller, void* user_data)
// LLPanelLandOptions
//---------------------------------------------------------------------------
LLPanelLandOptions::LLPanelLandOptions()
LLPanelLandOptions::LLPanelLandOptions(LLParcelSelectionHandle& parcel)
: LLPanel("land_options_panel"),
mCheckEditObjects(NULL),
mCheckEditGroupObjects(NULL),
@ -1921,7 +1905,8 @@ LLPanelLandOptions::LLPanelLandOptions()
mAllowPublishCtrl(NULL),
mMatureCtrl(NULL),
mPushRestrictionCtrl(NULL),
mPublishHelpButton(NULL)
mPublishHelpButton(NULL),
mParcel(parcel)
{
}
@ -2054,7 +2039,7 @@ LLPanelLandOptions::~LLPanelLandOptions()
// public
void LLPanelLandOptions::refresh()
{
LLParcel *parcel = gParcelMgr->getSelectedParcel();
LLParcel *parcel = mParcel->getParcel();
if (!parcel)
{
@ -2225,7 +2210,7 @@ void LLPanelLandOptions::onCommitAny(LLUICtrl *ctrl, void *userdata)
{
LLPanelLandOptions *self = (LLPanelLandOptions *)userdata;
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLParcel* parcel = self->mParcel->getParcel();
if (!parcel)
{
return;
@ -2279,7 +2264,7 @@ void LLPanelLandOptions::onCommitAny(LLUICtrl *ctrl, void *userdata)
parcel->setSnapshotID(snapshot_id);
// Send current parcel data upstream to server
gParcelMgr->sendParcelPropertiesUpdate( parcel, LLFloaterLand::sRequestReplyOnUpdate );
gParcelMgr->sendParcelPropertiesUpdate( parcel );
// Might have changed properties, so let's redraw!
self->refresh();
@ -2291,7 +2276,7 @@ void LLPanelLandOptions::onClickSet(void* userdata)
{
LLPanelLandOptions* self = (LLPanelLandOptions*)userdata;
LLParcel* selected_parcel = gParcelMgr->getSelectedParcel();
LLParcel* selected_parcel = self->mParcel->getParcel();
if (!selected_parcel) return;
LLParcel* agent_parcel = gParcelMgr->getAgentParcel();
@ -2307,7 +2292,7 @@ void LLPanelLandOptions::onClickSet(void* userdata)
selected_parcel->setUserLocation(pos_region);
selected_parcel->setUserLookAt(gAgent.getFrameAgent().getAtAxis());
gParcelMgr->sendParcelPropertiesUpdate(selected_parcel, LLFloaterLand::sRequestReplyOnUpdate);
gParcelMgr->sendParcelPropertiesUpdate(selected_parcel);
self->refresh();
}
@ -2316,7 +2301,7 @@ void LLPanelLandOptions::onClickClear(void* userdata)
{
LLPanelLandOptions* self = (LLPanelLandOptions*)userdata;
LLParcel* selected_parcel = gParcelMgr->getSelectedParcel();
LLParcel* selected_parcel = self->mParcel->getParcel();
if (!selected_parcel) return;
// yes, this magic number of 0,0,0 means that it is clear
@ -2324,7 +2309,7 @@ void LLPanelLandOptions::onClickClear(void* userdata)
selected_parcel->setUserLocation(zero_vec);
selected_parcel->setUserLookAt(zero_vec);
gParcelMgr->sendParcelPropertiesUpdate(selected_parcel, LLFloaterLand::sRequestReplyOnUpdate);
gParcelMgr->sendParcelPropertiesUpdate(selected_parcel);
self->refresh();
}
@ -2339,8 +2324,8 @@ void LLPanelLandOptions::onClickPublishHelp(void*)
// LLPanelLandMedia
//---------------------------------------------------------------------------
LLPanelLandMedia::LLPanelLandMedia()
: LLPanel("land_media_panel")
LLPanelLandMedia::LLPanelLandMedia(LLParcelSelectionHandle& parcel)
: LLPanel("land_media_panel"), mParcel(parcel)
{
}
@ -2382,7 +2367,7 @@ LLPanelLandMedia::~LLPanelLandMedia()
// public
void LLPanelLandMedia::refresh()
{
LLParcel *parcel = gParcelMgr->getSelectedParcel();
LLParcel *parcel = mParcel->getParcel();
if (!parcel)
{
@ -2467,7 +2452,7 @@ void LLPanelLandMedia::onCommitAny(LLUICtrl *ctrl, void *userdata)
{
LLPanelLandMedia *self = (LLPanelLandMedia *)userdata;
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLParcel* parcel = self->mParcel->getParcel();
if (!parcel)
{
return;
@ -2488,7 +2473,7 @@ void LLPanelLandMedia::onCommitAny(LLUICtrl *ctrl, void *userdata)
parcel->setMediaAutoScale ( media_auto_scale );
// Send current parcel data upstream to server
gParcelMgr->sendParcelPropertiesUpdate( parcel, LLFloaterLand::sRequestReplyOnUpdate );
gParcelMgr->sendParcelPropertiesUpdate( parcel );
// Might have changed properties, so let's redraw!
self->refresh();
@ -2512,8 +2497,8 @@ void LLPanelLandMedia::onClickStartMedia ( void* data )
// LLPanelLandAccess
//---------------------------------------------------------------------------
LLPanelLandAccess::LLPanelLandAccess()
: LLPanel("land_access_panel")
LLPanelLandAccess::LLPanelLandAccess(LLParcelSelectionHandle& parcel)
: LLPanel("land_access_panel"), mParcel(parcel)
{
}
@ -2555,13 +2540,14 @@ BOOL LLPanelLandAccess::postBuild()
LLPanelLandAccess::~LLPanelLandAccess()
{ }
{
}
void LLPanelLandAccess::refresh()
{
mListAccess->deleteAllItems();
LLParcel *parcel = gParcelMgr->getSelectedParcel();
LLParcel *parcel = mParcel->getParcel();
if (parcel)
{
@ -2667,7 +2653,7 @@ void LLPanelLandAccess::refresh()
// public
void LLPanelLandAccess::refreshNames()
{
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLParcel* parcel = mParcel->getParcel();
char group_name[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/
group_name[0] = '\0';
if(parcel)
@ -2698,7 +2684,7 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata)
{
LLPanelLandAccess *self = (LLPanelLandAccess *)userdata;
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLParcel* parcel = self->mParcel->getParcel();
if (!parcel)
{
return;
@ -2731,7 +2717,7 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata)
parcel->setPassHours( pass_hours );
// Send current parcel data upstream to server
gParcelMgr->sendParcelPropertiesUpdate( parcel, LLFloaterLand::sRequestReplyOnUpdate );
gParcelMgr->sendParcelPropertiesUpdate( parcel );
// Might have changed properties, so let's redraw!
self->refresh();
@ -2755,7 +2741,7 @@ void LLPanelLandAccess::callbackAvatarID(const std::vector<std::string>& names,
void LLPanelLandAccess::addAvatar(LLUUID id)
{
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLParcel* parcel = mParcel->getParcel();
if (!parcel) return;
parcel->addToAccessList(id, 0);
@ -2775,7 +2761,7 @@ void LLPanelLandAccess::onClickRemove(void* data)
LLScrollListItem* item = self->mListAccess->getFirstSelected();
if (!item) return;
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLParcel* parcel = self->mParcel->getParcel();
if (!parcel) return;
const LLUUID& agent_id = item->getUUID();
@ -2792,8 +2778,8 @@ void LLPanelLandAccess::onClickRemove(void* data)
//---------------------------------------------------------------------------
// LLPanelLandBan
//---------------------------------------------------------------------------
LLPanelLandBan::LLPanelLandBan()
: LLPanel("land_ban_panel")
LLPanelLandBan::LLPanelLandBan(LLParcelSelectionHandle& parcel)
: LLPanel("land_ban_panel"), mParcel(parcel)
{
}
@ -2837,7 +2823,7 @@ void LLPanelLandBan::refresh()
{
mList->deleteAllItems();
LLParcel *parcel = gParcelMgr->getSelectedParcel();
LLParcel *parcel = mParcel->getParcel();
if (parcel)
{
@ -2949,7 +2935,7 @@ void LLPanelLandBan::onCommitAny(LLUICtrl *ctrl, void *userdata)
{
LLPanelLandBan *self = (LLPanelLandBan*)userdata;
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLParcel* parcel = self->mParcel->getParcel();
if (!parcel)
{
return;
@ -2968,7 +2954,7 @@ void LLPanelLandBan::onCommitAny(LLUICtrl *ctrl, void *userdata)
parcel->setParcelFlag(PF_DENY_TRANSACTED, deny_access_transacted);
// Send current parcel data upstream to server
gParcelMgr->sendParcelPropertiesUpdate( parcel, LLFloaterLand::sRequestReplyOnUpdate );
gParcelMgr->sendParcelPropertiesUpdate( parcel );
// Might have changed properties, so let's redraw!
self->refresh();
@ -2992,7 +2978,7 @@ void LLPanelLandBan::callbackAvatarID(const std::vector<std::string>& names, con
void LLPanelLandBan::addAvatar(LLUUID id)
{
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLParcel* parcel = mParcel->getParcel();
if (!parcel) return;
parcel->addToBanList(id, 0);
@ -3012,7 +2998,7 @@ void LLPanelLandBan::onClickRemove(void* data)
LLScrollListItem* item = self->mList->getFirstSelected();
if (!item) return;
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLParcel* parcel = self->mParcel->getParcel();
if (!parcel) return;
const LLUUID& agent_id = item->getUUID();
@ -3027,8 +3013,8 @@ void LLPanelLandBan::onClickRemove(void* data)
//---------------------------------------------------------------------------
// LLPanelLandRenters
//---------------------------------------------------------------------------
LLPanelLandRenters::LLPanelLandRenters()
: LLPanel("landrenters", LLRect(0,500,500,0))
LLPanelLandRenters::LLPanelLandRenters(LLParcelSelectionHandle& parcel)
: LLPanel("landrenters", LLRect(0,500,500,0)), mParcel(parcel)
{
const S32 BTN_WIDTH = 64;
@ -3103,8 +3089,8 @@ void LLPanelLandRenters::onClickRemove(void*)
//---------------------------------------------------------------------------
// LLPanelLandCovenant
//---------------------------------------------------------------------------
LLPanelLandCovenant::LLPanelLandCovenant()
: LLPanel("land_covenant_panel")
LLPanelLandCovenant::LLPanelLandCovenant(LLParcelSelectionHandle& parcel)
: LLPanel("land_covenant_panel"), mParcel(parcel)
{
}

View File

@ -31,6 +31,7 @@ class LLParcelSelectionObserver;
class LLTabContainer;
class LLTextureCtrl;
class LLViewerTextEditor;
class LLParcelSelection;
class LLPanelLandGeneral;
class LLPanelLandObjects;
@ -54,9 +55,6 @@ public:
static LLPanelLandObjects* getCurrentPanelLandObjects();
static LLPanelLandCovenant* getCurrentPanelLandCovenant();
// Returns TRUE, but does some early prep work for closing the window.
virtual BOOL canClose();
// Destroys itself on close.
virtual void onClose(bool app_quitting);
@ -93,6 +91,8 @@ protected:
LLPanelLandCovenant* mPanelCovenant;
LLPanelLandRenters* mPanelRenters;
LLHandle<LLParcelSelection> mParcel;
public:
// When closing the dialog, we want to deselect the land. But when
// we send an update to the simulator, it usually replies with the
@ -106,7 +106,7 @@ class LLPanelLandGeneral
: public LLPanel
{
public:
LLPanelLandGeneral();
LLPanelLandGeneral(LLHandle<LLParcelSelection>& parcelp);
virtual ~LLPanelLandGeneral();
void refresh();
void refreshNames();
@ -198,6 +198,8 @@ protected:
LLButton* mBtnBuyPass;
LLButton* mBtnStartAuction;
LLHandle<LLParcelSelection>& mParcel;
static LLViewHandle sBuyPassDialogHandle;
};
@ -205,7 +207,7 @@ class LLPanelLandObjects
: public LLPanel
{
public:
LLPanelLandObjects();
LLPanelLandObjects(LLHandle<LLParcelSelection>& parcelp);
virtual ~LLPanelLandObjects();
void refresh();
virtual void draw();
@ -215,7 +217,7 @@ public:
static void callbackReturnOtherObjects(S32, void*);
static void callbackReturnOwnerList(S32, void*);
static void clickShowCore(S32 return_type, uuid_list_t* list = 0);
static void clickShowCore(LLPanelLandObjects* panelp, S32 return_type, uuid_list_t* list = 0);
static void onClickShowOwnerObjects(void*);
static void onClickShowGroupObjects(void*);
static void onClickShowOtherObjects(void*);
@ -295,6 +297,8 @@ protected:
LLString mSelectedName;
S32 mSelectedCount;
BOOL mSelectedIsGroup;
LLHandle<LLParcelSelection>& mParcel;
};
@ -302,7 +306,7 @@ class LLPanelLandOptions
: public LLPanel
{
public:
LLPanelLandOptions();
LLPanelLandOptions(LLHandle<LLParcelSelection>& parcelp);
virtual ~LLPanelLandOptions();
void refresh();
@ -340,6 +344,8 @@ protected:
LLCheckBoxCtrl *mMatureCtrl;
LLCheckBoxCtrl *mPushRestrictionCtrl;
LLButton *mPublishHelpButton;
LLHandle<LLParcelSelection>& mParcel;
};
@ -347,7 +353,7 @@ class LLPanelLandMedia
: public LLPanel
{
public:
LLPanelLandMedia();
LLPanelLandMedia(LLHandle<LLParcelSelection>& parcelp);
virtual ~LLPanelLandMedia();
void refresh();
@ -365,6 +371,8 @@ protected:
LLCheckBoxCtrl* mMediaAutoScaleCheck;
//LLButton* mMediaStopButton;
//LLButton* mMediaStartButton;
LLHandle<LLParcelSelection>& mParcel;
};
@ -373,7 +381,7 @@ class LLPanelLandAccess
: public LLPanel
{
public:
LLPanelLandAccess();
LLPanelLandAccess(LLHandle<LLParcelSelection>& parcelp);
virtual ~LLPanelLandAccess();
void refresh();
void refreshNames();
@ -407,6 +415,7 @@ protected:
LLCheckBoxCtrl* mCheckTransacted;
LLRadioGroup* mCheckStatusLevel;
LLHandle<LLParcelSelection>& mParcel;
};
@ -414,7 +423,7 @@ class LLPanelLandBan
: public LLPanel
{
public:
LLPanelLandBan();
LLPanelLandBan(LLHandle<LLParcelSelection>& parcelp);
virtual ~LLPanelLandBan();
void refresh();
@ -437,6 +446,8 @@ protected:
LLCheckBoxCtrl* mCheckDenyAnonymous;
LLCheckBoxCtrl* mCheckDenyIdentified;
LLCheckBoxCtrl* mCheckDenyTransacted;
LLHandle<LLParcelSelection>& mParcel;
};
@ -444,7 +455,7 @@ class LLPanelLandRenters
: public LLPanel
{
public:
LLPanelLandRenters();
LLPanelLandRenters(LLHandle<LLParcelSelection>& parcelp);
virtual ~LLPanelLandRenters();
void refresh();
@ -456,13 +467,15 @@ protected:
LLNameListCtrl* mListRenters;
LLButton* mBtnAddRenter;
LLButton* mBtnRemoveRenter;
LLHandle<LLParcelSelection>& mParcel;
};
class LLPanelLandCovenant
: public LLPanel
{
public:
LLPanelLandCovenant();
LLPanelLandCovenant(LLHandle<LLParcelSelection>& parcelp);
virtual ~LLPanelLandCovenant();
virtual BOOL postBuild();
void refresh();
@ -470,6 +483,9 @@ public:
static void updateEstateName(const std::string& name);
static void updateLastModified(const std::string& text);
static void updateEstateOwnerName(const std::string& name);
protected:
LLHandle<LLParcelSelection>& mParcel;
};
#endif

View File

@ -49,7 +49,6 @@ LLFloaterOpenObject::LLFloaterOpenObject()
LLFloaterOpenObject::~LLFloaterOpenObject()
{
gSelectMgr->deselectAll();
sInstance = NULL;
}
@ -57,7 +56,7 @@ void LLFloaterOpenObject::refresh()
{
mPanelInventory->refresh();
LLSelectNode* node = gSelectMgr->getFirstRootNode();
LLSelectNode* node = mObjectSelection->getFirstRootNode();
if (node)
{
std::string name = node->mName;
@ -84,7 +83,8 @@ void LLFloaterOpenObject::dirty()
// static
void LLFloaterOpenObject::show()
{
if (gSelectMgr->getRootObjectCount() != 1)
LLObjectSelectionHandle object_selection = gSelectMgr->getSelection();
if (object_selection->getRootObjectCount() != 1)
{
gViewerWindow->alertXml("UnableToViewContentsMoreThanOne");
return;
@ -99,19 +99,20 @@ void LLFloaterOpenObject::show()
sInstance->open(); /* Flawfinder: ignore */
sInstance->setFocus(TRUE);
sInstance->mObjectSelection = gSelectMgr->getEditSelection();
}
// static
void LLFloaterOpenObject::moveToInventory(bool wear)
{
if (gSelectMgr->getRootObjectCount() != 1)
if (mObjectSelection->getRootObjectCount() != 1)
{
gViewerWindow->alertXml("OnlyCopyContentsOfSingleItem");
return;
}
LLSelectNode* node = gSelectMgr->getFirstRootNode();
LLSelectNode* node = mObjectSelection->getFirstRootNode();
if (!node) return;
LLViewerObject* object = node->getObject();
if (!object) return;
@ -175,7 +176,7 @@ void LLFloaterOpenObject::callbackMoveInventory(S32 result, void* data)
void LLFloaterOpenObject::onClickMoveToInventory(void* data)
{
LLFloaterOpenObject* self = (LLFloaterOpenObject*)data;
moveToInventory(false);
self->moveToInventory(false);
self->close();
}
@ -183,7 +184,7 @@ void LLFloaterOpenObject::onClickMoveToInventory(void* data)
void LLFloaterOpenObject::onClickMoveAndWear(void* data)
{
LLFloaterOpenObject* self = (LLFloaterOpenObject*)data;
moveToInventory(true);
self->moveToInventory(true);
self->close();
}

View File

@ -16,8 +16,7 @@
#include "llfloater.h"
class LLObjectSelection;
class LLPanelInventory;
class LLFloaterOpenObject
@ -40,9 +39,10 @@ protected:
void refresh();
void draw();
void moveToInventory(bool wear);
static void onClickMoveToInventory(void* data);
static void onClickMoveAndWear(void* data);
static void moveToInventory(bool wear);
static void callbackMoveInventory(S32 result, void* data);
static void* createPanelInventory(void* data);
@ -50,6 +50,7 @@ protected:
static LLFloaterOpenObject* sInstance;
LLPanelInventory* mPanelInventory;
LLHandle<LLObjectSelection> mObjectSelection;
BOOL mDirty;
};

View File

@ -211,11 +211,6 @@ LLFloaterReporter::~LLFloaterReporter()
std::for_each(mMCDList.begin(), mMCDList.end(), DeletePointer() );
mMCDList.clear();
if (gSelectMgr)
{
gSelectMgr->deselectTransient();
}
gDialogVisible = FALSE;
}

View File

@ -36,15 +36,15 @@ private:
virtual ~LLFloaterSellLandUI();
LLViewerRegion* mRegion;
LLParcel* mParcel;
bool mParcelIsForSale;
bool mSellToBuyer;
bool mChoseSellTo;
S32 mParcelPrice;
S32 mParcelActualArea;
LLUUID mParcelSnapshot;
LLUUID mAuthorizedBuyer;
bool mParcelSoldWithObjects;
LLParcelSelectionHandle mParcelSelection;
bool mParcelIsForSale;
bool mSellToBuyer;
bool mChoseSellTo;
S32 mParcelPrice;
S32 mParcelActualArea;
LLUUID mParcelSnapshot;
LLUUID mAuthorizedBuyer;
bool mParcelSoldWithObjects;
void updateParcelInfo();
void refreshUI();
@ -68,12 +68,19 @@ public:
static LLFloaterSellLandUI* soleInstance(bool createIfNeeded);
bool setParcel(LLViewerRegion* region, LLParcel* parcel);
bool setParcel(LLViewerRegion* region, LLParcelSelectionHandle parcel);
private:
class SelectionObserver : public LLParcelObserver
{
public:
virtual void changed();
};
};
// static
void LLFloaterSellLand::sellLand(
LLViewerRegion* region, LLParcel* parcel)
LLViewerRegion* region, LLParcelSelectionHandle parcel)
{
LLFloaterSellLandUI* ui = LLFloaterSellLandUI::soleInstance(true);
if (ui->setParcel(region, parcel))
@ -96,12 +103,20 @@ LLFloaterSellLandUI* LLFloaterSellLandUI::soleInstance(bool createIfNeeded)
sInstance->center();
}
static SelectionObserver* parcelSelectionObserver = NULL;
if (!parcelSelectionObserver)
{
parcelSelectionObserver = new SelectionObserver;
gParcelMgr->addObserver(parcelSelectionObserver);
}
return sInstance;
}
LLFloaterSellLandUI::LLFloaterSellLandUI()
: LLFloater("Sell Land"),
mRegion(0), mParcel(0)
mRegion(0)
{
}
@ -113,6 +128,22 @@ LLFloaterSellLandUI::~LLFloaterSellLandUI()
}
}
void LLFloaterSellLandUI::SelectionObserver::changed()
{
LLFloaterSellLandUI* ui = LLFloaterSellLandUI::soleInstance(false);
if (ui)
{
if (gParcelMgr->selectionEmpty())
{
ui->close();
}
else {
ui->setParcel(
gParcelMgr->getSelectionRegion(),
gParcelMgr->getParcelSelection());
}
}
}
void LLFloaterSellLandUI::onClose(bool app_quitting)
{
@ -133,17 +164,18 @@ BOOL LLFloaterSellLandUI::postBuild()
return TRUE;
}
bool LLFloaterSellLandUI::setParcel(LLViewerRegion* region, LLParcel* parcel)
bool LLFloaterSellLandUI::setParcel(LLViewerRegion* region, LLParcelSelectionHandle parcel)
{
if (!parcel) // || !can_agent_modify_parcel(parcel)) // can_agent_modify_parcel was deprecated by GROUPS
if (!parcel->getParcel()) // || !can_agent_modify_parcel(parcel)) // can_agent_modify_parcel was deprecated by GROUPS
{
return false;
}
mRegion = region;
mParcel = parcel;
mParcelSelection = parcel;
mChoseSellTo = false;
updateParcelInfo();
refreshUI();
@ -152,14 +184,17 @@ bool LLFloaterSellLandUI::setParcel(LLViewerRegion* region, LLParcel* parcel)
void LLFloaterSellLandUI::updateParcelInfo()
{
mParcelActualArea = mParcel->getArea();
mParcelIsForSale = mParcel->getForSale();
LLParcel* parcelp = mParcelSelection->getParcel();
if (!parcelp) return;
mParcelActualArea = parcelp->getArea();
mParcelIsForSale = parcelp->getForSale();
if (mParcelIsForSale)
{
mChoseSellTo = true;
}
mParcelPrice = mParcelIsForSale ? mParcel->getSalePrice() : 0;
mParcelSoldWithObjects = mParcel->getSellWithObjects();
mParcelPrice = mParcelIsForSale ? parcelp->getSalePrice() : 0;
mParcelSoldWithObjects = parcelp->getSellWithObjects();
if (mParcelIsForSale)
{
childSetValue("price", mParcelPrice);
@ -178,9 +213,9 @@ void LLFloaterSellLandUI::updateParcelInfo()
childSetValue("sell_objects", "none");
}
mParcelSnapshot = mParcel->getSnapshotID();
mParcelSnapshot = parcelp->getSnapshotID();
mAuthorizedBuyer = mParcel->getAuthorizedBuyerID();
mAuthorizedBuyer = parcelp->getAuthorizedBuyerID();
mSellToBuyer = mAuthorizedBuyer.notNull();
if(mSellToBuyer)
@ -219,13 +254,16 @@ void LLFloaterSellLandUI::setBadge(const char* id, Badge badge)
void LLFloaterSellLandUI::refreshUI()
{
LLParcel* parcelp = mParcelSelection->getParcel();
if (!parcelp) return;
LLTextureCtrl* snapshot = LLViewerUICtrlFactory::getTexturePickerByName(this, "info_image");
if (snapshot)
{
snapshot->setImageAssetID(mParcelSnapshot);
}
childSetText("info_parcel", mParcel->getName());
childSetText("info_parcel", parcelp->getName());
childSetTextArg("info_size", "[AREA]", llformat("%d", mParcelActualArea));
LLString price_str = childGetValue("price").asString();
@ -358,7 +396,7 @@ void LLFloaterSellLandUI::doSelectAgent(void *userdata)
void LLFloaterSellLandUI::callbackAvatarPick(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data)
{
LLFloaterSellLandUI* floaterp = (LLFloaterSellLandUI*)data;
LLParcel* parcel = floaterp->mParcel;
LLParcel* parcel = floaterp->mParcelSelection->getParcel();
if (names.empty() || ids.empty()) return;
@ -383,7 +421,10 @@ void LLFloaterSellLandUI::doCancel(void *userdata)
void LLFloaterSellLandUI::doShowObjects(void *userdata)
{
LLFloaterSellLandUI* self = (LLFloaterSellLandUI*)userdata;
send_parcel_select_objects(self->mParcel->getLocalID(), RT_SELL);
LLParcel* parcel = self->mParcelSelection->getParcel();
if (!parcel) return;
send_parcel_select_objects(parcel->getLocalID(), RT_SELL);
LLNotifyBox::showXml("TransferObjectsHighlighted",
callbackHighlightTransferable,
@ -401,7 +442,7 @@ void LLFloaterSellLandUI::doSellLand(void *userdata)
{
LLFloaterSellLandUI* self = (LLFloaterSellLandUI*)userdata;
LLParcel* parcel = self->mParcel;
LLParcel* parcel = self->mParcelSelection->getParcel();
// Do a confirmation
if (!parcel->getForSale())
@ -453,7 +494,8 @@ void LLFloaterSellLandUI::onConfirmSale(S32 option, void *userdata)
return;
}
LLParcel* parcel = self->mParcel;
LLParcel* parcel = self->mParcelSelection->getParcel();
if (!parcel) return;
// can_agent_modify_parcel deprecated by GROUPS
// if (!can_agent_modify_parcel(parcel))
@ -480,7 +522,7 @@ void LLFloaterSellLandUI::onConfirmSale(S32 option, void *userdata)
}
// Send update to server
gParcelMgr->sendParcelPropertiesUpdate( parcel, LLFloaterLand::sRequestReplyOnUpdate );
gParcelMgr->sendParcelPropertiesUpdate( parcel );
self->close();
}

View File

@ -7,15 +7,17 @@
#ifndef LL_LLFLOATERSELLLAND_H
#define LL_LLFLOATERSELLLAND_H
#include "llmemory.h"
class LLParcel;
class LLViewerRegion;
class LLParcelSelection;
class LLFloaterSellLand
{
public:
static void sellLand(LLViewerRegion* region,
LLParcel* parcel);
LLHandle<LLParcelSelection> parcel);
};
#endif // LL_LLFLOATERSELLLAND_H

View File

@ -813,13 +813,12 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
// freeze everything else
gSavedSettings.setBOOL("FreezeTime", TRUE);
if (gCurrentToolset != gCameraToolset)
if (gToolMgr->getCurrentToolset() != gCameraToolset)
{
sInstance->impl.mLastToolset = gCurrentToolset;
gCurrentToolset = gCameraToolset;
sInstance->impl.mLastToolset = gToolMgr->getCurrentToolset();
if (gToolMgr)
{
gToolMgr->useSelectedTool( gCurrentToolset );
gToolMgr->setCurrentToolset(gCameraToolset);
}
}
}
@ -842,10 +841,9 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
// restore last tool (e.g. pie menu, etc)
if (sInstance->impl.mLastToolset)
{
gCurrentToolset = sInstance->impl.mLastToolset;
if (gToolMgr)
{
gToolMgr->useSelectedTool( gCurrentToolset );
gToolMgr->setCurrentToolset(sInstance->impl.mLastToolset);
}
}
}
@ -1220,10 +1218,9 @@ LLFloaterSnapshot::~LLFloaterSnapshot()
if (impl.mLastToolset)
{
gCurrentToolset = impl.mLastToolset;
if (gToolMgr && gCurrentToolset)
if (gToolMgr)
{
gToolMgr->useSelectedTool( gCurrentToolset );
gToolMgr->setCurrentToolset(impl.mLastToolset);
}
}
@ -1487,7 +1484,7 @@ BOOL LLSnapshotFloaterView::handleMouseDown(S32 x, S32 y, MASK mask)
// give floater a change to handle mouse, else camera tool
if (childrenHandleMouseDown(x, y, mask) == NULL)
{
gToolMgr->getCurrentTool(mask)->handleMouseDown( x, y, mask );
gToolMgr->getCurrentTool()->handleMouseDown( x, y, mask );
}
return TRUE;
}
@ -1502,7 +1499,7 @@ BOOL LLSnapshotFloaterView::handleMouseUp(S32 x, S32 y, MASK mask)
// give floater a change to handle mouse, else camera tool
if (childrenHandleMouseUp(x, y, mask) == NULL)
{
gToolMgr->getCurrentTool(mask)->handleMouseUp( x, y, mask );
gToolMgr->getCurrentTool()->handleMouseUp( x, y, mask );
}
return TRUE;
}
@ -1517,7 +1514,7 @@ BOOL LLSnapshotFloaterView::handleHover(S32 x, S32 y, MASK mask)
// give floater a change to handle mouse, else camera tool
if (childrenHandleHover(x, y, mask) == NULL)
{
gToolMgr->getCurrentTool(mask)->handleHover( x, y, mask );
gToolMgr->getCurrentTool()->handleHover( x, y, mask );
}
return TRUE;
}

View File

@ -39,8 +39,8 @@ void LLFloaterTelehub::show()
sInstance = new LLFloaterTelehub();
// Show tools floater by selecting translate (select) tool
gCurrentToolset = gBasicToolset;
gCurrentToolset->selectTool( gToolTranslate );
gToolMgr->setCurrentToolset(gBasicToolset);
gToolMgr->getCurrentToolset()->selectTool( gToolTranslate );
// Find tools floater, glue to bottom
if (gFloaterTools)
@ -82,6 +82,8 @@ LLFloaterTelehub::LLFloaterTelehub()
// otherwise you can't walk with arrow keys while floater is up
list->setAllowKeyboardMovement(FALSE);
}
mObjectSelection = gSelectMgr->getEditSelection();
}
LLFloaterTelehub::~LLFloaterTelehub()
@ -104,10 +106,10 @@ void LLFloaterTelehub::draw()
// Per-frame updates, because we don't have a selection manager observer.
void LLFloaterTelehub::refresh()
{
LLViewerObject* object = gSelectMgr->getFirstRootObject();
LLViewerObject* object = mObjectSelection->getFirstRootObject();
if(!object)
{
object = gSelectMgr->getFirstObject();
object = mObjectSelection->getFirstObject();
}
BOOL have_selection = (object != NULL);

View File

@ -13,6 +13,7 @@
#include "llfloater.h"
class LLMessageSystem;
class LLObjectSelection;
const S32 MAX_SPAWNPOINTS_PER_TELEHUB = 16;
@ -50,6 +51,8 @@ private:
S32 mNumSpawn;
LLVector3 mSpawnPointPos[MAX_SPAWNPOINTS_PER_TELEHUB];
LLHandle<LLObjectSelection> mObjectSelection;
static LLFloaterTelehub* sInstance;
};

View File

@ -376,7 +376,7 @@ LLFloaterTools::LLFloaterTools()
factory_map["ContentsInventory"] = LLCallbackMap(createPanelContentsInventory, this);//LLPanelContents
factory_map["land info panel"] = LLCallbackMap(createPanelLandInfo, this);//LLPanelLandInfo
gUICtrlFactory->buildFloater(this,"floater_tools.xml",&factory_map);
gUICtrlFactory->buildFloater(this,"floater_tools.xml",&factory_map,FALSE);
mLargeHeight = getRect().getHeight();
mSmallHeight = mLargeHeight;
@ -459,7 +459,7 @@ void LLFloaterTools::resetToolState()
void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
{
LLTool *tool = gToolMgr->getCurrentTool( mask );
LLTool *tool = gToolMgr->getCurrentTool();
// HACK to allow seeing the buttons when you have the app in a window.
// Keep the visibility the same as it
@ -560,7 +560,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
S32 index = mComboGridMode->getCurrentIndex();
mComboGridMode->removeall();
switch (gSelectMgr->getSelectType())
switch (mObjectSelection->getSelectType())
{
case SELECT_TYPE_HUD:
mComboGridMode->add("Screen");
@ -706,6 +706,13 @@ BOOL LLFloaterTools::canClose()
return !gQuit;
}
// virtual
void LLFloaterTools::onOpen()
{
mParcelSelection = gParcelMgr->getFloatingParcelSelection();
mObjectSelection = gSelectMgr->getEditSelection();
}
// virtual
void LLFloaterTools::onClose(bool app_quitting)
{
@ -725,10 +732,14 @@ void LLFloaterTools::onClose(bool app_quitting)
resetToolState();
mParcelSelection = NULL;
mObjectSelection = NULL;
// Switch back to basic toolset
gCurrentToolset = gBasicToolset;
gBasicToolset->selectFirstTool();
gToolMgr->useSelectedTool( gBasicToolset );
gToolMgr->setCurrentToolset(gBasicToolset);
// we were already in basic toolset, using build tools
// so manually reset tool to default (pie menu tool)
gToolMgr->getCurrentToolset()->selectFirstTool();
}
void LLFloaterTools::showMore(BOOL show_more)
@ -936,6 +947,5 @@ void LLFloaterTools::setEditTool(void* tool_pointer)
void LLFloaterTools::onFocusReceived()
{
gCurrentToolset = gBasicToolset;
gCurrentToolset->selectTool(gCurrentToolset->getSelectedTool());
gToolMgr->setCurrentToolset(gBasicToolset);
}

View File

@ -25,6 +25,11 @@ class LLPanelFace;
class LLPanelLandInfo;
class LLComboBox;
class LLVolumeSliderCtrl;
class LLParcelSelection;
class LLObjectSelection;
typedef LLHandle<LLParcelSelection> LLParcelSelectionHandle;
typedef LLHandle<LLObjectSelection> LLObjectSelectionHandle;
class LLFloaterTools
: public LLFloater
@ -42,6 +47,7 @@ public:
LLFloaterTools();
virtual ~LLFloaterTools();
virtual void onOpen();
virtual void onClose(bool app_quitting);
virtual BOOL canClose();
@ -156,7 +162,10 @@ public:
LLPanelLandInfo *mPanelLandInfo;
LLTabContainer* mTabLand;
LLParcelSelectionHandle mParcelSelection;
LLObjectSelectionHandle mObjectSelection;
private:
BOOL mDirty;
S32 mSmallHeight;

View File

@ -226,9 +226,11 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
if (shrink_selection)
{
for (LLViewerObject* vobjp = gSelectMgr->getFirstHighlightedObject();
LLObjectSelectionHandle highlighted_objects = gSelectMgr->getHighlightedObjects();
for (LLViewerObject* vobjp = highlighted_objects->getFirstObject();
vobjp;
vobjp = gSelectMgr->getNextHighlightedObject())
vobjp = highlighted_objects->getNextObject())
{
LLDrawable* drawable = vobjp->mDrawable;
if (!drawable || vobjp->getPCode() != LL_PCODE_VOLUME || vobjp->isAttachment())

View File

@ -3317,7 +3317,7 @@ BOOL LLObjectBridge::renameItem(const LLString& new_name)
{
gSelectMgr->deselectAll();
gSelectMgr->addAsIndividual( obj, SELECT_ALL_TES, FALSE );
gSelectMgr->setObjectName( new_name );
gSelectMgr->selectionSetObjectName( new_name );
gSelectMgr->deselectAll();
}
}

View File

@ -28,6 +28,7 @@
#include "llmutelist.h"
#include "llnotify.h"
#include "llcallbacklist.h"
#include "llpreview.h"
#include <deque>
//#define DIFF_INVENTORY_FILES
@ -2295,6 +2296,8 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account, boo
item_array_t items;
update_map_t update;
S32 count = msg->getNumberOfBlocksFast(_PREHASH_InventoryData);
bool all_one_folder = true;
LLUUID folder_id;
for(S32 i = 0; i < count; ++i)
{
LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
@ -2321,6 +2324,14 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account, boo
{
++update[titem->getParentUUID()];
}
if (folder_id.isNull())
{
folder_id = titem->getParentUUID();
}
else
{
all_one_folder = false;
}
}
if(account)
{
@ -2344,6 +2355,18 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account, boo
trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH);
if(!gInventory.isObjectDescendentOf(lastitem->getUUID(), trash_id))
{
LLMultiPreview* multi_previewp = LLMultiPreview::getAutoOpenInstance(folder_id);
if (!multi_previewp && all_one_folder)
{
S32 left, top;
gFloaterView->getNewFloaterPosition(&left, &top);
multi_previewp = new LLMultiPreview(LLRect(left, top, left + 300, top - 100));
LLMultiPreview::setAutoOpenInstance(multi_previewp, folder_id);
}
LLFloater::setFloaterHost(multi_previewp);
bool show_keep_discard = lastitem->getPermissions().getCreator() != gAgent.getID();
switch(lastitem->getType())
{
@ -2374,6 +2397,13 @@ bool LLInventoryModel::messageUpdateCore(LLMessageSystem* msg, bool account, boo
default:
break;
}
LLFloater::setFloaterHost(NULL);
if (multi_previewp)
{
multi_previewp->open();
}
LLInventoryView* view = LLInventoryView::getActiveInventory();
if(view)
{

View File

@ -150,7 +150,7 @@ F32 LLManip::getSubdivisionLevel(const LLVector3 &reference_point, const LLVecto
{
//update current snap subdivision level
LLVector3 cam_to_reference;
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
cam_to_reference = LLVector3(1.f / gAgent.getAvatarObject()->mHUDCurZoom, 0.f, 0.f);
}
@ -167,12 +167,27 @@ F32 LLManip::getSubdivisionLevel(const LLVector3 &reference_point, const LLVecto
return subdivisions;
}
void LLManip::handleSelect()
{
mObjectSelection = gSelectMgr->getEditSelection();
}
void LLManip::handleDeselect()
{
mObjectSelection = NULL;
}
LLObjectSelectionHandle LLManip::getSelection()
{
return mObjectSelection;
}
BOOL LLManip::handleHover(S32 x, S32 y, MASK mask)
{
// We only handle the event if mousedown started with us
if( hasMouseCapture() )
{
if( gSelectMgr->isEmpty() )
if( mObjectSelection->isEmpty() )
{
// Somehow the object got deselected while we were dragging it.
// Release the mouse
@ -217,7 +232,7 @@ BOOL LLManip::getMousePointOnPlaneAgent(LLVector3& point, S32 x, S32 y, LLVector
BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVector3d origin, LLVector3 normal)
{
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
BOOL result = FALSE;
F32 mouse_x = ((F32)x / gViewerWindow->getWindowWidth() - 0.5f) * gCamera->getAspect() / gAgent.getAvatarObject()->mHUDCurZoom;
@ -252,12 +267,12 @@ BOOL LLManip::getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVect
// Given the line defined by mouse cursor (a1 + a_param*(a2-a1)) and the line defined by b1 + b_param*(b2-b1),
// returns a_param and b_param for the points where lines are closest to each other.
// Returns false if the two lines are parallel.
BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, const LLVector3& b2, F32 &a_param, F32 &b_param ) const
BOOL LLManip::nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, const LLVector3& b2, F32 &a_param, F32 &b_param )
{
LLVector3 a1;
LLVector3 a2;
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidth()) - 0.5f) * gCamera->getAspect() / gAgent.getAvatarObject()->mHUDCurZoom;
F32 mouse_y = (((F32)y / gViewerWindow->getWindowHeight()) - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom;
@ -305,11 +320,11 @@ LLVector3 LLManip::getSavedPivotPoint() const
return gSelectMgr->getSavedBBoxOfSelection().getCenterAgent();
}
LLVector3 LLManip::getPivotPoint() const
LLVector3 LLManip::getPivotPoint()
{
if (gSelectMgr->getFirstObject() && gSelectMgr->getObjectCount() == 1 && gSelectMgr->getSelectType() != SELECT_TYPE_HUD)
if (mObjectSelection->getFirstObject() && mObjectSelection->getObjectCount() == 1 && mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
{
return gSelectMgr->getFirstObject()->getPivotPositionAgent();
return mObjectSelection->getFirstObject()->getPivotPositionAgent();
}
return gSelectMgr->getBBoxOfSelection().getCenterAgent();
}
@ -322,10 +337,10 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z)
LLVector3 grid_scale;
gSelectMgr->getGrid(grid_origin, grid_rot, grid_scale);
LLViewerObject* object = gSelectMgr->getFirstRootObject();
LLViewerObject* object = mObjectSelection->getFirstRootObject();
if (!object)
{
object = gSelectMgr->getFirstObject();
object = mObjectSelection->getFirstObject();
if (!object)
{
return;
@ -447,7 +462,7 @@ void LLManip::renderTickText(const LLVector3& pos, const char* text, const LLCol
{
const LLFontGL* big_fontp = gResMgr->getRes( LLFONT_SANSSERIF );
BOOL hud_selection = gSelectMgr->getSelectType() == SELECT_TYPE_HUD;
BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD;
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
LLVector3 render_pos = pos;
@ -465,9 +480,9 @@ void LLManip::renderTickText(const LLVector3& pos, const char* text, const LLCol
LLGLEnable tex(GL_TEXTURE_2D);
shadow_color.mV[VALPHA] = color.mV[VALPHA] * 0.5f;
gViewerWindow->setupViewport(1, -1);
hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(text), 3.f, shadow_color, gSelectMgr->getSelectType() == SELECT_TYPE_HUD);
hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(text), 3.f, shadow_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
gViewerWindow->setupViewport();
hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(text), 3.f, color, gSelectMgr->getSelectType() == SELECT_TYPE_HUD);
hud_render_utf8text(text, render_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(text), 3.f, color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
glPopMatrix();
}
@ -506,7 +521,7 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const char* suffi
}
}
BOOL hud_selection = gSelectMgr->getSelectType() == SELECT_TYPE_HUD;
BOOL hud_selection = mObjectSelection->getSelectType() == SELECT_TYPE_HUD;
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
LLVector3 render_pos = pos;

View File

@ -17,6 +17,7 @@ class LLTextBox;
class LLViewerObject;
class LLToolComposite;
class LLVector3;
class LLObjectSelection;
const S32 MIN_DIVISION_PIXEL_WIDTH = 9;
@ -102,14 +103,18 @@ public:
void renderGuidelines(BOOL draw_x = TRUE, BOOL draw_y = TRUE, BOOL draw_z = TRUE);
static void renderXYZ(const LLVector3 &vec);
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0;
/*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
/*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
virtual EManipPart getHighlightedPart() { return LL_NO_PART; }
virtual void highlightManipulators(S32 x, S32 y) {};
virtual void handleSelect();
virtual void handleDeselect();
LLHandle<LLObjectSelection> getSelection();
protected:
LLVector3 getSavedPivotPoint() const;
LLVector3 getPivotPoint() const;
LLVector3 getPivotPoint();
void getManipNormal(LLViewerObject* object, EManipPart manip, LLVector3 &normal);
BOOL getManipAxis(LLViewerObject* object, EManipPart manip, LLVector3 &axis);
F32 getSubdivisionLevel(const LLVector3 &reference_point, const LLVector3 &translate_axis, F32 grid_scale, S32 min_pixel_spacing = MIN_DIVISION_PIXEL_WIDTH);
@ -118,11 +123,12 @@ protected:
void updateGridSettings();
BOOL getMousePointOnPlaneGlobal(LLVector3d& point, S32 x, S32 y, LLVector3d origin, LLVector3 normal);
BOOL getMousePointOnPlaneAgent(LLVector3& point, S32 x, S32 y, LLVector3 origin, LLVector3 normal);
BOOL nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, const LLVector3& b2, F32 &a_param, F32 &b_param ) const;
BOOL nearestPointOnLineFromMouse( S32 x, S32 y, const LLVector3& b1, const LLVector3& b2, F32 &a_param, F32 &b_param );
LLColor4 setupSnapGuideRenderPass(S32 pass);
protected:
LLFrameTimer mHelpTextTimer;
BOOL mInSnapRegime;
LLHandle<LLObjectSelection> mObjectSelection;
static F32 sHelpTextVisibleTime;
static F32 sHelpTextFadeTime;

View File

@ -62,7 +62,6 @@ const F32 SELECTED_MANIPULATOR_SCALE = 1.05f;
const F32 MANIPULATOR_SCALE_HALF_LIFE = 0.07f;
extern void handle_reset_rotation(void*); // in LLViewerWindow
extern void handle_first_tool(void*);
LLManipRotate::LLManipRotate( LLToolComposite* composite )
: LLManip( "Rotate", composite ),
@ -89,6 +88,7 @@ void LLManipRotate::handleSelect()
// *FIX: put this in mouseDown?
gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
gFloaterTools->setStatusText("Drag colored bands to rotate object");
LLManip::handleSelect();
}
void LLManipRotate::handleDeselect()
@ -97,6 +97,7 @@ void LLManipRotate::handleDeselect()
mManipPart = LL_NO_PART;
gFloaterTools->setStatusText("");
LLManip::handleDeselect();
}
void LLManipRotate::render()
@ -108,7 +109,7 @@ void LLManipRotate::render()
LLGLEnable gls_alpha_test(GL_ALPHA_TEST);
// You can rotate if you can move
LLViewerObject* first_object = gSelectMgr->getFirstMoveableObject(TRUE);
LLViewerObject* first_object = mObjectSelection->getFirstMoveableObject(TRUE);
if( !first_object )
{
return;
@ -121,7 +122,7 @@ void LLManipRotate::render()
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
F32 zoom = gAgent.getAvatarObject()->mHUDCurZoom;
glScalef(zoom, zoom, zoom);
@ -339,7 +340,7 @@ BOOL LLManipRotate::handleMouseDown(S32 x, S32 y, MASK mask)
{
BOOL handled = FALSE;
LLViewerObject* first_object = gSelectMgr->getFirstMoveableObject(TRUE);
LLViewerObject* first_object = mObjectSelection->getFirstMoveableObject(TRUE);
if( first_object )
{
LLViewerObject* hit_obj = gViewerWindow->lastObjectHit();
@ -355,10 +356,10 @@ BOOL LLManipRotate::handleMouseDown(S32 x, S32 y, MASK mask)
// Assumes that one of the parts of the manipulator was hit.
BOOL LLManipRotate::handleMouseDownOnPart( S32 x, S32 y, MASK mask )
{
BOOL can_rotate = gSelectMgr->getObjectCount() != 0;
for (LLViewerObject* objectp = gSelectMgr->getFirstObject();
BOOL can_rotate = mObjectSelection->getObjectCount() != 0;
for (LLViewerObject* objectp = mObjectSelection->getFirstObject();
objectp;
objectp = gSelectMgr->getNextObject())
objectp = mObjectSelection->getNextObject())
{
can_rotate = can_rotate && objectp->permMove() && (objectp->permModify() || gSavedSettings.getBOOL("SelectLinkedSet"));
}
@ -463,7 +464,7 @@ BOOL LLManipRotate::handleHover(S32 x, S32 y, MASK mask)
{
if( hasMouseCapture() )
{
if( gSelectMgr->isEmpty() )
if( mObjectSelection->isEmpty() )
{
// Somehow the object got deselected while we were dragging it.
setMouseCapture( FALSE );
@ -531,7 +532,7 @@ void LLManipRotate::drag( S32 x, S32 y )
LLSelectNode* selectNode;
BOOL using_linked_selection = gSavedSettings.getBOOL("SelectLinkedSet");
for( selectNode = gSelectMgr->getFirstNode(); selectNode != NULL; selectNode = gSelectMgr->getNextNode() )
for( selectNode = mObjectSelection->getFirstNode(); selectNode != NULL; selectNode = mObjectSelection->getNextNode() )
{
object = selectNode->getObject();
@ -603,7 +604,7 @@ void LLManipRotate::drag( S32 x, S32 y )
}
// update positions
for( selectNode = gSelectMgr->getFirstNode(); selectNode != NULL; selectNode = gSelectMgr->getNextNode() )
for( selectNode = mObjectSelection->getFirstNode(); selectNode != NULL; selectNode = mObjectSelection->getNextNode() )
{
object = selectNode->getObject();
@ -766,7 +767,7 @@ void LLManipRotate::renderSnapGuides()
LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter );
LLVector3 cam_at_axis;
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
cam_at_axis.setVec(1.f, 0.f, 0.f);
}
@ -780,7 +781,7 @@ void LLManipRotate::renderSnapGuides()
LLVector3 test_axis = constraint_axis;
BOOL constrain_to_ref_object = FALSE;
if (gSelectMgr->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject())
if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject())
{
test_axis = test_axis * ~grid_rotation;
}
@ -807,7 +808,7 @@ void LLManipRotate::renderSnapGuides()
}
LLVector3 projected_snap_axis = world_snap_axis;
if (gSelectMgr->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject())
if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject())
{
projected_snap_axis = projected_snap_axis * grid_rotation;
}
@ -947,32 +948,32 @@ void LLManipRotate::renderSnapGuides()
{
if (i == 0)
{
renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Forward" : "East", LLColor4::white);
renderTickText(text_point, mObjectSelection->isAttachment() ? "Forward" : "East", LLColor4::white);
}
else if (i == 16)
{
if (constraint_axis.mV[VZ] > 0.f)
{
renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Left" : "North", LLColor4::white);
renderTickText(text_point, mObjectSelection->isAttachment() ? "Left" : "North", LLColor4::white);
}
else
{
renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Right" : "South", LLColor4::white);
renderTickText(text_point, mObjectSelection->isAttachment() ? "Right" : "South", LLColor4::white);
}
}
else if (i == 32)
{
renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Back" : "West", LLColor4::white);
renderTickText(text_point, mObjectSelection->isAttachment() ? "Back" : "West", LLColor4::white);
}
else
{
if (constraint_axis.mV[VZ] > 0.f)
{
renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Right" : "South", LLColor4::white);
renderTickText(text_point, mObjectSelection->isAttachment() ? "Right" : "South", LLColor4::white);
}
else
{
renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Left" : "North", LLColor4::white);
renderTickText(text_point, mObjectSelection->isAttachment() ? "Left" : "North", LLColor4::white);
}
}
}
@ -980,7 +981,7 @@ void LLManipRotate::renderSnapGuides()
{
if (i == 0)
{
renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Left" : "North", LLColor4::white);
renderTickText(text_point, mObjectSelection->isAttachment() ? "Left" : "North", LLColor4::white);
}
else if (i == 16)
{
@ -995,7 +996,7 @@ void LLManipRotate::renderSnapGuides()
}
else if (i == 32)
{
renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Right" : "South", LLColor4::white);
renderTickText(text_point, mObjectSelection->isAttachment() ? "Right" : "South", LLColor4::white);
}
else
{
@ -1019,11 +1020,11 @@ void LLManipRotate::renderSnapGuides()
{
if (constraint_axis.mV[VY] > 0.f)
{
renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Forward" : "East", LLColor4::white);
renderTickText(text_point, mObjectSelection->isAttachment() ? "Forward" : "East", LLColor4::white);
}
else
{
renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Back" : "West", LLColor4::white);
renderTickText(text_point, mObjectSelection->isAttachment() ? "Back" : "West", LLColor4::white);
}
}
else if (i == 32)
@ -1034,11 +1035,11 @@ void LLManipRotate::renderSnapGuides()
{
if (constraint_axis.mV[VY] > 0.f)
{
renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Back" : "West", LLColor4::white);
renderTickText(text_point, mObjectSelection->isAttachment() ? "Back" : "West", LLColor4::white);
}
else
{
renderTickText(text_point, gSelectMgr->selectionIsAttachment() ? "Forward" : "East", LLColor4::white);
renderTickText(text_point, mObjectSelection->isAttachment() ? "Forward" : "East", LLColor4::white);
}
}
}
@ -1053,7 +1054,7 @@ void LLManipRotate::renderSnapGuides()
getObjectAxisClosestToMouse(object_axis);
// project onto constraint plane
LLSelectNode* first_node = gSelectMgr->getFirstMoveableNode(TRUE);
LLSelectNode* first_node = mObjectSelection->getFirstMoveableNode(TRUE);
object_axis = object_axis * first_node->getObject()->getRenderRotation();
object_axis = object_axis - (object_axis * getConstraintAxis()) * getConstraintAxis();
object_axis.normVec();
@ -1137,7 +1138,7 @@ BOOL LLManipRotate::updateVisiblity()
BOOL visible = FALSE;
LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter );
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
mCenterToCam = LLVector3(-1.f / gAgent.getAvatarObject()->mHUDCurZoom, 0.f, 0.f);
mCenterToCamNorm = mCenterToCam;
@ -1246,7 +1247,7 @@ LLQuaternion LLManipRotate::dragUnconstrained( S32 x, S32 y )
F32 angle = (-1.f + dist_to_intersection / dist_to_tangent_point) * in_sphere_angle;
LLVector3 axis;
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
axis = LLVector3(-1.f, 0.f, 0.f) % profile_center_to_intersection;
}
@ -1289,7 +1290,7 @@ LLVector3 LLManipRotate::getConstraintAxis()
gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale);
LLSelectNode* first_node = gSelectMgr->getFirstMoveableNode(TRUE);
LLSelectNode* first_node = mObjectSelection->getFirstMoveableNode(TRUE);
if (first_node)
{
// *FIX: get agent local attachment grid working
@ -1303,7 +1304,7 @@ LLVector3 LLManipRotate::getConstraintAxis()
LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y )
{
LLSelectNode* first_object_node = gSelectMgr->getFirstMoveableNode(TRUE);
LLSelectNode* first_object_node = mObjectSelection->getFirstMoveableNode(TRUE);
LLVector3 constraint_axis = getConstraintAxis();
LLVector3 center = gAgent.getPosAgentFromGlobal( mRotationCenter );
@ -1320,7 +1321,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y )
LLVector3 axis2;
LLVector3 test_axis = constraint_axis;
if (gSelectMgr->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject())
if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject())
{
test_axis = test_axis * ~grid_rotation;
}
@ -1344,7 +1345,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y )
axis1 = LLVector3::x_axis;
}
if (gSelectMgr->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject())
if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject())
{
axis1 = axis1 * grid_rotation;
}
@ -1366,7 +1367,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y )
// We're looking at the ring edge-on.
LLVector3 snap_plane_center = (center + (constraint_axis * mRadiusMeters * 0.5f));
LLVector3 cam_to_snap_plane;
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
cam_to_snap_plane.setVec(1.f, 0.f, 0.f);
}
@ -1416,7 +1417,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y )
{
// try other plane
snap_plane_center = (center - (constraint_axis * mRadiusMeters * 0.5f));
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
cam_to_snap_plane.setVec(1.f, 0.f, 0.f);
}
@ -1463,7 +1464,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y )
if (snap_plane > 0)
{
LLVector3 cam_at_axis;
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
cam_at_axis.setVec(1.f, 0.f, 0.f);
}
@ -1661,9 +1662,10 @@ LLVector3 LLManipRotate::intersectRayWithSphere( const LLVector3& ray_pt, const
}
// Utility function. Should probably be moved to another class.
//static
void LLManipRotate::mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_dir )
{
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (gSelectMgr->getSelection()->getSelectType() == SELECT_TYPE_HUD)
{
F32 mouse_x = (((F32)x / gViewerWindow->getWindowWidth()) - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom;
F32 mouse_y = ((((F32)y) / gViewerWindow->getWindowHeight()) - 0.5f) / gAgent.getAvatarObject()->mHUDCurZoom;
@ -1685,7 +1687,7 @@ void LLManipRotate::highlightManipulators( S32 x, S32 y )
mHighlightedPart = LL_NO_PART;
//LLBBox bbox = gSelectMgr->getBBoxOfSelection();
LLViewerObject *first_object = gSelectMgr->getFirstMoveableObject(TRUE);
LLViewerObject *first_object = mObjectSelection->getFirstMoveableObject(TRUE);
if (!first_object)
{
@ -1821,7 +1823,7 @@ void LLManipRotate::highlightManipulators( S32 x, S32 y )
S32 LLManipRotate::getObjectAxisClosestToMouse(LLVector3& object_axis)
{
LLSelectNode* first_object_node = gSelectMgr->getFirstMoveableNode(TRUE);
LLSelectNode* first_object_node = mObjectSelection->getFirstMoveableNode(TRUE);
if (!first_object_node)
{

View File

@ -140,6 +140,7 @@ void LLManipScale::handleSelect()
updateSnapGuides(bbox);
gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
gFloaterTools->setStatusText("Click and drag to stretch selected side");
LLManip::handleSelect();
}
void LLManipScale::handleDeselect()
@ -147,6 +148,7 @@ void LLManipScale::handleDeselect()
mHighlightedPart = LL_NO_PART;
mManipPart = LL_NO_PART;
gFloaterTools->setStatusText("");
LLManip::handleDeselect();
}
BOOL sort_manip_by_z(LLManipScale::ManipulatorHandle *new_manip, LLManipScale::ManipulatorHandle *test_manip)
@ -196,7 +198,7 @@ void LLManipScale::render()
{
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
F32 zoom = gAgent.getAvatarObject()->mHUDCurZoom;
glScalef(zoom, zoom, zoom);
@ -212,7 +214,7 @@ void LLManipScale::render()
F32 range;
F32 range_from_agent;
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
mBoxHandleSize = BOX_HANDLE_BASE_SIZE * BOX_HANDLE_BASE_FACTOR / (F32) gCamera->getViewHeightInPixels();
mBoxHandleSize /= gAgent.getAvatarObject()->mHUDCurZoom;
@ -311,10 +313,10 @@ BOOL LLManipScale::handleMouseDown(S32 x, S32 y, MASK mask)
// Assumes that one of the arrows on an object was hit.
BOOL LLManipScale::handleMouseDownOnPart( S32 x, S32 y, MASK mask )
{
BOOL can_scale = gSelectMgr->getObjectCount() != 0;
for (LLViewerObject* objectp = gSelectMgr->getFirstObject();
BOOL can_scale = mObjectSelection->getObjectCount() != 0;
for (LLViewerObject* objectp = mObjectSelection->getFirstObject();
objectp;
objectp = gSelectMgr->getNextObject())
objectp = mObjectSelection->getNextObject())
{
can_scale = can_scale && objectp->permModify() && objectp->permMove() && !objectp->isSeat();
}
@ -377,7 +379,7 @@ BOOL LLManipScale::handleHover(S32 x, S32 y, MASK mask)
{
if( hasMouseCapture() )
{
if( gSelectMgr->isEmpty() )
if( mObjectSelection->isEmpty() )
{
// Somehow the object got deselected while we were dragging it.
setMouseCapture( FALSE );
@ -413,7 +415,7 @@ void LLManipScale::highlightManipulators(S32 x, S32 y)
if( isSelectionScalable() )
{
LLMatrix4 transform;
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
LLVector4 translation(bbox.getPositionAgent());
transform.initRotTrans(bbox.getRotation(), translation);
@ -454,7 +456,7 @@ void LLManipScale::highlightManipulators(S32 x, S32 y)
mManipulatorVertices[numManips++] = LLVector4(max.mV[VX], max.mV[VY], max.mV[VZ], 1.f);
// 1-D highlights are applicable iff one object is selected
if( gSelectMgr->getObjectCount() == 1 )
if( mObjectSelection->getObjectCount() == 1 )
{
// face centers
mManipulatorVertices[numManips++] = LLVector4(ctr.mV[VX], ctr.mV[VY], max.mV[VZ], 1.f);
@ -520,7 +522,7 @@ void LLManipScale::renderFaces( const LLBBox& bbox )
{
// Don't bother to render the drag handles for 1-D scaling if
// more than one object is selected or if it is an attachment
if ( gSelectMgr->getObjectCount() > 1 )
if ( mObjectSelection->getObjectCount() > 1 )
{
return;
}
@ -926,7 +928,7 @@ void LLManipScale::dragCorner( S32 x, S32 y )
// find max and min scale factors that will make biggest object hit max absolute scale and smallest object hit min absolute scale
LLSelectNode* selectNode;
for( selectNode = gSelectMgr->getFirstNode(); selectNode; selectNode = gSelectMgr->getNextNode() )
for( selectNode = mObjectSelection->getFirstNode(); selectNode; selectNode = mObjectSelection->getNextNode() )
{
LLViewerObject* cur = selectNode->getObject();
if( cur->permModify() && cur->permMove() && !cur->isAvatar() )
@ -946,7 +948,7 @@ void LLManipScale::dragCorner( S32 x, S32 y )
LLVector3d drag_global = uniform ? mDragStartCenterGlobal : mDragFarHitGlobal;
// do the root objects i.e. (TRUE == cur->isRootEdit())
for( selectNode = gSelectMgr->getFirstNode(); selectNode; selectNode = gSelectMgr->getNextNode() )
for( selectNode = mObjectSelection->getFirstNode(); selectNode; selectNode = mObjectSelection->getNextNode() )
{
LLViewerObject* cur = selectNode->getObject();
if( cur->permModify() && cur->permMove() && !cur->isAvatar() && cur->isRootEdit() )
@ -990,7 +992,7 @@ void LLManipScale::dragCorner( S32 x, S32 y )
}
}
// do the child objects i.e. (FALSE == cur->isRootEdit())
for( selectNode = gSelectMgr->getFirstNode(); selectNode; selectNode = gSelectMgr->getNextNode() )
for( selectNode = mObjectSelection->getFirstNode(); selectNode; selectNode = mObjectSelection->getNextNode() )
{
LLViewerObject*cur = selectNode->getObject();
if( cur->permModify() && cur->permMove() && !cur->isAvatar() && !cur->isRootEdit() )
@ -1209,7 +1211,7 @@ void LLManipScale::stretchFace( const LLVector3& drag_start_agent, const LLVecto
LLVector3 drag_start_center_agent = gAgent.getPosAgentFromGlobal(mDragStartCenterGlobal);
LLSelectNode *selectNode;
for( selectNode = gSelectMgr->getFirstNode(); selectNode; selectNode = gSelectMgr->getNextNode() )
for( selectNode = mObjectSelection->getFirstNode(); selectNode; selectNode = mObjectSelection->getNextNode() )
{
LLViewerObject*cur = selectNode->getObject();
if( cur->permModify() && cur->permMove() && !cur->isAvatar() )
@ -1330,7 +1332,7 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox)
mScaleDir = box_corner_agent - mScaleCenter;
mScaleDir.normVec();
if(gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if(mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
mSnapRegimeOffset = SNAP_GUIDE_SCREEN_OFFSET / gAgent.getAvatarObject()->mHUDCurZoom;
@ -1342,7 +1344,7 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox)
}
LLVector3 cam_at_axis;
F32 snap_guide_length;
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
cam_at_axis.setVec(1.f, 0.f, 0.f);
snap_guide_length = SNAP_GUIDE_SCREEN_LENGTH / gAgent.getAvatarObject()->mHUDCurZoom;
@ -1389,7 +1391,7 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox)
{
LLVector3 local_scale_dir = partToUnitVector( mManipPart );
LLVector3 local_camera_dir;
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
local_camera_dir = LLVector3(-1.f, 0.f, 0.f) * ~bbox.getRotation();
}
@ -1668,7 +1670,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
start_tick = -(llmin(ticks_from_scale_center_1, num_ticks_per_side1));
stop_tick = llmin(max_ticks1, num_ticks_per_side1);
F32 grid_resolution = gSelectMgr->getSelectType() == SELECT_TYPE_HUD ? 0.25f : llmax(gSavedSettings.getF32("GridResolution"), 0.001f);
F32 grid_resolution = mObjectSelection->getSelectType() == SELECT_TYPE_HUD ? 0.25f : llmax(gSavedSettings.getF32("GridResolution"), 0.001f);
S32 label_sub_div_offset_1 = llround(fmod(dist_grid_axis - grid_offset1, mScaleSnapUnit1 * 32.f) / (mScaleSnapUnit1 / max_subdivisions));
S32 label_sub_div_offset_2 = llround(fmod(dist_grid_axis - grid_offset2, mScaleSnapUnit2 * 32.f) / (mScaleSnapUnit2 / max_subdivisions));
@ -1774,7 +1776,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
// render help text
if (gSelectMgr->getSelectType() != SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
{
if (mHelpTextTimer.getElapsedTimeF32() < sHelpTextVisibleTime + sHelpTextFadeTime && sNumTimesHelpTextShown < sMaxTimesShowHelpText)
{
@ -1796,10 +1798,10 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox)
std::string help_text = "Move mouse cursor over ruler";
LLColor4 help_text_color = LLColor4::white;
help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, grid_alpha, 0.f);
hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, gSelectMgr->getSelectType() == SELECT_TYPE_HUD);
hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
help_text = "to snap to grid";
help_text_pos -= gCamera->getUpAxis() * mSnapRegimeOffset * 0.4f;
hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, gSelectMgr->getSelectType() == SELECT_TYPE_HUD);
hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
}
}
}
@ -2003,14 +2005,16 @@ LLVector3 LLManipScale::nearestAxis( const LLVector3& v ) const
return LLVector3( coords[greatest_index] );
}
BOOL LLManipScale::isSelectionScalable() const
//FIXME: make this const once we switch to iterator interface
//(making object traversal a const-able operation)
BOOL LLManipScale::isSelectionScalable()
{
// An selection is scalable if you are allowed to both edit and move
// everything in it, and it does not have any sitting agents
BOOL scalable = gSelectMgr->getFirstObject() ? TRUE : FALSE;
for(LLViewerObject* cur = gSelectMgr->getFirstObject();
BOOL scalable = mObjectSelection->getFirstObject() ? TRUE : FALSE;
for(LLViewerObject* cur = mObjectSelection->getFirstObject();
cur;
cur = gSelectMgr->getNextObject() )
cur = mObjectSelection->getNextObject() )
{
if( !(cur->permModify() && cur->permMove())
|| cur->isSeat())

View File

@ -94,7 +94,7 @@ private:
F32 partToMinScale( S32 part, const LLBBox& bbox ) const;
LLVector3 nearestAxis( const LLVector3& v ) const;
BOOL isSelectionScalable() const;
BOOL isSelectionScalable();
void stretchFace( const LLVector3& drag_start_agent, const LLVector3& drag_delta_agent);

View File

@ -238,6 +238,7 @@ void LLManipTranslate::handleSelect()
{
gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
gFloaterTools->setStatusText("Drag to move, shift-drag to copy");
LLManip::handleSelect();
}
void LLManipTranslate::handleDeselect()
@ -245,6 +246,7 @@ void LLManipTranslate::handleDeselect()
mHighlightedPart = LL_NO_PART;
mManipPart = LL_NO_PART;
gFloaterTools->setStatusText("");
LLManip::handleDeselect();
}
BOOL LLManipTranslate::handleMouseDown(S32 x, S32 y, MASK mask)
@ -270,10 +272,10 @@ BOOL LLManipTranslate::handleMouseDown(S32 x, S32 y, MASK mask)
// Assumes that one of the arrows on an object was hit.
BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask )
{
BOOL can_move = gSelectMgr->getObjectCount() != 0;
for (LLViewerObject* objectp = gSelectMgr->getFirstObject();
BOOL can_move = mObjectSelection->getObjectCount() != 0;
for (LLViewerObject* objectp = mObjectSelection->getFirstObject();
objectp;
objectp = gSelectMgr->getNextObject())
objectp = mObjectSelection->getNextObject())
{
can_move = can_move && objectp->permMove() && (objectp->permModify() || gSavedSettings.getBOOL("SelectLinkedSet"));
}
@ -313,7 +315,7 @@ BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask )
LLVector3 axis;
LLSelectNode *selectNode = gSelectMgr->getFirstMoveableNode(TRUE);
LLSelectNode *selectNode = mObjectSelection->getFirstMoveableNode(TRUE);
if (!selectNode)
{
@ -388,7 +390,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
BOOL rotated = FALSE;
// ...build mode moves camera about focus point
if (gSelectMgr->getSelectType() != SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
{
if (x < ROTATE_H_MARGIN)
{
@ -452,7 +454,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
// pick the first object to constrain to grid w/ common origin
// this is so we don't screw up groups
LLSelectNode* selectNode = gSelectMgr->getFirstMoveableNode(TRUE);
LLSelectNode* selectNode = mObjectSelection->getFirstMoveableNode(TRUE);
if (!selectNode)
{
// somehow we lost the object!
@ -624,9 +626,9 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
LLVector3d clamped_relative_move = axis_magnitude * axis_d; // scalar multiply
LLVector3 clamped_relative_move_f = (F32)axis_magnitude * axis_f; // scalar multiply
for(selectNode = gSelectMgr->getFirstNode();
for(selectNode = mObjectSelection->getFirstNode();
selectNode;
selectNode = gSelectMgr->getNextNode() )
selectNode = mObjectSelection->getNextNode() )
{
object = selectNode->getObject();
@ -792,7 +794,7 @@ void LLManipTranslate::highlightManipulators(S32 x, S32 y)
{
mHighlightedPart = LL_NO_PART;
if (!gSelectMgr->getObjectCount())
if (!mObjectSelection->getObjectCount())
{
return;
}
@ -813,7 +815,7 @@ void LLManipTranslate::highlightManipulators(S32 x, S32 y)
LLMatrix4 transform;
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
relative_camera_dir = LLVector3(1.f, 0.f, 0.f) * ~grid_rotation;
LLVector4 translation(object_position);
@ -1060,7 +1062,7 @@ void LLManipTranslate::render()
{
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
F32 zoom = gAgent.getAvatarObject()->mHUDCurZoom;
glScalef(zoom, zoom, zoom);
@ -1098,7 +1100,7 @@ void LLManipTranslate::renderSnapGuides()
return;
}
LLSelectNode *first_node = gSelectMgr->getFirstMoveableNode(TRUE);
LLSelectNode *first_node = mObjectSelection->getFirstMoveableNode(TRUE);
if (!first_node)
{
return;
@ -1123,7 +1125,7 @@ void LLManipTranslate::renderSnapGuides()
getManipAxis(first_object, mManipPart, translate_axis);
LLVector3 at_axis_abs;
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
at_axis_abs = LLVector3::x_axis * ~grid_rotation;
}
@ -1198,7 +1200,7 @@ void LLManipTranslate::renderSnapGuides()
F32 guide_size_meters;
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
guide_size_meters = 1.f / gAgent.getAvatarObject()->mHUDCurZoom;
mSnapOffsetMeters = mArrowLengthMeters * 1.5f;
@ -1400,7 +1402,7 @@ void LLManipTranslate::renderSnapGuides()
}
}
}
if (gSelectMgr->getSelectType() != SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() != SELECT_TYPE_HUD)
{
// render helpful text
if (mHelpTextTimer.getElapsedTimeF32() < sHelpTextVisibleTime + sHelpTextFadeTime && sNumTimesHelpTextShown < sMaxTimesShowHelpText)
@ -1424,10 +1426,10 @@ void LLManipTranslate::renderSnapGuides()
std::string help_text = "Move mouse cursor over ruler to snap";
LLColor4 help_text_color = LLColor4::white;
help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f);
hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, gSelectMgr->getSelectType() == SELECT_TYPE_HUD);
hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
help_text = "to snap to grid";
help_text_pos -= gCamera->getUpAxis() * mSnapOffsetMeters * 0.2f;
hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, gSelectMgr->getSelectType() == SELECT_TYPE_HUD);
hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
}
}
}
@ -1592,17 +1594,17 @@ void LLManipTranslate::renderGrid(F32 x, F32 y, F32 size, F32 r, F32 g, F32 b, F
void LLManipTranslate::renderText()
{
if (gSelectMgr->getRootObjectCount() && !gSelectMgr->selectionIsAttachment())
if (mObjectSelection->getRootObjectCount() && !mObjectSelection->isAttachment())
{
LLVector3 pos = getPivotPoint();
renderXYZ(pos);
}
else
{
LLViewerObject* objectp = gSelectMgr->getFirstRootObject();
LLViewerObject* objectp = mObjectSelection->getFirstRootObject();
if(!objectp)
{
objectp = gSelectMgr->getFirstObject();
objectp = mObjectSelection->getFirstObject();
}
if (objectp)
@ -1621,7 +1623,7 @@ void LLManipTranslate::renderTranslationHandles()
gSelectMgr->getGrid(grid_origin, grid_rotation, grid_scale);
LLVector3 at_axis;
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
at_axis = LLVector3::x_axis * ~grid_rotation;
}
@ -1657,13 +1659,13 @@ void LLManipTranslate::renderTranslationHandles()
mPlaneManipPositions.mV[VZ] = -1.f;
}
LLViewerObject *first_object = gSelectMgr->getFirstMoveableObject(TRUE);
LLViewerObject *first_object = mObjectSelection->getFirstMoveableObject(TRUE);
if (!first_object) return;
LLVector3 selection_center = getPivotPoint();
// Drag handles
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
mArrowLengthMeters = mAxisArrowLength / gViewerWindow->getWindowHeight();
mArrowLengthMeters /= gAgent.getAvatarObject()->mHUDCurZoom;
@ -1716,7 +1718,7 @@ void LLManipTranslate::renderTranslationHandles()
LLVector3 relative_camera_dir;
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
relative_camera_dir = LLVector3::x_axis * invRotation;
}
@ -1988,7 +1990,7 @@ void LLManipTranslate::renderTranslationHandles()
// draw arrows for deeper faces first, closer faces last
LLVector3 camera_axis;
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
{
camera_axis = LLVector3::x_axis;
}

View File

@ -96,8 +96,8 @@ void LLPanelContents::getState(LLViewerObject *objectp )
// unambiguous destination for the object.
if( editable &&
all_volume &&
((gSelectMgr->getRootObjectCount() == 1)
|| (gSelectMgr->getObjectCount() == 1)))
((gSelectMgr->getSelection()->getRootObjectCount() == 1)
|| (gSelectMgr->getSelection()->getObjectCount() == 1)))
{
//mBtnNewScript->setEnabled(TRUE);
childSetEnabled("button new script",TRUE);
@ -112,10 +112,10 @@ void LLPanelContents::getState(LLViewerObject *objectp )
void LLPanelContents::refresh()
{
LLViewerObject* object = gSelectMgr->getFirstRootObject();
LLViewerObject* object = gSelectMgr->getSelection()->getFirstRootObject();
if(!object)
{
object = gSelectMgr->getFirstObject();
object = gSelectMgr->getSelection()->getFirstObject();
}
getState(object);
@ -134,10 +134,10 @@ void LLPanelContents::refresh()
// static
void LLPanelContents::onClickNewScript(void *userdata)
{
LLViewerObject* object = gSelectMgr->getFirstRootObject();
LLViewerObject* object = gSelectMgr->getSelection()->getFirstRootObject();
if(!object)
{
object = gSelectMgr->getFirstObject();
object = gSelectMgr->getSelection()->getFirstObject();
}
if(object)
{

View File

@ -238,7 +238,8 @@ void LLPanelFace::sendTextureInfo()
{
S32 te;
LLViewerObject* object;
for ( gSelectMgr->getFirstTE(&object, &te); object; gSelectMgr->getNextTE(&object, &te) )
LLObjectSelectionHandle selection = gSelectMgr->getSelection();
for ( selection->getFirstTE(&object, &te); object; selection->getNextTE(&object, &te) )
{
BOOL valid;
F32 value;
@ -317,7 +318,7 @@ void LLPanelFace::sendTextureInfo()
}
}
for ( object = gSelectMgr->getFirstObject(); object; object = gSelectMgr->getNextObject() )
for ( object = gSelectMgr->getSelection()->getFirstObject(); object; object = gSelectMgr->getSelection()->getNextObject() )
{
object->sendTEUpdate();
}
@ -325,7 +326,7 @@ void LLPanelFace::sendTextureInfo()
void LLPanelFace::getState()
{
LLViewerObject* objectp = gSelectMgr->getFirstObject();
LLViewerObject* objectp = gSelectMgr->getSelection()->getFirstObject();
if( objectp
&& objectp->getPCode() == LL_PCODE_VOLUME)
@ -600,7 +601,7 @@ BOOL LLPanelFace::allFacesSameValue( F32 (get_face_value(LLViewerObject*, S32)),
// Get the value from the primary selected TE
F32 first_value = *value;
BOOL got_first = FALSE;
gSelectMgr->getPrimaryTE(&object, &te);
gSelectMgr->getSelection()->getPrimaryTE(&object, &te);
if (object)
{
first_value = get_face_value(object, te);
@ -609,7 +610,8 @@ BOOL LLPanelFace::allFacesSameValue( F32 (get_face_value(LLViewerObject*, S32)),
// Now iterate through all TEs to test for sameness
BOOL identical = TRUE;
for ( gSelectMgr->getFirstTE(&object, &te); object; gSelectMgr->getNextTE(&object, &te) )
LLObjectSelectionHandle selection = gSelectMgr->getSelection();
for ( selection->getFirstTE(&object, &te); object; selection->getNextTE(&object, &te) )
{
if (!got_first)
{
@ -760,13 +762,13 @@ void LLPanelFace::onCommitFullbright(LLUICtrl* ctrl, void* userdata)
BOOL LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item, void*)
{
BOOL accept = TRUE;
LLViewerObject* obj = gSelectMgr->getFirstRootObject();
LLViewerObject* obj = gSelectMgr->getSelection()->getFirstRootObject();
while(accept && obj)
{
if(!LLToolDragAndDrop::isInventoryDropAcceptable(obj, item))
accept = FALSE;
else
obj = gSelectMgr->getNextRootObject();
obj = gSelectMgr->getSelection()->getNextRootObject();
}
return accept;
}
@ -823,7 +825,8 @@ void LLPanelFace::onClickAutoFix(void* userdata)
LLViewerObject* object;
// for all selected objects
for ( gSelectMgr->getFirstTE(&object, &te); object; gSelectMgr->getNextTE(&object, &te) )
LLObjectSelectionHandle selection = gSelectMgr->getSelection();
for ( selection->getFirstTE(&object, &te); object; selection->getNextTE(&object, &te) )
{
// only do this if it's a media texture
if ( object->getTE ( te )->getID() == LLMediaEngine::getInstance()->getImageUUID () )
@ -848,7 +851,7 @@ void LLPanelFace::onClickAutoFix(void* userdata)
};
// not clear why this is in a separate loop but i followed the patter from further up this file just in case.
for ( object = gSelectMgr->getFirstObject(); object; object = gSelectMgr->getNextObject() )
for ( object = gSelectMgr->getSelection()->getFirstObject(); object; object = gSelectMgr->getSelection()->getNextObject() )
{
object->sendTEUpdate();
};

View File

@ -90,7 +90,7 @@ void LLPanelLandInfo::refreshAll()
// public
void LLPanelLandInfo::refresh()
{
LLParcel *parcel = gParcelMgr->getSelectedParcel();
LLParcel *parcel = gParcelMgr->getParcelSelection()->getParcel();
LLViewerRegion *regionp = gParcelMgr->getSelectionRegion();
if (!parcel || !regionp)
@ -158,7 +158,7 @@ void LLPanelLandInfo::refresh()
// and it must not be a whole parcel.
if (gParcelMgr->getSelectedArea() > PARCEL_UNIT_AREA
//&& gParcelMgr->getSelfCount() > 1
&& !gParcelMgr->getWholeParcelSelected())
&& !gParcelMgr->getParcelSelection()->getWholeParcelSelected())
{
childSetEnabled("button join land",TRUE);
}
@ -181,7 +181,7 @@ void LLPanelLandInfo::refresh()
&rent_price,
&for_sale,
&dwell);
if(is_public || (is_for_sale && gParcelMgr->getWholeParcelSelected()))
if(is_public || (is_for_sale && gParcelMgr->getParcelSelection()->getWholeParcelSelected()))
{
childSetTextArg("label_area_price","[PRICE]", llformat("%d",claim_price));
childSetTextArg("label_area_price","[AREA]", llformat("%d",area));
@ -227,7 +227,7 @@ void LLPanelLandInfo::onClickJoin(void*)
void LLPanelLandInfo::onClickAbout(void*)
{
// Promote the rectangle selection to a parcel selection
if (!gParcelMgr->getWholeParcelSelected())
if (!gParcelMgr->getParcelSelection()->getWholeParcelSelected())
{
gParcelMgr->selectParcelInRectangle();
}

View File

@ -256,11 +256,11 @@ LLPanelObject::~LLPanelObject()
void LLPanelObject::getState( )
{
LLViewerObject* objectp = gSelectMgr->getFirstRootObject();
LLViewerObject* objectp = gSelectMgr->getSelection()->getFirstRootObject();
LLViewerObject* root_objectp = objectp;
if(!objectp)
{
objectp = gSelectMgr->getFirstObject();
objectp = gSelectMgr->getSelection()->getFirstObject();
// *FIX: shouldn't we just keep the child?
if (objectp)
{
@ -372,9 +372,9 @@ void LLPanelObject::getState( )
owners_identical = gSelectMgr->selectGetOwner(owner_id, owner_name);
// BUG? Check for all objects being editable?
S32 roots_selected = gSelectMgr->getRootObjectCount();
S32 roots_selected = gSelectMgr->getSelection()->getRootObjectCount();
BOOL editable = root_objectp->permModify();
S32 selected_count = gSelectMgr->getObjectCount();
S32 selected_count = gSelectMgr->getSelection()->getObjectCount();
BOOL single_volume = (gSelectMgr->selectionAllPCode( LL_PCODE_VOLUME ))
&& (selected_count == 1);
@ -1506,7 +1506,7 @@ void LLPanelObject::draw()
const LLColor4 blue( 0.f, 0.5f, 1.0f, 1);
// Tune the colors of the labels
LLTool* tool = gToolMgr->getCurrentTool( gKeyboard->currentMask(TRUE) );
LLTool* tool = gToolMgr->getCurrentTool();
if (tool == gToolTranslate)
{
@ -1626,7 +1626,7 @@ void LLPanelObject::onCommitLock(LLUICtrl *ctrl, void *data)
BOOL new_state = self->mCheckLock->get();
gSelectMgr->setObjectPermissions(PERM_OWNER, !new_state, PERM_MOVE | PERM_MODIFY);
gSelectMgr->selectionSetObjectPermissions(PERM_OWNER, !new_state, PERM_MOVE | PERM_MODIFY);
}
// static

View File

@ -128,16 +128,16 @@ void LLPanelPermissions::refresh()
BtnDeedToGroup->setLabelUnselected(deedText);
}
BOOL root_selected = TRUE;
LLSelectNode* nodep = gSelectMgr->getFirstRootNode();
S32 object_count = gSelectMgr->getRootObjectCount();
LLSelectNode* nodep = gSelectMgr->getSelection()->getFirstRootNode();
S32 object_count = gSelectMgr->getSelection()->getRootObjectCount();
if(!nodep || 0 == object_count)
{
nodep = gSelectMgr->getFirstNode();
object_count = gSelectMgr->getObjectCount();
nodep = gSelectMgr->getSelection()->getFirstNode();
object_count = gSelectMgr->getSelection()->getObjectCount();
root_selected = FALSE;
}
//BOOL attachment_selected = gSelectMgr->selectionIsAttachment();
//BOOL attachment_selected = gSelectMgr->getSelection()->isAttachment();
//attachment_selected = false;
LLViewerObject* objectp = NULL;
if(nodep) objectp = nodep->getObject();
@ -230,7 +230,7 @@ void LLPanelPermissions::refresh()
BOOL is_one_object = (object_count == 1);
// BUG: fails if a root and non-root are both single-selected.
BOOL is_perm_modify = (gSelectMgr->getFirstRootNode()
BOOL is_perm_modify = (gSelectMgr->getSelection()->getFirstRootNode()
&& gSelectMgr->selectGetRootsModify())
|| gSelectMgr->selectGetModify();
const LLView* keyboard_focus_view = gFocusMgr.getKeyboardFocus();
@ -354,8 +354,8 @@ void LLPanelPermissions::refresh()
// Pre-compute object info string
S32 prim_count = gSelectMgr->getObjectCount();
S32 obj_count = gSelectMgr->getRootObjectCount();
S32 prim_count = gSelectMgr->getSelection()->getObjectCount();
S32 obj_count = gSelectMgr->getSelection()->getRootObjectCount();
LLString object_info_string;
if (1 == obj_count)
@ -833,7 +833,7 @@ void LLPanelPermissions::onClickDeedToGroup(void* data)
// static
void LLPanelPermissions::onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32 perm)
{
LLViewerObject* object = gSelectMgr->getFirstRootObject();
LLViewerObject* object = gSelectMgr->getSelection()->getFirstRootObject();
if(!object) return;
// Checkbox will have toggled itself
@ -841,7 +841,7 @@ void LLPanelPermissions::onCommitPerm(LLUICtrl *ctrl, void *data, U8 field, U32
LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;
BOOL new_state = check->get();
gSelectMgr->setObjectPermissions(field, new_state, perm);
gSelectMgr->selectionSetObjectPermissions(field, new_state, perm);
}
// static
@ -892,8 +892,8 @@ void LLPanelPermissions::onCommitName(LLUICtrl*, void* data)
LLLineEditor* tb = gUICtrlFactory->getLineEditorByName(self,"Object Name");
if(tb)
{
gSelectMgr->setObjectName(tb->getText());
// gSelectMgr->setObjectName(self->mLabelObjectName->getText());
gSelectMgr->selectionSetObjectName(tb->getText());
// gSelectMgr->selectionSetObjectName(self->mLabelObjectName->getText());
}
}
@ -906,7 +906,7 @@ void LLPanelPermissions::onCommitDesc(LLUICtrl*, void* data)
LLLineEditor* le = gUICtrlFactory->getLineEditorByName(self,"Object Description");
if(le)
{
gSelectMgr->setObjectDescription(le->getText());
gSelectMgr->selectionSetObjectDescription(le->getText());
}
}
@ -968,7 +968,7 @@ void LLPanelPermissions::setAllSaleInfo()
}
LLSaleInfo sale_info(sale_type, price);
gSelectMgr->setObjectSaleInfo(sale_info);
gSelectMgr->selectionSetObjectSaleInfo(sale_info);
// If turned off for-sale, make sure click-action buy is turned
// off as well
@ -1022,7 +1022,7 @@ void LLPanelPermissions::onCommitClickAction(LLUICtrl* ctrl, void*)
{
// Verify object has script with money() handler
LLSelectionPayable payable;
bool can_pay = gSelectMgr->applyToObjects(&payable);
bool can_pay = gSelectMgr->getSelection()->applyToObjects(&payable);
if (!can_pay)
{
// Warn, but do it anyway.

View File

@ -117,11 +117,11 @@ LLPanelVolume::~LLPanelVolume()
void LLPanelVolume::getState( )
{
LLViewerObject* objectp = gSelectMgr->getFirstRootObject();
LLViewerObject* objectp = gSelectMgr->getSelection()->getFirstRootObject();
LLViewerObject* root_objectp = objectp;
if(!objectp)
{
objectp = gSelectMgr->getFirstObject();
objectp = gSelectMgr->getSelection()->getFirstObject();
// *FIX: shouldn't we just keep the child?
if (objectp)
{
@ -166,7 +166,7 @@ void LLPanelVolume::getState( )
// BUG? Check for all objects being editable?
BOOL editable = root_objectp->permModify();
BOOL single_volume = gSelectMgr->selectionAllPCode( LL_PCODE_VOLUME )
&& gSelectMgr->getObjectCount() == 1;
&& gSelectMgr->getSelection()->getObjectCount() == 1;
// Select Single Message
if (single_volume)

View File

@ -33,6 +33,7 @@
// Globals and statics
LLPreview::preview_multimap_t LLPreview::sPreviewsBySource;
LLPreview::preview_map_t LLPreview::sInstances;
std::map<LLUUID, LLViewHandle> LLMultiPreview::sAutoOpenPreviewHandles;
// Functions
LLPreview::LLPreview(const std::string& name) :
@ -200,11 +201,11 @@ void LLPreview::onCommit()
{
gSelectMgr->deselectAll();
gSelectMgr->addAsIndividual( obj, SELECT_ALL_TES, FALSE );
gSelectMgr->setObjectDescription( childGetText("desc") );
gSelectMgr->selectionSetObjectDescription( childGetText("desc") );
if( has_sale_info )
{
gSelectMgr->setObjectSaleInfo( sale_info );
gSelectMgr->selectionSetObjectSaleInfo( sale_info );
}
gSelectMgr->deselectAll();
@ -492,3 +493,23 @@ void LLMultiPreview::tabOpen(LLFloater* opened_floater, bool from_click)
opened_preview->loadAsset();
}
}
//static
LLMultiPreview* LLMultiPreview::getAutoOpenInstance(const LLUUID& id)
{
handle_map_t::iterator found_it = sAutoOpenPreviewHandles.find(id);
if (found_it != sAutoOpenPreviewHandles.end())
{
return (LLMultiPreview*)gFloaterView->getFloaterByHandle(found_it->second);
}
return NULL;
}
//static
void LLMultiPreview::setAutoOpenInstance(LLMultiPreview* previewp, const LLUUID& id)
{
if (previewp)
{
sAutoOpenPreviewHandles[id] = previewp->getHandle();
}
}

View File

@ -15,7 +15,7 @@
#include "lluuid.h"
#include "llviewerinventory.h"
#include "lltabcontainer.h"
#include "lllineeditor.h"
#include <map>
class LLLineEditor;
class LLRadioGroup;
@ -28,6 +28,13 @@ public:
/*virtual*/void open(); /*Flawfinder: ignore*/
/*virtual*/void tabOpen(LLFloater* opened_floater, bool from_click);
static LLMultiPreview* getAutoOpenInstance(const LLUUID& id);
static void setAutoOpenInstance(LLMultiPreview* previewp, const LLUUID& id);
protected:
typedef std::map<LLUUID, LLViewHandle> handle_map_t;
static std::map<LLUUID, LLViewHandle> sAutoOpenPreviewHandles;
};
class LLPreview : public LLFloater

View File

@ -16,6 +16,7 @@
#include "audioengine.h"
#include "llviewermessage.h" // send_guid_sound_trigger
#include "llagent.h" // gAgent
#include "lllineeditor.h"
#include "llvieweruictrlfactory.h"
extern LLAudioEngine* gAudiop;

View File

@ -23,6 +23,7 @@
#include "llimagetga.h"
#include "llfilepicker.h"
#include "llvieweruictrlfactory.h"
#include "lllineeditor.h"
const S32 PREVIEW_TEXTURE_MIN_WIDTH = 300;
const S32 PREVIEW_TEXTURE_MIN_HEIGHT = 120;

File diff suppressed because it is too large Load Diff

View File

@ -91,11 +91,12 @@ typedef enum e_selection_type
SELECT_TYPE_HUD
}ESelectType;
class LLSelectNodeList : public std::list<LLSelectNode*>
class LLObjectSelection : public std::list<LLSelectNode*>, public LLRefCount
{
friend class LLSelectMgr;
public:
LLSelectNodeList();
virtual ~LLSelectNodeList();
LLObjectSelection();
virtual ~LLObjectSelection();
void updateEffects();
@ -110,6 +111,8 @@ public:
LLSelectNode *getFirstRootNode();
LLSelectNode *getNextRootNode();
LLSelectNode* getFirstMoveableNode(BOOL get_root = FALSE);
// iterate through objects
LLViewerObject* getFirstObject();
LLViewerObject* getNextObject();
@ -118,6 +121,11 @@ public:
LLViewerObject *getFirstRootObject();
LLViewerObject *getNextRootObject();
LLViewerObject* getFirstEditableObject(BOOL get_root = FALSE);
LLViewerObject* getFirstCopyableObject(BOOL get_root = FALSE);
LLViewerObject* getFirstDeleteableObject(BOOL get_root = FALSE);
LLViewerObject* getFirstMoveableObject(BOOL get_root = FALSE);
// iterate through texture entries
void getPrimaryTE(LLViewerObject* *object, S32 *te);
void getFirstTE(LLViewerObject* *object, S32 *te);
@ -130,24 +138,36 @@ public:
void deleteAllNodes(); // Delete all nodes
S32 getNumNodes();
LLSelectNode* findNode(LLViewerObject* objectp);
// count members
S32 getObjectCount();
S32 getTECount();
S32 getRootObjectCount();
BOOL contains(LLViewerObject* object);
BOOL contains(LLViewerObject* object, S32 te);
// returns TRUE is any node is currenly worn as an attachment
BOOL isAttachment();
// Apply functors to various subsets of the selected objects
// Returns the AND of all apply() calls.
bool applyToRootObjects(LLSelectedObjectFunctor* func);
bool applyToObjects(LLSelectedObjectFunctor* func);
bool applyToNodes(LLSelectedNodeFunctor* func);
ESelectType getSelectType() { return mSelectType; }
private:
const LLSelectNodeList &operator=(const LLSelectNodeList &);
const LLObjectSelection &operator=(const LLObjectSelection &);
std::list<LLSelectNode*>::iterator mCurrentNode;
S32 mCurrentTE;
std::map<LLViewerObject*, LLSelectNode*> mSelectNodeMap;
std::list<LLSelectNode*>::iterator mCurrentNode;
S32 mCurrentTE;
std::map<LLViewerObject*, LLSelectNode*> mSelectNodeMap;
ESelectType mSelectType;
};
struct LLSelectAction
{
public:
EActionType mActionType;
LLVector3 mPosition;
LLVector3 mScale;
LLQuaternion mRotation;
LLUUID mObjectID;
BOOL mIndividualSelection;
};
typedef LLHandle<LLObjectSelection> LLObjectSelectionHandle;
class LLSelectMgr : public LLEditMenuHandler
{
@ -168,6 +188,7 @@ public:
static LLColor4 sHighlightChildColor;
static LLColor4 sHighlightInspectColor;
static LLColor4 sContextSilhouetteColor;
public:
LLSelectMgr();
~LLSelectMgr();
@ -188,115 +209,90 @@ public:
virtual void duplicate();
virtual BOOL canDuplicate();
// Apply functors to various subsets of the selected objects
// Returns the AND of all apply() calls.
bool applyToRootObjects(LLSelectedObjectFunctor* func);
bool applyToObjects(LLSelectedObjectFunctor* func);
bool applyToNodes(LLSelectedNodeFunctor* func);
void updateEffects(); // Update HUD effects
void setForceSelection(BOOL force) { mForceSelection = force; }
////////////////////////////////////////////////////////////////
// Selection methods
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
// Add
////////////////////////////////////////////////////////////////
// For when you want just a child object.
void selectObjectOnly(LLViewerObject* object, S32 face = SELECT_ALL_TES);
LLObjectSelectionHandle selectObjectOnly(LLViewerObject* object, S32 face = SELECT_ALL_TES);
// This method is meant to select an object, and then select all
// of the ancestors and descendents. This should be the normal behavior.
void selectObjectAndFamily(LLViewerObject* object, BOOL add_to_end = FALSE);
LLObjectSelectionHandle selectObjectAndFamily(LLViewerObject* object, BOOL add_to_end = FALSE);
// Same as above, but takes a list of objects. Used by rectangle select.
void selectObjectAndFamily(const LLDynamicArray<LLViewerObject*>& object_list, BOOL send_to_sim = TRUE);
LLObjectSelectionHandle selectObjectAndFamily(const LLDynamicArray<LLViewerObject*>& object_list, BOOL send_to_sim = TRUE);
void deselectObjectOnly(LLViewerObject* object, BOOL send_to_sim = TRUE);
// converts all objects currently highlighted to a selection, and returns it
LLObjectSelectionHandle selectHighlightedObjects();
void deselectObjectAndFamily(LLViewerObject* object, BOOL send_to_sim = TRUE);
void deselectTransient(); // deselect "temporarily" selected objects (via pie menu)
void convertTransient(); // converts temporarily selected objects to full-fledged selections
// Send deselect messages to simulator, then clear the list
void deselectAll();
// Deselect if the selection center is too far away from the agent.
void deselectAllIfTooFar();
BOOL selectionRemoveObject(const LLUUID &id);
BOOL contains(LLViewerObject* object);
BOOL contains(LLViewerObject* object, S32 te);
ESelectType getSelectType() { return mSelectType; }
// count members
S32 getObjectCount();
S32 getTECount();
S32 getRootObjectCount();
BOOL isEmpty() { return !mSelectedObjects.getNumNodes(); }
BOOL shouldShowSelection() { return mShowSelection; }
LLSelectNodeList &getHoverObjects() { return mHoverObjects; }
LLSelectNodeList &getSelectedObjects() { return mSelectedObjects; }
// iterate through objects
LLViewerObject* getFirstObject() { return mSelectedObjects.getFirstObject(); }
LLViewerObject* getNextObject() { return mSelectedObjects.getNextObject(); }
// iterate through root objects
LLViewerObject *getFirstRootObject() { return mSelectedObjects.getFirstRootObject(); }
LLViewerObject *getNextRootObject() { return mSelectedObjects.getNextRootObject(); }
LLViewerObject* getFirstHighlightedObject() { return mHighlightedObjects.getFirstObject(); }
LLViewerObject* getNextHighlightedObject() { return mHighlightedObjects.getNextObject(); }
// iterate through tes
void getPrimaryTE(LLViewerObject* *object, S32 *te) { mSelectedObjects.getPrimaryTE(object, te); }
void getFirstTE(LLViewerObject* *object, S32 *te) { mSelectedObjects.getFirstTE(object, te); }
void getNextTE(LLViewerObject* *object, S32 *te) { mSelectedObjects.getNextTE(object, te); };
void setHoverObject(LLViewerObject *objectp);
void addGridObject(LLViewerObject* objectp);
void clearGridObjects();
void setGridMode(EGridMode mode);
EGridMode getGridMode() { return mGridMode; }
void getGrid(LLVector3& origin, LLQuaternion& rotation, LLVector3 &scale);
LLObjectSelectionHandle setHoverObject(LLViewerObject *objectp);
void highlightObjectOnly(LLViewerObject *objectp);
void highlightObjectAndFamily(LLViewerObject *objectp);
void highlightObjectAndFamily(const LLDynamicArray<LLViewerObject*>& list);
////////////////////////////////////////////////////////////////
// Remove
////////////////////////////////////////////////////////////////
void deselectObjectOnly(LLViewerObject* object, BOOL send_to_sim = TRUE);
void deselectObjectAndFamily(LLViewerObject* object, BOOL send_to_sim = TRUE);
// Send deselect messages to simulator, then clear the list
void deselectAll();
// deselect only if nothing else currently referencing the selection
void deselectUnused();
// Deselect if the selection center is too far away from the agent.
void deselectAllIfTooFar();
// Removes all highlighted objects from current selection
void deselectHighlightedObjects();
void unhighlightObjectOnly(LLViewerObject *objectp);
void unhighlightObjectAndFamily(LLViewerObject *objectp);
void unhighlightAll();
void selectHighlightedObjects();
void deselectHighlightedObjects();
LLSelectNode *findSelectNode(LLViewerObject *objectp);
LLSelectNode *getFirstRootNode() { return mSelectedObjects.getFirstRootNode(); }
LLSelectNode *getNextRootNode() { return mSelectedObjects.getNextRootNode(); }
LLSelectNode* getFirstNode() { return mSelectedObjects.getFirstNode(); }
LLSelectNode* getNextNode() { return mSelectedObjects.getNextNode(); }
BOOL removeObjectFromSelections(const LLUUID &id);
////////////////////////////////////////////////////////////////
// Selection accessors
////////////////////////////////////////////////////////////////
LLObjectSelectionHandle getHoverObjects() { return mHoverObjects; }
LLObjectSelectionHandle getSelection() { return mSelectedObjects; }
// right now this just renders the selection with root/child colors instead of a single color
LLObjectSelectionHandle getEditSelection() { convertTransient(); return mSelectedObjects; }
LLObjectSelectionHandle getHighlightedObjects() { return mHighlightedObjects; }
LLSelectNode *getHoverNode();
////////////////////////////////////////////////////////////////
// Grid manipulation
////////////////////////////////////////////////////////////////
void addGridObject(LLViewerObject* objectp);
void clearGridObjects();
void setGridMode(EGridMode mode);
EGridMode getGridMode() { return mGridMode; }
void getGrid(LLVector3& origin, LLQuaternion& rotation, LLVector3 &scale);
BOOL getTEMode() { return mTEMode; }
void setTEMode(BOOL b) { mTEMode = b; }
LLViewerObject* getFirstCopyableObject(BOOL get_root = FALSE);
LLViewerObject* getFirstEditableObject(BOOL get_root = FALSE);
LLViewerObject* getFirstMoveableObject(BOOL get_root = FALSE);
LLViewerObject* getFirstDeleteableObject(BOOL get_root = FALSE);
LLSelectNode* getFirstEditableNode(BOOL get_root = FALSE);
LLSelectNode* getFirstMoveableNode(BOOL get_root = FALSE);
BOOL shouldShowSelection() { return mShowSelection; }
LLBBox getBBoxOfSelection() const;
LLBBox getSavedBBoxOfSelection() const { return mSavedSelectionBBox; }
BOOL areMultpleEditableObjectsSelected();
void dump();
void cleanup();
@ -304,17 +300,18 @@ public:
void renderSilhouettes(BOOL for_hud);
void enableSilhouette(BOOL enable) { mRenderSilhouettes = enable; }
// Utility functions to operate on the list
////////////////////////////////////////////////////////////////
// Utility functions that operate on the current selection
////////////////////////////////////////////////////////////////
void saveSelectedObjectTransform(EActionType action_type);
void saveSelectedObjectColors();
void saveSelectedObjectTextures();
void saveSelectedObjectTransform(EActionType action_type);
void saveSelectedObjectColors();
void saveSelectedObjectTextures();
void selectionUpdatePhysics(BOOL use_physics);
void selectionUpdateTemporary(BOOL is_temporary);
void selectionUpdatePhantom(BOOL is_ghost);
void selectionUpdateCastShadows(BOOL cast_shadows);
void selectionDump();
void selectionUpdatePhysics(BOOL use_physics);
void selectionUpdateTemporary(BOOL is_temporary);
void selectionUpdatePhantom(BOOL is_ghost);
void selectionUpdateCastShadows(BOOL cast_shadows);
void selectionDump();
BOOL selectionAllPCode(LLPCode code); // all objects have this PCode
BOOL selectionGetMaterial(U8 *material); // all objects have same material
@ -343,11 +340,11 @@ public:
void selectionSetMediaTypeAndURL( U8 media_type, const std::string& media_url );
void selectionSetClickAction(U8 action);
void setObjectPermissions(U8 perm_field, BOOL set, U32 perm_mask, BOOL override = FALSE);
void setObjectName(const LLString& name);
void setObjectDescription(const LLString& desc);
void setObjectCategory(const LLCategory& category);
void setObjectSaleInfo(const LLSaleInfo& sale_info);
void selectionSetObjectPermissions(U8 perm_field, BOOL set, U32 perm_mask, BOOL override = FALSE);
void selectionSetObjectName(const LLString& name);
void selectionSetObjectDescription(const LLString& desc);
void selectionSetObjectCategory(const LLCategory& category);
void selectionSetObjectSaleInfo(const LLSaleInfo& sale_info);
void selectionTexScaleAutofit(F32 repeats_per_meter);
void selectionResetTexInfo(S32 te); // sets S,T to 1
@ -414,23 +411,20 @@ public:
// with the aggregate permissions for texture inventory items of the selection.
BOOL selectGetAggregateTexturePermissions(LLAggregatePermissions& ag_perm);
// returns TRUE is any node is currenly worn as an attachment
BOOL selectionIsAttachment();
LLPermissions* findObjectPermissions(const LLViewerObject* object);
void selectDelete(); // Delete on simulator
void selectForceDelete(); // just delete, no into trash
void selectForceDelete(); // just delete, no into trash
void selectDuplicate(const LLVector3& offset, BOOL select_copy); // Duplicate on simulator
void repeatDuplicate();
void selectDuplicateOnRay(const LLVector3 &ray_start_region,
const LLVector3 &ray_end_region,
BOOL bypass_raycast,
BOOL ray_end_is_intersection,
const LLUUID &ray_target_id,
BOOL copy_centers,
BOOL copy_rotates,
BOOL select_copy);
void selectDuplicateOnRay(const LLVector3 &ray_start_region,
const LLVector3 &ray_end_region,
BOOL bypass_raycast,
BOOL ray_end_is_intersection,
const LLUUID &ray_target_id,
BOOL copy_centers,
BOOL copy_rotates,
BOOL select_copy);
void sendMultipleUpdate(U32 type); // Position, rotation, scale all in one
void sendOwner(const LLUUID& owner_id, const LLUUID& group_id, BOOL override = FALSE);
@ -471,7 +465,7 @@ public:
void demoteSelectionToIndividuals();
private:
void convertTransient(); // converts temporarily selected objects to full-fledged selections
ESelectType getSelectTypeForObject(LLViewerObject* object);
void addAsFamily(LLDynamicArray<LLViewerObject*>& objects, BOOL add_to_end = FALSE);
void generateSilhouette(LLSelectNode *nodep, const LLVector3& view_point);
@ -482,7 +476,6 @@ private:
void (*pack_body)(LLSelectNode* node, void *user_data),
void *user_data,
ESendType send_type);
U32 undoRedo(std::deque<LLSelectAction*> &queue_src, std::deque<LLSelectAction*> &queue_dst, const LLUUID &object_id);
static void packAgentID( void *);
static void packAgentAndSessionID(void* user_data);
@ -517,22 +510,19 @@ private:
static void confirmDelete(S32 option, void* data);
private:
LLPointer<LLViewerImage> mSilhouetteImagep;
LLSelectNodeList mSelectedObjects;
LLSelectNodeList mHoverObjects;
LLPointer<LLViewerImage> mSilhouetteImagep;
LLObjectSelectionHandle mSelectedObjects;
LLObjectSelectionHandle mHoverObjects;
LLObjectSelectionHandle mHighlightedObjects;
std::set<LLPointer<LLViewerObject> > mRectSelectedObjects;
LLSelectNodeList mGridObjects;
LLObjectSelection mGridObjects;
LLQuaternion mGridRotation;
LLVector3 mGridOrigin;
LLVector3 mGridScale;
EGridMode mGridMode;
BOOL mGridValid;
LLSelectNodeList mHighlightedObjects;
BOOL mTEMode; // render te
LLVector3d mSelectionCenterGlobal;
@ -544,15 +534,10 @@ private:
BOOL mRenderSilhouettes; // do we render the silhouette
LLBBox mSavedSelectionBBox;
ESelectType mSelectType;
LLFrameTimer mEffectsTimer;
BOOL mForceSelection;
std::deque<LLSelectAction*> mUndoQueue;
std::deque<LLSelectAction*> mRedoQueue;
LLAnimPauseRequest mPauseRequest;
LLAnimPauseRequest mPauseRequest;
};

View File

@ -296,7 +296,7 @@ void LLFloaterTexturePicker::setCanApplyImmediately(BOOL b)
void LLFloaterTexturePicker::stopUsingPipette()
{
if (gToolMgr && gToolMgr->getCurrentTool(gKeyboard->currentMask(TRUE)) == gToolPipette)
if (gToolMgr && gToolMgr->getCurrentTool() == gToolPipette)
{
gToolMgr->clearTransientTool();
}
@ -451,7 +451,7 @@ void LLFloaterTexturePicker::draw()
childSetEnabled("show_folders_check", mActive && mCanApplyImmediately && !mNoCopyTextureSelected);
childSetEnabled("Select", mActive);
childSetEnabled("Pipette", gToolMgr != NULL && mActive);
childSetValue("Pipette", gToolMgr && gToolMgr->getCurrentTool(gKeyboard->currentMask(TRUE)) == gToolPipette);
childSetValue("Pipette", gToolMgr && gToolMgr->getCurrentTool() == gToolPipette);
//RN: reset search bar to reflect actual search query (all caps, for example)
mSearchEdit->setText(mInventoryPanel->getFilterSubString());

View File

@ -131,7 +131,8 @@ void LLTextureView::draw()
{
S32 te;
LLViewerObject *objectp;
for (gSelectMgr->getFirstTE(&objectp, &te); objectp; gSelectMgr->getNextTE(&objectp, &te))
LLObjectSelectionHandle selection = gSelectMgr->getSelection();
for (selection->getFirstTE(&objectp, &te); objectp; selection->getNextTE(&objectp, &te))
{
if (imagep == objectp->getTEImage(te))
{

View File

@ -16,6 +16,7 @@
#include "llviewerwindow.h"
#include "lltoolcomp.h"
#include "lltoolfocus.h"
#include "llfocusmgr.h"
#include "llagent.h"
#include "llviewborder.h"
@ -135,6 +136,14 @@ BOOL LLTool::handleKey(KEY key, MASK mask)
return FALSE;
}
LLTool* LLTool::getOverrideTool(MASK mask)
{
if (mask & MASK_ALT)
{
return gToolCamera;
}
return NULL;
}
// static
void LLTool::onMouseCaptureLost( LLMouseHandler* old_captor )

View File

@ -58,6 +58,8 @@ public:
virtual void handleSelect() { } // do stuff when your tool is selected
virtual void handleDeselect() { } // clean up when your tool is deselected
virtual LLTool* getOverrideTool(MASK mask);
// isAlwaysRendered() - return true if this is a tool that should
// always be rendered regardless of selection.
virtual BOOL isAlwaysRendered() { return FALSE; }

View File

@ -163,7 +163,7 @@ void LLToolBrushLand::modifyLandInSelectionGlobal()
return;
}
if (gToolMgr->getCurrentTool(gKeyboard->currentMask(TRUE)) == gToolParcel)
if (gToolMgr->getCurrentTool() == gToolParcel)
{
// selecting land, don't do anything
return;
@ -282,8 +282,8 @@ void LLToolBrushLand::modifyLandInSelectionGlobal()
msg->addF32Fast(_PREHASH_Seconds, seconds);
msg->addF32Fast(_PREHASH_Height, mStartingZ);
BOOL parcel_selected = gParcelMgr->getWholeParcelSelected();
LLParcel* selected_parcel = gParcelMgr->getSelectedParcel();
BOOL parcel_selected = gParcelMgr->getParcelSelection()->getWholeParcelSelected();
LLParcel* selected_parcel = gParcelMgr->getParcelSelection()->getParcel();
if (parcel_selected && selected_parcel)
{
@ -516,7 +516,7 @@ void LLToolBrushLand::onIdle( void* brush_tool )
{
LLToolBrushLand* self = reinterpret_cast<LLToolBrushLand*>(brush_tool);
if( gToolMgr->getCurrentTool( gKeyboard->currentMask(TRUE) ) == self )
if( gToolMgr->getCurrentTool() == self )
{
self->brush();
}

View File

@ -148,7 +148,7 @@ void LLToolCompInspect::pickCallback(S32 x, S32 y, MASK mask)
if( hit_obj )
{
if (gSelectMgr->getObjectCount())
if (gSelectMgr->getSelection()->getObjectCount())
{
gEditMenuHandler = gSelectMgr;
}
@ -222,7 +222,7 @@ void LLToolCompTranslate::pickCallback(S32 x, S32 y, MASK mask)
if( hit_obj || gToolTranslate->mManip->getHighlightedPart() != LLManip::LL_NO_PART )
{
if (gSelectMgr->getObjectCount())
if (gToolTranslate->mManip->getSelection()->getObjectCount())
{
gEditMenuHandler = gSelectMgr;
}
@ -253,9 +253,22 @@ BOOL LLToolCompTranslate::handleMouseUp(S32 x, S32 y, MASK mask)
return LLToolComposite::handleMouseUp(x, y, mask);
}
LLTool* LLToolCompTranslate::getOverrideTool(MASK mask)
{
if (mask == MASK_CONTROL)
{
return gToolRotate;
}
else if (mask == (MASK_CONTROL | MASK_SHIFT))
{
return gToolStretch;
}
return LLToolComposite::getOverrideTool(mask);
}
BOOL LLToolCompTranslate::handleDoubleClick(S32 x, S32 y, MASK mask)
{
if (!gSelectMgr->isEmpty() && mManip->getHighlightedPart() == LLManip::LL_NO_PART)
if (mManip->getSelection()->isEmpty() && mManip->getHighlightedPart() == LLManip::LL_NO_PART)
{
// You should already have an object selected from the mousedown.
// If so, show its properties
@ -331,7 +344,7 @@ void LLToolCompScale::pickCallback(S32 x, S32 y, MASK mask)
if( hit_obj || gToolStretch->mManip->getHighlightedPart() != LLManip::LL_NO_PART)
{
if (gSelectMgr->getObjectCount())
if (gToolStretch->mManip->getSelection()->getObjectCount())
{
gEditMenuHandler = gSelectMgr;
}
@ -359,9 +372,20 @@ BOOL LLToolCompScale::handleMouseUp(S32 x, S32 y, MASK mask)
return LLToolComposite::handleMouseUp(x, y, mask);
}
LLTool* LLToolCompScale::getOverrideTool(MASK mask)
{
if (mask == MASK_CONTROL)
{
return gToolRotate;
}
return LLToolComposite::getOverrideTool(mask);
}
BOOL LLToolCompScale::handleDoubleClick(S32 x, S32 y, MASK mask)
{
if (!gSelectMgr->isEmpty() && mManip->getHighlightedPart() == LLManip::LL_NO_PART)
if (!mManip->getSelection()->isEmpty() && mManip->getHighlightedPart() == LLManip::LL_NO_PART)
{
// You should already have an object selected from the mousedown.
// If so, show its properties
@ -515,7 +539,7 @@ void LLToolCompRotate::pickCallback(S32 x, S32 y, MASK mask)
if( hit_obj || gToolRotate->mManip->getHighlightedPart() != LLManip::LL_NO_PART)
{
if (gSelectMgr->getObjectCount())
if (gToolRotate->mManip->getSelection()->getObjectCount())
{
gEditMenuHandler = gSelectMgr;
}
@ -543,10 +567,18 @@ BOOL LLToolCompRotate::handleMouseUp(S32 x, S32 y, MASK mask)
return LLToolComposite::handleMouseUp(x, y, mask);
}
LLTool* LLToolCompRotate::getOverrideTool(MASK mask)
{
if (mask == (MASK_CONTROL | MASK_SHIFT))
{
return gToolStretch;
}
return LLToolComposite::getOverrideTool(mask);
}
BOOL LLToolCompRotate::handleDoubleClick(S32 x, S32 y, MASK mask)
{
if (!gSelectMgr->isEmpty() && mManip->getHighlightedPart() == LLManip::LL_NO_PART)
if (!mManip->getSelection()->isEmpty() && mManip->getHighlightedPart() == LLManip::LL_NO_PART)
{
// You should already have an object selected from the mousedown.
// If so, show its properties
@ -649,7 +681,7 @@ BOOL LLToolCompGun::handleMouseDown(S32 x, S32 y, MASK mask)
// On mousedown, start grabbing
gGrabTransientTool = this;
gCurrentToolset->selectTool( (LLTool*) mGrab );
gToolMgr->getCurrentToolset()->selectTool( (LLTool*) mGrab );
return gToolGrab->handleMouseDown(x, y, mask);
}
@ -666,7 +698,7 @@ BOOL LLToolCompGun::handleDoubleClick(S32 x, S32 y, MASK mask)
// On mousedown, start grabbing
gGrabTransientTool = this;
gCurrentToolset->selectTool( (LLTool*) mGrab );
gToolMgr->getCurrentToolset()->selectTool( (LLTool*) mGrab );
return gToolGrab->handleDoubleClick(x, y, mask);
}

View File

@ -110,6 +110,8 @@ public:
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); // Returns to the default tool
virtual void render();
virtual LLTool* getOverrideTool(MASK mask);
static void pickCallback(S32 x, S32 y, MASK mask);
};
@ -129,8 +131,9 @@ public:
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); // Returns to the default tool
virtual void render();
virtual LLTool* getOverrideTool(MASK mask);
static void pickCallback(S32 x, S32 y, MASK mask);
};
@ -150,6 +153,8 @@ public:
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
virtual void render();
virtual LLTool* getOverrideTool(MASK mask);
static void pickCallback(S32 x, S32 y, MASK mask);
protected:

View File

@ -42,7 +42,7 @@ LLToolFace::~LLToolFace()
BOOL LLToolFace::handleDoubleClick(S32 x, S32 y, MASK mask)
{
if (!gSelectMgr->isEmpty())
if (!gSelectMgr->getSelection()->isEmpty())
{
// You should already have an object selected from the mousedown.
// If so, show its properties
@ -90,7 +90,7 @@ void LLToolFace::pickCallback(S32 x, S32 y, MASK mask)
// object wasn't selected so add the object and face
gSelectMgr->selectObjectOnly(hit_obj, hit_face);
}
else if (!gSelectMgr->contains(hit_obj, hit_face) )
else if (!gSelectMgr->getSelection()->contains(hit_obj, hit_face) )
{
// object is selected, but not this face, so add it.
gSelectMgr->addAsIndividual(hit_obj, hit_face);

View File

@ -43,9 +43,6 @@ BOOL gCameraBtnPan = FALSE;
const S32 SLOP_RANGE = 4;
const F32 FOCUS_OFFSET_FACTOR = 1.f;
extern void handle_first_tool(void*);
//
// Camera - shared functionality
//
@ -136,7 +133,8 @@ void LLToolCamera::pickCallback(S32 x, S32 y, MASK mask)
// check for hud attachments
if (hit_obj && hit_obj->isHUDAttachment())
{
if (!gSelectMgr->getObjectCount() || gSelectMgr->getSelectType() != SELECT_TYPE_HUD)
LLObjectSelectionHandle selection = gSelectMgr->getSelection();
if (!selection->getObjectCount() || selection->getSelectType() != SELECT_TYPE_HUD)
{
gToolCamera->mValidClickPoint = FALSE;
return;
@ -175,7 +173,7 @@ void LLToolCamera::pickCallback(S32 x, S32 y, MASK mask)
}
//RN: check to see if this is mouse-driving as opposed to ALT-zoom or Focus tool
else if (mask & MASK_ALT ||
(gToolMgr->getCurrentTool(mask)->getName() == "Camera"))
(gToolMgr->getCurrentTool()->getName() == "Camera"))
{
LLViewerObject* hit_obj = gViewerWindow->lastObjectHit();
if (hit_obj)

View File

@ -27,6 +27,8 @@ public:
virtual void handleSelect();
virtual void handleDeselect();
virtual LLTool* getOverrideTool(MASK mask) { return NULL; }
static void pickCallback(S32 x, S32 y, MASK mask);
BOOL mouseSteerMode() { return mMouseSteering; }

View File

@ -126,7 +126,7 @@ void LLToolGrab::pickCallback(S32 x, S32 y, MASK mask)
BOOL extend_select = (mask & MASK_SHIFT);
if (!extend_select && !gSelectMgr->isEmpty())
if (!extend_select && !gSelectMgr->getSelection()->isEmpty())
{
gSelectMgr->deselectAll();
gToolGrab->mDeselectedThisClick = TRUE;

View File

@ -34,7 +34,7 @@ public:
virtual void handleSelect();
virtual void handleDeselect();
virtual LLViewerObject* getEditingObject();
virtual LLVector3d getEditingPointGlobal();
virtual BOOL isEditing();

View File

@ -48,7 +48,7 @@ void LLToolGun::handleDeselect()
BOOL LLToolGun::handleMouseDown(S32 x, S32 y, MASK mask)
{
gGrabTransientTool = this;
gCurrentToolset->selectTool( gToolGrab );
gToolMgr->getCurrentToolset()->selectTool( gToolGrab );
return gToolGrab->handleMouseDown(x, y, mask);
}

View File

@ -26,6 +26,7 @@ public:
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleHover(S32 x, S32 y, MASK mask);
virtual LLTool* getOverrideTool(MASK mask) { return NULL; }
virtual BOOL clipMouseWhenDown() { return FALSE; }
private:

View File

@ -66,7 +66,7 @@ void LLToolIndividual::pickCallback(S32 x, S32 y, MASK mask)
BOOL LLToolIndividual::handleDoubleClick(S32 x, S32 y, MASK mask)
{
if(!gSelectMgr->isEmpty())
if(!gSelectMgr->getSelection()->isEmpty())
{
// You should already have an object selected from the mousedown.
// If so, show its inventory.
@ -85,10 +85,10 @@ BOOL LLToolIndividual::handleDoubleClick(S32 x, S32 y, MASK mask)
void LLToolIndividual::handleSelect()
{
LLViewerObject* obj = gSelectMgr->getFirstRootObject();
LLViewerObject* obj = gSelectMgr->getSelection()->getFirstRootObject();
if(!obj)
{
obj = gSelectMgr->getFirstObject();
obj = gSelectMgr->getSelection()->getFirstObject();
}
gSelectMgr->deselectAll();
if(obj)

View File

@ -34,7 +34,6 @@ LLToolMgr* gToolMgr = NULL;
// Used when app not active to avoid processing hover.
LLTool* gToolNull = NULL;
LLToolset* gCurrentToolset = NULL;
LLToolset* gBasicToolset = NULL;
LLToolset* gCameraToolset = NULL;
//LLToolset* gLandToolset = NULL;
@ -46,10 +45,12 @@ LLToolset* gFaceEditToolset = NULL;
LLToolMgr::LLToolMgr()
:
mCurrentTool(NULL),
mBaseTool(NULL),
mSavedTool(NULL),
mTransientTool( NULL ),
mOverrideTool( NULL )
mOverrideTool( NULL ),
mSelectedTool( NULL ),
mCurrentToolset( NULL )
{
gToolNull = new LLTool(NULL); // Does nothing
setCurrentTool(gToolNull);
@ -59,8 +60,6 @@ LLToolMgr::LLToolMgr()
// gLandToolset = new LLToolset();
gMouselookToolset = new LLToolset();
gFaceEditToolset = new LLToolset();
gCurrentToolset = gBasicToolset;
}
void LLToolMgr::initTools()
@ -178,8 +177,8 @@ void LLToolMgr::initTools()
gToolObjPicker = new LLToolObjPicker();
// On startup, use "select" tool
setCurrentToolset(gBasicToolset);
gBasicToolset->selectTool( gToolPie );
useSelectedTool( gBasicToolset );
}
LLToolMgr::~LLToolMgr()
@ -248,138 +247,103 @@ LLToolMgr::~LLToolMgr()
gToolNull = NULL;
}
void LLToolMgr::useSelectedTool( LLToolset* vp )
{
setCurrentTool( vp->getSelectedTool() );
}
BOOL LLToolMgr::usingTransientTool()
{
return mTransientTool ? TRUE : FALSE;
}
void LLToolMgr::setCurrentTool( LLTool* tool )
void LLToolMgr::setCurrentToolset(LLToolset* current)
{
if (tool == mCurrentTool)
{
// didn't change tool, so don't mess with
// handleSelect or handleDeselect
return;
}
if (!current) return;
if (mTransientTool)
// switching toolsets?
if (current != mCurrentToolset)
{
mTransientTool->handleDeselect();
mTransientTool = NULL;
}
else if( mCurrentTool )
{
mCurrentTool->handleDeselect();
}
mCurrentTool = tool;
if (mCurrentTool)
{
mCurrentTool->handleSelect();
// deselect current tool
if (mSelectedTool)
{
mSelectedTool->handleDeselect();
}
mCurrentToolset = current;
// select first tool of new toolset only if toolset changed
mCurrentToolset->selectFirstTool();
}
// update current tool based on new toolset
setCurrentTool( mCurrentToolset->getSelectedTool() );
}
LLTool* LLToolMgr::getCurrentTool(MASK override_mask)
LLToolset* LLToolMgr::getCurrentToolset()
{
// In mid-drag, always keep the current tool
if (gToolTranslate->hasMouseCapture()
|| gToolRotate->hasMouseCapture()
|| gToolStretch->hasMouseCapture())
return mCurrentToolset;
}
void LLToolMgr::setCurrentTool( LLTool* tool )
{
if (mTransientTool)
{
// might have gotten here by overriding another tool
if (mOverrideTool)
{
return mOverrideTool;
}
else
{
return mCurrentTool;
}
mTransientTool = NULL;
}
mBaseTool = tool;
updateToolStatus();
}
LLTool* LLToolMgr::getCurrentTool()
{
MASK override_mask = gKeyboard->currentMask(TRUE);
LLTool* cur_tool = NULL;
// always use transient tools if available
if (mTransientTool)
{
mOverrideTool = NULL;
return mTransientTool;
cur_tool = mTransientTool;
}
if (mCurrentTool == gToolGun)
// tools currently grabbing mouse input will stay active
else if (mSelectedTool && mSelectedTool->hasMouseCapture())
{
mOverrideTool = NULL;
return mCurrentTool;
}
// ALT always gets you the camera tool
if (override_mask & MASK_ALT)
{
mOverrideTool = gToolCamera;
return mOverrideTool;
}
if (mCurrentTool == gToolCamera)
{
// ...can't switch out of camera
mOverrideTool = NULL;
return mCurrentTool;
}
else if (mCurrentTool == gToolGrab)
{
// ...can't switch out of grab
mOverrideTool = NULL;
return mCurrentTool;
}
else if (mCurrentTool == gToolInspect)
{
// ...can't switch out of grab
mOverrideTool = NULL;
return mCurrentTool;
cur_tool = mSelectedTool;
}
else
{
// ...can switch between editing tools
if (override_mask == MASK_CONTROL)
{
// Control lifts when in the pie tool, otherwise switches to rotate
if (mCurrentTool == gToolPie)
{
mOverrideTool = gToolGrab;
}
else
{
mOverrideTool = gToolRotate;
}
return mOverrideTool;
}
else if (override_mask == (MASK_CONTROL | MASK_SHIFT))
{
// Shift-Control spins when in the pie tool, otherwise switches to scale
if (mCurrentTool == gToolPie)
{
mOverrideTool = gToolGrab;
}
else
{
mOverrideTool = gToolStretch;
}
return mOverrideTool;
}
else
{
mOverrideTool = NULL;
return mCurrentTool;
}
mOverrideTool = mBaseTool ? mBaseTool->getOverrideTool(override_mask) : NULL;
// use override tool if available otherwise drop back to base tool
cur_tool = mOverrideTool ? mOverrideTool : mBaseTool;
}
//update tool selection status
if (mSelectedTool != cur_tool)
{
if (mSelectedTool)
{
mSelectedTool->handleDeselect();
}
if (cur_tool)
{
cur_tool->handleSelect();
}
mSelectedTool = cur_tool;
}
return mSelectedTool;
}
LLTool* LLToolMgr::getBaseTool()
{
return mBaseTool;
}
void LLToolMgr::updateToolStatus()
{
// call getcurrenttool() to calculate active tool and call handleSelect() and handleDeselect() immediately
// when active tool changes
getCurrentTool();
}
BOOL LLToolMgr::inEdit()
{
return mCurrentTool != gToolPie && mCurrentTool != gToolNull;
return mBaseTool != gToolPie && mBaseTool != gToolNull;
}
void LLToolMgr::setTransientTool(LLTool* tool)
@ -392,34 +356,26 @@ void LLToolMgr::setTransientTool(LLTool* tool)
{
if (mTransientTool)
{
mTransientTool->handleDeselect();
mTransientTool = NULL;
}
else if (mCurrentTool)
{
mCurrentTool->handleDeselect();
}
mTransientTool = tool;
mTransientTool->handleSelect();
}
updateToolStatus();
}
void LLToolMgr::clearTransientTool()
{
if (mTransientTool)
{
mTransientTool->handleDeselect();
mTransientTool = NULL;
if (mCurrentTool)
if (!mBaseTool)
{
mCurrentTool->handleSelect();
}
else
{
llwarns << "mCurrentTool is NULL" << llendl;
llwarns << "mBaseTool is NULL" << llendl;
}
}
updateToolStatus();
}
@ -428,26 +384,19 @@ void LLToolMgr::clearTransientTool()
// release this locking.
void LLToolMgr::onAppFocusLost()
{
if (mCurrentTool
&& mCurrentTool == gToolGun)
{
mCurrentTool->handleDeselect();
}
mSavedTool = mCurrentTool;
mCurrentTool = gToolNull;
mSavedTool = mBaseTool;
mBaseTool = gToolNull;
updateToolStatus();
}
void LLToolMgr::onAppFocusGained()
{
if (mSavedTool)
{
if (mSavedTool == gToolGun)
{
mCurrentTool->handleSelect();
}
mCurrentTool = mSavedTool;
mBaseTool = mSavedTool;
mSavedTool = NULL;
}
updateToolStatus();
}
/////////////////////////////////////////////////////
@ -491,7 +440,10 @@ BOOL LLToolset::isToolSelected( S32 index )
void LLToolset::selectFirstTool()
{
mSelectedTool = mToolList.getFirstData();
gToolMgr->setCurrentTool( mSelectedTool );
if (gToolMgr)
{
gToolMgr->setCurrentTool( mSelectedTool );
}
}
@ -540,5 +492,5 @@ void LLToolset::selectPrevTool()
void select_tool( void *tool_pointer )
{
LLTool *tool = (LLTool *)tool_pointer;
gCurrentToolset->selectTool( tool );
gToolMgr->getCurrentToolset()->selectTool( tool );
}

View File

@ -32,27 +32,33 @@ public:
// Must be called after gSavedSettings set up.
void initTools();
LLTool* getCurrentTool(MASK override_mask);
LLTool* getCurrentTool(); // returns active tool, taking into account keyboard state
LLTool* getBaseTool(); // returns active tool when overrides are deactivated
BOOL inEdit();
void useSelectedTool( LLToolset* vp );
void setTransientTool(LLTool* tool);
void clearTransientTool();
BOOL usingTransientTool();
void setCurrentToolset(LLToolset* current);
LLToolset* getCurrentToolset();
void onAppFocusGained();
void onAppFocusLost();
protected:
friend class LLToolset; // to allow access to setCurrentTool();
void setCurrentTool(LLTool* tool);
void updateToolStatus();
protected:
LLTool* mCurrentTool;
LLTool* mBaseTool;
LLTool* mSavedTool; // The current tool at the time application focus was lost.
LLTool* mTransientTool;
LLTool* mOverrideTool; // Tool triggered by keyboard override
LLTool* mSelectedTool; // last known active tool
LLToolset* mCurrentToolset;
};
// Sets of tools for various modes
@ -87,7 +93,6 @@ void select_tool(void *tool);
// Globals (created and destroyed by LLViewerWindow)
extern LLToolMgr* gToolMgr;
extern LLToolset* gCurrentToolset;
extern LLToolset* gBasicToolset;
extern LLToolset *gCameraToolset;
//extern LLToolset *gLandToolset;

View File

@ -63,7 +63,7 @@ BOOL LLToolPie::handleMouseDown(S32 x, S32 y, MASK mask)
// if buttons swapped, don't pick transparent so users can't "pay"
// transparent objects
gViewerWindow->hitObjectOrLandGlobalAsync(x, y, mask, leftMouseCallback,
TRUE, TRUE);
FALSE, TRUE);
mGrabMouseButtonDown = TRUE;
return TRUE;
}
@ -194,7 +194,7 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
!always_show)
{
gGrabTransientTool = this;
gCurrentToolset->selectTool( gToolGrab );
gToolMgr->getCurrentToolset()->selectTool( gToolGrab );
return gToolGrab->handleObjectHit( object, x, y, mask);
}
@ -253,8 +253,8 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
// Spawn pie menu
if (mHitLand)
{
gParcelMgr->selectParcelAt( gLastHitPosGlobal );
LLParcelSelectionHandle selection = gParcelMgr->selectParcelAt( gLastHitPosGlobal );
gMenuHolder->setParcelSelection(selection);
gPieLand->show(x, y, mPieMouseButtonDown);
// VEFFECT: ShowPie
@ -269,6 +269,8 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
}
else if (object)
{
gMenuHolder->setObjectSelection(gSelectMgr->getSelection());
if (object->isAvatar()
|| (object->isAttachment() && !object->isHUDAttachment() && !object->permYouOwner()))
{
@ -302,7 +304,7 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
{
// BUG: What about chatting child objects?
LLString name;
LLSelectNode* node = gSelectMgr->getFirstRootNode();
LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
if (node)
{
name = node->mName;
@ -397,7 +399,7 @@ void LLToolPie::selectionPropertiesReceived()
if (sClickActionObject
&& !sClickActionObject->isDead())
{
LLViewerObject* root = gSelectMgr->getFirstRootObject();
LLViewerObject* root = gSelectMgr->getSelection()->getFirstRootObject();
if (root == sClickActionObject)
{
U8 action = root->getClickAction();
@ -603,6 +605,19 @@ void LLToolPie::handleDeselect()
gSelectMgr->validateSelection();
}
LLTool* LLToolPie::getOverrideTool(MASK mask)
{
if (mask == MASK_CONTROL)
{
return gToolGrab;
}
else if (mask == (MASK_CONTROL | MASK_SHIFT))
{
return gToolGrab;
}
return LLTool::getOverrideTool(mask);
}
void LLToolPie::stopEditing()
{

View File

@ -33,6 +33,7 @@ public:
virtual void onMouseCaptureLost();
virtual void handleDeselect();
virtual LLTool* getOverrideTool(MASK mask);
static void leftMouseCallback(S32 x, S32 y, MASK mask);
static void rightMouseCallback(S32 x, S32 y, MASK mask);

View File

@ -110,7 +110,7 @@ BOOL LLToolPlacer::placeObject(S32 x, S32 y, MASK mask)
// ...and go back to the default tool
if (added && !gSavedSettings.getBOOL("CreateToolKeepSelected"))
{
gCurrentToolset->selectTool( gToolTranslate );
gToolMgr->getCurrentToolset()->selectTool( gToolTranslate );
}
return added;

View File

@ -174,9 +174,10 @@ void LLToolSelect::handleObjectSelection(LLViewerObject *object, MASK mask, BOOL
if (!already_selected)
{
LLViewerObject* root_object = (LLViewerObject*)object->getRootEdit();
LLObjectSelectionHandle selection = gSelectMgr->getSelection();
// this is just a temporary selection
LLSelectNode* select_node = gSelectMgr->findSelectNode(root_object);
LLSelectNode* select_node = selection->findNode(root_object);
if (select_node)
{
select_node->setTransient(TRUE);
@ -184,7 +185,7 @@ void LLToolSelect::handleObjectSelection(LLViewerObject *object, MASK mask, BOOL
for (S32 i = 0; i < (S32)root_object->mChildList.size(); i++)
{
select_node = gSelectMgr->findSelectNode(root_object->mChildList[i]);
select_node = selection->findNode(root_object->mChildList[i]);
if (select_node)
{
select_node->setTransient(TRUE);

View File

@ -46,6 +46,10 @@ LLToolSelectLand::LLToolSelectLand( )
mLastShowParcelOwners(FALSE)
{ }
LLToolSelectLand::~LLToolSelectLand()
{
}
BOOL LLToolSelectLand::handleMouseDown(S32 x, S32 y, MASK mask)
{
@ -114,7 +118,7 @@ BOOL LLToolSelectLand::handleMouseUp(S32 x, S32 y, MASK mask)
roundXY(mEastNorthTop);
// Don't auto-select entire parcel.
gParcelMgr->selectLand( mWestSouthBottom, mEastNorthTop, FALSE );
mSelection = gParcelMgr->selectLand( mWestSouthBottom, mEastNorthTop, FALSE );
}
mMouseOutsideSlop = FALSE;
@ -201,6 +205,7 @@ void LLToolSelectLand::handleSelect()
void LLToolSelectLand::handleDeselect()
{
gFloaterTools->setStatusText("");
mSelection = NULL;
//gParcelMgr->deselectLand();
gSavedSettings.setBOOL("ShowParcelOwners", mLastShowParcelOwners);
}

View File

@ -12,11 +12,14 @@
#include "lltool.h"
#include "v3dmath.h"
class LLParcelSelection;
class LLToolSelectLand
: public LLTool
{
public:
LLToolSelectLand( );
virtual ~LLToolSelectLand();
/*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
/*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
@ -49,6 +52,7 @@ protected:
LLVector3d mEastNorthTop; // global coords, from drag
BOOL mLastShowParcelOwners; // store last Show Parcel Owners setting
LLHandle<LLParcelSelection> mSelection; // hold on to a parcel selection
};
extern LLToolSelectLand *gToolParcel;

View File

@ -129,7 +129,7 @@ void LLToolView::draw()
{
// turn off highlighting for all containers
// and hide all option panels except for the selected one.
LLTool* selected = gCurrentToolset->getSelectedTool();
LLTool* selected = gToolMgr->getCurrentToolset()->getSelectedTool();
for( LLToolContainer* contain = mContainList.getFirstData();
contain != NULL;
contain = mContainList.getNextData()
@ -169,7 +169,6 @@ void LLToolView::onClickToolButton(void* userdata)
LLToolContainer* clicked = (LLToolContainer*) userdata;
// Switch to this one
gCurrentToolset->selectTool( clicked->mTool );
gToolMgr->useSelectedTool( gCurrentToolset );
gToolMgr->getCurrentToolset()->selectTool( clicked->mTool );
}

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,8 @@
class LLUICtrl;
class LLView;
class LLParcelSelection;
class LLObjectSelection;
struct LLResourceData
{
@ -126,11 +128,18 @@ class LLPermissions;
class LLViewerMenuHolderGL : public LLMenuHolderGL
{
public:
LLViewerMenuHolderGL() : LLMenuHolderGL() {};
LLViewerMenuHolderGL();
virtual BOOL hideMenus();
void setParcelSelection(LLHandle<LLParcelSelection> selection);
void setObjectSelection(LLHandle<LLObjectSelection> selection);
virtual const LLRect getMenuRect() const;
//virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
protected:
LLHandle<LLParcelSelection> mParcelSelection;
LLHandle<LLObjectSelection> mObjectSelection;
};
extern const LLString SAVE_INTO_INVENTORY;

View File

@ -2990,7 +2990,7 @@ void process_kill_object(LLMessageSystem *mesgsys, void **user_data)
//llinfos << "Kill message for local " << local_id << llendl;
}
gSelectMgr->selectionRemoveObject(id);
gSelectMgr->removeObjectFromSelections(id);
// ...don't kill the avatar
if (!(id == gAgentID))
@ -3472,12 +3472,15 @@ void process_camera_constraint(LLMessageSystem *mesgsys, void **user_data)
void near_sit_object(BOOL success, void *data)
{
// Send message to sit on object
gMessageSystem->newMessageFast(_PREHASH_AgentSit);
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
gAgent.sendReliableMessage();
if (success)
{
// Send message to sit on object
gMessageSystem->newMessageFast(_PREHASH_AgentSit);
gMessageSystem->nextBlockFast(_PREHASH_AgentData);
gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
gAgent.sendReliableMessage();
}
}
void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data)
@ -3518,9 +3521,6 @@ void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data)
{
gAgent.startAutoPilotGlobal(gAgent.getPosGlobalFromAgent(sit_spot), "Sit", &sitRotation, near_sit_object, NULL, 0.5f);
}
// deselect transient selections (pie menu) when sitting
gSelectMgr->deselectTransient();
}
else
{

View File

@ -211,7 +211,7 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp,
&& update_type != OUT_TERSE_IMPROVED
&& objectp->mCreateSelected)
{
if ( gToolMgr->getCurrentTool( gKeyboard->currentMask(TRUE) ) != gToolPie )
if ( gToolMgr->getCurrentTool() != gToolPie )
{
//llinfos << "DEBUG selecting " << objectp->mID << " "
// << objectp->mLocalID << llendl;
@ -565,7 +565,8 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent)
}
// Selected
for (objectp = gSelectMgr->getFirstRootObject(); objectp; objectp = gSelectMgr->getNextRootObject())
LLObjectSelectionHandle selection = gSelectMgr->getSelection();
for (objectp = selection->getFirstRootObject(); objectp; objectp = selection->getNextRootObject())
{
objectp->boostTexturePriority();
}
@ -1421,7 +1422,7 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port)
if (orphans_found && objectp->isSelected())
{
LLSelectNode* nodep = gSelectMgr->findSelectNode(objectp);
LLSelectNode* nodep = gSelectMgr->getSelection()->findNode(objectp);
if (nodep && !nodep->mIndividualSelection)
{
// rebuild selection with orphans

View File

@ -46,6 +46,7 @@
const F32 PARCEL_COLLISION_DRAW_SECS = 1.f;
// Globals
LLViewerParcelMgr *gParcelMgr = NULL;
@ -53,6 +54,12 @@ U8* LLViewerParcelMgr::sPackedOverlay = NULL;
LLUUID gCurrentMovieID = LLUUID::null;
static LLParcelSelection* get_null_parcel_selection();
template<>
const LLHandle<LLParcelSelection>::NullFunc
LLHandle<LLParcelSelection>::sNullFunc = get_null_parcel_selection;
// Local functions
void optionally_start_music(const LLString& music_url);
void callback_start_music(S32 option, void* data);
@ -83,8 +90,6 @@ struct LLGodForceOwnerData
//
LLViewerParcelMgr::LLViewerParcelMgr()
: mSelected(FALSE),
mSelectedMultipleOwners(FALSE),
mWholeParcelSelected(FALSE),
mWestSouth(),
mEastNorth(),
mSelectedDwell(0.f),
@ -94,11 +99,12 @@ LLViewerParcelMgr::LLViewerParcelMgr()
mRenderCollision(FALSE),
mRenderSelection(TRUE),
mCollisionBanned(0),
mCollisionTimer(),
mMediaParcelId(0),
mMediaRegionId(0)
mCollisionTimer()
{
mParcel = new LLParcel();
mCurrentParcel = new LLParcel();
mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel);
mFloatingParcelSelection = new LLParcelSelection(mCurrentParcel);
mAgentParcel = new LLParcel();
mHoverParcel = new LLParcel();
mCollisionParcel = new LLParcel();
@ -130,8 +136,14 @@ LLViewerParcelMgr::LLViewerParcelMgr()
LLViewerParcelMgr::~LLViewerParcelMgr()
{
delete mParcel;
mParcel = NULL;
mCurrentParcelSelection->setParcel(NULL);
mCurrentParcelSelection = NULL;
mFloatingParcelSelection->setParcel(NULL);
mFloatingParcelSelection = NULL;
delete mCurrentParcel;
mCurrentParcel = NULL;
delete mAgentParcel;
mAgentParcel = NULL;
@ -156,32 +168,17 @@ LLViewerParcelMgr::~LLViewerParcelMgr()
mAgentParcelOverlay = NULL;
}
void LLViewerParcelMgr::destroyGL()
{
mBlockedImage = NULL;
mPassImage = NULL;
}
void LLViewerParcelMgr::restoreGL()
{
mBlockedImage = gImageList.getImage(mBlockedImageID, TRUE, TRUE);
mPassImage = gImageList.getImage(mPassImageID, TRUE, TRUE);
}
void LLViewerParcelMgr::dump()
{
llinfos << "Parcel Manager Dump" << llendl;
llinfos << "mSelected " << S32(mSelected) << llendl;
llinfos << "Selected parcel: " << llendl;
llinfos << mWestSouth << " to " << mEastNorth << llendl;
mParcel->dump();
llinfos << "banning " << mParcel->mBanList.size() << llendl;
mCurrentParcel->dump();
llinfos << "banning " << mCurrentParcel->mBanList.size() << llendl;
access_map_const_iterator cit = mParcel->mBanList.begin();
access_map_const_iterator end = mParcel->mBanList.end();
access_map_const_iterator cit = mCurrentParcel->mBanList.begin();
access_map_const_iterator end = mCurrentParcel->mBanList.end();
for ( ; cit != end; ++cit)
{
llinfos << "ban id " << (*cit).first << llendl;
@ -214,27 +211,27 @@ void LLViewerParcelMgr::getDisplayInfo(S32* area_out, S32* claim_out,
if (mSelected)
{
if (mSelectedMultipleOwners)
if (mCurrentParcelSelection->mSelectedMultipleOwners)
{
area = getClaimableArea();
area = mCurrentParcelSelection->getClaimableArea();
}
else
{
area = getSelectedArea();
}
if (mParcel->getForSale())
if (mCurrentParcel->getForSale())
{
price = mParcel->getSalePrice();
price = mCurrentParcel->getSalePrice();
for_sale = TRUE;
}
else
{
price = area * mParcel->getClaimPricePerMeter();
price = area * mCurrentParcel->getClaimPricePerMeter();
for_sale = FALSE;
}
rent = mParcel->getTotalRent();
rent = mCurrentParcel->getTotalRent();
dwell = mSelectedDwell;
}
@ -248,51 +245,27 @@ void LLViewerParcelMgr::getDisplayInfo(S32* area_out, S32* claim_out,
void LLViewerParcelMgr::getPrimInfo(S32 &sw_max, S32 &sw_total, S32 &max, S32 &total, S32 &owner, S32 &group, S32 &other, S32& selected, F32 &parcel_object_bonus, S32 &other_clean)
{
if (mSelected && mParcel)
if (mSelected && mCurrentParcel)
{
sw_max = mParcel->getSimWideMaxPrimCapacity();
sw_total = mParcel->getSimWidePrimCount();
max = llround(mParcel->getMaxPrimCapacity()*mParcel->getParcelPrimBonus());
total = mParcel->getPrimCount();
owner = mParcel->getOwnerPrimCount();
group = mParcel->getGroupPrimCount();
other = mParcel->getOtherPrimCount();
selected = mParcel->getSelectedPrimCount();
parcel_object_bonus = mParcel->getParcelPrimBonus();
other_clean = mParcel->getCleanOtherTime();
sw_max = mCurrentParcel->getSimWideMaxPrimCapacity();
sw_total = mCurrentParcel->getSimWidePrimCount();
max = llround(mCurrentParcel->getMaxPrimCapacity()*mCurrentParcel->getParcelPrimBonus());
total = mCurrentParcel->getPrimCount();
owner = mCurrentParcel->getOwnerPrimCount();
group = mCurrentParcel->getGroupPrimCount();
other = mCurrentParcel->getOtherPrimCount();
selected = mCurrentParcel->getSelectedPrimCount();
parcel_object_bonus = mCurrentParcel->getParcelPrimBonus();
other_clean = mCurrentParcel->getCleanOtherTime();
}
}
BOOL LLViewerParcelMgr::getMultipleOwners() const
{
return mSelectedMultipleOwners;
}
BOOL LLViewerParcelMgr::getWholeParcelSelected() const
{
return mWholeParcelSelected;
}
S32 LLViewerParcelMgr::getClaimableArea() const
{
const S32 UNIT_AREA = S32( PARCEL_GRID_STEP_METERS * PARCEL_GRID_STEP_METERS );
return mSelectedPublicCount * UNIT_AREA;
}
bool LLViewerParcelMgr::hasOthersSelected() const
{
return mSelectedOtherCount != 0;
}
S32 LLViewerParcelMgr::getSelectedArea() const
{
S32 rv = 0;
if(mSelected && mParcel && mWholeParcelSelected)
if(mSelected && mCurrentParcel && mCurrentParcelSelection->mWholeParcelSelected)
{
rv = mParcel->getArea();
rv = mCurrentParcel->getArea();
}
else if(mSelected)
{
@ -428,7 +401,7 @@ void LLViewerParcelMgr::writeAgentParcelFromBitmap(U8* bitmap)
// Given a point, find the PARCEL_GRID_STEP x PARCEL_GRID_STEP block
// containing it and select that.
void LLViewerParcelMgr::selectParcelAt(const LLVector3d& pos_global)
LLParcelSelectionHandle LLViewerParcelMgr::selectParcelAt(const LLVector3d& pos_global)
{
LLVector3d southwest = pos_global;
LLVector3d northeast = pos_global;
@ -442,14 +415,14 @@ void LLViewerParcelMgr::selectParcelAt(const LLVector3d& pos_global)
northeast.mdV[VY] = llround( northeast.mdV[VY], (F64)PARCEL_GRID_STEP_METERS );
// Snap to parcel
selectLand( southwest, northeast, TRUE );
return selectLand( southwest, northeast, TRUE );
}
// Tries to select the parcel inside the rectangle
void LLViewerParcelMgr::selectParcelInRectangle()
LLParcelSelectionHandle LLViewerParcelMgr::selectParcelInRectangle()
{
selectLand(mWestSouth, mEastNorth, TRUE);
return selectLand(mWestSouth, mEastNorth, TRUE);
}
@ -479,28 +452,32 @@ void LLViewerParcelMgr::selectCollisionParcel()
mRequestResult = PARCEL_RESULT_NO_DATA;
// Hack: Copy some data over temporarily
mParcel->setName( mCollisionParcel->getName() );
mParcel->setDesc( mCollisionParcel->getDesc() );
mParcel->setPassPrice(mCollisionParcel->getPassPrice());
mParcel->setPassHours(mCollisionParcel->getPassHours());
mCurrentParcel->setName( mCollisionParcel->getName() );
mCurrentParcel->setDesc( mCollisionParcel->getDesc() );
mCurrentParcel->setPassPrice(mCollisionParcel->getPassPrice());
mCurrentParcel->setPassHours(mCollisionParcel->getPassHours());
// clear the list of segments to prevent flashing
resetSegments(mHighlightSegments);
mFloatingParcelSelection->setParcel(mCurrentParcel);
mCurrentParcelSelection->setParcel(NULL);
mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel);
mSelected = TRUE;
mWholeParcelSelected = TRUE;
mCurrentParcelSelection->mWholeParcelSelected = TRUE;
notifyObservers();
return;
}
// snap_selection = auto-select the hit parcel, if there is exactly one
void LLViewerParcelMgr::selectLand(const LLVector3d &corner1, const LLVector3d &corner2,
LLParcelSelectionHandle LLViewerParcelMgr::selectLand(const LLVector3d &corner1, const LLVector3d &corner2,
BOOL snap_selection)
{
if (!gWorldp)
{
return;
return NULL;
}
sanitize_corners( corner1, corner2, mWestSouth, mEastNorth );
@ -511,7 +488,7 @@ void LLViewerParcelMgr::selectLand(const LLVector3d &corner1, const LLVector3d &
{
mSelected = FALSE;
notifyObservers();
return;
return NULL;
}
// ...y isn't more than one meter away
@ -520,7 +497,7 @@ void LLViewerParcelMgr::selectLand(const LLVector3d &corner1, const LLVector3d &
{
mSelected = FALSE;
notifyObservers();
return;
return NULL;
}
// Can't select across region boundary
@ -537,7 +514,7 @@ void LLViewerParcelMgr::selectLand(const LLVector3d &corner1, const LLVector3d &
{
// just in case they somehow selected no land.
mSelected = FALSE;
return;
return NULL;
}
if (region != region_other)
@ -545,50 +522,13 @@ void LLViewerParcelMgr::selectLand(const LLVector3d &corner1, const LLVector3d &
LLNotifyBox::showXml("CantSelectLandFromMultipleRegions");
mSelected = FALSE;
notifyObservers();
return;
return NULL;
}
// Build region global copies of corners
LLVector3 wsb_region = region->getPosRegionFromGlobal( mWestSouth );
LLVector3 ent_region = region->getPosRegionFromGlobal( mEastNorth );
/*
// Check land to make sure all is either public, owned, or self
LLViewerParcelOverlay* overlay = region->getParcelOverlay();
if (!overlay)
{
llerrs << "No overlay in LLViewerParcelMgr::selectLand" << llendl;
return;
}
U8 start_ownership = overlay->ownership( wsb_region );
BOOL identical = TRUE;
S32 x_steps = S32( getSelectionWidth() / PARCEL_GRID_STEP_METERS );
S32 y_steps = S32( getSelectionHeight() / PARCEL_GRID_STEP_METERS );
for (S32 x = 0; x < x_steps && identical; x++ )
{
for (S32 y = 0; y < y_steps && identical; y++ )
{
// strange recomputation each time to avoid error accumulation
LLVector3 check = wsb_region;
check.mV[VX] += x * PARCEL_GRID_STEP_METERS;
check.mV[VY] += y * PARCEL_GRID_STEP_METERS;
identical = (start_ownership == overlay->ownership(check));
}
}
if (!identical)
{
add_chat("Can't select mix of your own, other people's and public land.", FALSE, "", FALSE, CHAT_SOURCE_SYSTEM);
add_chat("Try selecting a smaller piece of land.", FALSE, "", FALSE, CHAT_SOURCE_SYSTEM);
mSelected = FALSE;
notifyObservers();
return;
}
*/
// Send request message
LLMessageSystem *msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ParcelPropertiesRequest);
@ -609,12 +549,24 @@ void LLViewerParcelMgr::selectLand(const LLVector3d &corner1, const LLVector3d &
// clear the list of segments to prevent flashing
resetSegments(mHighlightSegments);
mFloatingParcelSelection->setParcel(mCurrentParcel);
mCurrentParcelSelection->setParcel(NULL);
mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel);
mSelected = TRUE;
mWholeParcelSelected = snap_selection;
mCurrentParcelSelection->mWholeParcelSelected = snap_selection;
notifyObservers();
return;
return mCurrentParcelSelection;
}
void LLViewerParcelMgr::deselectUnused()
{
// no more outstanding references to this selection, other than our own
if (mCurrentParcelSelection->getNumRefs() == 1 && mFloatingParcelSelection->getNumRefs() == 1)
{
deselectLand();
}
}
void LLViewerParcelMgr::deselectLand()
{
@ -623,14 +575,20 @@ void LLViewerParcelMgr::deselectLand()
mSelected = FALSE;
// Invalidate the selected parcel
mParcel->setLocalID(-1);
mParcel->mAccessList.clear();
mParcel->mBanList.clear();
//mParcel->mRenterList.reset();
mCurrentParcel->setLocalID(-1);
mCurrentParcel->mAccessList.clear();
mCurrentParcel->mBanList.clear();
//mCurrentParcel->mRenterList.reset();
mSelectedDwell = 0.f;
notifyObservers();
// invalidate parcel selection so that existing users of this selection can clean up
mCurrentParcelSelection->setParcel(NULL);
mFloatingParcelSelection->setParcel(NULL);
// create new parcel selection
mCurrentParcelSelection = new LLParcelSelection(mCurrentParcel);
}
}
@ -675,18 +633,15 @@ BOOL LLViewerParcelMgr::selectionEmpty() const
}
LLParcel *LLViewerParcelMgr::getSelectedParcel() const
LLParcelSelectionHandle LLViewerParcelMgr::getParcelSelection() const
{
if (mSelected)
{
return mParcel;
}
else
{
return NULL;
}
return mCurrentParcelSelection;
}
LLParcelSelectionHandle LLViewerParcelMgr::getFloatingParcelSelection() const
{
return mFloatingParcelSelection;
}
LLParcel *LLViewerParcelMgr::getAgentParcel() const
{
@ -905,11 +860,11 @@ void LLViewerParcelMgr::sendParcelAccessListRequest(U32 flags)
if (flags & AL_BAN)
{
mParcel->mBanList.clear();
mCurrentParcel->mBanList.clear();
}
if (flags & AL_ACCESS)
{
mParcel->mAccessList.clear();
mCurrentParcel->mAccessList.clear();
}
// Only the headers differ
@ -920,7 +875,7 @@ void LLViewerParcelMgr::sendParcelAccessListRequest(U32 flags)
msg->nextBlockFast(_PREHASH_Data);
msg->addS32Fast(_PREHASH_SequenceID, 0);
msg->addU32Fast(_PREHASH_Flags, flags);
msg->addS32("LocalID", mParcel->getLocalID() );
msg->addS32("LocalID", mCurrentParcel->getLocalID() );
msg->sendReliable( region->getHost() );
}
@ -943,7 +898,7 @@ void LLViewerParcelMgr::sendParcelDwellRequest()
msg->addUUID("AgentID", gAgent.getID() );
msg->addUUID("SessionID", gAgent.getSessionID());
msg->nextBlock("Data");
msg->addS32("LocalID", mParcel->getLocalID());
msg->addS32("LocalID", mCurrentParcel->getLocalID());
msg->addUUID("ParcelID", LLUUID::null); // filled in on simulator
msg->sendReliable( region->getHost() );
}
@ -982,8 +937,8 @@ void LLViewerParcelMgr::sendParcelGodForceOwner(const LLUUID& owner_id)
llinfos << "Region " << region->getOriginGlobal() << llendl;
LLGodForceOwnerData* data = new LLGodForceOwnerData(owner_id, mParcel->getLocalID(), region->getHost());
if(mParcel->getAuctionID())
LLGodForceOwnerData* data = new LLGodForceOwnerData(owner_id, mCurrentParcel->getLocalID(), region->getHost());
if(mCurrentParcel->getAuctionID())
{
gViewerWindow->alertXml("ForceOwnerAuctionWarning",
callback_god_force_owner,
@ -1033,7 +988,7 @@ void LLViewerParcelMgr::sendParcelGodForceToContent()
msg->addUUID("AgentID", gAgent.getID());
msg->addUUID("SessionID", gAgent.getSessionID());
msg->nextBlock("ParcelData");
msg->addS32("LocalID", mParcel->getLocalID());
msg->addS32("LocalID", mCurrentParcel->getLocalID());
msg->sendReliable(region->getHost());
}
@ -1061,7 +1016,7 @@ void LLViewerParcelMgr::sendParcelRelease()
msg->addUUID("AgentID", gAgent.getID() );
msg->addUUID("SessionID", gAgent.getSessionID() );
msg->nextBlock("Data");
msg->addS32("LocalID", mParcel->getLocalID() );
msg->addS32("LocalID", mCurrentParcel->getLocalID() );
//msg->addU32("Flags", flags);
msg->sendReliable( region->getHost() );
@ -1099,7 +1054,7 @@ LLViewerParcelMgr::ParcelBuyInfo* LLViewerParcelMgr::setupParcelBuy(
BOOL is_claim,
BOOL remove_contribution)
{
if (!mSelected || !mParcel)
if (!mSelected || !mCurrentParcel)
{
gViewerWindow->alertXml("CannotBuyLandNothingSelected");
return NULL;
@ -1144,7 +1099,7 @@ LLViewerParcelMgr::ParcelBuyInfo* LLViewerParcelMgr::setupParcelBuy(
if (!is_claim)
{
info->mParcelID = mParcel->getLocalID();
info->mParcelID = mCurrentParcel->getLocalID();
}
else
{
@ -1197,7 +1152,7 @@ void LLViewerParcelMgr::deleteParcelBuy(ParcelBuyInfo*& info)
void LLViewerParcelMgr::sendParcelDeed(const LLUUID& group_id)
{
if (!mSelected || !mParcel)
if (!mSelected || !mCurrentParcel)
{
gViewerWindow->alertXml("CannotDeedLandNothingSelected");
return;
@ -1221,7 +1176,7 @@ void LLViewerParcelMgr::sendParcelDeed(const LLUUID& group_id)
msg->addUUID("SessionID", gAgent.getSessionID() );
msg->nextBlock("Data");
msg->addUUID("GroupID", group_id );
msg->addS32("LocalID", mParcel->getLocalID() );
msg->addS32("LocalID", mCurrentParcel->getLocalID() );
//msg->addU32("JoinNeighbors", join);
msg->sendReliable( region->getHost() );
}
@ -1235,7 +1190,7 @@ void LLViewerParcelMgr::sendParcelDeed(const LLUUID& group_id)
void LLViewerParcelMgr::makeLandmarkAtSelection()
{
// Don't create for parcels you don't own
if (gAgent.getID() != mParcel->getOwnerID())
if (gAgent.getID() != mCurrentParcel->getOwnerID())
{
return;
}
@ -1271,7 +1226,7 @@ const char* LLViewerParcelMgr::getAgentParcelName() const
}
void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel, BOOL want_reply_to_update)
void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel)
{
if (!parcel) return;
@ -1288,7 +1243,8 @@ void LLViewerParcelMgr::sendParcelPropertiesUpdate(LLParcel* parcel, BOOL want_r
msg->addS32Fast(_PREHASH_LocalID, parcel->getLocalID() );
U32 flags = 0x0;
if (want_reply_to_update) flags |= 0x01;
// request new properties update from simulator
flags |= 0x01;
msg->addU32("Flags", flags);
parcel->packMessage(msg);
@ -1432,7 +1388,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
{
// ...selected parcels report this sequence id
gParcelMgr->mRequestResult = PARCEL_RESULT_SUCCESS;
parcel = gParcelMgr->mParcel;
parcel = gParcelMgr->mCurrentParcel;
}
else if (sequence_id == HOVERED_PARCEL_SEQ_ID)
{
@ -1541,11 +1497,11 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
if (sequence_id == SELECTED_PARCEL_SEQ_ID)
{
// Update selected counts
gParcelMgr->mSelectedSelfCount = self_count;
gParcelMgr->mSelectedOtherCount = other_count;
gParcelMgr->mSelectedPublicCount = public_count;
gParcelMgr->mCurrentParcelSelection->mSelectedSelfCount = self_count;
gParcelMgr->mCurrentParcelSelection->mSelectedOtherCount = other_count;
gParcelMgr->mCurrentParcelSelection->mSelectedPublicCount = public_count;
gParcelMgr->mSelectedMultipleOwners =
gParcelMgr->mCurrentParcelSelection->mSelectedMultipleOwners =
(request_result == PARCEL_RESULT_MULTIPLE);
// Select the whole parcel
@ -1565,7 +1521,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
west_south.mV[VY],
east_north.mV[VX],
east_north.mV[VY] );
gParcelMgr->mWholeParcelSelected = FALSE;
gParcelMgr->mCurrentParcelSelection->mWholeParcelSelected = FALSE;
}
else if (0 == local_id)
{
@ -1579,7 +1535,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
aabb_min.mV[VY],
aabb_max.mV[VX],
aabb_max.mV[VY] );
gParcelMgr->mWholeParcelSelected = TRUE;
gParcelMgr->mCurrentParcelSelection->mWholeParcelSelected = TRUE;
}
else
{
@ -1599,7 +1555,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use
delete bitmap;
bitmap = NULL;
gParcelMgr->mWholeParcelSelected = TRUE;
gParcelMgr->mCurrentParcelSelection->mWholeParcelSelected = TRUE;
}
// Request access list information for this land
@ -1944,7 +1900,7 @@ void LLViewerParcelMgr::processParcelAccessListReply(LLMessageSystem *msg, void
msg->getU32Fast( _PREHASH_Data, _PREHASH_Flags, message_flags);
msg->getS32Fast( _PREHASH_Data, _PREHASH_LocalID, parcel_id);
LLParcel* parcel = gParcelMgr->mParcel;
LLParcel* parcel = gParcelMgr->mCurrentParcel;
if (!parcel) return;
if (parcel_id != parcel->getLocalID())
@ -1986,7 +1942,7 @@ void LLViewerParcelMgr::processParcelDwellReply(LLMessageSystem* msg, void**)
F32 dwell;
msg->getF32("Data", "Dwell", dwell);
if (local_id == gParcelMgr->mParcel->getLocalID())
if (local_id == gParcelMgr->mCurrentParcel->getLocalID())
{
gParcelMgr->mSelectedDwell = dwell;
gParcelMgr->notifyObservers();
@ -2010,7 +1966,7 @@ void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 which)
LLMessageSystem* msg = gMessageSystem;
LLParcel* parcel = mParcel;
LLParcel* parcel = mCurrentParcel;
if (!parcel) return;
if (which & AL_ACCESS)
@ -2131,17 +2087,17 @@ void LLViewerParcelMgr::sendParcelAccessListUpdate(U32 which)
void LLViewerParcelMgr::deedLandToGroup()
{
char group_name[MAX_STRING]; /* Flawfinder: ignore */
gCacheName->getGroupName(mParcel->getGroupID(), group_name);
gCacheName->getGroupName(mCurrentParcel->getGroupID(), group_name);
LLString::format_map_t args;
args["[AREA]"] = llformat("%d", mParcel->getArea());
args["[AREA]"] = llformat("%d", mCurrentParcel->getArea());
args["[GROUP_NAME]"] = group_name;
if(mParcel->getContributeWithDeed())
if(mCurrentParcel->getContributeWithDeed())
{
char first_name[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
first_name[0] = '\0';
char last_name[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
last_name[0] = '\0';
gCacheName->getName(mParcel->getOwnerID(), first_name, last_name);
gCacheName->getName(mCurrentParcel->getOwnerID(), first_name, last_name);
args["[FIRST_NAME]"] = first_name;
args["[LAST_NAME]"] = last_name;
gViewerWindow->alertXml("DeedLandToGroupWithContribution",args, deedAlertCB, NULL);
@ -2157,7 +2113,7 @@ void LLViewerParcelMgr::deedAlertCB(S32 option, void*)
{
if (option == 0)
{
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLParcel* parcel = gParcelMgr->getParcelSelection()->getParcel();
LLUUID group_id;
if(parcel)
{
@ -2188,7 +2144,7 @@ void LLViewerParcelMgr::startReleaseLand()
return;
}
if (!isParcelOwnedByAgent(mParcel, GP_LAND_RELEASE)
if (!isParcelOwnedByAgent(mCurrentParcel, GP_LAND_RELEASE)
&& !(gAgent.canManageEstate()))
{
gViewerWindow->alertXml("CannotReleaseLandDontOwn");
@ -2213,7 +2169,7 @@ void LLViewerParcelMgr::startReleaseLand()
}
*/
if (!mWholeParcelSelected)
if (!mCurrentParcelSelection->mWholeParcelSelected)
{
gViewerWindow->alertXml("CannotReleaseLandPartialSelection");
return;
@ -2221,7 +2177,7 @@ void LLViewerParcelMgr::startReleaseLand()
// Compute claim price
LLStringBase<char>::format_map_t args;
args["[AREA]"] = llformat("%d",mParcel->getArea());
args["[AREA]"] = llformat("%d",mCurrentParcel->getArea());
gViewerWindow->alertXml("ReleaseLandWarning", args,
releaseAlertCB, this);
}
@ -2233,7 +2189,7 @@ bool LLViewerParcelMgr::canAgentBuyParcel(LLParcel* parcel, bool forGroup) const
return false;
}
if (mSelected && parcel == mParcel)
if (mSelected && parcel == mCurrentParcel)
{
if (mRequestResult == PARCEL_RESULT_NO_DATA)
{
@ -2273,12 +2229,12 @@ bool LLViewerParcelMgr::canAgentBuyParcel(LLParcel* parcel, bool forGroup) const
void LLViewerParcelMgr::startBuyLand(BOOL is_for_group)
{
LLFloaterBuyLand::buyLand(getSelectionRegion(), mParcel, is_for_group == TRUE);
LLFloaterBuyLand::buyLand(getSelectionRegion(), mCurrentParcelSelection, is_for_group == TRUE);
}
void LLViewerParcelMgr::startSellLand()
{
LLFloaterSellLand::sellLand(getSelectionRegion(), mParcel);
LLFloaterSellLand::sellLand(getSelectionRegion(), mCurrentParcelSelection);
}
void LLViewerParcelMgr::startDivideLand()
@ -2289,7 +2245,7 @@ void LLViewerParcelMgr::startDivideLand()
return;
}
if (mWholeParcelSelected)
if (mCurrentParcelSelection->mWholeParcelSelected)
{
gViewerWindow->alertXml("CannotDivideLandPartialSelection");
return;
@ -2341,13 +2297,13 @@ void LLViewerParcelMgr::startJoinLand()
return;
}
if (mWholeParcelSelected)
if (mCurrentParcelSelection->mWholeParcelSelected)
{
gViewerWindow->alertXml("CannotJoinLandEntireParcelSelected");
return;
}
if (!mSelectedMultipleOwners)
if (!mCurrentParcelSelection->mSelectedMultipleOwners)
{
gViewerWindow->alertXml("CannotJoinLandSelection");
return;
@ -2393,7 +2349,7 @@ void LLViewerParcelMgr::callbackJoinLand(S32 option, void* data)
void LLViewerParcelMgr::startDeedLandToGroup()
{
if (!mSelected || !mParcel)
if (!mSelected || !mCurrentParcel)
{
gViewerWindow->alertXml("CannotDeedLandNothingSelected");
return;
@ -2423,7 +2379,7 @@ void LLViewerParcelMgr::startDeedLandToGroup()
if(!gAgent.isGodlike())
{
if((region->getRegionFlags() & REGION_FLAGS_BLOCK_LAND_RESELL)
&& (mParcel->getOwnerID() != region->getOwner()))
&& (mCurrentParcel->getOwnerID() != region->getOwner()))
{
LLStringBase<char>::format_map_t args;
args["[REGION]"] = region->getName();
@ -2437,7 +2393,7 @@ void LLViewerParcelMgr::startDeedLandToGroup()
}
void LLViewerParcelMgr::reclaimParcel()
{
LLParcel* parcel = gParcelMgr->getSelectedParcel();
LLParcel* parcel = gParcelMgr->getParcelSelection()->getParcel();
LLViewerRegion* regionp = gParcelMgr->getSelectionRegion();
if(parcel && parcel->getOwnerID().notNull()
&& (parcel->getOwnerID() != gAgent.getID())
@ -2466,7 +2422,7 @@ void LLViewerParcelMgr::releaseAlertCB(S32 option, void *)
void LLViewerParcelMgr::buyPass()
{
LLParcel* parcel = getSelectedParcel();
LLParcel* parcel = getParcelSelection()->getParcel();
if (!parcel) return;
LLViewerRegion* region = getSelectionRegion();
@ -2560,3 +2516,58 @@ void sanitize_corners(const LLVector3d &corner1,
east_north_top.mdV[VZ] = llmax( corner1.mdV[VZ], corner2.mdV[VZ] );
}
//
// LLParcelSelection
//
LLParcelSelection::LLParcelSelection() :
mParcel(NULL),
mSelectedMultipleOwners(FALSE),
mWholeParcelSelected(FALSE),
mSelectedPublicCount(0),
mSelectedSelfCount(0),
mSelectedOtherCount(0)
{
}
LLParcelSelection::LLParcelSelection(LLParcel* parcel) :
mParcel(parcel),
mSelectedMultipleOwners(FALSE),
mWholeParcelSelected(FALSE),
mSelectedPublicCount(0),
mSelectedSelfCount(0),
mSelectedOtherCount(0)
{
}
LLParcelSelection::~LLParcelSelection()
{
}
BOOL LLParcelSelection::getMultipleOwners() const
{
return mSelectedMultipleOwners;
}
BOOL LLParcelSelection::getWholeParcelSelected() const
{
return mWholeParcelSelected;
}
S32 LLParcelSelection::getClaimableArea() const
{
const S32 UNIT_AREA = S32( PARCEL_GRID_STEP_METERS * PARCEL_GRID_STEP_METERS );
return mSelectedPublicCount * UNIT_AREA;
}
bool LLParcelSelection::hasOthersSelected() const
{
return mSelectedOtherCount != 0;
}
LLParcelSelection* get_null_parcel_selection()
{
static LLParcelSelectionHandle null_ptr = new LLParcelSelection();
return null_ptr;
}

View File

@ -49,15 +49,56 @@ public:
virtual void changed() = 0;
};
class LLParcelSelection : public LLRefCount
{
friend class LLViewerParcelMgr;
public:
LLParcelSelection(LLParcel* parcel);
LLParcelSelection();
~LLParcelSelection();
// this can return NULL at any time, as parcel selection
// might have been invalidated.
LLParcel* getParcel() { return mParcel; }
// Return the number of grid units that are owned by you within
// the selection (computed by server).
S32 getSelfCount() const { return mSelectedSelfCount; }
// Returns area that will actually be claimed in meters squared.
S32 getClaimableArea() const;
bool hasOthersSelected() const;
// Does the selection have multiple land owners in it?
BOOL getMultipleOwners() const;
// Is the entire parcel selected, or just a part?
BOOL getWholeParcelSelected() const;
protected:
void setParcel(LLParcel* parcel) { mParcel = parcel; }
protected:
LLParcel* mParcel;
BOOL mSelectedMultipleOwners;
BOOL mWholeParcelSelected;
S32 mSelectedSelfCount;
S32 mSelectedOtherCount;
S32 mSelectedPublicCount;
};
typedef LLHandle<LLParcelSelection> LLParcelSelectionHandle;
class LLViewerParcelMgr
{
public:
LLViewerParcelMgr();
~LLViewerParcelMgr();
void destroyGL();
void restoreGL();
BOOL selectionEmpty() const;
F32 getSelectionWidth() const { return F32(mEastNorth.mdV[VX] - mWestSouth.mdV[VX]); }
F32 getSelectionHeight() const { return F32(mEastNorth.mdV[VY] - mWestSouth.mdV[VY]); }
@ -68,16 +109,6 @@ public:
void getPrimInfo(S32 &sw_max, S32 &sw_total, S32 &max, S32 &total, S32 &owner, S32 &group, S32 &other, S32& selected, F32 &parcel_object_bonus, S32 &other_clean);
// Does the selection have multiple land owners in it?
BOOL getMultipleOwners() const;
// Is the entire parcel selected, or just a part?
BOOL getWholeParcelSelected() const;
// Returns area that will actually be claimed in meters squared.
S32 getClaimableArea() const;
bool hasOthersSelected() const;
// Returns selected area
S32 getSelectedArea() const;
@ -96,18 +127,19 @@ public:
void selectCollisionParcel();
// Select the parcel at a specific point
void selectParcelAt(const LLVector3d& pos_global);
LLHandle<LLParcelSelection> selectParcelAt(const LLVector3d& pos_global);
// Take the current rectangle select, and select the parcel contained
// within it.
void selectParcelInRectangle();
LLParcelSelectionHandle selectParcelInRectangle();
// Select a piece of land
void selectLand(const LLVector3d &corner1, const LLVector3d &corner2,
LLParcelSelectionHandle selectLand(const LLVector3d &corner1, const LLVector3d &corner2,
BOOL snap_to_parcel);
// Clear the selection, and stop drawing the highlight.
void deselectLand();
void deselectUnused();
void addObserver(LLParcelObserver* observer);
void removeObserver(LLParcelObserver* observer);
@ -122,15 +154,23 @@ public:
BOOL canHearSound(const LLVector3d &pos_global) const;
LLParcel *getSelectedParcel() const;
// Returns a reference counted pointer to current parcel selection.
// Selection does not change to reflect new selections made by user
// Use this when implementing a task UI that refers to a specific
// selection.
LLParcelSelectionHandle getParcelSelection() const;
// Returns a reference counted pointer to current parcel selection.
// Pointer tracks whatever the user has currently selected.
// Use this when implementing an inspector UI.
// http://en.wikipedia.org/wiki/Inspector_window
LLParcelSelectionHandle getFloatingParcelSelection() const;
//LLParcel *getParcelSelection() const;
LLParcel *getAgentParcel() const;
BOOL inAgentParcel(const LLVector3d &pos_global) const;
// Return the number of grid units that are owned by you within
// the selection (computed by server).
S32 getSelfCount() const { return mSelectedSelfCount; }
// Returns a pointer only when it has valid data.
LLParcel* getHoverParcel() const;
@ -172,7 +212,7 @@ public:
// containing the southwest corner of the selection.
// If want_reply_to_update, simulator will send back a ParcelProperties
// message.
void sendParcelPropertiesUpdate(LLParcel* parcel, BOOL want_reply_to_update);
void sendParcelPropertiesUpdate(LLParcel* parcel);
// Takes an Access List flag, like AL_ACCESS or AL_BAN
void sendParcelAccessListUpdate(U32 which);
@ -265,26 +305,23 @@ protected:
//void finishClaim(BOOL user_to_user_sale, U32 join);
private:
BOOL mSelected;
BOOL mSelectedMultipleOwners;
BOOL mWholeParcelSelected;
S32 mSelectedSelfCount;
S32 mSelectedOtherCount;
S32 mSelectedPublicCount;
BOOL mSelected;
LLParcel *mParcel; // selected parcel info
S32 mRequestResult; // result of last parcel request
LLVector3d mWestSouth;
LLVector3d mEastNorth;
F32 mSelectedDwell;
LLParcel* mCurrentParcel; // selected parcel info
LLParcelSelectionHandle mCurrentParcelSelection;
LLParcelSelectionHandle mFloatingParcelSelection;
S32 mRequestResult; // result of last parcel request
LLVector3d mWestSouth;
LLVector3d mEastNorth;
F32 mSelectedDwell;
LLParcel *mAgentParcel; // info for parcel agent is in
S32 mAgentParcelSequenceID; // incrementing counter to suppress out of order updates
LLParcel *mAgentParcel; // info for parcel agent is in
S32 mAgentParcelSequenceID; // incrementing counter to suppress out of order updates
LLParcel* mHoverParcel;
S32 mHoverRequestResult;
LLVector3d mHoverWestSouth;
LLVector3d mHoverEastNorth;
LLParcel* mHoverParcel;
S32 mHoverRequestResult;
LLVector3d mHoverWestSouth;
LLVector3d mHoverEastNorth;
LLDynamicArray<LLParcelObserver*> mObservers;
@ -293,30 +330,30 @@ private:
// we can represent edges of the grid.
// WEST_MASK = draw west edge
// SOUTH_MASK = draw south edge
S32 mParcelsPerEdge;
U8* mHighlightSegments;
U8* mAgentParcelOverlay;
S32 mParcelsPerEdge;
U8* mHighlightSegments;
U8* mAgentParcelOverlay;
// Raw data buffer for unpacking parcel overlay chunks
// Size = parcels_per_edge * parcels_per_edge / parcel_overlay_chunks
static U8* sPackedOverlay;
static U8* sPackedOverlay;
// Watch for pending collisions with a parcel you can't access.
// If it's coming, draw the parcel's boundaries.
LLParcel* mCollisionParcel;
U8* mCollisionSegments;
BOOL mRenderCollision;
BOOL mRenderSelection;
S32 mCollisionBanned;
LLFrameTimer mCollisionTimer;
LLUUID mBlockedImageID;
LLUUID mPassImageID;
LLPointer<LLViewerImage> mBlockedImage;
LLPointer<LLViewerImage> mPassImage;
LLParcel* mCollisionParcel;
U8* mCollisionSegments;
BOOL mRenderCollision;
BOOL mRenderSelection;
S32 mCollisionBanned;
LLFrameTimer mCollisionTimer;
LLUUID mBlockedImageID;
LLUUID mPassImageID;
LLPointer<LLViewerImage> mBlockedImage;
LLPointer<LLViewerImage> mPassImage;
// Media
S32 mMediaParcelId;
U64 mMediaRegionId;
S32 mMediaParcelId;
U64 mMediaRegionId;
};
extern LLViewerParcelMgr *gParcelMgr;

View File

@ -378,7 +378,7 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask
if (gToolMgr)
{
// Don't let the user move the mouse out of the window until mouse up.
if( gToolMgr->getCurrentTool(mask)->clipMouseWhenDown() )
if( gToolMgr->getCurrentTool()->clipMouseWhenDown() )
{
mWindow->setMouseClipping(TRUE);
}
@ -429,7 +429,7 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask
if (gToolMgr)
{
if(gToolMgr->getCurrentTool(mask)->handleMouseDown( x, y, mask ) )
if(gToolMgr->getCurrentTool()->handleMouseDown( x, y, mask ) )
{
// This is necessary to force clicks in the world to cause edit
// boxes that might have keyboard focus to relinquish it, and hence
@ -507,7 +507,7 @@ BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK ma
if (gToolMgr)
{
if(gToolMgr->getCurrentTool(mask)->handleDoubleClick( x, y, mask ) )
if(gToolMgr->getCurrentTool()->handleDoubleClick( x, y, mask ) )
{
return TRUE;
}
@ -550,7 +550,7 @@ BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
LLTool *tool = NULL;
if (gToolMgr)
{
tool = gToolMgr->getCurrentTool(mask);
tool = gToolMgr->getCurrentTool();
if( tool->clipMouseWhenDown() )
{
@ -649,7 +649,7 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK
if (gToolMgr)
{
// Don't let the user move the mouse out of the window until mouse up.
if( gToolMgr->getCurrentTool(mask)->clipMouseWhenDown() )
if( gToolMgr->getCurrentTool()->clipMouseWhenDown() )
{
mWindow->setMouseClipping(TRUE);
}
@ -692,7 +692,7 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK
if (gToolMgr)
{
if(gToolMgr->getCurrentTool(mask)->handleRightMouseDown( x, y, mask ) )
if(gToolMgr->getCurrentTool()->handleRightMouseDown( x, y, mask ) )
{
// This is necessary to force clicks in the world to cause edit
// boxes that might have keyboard focus to relinquish it, and hence
@ -750,7 +750,7 @@ BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK m
LLTool *tool = NULL;
if (gToolMgr)
{
tool = gToolMgr->getCurrentTool(mask);
tool = gToolMgr->getCurrentTool();
if( tool->clipMouseWhenDown() )
{
@ -1909,7 +1909,7 @@ void LLViewerWindow::draw()
if (gToolMgr)
{
// Draw tool specific overlay on world
gToolMgr->getCurrentTool( gKeyboard->currentMask(TRUE) )->draw();
gToolMgr->getCurrentTool()->draw();
}
if( gAgent.cameraMouselook() )
@ -2097,7 +2097,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
if (gToolMgr)
{
if( gToolMgr->getCurrentTool(mask)->handleKey(key, mask) )
if( gToolMgr->getCurrentTool()->handleKey(key, mask) )
{
return TRUE;
}
@ -2457,7 +2457,7 @@ BOOL LLViewerWindow::handlePerFrameHover()
LLTool *tool = NULL;
if (gToolMgr && gHoverView)
{
tool = gToolMgr->getCurrentTool(mask);
tool = gToolMgr->getCurrentTool();
if(!handled && tool)
{
@ -2477,8 +2477,8 @@ BOOL LLViewerWindow::handlePerFrameHover()
// Suppress the toolbox view if our source tool was the pie tool,
// and we've overridden to something else.
mSuppressToolbox =
(gToolMgr->getCurrentTool(MASK_NONE) == gToolPie) &&
(gToolMgr->getCurrentTool(mask) != gToolPie);
(gToolMgr->getBaseTool() == gToolPie) &&
(gToolMgr->getCurrentTool() != gToolPie);
}
@ -2539,8 +2539,8 @@ BOOL LLViewerWindow::handlePerFrameHover()
(tool != gToolPie // not default tool
&& tool != gToolGun // not coming out of mouselook
&& !mSuppressToolbox // not override in third person
&& gCurrentToolset != gFaceEditToolset // not special mode
&& gCurrentToolset != gMouselookToolset
&& gToolMgr->getCurrentToolset() != gFaceEditToolset // not special mode
&& gToolMgr->getCurrentToolset() != gMouselookToolset
&& (!captor || captor->isView())) // not dragging
)
{
@ -2653,7 +2653,7 @@ BOOL LLViewerWindow::handlePerFrameHover()
mLastMousePoint = mCurrentMousePoint;
// last ditch force of edit menu to selection manager
if (gEditMenuHandler == NULL && gSelectMgr && gSelectMgr->getObjectCount())
if (gEditMenuHandler == NULL && gSelectMgr && gSelectMgr->getSelection()->getObjectCount())
{
gEditMenuHandler = gSelectMgr;
}
@ -2689,15 +2689,15 @@ BOOL LLViewerWindow::handlePerFrameHover()
gChatBar->startChat(NULL);
}
// sync land selection with edit and about land dialogs
if (gParcelMgr
&& !gMenuHolder->hasVisibleMenu()
&& !LLFloaterLand::floaterVisible()
&& !LLFloaterBuyLand::isOpen()
&& !LLPanelLandGeneral::buyPassDialogVisible()
&& (!gFloaterTools || !gFloaterTools->getVisible()))
// cleanup unused selections
if (gParcelMgr)
{
gParcelMgr->deselectLand();
gParcelMgr->deselectUnused();
}
if (gSelectMgr)
{
gSelectMgr->deselectUnused();
}
return handled;
@ -2745,6 +2745,7 @@ void LLViewerWindow::saveLastMouse(const LLCoordGL &point)
void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL for_hud )
{
LLViewerObject* object;
LLObjectSelectionHandle selection = gSelectMgr->getSelection();
if (!for_hud && !for_gl_pick)
{
@ -2760,15 +2761,15 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
gParcelMgr->renderParcelCollision();
}
}
else if (( for_hud && gSelectMgr->getSelectType() == SELECT_TYPE_HUD) ||
(!for_hud && gSelectMgr->getSelectType() != SELECT_TYPE_HUD))
else if (( for_hud && selection->getSelectType() == SELECT_TYPE_HUD) ||
(!for_hud && selection->getSelectType() != SELECT_TYPE_HUD))
{
gSelectMgr->renderSilhouettes(for_hud);
stop_glerror();
// setup HUD render
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD && gSelectMgr->getObjectCount())
if (selection->getSelectType() == SELECT_TYPE_HUD && gSelectMgr->getSelection()->getObjectCount())
{
LLBBox hud_bbox = gAgent.getAvatarObject()->getHUDBBox();
@ -2794,12 +2795,12 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD)
if (selection->getSelectType() == SELECT_TYPE_HUD)
{
F32 zoom = gAgent.getAvatarObject()->mHUDCurZoom;
glScalef(zoom, zoom, zoom);
}
for( object = gSelectMgr->getFirstObject(); object; object = gSelectMgr->getNextObject() )
for( object = gSelectMgr->getSelection()->getFirstObject(); object; object = gSelectMgr->getSelection()->getNextObject() )
{
LLDrawable* drawable = object->mDrawable;
if (drawable && drawable->isLight())
@ -2834,7 +2835,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
// not be recalculated at this time. If they are, then group rotations will break.
// Draw arrows at average center of all selected objects
LLTool* tool = gToolMgr->getCurrentTool( gKeyboard->currentMask(TRUE) );
LLTool* tool = gToolMgr->getCurrentTool();
if (tool)
{
if(tool->isAlwaysRendered())
@ -2843,13 +2844,13 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
}
else
{
if( !gSelectMgr->isEmpty() )
if( !gSelectMgr->getSelection()->isEmpty() )
{
BOOL moveable_object_selected = FALSE;
BOOL all_selected_objects_move = TRUE;
BOOL all_selected_objects_modify = TRUE;
BOOL selecting_linked_set = gSavedSettings.getBOOL("SelectLinkedSet");
for( object = gSelectMgr->getFirstObject(); object; object = gSelectMgr->getNextObject() )
for( object = gSelectMgr->getSelection()->getFirstObject(); object; object = gSelectMgr->getSelection()->getNextObject() )
{
BOOL this_object_movable = FALSE;
if (object->permMove() && (object->permModify() || selecting_linked_set))
@ -2884,7 +2885,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
}
}
}
if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD && gSelectMgr->getObjectCount())
if (selection->getSelectType() == SELECT_TYPE_HUD && selection->getObjectCount())
{
glMatrixMode(GL_PROJECTION);
glPopMatrix();

View File

@ -1925,9 +1925,10 @@ void LLVOAvatar::buildCharacter()
{
LLMenuItemCallGL* item;
item = new LLMenuItemCallGL(attachment->getName(),
&handle_attach_to_avatar,
object_selected_and_point_valid,
attachment);
NULL,
object_selected_and_point_valid);
item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", mAttachmentPoints.reverseLookup(attachment));
gAttachPieMenu->append(item);
attachment_found = TRUE;
@ -1979,9 +1980,9 @@ void LLVOAvatar::buildCharacter()
{
LLMenuItemCallGL* item;
item = new LLMenuItemCallGL(attachment->getName(),
&handle_attach_to_avatar,
object_selected_and_point_valid,
attachment);
NULL,
object_selected_and_point_valid);
item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", mAttachmentPoints.reverseLookup(attachment));
gAttachScreenPieMenu->append(item);
gDetachScreenPieMenu->append(new LLMenuItemCallGL(attachment->getName(),
&handle_detach_from_avatar, object_attached, attachment));
@ -1998,8 +1999,11 @@ void LLVOAvatar::buildCharacter()
{
continue;
}
gAttachSubMenu->append(new LLMenuItemCallGL(attachment->getName(),
&handle_attach_to_avatar, object_selected_and_point_valid, &attach_label, attachment));
LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(),
NULL, &object_selected_and_point_valid, &attach_label, NULL);
item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", mAttachmentPoints.reverseLookup(attachment));
gAttachSubMenu->append(item);
gDetachSubMenu->append(new LLMenuItemCallGL(attachment->getName(),
&handle_detach_from_avatar, object_attached, &detach_label, attachment));
@ -2049,8 +2053,10 @@ void LLVOAvatar::buildCharacter()
LLViewerJointAttachment* attachment = attach_it->second;
gAttachBodyPartPieMenus[group]->append(new LLMenuItemCallGL(attachment->getName(),
&handle_attach_to_avatar, object_selected_and_point_valid, attachment));
LLMenuItemCallGL* item = new LLMenuItemCallGL(attachment->getName(),
NULL, object_selected_and_point_valid);
gAttachBodyPartPieMenus[group]->append(item);
item->addListener(gMenuHolder->getListenerByName("Object.AttachToAvatar"), "on_click", mAttachmentPoints.reverseLookup(attachment));
gDetachBodyPartPieMenus[group]->append(new LLMenuItemCallGL(attachment->getName(),
&handle_detach_from_avatar, object_attached, attachment));
@ -2448,7 +2454,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
if (attached_object && !attached_object->isDead() && attachment->getValid())
{
// if selecting any attachments, update all of them as non-damped
if (gSelectMgr->getObjectCount() && gSelectMgr->selectionIsAttachment())
if (gSelectMgr->getSelection()->getObjectCount() && gSelectMgr->getSelection()->isAttachment())
{
gPipeline.updateMoveNormalAsync(attached_object->mDrawable);
}
@ -2905,22 +2911,24 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
if (!mBeam.isNull())
{
LLObjectSelectionHandle selection = gSelectMgr->getSelection();
if (gAgent.mPointAt.notNull())
{
// get point from pointat effect
mBeam->setPositionGlobal(gAgent.mPointAt->getPointAtPosGlobal());
mBeam->triggerLocal();
}
else if (gSelectMgr->getFirstRootObject() &&
gSelectMgr->getSelectType() != SELECT_TYPE_HUD)
else if (selection->getFirstRootObject() &&
selection->getSelectType() != SELECT_TYPE_HUD)
{
LLViewerObject* objectp = gSelectMgr->getFirstRootObject();
LLViewerObject* objectp = selection->getFirstRootObject();
mBeam->setTargetObject(objectp);
}
else
{
mBeam->setTargetObject(NULL);
LLTool *tool = gToolMgr->getCurrentTool( gKeyboard->currentMask(TRUE) );
LLTool *tool = gToolMgr->getCurrentTool();
if (tool->isEditing())
{
if (tool->getEditingObject())
@ -3654,7 +3662,7 @@ BOOL LLVOAvatar::needsRenderBeam()
{
return FALSE;
}
LLTool *tool = gToolMgr->getCurrentTool( gKeyboard->currentMask(TRUE) );
LLTool *tool = gToolMgr->getCurrentTool();
BOOL is_touching_or_grabbing = (tool == gToolGrab && gToolGrab->isEditing());
if (gToolGrab->getEditingObject() &&

View File

@ -2299,7 +2299,7 @@ void LLPipeline::stateSort()
{
LLViewerObject *vobjp;
S32 te;
gSelectMgr->getFirstTE(&vobjp,&te);
gSelectMgr->getSelection()->getFirstTE(&vobjp,&te);
while (vobjp)
{
@ -2351,7 +2351,7 @@ void LLPipeline::stateSort()
}
}
}
gSelectMgr->getNextTE(&vobjp,&te);
gSelectMgr->getSelection()->getNextTE(&vobjp,&te);
}
}
}