In Freeze Time re-show fullscreen preview when clicking thumbnail.

This commit is contained in:
Aleric Inglewood
2012-12-15 02:20:53 +01:00
parent cfa8df0575
commit e0c0da7dff
4 changed files with 44 additions and 10 deletions

View File

@@ -2645,6 +2645,12 @@ BOOL LLFloaterSnapshot::postBuild()
return TRUE;
}
LLRect LLFloaterSnapshot::getThumbnailAreaRect()
{
// getRect() includes shadows and the title bar, therefore the real corners are as follows:
return LLRect(1, getRect().getHeight() - 17, getRect().getWidth() - 1, getRect().getHeight() - 17 - THUMBHEIGHT);
}
void LLFloaterSnapshot::draw()
{
LLSnapshotLivePreview* previewp = impl.getPreviewView(this);
@@ -2661,17 +2667,13 @@ void LLFloaterSnapshot::draw()
{
if(previewp->getThumbnailImage())
{
// getRect() includes shadows and the title bar, therefore the real corners are as follows:
S32 const left = 1;
S32 const right = getRect().getWidth() - 1;
S32 const top = getRect().getHeight() - 17;
S32 const bottom = top - THUMBHEIGHT;
LLRect const thumb_area = getThumbnailAreaRect();
// The offset needed to center the thumbnail is: center - thumbnailSize/2 =
S32 offset_x = (left + right - previewp->getThumbnailWidth()) / 2;
S32 offset_y = (bottom + top - previewp->getThumbnailHeight()) / 2;
S32 offset_x = (thumb_area.mLeft + thumb_area.mRight - previewp->getThumbnailWidth()) / 2;
S32 offset_y = (thumb_area.mBottom + thumb_area.mTop - previewp->getThumbnailHeight()) / 2;
gGL.matrixMode(LLRender::MM_MODELVIEW);
gl_rect_2d(left, top, right, bottom, LLColor4::grey4, true);
gl_rect_2d(thumb_area, LLColor4::grey4, true);
gl_draw_scaled_image(offset_x, offset_y,
previewp->getThumbnailWidth(), previewp->getThumbnailHeight(),
previewp->getThumbnailImage(), LLColor4::white);
@@ -2776,6 +2778,34 @@ BOOL LLFloaterSnapshot::handleKeyHere(KEY key, MASK mask)
return LLFloater::handleKeyHere(key, mask);
}
BOOL LLFloaterSnapshot::handleMouseDown(S32 x, S32 y, MASK mask)
{
if (mask == MASK_NONE)
{
LLRect thumb_area = getThumbnailAreaRect();
if (thumb_area.pointInRect(x, y))
{
return TRUE;
}
}
return LLFloater::handleMouseDown(x, y, mask);
}
BOOL LLFloaterSnapshot::handleMouseUp(S32 x, S32 y, MASK mask)
{
if (mask == MASK_NONE)
{
// In FreezeTime mode, show preview again (after user pressed ESC) when
// clicking on the thumbnail area.
LLRect thumb_area = getThumbnailAreaRect();
if (thumb_area.pointInRect(x, y))
{
impl.updateControls(this);
return TRUE;
}
}
return LLFloater::handleMouseUp(x, y, mask);
}
///----------------------------------------------------------------------------
/// Class LLSnapshotFloaterView

View File

@@ -54,11 +54,15 @@ public:
LLFloaterSnapshot();
virtual ~LLFloaterSnapshot();
LLRect getThumbnailAreaRect();
/*virtual*/ BOOL postBuild();
/*virtual*/ void draw();
/*virtual*/ void onClose(bool app_quitting);
/*virtual*/ void onOpen();
/*virtual*/ BOOL handleKeyHere(KEY key, MASK mask);
/*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
/*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
static void show(void*);
static void hide(void*);

View File

@@ -2878,7 +2878,7 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
if (mFreezeTimeHidden)
{
return TRUE;
return;
}
checkTextureLoading() ;

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater bottom="-300" can_close="true" can_drag_on_left="false" can_minimize="false"
can_resize="false" follows="left|top" height="629" name="Snapshot"
can_resize="false" follows="left|top" height="629" name="Snapshot"
rect_control="FloaterSnapshotRect" title="Snapshot Preview" width="219">
<text bottom="-201" right="-6" height="25" name="file_size_label" halign="right" width="120">
File size: [SIZE] KB