summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llbutton.cpp5
-rw-r--r--indra/llui/llbutton.h5
-rw-r--r--indra/llui/llcheckboxctrl.cpp5
-rw-r--r--indra/llui/llcheckboxctrl.h5
-rw-r--r--indra/llui/llflatlistview.cpp10
-rw-r--r--indra/llui/llfloater.cpp7
-rw-r--r--indra/llui/llfloater.h2
-rw-r--r--indra/llui/llfloaterreglistener.cpp2
-rw-r--r--indra/llui/lllineeditor.cpp5
-rw-r--r--indra/llui/lllineeditor.h5
-rw-r--r--indra/llui/llmenugl.cpp9
-rw-r--r--indra/llui/llnotifications.cpp12
-rw-r--r--indra/llui/llpanel.cpp5
-rw-r--r--indra/llui/llpanel.h6
-rw-r--r--indra/llui/llprogressbar.cpp9
-rw-r--r--indra/llui/llscrollcontainer.cpp24
-rw-r--r--indra/llui/llscrollcontainer.h2
-rw-r--r--indra/llui/lltextbase.cpp63
-rw-r--r--indra/llui/lltextbase.h5
-rw-r--r--indra/llui/lltextbox.cpp7
-rw-r--r--indra/llui/lltextbox.h6
-rw-r--r--indra/llui/lltexteditor.cpp8
-rw-r--r--indra/llui/lltexteditor.h5
-rw-r--r--indra/llui/lltooltip.cpp5
-rw-r--r--indra/llui/lluictrl.cpp30
-rw-r--r--indra/llui/lluictrl.h28
-rw-r--r--indra/llui/lluictrlfactory.cpp4
-rw-r--r--indra/llui/lluictrlfactory.h5
-rw-r--r--indra/llui/llview.cpp10
-rw-r--r--indra/llui/llview.h12
30 files changed, 218 insertions, 88 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index b91c614424..7721137e29 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -32,6 +32,7 @@
#include "linden_common.h"
+#define LLBUTTON_CPP
#include "llbutton.h"
// Linden library includes
@@ -56,6 +57,10 @@
static LLDefaultChildRegistry::Register<LLButton> r("button");
+// Compiler optimization, generate extern template
+template class LLButton* LLView::getChild<class LLButton>(
+ const std::string& name, BOOL recurse) const;
+
// globals loaded from settings.xml
S32 LLBUTTON_H_PAD = 0;
S32 LLBUTTON_V_PAD = 0;
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index 8c3b4bd859..4c7400220d 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -322,5 +322,10 @@ private:
LLFrameTimer mFlashingTimer;
};
+// Build time optimization, generate once in .cpp file
+#ifndef LLBUTTON_CPP
+extern template class LLButton* LLView::getChild<class LLButton>(
+ const std::string& name, BOOL recurse) const;
+#endif
#endif // LL_LLBUTTON_H
diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp
index 7f0f9751db..cd10dfdb1c 100644
--- a/indra/llui/llcheckboxctrl.cpp
+++ b/indra/llui/llcheckboxctrl.cpp
@@ -33,6 +33,7 @@
// The mutants are coming!
#include "linden_common.h"
+#define LLCHECKBOXCTRL_CPP
#include "llcheckboxctrl.h"
#include "llgl.h"
@@ -50,6 +51,10 @@ const U32 MAX_STRING_LENGTH = 10;
static LLDefaultChildRegistry::Register<LLCheckBoxCtrl> r("check_box");
+// Compiler optimization, generate extern template
+template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>(
+ const std::string& name, BOOL recurse) const;
+
LLCheckBoxCtrl::Params::Params()
: text_enabled_color("text_enabled_color"),
text_disabled_color("text_disabled_color"),
diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h
index b14e66b915..28d50f957d 100644
--- a/indra/llui/llcheckboxctrl.h
+++ b/indra/llui/llcheckboxctrl.h
@@ -126,5 +126,10 @@ protected:
LLUIColor mTextDisabledColor;
};
+// Build time optimization, generate once in .cpp file
+#ifndef LLCHECKBOXCTRL_CPP
+extern template class LLCheckBoxCtrl* LLView::getChild<class LLCheckBoxCtrl>(
+ const std::string& name, BOOL recurse) const;
+#endif
#endif // LL_LLCHECKBOXCTRL_H
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index ddfb0f8534..f4a5f1c990 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -39,8 +39,8 @@
static const LLDefaultChildRegistry::Register<LLFlatListView> flat_list_view("flat_list_view");
-const LLSD SELECTED_EVENT = LLSD().insert("selected", true);
-const LLSD UNSELECTED_EVENT = LLSD().insert("selected", false);
+const LLSD SELECTED_EVENT = LLSD().with("selected", true);
+const LLSD UNSELECTED_EVENT = LLSD().with("selected", false);
static const std::string COMMENT_TEXTBOX = "comment_text";
@@ -530,7 +530,7 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask)
if ( !selectNextItemPair(true, reset_selection) && reset_selection)
{
// If case we are in accordion tab notify parent to go to the previous accordion
- notifyParent(LLSD().insert("action","select_prev"));
+ notifyParent(LLSD().with("action","select_prev"));
}
break;
}
@@ -539,7 +539,7 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask)
if ( !selectNextItemPair(false, reset_selection) && reset_selection)
{
// If case we are in accordion tab notify parent to go to the next accordion
- notifyParent(LLSD().insert("action","select_next"));
+ notifyParent(LLSD().with("action","select_next"));
}
break;
}
@@ -570,7 +570,7 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask)
// In case we are in accordion tab notify parent to show selected rectangle
LLRect screen_rc;
localRectToScreen(selected_rc, &screen_rc);
- notifyParent(LLSD().insert("scrollToShowRect",screen_rc.getValue()));
+ notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));
handled = TRUE;
}
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 8cf65fe76a..a63187678e 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1452,6 +1452,7 @@ void LLFloater::onClickTearOff(LLFloater* self)
gFloaterView->adjustToFitScreen(self, FALSE);
// give focus to new window to keep continuity for the user
self->setFocus(TRUE);
+ self->setTornOff(true);
}
else //Attach to parent.
{
@@ -1463,6 +1464,7 @@ void LLFloater::onClickTearOff(LLFloater* self)
// make sure host is visible
new_host->openFloater(new_host->getKey());
}
+ self->setTornOff(false);
}
}
@@ -2347,8 +2349,7 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out
}
LLRect::tCoordType screen_width = getSnapRect().getWidth();
LLRect::tCoordType screen_height = getSnapRect().getHeight();
- // convert to local coordinate frame
- LLRect snap_rect_local = getLocalSnapRect();
+
// only automatically resize non-minimized, resizable floaters
if( floater->isResizable() && !floater->isMinimized() )
@@ -2388,7 +2389,7 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out
}
// move window fully onscreen
- if (floater->translateIntoRect( snap_rect_local, allow_partial_outside ))
+ if (floater->translateIntoRect( getLocalRect(), allow_partial_outside ))
{
floater->clearSnapTarget();
}
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index d7ec0aac00..b5c835cb47 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -259,6 +259,8 @@ public:
bool isDocked() const { return mDocked; }
virtual void setDocked(bool docked, bool pop_on_undock = true);
+ virtual void setTornOff(bool torn_off) {}
+
// Return a closeable floater, if any, given the current focus.
static LLFloater* getClosableFloaterFromFocus();
diff --git a/indra/llui/llfloaterreglistener.cpp b/indra/llui/llfloaterreglistener.cpp
index 029d3b6810..082d7c1573 100644
--- a/indra/llui/llfloaterreglistener.cpp
+++ b/indra/llui/llfloaterreglistener.cpp
@@ -28,7 +28,7 @@ LLFloaterRegListener::LLFloaterRegListener():
add("getBuildMap",
"Return on [\"reply\"] data about all registered LLFloaterReg floater names",
&LLFloaterRegListener::getBuildMap,
- LLSD().insert("reply", LLSD()));
+ LLSD().with("reply", LLSD()));
LLSD requiredName;
requiredName["name"] = LLSD();
add("showInstance",
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 4ea30dbd4d..8a21155cc3 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -34,6 +34,7 @@
#include "linden_common.h"
+#define LLLINEEDITOR_CPP
#include "lllineeditor.h"
#include "lltexteditor.h"
@@ -71,6 +72,10 @@ const F32 TRIPLE_CLICK_INTERVAL = 0.3f; // delay between double and triple click
static LLDefaultChildRegistry::Register<LLLineEditor> r1("line_editor");
+// Compiler optimization, generate extern template
+template class LLLineEditor* LLView::getChild<class LLLineEditor>(
+ const std::string& name, BOOL recurse) const;
+
//
// Member functions
//
diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h
index b96220e020..49e9539b16 100644
--- a/indra/llui/lllineeditor.h
+++ b/indra/llui/lllineeditor.h
@@ -395,5 +395,10 @@ private:
}; // end class LLLineEditor
+// Build time optimization, generate once in .cpp file
+#ifndef LLLINEEDITOR_CPP
+extern template class LLLineEditor* LLView::getChild<class LLLineEditor>(
+ const std::string& name, BOOL recurse) const;
+#endif
#endif // LL_LINEEDITOR_
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index f8935d03ac..907f2352a0 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -590,12 +590,13 @@ BOOL LLMenuItemSeparatorGL::handleMouseDown(S32 x, S32 y, MASK mask)
LLMenuGL* parent_menu = getMenu();
if (y > getRect().getHeight() / 2)
{
- LLView* prev_menu_item = parent_menu->findPrevSibling(this);
+ // the menu items are in the child list in bottom up order
+ LLView* prev_menu_item = parent_menu->findNextSibling(this);
return prev_menu_item ? prev_menu_item->handleMouseDown(x, prev_menu_item->getRect().getHeight(), mask) : FALSE;
}
else
{
- LLView* next_menu_item = parent_menu->findNextSibling(this);
+ LLView* next_menu_item = parent_menu->findPrevSibling(this);
return next_menu_item ? next_menu_item->handleMouseDown(x, 0, mask) : FALSE;
}
}
@@ -605,12 +606,12 @@ BOOL LLMenuItemSeparatorGL::handleMouseUp(S32 x, S32 y, MASK mask)
LLMenuGL* parent_menu = getMenu();
if (y > getRect().getHeight() / 2)
{
- LLView* prev_menu_item = parent_menu->findPrevSibling(this);
+ LLView* prev_menu_item = parent_menu->findNextSibling(this);
return prev_menu_item ? prev_menu_item->handleMouseUp(x, prev_menu_item->getRect().getHeight(), mask) : FALSE;
}
else
{
- LLView* next_menu_item = parent_menu->findNextSibling(this);
+ LLView* next_menu_item = parent_menu->findPrevSibling(this);
return next_menu_item ? next_menu_item->handleMouseUp(x, 0, mask) : FALSE;
}
}
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 05f2d3a9cf..86989012ee 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -711,7 +711,7 @@ LLBoundListener LLNotificationChannelBase::connectChangedImpl(const LLEventListe
// only about new notifications
for (LLNotificationSet::iterator it = mItems.begin(); it != mItems.end(); ++it)
{
- slot(LLSD().insert("sigtype", "load").insert("id", (*it)->id()));
+ slot(LLSD().with("sigtype", "load").with("id", (*it)->id()));
}
// and then connect the signal so that all future notifications will also be
// forwarded.
@@ -722,7 +722,7 @@ LLBoundListener LLNotificationChannelBase::connectAtFrontChangedImpl(const LLEve
{
for (LLNotificationSet::iterator it = mItems.begin(); it != mItems.end(); ++it)
{
- slot(LLSD().insert("sigtype", "load").insert("id", (*it)->id()));
+ slot(LLSD().with("sigtype", "load").with("id", (*it)->id()));
}
return mChanged.connect(slot, boost::signals2::at_front);
}
@@ -907,7 +907,7 @@ void LLNotificationChannel::setComparator(LLNotificationComparator comparator)
mItems.swap(s2);
// notify clients that we've been resorted
- mChanged(LLSD().insert("sigtype", "sort"));
+ mChanged(LLSD().with("sigtype", "sort"));
}
bool LLNotificationChannel::isEmpty() const
@@ -1443,7 +1443,7 @@ void LLNotifications::add(const LLNotificationPtr pNotif)
llerrs << "Notification added a second time to the master notification channel." << llendl;
}
- updateItem(LLSD().insert("sigtype", "add").insert("id", pNotif->id()), pNotif);
+ updateItem(LLSD().with("sigtype", "add").with("id", pNotif->id()), pNotif);
}
void LLNotifications::cancel(LLNotificationPtr pNotif)
@@ -1454,7 +1454,7 @@ void LLNotifications::cancel(LLNotificationPtr pNotif)
llerrs << "Attempted to delete nonexistent notification " << pNotif->getName() << llendl;
}
pNotif->cancel();
- updateItem(LLSD().insert("sigtype", "delete").insert("id", pNotif->id()), pNotif);
+ updateItem(LLSD().with("sigtype", "delete").with("id", pNotif->id()), pNotif);
}
void LLNotifications::update(const LLNotificationPtr pNotif)
@@ -1462,7 +1462,7 @@ void LLNotifications::update(const LLNotificationPtr pNotif)
LLNotificationSet::iterator it=mItems.find(pNotif);
if (it != mItems.end())
{
- updateItem(LLSD().insert("sigtype", "change").insert("id", pNotif->id()), pNotif);
+ updateItem(LLSD().with("sigtype", "change").with("id", pNotif->id()), pNotif);
}
}
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 063822dd56..750b190953 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -34,6 +34,7 @@
#include "linden_common.h"
+#define LLPANEL_CPP
#include "llpanel.h"
#include "llalertdialog.h"
@@ -58,6 +59,10 @@
static LLDefaultChildRegistry::Register<LLPanel> r1("panel", &LLPanel::fromXML);
+// Compiler optimization, generate extern template
+template class LLPanel* LLView::getChild<class LLPanel>(
+ const std::string& name, BOOL recurse) const;
+
LLPanel::LocalizedString::LocalizedString()
: name("name"),
value("value")
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index 0a0fed82fb..a8bd5fd5e5 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -275,4 +275,10 @@ private:
}; // end class LLPanel
+// Build time optimization, generate once in .cpp file
+#ifndef LLPANEL_CPP
+extern template class LLPanel* LLView::getChild<class LLPanel>(
+ const std::string& name, BOOL recurse) const;
+#endif
+
#endif
diff --git a/indra/llui/llprogressbar.cpp b/indra/llui/llprogressbar.cpp
index c8b6e814e1..62ca569e6c 100644
--- a/indra/llui/llprogressbar.cpp
+++ b/indra/llui/llprogressbar.cpp
@@ -72,12 +72,13 @@ LLProgressBar::~LLProgressBar()
void LLProgressBar::draw()
{
static LLTimer timer;
-
- LLUIImagePtr bar_fg_imagep = LLUI::getUIImage("progressbar_fill.tga");
+ F32 alpha = getDrawContext().mAlpha;
- mImageBar->draw(getLocalRect(), mColorBackground.get());
+ LLColor4 image_bar_color = mColorBackground.get();
+ image_bar_color.setAlpha(alpha);
+ mImageBar->draw(getLocalRect(), image_bar_color);
- F32 alpha = 0.5f + 0.5f*0.5f*(1.f + (F32)sin(3.f*timer.getElapsedTimeF32()));
+ alpha *= 0.5f + 0.5f*0.5f*(1.f + (F32)sin(3.f*timer.getElapsedTimeF32()));
LLColor4 bar_color = mColorBar.get();
bar_color.mV[VALPHA] *= alpha; // modulate alpha
LLRect progress_rect = getLocalRect();
diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp
index d91b58b4ea..f6caed4617 100644
--- a/indra/llui/llscrollcontainer.cpp
+++ b/indra/llui/llscrollcontainer.cpp
@@ -111,8 +111,7 @@ LLScrollContainer::LLScrollContainer(const LLScrollContainer::Params& p)
LLView::addChild( mBorder );
mInnerRect.set( 0, getRect().getHeight(), getRect().getWidth(), 0 );
- if ( mBorder->getVisible() )
- mInnerRect.stretch( -mBorder->getBorderWidth() );
+ mInnerRect.stretch( -getBorderWidth() );
LLRect vertical_scroll_rect = mInnerRect;
vertical_scroll_rect.mLeft = vertical_scroll_rect.mRight - scrollbar_size;
@@ -190,8 +189,7 @@ void LLScrollContainer::reshape(S32 width, S32 height,
LLUICtrl::reshape( width, height, called_from_parent );
mInnerRect = getLocalRect();
- if ( mBorder->getVisible() )
- mInnerRect.stretch( -mBorder->getBorderWidth() );
+ mInnerRect.stretch( -getBorderWidth() );
if (mScrolledView)
{
@@ -353,9 +351,9 @@ void LLScrollContainer::calcVisibleSize( S32 *visible_width, S32 *visible_height
S32 doc_width = doc_rect.getWidth();
S32 doc_height = doc_rect.getHeight();
- S32 border_width = (mBorder->getVisible() ? 2 * mBorder->getBorderWidth() : 0);
- *visible_width = getRect().getWidth() - border_width;
- *visible_height = getRect().getHeight() - border_width;
+ S32 border_width = getBorderWidth();
+ *visible_width = getRect().getWidth() - 2 * border_width;
+ *visible_height = getRect().getHeight() - 2 * border_width;
*show_v_scrollbar = FALSE;
*show_h_scrollbar = FALSE;
@@ -501,7 +499,7 @@ void LLScrollContainer::updateScroll()
BOOL show_h_scrollbar = FALSE;
calcVisibleSize( &visible_width, &visible_height, &show_h_scrollbar, &show_v_scrollbar );
- S32 border_width = mBorder->getBorderWidth();
+ S32 border_width = getBorderWidth();
if( show_v_scrollbar )
{
if( doc_rect.mTop < getRect().getHeight() - border_width )
@@ -575,6 +573,9 @@ void LLScrollContainer::updateScroll()
void LLScrollContainer::setBorderVisible(BOOL b)
{
mBorder->setVisible( b );
+ // Recompute inner rect, as border visibility changes it
+ mInnerRect = getLocalRect();
+ mInnerRect.stretch( -getBorderWidth() );
}
LLRect LLScrollContainer::getVisibleContentRect()
@@ -586,15 +587,16 @@ LLRect LLScrollContainer::getVisibleContentRect()
return visible_rect;
}
-LLRect LLScrollContainer::getContentWindowRect() const
+LLRect LLScrollContainer::getContentWindowRect()
{
+ updateScroll();
LLRect scroller_view_rect;
S32 visible_width = 0;
S32 visible_height = 0;
BOOL show_h_scrollbar = FALSE;
BOOL show_v_scrollbar = FALSE;
calcVisibleSize( &visible_width, &visible_height, &show_h_scrollbar, &show_v_scrollbar );
- S32 border_width = mBorder->getVisible() ? mBorder->getBorderWidth() : 0;
+ S32 border_width = getBorderWidth();
scroller_view_rect.setOriginAndSize(border_width,
show_h_scrollbar ? mScrollbar[HORIZONTAL]->getRect().mTop : border_width,
visible_width,
@@ -675,7 +677,7 @@ void LLScrollContainer::goToBottom()
S32 LLScrollContainer::getBorderWidth() const
{
- if (mBorder)
+ if (mBorder->getVisible())
{
return mBorder->getBorderWidth();
}
diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h
index ac8ffe5258..25dcd071ab 100644
--- a/indra/llui/llscrollcontainer.h
+++ b/indra/llui/llscrollcontainer.h
@@ -96,7 +96,7 @@ public:
void setReserveScrollCorner( BOOL b ) { mReserveScrollCorner = b; }
LLRect getVisibleContentRect();
- LLRect getContentWindowRect() const;
+ LLRect getContentWindowRect();
const LLRect& getScrolledViewRect() const { return mScrolledView ? mScrolledView->getRect() : LLRect::null; }
void pageUp(S32 overlap = 0);
void pageDown(S32 overlap = 0);
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 7bf10d774c..db16670f79 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -156,6 +156,7 @@ LLTextBase::Params::Params()
read_only("read_only", false),
v_pad("v_pad", 0),
h_pad("h_pad", 0),
+ clip_partial("clip_partial", true),
line_spacing("line_spacing"),
max_text_length("max_length", 255),
font_shadow("font_shadow"),
@@ -193,6 +194,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p)
mHAlign(p.font_halign),
mLineSpacingMult(p.line_spacing.multiple),
mLineSpacingPixels(p.line_spacing.pixels),
+ mClipPartial(p.clip_partial),
mTrackEnd( p.track_end ),
mScrollIndex(-1),
mSelectionStart( 0 ),
@@ -379,10 +381,10 @@ void LLTextBase::drawSelectionBackground()
// Draw the selection box (we're using a box instead of reversing the colors on the selected text).
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- const LLColor4& color = mReadOnly ? mReadOnlyBgColor.get() : mWriteableBgColor.get();
+ const LLColor4& color = mReadOnly ? mReadOnlyFgColor.get() : mFgColor.get();
F32 alpha = hasFocus() ? 0.7f : 0.3f;
alpha *= getDrawContext().mAlpha;
- gGL.color4f( 1.f - color.mV[0], 1.f - color.mV[1], 1.f - color.mV[2], alpha );
+ LLColor4 selection_color(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], alpha);
for (std::vector<LLRect>::iterator rect_it = selection_rects.begin();
rect_it != selection_rects.end();
@@ -390,7 +392,7 @@ void LLTextBase::drawSelectionBackground()
{
LLRect selection_rect = *rect_it;
selection_rect.translate(mTextRect.mLeft - content_display_rect.mLeft, mTextRect.mBottom - content_display_rect.mBottom);
- gl_rect_2d(selection_rect);
+ gl_rect_2d(selection_rect, selection_color);
}
}
}
@@ -504,7 +506,7 @@ void LLTextBase::drawText()
}
LLRect scrolled_view_rect = getVisibleDocumentRect();
- std::pair<S32, S32> line_range = getVisibleLines();
+ std::pair<S32, S32> line_range = getVisibleLines(mClipPartial);
S32 first_line = line_range.first;
S32 last_line = line_range.second;
if (first_line >= last_line)
@@ -524,6 +526,7 @@ void LLTextBase::drawText()
for (S32 cur_line = first_line; cur_line < last_line; cur_line++)
{
+ S32 next_line = cur_line + 1;
line_info& line = mLineInfoList[cur_line];
if ((line.mRect.mTop - scrolled_view_rect.mBottom) < mTextRect.mBottom)
@@ -534,15 +537,15 @@ void LLTextBase::drawText()
S32 next_start = -1;
S32 line_end = text_len;
- if ((cur_line + 1) < getLineCount())
+ if (next_line < getLineCount())
{
- next_start = getLineStart(cur_line + 1);
+ next_start = getLineStart(next_line);
line_end = next_start;
}
LLRect text_rect(line.mRect.mLeft + mTextRect.mLeft - scrolled_view_rect.mLeft,
line.mRect.mTop - scrolled_view_rect.mBottom + mTextRect.mBottom,
- mDocumentView->getRect().getWidth() - scrolled_view_rect.mLeft,
+ llmin(mDocumentView->getRect().getWidth(), line.mRect.mRight) - scrolled_view_rect.mLeft,
line.mRect.mBottom - scrolled_view_rect.mBottom + mTextRect.mBottom);
// draw a single line of text
@@ -562,6 +565,17 @@ void LLTextBase::drawText()
}
S32 clipped_end = llmin( line_end, cur_segment->getEnd() ) - cur_segment->getStart();
+
+ if (mUseEllipses
+ && clipped_end == line_end
+ && next_line == last_line
+ && last_line < (S32)mLineInfoList.size())
+ {
+ // more text to go, but we can't fit it
+ // so attempt to draw one extra character to force ellipses
+ clipped_end++;
+ }
+
text_rect.mLeft = (S32)(cur_segment->draw(seg_start - cur_segment->getStart(), clipped_end, selection_left, selection_right, text_rect));
seg_start = clipped_end + cur_segment->getStart();
@@ -641,8 +655,6 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s
if ( truncate() )
{
- // The user's not getting everything he's hoping for
- make_ui_sound("UISndBadKeystroke");
insert_len = getLength() - old_len;
}
@@ -1070,6 +1082,8 @@ void LLTextBase::reflow(S32 start_index)
LLRect old_cursor_rect = getLocalRectFromDocIndex(mCursorPos);
bool follow_selection = mTextRect.overlaps(old_cursor_rect); // cursor is visible
+ old_cursor_rect.translate(-mTextRect.mLeft, -mTextRect.mBottom);
+
S32 first_line = getFirstVisibleLine();
// if scroll anchor not on first line, update it to first character of first line
@@ -1080,6 +1094,8 @@ void LLTextBase::reflow(S32 start_index)
mScrollIndex = mLineInfoList[first_line].mDocIndexStart;
}
LLRect first_char_rect = getLocalRectFromDocIndex(mScrollIndex);
+ // subtract off effect of horizontal scrollbar from local position of first char
+ first_char_rect.translate(-mTextRect.mLeft, -mTextRect.mBottom);
S32 cur_top = 0;
@@ -1178,6 +1194,10 @@ void LLTextBase::reflow(S32 start_index)
++seg_iter;
seg_offset = 0;
}
+ if (force_newline)
+ {
+ line_count++;
+ }
}
// calculate visible region for diplaying text
@@ -1195,7 +1215,6 @@ void LLTextBase::reflow(S32 start_index)
// apply scroll constraints after reflowing text
if (!hasMouseCapture() && mScroller)
{
- LLRect visible_content_rect = getVisibleDocumentRect();
if (scrolled_to_bottom && mTrackEnd)
{
// keep bottom of text buffer visible
@@ -1204,18 +1223,14 @@ void LLTextBase::reflow(S32 start_index)
else if (hasSelection() && follow_selection)
{
// keep cursor in same vertical position on screen when selecting text
- LLRect new_cursor_rect_doc = getLocalRectFromDocIndex(mCursorPos);
- new_cursor_rect_doc.translate(visible_content_rect.mLeft, visible_content_rect.mBottom);
+ LLRect new_cursor_rect_doc = getDocRectFromDocIndex(mCursorPos);
mScroller->scrollToShowRect(new_cursor_rect_doc, old_cursor_rect);
- //llassert_always(getLocalRectFromDocIndex(mCursorPos).mBottom == old_cursor_rect.mBottom);
}
else
{
// keep first line of text visible
- LLRect new_first_char_rect = getLocalRectFromDocIndex(mScrollIndex);
- new_first_char_rect.translate(visible_content_rect.mLeft, visible_content_rect.mBottom);
+ LLRect new_first_char_rect = getDocRectFromDocIndex(mScrollIndex);
mScroller->scrollToShowRect(new_first_char_rect, first_char_rect);
- //llassert_always(getLocalRectFromDocIndex(mScrollIndex).mBottom == first_char_rect.mBottom);
}
}
@@ -1464,14 +1479,16 @@ void LLTextBase::setText(const LLStringExplicit &utf8str ,const LLStyle::Params&
clearSegments();
// createDefaultSegment();
- startOfDoc();
deselect();
// append the new text (supports Url linking)
std::string text(utf8str);
LLStringUtil::removeCRLF(text);
+ // appendText modifies mCursorPos...
appendText(text, false, input_params);
+ // ...so move cursor to top after appending text
+ startOfDoc();
onValueChange(0, getLength());
}
@@ -2065,22 +2082,22 @@ void LLTextBase::updateRects()
mContentsRect.unionWith(line_iter->mRect);
}
- S32 delta_pos_x = -mContentsRect.mLeft;
mContentsRect.mTop += mVPad;
S32 delta_pos = -mContentsRect.mBottom;
// move line segments to fit new document rect
for (line_list_t::iterator it = mLineInfoList.begin(); it != mLineInfoList.end(); ++it)
{
- it->mRect.translate(delta_pos_x, delta_pos);
+ it->mRect.translate(0, delta_pos);
}
- mContentsRect.translate(delta_pos_x, delta_pos);
+ mContentsRect.translate(0, delta_pos);
}
// update document container dimensions according to text contents
LLRect doc_rect = mContentsRect;
// use old mTextRect constraint document to width of viewable region
- doc_rect.mRight = doc_rect.mLeft + mTextRect.getWidth();
+ doc_rect.mLeft = 0;
+ doc_rect.mRight = mTextRect.getWidth();
mDocumentView->setShape(doc_rect);
@@ -2281,7 +2298,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
LLFontGL::LEFT, LLFontGL::TOP,
0,
LLFontGL::NO_SHADOW,
- length, rect.mRight,
+ length, rect.getWidth(),
&right_x,
mEditor.getUseEllipses());
}
@@ -2298,7 +2315,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
LLFontGL::LEFT, LLFontGL::TOP,
0,
mStyle->getShadowType(),
- length, rect.mRight,
+ length, rect.getWidth(),
&right_x,
mEditor.getUseEllipses());
}
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index c376a73615..c60b040655 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -84,11 +84,13 @@ public:
wrap,
use_ellipses,
allow_html,
- parse_highlights;
+ parse_highlights,
+ clip_partial;
Optional<S32> v_pad,
h_pad;
+
Optional<LineSpacingParams>
line_spacing;
@@ -347,6 +349,7 @@ protected:
bool mTrackEnd; // if true, keeps scroll position at end of document during resize
bool mReadOnly;
bool mBGVisible; // render background?
+ bool mClipPartial; // false if we show lines that are partially inside bounding rect
S32 mMaxTextByteLength; // Maximum length mText is allowed to be in bytes
// support widgets
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp
index 4c4123cf45..0bd0ab59fb 100644
--- a/indra/llui/lltextbox.cpp
+++ b/indra/llui/lltextbox.cpp
@@ -31,7 +31,10 @@
*/
#include "linden_common.h"
+
+#define LLTEXTBOX_CPP
#include "lltextbox.h"
+
#include "lluictrlfactory.h"
#include "llfocusmgr.h"
#include "llwindow.h"
@@ -40,6 +43,10 @@
static LLDefaultChildRegistry::Register<LLTextBox> r("text");
+// Compiler optimization, generate extern template
+template class LLTextBox* LLView::getChild<class LLTextBox>(
+ const std::string& name, BOOL recurse) const;
+
LLTextBox::LLTextBox(const LLTextBox::Params& p)
: LLTextBase(p),
mClickedCallback(NULL)
diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h
index 01b4bfa5ed..3a045534d3 100644
--- a/indra/llui/lltextbox.h
+++ b/indra/llui/lltextbox.h
@@ -79,4 +79,10 @@ protected:
callback_t mClickedCallback;
};
+// Build time optimization, generate once in .cpp file
+#ifndef LLTEXTBOX_CPP
+extern template class LLTextBox* LLView::getChild<class LLTextBox>(
+ const std::string& name, BOOL recurse) const;
+#endif
+
#endif
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 3f4ef24f82..e68affc36c 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -1,6 +1,5 @@
/**
* @file lltexteditor.cpp
- * @brief LLTextEditor base class
*
* $LicenseInfo:firstyear=2001&license=viewergpl$
*
@@ -34,6 +33,7 @@
#include "linden_common.h"
+#define LLTEXTEDITOR_CPP
#include "lltexteditor.h"
#include "llfontfreetype.h" // for LLFontFreetype::FIRST_CHAR
@@ -73,6 +73,10 @@
//
static LLDefaultChildRegistry::Register<LLTextEditor> r("simple_text_editor");
+// Compiler optimization, generate extern template
+template class LLTextEditor* LLView::getChild<class LLTextEditor>(
+ const std::string& name, BOOL recurse) const;
+
//
// Constants
//
@@ -2158,7 +2162,7 @@ void LLTextEditor::drawLineNumbers()
return;
}
- S32 cursor_line = getLineNumFromDocIndex(mCursorPos);
+ S32 cursor_line = mLineInfoList[getLineNumFromDocIndex(mCursorPos)].mLineNum;
if (mShowLineNumbers)
{
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index fb014b86bf..043dda8fa6 100644
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -334,5 +334,10 @@ private:
LLContextMenu* mContextMenu;
}; // end class LLTextEditor
+// Build time optimization, generate once in .cpp file
+#ifndef LLTEXTEDITOR_CPP
+extern template class LLTextEditor* LLView::getChild<class LLTextEditor>(
+ const std::string& name, BOOL recurse) const;
+#endif
#endif // LL_TEXTEDITOR_
diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp
index d7228c78bd..01c7a81309 100644
--- a/indra/llui/lltooltip.cpp
+++ b/indra/llui/lltooltip.cpp
@@ -300,9 +300,8 @@ void LLToolTip::initFromParams(const LLToolTip::Params& p)
mTextBox->setText(p.message());
}
- LLRect text_contents_rect = mTextBox->getContentsRect();
- S32 text_width = llmin(p.max_width(), text_contents_rect.getWidth());
- S32 text_height = text_contents_rect.getHeight();
+ S32 text_width = llmin(p.max_width(), mTextBox->getTextPixelWidth());
+ S32 text_height = mTextBox->getTextPixelHeight();
mTextBox->reshape(text_width, text_height);
// reshape tooltip panel to fit text box
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index a30d5b4651..706712ec5e 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -31,15 +31,43 @@
* $/LicenseInfo$
*/
-//#include "llviewerprecompiledheaders.h"
#include "linden_common.h"
+
+#define LLUICTRL_CPP
#include "lluictrl.h"
+
#include "llfocusmgr.h"
#include "llpanel.h"
#include "lluictrlfactory.h"
static LLDefaultChildRegistry::Register<LLUICtrl> r("ui_ctrl");
+// Compiler optimization, generate extern template
+template class LLUICtrl* LLView::getChild<class LLUICtrl>(
+ const std::string& name, BOOL recurse) const;
+
+LLUICtrl::CallbackParam::CallbackParam()
+: name("name"),
+ function_name("function"),
+ parameter("parameter"),
+ control_name("control") // Shortcut to control -> "control_name" for backwards compatability
+{
+ addSynonym(parameter, "userdata");
+}
+
+LLUICtrl::EnableControls::EnableControls()
+: enabled("enabled_control"),
+ disabled("disabled_control")
+{}
+
+LLUICtrl::ControlVisibility::ControlVisibility()
+: visible("visibility_control"),
+ invisible("invisibility_control")
+{
+ addSynonym(visible, "visiblity_control");
+ addSynonym(invisible, "invisiblity_control");
+}
+
LLUICtrl::Params::Params()
: tab_stop("tab_stop", true),
chrome("chrome", false),
diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h
index aef1bcd519..b20ff5d798 100644
--- a/indra/llui/lluictrl.h
+++ b/indra/llui/lluictrl.h
@@ -75,14 +75,7 @@ public:
Optional<std::string> control_name;
- CallbackParam()
- : name("name"),
- function_name("function"),
- parameter("parameter"),
- control_name("control") // Shortcut to control -> "control_name" for backwards compatability
- {
- addSynonym(parameter, "userdata");
- }
+ CallbackParam();
};
struct CommitCallbackParam : public LLInitParam::Block<CommitCallbackParam, CallbackParam >
@@ -105,23 +98,14 @@ public:
Alternative<std::string> enabled;
Alternative<std::string> disabled;
- EnableControls()
- : enabled("enabled_control"),
- disabled("disabled_control")
- {}
+ EnableControls();
};
struct ControlVisibility : public LLInitParam::Choice<ControlVisibility>
{
Alternative<std::string> visible;
Alternative<std::string> invisible;
- ControlVisibility()
- : visible("visibility_control"),
- invisible("invisibility_control")
- {
- addSynonym(visible, "visiblity_control");
- addSynonym(invisible, "invisiblity_control");
- }
+ ControlVisibility();
};
struct Params : public LLInitParam::Block<Params, LLView::Params>
{
@@ -328,4 +312,10 @@ private:
class DefaultTabGroupFirstSorter;
};
+// Build time optimization, generate once in .cpp file
+#ifndef LLUICTRL_CPP
+extern template class LLUICtrl* LLView::getChild<class LLUICtrl>(
+ const std::string& name, BOOL recurse) const;
+#endif
+
#endif // LL_LLUICTRL_H
diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp
index 1c1450d7e9..3643bf44f7 100644
--- a/indra/llui/lluictrlfactory.cpp
+++ b/indra/llui/lluictrlfactory.cpp
@@ -32,6 +32,7 @@
#include "linden_common.h"
+#define LLUICTRLFACTORY_CPP
#include "lluictrlfactory.h"
#include "llxmlnode.h"
@@ -75,6 +76,9 @@ public:
static LLDefaultChildRegistry::Register<LLUICtrlLocate> r1("locate");
+// Build time optimization, generate this once in .cpp file
+template class LLUICtrlFactory* LLSingleton<class LLUICtrlFactory>::getInstance();
+
//-----------------------------------------------------------------------------
// LLUICtrlFactory()
//-----------------------------------------------------------------------------
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index 8a9c9e23c1..55d7d745eb 100644
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -108,6 +108,11 @@ extern LLFastTimer::DeclareTimer FTM_WIDGET_SETUP;
extern LLFastTimer::DeclareTimer FTM_WIDGET_CONSTRUCTION;
extern LLFastTimer::DeclareTimer FTM_INIT_FROM_PARAMS;
+// Build time optimization, generate this once in .cpp file
+#ifndef LLUICTRLFACTORY_CPP
+extern template class LLUICtrlFactory* LLSingleton<class LLUICtrlFactory>::getInstance();
+#endif
+
class LLUICtrlFactory : public LLSingleton<LLUICtrlFactory>
{
private:
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index dba24ee165..23e4131e6d 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -33,6 +33,7 @@
#include "linden_common.h"
+#define LLVIEW_CPP
#include "llview.h"
#include <cassert>
@@ -76,8 +77,17 @@ std::vector<LLViewDrawContext*> LLViewDrawContext::sDrawContextStack;
BOOL LLView::sIsDrawing = FALSE;
#endif
+// Compiler optimization, generate extern template
+template class LLView* LLView::getChild<class LLView>(
+ const std::string& name, BOOL recurse) const;
+
static LLDefaultChildRegistry::Register<LLView> r("view");
+LLView::Follows::Follows()
+: string(""),
+ flags("flags", FOLLOWS_LEFT | FOLLOWS_TOP)
+{}
+
LLView::Params::Params()
: name("name", std::string("unnamed")),
enabled("enabled", true),
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 2607120e17..d485244a05 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -111,10 +111,7 @@ public:
Alternative<std::string> string;
Alternative<U32> flags;
- Follows()
- : string(""),
- flags("flags", FOLLOWS_LEFT | FOLLOWS_TOP)
- {}
+ Follows();
};
struct Params : public LLInitParam::Block<Params>
@@ -659,4 +656,11 @@ template <class T> T* LLView::getChild(const std::string& name, BOOL recurse) co
return result;
}
+// Compiler optimization - don't generate these specializations inline,
+// require explicit specialization. See llbutton.cpp for an example.
+#ifndef LLVIEW_CPP
+extern template class LLView* LLView::getChild<class LLView>(
+ const std::string& name, BOOL recurse) const;
+#endif
+
#endif //LL_LLVIEW_H