diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llconsole.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llfloater.cpp | 2 | ||||
-rw-r--r-- | indra/llui/lllayoutstack.cpp | 43 | ||||
-rw-r--r-- | indra/llui/lllayoutstack.h | 8 | ||||
-rw-r--r-- | indra/llui/llmenugl.cpp | 6 | ||||
-rw-r--r-- | indra/llui/llmenugl.h | 4 | ||||
-rw-r--r-- | indra/llui/llscrolllistcolumn.cpp | 11 | ||||
-rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 2 | ||||
-rw-r--r-- | indra/llui/lltooltip.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llui.cpp | 1 | ||||
-rw-r--r-- | indra/llui/lluictrlfactory.cpp | 6 | ||||
-rw-r--r-- | indra/llui/lluictrlfactory.h | 7 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llview.h | 3 |
14 files changed, 72 insertions, 31 deletions
diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp index e0053b4cc7..48c76cf105 100644 --- a/indra/llui/llconsole.cpp +++ b/indra/llui/llconsole.cpp @@ -60,6 +60,8 @@ LLConsole* gConsole = NULL; // Created and destroyed in LLViewerWindow. const F32 FADE_DURATION = 2.f; const S32 MIN_CONSOLE_WIDTH = 200; +static LLDefaultChildRegistry::Register<LLConsole> r("console"); + LLConsole::LLConsole(const LLConsole::Params& p) : LLUICtrl(p), LLFixedBuffer(p.max_lines), diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index aac27e6562..f2cdad8854 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1857,6 +1857,8 @@ void LLFloater::buildButtons() ///////////////////////////////////////////////////// // LLFloaterView +static LLDefaultChildRegistry::Register<LLFloaterView> r("floater_view"); + LLFloaterView::LLFloaterView (const Params& p) : LLUICtrl (p), mFocusCycleMode(FALSE), diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index bac5491943..9399ace1f7 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -137,6 +137,7 @@ LLLayoutStack::LLLayoutStack(const LLLayoutStack::Params& p) mPanelSpacing(p.border_size), mOrientation((p.orientation() == "vertical") ? VERTICAL : HORIZONTAL), mAnimate(p.animate), + mAnimatedThisFrame(false), mClip(p.clip) {} @@ -172,6 +173,7 @@ void LLLayoutStack::draw() // only force drawing invisible children if visible amount is non-zero drawChild(panelp, 0, 0, !clip_rect.isEmpty()); } + mAnimatedThisFrame = false; } void LLLayoutStack::removeChild(LLView* view) @@ -411,8 +413,10 @@ void LLLayoutStack::updatePanelAutoResize(const std::string& panel_name, BOOL au } } +static LLFastTimer::DeclareTimer FTM_UPDATE_LAYOUT("Update LayoutStacks"); void LLLayoutStack::updateLayout(BOOL force_resize) { + LLFastTimer ft(FTM_UPDATE_LAYOUT); static LLUICachedControl<S32> resize_bar_overlap ("UIResizeBarOverlap", 0); calcMinExtents(); @@ -431,10 +435,13 @@ void LLLayoutStack::updateLayout(BOOL force_resize) { if (mAnimate) { - (*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(ANIM_OPEN_TIME)); - if ((*panel_it)->mVisibleAmt > 0.99f) + if (!mAnimatedThisFrame) { - (*panel_it)->mVisibleAmt = 1.f; + (*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 1.f, LLCriticalDamp::getInterpolant(ANIM_OPEN_TIME)); + if ((*panel_it)->mVisibleAmt > 0.99f) + { + (*panel_it)->mVisibleAmt = 1.f; + } } } else @@ -446,10 +453,13 @@ void LLLayoutStack::updateLayout(BOOL force_resize) { if (mAnimate) { - (*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(ANIM_CLOSE_TIME)); - if ((*panel_it)->mVisibleAmt < 0.001f) + if (!mAnimatedThisFrame) { - (*panel_it)->mVisibleAmt = 0.f; + (*panel_it)->mVisibleAmt = lerp((*panel_it)->mVisibleAmt, 0.f, LLCriticalDamp::getInterpolant(ANIM_CLOSE_TIME)); + if ((*panel_it)->mVisibleAmt < 0.001f) + { + (*panel_it)->mVisibleAmt = 0.f; + } } } else @@ -631,10 +641,10 @@ void LLLayoutStack::updateLayout(BOOL force_resize) // adjust running headroom count based on new sizes shrink_headroom_total += delta_size; - panelp->reshape(new_width, new_height); - panelp->setOrigin(cur_x, cur_y - new_height); + LLRect panel_rect; + panel_rect.setLeftTopAndSize(cur_x, cur_y, new_width, new_height); + panelp->setShape(panel_rect); - LLRect panel_rect = panelp->getRect(); LLRect resize_bar_rect = panel_rect; if (mOrientation == HORIZONTAL) { @@ -705,6 +715,8 @@ void LLLayoutStack::updateLayout(BOOL force_resize) llassert_always(force_resize == FALSE); updateLayout(TRUE); } + + mAnimatedThisFrame = true; } // end LLLayoutStack::updateLayout @@ -772,3 +784,16 @@ void LLLayoutStack::calcMinExtents() } } } + +// update layout stack animations, etc. once per frame +// NOTE: we use this to size world view based on animating UI, *before* we draw the UI +// we might still need to call updateLayout during UI draw phase, in case UI elements +// are resizing themselves dynamically +//static +void LLLayoutStack::updateClass() +{ + for (LLInstanceTracker<LLLayoutStack>::instance_iter it = beginInstances(); it != endInstances(); ++it) + { + (*it)->updateLayout(); + } +} diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 9ded48ef6a..3a073fa1b2 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -38,7 +38,7 @@ class LLPanel; -class LLLayoutStack : public LLView +class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack> { public: struct Params : public LLInitParam::Block<Params, LLView::Params> @@ -81,6 +81,10 @@ public: S32 getNumPanels() { return mPanels.size(); } void updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize); + + + static void updateClass(); + protected: LLLayoutStack(const Params&); friend class LLUICtrlFactory; @@ -105,6 +109,8 @@ private: S32 mMinHeight; // calculated by calcMinExtents S32 mPanelSpacing; + // true if we already applied animation this frame + bool mAnimatedThisFrame; bool mAnimate; bool mClip; }; // end class LLLayoutStack diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index c6a38c7ca7..de9a854f63 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3270,11 +3270,9 @@ BOOL LLMenuBarGL::handleHover( S32 x, S32 y, MASK mask ) ///============================================================================ LLCoordGL LLMenuHolderGL::sContextMenuSpawnPos(S32_MAX, S32_MAX); -LLMenuHolderGL::LLMenuHolderGL() - : LLPanel() +LLMenuHolderGL::LLMenuHolderGL(const LLMenuHolderGL::Params& p) + : LLPanel(p) { - setName("Menu Holder"); - setMouseOpaque(FALSE); sItemActivationTimer.stop(); mCanHide = TRUE; } diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index dc8ed3b3fd..cbb9b4d344 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -746,7 +746,9 @@ private: class LLMenuHolderGL : public LLPanel { public: - LLMenuHolderGL(); + struct Params : public LLInitParam::Block<Params, LLPanel::Params> + {}; + LLMenuHolderGL(const Params& p); virtual ~LLMenuHolderGL() {} virtual BOOL hideMenus(); diff --git a/indra/llui/llscrolllistcolumn.cpp b/indra/llui/llscrolllistcolumn.cpp index ba53f84877..d281341202 100644 --- a/indra/llui/llscrolllistcolumn.cpp +++ b/indra/llui/llscrolllistcolumn.cpp @@ -44,6 +44,9 @@ const S32 MIN_COLUMN_WIDTH = 20; +// defaults for LLScrollColumnHeader param block pulled from widgets/scroll_column_header.xml +static LLWidgetNameRegistry::StaticRegistrar sRegisterColumnHeaderParams(&typeid(LLScrollColumnHeader::Params), "scroll_column_header"); + //--------------------------------------------------------------------------- // LLScrollColumnHeader //--------------------------------------------------------------------------- @@ -51,15 +54,7 @@ LLScrollColumnHeader::Params::Params() : column("column") { name = "column_header"; - image_unselected.name("square_btn_32x128.tga"); - image_selected.name("square_btn_selected_32x128.tga"); - image_disabled.name("square_btn_32x128.tga"); - image_disabled_selected.name("square_btn_selected_32x128.tga"); - image_overlay.name("combobox_arrow.tga"); - image_overlay_alignment("right"); - font_halign = LLFontGL::LEFT; tab_stop(false); - scale_image(true); } diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index a6cd6412e5..1c2c02e1cc 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -2624,7 +2624,7 @@ void LLScrollListCtrl::addColumn(const LLScrollListColumn::Params& column_params LLRect temp_rect = LLRect(left,top+mHeadingHeight,right,top); - LLScrollColumnHeader::Params params; + LLScrollColumnHeader::Params params(LLUICtrlFactory::getDefaultParams<LLScrollColumnHeader>()); params.name = "btn_" + name; params.rect = temp_rect; params.column = new_column; diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index 4bc9a9c042..fe1c2ba67c 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -57,6 +57,8 @@ LLToolTipView *gToolTipView = NULL; // Member functions // +static LLDefaultChildRegistry::Register<LLToolTipView> register_tooltip_view("tooltip_view"); + LLToolTipView::Params::Params() { mouse_opaque = false; @@ -142,7 +144,7 @@ void LLToolTipView::drawStickyRect() // -static LLDefaultChildRegistry::Register<LLToolTip> r("tool_tip"); +static LLDefaultChildRegistry::Register<LLToolTip> register_tooltip("tool_tip"); LLToolTip::Params::Params() diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index a82e6eb372..4cf503b413 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -43,7 +43,6 @@ #include "llrender.h" #include "llrect.h" #include "lldir.h" -#include "llfontgl.h" #include "llgl.h" // Project includes diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index c3c0daed0f..8ab015f2bb 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -449,3 +449,9 @@ const std::string* LLUICtrlFactory::getWidgetTag(const std::type_info* widget_ty { return LLWidgetNameRegistry::instance().getValue(widget_type); } + +// static +void LLUICtrlFactory::connect(LLView* parent, LLView* child) +{ + parent->addChild(child); +}
\ No newline at end of file diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 17e32dc7a9..8a9c9e23c1 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -188,10 +188,15 @@ public: T* widget = new T(params); widget->initFromParams(params); if (parent) - widget->setParent(parent); + { + connect(parent, widget); + } return widget; } + // fix for gcc template instantiation annoyance + static void connect(LLView* parent, LLView* child); + LLView* createFromXML(LLXMLNodePtr node, LLView* parent, const std::string& filename, const widget_registry_t&, LLXMLNodePtr output_node ); template<typename T> diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index fe7fd59de8..dba24ee165 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -40,7 +40,6 @@ #include "llrender.h" #include "llevent.h" -#include "llfontgl.h" #include "llfocusmgr.h" #include "llrect.h" #include "llstl.h" @@ -1698,8 +1697,11 @@ LLView* LLView::getChildView(const std::string& name, BOOL recurse) const return child; } +static LLFastTimer::DeclareTimer FTM_FIND_VIEWS("Find Widgets"); + LLView* LLView::findChildView(const std::string& name, BOOL recurse) const { + LLFastTimer ft(FTM_FIND_VIEWS); //richard: should we allow empty names? //if(name.empty()) // return NULL; diff --git a/indra/llui/llview.h b/indra/llui/llview.h index c3b442e022..2607120e17 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -267,9 +267,6 @@ public: // remove the specified child from the view, and set it's parent to NULL. virtual void removeChild(LLView* view); - // helper function for lluictrlfactory.h create<> template - void setParent(LLView* parent) { if (parent) parent->addChild(this); } - virtual BOOL postBuild() { return TRUE; } child_tab_order_t getCtrlOrder() const { return mCtrlOrder; } |