From 0a7290772a6b39555adb966c7a48ef44151c1f05 Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 5 Nov 2009 15:36:11 -0800 Subject: moved scroll_column_header default params to scroll_column_header.xml reviewed by James --- indra/llui/llscrolllistcolumn.cpp | 11 +++-------- indra/llui/llscrolllistctrl.cpp | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) (limited to 'indra/llui') 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()); params.name = "btn_" + name; params.rect = temp_rect; params.column = new_column; -- cgit v1.2.3 From fac0b6836a59681443fb2bbd13e6b5eb9c07cef5 Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 5 Nov 2009 20:36:15 -0800 Subject: refactored top level ui into main_view.xml --- indra/llui/llfloater.cpp | 2 ++ indra/llui/llmenugl.cpp | 6 ++---- indra/llui/llmenugl.h | 4 +++- indra/llui/lltooltip.cpp | 4 +++- 4 files changed, 10 insertions(+), 6 deletions(-) (limited to 'indra/llui') 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 r("floater_view"); + LLFloaterView::LLFloaterView (const Params& p) : LLUICtrl (p), mFocusCycleMode(FALSE), diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 956e843987..f078b67912 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3247,11 +3247,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 09d9e407c7..b0681d252d 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -765,7 +765,9 @@ private: class LLMenuHolderGL : public LLPanel { public: - LLMenuHolderGL(); + struct Params : public LLInitParam::Block + {}; + LLMenuHolderGL(const Params& p); virtual ~LLMenuHolderGL() {} virtual BOOL hideMenus(); 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 register_tooltip_view("tooltip_view"); + LLToolTipView::Params::Params() { mouse_opaque = false; @@ -142,7 +144,7 @@ void LLToolTipView::drawStickyRect() // -static LLDefaultChildRegistry::Register r("tool_tip"); +static LLDefaultChildRegistry::Register register_tooltip("tool_tip"); LLToolTip::Params::Params() -- cgit v1.2.3 From 4eb72a12a2280d3be6ac556ad80eb953d249e8eb Mon Sep 17 00:00:00 2001 From: richard Date: Mon, 9 Nov 2009 15:29:47 -0800 Subject: data driven layout of top-level UI elements EXT-1219 Side tray slide-out animation cleaned up some layout of bottom tray contents reviewed by James --- indra/llui/llconsole.cpp | 2 ++ indra/llui/lllayoutstack.cpp | 43 ++++++++++++++++++++++++++++++++++--------- indra/llui/lllayoutstack.h | 8 +++++++- indra/llui/lluictrlfactory.h | 2 +- indra/llui/llview.cpp | 3 +++ indra/llui/llview.h | 3 --- 6 files changed, 47 insertions(+), 14 deletions(-) (limited to 'indra/llui') 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 r("console"); + LLConsole::LLConsole(const LLConsole::Params& p) : LLUICtrl(p), LLFixedBuffer(p.max_lines), diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index bac5491943..596b3a3e70 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 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::idle() +{ + for (LLInstanceTracker::instance_iter it = beginInstances(); it != endInstances(); ++it) + { + (*it)->updateLayout(); + } +} diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 9ded48ef6a..11d604b7ec 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, LLInstanceTracker { public: struct Params : public LLInitParam::Block @@ -81,6 +81,10 @@ public: S32 getNumPanels() { return mPanels.size(); } void updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize); + + + static void idle(); + 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/lluictrlfactory.h b/indra/llui/lluictrlfactory.h index 17e32dc7a9..0ccd3047f6 100644 --- a/indra/llui/lluictrlfactory.h +++ b/indra/llui/lluictrlfactory.h @@ -188,7 +188,7 @@ public: T* widget = new T(params); widget->initFromParams(params); if (parent) - widget->setParent(parent); + parent->addChild(widget); return widget; } diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index fe7fd59de8..da564befa9 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1698,8 +1698,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; } -- cgit v1.2.3 From 2bc97bd68a774dd373c5688b5dc660abe90b37cc Mon Sep 17 00:00:00 2001 From: richard Date: Mon, 9 Nov 2009 16:01:21 -0800 Subject: renamed LLLayoutStack::idle to LLLayoutStack::updateClass converted mWorldViewPlaceholder to a LLHandle improved layout of panel_bottomtray reviewed by James --- indra/llui/lllayoutstack.cpp | 2 +- indra/llui/lllayoutstack.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 596b3a3e70..5999e1a29e 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -790,7 +790,7 @@ void LLLayoutStack::calcMinExtents() // we might still need to call updateLayout during UI draw phase, in case UI elements // are resizing themselves dynamically //static -void LLLayoutStack::idle() +void LLLayoutStack::updateClass() { for (LLInstanceTracker::instance_iter it = beginInstances(); it != endInstances(); ++it) { diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 11d604b7ec..8475079f5e 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -83,7 +83,7 @@ public: void updatePanelAutoResize(const std::string& panel_name, BOOL auto_resize); - static void idle(); + static void updateClass(); protected: LLLayoutStack(const Params&); -- cgit v1.2.3 From caa468a5f184a1c2dd2cd1f2c4a7aafc5acf05d0 Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Tue, 10 Nov 2009 12:58:10 -0800 Subject: fix for gcc --- indra/llui/lluictrlfactory.cpp | 6 ++++++ indra/llui/lluictrlfactory.h | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'indra/llui') 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 0ccd3047f6..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) - parent->addChild(widget); + { + 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 -- cgit v1.2.3 From 25d8cf689aa04a1bd4ebb336714730d29040d05c Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Tue, 10 Nov 2009 13:03:16 -0800 Subject: further fixes in gcc land --- indra/llui/lllayoutstack.cpp | 2 +- indra/llui/lllayoutstack.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 5999e1a29e..9399ace1f7 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -792,7 +792,7 @@ void LLLayoutStack::calcMinExtents() //static void LLLayoutStack::updateClass() { - for (LLInstanceTracker::instance_iter it = beginInstances(); it != endInstances(); ++it) + for (LLInstanceTracker::instance_iter it = beginInstances(); it != endInstances(); ++it) { (*it)->updateLayout(); } diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h index 8475079f5e..3a073fa1b2 100644 --- a/indra/llui/lllayoutstack.h +++ b/indra/llui/lllayoutstack.h @@ -38,7 +38,7 @@ class LLPanel; -class LLLayoutStack : public LLView, LLInstanceTracker +class LLLayoutStack : public LLView, public LLInstanceTracker { public: struct Params : public LLInitParam::Block -- cgit v1.2.3 From 6c997043924216405057c9ca6927ec5c026ad5ee Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 10 Nov 2009 14:40:22 -0800 Subject: Add newline at end of file --- indra/llui/lluictrlfactory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp index 8ab015f2bb..adfbb41feb 100644 --- a/indra/llui/lluictrlfactory.cpp +++ b/indra/llui/lluictrlfactory.cpp @@ -454,4 +454,4 @@ const std::string* LLUICtrlFactory::getWidgetTag(const std::type_info* widget_ty void LLUICtrlFactory::connect(LLView* parent, LLView* child) { parent->addChild(child); -} \ No newline at end of file +} -- cgit v1.2.3