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.cpp37
1 files changed, 23 insertions, 14 deletions
diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp
index 259332a3ff..1b657d9ea1 100644
--- a/indra/newview/llpreviewtexture.cpp
+++ b/indra/newview/llpreviewtexture.cpp
@@ -129,6 +129,10 @@ void LLPreviewTexture::populateRatioList()
// virtual
bool LLPreviewTexture::postBuild()
{
+ mButtonsPanel = getChild<LLLayoutPanel>("buttons_panel");
+ mDimensionsText = getChild<LLUICtrl>("dimensions");
+ mAspectRatioText = getChild<LLUICtrl>("aspect_ratio");
+
if (mCopyToInv)
{
getChild<LLButton>("Keep")->setLabel(getString("Copy"));
@@ -346,15 +350,20 @@ void LLPreviewTexture::reshape(S32 width, S32 height, bool called_from_parent)
{
LLPreview::reshape(width, height, called_from_parent);
- LLRect dim_rect(getChildView("dimensions")->getRect());
-
S32 horiz_pad = 2 * (LLPANEL_BORDER_WIDTH + PREVIEW_PAD) + PREVIEW_RESIZE_HANDLE_SIZE;
// add space for dimensions and aspect ratio
- S32 info_height = dim_rect.mTop + CLIENT_RECT_VPAD;
- if (getChild<LLLayoutPanel>("buttons_panel")->getVisible())
+ S32 info_height = CLIENT_RECT_VPAD;
+
+ if (mDimensionsText)
+ {
+ LLRect dim_rect(mDimensionsText->getRect());
+ info_height += dim_rect.mTop;
+ }
+
+ if (mButtonsPanel && mButtonsPanel->getVisible())
{
- info_height += getChild<LLLayoutPanel>("buttons_panel")->getRect().getHeight();
+ info_height += mButtonsPanel->getRect().getHeight();
}
LLRect client_rect(horiz_pad, getRect().getHeight(), getRect().getWidth() - horiz_pad, 0);
client_rect.mTop -= (PREVIEW_HEADER_SIZE + CLIENT_RECT_VPAD);
@@ -404,8 +413,8 @@ void LLPreviewTexture::hideCtrlButtons()
{
getChildView("desc txt")->setVisible(false);
getChildView("desc")->setVisible(false);
- getChild<LLLayoutStack>("preview_stack")->collapsePanel(getChild<LLLayoutPanel>("buttons_panel"), true);
- getChild<LLLayoutPanel>("buttons_panel")->setVisible(false);
+ getChild<LLLayoutStack>("preview_stack")->collapsePanel(mButtonsPanel, true);
+ mButtonsPanel->setVisible(false);
getChild<LLComboBox>("combo_aspect_ratio")->setCurrentByIndex(0); //unconstrained
reshape(getRect().getWidth(), getRect().getHeight());
}
@@ -538,8 +547,8 @@ void LLPreviewTexture::updateDimensions()
// Update the width/height display every time
- getChild<LLUICtrl>("dimensions")->setTextArg("[WIDTH]", llformat("%d", img_width));
- getChild<LLUICtrl>("dimensions")->setTextArg("[HEIGHT]", llformat("%d", img_height));
+ mDimensionsText->setTextArg("[WIDTH]", llformat("%d", img_width));
+ mDimensionsText->setTextArg("[HEIGHT]", llformat("%d", img_height));
mLastHeight = img_height;
mLastWidth = img_width;
@@ -554,9 +563,9 @@ void LLPreviewTexture::updateDimensions()
gFloaterView->adjustToFitScreen(this, false);
- LLRect dim_rect(getChildView("dimensions")->getRect());
- LLRect aspect_label_rect(getChildView("aspect_ratio")->getRect());
- getChildView("aspect_ratio")->setVisible( dim_rect.mRight < aspect_label_rect.mLeft);
+ LLRect dim_rect(mDimensionsText->getRect());
+ LLRect aspect_label_rect(mAspectRatioText->getRect());
+ mAspectRatioText->setVisible( dim_rect.mRight < aspect_label_rect.mLeft);
}
}
@@ -657,7 +666,7 @@ void LLPreviewTexture::adjustAspectRatio()
S32 num = mImage->getFullWidth() / divisor;
S32 denom = mImage->getFullHeight() / divisor;
- if (setAspectRatio(num, denom))
+ if (setAspectRatio((F32)num, (F32)denom))
{
// Select corresponding ratio entry in the combo list
LLComboBox* combo = getChild<LLComboBox>("combo_aspect_ratio");
@@ -677,7 +686,7 @@ void LLPreviewTexture::adjustAspectRatio()
}
else
{
- combo->setCurrentByIndex(found - mRatiosList.begin());
+ combo->setCurrentByIndex((S32)(found - mRatiosList.begin()));
}
}
}