summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelface.cpp')
-rw-r--r--indra/newview/llpanelface.cpp102
1 files changed, 45 insertions, 57 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index e93a5be8ed..08a50d4b6e 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -62,6 +62,7 @@
#include "llviewerobject.h"
#include "llviewerstats.h"
#include "lluictrlfactory.h"
+#include "llpluginclassmedia.h"
//
// Methods
@@ -87,11 +88,10 @@ BOOL LLPanelFace::postBuild()
if(mTextureCtrl)
{
mTextureCtrl->setDefaultImageAssetID(LLUUID( gSavedSettings.getString( "DefaultObjectTexture" )));
- mTextureCtrl->setCommitCallback( LLPanelFace::onCommitTexture );
- mTextureCtrl->setOnCancelCallback( LLPanelFace::onCancelTexture );
- mTextureCtrl->setOnSelectCallback( LLPanelFace::onSelectTexture );
- mTextureCtrl->setDragCallback(LLPanelFace::onDragTexture);
- mTextureCtrl->setCallbackUserData( this );
+ mTextureCtrl->setCommitCallback( boost::bind(&LLPanelFace::onCommitTexture, this, _2) );
+ mTextureCtrl->setOnCancelCallback( boost::bind(&LLPanelFace::onCancelTexture, this, _2) );
+ mTextureCtrl->setOnSelectCallback( boost::bind(&LLPanelFace::onSelectTexture, this, _2) );
+ mTextureCtrl->setDragCallback(boost::bind(&LLPanelFace::onDragTexture, _2));
mTextureCtrl->setFollowsTop();
mTextureCtrl->setFollowsLeft();
// Don't allow (no copy) or (no transfer) textures to be selected during immediate mode
@@ -118,10 +118,9 @@ BOOL LLPanelFace::postBuild()
mColorSwatch = getChild<LLColorSwatchCtrl>("colorswatch");
if(mColorSwatch)
{
- mColorSwatch->setCommitCallback(LLPanelFace::onCommitColor);
- mColorSwatch->setOnCancelCallback(LLPanelFace::onCancelColor);
- mColorSwatch->setOnSelectCallback(LLPanelFace::onSelectColor);
- mColorSwatch->setCallbackUserData( this );
+ mColorSwatch->setCommitCallback(boost::bind(&LLPanelFace::onCommitColor, this, _2));
+ mColorSwatch->setOnCancelCallback(boost::bind(&LLPanelFace::onCancelColor, this, _2));
+ mColorSwatch->setOnSelectCallback(boost::bind(&LLPanelFace::onSelectColor, this, _2));
mColorSwatch->setFollowsTop();
mColorSwatch->setFollowsLeft();
mColorSwatch->setCanApplyImmediately(TRUE);
@@ -137,8 +136,7 @@ BOOL LLPanelFace::postBuild()
mCtrlColorTransp = getChild<LLSpinCtrl>("ColorTrans");
if(mCtrlColorTransp)
{
- mCtrlColorTransp->setCommitCallback(LLPanelFace::onCommitAlpha);
- mCtrlColorTransp->setCallbackUserData(this);
+ mCtrlColorTransp->setCommitCallback(boost::bind(&LLPanelFace::onCommitAlpha, this, _2));
mCtrlColorTransp->setPrecision(0);
mCtrlColorTransp->setFollowsTop();
mCtrlColorTransp->setFollowsLeft();
@@ -147,23 +145,20 @@ BOOL LLPanelFace::postBuild()
mCheckFullbright = getChild<LLCheckBoxCtrl>("checkbox fullbright");
if (mCheckFullbright)
{
- mCheckFullbright->setCommitCallback(LLPanelFace::onCommitFullbright);
- mCheckFullbright->setCallbackUserData( this );
+ mCheckFullbright->setCommitCallback(LLPanelFace::onCommitFullbright, this);
}
mComboTexGen = getChild<LLComboBox>("combobox texgen");
if(mComboTexGen)
{
- mComboTexGen->setCommitCallback(LLPanelFace::onCommitTexGen);
+ mComboTexGen->setCommitCallback(LLPanelFace::onCommitTexGen, this);
mComboTexGen->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP);
- mComboTexGen->setCallbackUserData( this );
}
mCtrlGlow = getChild<LLSpinCtrl>("glow");
if(mCtrlGlow)
{
- mCtrlGlow->setCommitCallback(LLPanelFace::onCommitGlow);
- mCtrlGlow->setCallbackUserData(this);
+ mCtrlGlow->setCommitCallback(LLPanelFace::onCommitGlow, this);
}
childSetCommitCallback("combobox shininess",&LLPanelFace::onCommitShiny,this);
@@ -183,8 +178,8 @@ BOOL LLPanelFace::postBuild()
return TRUE;
}
-LLPanelFace::LLPanelFace(const std::string& name)
-: LLPanel(name)
+LLPanelFace::LLPanelFace()
+: LLPanel()
{
}
@@ -392,11 +387,6 @@ void LLPanelFace::getState()
childSetEnabled("button align",FALSE);
//mBtnAutoFix->setEnabled ( FALSE );
- if(LLViewerMedia::hasMedia())
- {
- childSetEnabled("textbox autofix",editable);
- childSetEnabled("button align",editable);
- }
//if ( LLMediaEngine::getInstance()->getMediaRenderer () )
// if ( LLMediaEngine::getInstance()->getMediaRenderer ()->isLoaded () )
// {
@@ -417,7 +407,7 @@ void LLPanelFace::getState()
{
LLUUID get(LLViewerObject* object, S32 te)
{
- LLViewerImage* image = object->getTEImage(te);
+ LLViewerTexture* image = object->getTEImage(te);
return image ? image->getID() : LLUUID::null;
}
} func;
@@ -453,7 +443,15 @@ void LLPanelFace::getState()
}
}
}
+
+ if(LLViewerMedia::textureHasMedia(id))
+ {
+ childSetEnabled("textbox autofix",editable);
+ childSetEnabled("button align",editable);
+ }
+
}
+
LLAggregatePermissions texture_perms;
if(texture_ctrl)
@@ -807,32 +805,25 @@ F32 LLPanelFace::valueGlow(LLViewerObject* object, S32 face)
}
-// static
-void LLPanelFace::onCommitColor(LLUICtrl* ctrl, void* userdata)
+void LLPanelFace::onCommitColor(const LLSD& data)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- self->sendColor();
+ sendColor();
}
-// static
-void LLPanelFace::onCommitAlpha(LLUICtrl* ctrl, void* userdata)
+void LLPanelFace::onCommitAlpha(const LLSD& data)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
- self->sendAlpha();
+ sendAlpha();
}
-// static
-void LLPanelFace::onCancelColor(LLUICtrl* ctrl, void* userdata)
+void LLPanelFace::onCancelColor(const LLSD& data)
{
LLSelectMgr::getInstance()->selectionRevertColors();
}
-// static
-void LLPanelFace::onSelectColor(LLUICtrl* ctrl, void* userdata)
+void LLPanelFace::onSelectColor(const LLSD& data)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
LLSelectMgr::getInstance()->saveSelectedObjectColors();
- self->sendColor();
+ sendColor();
}
// static
@@ -871,7 +862,7 @@ void LLPanelFace::onCommitGlow(LLUICtrl* ctrl, void* userdata)
}
// static
-BOOL LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item, void*)
+BOOL LLPanelFace::onDragTexture(LLInventoryItem* item)
{
BOOL accept = TRUE;
for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin();
@@ -888,28 +879,21 @@ BOOL LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item, void*)
return accept;
}
-// static
-void LLPanelFace::onCommitTexture( LLUICtrl* ctrl, void* userdata )
+void LLPanelFace::onCommitTexture( const LLSD& data )
{
- LLPanelFace* self = (LLPanelFace*) userdata;
-
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_EDIT_TEXTURE_COUNT );
-
- self->sendTexture();
+ sendTexture();
}
-// static
-void LLPanelFace::onCancelTexture(LLUICtrl* ctrl, void* userdata)
+void LLPanelFace::onCancelTexture(const LLSD& data)
{
LLSelectMgr::getInstance()->selectionRevertTextures();
}
-// static
-void LLPanelFace::onSelectTexture(LLUICtrl* ctrl, void* userdata)
+void LLPanelFace::onSelectTexture(const LLSD& data)
{
- LLPanelFace* self = (LLPanelFace*) userdata;
LLSelectMgr::getInstance()->saveSelectedObjectTextures();
- self->sendTexture();
+ sendTexture();
}
@@ -939,14 +923,18 @@ struct LLPanelFaceSetMediaFunctor : public LLSelectedTEFunctor
{
virtual bool apply(LLViewerObject* object, S32 te)
{
+ // TODO: the media impl pointer should actually be stored by the texture
+ viewer_media_t pMediaImpl = LLViewerMedia::getMediaImplFromTextureID(object->getTE ( te )->getID());
// only do this if it's a media texture
- if ( object->getTE ( te )->getID() == LLViewerMedia::getMediaTextureID() )
+ if ( pMediaImpl.notNull())
{
- S32 media_width, media_height;
- S32 texture_width, texture_height;
- if ( LLViewerMedia::getMediaSize( &media_width, &media_height )
- && LLViewerMedia::getTextureSize( &texture_width, &texture_height ) )
+ LLPluginClassMedia *media = pMediaImpl->getMediaPlugin();
+ if(media)
{
+ S32 media_width = media->getWidth();
+ S32 media_height = media->getHeight();
+ S32 texture_width = media->getTextureWidth();
+ S32 texture_height = media->getTextureHeight();
F32 scale_s = (F32)media_width / (F32)texture_width;
F32 scale_t = (F32)media_height / (F32)texture_height;