summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorrichard <none@none>2009-11-09 16:14:52 -0800
committerrichard <none@none>2009-11-09 16:14:52 -0800
commit3b2d9f63e3a54660a8657ec573cce3f29f677047 (patch)
tree2f51c9bc9a04a639ff3ac6851917f4f4df89bd0b /indra/llui
parentf4a7de3bb5a837df43525ac936000fd67177ea42 (diff)
parent2bc97bd68a774dd373c5688b5dc660abe90b37cc (diff)
merge
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llconsole.cpp2
-rw-r--r--indra/llui/llfloater.cpp2
-rw-r--r--indra/llui/lllayoutstack.cpp43
-rw-r--r--indra/llui/lllayoutstack.h8
-rw-r--r--indra/llui/llmenugl.cpp6
-rw-r--r--indra/llui/llmenugl.h4
-rw-r--r--indra/llui/llscrolllistcolumn.cpp11
-rw-r--r--indra/llui/llscrolllistctrl.cpp2
-rw-r--r--indra/llui/lltooltip.cpp4
-rw-r--r--indra/llui/lluictrlfactory.h2
-rw-r--r--indra/llui/llview.cpp3
-rw-r--r--indra/llui/llview.h3
12 files changed, 61 insertions, 29 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..5999e1a29e 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::instance_iter it = beginInstances(); it != endInstances(); ++it)
+ {
+ (*it)->updateLayout();
+ }
+}
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h
index 9ded48ef6a..8475079f5e 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<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/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; }