diff options
author | Merov Linden <merov@lindenlab.com> | 2013-07-03 19:29:42 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2013-07-03 19:29:42 -0700 |
commit | 6e8b353575f670e50267cb172860a3f8da1dbbd0 (patch) | |
tree | c80ba0b7eaa96b63526f07d3c6a968382ca8ee27 /indra | |
parent | e7cb0fe13be7f1b37d24cea5e8ea070cdcf7b5a6 (diff) |
ACME-626 : Simplify the preview drawing code and positioning
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llfloatersocial.cpp | 53 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_social.xml | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_social_photo.xml | 53 |
3 files changed, 27 insertions, 82 deletions
diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index a0dbb7ea95..fce9d1b28f 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -178,76 +178,33 @@ void LLSocialPhotoPanel::draw() { LLSnapshotLivePreview * previewp = static_cast<LLSnapshotLivePreview *>(mPreviewHandle.get()); - LLPanel::draw(); - - if(previewp && previewp->getThumbnailImage()) + if (previewp && previewp->getThumbnailImage()) { - bool working = false; //impl.getStatus() == Impl::STATUS_WORKING; const LLRect& thumbnail_rect = mThumbnailPlaceholder->getRect(); + const LLRect& snapshot_rect = mSnapshotPanel->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 = (thumbnail_rect.getWidth() - thumbnail_w) / 2 ; - const S32 local_offset_y = (thumbnail_rect.getHeight() - thumbnail_h) / 2 ; // preview y pos within the preview rect // calc preview offset within the floater rect S32 offset_x = thumbnail_rect.mLeft + local_offset_x; - S32 offset_y = thumbnail_rect.mBottom + local_offset_y; + S32 offset_y = thumbnail_rect.mBottom - (snapshot_rect.mTop - thumbnail_rect.mTop); mSnapshotPanel->localPointToOtherView(offset_x, offset_y, &offset_x, &offset_y, getParentByType<LLFloater>()); gGL.matrixMode(LLRender::MM_MODELVIEW); // Apply floater transparency to the texture unless the floater is focused. F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); - LLColor4 color = working ? LLColor4::grey4 : LLColor4::white; + LLColor4 color = LLColor4::white; gl_draw_scaled_image(offset_x, offset_y, thumbnail_w, thumbnail_h, previewp->getThumbnailImage(), color % alpha); previewp->drawPreviewRect(offset_x, offset_y) ; - - // Draw some controls on top of the preview thumbnail. - static const S32 PADDING = 5; - static const S32 REFRESH_LBL_BG_HEIGHT = 32; - - // Reshape and position the posting result message panels at the top of the thumbnail. - // Do this regardless of current posting status (finished or not) to avoid flicker - // when the result message is displayed for the first time. - // if (impl.getStatus() == Impl::STATUS_FINISHED) - { - LLRect result_lbl_rect = mSucceessLblPanel->getRect(); - const S32 result_lbl_h = result_lbl_rect.getHeight(); - result_lbl_rect.setLeftTopAndSize(local_offset_x, local_offset_y + thumbnail_h, thumbnail_w - 1, result_lbl_h); - mSucceessLblPanel->reshape(result_lbl_rect.getWidth(), result_lbl_h); - mSucceessLblPanel->setRect(result_lbl_rect); - mFailureLblPanel->reshape(result_lbl_rect.getWidth(), result_lbl_h); - mFailureLblPanel->setRect(result_lbl_rect); - } - - // Position the refresh button in the bottom left corner of the thumbnail. - mRefreshBtn->setOrigin(local_offset_x + PADDING, local_offset_y + PADDING); - - if (mNeedRefresh) - { - // Place the refresh hint text to the right of the refresh button. - const LLRect& refresh_btn_rect = mRefreshBtn->getRect(); - mRefreshLabel->setOrigin(refresh_btn_rect.mLeft + refresh_btn_rect.getWidth() + PADDING, refresh_btn_rect.mBottom); - - // Draw the refresh hint background. - LLRect refresh_label_bg_rect(offset_x, offset_y + REFRESH_LBL_BG_HEIGHT, offset_x + thumbnail_w - 1, offset_y); - gl_rect_2d(refresh_label_bg_rect, LLColor4::white % 0.9f, TRUE); - } - - gGL.pushUIMatrix(); - S32 x_pos; - S32 y_pos; - mSnapshotPanel->localPointToOtherView(thumbnail_rect.mLeft, thumbnail_rect.mBottom, &x_pos, &y_pos, getParentByType<LLFloater>()); - - LLUI::translate((F32) x_pos, (F32) y_pos); - mThumbnailPlaceholder->draw(); - gGL.popUIMatrix(); } + LLPanel::draw(); } LLSnapshotLivePreview* LLSocialPhotoPanel::getPreviewView() diff --git a/indra/newview/skins/default/xui/en/floater_social.xml b/indra/newview/skins/default/xui/en/floater_social.xml index 3ce6841a3a..40800c87e6 100644 --- a/indra/newview/skins/default/xui/en/floater_social.xml +++ b/indra/newview/skins/default/xui/en/floater_social.xml @@ -36,9 +36,6 @@ filename="panel_social_photo.xml" class="llsocialphotopanel" follows="all" - background_visible="true" - bg_alpha_color="DkGray" - bg_opaque_color="DkGray" label="PHOTO" help_topic="panel_social_photo" name="panel_social_photo"/> diff --git a/indra/newview/skins/default/xui/en/panel_social_photo.xml b/indra/newview/skins/default/xui/en/panel_social_photo.xml index c15b2f02d4..72e5286fe6 100644 --- a/indra/newview/skins/default/xui/en/panel_social_photo.xml +++ b/indra/newview/skins/default/xui/en/panel_social_photo.xml @@ -1,15 +1,15 @@ <panel height="395" width="304" + layout="topleft" name="panel_social_photo"> <layout_stack layout="topleft" border_size="0" height="395" - width="304" - follows="all" + follows="top|left|right" orientation="vertical" - name="stack1" + name="stack_photo" top="8"> <layout_panel name="photo_detail_panel" @@ -57,31 +57,28 @@ length="1" halign="right" name="file_size_label" - top="12" + top="9" type="string" width="50"> [SIZE] KB </text> - <ui_ctrl + <panel height="150" width="250" + visible="true" name="thumbnail_placeholder" - top_pad="5" + top="33" follows="left|top" left="9"> <panel background_visible="true" bg_alpha_color="0.9 1 0.9 1" follows="left|top" - font="SansSerifLarge" - halign="center" height="20" + width="250" + top="0" left="0" - length="1" name="succeeded_panel" - right="-1" - top="0" - type="string" visible="false"> <text follows="all" @@ -103,15 +100,11 @@ background_visible="true" bg_alpha_color="1 0.9 0.9 1" follows="left|top" - font="SansSerifLarge" - halign="center" height="20" - left_delta="0" - length="1" - name="failed_panel" - right="-1" + width="250" top="0" - type="string" + left="0" + name="failed_panel" visible="false"> <text follows="all" @@ -131,12 +124,12 @@ </panel> <loading_indicator follows="left|top" - height="48" + height="24" name="working_indicator" - left="101" - top="46" + left="113" + top="59" visible="false" - width="48" /> + width="24" /> <text follows="left|top|right" font="SansSerifBold" @@ -149,17 +142,16 @@ top="98" translate="false" type="string" - visible="false" - width="130"> + visible="false"> Working </text> <button follows="left|top" height="22" image_overlay="Refresh_Off" - left="20" + left="10" name="new_snapshot_btn" - bottom="-20" + bottom="-10" visible="false" width="22" /> <text @@ -170,16 +162,15 @@ left_pad="10" length="1" name="refresh_lbl" - right="-5" text_color="red" - top_delta="0" + top_delta="4" translate="false" type="string" visible="false" width="130"> - Refresh to save. + Refresh to save </text> - </ui_ctrl> + </panel> <text length="1" follows="top|left|right" |