// static
void LLFloaterBuyContents::show(const LLSaleInfo& sale_info)
{
	LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();

	if (selection->getRootObjectCount() != 1)
	{
		LLNotificationsUtil::add("BuyContentsOneOnly");
		return;
	}
	
	LLFloaterBuyContents* floater = LLFloaterReg::showTypedInstance<LLFloaterBuyContents>("buy_object_contents");
	if (!floater)
		return;
	
	LLScrollListCtrl* list = floater->getChild<LLScrollListCtrl>("item_list");
	if (list)
		list->deleteAllItems();

	floater->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();

	LLUUID owner_id;
	std::string owner_name;
	BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
	if (!owners_identical)
	{
		LLNotificationsUtil::add("BuyContentsOneOwner");
		return;
	}

	floater->mSaleInfo = sale_info;

	// Update the display
	LLSelectNode* node = selection->getFirstRootNode();
	if (!node) return;
	if(node->mPermissions->isGroupOwned())
	{
		gCacheName->getGroupName(owner_id, owner_name);
	}

	floater->getChild<LLUICtrl>("contains_text")->setTextArg("[NAME]", node->mName);
	floater->getChild<LLUICtrl>("buy_text")->setTextArg("[AMOUNT]", llformat("%d", sale_info.getSalePrice()));
	floater->getChild<LLUICtrl>("buy_text")->setTextArg("[NAME]", owner_name);
	std::string type_currency = LLGridManager::getInstance()->getCurrency();
	floater->getChild<LLUICtrl>("buy_text")->setTextArg("[CUR]", type_currency);
	// Must do this after the floater is created, because
	// sometimes the inventory is already there and 
	// the callback is called immediately.
	LLViewerObject* obj = selection->getFirstRootObject();
	floater->registerVOInventoryListener(obj,NULL);
	floater->requestVOInventory();
}
// Checked: 2010-04-11 (RLVa-1.2.0b) | Modified: RLVa-0.2.0g
bool rlvCanDeleteOrReturn()
{
	bool fIsAllowed = true;

	if (gRlvHandler.hasBehaviour(RLV_BHVR_REZ))
	{
		// We'll allow if none of the prims are owned by the avie or group owned
		LLObjectSelectionHandle handleSel = LLSelectMgr::getInstance()->getSelection();
		RlvSelectIsOwnedByOrGroupOwned f(gAgent.getID());
		if ( (handleSel.notNull()) && ((0 == handleSel->getRootObjectCount()) || (NULL != handleSel->getFirstRootNode(&f, FALSE))) )
			fIsAllowed = false;
	}
	
	if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (gAgent.getAvatarObject()) )
	{
		// We'll allow if the avie isn't sitting on any of the selected objects
		LLObjectSelectionHandle handleSel = LLSelectMgr::getInstance()->getSelection();
		RlvSelectIsSittingOn f(gAgent.getAvatarObject()->getRoot());
		if ( (handleSel.notNull()) && (handleSel->getFirstRootNode(&f, TRUE)) )
			fIsAllowed = false;
	}

	return fIsAllowed;
}
// static
void LLFloaterBuy::show(const LLSaleInfo& sale_info)
{
	LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();

	if (selection->getRootObjectCount() != 1)
	{
		LLNotificationsUtil::add("BuyOneObjectOnly");
		return;
	}
	
	LLFloaterBuy* floater = LLFloaterReg::showTypedInstance<LLFloaterBuy>("buy_object");
	if (!floater)
		return;
	
	// Clean up the lists...
	floater->reset();
	floater->mSaleInfo = sale_info;
	floater->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();
	
	LLSelectNode* node = selection->getFirstRootNode();
	if (!node)
		return;
	
	// Set title based on sale type
	LLUIString title;
	switch (sale_info.getSaleType())
	{
	  case LLSaleInfo::FS_ORIGINAL:
		title = floater->getString("title_buy_text");
		break;
	  case LLSaleInfo::FS_COPY:
	  default:
		title = floater->getString("title_buy_copy_text");
		break;
	}
	title.setArg("[NAME]", node->mName);
	floater->setTitle(title);

	LLUUID owner_id;
	std::string owner_name;
	BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
	if (!owners_identical)
	{
		LLNotificationsUtil::add("BuyObjectOneOwner");
		return;
	}

	LLCtrlListInterface *object_list = floater->childGetListInterface("object_list");
	if (!object_list)
	{
		return;
	}

	// Update the display
	// Display next owner permissions
	LLSD row;

	// Compute icon for this item
	std::string icon_name = LLInventoryIcon::getIconName(LLAssetType::AT_OBJECT, 
									 LLInventoryType::IT_OBJECT);

	row["columns"][0]["column"] = "icon";
	row["columns"][0]["type"] = "icon";
	row["columns"][0]["value"] = icon_name;
	
	// Append the permissions that you will acquire (not the current
	// permissions).
	U32 next_owner_mask = node->mPermissions->getMaskNextOwner();
	std::string text = node->mName;
	if (!(next_owner_mask & PERM_COPY))
	{
		text.append(floater->getString("no_copy_text"));
	}
	if (!(next_owner_mask & PERM_MODIFY))
	{
		text.append(floater->getString("no_modify_text"));
	}
	if (!(next_owner_mask & PERM_TRANSFER))
	{
		text.append(floater->getString("no_transfer_text"));
	}

	row["columns"][1]["column"] = "text";
	row["columns"][1]["value"] = text;
	row["columns"][1]["font"] = "SANSSERIF";

	// Add after columns added so appropriate heights are correct.
	object_list->addElement(row);

	floater->getChild<LLUICtrl>("buy_text")->setTextArg("[AMOUNT]", llformat("%d", sale_info.getSalePrice()));
	floater->getChild<LLUICtrl>("buy_name_text")->setTextArg("[NAME]", owner_name);

	// Must do this after the floater is created, because
	// sometimes the inventory is already there and 
	// the callback is called immediately.
	LLViewerObject* obj = selection->getFirstRootObject();
	floater->registerVOInventoryListener(obj,NULL);
	floater->requestVOInventory();
}
Пример #4
0
// static
void LLFloaterBuyContents::show(const LLSaleInfo& sale_info)
{
	LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();

	if (selection->getRootObjectCount() != 1)
	{
		LLNotifications::instance().add("BuyContentsOneOnly");
		return;
	}

	// Create a new instance only if needed
	if (sInstance)
	{
		LLScrollListCtrl* list = sInstance->getChild<LLScrollListCtrl>("item_list");
		if (list) list->deleteAllItems();
	}
	else
	{
		sInstance = new LLFloaterBuyContents();
	}

	sInstance->open(); /*Flawfinder: ignore*/
	sInstance->setFocus(TRUE);
	sInstance->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();

	// Always center the dialog.  User can change the size,
	// but purchases are important and should be center screen.
	// This also avoids problems where the user resizes the application window
	// mid-session and the saved rect is off-center.
	sInstance->center();

	LLUUID owner_id;
	std::string owner_name;
	BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
	if (!owners_identical)
	{
		LLNotifications::instance().add("BuyContentsOneOwner");
		return;
	}

	sInstance->mSaleInfo = sale_info;

	// Update the display
	LLSelectNode* node = selection->getFirstRootNode();
	if (!node) return;
	if(node->mPermissions->isGroupOwned())
	{
		gCacheName->getGroupName(owner_id, owner_name);
	}

	sInstance->childSetTextArg("contains_text", "[NAME]", node->mName);
	sInstance->childSetTextArg("buy_text", "[AMOUNT]", llformat("%d", sale_info.getSalePrice()));
	sInstance->childSetTextArg("buy_text", "[NAME]", owner_name);

	// Must do this after the floater is created, because
	// sometimes the inventory is already there and 
	// the callback is called immediately.
	LLViewerObject* obj = selection->getFirstRootObject();
	sInstance->registerVOInventoryListener(obj,NULL);
	sInstance->requestVOInventory();
}
Пример #5
0
void LLToolMgr::toggleBuildMode()
{
    if (inBuildMode())
    {
        if (gSavedSettings.getBOOL("EditCameraMovement"))
        {
            // just reset the view, will pull us out of edit mode
            handle_reset_view();
        }
        else
        {
            // manually disable edit mode, but do not affect the camera
            gAgentCamera.resetView(false);
            gFloaterTools->close();
            gViewerWindow->showCursor();
        }
        // avoid spurious avatar movements pulling out of edit mode
        LLViewerJoystick::getInstance()->setNeedsReset();
    }
    else
    {
        ECameraMode camMode = gAgentCamera.getCameraMode();
        if (CAMERA_MODE_MOUSELOOK == camMode ||	CAMERA_MODE_CUSTOMIZE_AVATAR == camMode)
        {
            // pull the user out of mouselook or appearance mode when entering build mode
            handle_reset_view();
        }

        if (gSavedSettings.getBOOL("EditCameraMovement"))
        {
            // camera should be set
            if (LLViewerJoystick::getInstance()->getOverrideCamera())
            {
                handle_toggle_flycam();
            }

            if (gAgentCamera.getFocusOnAvatar())
            {
                // zoom in if we're looking at the avatar
                gAgentCamera.setFocusOnAvatar(FALSE, ANIMATE);
                gAgentCamera.setFocusGlobal(gAgent.getPositionGlobal() + 2.0 * LLVector3d(gAgent.getAtAxis()));
                gAgentCamera.cameraZoomIn(0.666f);
                gAgentCamera.cameraOrbitOver( 30.f * DEG_TO_RAD );
            }
        }

// [RLVa:KB] - Checked: 2009-07-05 (RLVa-1.0.0b)
        bool fRlvCanEdit = (!gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) && (!gRlvHandler.hasBehaviour(RLV_BHVR_EDITOBJ));
        if (!fRlvCanEdit)
        {
            LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection();
            RlvSelectIsEditable f;
            if ((hSel.notNull()) && ((hSel->getFirstRootNode(&f, TRUE)) != NULL))
                LLSelectMgr::getInstance()->deselectAll();
        }
// [/RLVa:KB]

        setCurrentToolset(gBasicToolset);
        getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() );

        // Could be first use
        LLFirstUse::useBuild();

        gAgentCamera.resetView(false);

        // avoid spurious avatar movements
        LLViewerJoystick::getInstance()->setNeedsReset();

    }
}
Пример #6
0
// static
void LLFloaterBuy::show(const LLSaleInfo& sale_info)
{
	LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();

	if (selection->getRootObjectCount() != 1)
	{
		LLNotifications::instance().add("BuyOneObjectOnly");
		return;
	}

	// Create a new instance only if one doesn't exist
	if (sInstance)
	{
		// Clean up the lists...
		sInstance->reset();
	}
	else
	{
		sInstance = new LLFloaterBuy();
	}
	
	sInstance->open(); /*Flawfinder: ignore*/
	sInstance->setFocus(TRUE);
	sInstance->mSaleInfo = sale_info;
	sInstance->mObjectSelection = LLSelectMgr::getInstance()->getEditSelection();

	// Always center the dialog.  User can change the size,
	// but purchases are important and should be center screen.
	// This also avoids problems where the user resizes the application window
	// mid-session and the saved rect is off-center.
	sInstance->center();

	LLSelectNode* node = selection->getFirstRootNode();
	if (!node)
		return;

	// Set title based on sale type
	LLUIString title;
	switch (sale_info.getSaleType())
	{
	  case LLSaleInfo::FS_ORIGINAL:
		title = sInstance->getString("title_buy_text");
		break;
	  case LLSaleInfo::FS_COPY:
	  default:
		title = sInstance->getString("title_buy_copy_text");
		break;
	}
	title.setArg("[NAME]", node->mName);
	sInstance->setTitle(title);

	LLUUID owner_id;
	std::string owner_name;
	BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
	if (!owners_identical)
	{
		LLNotifications::instance().add("BuyObjectOneOwner");
		return;
	}

	LLCtrlListInterface *object_list = sInstance->childGetListInterface("object_list");
	if (!object_list)
	{
		return;
	}

	// Update the display
	// Display next owner permissions
	LLSD row;

	// Compute icon for this item
	std::string icon_name = get_item_icon_name(LLAssetType::AT_OBJECT, 
									 LLInventoryType::IT_OBJECT,
									 0x0, FALSE);

	row["columns"][0]["column"] = "icon";
	row["columns"][0]["type"] = "icon";
	row["columns"][0]["color"] = gColors.getColor("DefaultListIcon").getValue();
	row["columns"][0]["value"] = icon_name;
	
	// Append the permissions that you will acquire (not the current
	// permissions).
	U32 next_owner_mask = node->mPermissions->getMaskNextOwner();
	std::string text = node->mName;
	if (!(next_owner_mask & PERM_COPY))
	{
		text.append(sInstance->getString("no_copy_text"));
	}
	if (!(next_owner_mask & PERM_MODIFY))
	{
		text.append(sInstance->getString("no_modify_text"));
	}
	if (!(next_owner_mask & PERM_TRANSFER))
	{
		text.append(sInstance->getString("no_transfer_text"));
	}

	row["columns"][1]["column"] = "text";
	row["columns"][1]["color"] = gColors.getColor("DefaultListText").getValue();
	row["columns"][1]["value"] = text;
	row["columns"][1]["font"] = "SANSSERIF";

	// Add after columns added so appropriate heights are correct.
	object_list->addElement(row);

	sInstance->childSetTextArg("buy_text", "[AMOUNT]", llformat("%d", sale_info.getSalePrice()));
	sInstance->childSetTextArg("buy_text", "[NAME]", owner_name);

	// Must do this after the floater is created, because
	// sometimes the inventory is already there and 
	// the callback is called immediately.
	LLViewerObject* obj = selection->getFirstRootObject();
	sInstance->registerVOInventoryListener(obj,NULL);
	sInstance->requestVOInventory();
}