Example #1
0
// virtual
BOOL LLPreviewTexture::postBuild()
{
	if (mCopyToInv) 
	{
		getChild<LLButton>("Keep")->setLabel(getString("Copy"));
		childSetAction("Keep",LLPreview::onBtnCopyToInv,this);
		getChildView("Discard")->setVisible( false);
	}
	else if (mShowKeepDiscard)
	{
		childSetAction("Keep",onKeepBtn,this);
		childSetAction("Discard",onDiscardBtn,this);
	}
	else
	{
		getChildView("Keep")->setVisible( false);
		getChildView("Discard")->setVisible( false);
	}
	
	childSetAction("save_tex_btn", LLPreviewTexture::onSaveAsBtn, this);
	getChildView("save_tex_btn")->setVisible( true);
	getChildView("save_tex_btn")->setEnabled(canSaveAs());
	
	if (!mCopyToInv) 
	{
		const LLInventoryItem* item = getItem();
		
		if (item)
		{
			childSetCommitCallback("desc", LLPreview::onText, this);
			getChild<LLUICtrl>("desc")->setValue(item->getDescription());
			getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
		}
	}

	// Fill in ratios list with common aspect ratio values
	mRatiosList.clear();
	mRatiosList.push_back(LLTrans::getString("Unconstrained"));
	mRatiosList.push_back("1:1");
	mRatiosList.push_back("4:3");
	mRatiosList.push_back("10:7");
	mRatiosList.push_back("3:2");
	mRatiosList.push_back("16:10");
	mRatiosList.push_back("16:9");
	mRatiosList.push_back("2:1");
	
	// Now fill combo box with provided list
	LLComboBox* combo = getChild<LLComboBox>("combo_aspect_ratio");
	combo->removeall();

	for (std::vector<std::string>::const_iterator it = mRatiosList.begin(); it != mRatiosList.end(); ++it)
	{
		combo->add(*it);
	}

	childSetCommitCallback("combo_aspect_ratio", onAspectRatioCommit, this);
	combo->setCurrentByIndex(0);
	
	return LLPreview::postBuild();
}
// virtual
BOOL LLPreviewTexture::postBuild()
{
	if (mCopyToInv) 
	{
		getChild<LLButton>("Keep")->setLabel(getString("Copy"));
		childSetAction("Keep",LLPreview::onBtnCopyToInv,this);
		getChildView("Discard")->setVisible( false);
	}
	else if (mShowKeepDiscard)
	{
		childSetAction("Keep",onKeepBtn,this);
		childSetAction("Discard",onDiscardBtn,this);
	}
	else
	{
		getChildView("Keep")->setVisible( false);
		getChildView("Discard")->setVisible( false);
	}
	
	childSetAction("save_tex_btn", LLPreviewTexture::onSaveAsBtn, this);
	getChildView("save_tex_btn")->setVisible( true);
	getChildView("save_tex_btn")->setEnabled(canSaveAs());
	
	if (!mCopyToInv) 
	{
		const LLInventoryItem* item = getItem();
		
		if (item)
		{
			childSetCommitCallback("desc", LLPreview::onText, this);
			getChild<LLUICtrl>("desc")->setValue(item->getDescription());
			getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
		}
	}
	
	childSetCommitCallback("combo_aspect_ratio", onAspectRatioCommit, this);
	LLComboBox* combo = getChild<LLComboBox>("combo_aspect_ratio");
	combo->setCurrentByIndex(0);
	
	return LLPreview::postBuild();
}
// virtual
BOOL LLPreviewTexture::postBuild()
{
	if (mCopyToInv) 
	{
		getChild<LLButton>("Keep")->setLabel(getString("Copy"));
		childSetAction("Keep",LLPreview::onBtnCopyToInv,this);
		getChildView("Discard")->setVisible( false);
	}
	else if (mShowKeepDiscard)
	{
		childSetAction("Keep",onKeepBtn,this);
		childSetAction("Discard",onDiscardBtn,this);
	}
	else
	{
		getChildView("Keep")->setVisible( false);
		getChildView("Discard")->setVisible( false);
	}
	
	childSetCommitCallback("save_tex_btn", onSaveAsBtn, this);
	getChildView("save_tex_btn")->setVisible(canSaveAs()); // Ansariel: No need to show the save button if we can't save anyway
	getChildView("save_tex_btn")->setEnabled(canSaveAs());
	
	if (!mCopyToInv) 
	{
		const LLInventoryItem* item = getItem();
		
		if (item)
		{
			childSetCommitCallback("desc", LLPreview::onText, this);
			getChild<LLUICtrl>("desc")->setValue(item->getDescription());
			getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
		}
	}

	// Fill in ratios list with common aspect ratio values
	mRatiosList.clear();
	mRatiosList.push_back(LLTrans::getString("Unconstrained"));
	mRatiosList.push_back("1:1");
	mRatiosList.push_back("4:3");
	mRatiosList.push_back("10:7");
	mRatiosList.push_back("3:2");
	mRatiosList.push_back("16:10");
	mRatiosList.push_back("16:9");
	mRatiosList.push_back("2:1");
	
	// Now fill combo box with provided list
	LLComboBox* combo = getChild<LLComboBox>("combo_aspect_ratio");
	combo->removeall();

	for (std::vector<std::string>::const_iterator it = mRatiosList.begin(); it != mRatiosList.end(); ++it)
	{
		combo->add(*it);
	}

	childSetCommitCallback("combo_aspect_ratio", onAspectRatioCommit, this);
	combo->setCurrentByIndex(0);

	// <FS:Techwolf Lupindo> texture comment metadata reader
	getChild<LLButton>("openprofile")->setClickedCallback(boost::bind(&LLPreviewTexture::onButtonClickProfile, this));
	getChild<LLButton>("copyuuid")->setClickedCallback(boost::bind(&LLPreviewTexture::onButtonClickUUID, this));
	mUploaderDateTime = getString("UploaderDateTime");
	// </FS:Techwolf Lupindo>

	// <FS:Ansariel> AnsaStorm skin: Need to disable line editors from
	//               code or the floater would be dragged around if
	//               trying to mark text
	if (findChild<LLLineEditor>("uploader"))
	{
		getChild<LLLineEditor>("uploader")->setEnabled(FALSE);
		getChild<LLLineEditor>("upload_time")->setEnabled(FALSE);
		getChild<LLLineEditor>("uuid")->setEnabled(FALSE);
	}
	// </FS:Ansariel>

	// <FS:Ansariel> Performance improvement
	mDimensionsCtrl = getChild<LLUICtrl>("dimensions");

	return LLPreview::postBuild();
}