summaryrefslogtreecommitdiff
path: root/indra/newview/llpreviewtexture.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpreviewtexture.cpp')
-rw-r--r--indra/newview/llpreviewtexture.cpp41
1 files changed, 21 insertions, 20 deletions
diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp
index 22a1ef94a7..c1cb386556 100644
--- a/indra/newview/llpreviewtexture.cpp
+++ b/indra/newview/llpreviewtexture.cpp
@@ -75,7 +75,8 @@ LLPreviewTexture::LLPreviewTexture(const LLSD& key)
mLastWidth(0),
mAspectRatio(0.f),
mPreviewToSave(FALSE),
- mImage(NULL)
+ mImage(NULL),
+ mImageOldBoostLevel(LLViewerTexture::BOOST_NONE)
{
updateImageID();
if (key.has("save_as"))
@@ -87,11 +88,13 @@ LLPreviewTexture::LLPreviewTexture(const LLSD& key)
LLPreviewTexture::~LLPreviewTexture()
{
+ LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList) ;
+
if( mLoadingFullImage )
{
getWindow()->decBusyCount();
}
-
+ mImage->setBoostLevel(mImageOldBoostLevel);
mImage = NULL;
}
@@ -102,7 +105,7 @@ BOOL LLPreviewTexture::postBuild()
{
getChild<LLButton>("Keep")->setLabel(getString("Copy"));
childSetAction("Keep",LLPreview::onBtnCopyToInv,this);
- childSetVisible("Discard", false);
+ getChildView("Discard")->setVisible( false);
}
else if (mShowKeepDiscard)
{
@@ -111,13 +114,13 @@ BOOL LLPreviewTexture::postBuild()
}
else
{
- childSetVisible("Keep", false);
- childSetVisible("Discard", false);
+ getChildView("Keep")->setVisible( false);
+ getChildView("Discard")->setVisible( false);
}
childSetAction("save_tex_btn", LLPreviewTexture::onSaveAsBtn, this);
- childSetVisible("save_tex_btn", true);
- childSetEnabled("save_tex_btn", canSaveAs());
+ getChildView("save_tex_btn")->setVisible( true);
+ getChildView("save_tex_btn")->setEnabled(canSaveAs());
if (!mCopyToInv)
{
@@ -126,8 +129,8 @@ BOOL LLPreviewTexture::postBuild()
if (item)
{
childSetCommitCallback("desc", LLPreview::onText, this);
- childSetText("desc", item->getDescription());
- childSetPrevalidate("desc", &LLTextValidate::validateASCIIPrintableNoPipe);
+ getChild<LLUICtrl>("desc")->setValue(item->getDescription());
+ getChild<LLLineEditor>("desc")->setPrevalidate(&LLTextValidate::validateASCIIPrintableNoPipe);
}
}
@@ -278,7 +281,7 @@ void LLPreviewTexture::saveAs()
mLoadingFullImage = TRUE;
getWindow()->incBusyCount();
mImage->setLoadedCallback( LLPreviewTexture::onFileLoadedForSave,
- 0, TRUE, FALSE, new LLUUID( mItemUUID ) );
+ 0, TRUE, FALSE, new LLUUID( mItemUUID ), &mCallbackTextureList );
}
// virtual
@@ -286,8 +289,7 @@ void LLPreviewTexture::reshape(S32 width, S32 height, BOOL called_from_parent)
{
LLPreview::reshape(width, height, called_from_parent);
- LLRect dim_rect;
- childGetRect("dimensions", dim_rect);
+ LLRect dim_rect(getChildView("dimensions")->getRect());
S32 horiz_pad = 2 * (LLPANEL_BORDER_WIDTH + PREVIEW_PAD) + PREVIEW_RESIZE_HANDLE_SIZE;
@@ -409,12 +411,11 @@ void LLPreviewTexture::updateDimensions()
mUpdateDimensions = FALSE;
- childSetTextArg("dimensions", "[WIDTH]", llformat("%d", mImage->getFullWidth()));
- childSetTextArg("dimensions", "[HEIGHT]", llformat("%d", mImage->getFullHeight()));
+ getChild<LLUICtrl>("dimensions")->setTextArg("[WIDTH]", llformat("%d", mImage->getFullWidth()));
+ getChild<LLUICtrl>("dimensions")->setTextArg("[HEIGHT]", llformat("%d", mImage->getFullHeight()));
- LLRect dim_rect;
- childGetRect("dimensions", dim_rect);
+ LLRect dim_rect(getChildView("dimensions")->getRect());
S32 horiz_pad = 2 * (LLPANEL_BORDER_WIDTH + PREVIEW_PAD) + PREVIEW_RESIZE_HANDLE_SIZE;
@@ -488,9 +489,8 @@ void LLPreviewTexture::updateDimensions()
// Hide the aspect ratio label if the window is too narrow
// Assumes the label should be to the right of the dimensions
- LLRect aspect_label_rect;
- childGetRect("aspect_ratio", aspect_label_rect);
- childSetVisible("aspect_ratio", dim_rect.mRight < aspect_label_rect.mLeft);
+ LLRect aspect_label_rect(getChildView("aspect_ratio")->getRect());
+ getChildView("aspect_ratio")->setVisible( dim_rect.mRight < aspect_label_rect.mLeft);
}
@@ -541,12 +541,13 @@ void LLPreviewTexture::onAspectRatioCommit(LLUICtrl* ctrl, void* userdata)
void LLPreviewTexture::loadAsset()
{
mImage = LLViewerTextureManager::getFetchedTexture(mImageID, MIPMAP_TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+ mImageOldBoostLevel = mImage->getBoostLevel();
mImage->setBoostLevel(LLViewerTexture::BOOST_PREVIEW);
mImage->forceToSaveRawImage(0) ;
mAssetStatus = PREVIEW_ASSET_LOADING;
mUpdateDimensions = TRUE;
updateDimensions();
- childSetEnabled("save_tex_btn", canSaveAs());
+ getChildView("save_tex_btn")->setEnabled(canSaveAs());
}
LLPreview::EAssetStatus LLPreviewTexture::getAssetStatus()