diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llfloater.cpp | 2 | ||||
-rw-r--r-- | indra/llui/lllayoutstack.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llpanel.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llradiogroup.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llscrolllistcell.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llspinctrl.cpp | 20 | ||||
-rw-r--r-- | indra/llui/lltabcontainer.cpp | 8 | ||||
-rw-r--r-- | indra/llui/lltextbase.cpp | 23 | ||||
-rw-r--r-- | indra/llui/lltextbase.h | 2 | ||||
-rw-r--r-- | indra/llui/llui.cpp | 1 | ||||
-rw-r--r-- | indra/llui/lluictrlfactory.h | 3 | ||||
-rw-r--r-- | indra/llui/lluiimage.cpp | 1 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 24 | ||||
-rw-r--r-- | indra/llui/llview.h | 8 |
14 files changed, 56 insertions, 48 deletions
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index f7fd2dbdfe..d7a692ec9b 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2717,7 +2717,7 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr o } params.from_xui = true; - setupParams(params, parent); + applyXUILayout(params, parent); initFromParams(params); initFloater(params); diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 5e15fa3919..7d8c102750 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -247,7 +247,7 @@ LLView* LLLayoutStack::fromXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr o } p.from_xui = true; - setupParams(p, parent); + applyXUILayout(p, parent); LLLayoutStack* layout_stackp = LLUICtrlFactory::create<LLLayoutStack>(p); if (parent && layout_stackp) diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 738a96f730..db32882438 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -452,7 +452,7 @@ void LLPanel::initFromParams(const LLPanel::Params& p) parseFollowsFlags(p); setToolTip(p.tool_tip()); - setSaveToXML(p.from_xui); + setFromXUI(p.from_xui); mHoverCursor = getCursorFromString(p.hover_cursor); @@ -542,7 +542,7 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu } params.from_xui = true; - setupParams(params, parent); + applyXUILayout(params, parent); { LLFastTimer timer(FTM_PANEL_CONSTRUCTION); initFromParams(params); diff --git a/indra/llui/llradiogroup.cpp b/indra/llui/llradiogroup.cpp index 997b9c13f8..4087b484aa 100644 --- a/indra/llui/llradiogroup.cpp +++ b/indra/llui/llradiogroup.cpp @@ -116,6 +116,10 @@ void LLRadioGroup::initFromParams(const Params& p) item_params.font.setIfNotProvided(mFont); // apply radio group font by default item_params.commit_callback.function = boost::bind(&LLRadioGroup::onClickButton, this, _1); item_params.from_xui = p.from_xui; + if (p.from_xui) + { + applyXUILayout(item_params, this); + } LLRadioCtrl* item = LLUICtrlFactory::create<LLRadioCtrl>(item_params, this); mRadioButtons.push_back(item); diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index 544352176a..7238d903a3 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -353,7 +353,7 @@ LLScrollListCheck::LLScrollListCheck(const LLScrollListCell::Params& p) { LLCheckBoxCtrl::Params checkbox_p; checkbox_p.name("checkbox"); - checkbox_p.rect.left(0).bottom(0).width(p.width).height(p.width); + checkbox_p.rect = LLRect(0, p.width, p.width, 0); checkbox_p.enabled(p.enabled); checkbox_p.initial_value(p.value()); diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index d6d46654d5..20a1ab7af3 100644 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp @@ -75,10 +75,8 @@ LLSpinCtrl::LLSpinCtrl(const LLSpinCtrl::Params& p) static LLUICachedControl<S32> spinctrl_spacing ("UISpinctrlSpacing", 0); static LLUICachedControl<S32> spinctrl_btn_width ("UISpinctrlBtnWidth", 0); static LLUICachedControl<S32> spinctrl_btn_height ("UISpinctrlBtnHeight", 0); - S32 top = getRect().getHeight(); - S32 bottom = top - 2 * spinctrl_btn_height; - S32 centered_top = top; - S32 centered_bottom = bottom; + S32 centered_top = getRect().getHeight(); + S32 centered_bottom = getRect().getHeight() - 2 * spinctrl_btn_height; S32 btn_left = 0; // reserve space for spinner S32 label_width = llclamp(p.label_width(), 0, llmax(0, getRect().getWidth() - 40)); @@ -105,25 +103,15 @@ LLSpinCtrl::LLSpinCtrl(const LLSpinCtrl::Params& p) // Spin buttons LLButton::Params up_button_params(p.up_button); - up_button_params.rect - .left(btn_left) - .top(top) - .right(btn_right) - .height(spinctrl_btn_height); + up_button_params.rect = LLRect(btn_left, getRect().getHeight(), btn_right, getRect().getHeight() - spinctrl_btn_height); up_button_params.click_callback.function(boost::bind(&LLSpinCtrl::onUpBtn, this, _2)); up_button_params.mouse_held_callback.function(boost::bind(&LLSpinCtrl::onUpBtn, this, _2)); mUpBtn = LLUICtrlFactory::create<LLButton>(up_button_params); addChild(mUpBtn); - LLRect down_rect( btn_left, top - spinctrl_btn_height, btn_right, bottom ); - LLButton::Params down_button_params(p.down_button); - down_button_params.rect - .left(btn_left) - .right(btn_right) - .bottom(bottom) - .height(spinctrl_btn_height); + down_button_params.rect = LLRect(btn_left, getRect().getHeight() - spinctrl_btn_height, btn_right, getRect().getHeight() - 2 * spinctrl_btn_height); down_button_params.click_callback.function(boost::bind(&LLSpinCtrl::onDownBtn, this, _2)); down_button_params.mouse_held_callback.function(boost::bind(&LLSpinCtrl::onDownBtn, this, _2)); mDownBtn = LLUICtrlFactory::create<LLButton>(down_button_params); diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 83e2e3db50..327dd01612 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -266,8 +266,6 @@ bool LLTabContainer::addChild(LLView* view, S32 tab_group) if (panelp) { - panelp->setSaveToXML(TRUE); - addTabPanel(TabPanelParams().panel(panelp).label(panelp->getLabel()).is_placeholder(dynamic_cast<LLPlaceHolderPanel*>(view) != NULL)); return true; } @@ -1019,12 +1017,10 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) { if (textbox) { - textbox->setSaveToXML(false); addChild( textbox, 0 ); } if (btn) { - btn->setSaveToXML(false); addChild( btn, 0 ); } } @@ -1747,24 +1743,20 @@ void LLTabContainer::initButtons() } } - mPrevArrowBtn->setSaveToXML(false); mPrevArrowBtn->setTabStop(FALSE); addChild(mPrevArrowBtn); - mNextArrowBtn->setSaveToXML(false); mNextArrowBtn->setTabStop(FALSE); addChild(mNextArrowBtn); if (mJumpPrevArrowBtn) { - mJumpPrevArrowBtn->setSaveToXML(false); mJumpPrevArrowBtn->setTabStop(FALSE); addChild(mJumpPrevArrowBtn); } if (mJumpNextArrowBtn) { - mJumpNextArrowBtn->setSaveToXML(false); mJumpNextArrowBtn->setTabStop(FALSE); addChild(mJumpNextArrowBtn); } diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index cb0907a771..e54032ac5e 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -962,7 +962,10 @@ void LLTextBase::draw() reflow(); // then update scroll position, as cursor may have moved - updateScrollFromCursor(); + if (!mReadOnly) + { + updateScrollFromCursor(); + } LLRect doc_rect; if (mScroller) @@ -1932,11 +1935,19 @@ void LLTextBase::endOfLine() void LLTextBase::startOfDoc() { setCursorPos(0); + if (mScroller) + { + mScroller->goToTop(); + } } void LLTextBase::endOfDoc() { setCursorPos(getLength()); + if (mScroller) + { + mScroller->goToBottom(); + } } void LLTextBase::changePage( S32 delta ) @@ -2001,6 +2012,16 @@ void LLTextBase::changeLine( S32 delta ) setCursorPos(new_cursor_pos, true); } +bool LLTextBase::scrolledToStart() +{ + return mScroller->isAtTop(); +} + +bool LLTextBase::scrolledToEnd() +{ + return mScroller->isAtBottom(); +} + bool LLTextBase::setCursor(S32 row, S32 column) { diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index a1f8ba39ae..c91578b637 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -180,6 +180,8 @@ public: void changePage( S32 delta ); void changeLine( S32 delta ); + bool scrolledToStart(); + bool scrolledToEnd(); const LLFontGL* getDefaultFont() const { return mDefaultFont; } diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 1ea6b66a93..728ed4e7aa 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1915,6 +1915,7 @@ namespace LLInitParam green = color.mV[VGREEN]; blue = color.mV[VBLUE]; alpha = color.mV[VALPHA]; + control.set("", false); } void TypeValues<LLUIColor>::declareValues() diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 6788f29ba9..b1fa6add67 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -184,8 +184,6 @@ public: { T* widget = NULL; - T::setupParams(params, parent); - if (!params.validateBlock()) { llwarns << getInstance()->getCurFileName() << ": Invalid parameter block for " << typeid(T).name() << llendl; @@ -310,6 +308,7 @@ fail: // Apply layout transformations, usually munging rect params.from_xui = true; + T::applyXUILayout(params, parent); T* widget = createWidget<T>(params, parent); typedef typename T::child_registry_t registry_t; diff --git a/indra/llui/lluiimage.cpp b/indra/llui/lluiimage.cpp index 1dfc281d93..966d919dc7 100644 --- a/indra/llui/lluiimage.cpp +++ b/indra/llui/lluiimage.cpp @@ -168,6 +168,7 @@ namespace LLInitParam if (name() == "none") { mData.mValue = NULL; + return; } LLUIImage* imagep = LLUI::getUIImage(name()); diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index a8d8626e49..f1b08c380b 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -126,7 +126,7 @@ LLView::LLView(const LLView::Params& p) : mName(p.name), mParentView(NULL), mReshapeFlags(FOLLOWS_NONE), - mSaveToXML(p.from_xui), + mFromXUI(p.from_xui), mIsFocusRoot(FALSE), mLastVisible(FALSE), mNextInsertionOrdinal(0), @@ -2479,7 +2479,7 @@ static bool get_last_child_rect(LLView* parent, LLRect *rect) for (;itor != parent->getChildList()->end(); ++itor) { LLView *last_view = (*itor); - if (last_view->getSaveToXML()) + if (last_view->getFromXUI()) { *rect = last_view->getRect(); return true; @@ -2489,7 +2489,7 @@ static bool get_last_child_rect(LLView* parent, LLRect *rect) } //static -void LLView::setupParams(LLView::Params& p, LLView* parent) +void LLView::applyXUILayout(LLView::Params& p, LLView* parent) { const S32 VPAD = 4; const S32 MIN_WIDGET_HEIGHT = 10; @@ -2509,7 +2509,7 @@ void LLView::setupParams(LLView::Params& p, LLView* parent) LLRect last_rect = parent->getLocalRect(); bool layout_topleft = (p.layout() == "topleft"); - if (layout_topleft && p.from_xui) + if (layout_topleft) { //invert top to bottom if (p.rect.top.isProvided()) p.rect.top = parent_rect.getHeight() - p.rect.top; @@ -2535,10 +2535,10 @@ void LLView::setupParams(LLView::Params& p, LLView* parent) p.rect.right.setProvided(false); // recalculate the right } } - else if (p.from_xui) // only do negative coordinate magic for XUI + else { - if (p.rect.left < 0) p.rect.left = p.rect.left + parent_rect.getWidth(); - if (p.rect.right < 0) p.rect.right = p.rect.right + parent_rect.getWidth(); + if (p.rect.left.isProvided() && p.rect.left < 0) p.rect.left = p.rect.left + parent_rect.getWidth(); + if (p.rect.right.isProvided() && p.rect.right < 0) p.rect.right = p.rect.right + parent_rect.getWidth(); } if (p.center_vert) { @@ -2556,15 +2556,15 @@ void LLView::setupParams(LLView::Params& p, LLView* parent) p.rect.top.setProvided(false); // recalculate the top } } - else if (p.from_xui) + else { - if (p.rect.bottom < 0) p.rect.bottom = p.rect.bottom + parent_rect.getHeight(); - if (p.rect.top < 0) p.rect.top = p.rect.top + parent_rect.getHeight(); + if (p.rect.bottom.isProvided() && p.rect.bottom < 0) p.rect.bottom = p.rect.bottom + parent_rect.getHeight(); + if (p.rect.top.isProvided() && p.rect.top < 0) p.rect.top = p.rect.top + parent_rect.getHeight(); } // DEPRECATE: automatically fall back to height of MIN_WIDGET_HEIGHT pixels - if (!p.rect.height.isProvided() && !p.rect.top.isProvided()) + if (!p.rect.height.isProvided() && !p.rect.top.isProvided() && p.rect.height == 0) { p.rect.height = MIN_WIDGET_HEIGHT; } @@ -2663,7 +2663,7 @@ static void convert_to_relative_layout(LLView::Params& p, LLView* parent) // Use setupParams to get the final widget rectangle // according to our wacky layout rules. LLView::Params final = p; - LLView::setupParams(final, parent); + LLView::applyXUILayout(final, parent); // Must actually extract the rectangle to get consistent // right = left+width, top = bottom+height LLRect final_rect = final.rect; diff --git a/indra/llui/llview.h b/indra/llui/llview.h index f8460f5361..c4d7313743 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -395,8 +395,8 @@ public: void parseFollowsFlags(const LLView::Params& params); // Some widgets, like close box buttons, don't need to be saved - BOOL getSaveToXML() const { return mSaveToXML; } - void setSaveToXML(BOOL b) { mSaveToXML = b; } + BOOL getFromXUI() const { return mFromXUI; } + void setFromXUI(BOOL b) { mFromXUI = b; } typedef enum e_hit_test_type { @@ -498,7 +498,7 @@ public: // Set up params after XML load before calling new(), // usually to adjust layout. - static void setupParams(Params& p, LLView* parent); + static void applyXUILayout(Params& p, LLView* parent); // For re-export of floaters and panels, convert the coordinate system // to be top-left based. @@ -573,7 +573,7 @@ private: LLUIString mToolTipMsg; // isNull() is true if none. U8 mSoundFlags; - BOOL mSaveToXML; + BOOL mFromXUI; BOOL mIsFocusRoot; BOOL mUseBoundingRect; // hit test against bounding rectangle that includes all child elements |