summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llfloaterbigpreview.cpp33
-rw-r--r--indra/newview/llfloaterbigpreview.h4
-rw-r--r--indra/newview/llfloaterflickr.cpp31
-rw-r--r--indra/newview/llfloaterflickr.h1
-rw-r--r--indra/newview/llsnapshotlivepreview.h1
-rw-r--r--indra/newview/skins/default/xui/en/panel_flickr_photo.xml5
6 files changed, 48 insertions, 27 deletions
diff --git a/indra/newview/llfloaterbigpreview.cpp b/indra/newview/llfloaterbigpreview.cpp
index d5f25d5f95..b516e9dd01 100644
--- a/indra/newview/llfloaterbigpreview.cpp
+++ b/indra/newview/llfloaterbigpreview.cpp
@@ -28,8 +28,6 @@
#include "llviewerprecompiledheaders.h"
#include "llfloaterbigpreview.h"
-
-#include "llfloaterreg.h"
#include "llsnapshotlivepreview.h"
///////////////////////
@@ -57,7 +55,7 @@ void LLFloaterBigPreview::onCancel()
void LLFloaterBigPreview::closeOnFloaterOwnerClosing(LLFloater* floaterp)
{
- if (floaterp == mFloaterOwner)
+ if (isFloaterOwner(floaterp))
{
closeFloater();
}
@@ -76,21 +74,25 @@ void LLFloaterBigPreview::draw()
LLSnapshotLivePreview * previewp = static_cast<LLSnapshotLivePreview *>(mPreviewHandle.get());
// Display the preview if one is available
- // HACK!!! We use the puny thumbnail image for the moment
- // *TODO : Use the real large preview
if (previewp && previewp->getBigThumbnailImage())
{
+ // Get the preview rect
const LLRect& preview_rect = mPreviewPlaceholder->getRect();
-// const S32 thumbnail_w = previewp->getThumbnailWidth();
-// const S32 thumbnail_h = previewp->getThumbnailHeight();
- // calc preview offset within the preview rect
-// const S32 local_offset_x = (preview_rect.getWidth() - thumbnail_w) / 2 ;
-// const S32 local_offset_y = (preview_rect.getHeight() - thumbnail_h) / 2 ;
- const S32 local_offset_x = 0 ;
- const S32 local_offset_y = 0 ;
+ // Get the preview texture size
+ S32 thumbnail_w = previewp->getBigThumbnailWidth();
+ S32 thumbnail_h = previewp->getBigThumbnailHeight();
+
+ // Compute the scaling ratio and the size of the final texture in the rect: we want to prevent anisotropic scaling (distorted in x and y)
+ F32 ratio = llmax((F32)(thumbnail_w)/(F32)(preview_rect.getWidth()), (F32)(thumbnail_h)/(F32)(preview_rect.getHeight()));
+ thumbnail_w = (S32)((F32)(thumbnail_w)/ratio);
+ thumbnail_h = (S32)((F32)(thumbnail_h)/ratio);
- // calc preview offset within the floater rect
+ // Compute the preview offset within the preview rect: we want to center that preview in the available rect
+ const S32 local_offset_x = (preview_rect.getWidth() - thumbnail_w) / 2 ;
+ const S32 local_offset_y = (preview_rect.getHeight() - thumbnail_h) / 2 ;
+
+ // Compute preview offset within the floater rect
S32 offset_x = preview_rect.mLeft + local_offset_x;
S32 offset_y = preview_rect.mBottom + local_offset_y;
@@ -98,9 +100,10 @@ void LLFloaterBigPreview::draw()
// Apply floater transparency to the texture unless the floater is focused.
F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
LLColor4 color = LLColor4::white;
+
+ // Draw the preview texture
gl_draw_scaled_image(offset_x, offset_y,
- //thumbnail_w, thumbnail_h,
- preview_rect.getWidth(), preview_rect.getHeight(),
+ thumbnail_w, thumbnail_h,
previewp->getBigThumbnailImage(), color % alpha);
}
}
diff --git a/indra/newview/llfloaterbigpreview.h b/indra/newview/llfloaterbigpreview.h
index 91b0968e88..63c6784d36 100644
--- a/indra/newview/llfloaterbigpreview.h
+++ b/indra/newview/llfloaterbigpreview.h
@@ -28,9 +28,6 @@
#define LL_LLFLOATERBIGPREVIEW_H
#include "llfloater.h"
-#include "llviewertexture.h"
-
-//class LLSnapshotLivePreview;
class LLFloaterBigPreview : public LLFloater
{
@@ -44,6 +41,7 @@ public:
void setPreview(LLView* previewp) { mPreviewHandle = previewp->getHandle(); }
void setFloaterOwner(LLFloater* floaterp) { mFloaterOwner = floaterp; }
+ bool isFloaterOwner(LLFloater* floaterp) const { return (mFloaterOwner == floaterp); }
void closeOnFloaterOwnerClosing(LLFloater* floaterp);
private:
diff --git a/indra/newview/llfloaterflickr.cpp b/indra/newview/llfloaterflickr.cpp
index 21c619730c..e93adf1570 100644
--- a/indra/newview/llfloaterflickr.cpp
+++ b/indra/newview/llfloaterflickr.cpp
@@ -66,6 +66,7 @@ LLFlickrPhotoPanel::LLFlickrPhotoPanel() :
mSnapshotPanel(NULL),
mResolutionComboBox(NULL),
mRefreshBtn(NULL),
+mBtnPreview(NULL),
mWorkingLabel(NULL),
mThumbnailPlaceholder(NULL),
mTitleTextBox(NULL),
@@ -98,6 +99,7 @@ BOOL LLFlickrPhotoPanel::postBuild()
mFilterComboBox = getChild<LLUICtrl>("filters_combobox");
mFilterComboBox->setCommitCallback(boost::bind(&LLFlickrPhotoPanel::updateResolution, this, TRUE));
mRefreshBtn = getChild<LLUICtrl>("new_snapshot_btn");
+ mBtnPreview = getChild<LLButton>("big_preview_btn");
mWorkingLabel = getChild<LLUICtrl>("working_lbl");
mThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder");
mTitleTextBox = getChild<LLUICtrl>("photo_title");
@@ -162,8 +164,14 @@ void LLFlickrPhotoPanel::draw()
mResolutionComboBox->setEnabled(no_ongoing_connection);
mFilterComboBox->setEnabled(no_ongoing_connection);
mRefreshBtn->setEnabled(no_ongoing_connection);
+ mBtnPreview->setEnabled(no_ongoing_connection);
mLocationCheckbox->setEnabled(no_ongoing_connection);
+ // Toggle the button state as appropriate
+ LLFloaterBigPreview* big_preview_floater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview"));
+ bool preview_active = (big_preview_floater && big_preview_floater->getVisible() && big_preview_floater->isFloaterOwner(getParentByType<LLFloater>()));
+ mBtnPreview->setToggleState(preview_active);
+
// Display the preview if one is available
if (previewp && previewp->getThumbnailImage())
{
@@ -256,13 +264,22 @@ void LLFlickrPhotoPanel::onClickNewSnapshot()
void LLFlickrPhotoPanel::onClickBigPreview()
{
LLFloaterBigPreview* big_preview_floater = dynamic_cast<LLFloaterBigPreview*>(LLFloaterReg::getInstance("big_preview"));
- if (big_preview_floater)
- {
- LLSnapshotLivePreview* previewp = getPreviewView();
- big_preview_floater->setPreview(previewp);
- big_preview_floater->setFloaterOwner(getParentByType<LLFloater>());
- }
- LLFloaterReg::showInstance("big_preview");
+ bool preview_active = (big_preview_floater && big_preview_floater->getVisible() && big_preview_floater->isFloaterOwner(getParentByType<LLFloater>()));
+ // Toggle the preview
+ if (preview_active)
+ {
+ LLFloaterReg::hideInstance("big_preview");
+ }
+ else
+ {
+ if (big_preview_floater)
+ {
+ LLSnapshotLivePreview* previewp = getPreviewView();
+ big_preview_floater->setPreview(previewp);
+ big_preview_floater->setFloaterOwner(getParentByType<LLFloater>());
+ }
+ LLFloaterReg::showInstance("big_preview");
+ }
}
void LLFlickrPhotoPanel::onSend()
diff --git a/indra/newview/llfloaterflickr.h b/indra/newview/llfloaterflickr.h
index 9fa4a258e2..8a346c3166 100644
--- a/indra/newview/llfloaterflickr.h
+++ b/indra/newview/llfloaterflickr.h
@@ -76,6 +76,7 @@ private:
LLUICtrl * mRatingComboBox;
LLUICtrl * mPostButton;
LLUICtrl * mCancelButton;
+ LLButton * mBtnPreview;
};
class LLFlickrAccountPanel : public LLPanel
diff --git a/indra/newview/llsnapshotlivepreview.h b/indra/newview/llsnapshotlivepreview.h
index baf3531e69..0e918d165e 100644
--- a/indra/newview/llsnapshotlivepreview.h
+++ b/indra/newview/llsnapshotlivepreview.h
@@ -28,6 +28,7 @@
#define LL_LLSNAPSHOTLIVEPREVIEW_H
#include "llpanelsnapshot.h"
+#include "llviewertexture.h"
#include "llviewerwindow.h"
class LLImageJPEG;
diff --git a/indra/newview/skins/default/xui/en/panel_flickr_photo.xml b/indra/newview/skins/default/xui/en/panel_flickr_photo.xml
index 350c385cc3..8d8ef45c0d 100644
--- a/indra/newview/skins/default/xui/en/panel_flickr_photo.xml
+++ b/indra/newview/skins/default/xui/en/panel_flickr_photo.xml
@@ -95,11 +95,12 @@
<button
follows="right|top"
height="23"
- label="Big Preview"
+ label="Preview"
left="200"
top_pad="-19"
name="big_preview_btn"
- tool_tip="Click to open big preview"
+ tool_tip="Click to toggle preview"
+ is_toggle="true"
visible="true"
width="100" >
<button.commit_callback