summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2009-12-01 08:51:32 -0800
committerJames Cook <james@lindenlab.com>2009-12-01 08:51:32 -0800
commit5e11affddb1b8816f57f9314381486c00033e080 (patch)
treeb21e2486be2daaa9b249588ce7d88f0f9f472814 /indra/llui
parent677938e6531209ca9ccd29146454af67f1c743c7 (diff)
parentbf34e572e7acd0f80d103318b76b4abe32c802d3 (diff)
merge
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/llfloater.cpp5
-rw-r--r--indra/llui/lllineeditor.cpp5
-rw-r--r--indra/llui/lllineeditor.h5
-rw-r--r--indra/llui/llpanel.cpp5
-rw-r--r--indra/llui/llpanel.h6
-rw-r--r--indra/llui/llscrollcontainer.cpp5
-rw-r--r--indra/llui/llscrollcontainer.h2
-rw-r--r--indra/llui/lltextbase.cpp60
-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
24 files changed, 180 insertions, 58 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/llfloater.cpp b/indra/llui/llfloater.cpp
index 8cf65fe76a..36a9e0a650 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -2347,8 +2347,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 +2387,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/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/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/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp
index d91b58b4ea..8a33619b58 100644
--- a/indra/llui/llscrollcontainer.cpp
+++ b/indra/llui/llscrollcontainer.cpp
@@ -586,8 +586,9 @@ 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;
@@ -627,7 +628,7 @@ void LLScrollContainer::scrollToShowRect(const LLRect& rect, const LLRect& const
rect_to_constrain.mTop - constraint.mTop);
// translate from allowable region for lower left corner to upper left corner
- allowable_scroll_rect.translate(0, content_window_rect.getHeight());
+ allowable_scroll_rect.translate(0, content_window_rect.getHeight() - 1);
S32 vert_pos = llclamp(mScrollbar[VERTICAL]->getDocPos(),
mScrollbar[VERTICAL]->getDocSize() - allowable_scroll_rect.mTop, // min vertical scroll
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..64164df17f 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,16 +2082,15 @@ 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
@@ -2281,7 +2297,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 +2314,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