summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDmitry Zaporozhan <dzaporozhan@productengine.com>2009-12-26 17:55:05 +0200
committerDmitry Zaporozhan <dzaporozhan@productengine.com>2009-12-26 17:55:05 +0200
commitbb2ad27f46149b4cdbee53cc37af51330ae7321c (patch)
treea30b73ee0b9ca4af240e85d1254efb294cf1c0b4 /indra/newview
parentad76bebf6f399de8c7345f4c8f975a9e5687b054 (diff)
Update for low task EXT-3451 - Code cleanup: Get Rid of Magic constants in LLChicletPanel::Params::Params (move into widget xml).
Removed hardcodes. --HG-- branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llchiclet.cpp24
-rw-r--r--indra/newview/llchiclet.h6
-rw-r--r--indra/newview/skins/default/xui/en/widgets/chiclet_panel.xml2
3 files changed, 17 insertions, 15 deletions
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp
index c97d1254da..c01202bb82 100644
--- a/indra/newview/llchiclet.cpp
+++ b/indra/newview/llchiclet.cpp
@@ -64,11 +64,6 @@ static LLDefaultChildRegistry::Register<LLAdHocChiclet> t5("chiclet_im_adhoc");
static LLDefaultChildRegistry::Register<LLScriptChiclet> t6("chiclet_script");
static LLDefaultChildRegistry::Register<LLInvOfferChiclet> t7("chiclet_offer");
-static const S32 SCROLL_BUTTON_PAD = 5;
-
-// static
-const S32 LLChicletPanel::s_scroll_ratio = 10;
-
boost::signals2::signal<LLChiclet* (const LLUUID&),
LLIMChiclet::CollectChicletCombiner<std::list<LLChiclet*> > >
LLIMChiclet::sFindChicletsSignal;
@@ -1057,6 +1052,8 @@ void LLIMGroupChiclet::onMenuItemClicked(const LLSD& user_data)
LLChicletPanel::Params::Params()
: chiclet_padding("chiclet_padding")
, scrolling_offset("scrolling_offset")
+, scroll_button_hpad("scroll_button_hpad")
+, scroll_ratio("scroll_ratio")
, min_width("min_width")
{
};
@@ -1068,12 +1065,11 @@ LLChicletPanel::LLChicletPanel(const Params&p)
, mRightScrollButton(NULL)
, mChicletPadding(p.chiclet_padding)
, mScrollingOffset(p.scrolling_offset)
+, mScrollButtonHPad(p.scroll_button_hpad)
+, mScrollRatio(p.scroll_ratio)
, mMinWidth(p.min_width)
, mShowControls(true)
{
- // min_width = 4 chiclets + 3 paddings
- mMinWidth += 3 * mChicletPadding;
-
LLPanel::Params panel_params;
panel_params.follows.flags(FOLLOWS_LEFT | FOLLOWS_RIGHT);
mScrollArea = LLUICtrlFactory::create<LLPanel>(panel_params,this);
@@ -1372,8 +1368,8 @@ void LLChicletPanel::reshape(S32 width, S32 height, BOOL called_from_parent )
bool need_show_scroll = needShowScroll();
if(need_show_scroll)
{
- mScrollArea->setRect(LLRect(scroll_button_rect.getWidth() + SCROLL_BUTTON_PAD,
- height, width - scroll_button_rect.getWidth() - SCROLL_BUTTON_PAD, 0));
+ mScrollArea->setRect(LLRect(scroll_button_rect.getWidth() + mScrollButtonHPad,
+ height, width - scroll_button_rect.getWidth() - mScrollButtonHPad, 0));
}
else
{
@@ -1431,8 +1427,8 @@ void LLChicletPanel::arrange()
bool need_show_scroll = needShowScroll();
if(need_show_scroll)
{
- mScrollArea->setRect(LLRect(scroll_button_rect.getWidth() + SCROLL_BUTTON_PAD,
- rect.getHeight(), rect.getWidth() - scroll_button_rect.getWidth() - SCROLL_BUTTON_PAD, 0));
+ mScrollArea->setRect(LLRect(scroll_button_rect.getWidth() + mScrollButtonHPad,
+ rect.getHeight(), rect.getWidth() - scroll_button_rect.getWidth() - mScrollButtonHPad, 0));
}
else
{
@@ -1596,7 +1592,7 @@ void LLChicletPanel::onRightScrollClick()
void LLChicletPanel::onLeftScrollHeldDown()
{
S32 offset = mScrollingOffset;
- mScrollingOffset = mScrollingOffset / s_scroll_ratio;
+ mScrollingOffset = mScrollingOffset / mScrollRatio;
scrollLeft();
mScrollingOffset = offset;
}
@@ -1604,7 +1600,7 @@ void LLChicletPanel::onLeftScrollHeldDown()
void LLChicletPanel::onRightScrollHeldDown()
{
S32 offset = mScrollingOffset;
- mScrollingOffset = mScrollingOffset / s_scroll_ratio;
+ mScrollingOffset = mScrollingOffset / mScrollRatio;
scrollRight();
mScrollingOffset = offset;
}
diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h
index bb2cf3a8de..ee9db10525 100644
--- a/indra/newview/llchiclet.h
+++ b/indra/newview/llchiclet.h
@@ -945,7 +945,9 @@ public:
struct Params : public LLInitParam::Block<Params, LLPanel::Params>
{
Optional<S32> chiclet_padding,
- scrolling_offset;
+ scrolling_offset,
+ scroll_button_hpad,
+ scroll_ratio;
Optional<S32> min_width;
@@ -1164,6 +1166,8 @@ protected:
S32 mChicletPadding;
S32 mScrollingOffset;
+ S32 mScrollButtonHPad;
+ S32 mScrollRatio;
S32 mMinWidth;
bool mShowControls;
static const S32 s_scroll_ratio;
diff --git a/indra/newview/skins/default/xui/en/widgets/chiclet_panel.xml b/indra/newview/skins/default/xui/en/widgets/chiclet_panel.xml
index d8cf1b9815..f3207ddeae 100644
--- a/indra/newview/skins/default/xui/en/widgets/chiclet_panel.xml
+++ b/indra/newview/skins/default/xui/en/widgets/chiclet_panel.xml
@@ -3,5 +3,7 @@
name="chiclet_panel"
chiclet_padding="3"
scrolling_offset="40"
+ scroll_button_hpad="5"
+ scroll_ratio="10"
min_width="180"
/> \ No newline at end of file