Make multi texture preview behave nicely (images fit into the multi floater and multi floater adjusts its size depending on current image)

Ansariel 2014-01-27 15:30:49 +01:00
parent 92cc46cbc8
commit 0f04623c8c
3 changed files with 22 additions and 9 deletions

View File

@ -55,6 +55,7 @@
#include "llpreviewnotecard.h"
#include "llpreviewscript.h"
// [/SL:KB]
#include "llpreviewtexture.h"
// Constants
@ -512,6 +513,14 @@ void LLMultiPreview::tabOpen(LLFloater* opened_floater, bool from_click)
opened_preview->loadAsset();
}
// <FS:Ansariel> Update preview dimensions for multi texture preview upon tab change
LLPreviewTexture* texture_preview = dynamic_cast<LLPreviewTexture*>(opened_floater);
if (texture_preview)
{
texture_preview->setUpdateDimensions(TRUE);
}
// </FS:Ansariel>
// [SL:KB] - Patch: UI-FloaterSearchReplace | Checked: 2010-11-05 (Catznip-2.3.0a) | Added: Catznip-2.3.0a
LLFloaterSearchReplace* pSearchFloater = LLFloaterReg::getTypedInstance<LLFloaterSearchReplace>("search_replace");
if ( (pSearchFloater) && (pSearchFloater->getDependee() == this) )

View File

@ -606,7 +606,7 @@ void LLPreviewTexture::updateDimensions()
{
mUpdateDimensions = FALSE;
// <Ansariel>: Show image at full resolution if possible
// <FS:Ansariel>: Show image at full resolution if possible
//reshape floater
//reshape(getRect().getWidth(), getRect().getHeight());
@ -760,16 +760,17 @@ void LLPreviewTexture::updateDimensions()
floater_target_height = llmax(floater_target_height, getMinHeight());
// Resize floater
if (getHost())
LLMultiFloater* host = getHost();
if (host)
{
getHost()->growToFit(floater_target_width, floater_target_height);
S32 old_height = host->getRect().getHeight();
host->reshape(getMinWidth(), getMinHeight());
host->translate(0, old_height - getMinHeight());
host->growToFit(floater_target_width, floater_target_height);
}
else
{
reshape(floater_target_width, floater_target_height);
gFloaterView->adjustToFitScreen(this, FALSE);
}
// </Ansariel>: Show image at full resolution if possible
reshape(floater_target_width, floater_target_height);
gFloaterView->adjustToFitScreen(this, FALSE);
// </FS:Ansariel>: Show image at full resolution if possible
LLRect dim_rect(getChildView("dimensions")->getRect());
LLRect aspect_label_rect(getChildView("aspect_ratio")->getRect());

View File

@ -91,6 +91,9 @@ public:
void onButtonClickUUID();
static void onTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
// </FS:Techwolf Lupindo>
// <FS:Ansariel> For requesting dimensions update
void setUpdateDimensions(BOOL update) { mUpdateDimensions = update; }
protected:
void init();