summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Antipov <mantipov@productengine.com>2010-02-24 17:13:56 +0200
committerMike Antipov <mantipov@productengine.com>2010-02-24 17:13:56 +0200
commit08ede585ce33b2551d8e22bec5c5b3a5e345051f (patch)
treea10a1d6e177ad621867858a013cef83a919af318
parentacc97bd55fbdaecb16f47ae53e896eb0ca7d53c5 (diff)
Work on major bug EXT-5589 (Notifications button falls under side panel)
-- updated LLLayoutStack to process "max_width" & "max_height" attributes for layout_panel. --HG-- branch : product-engine
-rw-r--r--indra/llui/lllayoutstack.cpp38
-rw-r--r--indra/llui/lllayoutstack.h10
-rw-r--r--indra/newview/llchathistory.cpp4
-rw-r--r--indra/newview/llfloaternotificationsconsole.cpp2
4 files changed, 45 insertions, 9 deletions
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index dc79550eb4..4512091371 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -49,9 +49,11 @@ static LLDefaultChildRegistry::Register<LLLayoutStack> register_layout_stack("la
//
struct LLLayoutStack::LayoutPanel
{
- LayoutPanel(LLPanel* panelp, ELayoutOrientation orientation, S32 min_width, S32 min_height, BOOL auto_resize, BOOL user_resize) : mPanel(panelp),
+ LayoutPanel(LLPanel* panelp, ELayoutOrientation orientation, S32 min_width, S32 min_height, S32 max_width, S32 max_height, BOOL auto_resize, BOOL user_resize) : mPanel(panelp),
mMinWidth(min_width),
mMinHeight(min_height),
+ mMaxWidth(max_width),
+ mMaxHeight(max_height),
mAutoResize(auto_resize),
mUserResize(user_resize),
mOrientation(orientation),
@@ -112,6 +114,11 @@ struct LLLayoutStack::LayoutPanel
LLPanel* mPanel;
S32 mMinWidth;
S32 mMinHeight;
+
+ // mMaxWidth & mMaxHeight are added to make configurable max width of the nearby chat bar. EXT-5589
+ // they are not processed by LLLayoutStack but they can be if necessary
+ S32 mMaxWidth;
+ S32 mMaxHeight;
BOOL mAutoResize;
BOOL mUserResize;
BOOL mCollapsed;
@@ -261,10 +268,14 @@ LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr o
{
const S32 DEFAULT_MIN_WIDTH = 0;
const S32 DEFAULT_MIN_HEIGHT = 0;
+ const S32 DEFAULT_MAX_WIDTH = S32_MAX;
+ const S32 DEFAULT_MAX_HEIGHT = S32_MAX;
const BOOL DEFAULT_AUTO_RESIZE = TRUE;
S32 min_width = DEFAULT_MIN_WIDTH;
S32 min_height = DEFAULT_MIN_HEIGHT;
+ S32 max_width = DEFAULT_MAX_WIDTH;
+ S32 max_height = DEFAULT_MAX_HEIGHT;
BOOL auto_resize = DEFAULT_AUTO_RESIZE;
LLXMLNodePtr output_child;
@@ -281,6 +292,10 @@ LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr o
DEFAULT_MIN_WIDTH, output_child);
get_attribute_s32_and_write(child_node, "min_height", &min_height,
DEFAULT_MIN_HEIGHT, output_child);
+ get_attribute_s32_and_write(child_node, "max_width", &max_width,
+ DEFAULT_MAX_WIDTH, output_child);
+ get_attribute_s32_and_write(child_node, "max_height", &max_height,
+ DEFAULT_MAX_HEIGHT, output_child);
get_attribute_bool_and_write(child_node, "auto_resize", &auto_resize,
DEFAULT_AUTO_RESIZE, output_child);
@@ -293,7 +308,7 @@ LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr o
if (panelp)
{
panelp->setFollowsNone();
- layout_stackp->addPanel(panelp, min_width, min_height, auto_resize, user_resize);
+ layout_stackp->addPanel(panelp, min_width, min_height, max_width, max_height, auto_resize, user_resize);
}
}
else
@@ -309,7 +324,7 @@ LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr o
if (new_child)
{
// put child in new embedded panel
- layout_stackp->addPanel(panelp, min_width, min_height, auto_resize, user_resize);
+ layout_stackp->addPanel(panelp, min_width, min_height, max_width, max_height, auto_resize, user_resize);
// resize panel to contain widget and move widget to be contained in panel
panelp->setRect(new_child->getRect());
new_child->setOrigin(0, 0);
@@ -359,14 +374,14 @@ S32 LLLayoutStack::getDefaultWidth(S32 cur_width)
return cur_width;
}
-void LLLayoutStack::addPanel(LLPanel* panel, S32 min_width, S32 min_height, BOOL auto_resize, BOOL user_resize, EAnimate animate, S32 index)
+void LLLayoutStack::addPanel(LLPanel* panel, S32 min_width, S32 min_height, S32 max_width, S32 max_height, BOOL auto_resize, BOOL user_resize, EAnimate animate, S32 index)
{
// panel starts off invisible (collapsed)
if (animate == ANIMATE)
{
panel->setVisible(FALSE);
}
- LayoutPanel* embedded_panel = new LayoutPanel(panel, mOrientation, min_width, min_height, auto_resize, user_resize);
+ LayoutPanel* embedded_panel = new LayoutPanel(panel, mOrientation, min_width, min_height, max_width, max_height, auto_resize, user_resize);
mPanels.insert(mPanels.begin() + llclamp(index, 0, (S32)mPanels.size()), embedded_panel);
@@ -437,6 +452,19 @@ bool LLLayoutStack::getPanelMinSize(const std::string& panel_name, S32* min_widt
return NULL != panel;
}
+bool LLLayoutStack::getPanelMaxSize(const std::string& panel_name, S32* max_widthp, S32* max_heightp)
+{
+ LayoutPanel* panel = findEmbeddedPanelByName(panel_name);
+
+ if (panel)
+ {
+ if (max_widthp) *max_widthp = panel->mMaxWidth;
+ if (max_heightp) *max_heightp = panel->mMaxHeight;
+ }
+
+ return NULL != panel;
+}
+
static LLFastTimer::DeclareTimer FTM_UPDATE_LAYOUT("Update LayoutStacks");
void LLLayoutStack::updateLayout(BOOL force_resize)
{
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h
index c4f10038f8..e454454fe2 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -74,7 +74,7 @@ public:
ANIMATE
} EAnimate;
- void addPanel(LLPanel* panel, S32 min_width, S32 min_height, BOOL auto_resize, BOOL user_resize, EAnimate animate = NO_ANIMATE, S32 index = S32_MAX);
+ void addPanel(LLPanel* panel, S32 min_width, S32 min_height, S32 max_width, S32 max_height, BOOL auto_resize, BOOL user_resize, EAnimate animate = NO_ANIMATE, S32 index = S32_MAX);
void removePanel(LLPanel* panel);
void collapsePanel(LLPanel* panel, BOOL collapsed = TRUE);
S32 getNumPanels() { return mPanels.size(); }
@@ -89,6 +89,14 @@ public:
* @returns true if specified by panel_name internal panel exists, false otherwise.
*/
bool getPanelMinSize(const std::string& panel_name, S32* min_widthp, S32* min_heightp);
+
+ /**
+ * Gets maximal width and/or height of the specified by name panel.
+ *
+ * If it is necessary to get only the one dimension pass NULL for another one.
+ * @returns true if specified by panel_name internal panel exists, false otherwise.
+ */
+ bool getPanelMaxSize(const std::string& panel_name, S32* max_width, S32* max_height);
void updateLayout(BOOL force_resize = FALSE);
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 45c2d26fde..e1c96d4a16 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -491,7 +491,7 @@ void LLChatHistory::initFromParams(const LLChatHistory::Params& p)
panel_p.background_visible = false;
panel_p.has_border = false;
panel_p.mouse_opaque = false;
- stackp->addPanel(LLUICtrlFactory::create<LLPanel>(panel_p), 0, 30, true, false, LLLayoutStack::ANIMATE);
+ stackp->addPanel(LLUICtrlFactory::create<LLPanel>(panel_p), 0, 30, S32_MAX, S32_MAX, true, false, LLLayoutStack::ANIMATE);
panel_p.name = "new_text_notice_holder";
LLRect new_text_notice_rect = getLocalRect();
@@ -509,7 +509,7 @@ void LLChatHistory::initFromParams(const LLChatHistory::Params& p)
mMoreChatText = LLUICtrlFactory::create<LLTextBox>(text_p, mMoreChatPanel);
mMoreChatText->setClickedCallback(boost::bind(&LLChatHistory::onClickMoreText, this));
- stackp->addPanel(mMoreChatPanel, 0, 0, false, false, LLLayoutStack::ANIMATE);
+ stackp->addPanel(mMoreChatPanel, 0, 0, S32_MAX, S32_MAX, false, false, LLLayoutStack::ANIMATE);
}
diff --git a/indra/newview/llfloaternotificationsconsole.cpp b/indra/newview/llfloaternotificationsconsole.cpp
index 94b5ebba00..b744bff084 100644
--- a/indra/newview/llfloaternotificationsconsole.cpp
+++ b/indra/newview/llfloaternotificationsconsole.cpp
@@ -210,7 +210,7 @@ void LLFloaterNotificationConsole::addChannel(const std::string& name, bool open
{
LLLayoutStack& stack = getChildRef<LLLayoutStack>("notification_channels");
LLNotificationChannelPanel* panelp = new LLNotificationChannelPanel(name);
- stack.addPanel(panelp, 0, NOTIFICATION_PANEL_HEADER_HEIGHT, TRUE, TRUE, LLLayoutStack::ANIMATE);
+ stack.addPanel(panelp, 0, NOTIFICATION_PANEL_HEADER_HEIGHT, S32_MAX, S32_MAX, TRUE, TRUE, LLLayoutStack::ANIMATE);
LLButton& header_button = panelp->getChildRef<LLButton>("header");
header_button.setToggleState(!open);