diff options
author | Paul ProductEngine <pguslisty@productengine.com> | 2011-11-25 19:24:47 +0200 |
---|---|---|
committer | Paul ProductEngine <pguslisty@productengine.com> | 2011-11-25 19:24:47 +0200 |
commit | 8a442d5edb9074fa76856fc739b362a7374bc1cf (patch) | |
tree | 56be117dff55cea54a438d5ab7a1dc321c539c77 | |
parent | c577966d198889730cc1b4f4d43ec9c4865c47f6 (diff) |
EXP-1463 FIXED (IM chiclets overlay Mini-Location bar)
- Now chiclet bar adjusts its width with Mini-Location bar
-rw-r--r-- | indra/newview/llchicletbar.cpp | 32 | ||||
-rw-r--r-- | indra/newview/llchicletbar.h | 6 | ||||
-rw-r--r-- | indra/newview/llpaneltopinfobar.cpp | 18 | ||||
-rw-r--r-- | indra/newview/llpaneltopinfobar.h | 6 |
4 files changed, 62 insertions, 0 deletions
diff --git a/indra/newview/llchicletbar.cpp b/indra/newview/llchicletbar.cpp index a17e1d13f5..1bd5a571a5 100644 --- a/indra/newview/llchicletbar.cpp +++ b/indra/newview/llchicletbar.cpp @@ -35,6 +35,7 @@ // newview includes #include "llchiclet.h" #include "llimfloater.h" // for LLIMFloater +#include "llpaneltopinfobar.h" #include "llsyswellwindow.h" namespace @@ -181,6 +182,9 @@ BOOL LLChicletBar::postBuild() showWellButton("im_well", !LLIMWellWindow::getInstance()->isWindowEmpty()); showWellButton("notification_well", !LLNotificationWellWindow::getInstance()->isWindowEmpty()); + LLPanelTopInfoBar::instance().setResizeCallback(boost::bind(&LLChicletBar::fitWithTopInfoBar, this)); + LLPanelTopInfoBar::instance().setVisibleCallback(boost::bind(&LLChicletBar::fitWithTopInfoBar, this)); + return TRUE; } @@ -338,3 +342,31 @@ S32 LLChicletBar::getChicletPanelShrinkHeadroom() const llassert(shrink_headroom >= 0); // the panel cannot get narrower than the minimum return shrink_headroom; } + +void LLChicletBar::fitWithTopInfoBar() +{ + LLPanelTopInfoBar& top_info_bar = LLPanelTopInfoBar::instance(); + + LLRect rect = getRect(); + S32 width = rect.getWidth(); + + if (top_info_bar.getVisible()) + { + S32 delta = top_info_bar.calcScreenRect().mRight - calcScreenRect().mLeft; + rect.setLeftTopAndSize(rect.mLeft + delta, rect.mTop, rect.getWidth(), rect.getHeight()); + width = rect.getWidth() - delta; + } + else + { + LLView* parent = getParent(); + if (parent) + { + LLRect parent_rect = parent->getRect(); + rect.setLeftTopAndSize(0, rect.mTop, rect.getWidth(), rect.getHeight()); + width = parent_rect.getWidth(); + } + } + + setRect(rect); + LLPanel::reshape(width, rect.getHeight(), false); +} diff --git a/indra/newview/llchicletbar.h b/indra/newview/llchicletbar.h index 224dfbb647..1427bf95e0 100644 --- a/indra/newview/llchicletbar.h +++ b/indra/newview/llchicletbar.h @@ -89,6 +89,12 @@ private: */ S32 getChicletPanelShrinkHeadroom() const; + /** + * function adjusts Chiclet bar width to prevent overlapping with Mini-Location bar + * EXP-1463 + */ + void fitWithTopInfoBar(); + protected: LLChicletBar(const LLSD& key = LLSD()); diff --git a/indra/newview/llpaneltopinfobar.cpp b/indra/newview/llpaneltopinfobar.cpp index 5ed23d2f42..eb4c7572d4 100644 --- a/indra/newview/llpaneltopinfobar.cpp +++ b/indra/newview/llpaneltopinfobar.cpp @@ -203,6 +203,11 @@ void LLPanelTopInfoBar::onVisibilityChange(const LLSD& show) gFloaterView->setMinimizePositionVerticalOffset(minimize_pos_offset); } +boost::signals2::connection LLPanelTopInfoBar::setResizeCallback( const resize_signal_t::slot_type& cb ) +{ + return mResizeSignal.connect(cb); +} + void LLPanelTopInfoBar::draw() { updateParcelInfoText(); @@ -224,6 +229,7 @@ void LLPanelTopInfoBar::buildLocationString(std::string& loc_str, bool show_coor void LLPanelTopInfoBar::setParcelInfoText(const std::string& new_text) { + LLRect old_rect = getRect(); const LLFontGL* font = mParcelInfoText->getDefaultFont(); S32 new_text_width = font->getWidth(new_text); @@ -235,6 +241,11 @@ void LLPanelTopInfoBar::setParcelInfoText(const std::string& new_text) mParcelInfoText->reshape(rect.getWidth(), rect.getHeight(), TRUE); mParcelInfoText->setRect(rect); layoutParcelIcons(); + + if (old_rect != getRect()) + { + mResizeSignal(); + } } void LLPanelTopInfoBar::update() @@ -342,6 +353,8 @@ void LLPanelTopInfoBar::updateHealth() void LLPanelTopInfoBar::layoutParcelIcons() { + LLRect old_rect = getRect(); + // TODO: remove hard-coded values and read them as xml parameters static const int FIRST_ICON_HPAD = 32; static const int LAST_ICON_HPAD = 11; @@ -358,6 +371,11 @@ void LLPanelTopInfoBar::layoutParcelIcons() LLRect rect = getRect(); rect.set(rect.mLeft, rect.mTop, left + LAST_ICON_HPAD, rect.mBottom); setRect(rect); + + if (old_rect != getRect()) + { + mResizeSignal(); + } } S32 LLPanelTopInfoBar::layoutWidget(LLUICtrl* ctrl, S32 left) diff --git a/indra/newview/llpaneltopinfobar.h b/indra/newview/llpaneltopinfobar.h index e934b522be..d58d95be90 100644 --- a/indra/newview/llpaneltopinfobar.h +++ b/indra/newview/llpaneltopinfobar.h @@ -41,6 +41,8 @@ class LLPanelTopInfoBar : public LLPanel, public LLSingleton<LLPanelTopInfoBar>, friend class LLDestroyClass<LLPanelTopInfoBar>; public: + typedef boost::signals2::signal<void ()> resize_signal_t; + LLPanelTopInfoBar(); ~LLPanelTopInfoBar(); @@ -57,6 +59,8 @@ public: */ void onVisibilityChange(const LLSD& show); + boost::signals2::connection setResizeCallback( const resize_signal_t::slot_type& cb ); + private: class LLParcelChangeObserver; @@ -167,6 +171,8 @@ private: boost::signals2::connection mParcelPropsCtrlConnection; boost::signals2::connection mShowCoordsCtrlConnection; boost::signals2::connection mParcelMgrConnection; + + resize_signal_t mResizeSignal; }; #endif /* LLPANELTOPINFOBAR_H_ */ |