From 8f54407fe69d5dedad472906470f5e0b6186bf23 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 12 Feb 2010 13:33:10 -0800 Subject: can resize bottom of nearby media panel now, and remembers size when expanding/collapsing --- indra/newview/llpanelnearbymedia.cpp | 42 +++++++++++++++++++--- indra/newview/llpanelnearbymedia.h | 5 +-- .../skins/default/xui/en/panel_nearby_media.xml | 6 ++-- 3 files changed, 45 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index a4da194a20..3480abcf40 100644 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -37,6 +37,7 @@ #include "llaudioengine.h" #include "llcheckboxctrl.h" #include "llcombobox.h" +#include "llresizebar.h" #include "llscrolllistctrl.h" #include "llscrolllistitem.h" #include "llscrolllistcell.h" @@ -108,6 +109,15 @@ BOOL LLPanelNearByMedia::postBuild() { LLPanel::postBuild(); + const S32 RESIZE_BAR_THICKNESS = 6; + LLResizeBar::Params p; + p.rect = LLRect(0, RESIZE_BAR_THICKNESS, getRect().getWidth(), 0); + p.name = "resizebar_bottom"; + p.min_size = getRect().getHeight(); + p.side = LLResizeBar::BOTTOM; + p.resizing_view = this; + addChild( LLUICtrlFactory::create(p) ); + mNearbyMediaPanel = getChild("nearby_media_panel"); mMediaList = getChild("media_list"); mEnableAllCtrl = getChild("all_nearby_media_enable_btn"); @@ -144,8 +154,9 @@ BOOL LLPanelNearByMedia::postBuild() refreshList(); updateColumns(); - mOriginalHeight = getRect().getHeight(); - mNearbyMediaPanelHeight = mNearbyMediaPanel->getRect().getHeight(); + LLView* minimized_controls = getChildView("minimized_controls"); + mMoreHeight = getRect().getHeight(); + mLessHeight = getRect().getHeight() - minimized_controls->getRect().mBottom; getChild("more_less_btn")->setValue(false); onMoreLess(); @@ -191,12 +202,33 @@ void LLPanelNearByMedia::onTopLost () setVisible(FALSE); } +/*virtual*/ +void LLPanelNearByMedia::reshape(S32 width, S32 height, BOOL called_from_parent) +{ + LLPanel::reshape(width, height, called_from_parent); + + LLButton* more_less_btn = getChild("more_less_btn"); + if (more_less_btn->getValue().asBoolean()) + { + mMoreHeight = getRect().getHeight(); + } + +} const F32 AUTO_CLOSE_FADE_TIME_START= 4.0f; const F32 AUTO_CLOSE_FADE_TIME_END = 5.0f; void LLPanelNearByMedia::draw() { + // keep bottom of panel on screen + LLRect screen_rect = calcScreenRect(); + if (screen_rect.mBottom < 0) + { + LLRect new_rect = getRect(); + new_rect.mBottom += 0 - screen_rect.mBottom; + setShape(new_rect); + } + mItemCountText->setValue(llformat(getString("media_item_count_format").c_str(), mMediaList->getItemCount())); // refreshParcelMediaUI(); @@ -821,8 +853,10 @@ void LLPanelNearByMedia::onMoreLess() bool is_more = getChild("more_less_btn")->getValue(); mNearbyMediaPanel->setVisible(is_more); - S32 new_height = mOriginalHeight; - if (!is_more) new_height -= mNearbyMediaPanelHeight; + // enable resizing when expanded + getChildView("resizebar_bottom")->setEnabled(is_more); + + S32 new_height = is_more ? mMoreHeight : mLessHeight; LLRect new_rect = getRect(); new_rect.mBottom = new_rect.mTop - new_height; diff --git a/indra/newview/llpanelnearbymedia.h b/indra/newview/llpanelnearbymedia.h index 8b30f3c0e0..50ccd92e09 100644 --- a/indra/newview/llpanelnearbymedia.h +++ b/indra/newview/llpanelnearbymedia.h @@ -54,6 +54,7 @@ public: /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); /*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); /*virtual*/ void onTopLost (); + /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent); // this is part of the nearby media *dialog* so we can track whether // the user *implicitly* wants audio on or off via their *explicit* @@ -151,8 +152,8 @@ private: std::string mDefaultParcelMediaName; std::string mPlayingString; - S32 mOriginalHeight; - S32 mNearbyMediaPanelHeight; + S32 mMoreHeight; + S32 mLessHeight; LLFrameTimer mHoverTimer; }; diff --git a/indra/newview/skins/default/xui/en/panel_nearby_media.xml b/indra/newview/skins/default/xui/en/panel_nearby_media.xml index 4fcdb30465..f51156812a 100644 --- a/indra/newview/skins/default/xui/en/panel_nearby_media.xml +++ b/indra/newview/skins/default/xui/en/panel_nearby_media.xml @@ -17,9 +17,11 @@ bevel_style="in" bg_alpha_color="0 0 0 0" bg_opaque_color="0 0 0 0.3" - follows="left|right|top" + bg_opaque_image="Toast_Background" + follows="left|right|top" top="0" - height="45" + height="30" + name="minimized_controls" left="0">