summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Litovchuk <slitovchuk@productengine.com>2010-01-14 18:52:52 +0200
committerSergei Litovchuk <slitovchuk@productengine.com>2010-01-14 18:52:52 +0200
commit6649dcc38ea13ecc6390891e9ac6ae606070ce60 (patch)
tree9af6cd8f94019d7965fbf35d13d875974126736b
parent24d8bf26fc489c7cb35cd4d8bfba2ca8c1e46442 (diff)
Fixed normal bug (EXT-3794) Controls in Edit Pick side panel cut off by
vertical scrollbar. - Added resizing pick info and pick editing panels when vertical scrollbar appears. - Resized controls on pick info and edit panels to avoid them being overlapped by scrollbar. - Changed pick info description from text box to text editor in read-only mode to allow text scrolling. - Removed text box resizing logic from LLPanelPickEdit. --HG-- branch : product-engine
-rw-r--r--indra/newview/llpanelpick.cpp80
-rw-r--r--indra/newview/llpanelpick.h18
-rw-r--r--indra/newview/skins/default/xui/en/panel_edit_pick.xml32
-rw-r--r--indra/newview/skins/default/xui/en/panel_pick_info.xml33
4 files changed, 87 insertions, 76 deletions
diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp
index 7a4dd3569d..e7615929c8 100644
--- a/indra/newview/llpanelpick.cpp
+++ b/indra/newview/llpanelpick.cpp
@@ -35,24 +35,30 @@
// profile.
#include "llviewerprecompiledheaders.h"
-#include "llpanel.h"
+
+#include "llpanelpick.h"
+
#include "message.h"
-#include "llagent.h"
-#include "llagentpicksinfo.h"
+
+#include "llparcel.h"
+
#include "llbutton.h"
+#include "llfloaterreg.h"
#include "lliconctrl.h"
#include "lllineeditor.h"
-#include "llparcel.h"
-#include "llviewerparcelmgr.h"
+#include "llpanel.h"
+#include "llscrollcontainer.h"
#include "lltexteditor.h"
+
+#include "llagent.h"
+#include "llagentpicksinfo.h"
+#include "llavatarpropertiesprocessor.h"
+#include "llfloaterworldmap.h"
#include "lltexturectrl.h"
#include "lluiconstants.h"
+#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
#include "llworldmap.h"
-#include "llfloaterworldmap.h"
-#include "llfloaterreg.h"
-#include "llavatarpropertiesprocessor.h"
-#include "llpanelpick.h"
#define XML_PANEL_EDIT_PICK "panel_edit_pick.xml"
@@ -93,6 +99,10 @@ LLPanelPickInfo::LLPanelPickInfo()
, mPickId(LLUUID::null)
, mParcelId(LLUUID::null)
, mRequestedId(LLUUID::null)
+ , mScrollingPanelMinHeight(0)
+ , mScrollingPanelWidth(0)
+ , mScrollingPanel(NULL)
+ , mScrollContainer(NULL)
{
}
@@ -146,9 +156,35 @@ BOOL LLPanelPickInfo::postBuild()
childSetAction("show_on_map_btn", boost::bind(&LLPanelPickInfo::onClickMap, this));
childSetAction("back_btn", boost::bind(&LLPanelPickInfo::onClickBack, this));
+ mScrollingPanel = getChild<LLPanel>("scroll_content_panel");
+ mScrollContainer = getChild<LLScrollContainer>("profile_scroll");
+
+ mScrollingPanelMinHeight = mScrollContainer->getScrolledViewRect().getHeight();
+ mScrollingPanelWidth = mScrollingPanel->getRect().getWidth();
+
return TRUE;
}
+void LLPanelPickInfo::reshape(S32 width, S32 height, BOOL called_from_parent)
+{
+ LLPanel::reshape(width, height, called_from_parent);
+
+ if (!mScrollContainer || !mScrollingPanel)
+ return;
+
+ static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
+
+ S32 scroll_height = mScrollContainer->getRect().getHeight();
+ if (mScrollingPanelMinHeight >= scroll_height)
+ {
+ mScrollingPanel->reshape(mScrollingPanelWidth, mScrollingPanelMinHeight);
+ }
+ else
+ {
+ mScrollingPanel->reshape(mScrollingPanelWidth + scrollbar_size, scroll_height);
+ }
+}
+
void LLPanelPickInfo::processProperties(void* data, EAvatarProcessorType type)
{
if(APT_PICK_INFO != type)
@@ -284,7 +320,6 @@ void LLPanelPickInfo::setPickName(const std::string& name)
void LLPanelPickInfo::setPickDesc(const std::string& desc)
{
childSetValue(XML_DESC, desc);
- updateContentPanelRect();
}
void LLPanelPickInfo::setPickLocation(const std::string& location)
@@ -292,31 +327,6 @@ void LLPanelPickInfo::setPickLocation(const std::string& location)
childSetValue(XML_LOCATION, location);
}
-void LLPanelPickInfo::updateContentPanelRect()
-{
- LLTextBox* desc = getChild<LLTextBox>(XML_DESC);
-
- S32 text_height = desc->getTextPixelHeight();
- LLRect text_rect = desc->getRect();
-
- // let text-box height fit text height
- text_rect.set(text_rect.mLeft, text_rect.mTop, text_rect.mRight, text_rect.mTop - text_height);
- desc->setRect(text_rect);
- desc->reshape(text_rect.getWidth(), text_rect.getHeight());
- // force reflow
- desc->setText(desc->getText());
-
- // bottom of description text-box will be bottom of content panel
- desc->localRectToOtherView(desc->getLocalRect(), &text_rect, getChild<LLView>("profile_scroll"));
-
- LLPanel* content_panel = getChild<LLPanel>("scroll_content_panel");
- LLRect content_rect = content_panel->getRect();
- content_rect.set(content_rect.mLeft, content_rect.mTop, content_rect.mRight, text_rect.mBottom);
- // Somehow setRect moves all elements down.
- // Single reshape() updates rect and does not move anything.
- content_panel->reshape(content_rect.getWidth(), content_rect.getHeight());
-}
-
void LLPanelPickInfo::onClickMap()
{
LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal());
diff --git a/indra/newview/llpanelpick.h b/indra/newview/llpanelpick.h
index 12b5a116b4..62c3b20c0d 100644
--- a/indra/newview/llpanelpick.h
+++ b/indra/newview/llpanelpick.h
@@ -43,6 +43,7 @@
class LLIconCtrl;
class LLTextureCtrl;
+class LLScrollContainer;
class LLMessageSystem;
class LLAvatarPropertiesObserver;
@@ -69,6 +70,8 @@ public:
/*virtual*/ BOOL postBuild();
+ /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+
/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
/**
@@ -140,15 +143,6 @@ protected:
virtual LLVector3d& getPosGlobal() { return mPosGlobal; }
/**
- * Reshapes content panel to fit all elements.
- *
- * Assume that description text-box is the last element of panel.
- * Reshape text-box to fit text height and then reshape content panel to fit
- * text-box bottom. EXT-1326
- */
- void updateContentPanelRect();
-
- /**
* Callback for "Map" button, opens Map
*/
void onClickMap();
@@ -162,7 +156,11 @@ protected:
protected:
- LLTextureCtrl* mSnapshotCtrl;
+ S32 mScrollingPanelMinHeight;
+ S32 mScrollingPanelWidth;
+ LLScrollContainer* mScrollContainer;
+ LLPanel* mScrollingPanel;
+ LLTextureCtrl* mSnapshotCtrl;
LLUUID mAvatarId;
LLVector3d mPosGlobal;
diff --git a/indra/newview/skins/default/xui/en/panel_edit_pick.xml b/indra/newview/skins/default/xui/en/panel_edit_pick.xml
index d6de5af32d..7769189219 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_pick.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_pick.xml
@@ -38,28 +38,27 @@
<scroll_container
color="DkGray2"
follows="all"
- height="510"
+ height="500"
layout="topleft"
left="10"
top_pad="10"
name="profile_scroll"
- reserve_scroll_corner="false"
opaque="true"
width="313">
<panel
name="scroll_content_panel"
- follows="left|top"
+ follows="left|top|right"
min_height="300"
layout="topleft"
top="0"
background_visible="false"
- height="510"
+ height="500"
left="0"
- width="295">
+ width="285">
<texture_picker
follows="left|top|right"
height="197"
- width="290"
+ width="280"
layout="topleft"
top="20"
left="10"
@@ -77,7 +76,7 @@
<text
type="string"
length="1"
- follows="left|top"
+ follows="left|top|right"
height="15"
font="SansSerifSmall"
font.style="BOLD"
@@ -86,7 +85,7 @@
top="215"
name="Name:"
text_color="white"
- width="290">
+ width="280">
Title:
</text>
<line_editor
@@ -99,11 +98,11 @@
max_length="63"
name="pick_name"
text_color="black"
- width="290" />
+ width="280" />
<text
type="string"
length="1"
- follows="left|top"
+ follows="left|top|right"
height="15"
font="SansSerifSmall"
font.style="BOLD"
@@ -112,13 +111,13 @@
top_pad="20"
name="description_label"
text_color="white"
- width="290">
+ width="280">
Description:
</text>
<text_editor
follows="left|top|right"
height="100"
- width="290"
+ width="280"
hide_scrollbar="false"
layout="topleft"
left="10"
@@ -132,27 +131,26 @@
length="1"
font="SansSerifSmall"
font.style="BOLD"
- follows="left|top"
+ follows="left|top|right"
height="15"
layout="topleft"
left="10"
name="location_label"
text_color="white"
top_pad="20"
- width="290">
+ width="280">
Location:
</text>
<text
type="string"
length="1"
- follows="left|top"
+ follows="left|top|right"
height="50"
layout="topleft"
left="10"
name="pick_location"
- right="-10"
top_pad="2"
- width="290"
+ width="280"
word_wrap="true">
loading...
</text>
diff --git a/indra/newview/skins/default/xui/en/panel_pick_info.xml b/indra/newview/skins/default/xui/en/panel_pick_info.xml
index f68202d287..9c7f38e688 100644
--- a/indra/newview/skins/default/xui/en/panel_pick_info.xml
+++ b/indra/newview/skins/default/xui/en/panel_pick_info.xml
@@ -40,31 +40,30 @@
left="10"
top_pad="10"
name="profile_scroll"
- reserve_scroll_corner="false"
width="313">
<panel
name="scroll_content_panel"
- follows="left|top"
+ follows="left|top|right"
min_height="300"
layout="topleft"
top="0"
background_visible="false"
- height="470"
+ height="400"
left="0"
- width="295">
+ width="285">
<texture_picker
enabled="false"
- follows="left|top"
+ follows="left|top|right"
height="197"
layout="topleft"
left="10"
name="pick_snapshot"
top="20"
- width="290" />
+ width="280" />
<text
follows="left|top|right"
height="35"
- width="290"
+ width="280"
layout="topleft"
font="SansSerifBig"
font.style="BOLD"
@@ -75,23 +74,29 @@
value="[name]"
use_ellipses="true" />
<text
- follows="left|top"
+ follows="left|top|right"
height="25"
layout="topleft"
left="10"
name="pick_location"
- width="290"
+ width="280"
word_wrap="true"
value="[loading...]" />
- <text
- follows="left|top|right"
- height="280"
+ <text_editor
+ bg_readonly_color="DkGray2"
+ follows="all"
+ height="100"
+ width="280"
+ hide_scrollbar="false"
layout="topleft"
left="10"
+ top_pad="2"
+ max_length="1023"
name="pick_desc"
- width="290"
+ read_only="true"
+ text_readonly_color="white"
value="[description]"
- word_wrap="true" />
+ wrap="true" />
</panel>
</scroll_container>
<panel