aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llui')
-rw-r--r--linden/indra/llui/llfloater.cpp22
-rw-r--r--linden/indra/llui/lllineeditor.cpp29
-rw-r--r--linden/indra/llui/lllineeditor.h3
-rw-r--r--linden/indra/llui/llmenugl.cpp3
-rw-r--r--linden/indra/llui/llmultislider.cpp2
-rw-r--r--linden/indra/llui/llscrollcontainer.cpp2
-rw-r--r--linden/indra/llui/llscrolllistctrl.cpp4
-rw-r--r--linden/indra/llui/llslider.cpp2
-rw-r--r--linden/indra/llui/lltexteditor.cpp144
-rw-r--r--linden/indra/llui/lltexteditor.h20
-rw-r--r--linden/indra/llui/llui.cpp88
-rw-r--r--linden/indra/llui/llview.cpp4
-rw-r--r--linden/indra/llui/llviewborder.cpp8
13 files changed, 179 insertions, 152 deletions
diff --git a/linden/indra/llui/llfloater.cpp b/linden/indra/llui/llfloater.cpp
index 9f8cd65..047342f 100644
--- a/linden/indra/llui/llfloater.cpp
+++ b/linden/indra/llui/llfloater.cpp
@@ -127,6 +127,7 @@ LLFloaterView* gFloaterView = NULL;
127 127
128LLFloater::LLFloater() : 128LLFloater::LLFloater() :
129 //FIXME: we should initialize *all* member variables here 129 //FIXME: we should initialize *all* member variables here
130 LLPanel(), mAutoFocus(TRUE),
130 mResizable(FALSE), 131 mResizable(FALSE),
131 mDragOnLeft(FALSE), 132 mDragOnLeft(FALSE),
132 mMinWidth(0), 133 mMinWidth(0),
@@ -139,6 +140,11 @@ LLFloater::LLFloater() :
139 mButtonsEnabled[i] = FALSE; 140 mButtonsEnabled[i] = FALSE;
140 mButtons[i] = NULL; 141 mButtons[i] = NULL;
141 } 142 }
143 for (S32 i = 0; i < 4; i++)
144 {
145 mResizeBar[i] = NULL;
146 mResizeHandle[i] = NULL;
147 }
142 mDragHandle = NULL; 148 mDragHandle = NULL;
143 mHandle.bind(this); 149 mHandle.bind(this);
144} 150}
@@ -151,6 +157,11 @@ LLFloater::LLFloater(const std::string& name)
151 mButtonsEnabled[i] = FALSE; 157 mButtonsEnabled[i] = FALSE;
152 mButtons[i] = NULL; 158 mButtons[i] = NULL;
153 } 159 }
160 for (S32 i = 0; i < 4; i++)
161 {
162 mResizeBar[i] = NULL;
163 mResizeHandle[i] = NULL;
164 }
154 std::string title; // null string 165 std::string title; // null string
155 initFloater(title, FALSE, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, FALSE, TRUE, TRUE); // defaults 166 initFloater(title, FALSE, DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT, FALSE, TRUE, TRUE); // defaults
156} 167}
@@ -171,6 +182,11 @@ LLFloater::LLFloater(const std::string& name, const LLRect& rect, const std::str
171 mButtonsEnabled[i] = FALSE; 182 mButtonsEnabled[i] = FALSE;
172 mButtons[i] = NULL; 183 mButtons[i] = NULL;
173 } 184 }
185 for (S32 i = 0; i < 4; i++)
186 {
187 mResizeBar[i] = NULL;
188 mResizeHandle[i] = NULL;
189 }
174 initFloater( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn); 190 initFloater( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn);
175} 191}
176 192
@@ -189,6 +205,11 @@ LLFloater::LLFloater(const std::string& name, const std::string& rect_control, c
189 mButtonsEnabled[i] = FALSE; 205 mButtonsEnabled[i] = FALSE;
190 mButtons[i] = NULL; 206 mButtons[i] = NULL;
191 } 207 }
208 for (S32 i = 0; i < 4; i++)
209 {
210 mResizeBar[i] = NULL;
211 mResizeHandle[i] = NULL;
212 }
192 initFloater( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn); 213 initFloater( title, resizable, min_width, min_height, drag_on_left, minimizable, close_btn);
193} 214}
194 215
@@ -1580,6 +1601,7 @@ void LLFloater::updateButtons()
1580 S32 button_count = 0; 1601 S32 button_count = 0;
1581 for (S32 i = 0; i < BUTTON_COUNT; i++) 1602 for (S32 i = 0; i < BUTTON_COUNT; i++)
1582 { 1603 {
1604 if(!mButtons[i]) continue;
1583 mButtons[i]->setEnabled(mButtonsEnabled[i]); 1605 mButtons[i]->setEnabled(mButtonsEnabled[i]);
1584 1606
1585 if (mButtonsEnabled[i] 1607 if (mButtonsEnabled[i]
diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp
index 12d1929..a0af463 100644
--- a/linden/indra/llui/lllineeditor.cpp
+++ b/linden/indra/llui/lllineeditor.cpp
@@ -35,6 +35,7 @@
35 35
36#include "lllineeditor.h" 36#include "lllineeditor.h"
37 37
38#include "lltexteditor.h"
38#include "audioengine.h" 39#include "audioengine.h"
39#include "llmath.h" 40#include "llmath.h"
40#include "llfontgl.h" 41#include "llfontgl.h"
@@ -450,19 +451,19 @@ BOOL LLLineEditor::handleDoubleClick(S32 x, S32 y, MASK mask)
450 BOOL doSelectAll = TRUE; 451 BOOL doSelectAll = TRUE;
451 452
452 // Select the word we're on 453 // Select the word we're on
453 if( isPartOfWord( wtext[mCursorPos] ) ) 454 if( LLTextEditor::isPartOfWord( wtext[mCursorPos] ) )
454 { 455 {
455 S32 old_selection_start = mLastSelectionStart; 456 S32 old_selection_start = mLastSelectionStart;
456 S32 old_selection_end = mLastSelectionEnd; 457 S32 old_selection_end = mLastSelectionEnd;
457 458
458 // Select word the cursor is over 459 // Select word the cursor is over
459 while ((mCursorPos > 0) && isPartOfWord( wtext[mCursorPos-1] )) 460 while ((mCursorPos > 0) && LLTextEditor::isPartOfWord( wtext[mCursorPos-1] ))
460 { // Find the start of the word 461 { // Find the start of the word
461 mCursorPos--; 462 mCursorPos--;
462 } 463 }
463 startSelection(); 464 startSelection();
464 465
465 while ((mCursorPos < (S32)wtext.length()) && isPartOfWord( wtext[mCursorPos] ) ) 466 while ((mCursorPos < (S32)wtext.length()) && LLTextEditor::isPartOfWord( wtext[mCursorPos] ) )
466 { // Find the end of the word 467 { // Find the end of the word
467 mCursorPos++; 468 mCursorPos++;
468 } 469 }
@@ -764,7 +765,7 @@ S32 LLLineEditor::prevWordPos(S32 cursorPos) const
764 { 765 {
765 cursorPos--; 766 cursorPos--;
766 } 767 }
767 while( (cursorPos > 0) && isPartOfWord( wtext[cursorPos-1] ) ) 768 while( (cursorPos > 0) && LLTextEditor::isPartOfWord( wtext[cursorPos-1] ) )
768 { 769 {
769 cursorPos--; 770 cursorPos--;
770 } 771 }
@@ -774,7 +775,7 @@ S32 LLLineEditor::prevWordPos(S32 cursorPos) const
774S32 LLLineEditor::nextWordPos(S32 cursorPos) const 775S32 LLLineEditor::nextWordPos(S32 cursorPos) const
775{ 776{
776 const LLWString& wtext = mText.getWString(); 777 const LLWString& wtext = mText.getWString();
777 while( (cursorPos < getLength()) && isPartOfWord( wtext[cursorPos] ) ) 778 while( (cursorPos < getLength()) && LLTextEditor::isPartOfWord( wtext[cursorPos] ) )
778 { 779 {
779 cursorPos++; 780 cursorPos++;
780 } 781 }
@@ -1422,7 +1423,7 @@ void LLLineEditor::draw()
1422#else // the old programmer art. 1423#else // the old programmer art.
1423 // drawing solids requires texturing be disabled 1424 // drawing solids requires texturing be disabled
1424 { 1425 {
1425 LLGLSNoTexture no_texture; 1426 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
1426 // draw background for text 1427 // draw background for text
1427 if( !mReadOnly ) 1428 if( !mReadOnly )
1428 { 1429 {
@@ -1817,9 +1818,6 @@ BOOL LLLineEditor::prevalidateFloat(const LLWString &str)
1817 return success; 1818 return success;
1818} 1819}
1819 1820
1820//static
1821BOOL LLLineEditor::isPartOfWord(llwchar c) { return (c == '_') || isalnum(c); }
1822
1823// static 1821// static
1824BOOL LLLineEditor::postvalidateFloat(const std::string &str) 1822BOOL LLLineEditor::postvalidateFloat(const std::string &str)
1825{ 1823{
@@ -1993,7 +1991,7 @@ BOOL LLLineEditor::prevalidateAlphaNum(const LLWString &str)
1993 if(len == 0) return rv; 1991 if(len == 0) return rv;
1994 while(len--) 1992 while(len--)
1995 { 1993 {
1996 if( !isalnum(str[len]) ) 1994 if( !LLStringOps::isAlnum((char)str[len]) )
1997 { 1995 {
1998 rv = FALSE; 1996 rv = FALSE;
1999 break; 1997 break;
@@ -2012,7 +2010,7 @@ BOOL LLLineEditor::prevalidateAlphaNumSpace(const LLWString &str)
2012 if(len == 0) return rv; 2010 if(len == 0) return rv;
2013 while(len--) 2011 while(len--)
2014 { 2012 {
2015 if(!(isalnum(str[len]) || (' ' == str[len]))) 2013 if(!(LLStringOps::isAlnum((char)str[len]) || (' ' == str[len])))
2016 { 2014 {
2017 rv = FALSE; 2015 rv = FALSE;
2018 break; 2016 break;
@@ -2034,7 +2032,7 @@ BOOL LLLineEditor::prevalidatePrintableNotPipe(const LLWString &str)
2034 rv = FALSE; 2032 rv = FALSE;
2035 break; 2033 break;
2036 } 2034 }
2037 if(!((' ' == str[len]) || isalnum(str[len]) || ispunct(str[len]))) 2035 if(!((' ' == str[len]) || LLStringOps::isAlnum((char)str[len]) || LLStringOps::isPunct((char)str[len])))
2038 { 2036 {
2039 rv = FALSE; 2037 rv = FALSE;
2040 break; 2038 break;
@@ -2052,12 +2050,13 @@ BOOL LLLineEditor::prevalidatePrintableNoSpace(const LLWString &str)
2052 if(len == 0) return rv; 2050 if(len == 0) return rv;
2053 while(len--) 2051 while(len--)
2054 { 2052 {
2055 if(iswspace(str[len])) 2053 if(LLStringOps::isSpace(str[len]))
2056 { 2054 {
2057 rv = FALSE; 2055 rv = FALSE;
2058 break; 2056 break;
2059 } 2057 }
2060 if( !(isalnum(str[len]) || ispunct(str[len]) ) ) 2058 if( !(LLStringOps::isAlnum((char)str[len]) ||
2059 LLStringOps::isPunct((char)str[len]) ) )
2061 { 2060 {
2062 rv = FALSE; 2061 rv = FALSE;
2063 break; 2062 break;
@@ -2282,7 +2281,7 @@ LLView* LLLineEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory
2282} 2281}
2283 2282
2284//static 2283//static
2285void LLLineEditor::cleanupClass() 2284void LLLineEditor::cleanupLineEditor()
2286{ 2285{
2287 sImage = NULL; 2286 sImage = NULL;
2288} 2287}
diff --git a/linden/indra/llui/lllineeditor.h b/linden/indra/llui/lllineeditor.h
index 09a240b..bc9e406 100644
--- a/linden/indra/llui/lllineeditor.h
+++ b/linden/indra/llui/lllineeditor.h
@@ -82,7 +82,7 @@ public:
82 virtual LLXMLNodePtr getXML(bool save_children = true) const; 82 virtual LLXMLNodePtr getXML(bool save_children = true) const;
83 void setColorParameters(LLXMLNodePtr node); 83 void setColorParameters(LLXMLNodePtr node);
84 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); 84 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
85 static void cleanupClass(); 85 static void cleanupLineEditor();
86 86
87 // mousehandler overrides 87 // mousehandler overrides
88 /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); 88 /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
@@ -194,7 +194,6 @@ public:
194 void setMaxTextLength(S32 max_text_length); 194 void setMaxTextLength(S32 max_text_length);
195 void setTextPadding(S32 left, S32 right); // Used to specify room for children before or after text. 195 void setTextPadding(S32 left, S32 right); // Used to specify room for children before or after text.
196 196
197 static BOOL isPartOfWord(llwchar c);
198 // Prevalidation controls which keystrokes can affect the editor 197 // Prevalidation controls which keystrokes can affect the editor
199 void setPrevalidate( BOOL (*func)(const LLWString &) ); 198 void setPrevalidate( BOOL (*func)(const LLWString &) );
200 static BOOL prevalidateFloat(const LLWString &str ); 199 static BOOL prevalidateFloat(const LLWString &str );
diff --git a/linden/indra/llui/llmenugl.cpp b/linden/indra/llui/llmenugl.cpp
index 24cc47e..4766267 100644
--- a/linden/indra/llui/llmenugl.cpp
+++ b/linden/indra/llui/llmenugl.cpp
@@ -1309,6 +1309,7 @@ void LLMenuItemBranchGL::openMenu()
1309 } 1309 }
1310 mBranch->translate( delta_x, delta_y ); 1310 mBranch->translate( delta_x, delta_y );
1311 mBranch->setVisible( TRUE ); 1311 mBranch->setVisible( TRUE );
1312 mBranch->getParent()->sendChildToFront(mBranch);
1312 } 1313 }
1313} 1314}
1314 1315
@@ -1427,6 +1428,7 @@ void LLMenuItemBranchDownGL::openMenu( void )
1427 1428
1428 setHighlight(TRUE); 1429 setHighlight(TRUE);
1429 branch->setVisible( TRUE ); 1430 branch->setVisible( TRUE );
1431 branch->getParent()->sendChildToFront(branch);
1430 } 1432 }
1431 } 1433 }
1432} 1434}
@@ -2958,6 +2960,7 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y)
2958 } 2960 }
2959 menu->translate( delta_x, delta_y ); 2961 menu->translate( delta_x, delta_y );
2960 menu->setVisible( TRUE ); 2962 menu->setVisible( TRUE );
2963 menu->getParent()->sendChildToFront(menu);
2961} 2964}
2962 2965
2963//----------------------------------------------------------------------------- 2966//-----------------------------------------------------------------------------
diff --git a/linden/indra/llui/llmultislider.cpp b/linden/indra/llui/llmultislider.cpp
index 227cf98..11c2cba 100644
--- a/linden/indra/llui/llmultislider.cpp
+++ b/linden/indra/llui/llmultislider.cpp
@@ -431,7 +431,7 @@ void LLMultiSlider::draw()
431 // Draw background and thumb. 431 // Draw background and thumb.
432 432
433 // drawing solids requires texturing be disabled 433 // drawing solids requires texturing be disabled
434 LLGLSNoTexture no_texture; 434 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
435 435
436 LLRect rect(mDragStartThumbRect); 436 LLRect rect(mDragStartThumbRect);
437 437
diff --git a/linden/indra/llui/llscrollcontainer.cpp b/linden/indra/llui/llscrollcontainer.cpp
index 1ba2923..51face6 100644
--- a/linden/indra/llui/llscrollcontainer.cpp
+++ b/linden/indra/llui/llscrollcontainer.cpp
@@ -425,7 +425,7 @@ void LLScrollableContainerView::draw()
425 // Draw background 425 // Draw background
426 if( mIsOpaque ) 426 if( mIsOpaque )
427 { 427 {
428 LLGLSNoTexture no_texture; 428 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
429 gGL.color4fv( mBackgroundColor.mV ); 429 gGL.color4fv( mBackgroundColor.mV );
430 gl_rect_2d( mInnerRect ); 430 gl_rect_2d( mInnerRect );
431 } 431 }
diff --git a/linden/indra/llui/llscrolllistctrl.cpp b/linden/indra/llui/llscrolllistctrl.cpp
index d342378..92bcb88 100644
--- a/linden/indra/llui/llscrolllistctrl.cpp
+++ b/linden/indra/llui/llscrolllistctrl.cpp
@@ -435,7 +435,7 @@ void LLScrollListItem::draw(const LLRect& rect, const LLColor4& fg_color, const
435 // draw background rect 435 // draw background rect
436 LLRect bg_rect = rect; 436 LLRect bg_rect = rect;
437 { 437 {
438 LLGLSNoTexture no_texture; 438 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
439 gGL.color4fv(bg_color.mV); 439 gGL.color4fv(bg_color.mV);
440 gl_rect_2d( bg_rect ); 440 gl_rect_2d( bg_rect );
441 } 441 }
@@ -1758,7 +1758,7 @@ void LLScrollListCtrl::draw()
1758 // Draw background 1758 // Draw background
1759 if (mBackgroundVisible) 1759 if (mBackgroundVisible)
1760 { 1760 {
1761 LLGLSNoTexture no_texture; 1761 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
1762 gGL.color4fv( getEnabled() ? mBgWriteableColor.mV : mBgReadOnlyColor.mV ); 1762 gGL.color4fv( getEnabled() ? mBgWriteableColor.mV : mBgReadOnlyColor.mV );
1763 gl_rect_2d(background); 1763 gl_rect_2d(background);
1764 } 1764 }
diff --git a/linden/indra/llui/llslider.cpp b/linden/indra/llui/llslider.cpp
index 4cc558f..b2438af 100644
--- a/linden/indra/llui/llslider.cpp
+++ b/linden/indra/llui/llslider.cpp
@@ -253,7 +253,7 @@ void LLSlider::draw()
253 // Draw background and thumb. 253 // Draw background and thumb.
254 254
255 // drawing solids requires texturing be disabled 255 // drawing solids requires texturing be disabled
256 LLGLSNoTexture no_texture; 256 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
257 257
258 F32 opacity = getEnabled() ? 1.f : 0.3f; 258 F32 opacity = getEnabled() ? 1.f : 0.3f;
259 LLColor4 center_color = (mThumbCenterColor % opacity); 259 LLColor4 center_color = (mThumbCenterColor % opacity);
diff --git a/linden/indra/llui/lltexteditor.cpp b/linden/indra/llui/lltexteditor.cpp
index e56002f..281dbe4 100644
--- a/linden/indra/llui/lltexteditor.cpp
+++ b/linden/indra/llui/lltexteditor.cpp
@@ -260,7 +260,7 @@ LLTextEditor::LLTextEditor(
260 mIsSelecting( FALSE ), 260 mIsSelecting( FALSE ),
261 mSelectionStart( 0 ), 261 mSelectionStart( 0 ),
262 mSelectionEnd( 0 ), 262 mSelectionEnd( 0 ),
263 mScrolledToBottom( FALSE ), 263 mScrolledToBottom( TRUE ),
264 mOnScrollEndCallback( NULL ), 264 mOnScrollEndCallback( NULL ),
265 mOnScrollEndData( NULL ), 265 mOnScrollEndData( NULL ),
266 mCursorColor( LLUI::sColorsGroup->getColor( "TextCursorColor" ) ), 266 mCursorColor( LLUI::sColorsGroup->getColor( "TextCursorColor" ) ),
@@ -277,14 +277,16 @@ LLTextEditor::LLTextEditor(
277 mCommitOnFocusLost( FALSE ), 277 mCommitOnFocusLost( FALSE ),
278 mHideScrollbarForShortDocs( FALSE ), 278 mHideScrollbarForShortDocs( FALSE ),
279 mTakesNonScrollClicks( TRUE ), 279 mTakesNonScrollClicks( TRUE ),
280 mTrackBottom( TRUE ), 280 mTrackBottom( FALSE ),
281 mAllowEmbeddedItems( allow_embedded_items ), 281 mAllowEmbeddedItems( allow_embedded_items ),
282 mAcceptCallingCardNames(FALSE), 282 mAcceptCallingCardNames(FALSE),
283 mHandleEditKeysDirectly( FALSE ), 283 mHandleEditKeysDirectly( FALSE ),
284 mMouseDownX(0), 284 mMouseDownX(0),
285 mMouseDownY(0), 285 mMouseDownY(0),
286 mLastSelectionX(-1), 286 mLastSelectionX(-1),
287 mLastSelectionY(-1) 287 mLastSelectionY(-1),
288 mReflowNeeded(FALSE),
289 mScrollNeeded(FALSE)
288{ 290{
289 mSourceID.generate(); 291 mSourceID.generate();
290 292
@@ -468,6 +470,13 @@ void LLTextEditor::updateLineStartList(S32 startpos)
468 mScrollbar->setVisible(!short_doc); 470 mScrollbar->setVisible(!short_doc);
469 } 471 }
470 472
473 // if scrolled to bottom, stay at bottom
474 // unless user is editing text
475 // do this after updating page size
476 if (mScrolledToBottom && mTrackBottom && !hasFocus())
477 {
478 endOfDoc();
479 }
471} 480}
472 481
473//////////////////////////////////////////////////////////// 482////////////////////////////////////////////////////////////
@@ -511,8 +520,7 @@ void LLTextEditor::setText(const LLStringExplicit &utf8str)
511 setCursorPos(0); 520 setCursorPos(0);
512 deselect(); 521 deselect();
513 522
514 updateLineStartList(); 523 needsReflow();
515 updateScrollFromCursor();
516 524
517 resetDirty(); 525 resetDirty();
518} 526}
@@ -529,8 +537,7 @@ void LLTextEditor::setWText(const LLWString &wtext)
529 setCursorPos(0); 537 setCursorPos(0);
530 deselect(); 538 deselect();
531 539
532 updateLineStartList(); 540 needsReflow();
533 updateScrollFromCursor();
534 541
535 resetDirty(); 542 resetDirty();
536} 543}
@@ -568,8 +575,7 @@ void LLTextEditor::setWordWrap(BOOL b)
568 setCursorPos(0); 575 setCursorPos(0);
569 deselect(); 576 deselect();
570 577
571 updateLineStartList(); 578 needsReflow();
572 updateScrollFromCursor();
573} 579}
574 580
575 581
@@ -734,6 +740,7 @@ S32 LLTextEditor::getLineStart( S32 line ) const
734 { 740 {
735 return 0; 741 return 0;
736 } 742 }
743
737 line = llclamp(line, 0, num_lines-1); 744 line = llclamp(line, 0, num_lines-1);
738 S32 segidx = mLineStartList[line].mSegment; 745 S32 segidx = mLineStartList[line].mSegment;
739 S32 segoffset = mLineStartList[line].mOffset; 746 S32 segoffset = mLineStartList[line].mOffset;
@@ -781,14 +788,14 @@ void LLTextEditor::getSegmentAndOffset( S32 startpos, S32* segidxp, S32* offsetp
781 *offsetp = startpos - (*seg_iter)->getStart(); 788 *offsetp = startpos - (*seg_iter)->getStart();
782} 789}
783 790
784const LLTextSegment* LLTextEditor::getPreviousSegment() 791const LLTextSegment* LLTextEditor::getPreviousSegment() const
785{ 792{
786 // find segment index at character to left of cursor (or rightmost edge of selection) 793 // find segment index at character to left of cursor (or rightmost edge of selection)
787 S32 idx = llmax(0, getSegmentIdxAtOffset(mCursorPos) - 1); 794 S32 idx = llmax(0, getSegmentIdxAtOffset(mCursorPos) - 1);
788 return idx >= 0 ? mSegments[idx] : NULL; 795 return idx >= 0 ? mSegments[idx] : NULL;
789} 796}
790 797
791void LLTextEditor::getSelectedSegments(std::vector<const LLTextSegment*>& segments) 798void LLTextEditor::getSelectedSegments(std::vector<const LLTextSegment*>& segments) const
792{ 799{
793 S32 left = hasSelection() ? llmin(mSelectionStart, mSelectionEnd) : mCursorPos; 800 S32 left = hasSelection() ? llmin(mSelectionStart, mSelectionEnd) : mCursorPos;
794 S32 right = hasSelection() ? llmax(mSelectionStart, mSelectionEnd) : mCursorPos; 801 S32 right = hasSelection() ? llmax(mSelectionStart, mSelectionEnd) : mCursorPos;
@@ -875,13 +882,12 @@ void LLTextEditor::setCursor(S32 row, S32 column)
875 } 882 }
876 doc += column; 883 doc += column;
877 setCursorPos(doc - mWText.c_str()); 884 setCursorPos(doc - mWText.c_str());
878 updateScrollFromCursor();
879} 885}
880 886
881void LLTextEditor::setCursorPos(S32 offset) 887void LLTextEditor::setCursorPos(S32 offset)
882{ 888{
883 mCursorPos = llclamp(offset, 0, (S32)getLength()); 889 mCursorPos = llclamp(offset, 0, (S32)getLength());
884 updateScrollFromCursor(); 890 needsScroll();
885 // reset desired x cursor position 891 // reset desired x cursor position
886 mDesiredXPixel = -1; 892 mDesiredXPixel = -1;
887} 893}
@@ -1222,8 +1228,6 @@ BOOL LLTextEditor::handleHover(S32 x, S32 y, MASK mask)
1222 1228
1223 setCursorAtLocalPos( x, y, TRUE ); 1229 setCursorAtLocalPos( x, y, TRUE );
1224 mSelectionEnd = mCursorPos; 1230 mSelectionEnd = mCursorPos;
1225
1226 updateScrollFromCursor();
1227 } 1231 }
1228 1232
1229 lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl; 1233 lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl;
@@ -1317,8 +1321,6 @@ BOOL LLTextEditor::handleMouseUp(S32 x, S32 y, MASK mask)
1317 1321
1318 setCursorAtLocalPos( x, y, TRUE ); 1322 setCursorAtLocalPos( x, y, TRUE );
1319 endSelection(); 1323 endSelection();
1320
1321 updateScrollFromCursor();
1322 } 1324 }
1323 1325
1324 if( !hasSelection() ) 1326 if( !hasSelection() )
@@ -1839,8 +1841,7 @@ void LLTextEditor::cut()
1839 gClipboard.copyFromSubstring( mWText, left_pos, length, mSourceID ); 1841 gClipboard.copyFromSubstring( mWText, left_pos, length, mSourceID );
1840 deleteSelection( FALSE ); 1842 deleteSelection( FALSE );
1841 1843
1842 updateLineStartList(); 1844 needsReflow();
1843 updateScrollFromCursor();
1844} 1845}
1845 1846
1846BOOL LLTextEditor::canCopy() const 1847BOOL LLTextEditor::canCopy() const
@@ -1910,8 +1911,7 @@ void LLTextEditor::paste()
1910 setCursorPos(mCursorPos + insert(mCursorPos, clean_string, FALSE)); 1911 setCursorPos(mCursorPos + insert(mCursorPos, clean_string, FALSE));
1911 deselect(); 1912 deselect();
1912 1913
1913 updateLineStartList(); 1914 needsReflow();
1914 updateScrollFromCursor();
1915} 1915}
1916 1916
1917 1917
@@ -2235,9 +2235,9 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask )
2235 2235
2236 if(text_may_have_changed) 2236 if(text_may_have_changed)
2237 { 2237 {
2238 updateLineStartList(); 2238 needsReflow();
2239 } 2239 }
2240 updateScrollFromCursor(); 2240 needsScroll();
2241 } 2241 }
2242 } 2242 }
2243 2243
@@ -2280,8 +2280,7 @@ BOOL LLTextEditor::handleUnicodeCharHere(llwchar uni_char)
2280 // Most keystrokes will make the selection box go away, but not all will. 2280 // Most keystrokes will make the selection box go away, but not all will.
2281 deselect(); 2281 deselect();
2282 2282
2283 updateLineStartList(); 2283 needsReflow();
2284 updateScrollFromCursor();
2285 } 2284 }
2286 } 2285 }
2287 2286
@@ -2339,8 +2338,7 @@ void LLTextEditor::doDelete()
2339 } 2338 }
2340 } 2339 }
2341 2340
2342 updateLineStartList(); 2341 needsReflow();
2343 updateScrollFromCursor();
2344} 2342}
2345 2343
2346//---------------------------------------------------------------------------- 2344//----------------------------------------------------------------------------
@@ -2383,8 +2381,7 @@ void LLTextEditor::undo()
2383 2381
2384 setCursorPos(pos); 2382 setCursorPos(pos);
2385 2383
2386 updateLineStartList(); 2384 needsReflow();
2387 updateScrollFromCursor();
2388} 2385}
2389 2386
2390BOOL LLTextEditor::canRedo() const 2387BOOL LLTextEditor::canRedo() const
@@ -2426,8 +2423,7 @@ void LLTextEditor::redo()
2426 2423
2427 setCursorPos(pos); 2424 setCursorPos(pos);
2428 2425
2429 updateLineStartList(); 2426 needsReflow();
2430 updateScrollFromCursor();
2431} 2427}
2432 2428
2433void LLTextEditor::onFocusReceived() 2429void LLTextEditor::onFocusReceived()
@@ -2594,7 +2590,7 @@ void LLTextEditor::drawSelectionBackground()
2594 BOOL selection_visible = (left_visible_pos <= selection_right) && (selection_left <= right_visible_pos); 2590 BOOL selection_visible = (left_visible_pos <= selection_right) && (selection_left <= right_visible_pos);
2595 if( selection_visible ) 2591 if( selection_visible )
2596 { 2592 {
2597 LLGLSNoTexture no_texture; 2593 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
2598 const LLColor4& color = mReadOnly ? mReadOnlyBgColor : mWriteableBgColor; 2594 const LLColor4& color = mReadOnly ? mReadOnlyBgColor : mWriteableBgColor;
2599 F32 alpha = hasFocus() ? 1.f : 0.5f; 2595 F32 alpha = hasFocus() ? 1.f : 0.5f;
2600 gGL.color4f( 1.f - color.mV[0], 1.f - color.mV[1], 1.f - color.mV[2], alpha ); 2596 gGL.color4f( 1.f - color.mV[0], 1.f - color.mV[1], 1.f - color.mV[2], alpha );
@@ -2729,7 +2725,7 @@ void LLTextEditor::drawCursor()
2729 } 2725 }
2730 } 2726 }
2731 2727
2732 LLGLSNoTexture no_texture; 2728 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
2733 2729
2734 gGL.color4fv( mCursorColor.mV ); 2730 gGL.color4fv( mCursorColor.mV );
2735 2731
@@ -3100,6 +3096,20 @@ void LLTextEditor::drawClippedSegment(const LLWString &text, S32 seg_start, S32
3100 3096
3101void LLTextEditor::draw() 3097void LLTextEditor::draw()
3102{ 3098{
3099 // do on-demand reflow
3100 if (mReflowNeeded)
3101 {
3102 updateLineStartList();
3103 mReflowNeeded = FALSE;
3104 }
3105
3106 // then update scroll position, as cursor may have moved
3107 if (mScrollNeeded)
3108 {
3109 updateScrollFromCursor();
3110 mScrollNeeded = FALSE;
3111 }
3112
3103 { 3113 {
3104 LLLocalClipRect clip(LLRect(0, getRect().getHeight(), getRect().getWidth() - (mScrollbar->getVisible() ? SCROLLBAR_SIZE : 0), 0)); 3114 LLLocalClipRect clip(LLRect(0, getRect().getHeight(), getRect().getWidth() - (mScrollbar->getVisible() ? SCROLLBAR_SIZE : 0), 0));
3105 3115
@@ -3118,10 +3128,10 @@ void LLTextEditor::draw()
3118 mBorder->setKeyboardFocusHighlight( gFocusMgr.getKeyboardFocus() == this);// && !mReadOnly); 3128 mBorder->setKeyboardFocusHighlight( gFocusMgr.getKeyboardFocus() == this);// && !mReadOnly);
3119 } 3129 }
3120 3130
3131 LLView::draw(); // Draw children (scrollbar and border)
3132
3121 // remember if we are supposed to be at the bottom of the buffer 3133 // remember if we are supposed to be at the bottom of the buffer
3122 mScrolledToBottom = isScrolledToBottom(); 3134 mScrolledToBottom = isScrolledToBottom();
3123
3124 LLView::draw(); // Draw children (scrollbar and border)
3125} 3135}
3126 3136
3127 3137
@@ -3311,7 +3321,7 @@ void LLTextEditor::setCursorAndScrollToEnd()
3311{ 3321{
3312 deselect(); 3322 deselect();
3313 endOfDoc(); 3323 endOfDoc();
3314 updateScrollFromCursor(); 3324 needsScroll();
3315} 3325}
3316 3326
3317void LLTextEditor::getLineAndColumnForPosition( S32 position, S32* line, S32* col, BOOL include_wordwrap ) 3327void LLTextEditor::getLineAndColumnForPosition( S32 position, S32* line, S32* col, BOOL include_wordwrap )
@@ -3438,7 +3448,7 @@ void LLTextEditor::reshape(S32 width, S32 height, BOOL called_from_parent)
3438 // up-to-date mTextRect 3448 // up-to-date mTextRect
3439 updateTextRect(); 3449 updateTextRect();
3440 3450
3441 updateLineStartList(); 3451 needsReflow();
3442 3452
3443 // propagate shape information to scrollbar 3453 // propagate shape information to scrollbar
3444 mScrollbar->setDocSize( getLineCount() ); 3454 mScrollbar->setDocSize( getLineCount() );
@@ -3446,14 +3456,6 @@ void LLTextEditor::reshape(S32 width, S32 height, BOOL called_from_parent)
3446 S32 line_height = llround( mGLFont->getLineHeight() ); 3456 S32 line_height = llround( mGLFont->getLineHeight() );
3447 S32 page_lines = mTextRect.getHeight() / line_height; 3457 S32 page_lines = mTextRect.getHeight() / line_height;
3448 mScrollbar->setPageSize( page_lines ); 3458 mScrollbar->setPageSize( page_lines );
3449
3450 // if scrolled to bottom, stay at bottom
3451 // unless user is editing text
3452 // do this after updating page size
3453 if (mScrolledToBottom && mTrackBottom && !hasFocus())
3454 {
3455 endOfDoc();
3456 }
3457} 3459}
3458 3460
3459void LLTextEditor::autoIndent() 3461void LLTextEditor::autoIndent()
@@ -3500,8 +3502,7 @@ void LLTextEditor::insertText(const std::string &new_text)
3500 3502
3501 setCursorPos(mCursorPos + insert( mCursorPos, utf8str_to_wstring(new_text), FALSE )); 3503 setCursorPos(mCursorPos + insert( mCursorPos, utf8str_to_wstring(new_text), FALSE ));
3502 3504
3503 updateLineStartList(); 3505 needsReflow();
3504 updateScrollFromCursor();
3505 3506
3506 setEnabled( enabled ); 3507 setEnabled( enabled );
3507} 3508}
@@ -3600,7 +3601,7 @@ void LLTextEditor::appendText(const std::string &new_text, bool allow_undo, bool
3600 mSegments.push_back(segment); 3601 mSegments.push_back(segment);
3601 } 3602 }
3602 3603
3603 updateLineStartList(old_length); 3604 needsReflow();
3604 3605
3605 // Set the cursor and scroll position 3606 // Set the cursor and scroll position
3606 // Maintain the scroll position unless the scroll was at the end of the doc (in which 3607 // Maintain the scroll position unless the scroll was at the end of the doc (in which
@@ -3639,14 +3640,6 @@ void LLTextEditor::appendText(const std::string &new_text, bool allow_undo, bool
3639 { 3640 {
3640 blockUndo(); 3641 blockUndo();
3641 } 3642 }
3642
3643 // if scrolled to bottom, stay at bottom
3644 // unless user is editing text
3645 // do this after updating page size
3646 if (mScrolledToBottom && mTrackBottom && !hasFocus())
3647 {
3648 endOfDoc();
3649 }
3650} 3643}
3651 3644
3652void LLTextEditor::removeTextFromEnd(S32 num_chars) 3645void LLTextEditor::removeTextFromEnd(S32 num_chars)
@@ -3661,7 +3654,10 @@ void LLTextEditor::removeTextFromEnd(S32 num_chars)
3661 mSelectionEnd = llclamp(mSelectionEnd, 0, len); 3654 mSelectionEnd = llclamp(mSelectionEnd, 0, len);
3662 3655
3663 pruneSegments(); 3656 pruneSegments();
3657
3658 // pruneSegments will invalidate mLineStartList.
3664 updateLineStartList(); 3659 updateLineStartList();
3660 needsScroll();
3665} 3661}
3666 3662
3667/////////////////////////////////////////////////////////////////// 3663///////////////////////////////////////////////////////////////////
@@ -3759,8 +3755,7 @@ BOOL LLTextEditor::tryToRevertToPristineState()
3759 } 3755 }
3760 } 3756 }
3761 3757
3762 updateLineStartList(); 3758 needsReflow();
3763 updateScrollFromCursor();
3764 } 3759 }
3765 3760
3766 return isPristine(); // TRUE => success 3761 return isPristine(); // TRUE => success
@@ -3808,6 +3803,7 @@ void LLTextEditor::updateSegments()
3808 { 3803 {
3809 findEmbeddedItemSegments(); 3804 findEmbeddedItemSegments();
3810 } 3805 }
3806
3811 // Make sure we have at least one segment 3807 // Make sure we have at least one segment
3812 if (mSegments.size() == 1 && mSegments[0]->getIsDefault()) 3808 if (mSegments.size() == 1 && mSegments[0]->getIsDefault())
3813 { 3809 {
@@ -3824,6 +3820,7 @@ void LLTextEditor::updateSegments()
3824} 3820}
3825 3821
3826// Only effective if text was removed from the end of the editor 3822// Only effective if text was removed from the end of the editor
3823// *NOTE: Using this will invalidate references to mSegments from mLineStartList.
3827void LLTextEditor::pruneSegments() 3824void LLTextEditor::pruneSegments()
3828{ 3825{
3829 S32 len = mWText.length(); 3826 S32 len = mWText.length();
@@ -4066,9 +4063,7 @@ BOOL LLTextEditor::importBuffer(const char* buffer, S32 length )
4066 setCursorPos(0); 4063 setCursorPos(0);
4067 deselect(); 4064 deselect();
4068 4065
4069 updateLineStartList(); 4066 needsReflow();
4070 updateScrollFromCursor();
4071
4072 return success; 4067 return success;
4073} 4068}
4074 4069
@@ -4260,35 +4255,35 @@ S32 LLTextEditor::findHTMLToken(const std::string &line, S32 pos, BOOL reverse)
4260 std::string openers=" \t\n('\"[{<>"; 4255 std::string openers=" \t\n('\"[{<>";
4261 std::string closers=" \t\n)'\"]}><;"; 4256 std::string closers=" \t\n)'\"]}><;";
4262 4257
4263 S32 m2 = 0; 4258 S32 index = 0;
4264 S32 retval = 0;
4265 4259
4266 if (reverse) 4260 if (reverse)
4267 { 4261 {
4268 4262 for (index=pos; index >= 0; index--)
4269 for (retval=pos; retval >= 0; retval--)
4270 { 4263 {
4271 m2 = openers.find(line.substr(retval,1)); 4264 char c = line[index];
4265 S32 m2 = openers.find(c);
4272 if (m2 >= 0) 4266 if (m2 >= 0)
4273 { 4267 {
4274 break; 4268 return index+1;
4275 } 4269 }
4276 } 4270 }
4277 return retval+1;
4278 } 4271 }
4279 else 4272 else
4280 { 4273 {
4281 4274
4282 for (retval=pos; retval<(S32)line.length(); retval++) 4275 for (index=pos; index<(S32)line.length(); index++)
4283 { 4276 {
4284 m2 = closers.find(line.substr(retval,1)); 4277 char c = line[index];
4278 S32 m2 = closers.find(c);
4285 if (m2 >= 0) 4279 if (m2 >= 0)
4286 { 4280 {
4287 break; 4281 return index;
4288 } 4282 }
4289 } 4283 }
4290 return retval; 4284 }
4291 } 4285
4286 return index;
4292} 4287}
4293 4288
4294BOOL LLTextEditor::findHTML(const std::string &line, S32 *begin, S32 *end) const 4289BOOL LLTextEditor::findHTML(const std::string &line, S32 *begin, S32 *end) const
@@ -4476,9 +4471,8 @@ void LLTextEditor::updatePreedit(const LLWString &preedit_string,
4476 4471
4477 mPreeditStandouts = preedit_standouts; 4472 mPreeditStandouts = preedit_standouts;
4478 4473
4479 updateLineStartList(); 4474 needsReflow();
4480 setCursorPos(insert_preedit_at + caret_position); 4475 setCursorPos(insert_preedit_at + caret_position);
4481 // updateScrollFromCursor();
4482 4476
4483 // Update of the preedit should be caused by some key strokes. 4477 // Update of the preedit should be caused by some key strokes.
4484 mKeystrokeTimer.reset(); 4478 mKeystrokeTimer.reset();
diff --git a/linden/indra/llui/lltexteditor.h b/linden/indra/llui/lltexteditor.h
index 3cff91d..3604cf6 100644
--- a/linden/indra/llui/lltexteditor.h
+++ b/linden/indra/llui/lltexteditor.h
@@ -245,9 +245,11 @@ public:
245 llwchar getWChar(S32 pos) const { return mWText[pos]; } 245 llwchar getWChar(S32 pos) const { return mWText[pos]; }
246 LLWString getWSubString(S32 pos, S32 len) const { return mWText.substr(pos, len); } 246 LLWString getWSubString(S32 pos, S32 len) const { return mWText.substr(pos, len); }
247 247
248 const LLTextSegment* getCurrentSegment() { return getSegmentAtOffset(mCursorPos); } 248 const LLTextSegment* getCurrentSegment() const { return getSegmentAtOffset(mCursorPos); }
249 const LLTextSegment* getPreviousSegment(); 249 const LLTextSegment* getPreviousSegment() const;
250 void getSelectedSegments(std::vector<const LLTextSegment*>& segments); 250 void getSelectedSegments(std::vector<const LLTextSegment*>& segments) const;
251
252 static bool isPartOfWord(llwchar c) { return (c == '_') || LLStringOps::isAlnum((char)c); }
251 253
252protected: 254protected:
253 // 255 //
@@ -266,8 +268,6 @@ protected:
266 void assignEmbedded(const std::string &s); 268 void assignEmbedded(const std::string &s);
267 BOOL truncate(); // Returns true if truncation occurs 269 BOOL truncate(); // Returns true if truncation occurs
268 270
269 static BOOL isPartOfWord(llwchar c) { return (c == '_') || isalnum(c); }
270
271 void removeCharOrTab(); 271 void removeCharOrTab();
272 void setCursorAtLocalPos(S32 x, S32 y, BOOL round); 272 void setCursorAtLocalPos(S32 x, S32 y, BOOL round);
273 S32 getCursorPosFromLocalCoord( S32 local_x, S32 local_y, BOOL round ) const; 273 S32 getCursorPosFromLocalCoord( S32 local_x, S32 local_y, BOOL round ) const;
@@ -433,6 +433,14 @@ private:
433 void drawText(); 433 void drawText();
434 void drawClippedSegment(const LLWString &wtext, S32 seg_start, S32 seg_end, F32 x, F32 y, S32 selection_left, S32 selection_right, const LLStyleSP& color, F32* right_x); 434 void drawClippedSegment(const LLWString &wtext, S32 seg_start, S32 seg_end, F32 x, F32 y, S32 selection_left, S32 selection_right, const LLStyleSP& color, F32* right_x);
435 435
436 void needsReflow()
437 {
438 mReflowNeeded = TRUE;
439 // cursor might have moved, need to scroll
440 mScrollNeeded = TRUE;
441 }
442 void needsScroll() { mScrollNeeded = TRUE; }
443
436 // 444 //
437 // Data 445 // Data
438 // 446 //
@@ -489,6 +497,8 @@ private:
489 }; 497 };
490 typedef std::vector<line_info> line_list_t; 498 typedef std::vector<line_info> line_list_t;
491 line_list_t mLineStartList; 499 line_list_t mLineStartList;
500 BOOL mReflowNeeded;
501 BOOL mScrollNeeded;
492 502
493 LLFrameTimer mKeystrokeTimer; 503 LLFrameTimer mKeystrokeTimer;
494 504
diff --git a/linden/indra/llui/llui.cpp b/linden/indra/llui/llui.cpp
index 734aecf..5502246 100644
--- a/linden/indra/llui/llui.cpp
+++ b/linden/indra/llui/llui.cpp
@@ -143,11 +143,11 @@ void gl_state_for_2d(S32 width, S32 height)
143 143
144void gl_draw_x(const LLRect& rect, const LLColor4& color) 144void gl_draw_x(const LLRect& rect, const LLColor4& color)
145{ 145{
146 LLGLSNoTexture no_texture; 146 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
147 147
148 gGL.color4fv( color.mV ); 148 gGL.color4fv( color.mV );
149 149
150 gGL.begin( LLVertexBuffer::LINES ); 150 gGL.begin( LLRender::LINES );
151 gGL.vertex2i( rect.mLeft, rect.mTop ); 151 gGL.vertex2i( rect.mLeft, rect.mTop );
152 gGL.vertex2i( rect.mRight, rect.mBottom ); 152 gGL.vertex2i( rect.mRight, rect.mBottom );
153 gGL.vertex2i( rect.mLeft, rect.mBottom ); 153 gGL.vertex2i( rect.mLeft, rect.mBottom );
@@ -183,12 +183,12 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixe
183void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled ) 183void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled )
184{ 184{
185 stop_glerror(); 185 stop_glerror();
186 LLGLSNoTexture no_texture; 186 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
187 187
188 // Counterclockwise quad will face the viewer 188 // Counterclockwise quad will face the viewer
189 if( filled ) 189 if( filled )
190 { 190 {
191 gGL.begin( LLVertexBuffer::QUADS ); 191 gGL.begin( LLRender::QUADS );
192 gGL.vertex2i(left, top); 192 gGL.vertex2i(left, top);
193 gGL.vertex2i(left, bottom); 193 gGL.vertex2i(left, bottom);
194 gGL.vertex2i(right, bottom); 194 gGL.vertex2i(right, bottom);
@@ -200,7 +200,7 @@ void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled )
200 if( gGLManager.mATIOffsetVerticalLines ) 200 if( gGLManager.mATIOffsetVerticalLines )
201 { 201 {
202 // Work around bug in ATI driver: vertical lines are offset by (-1,-1) 202 // Work around bug in ATI driver: vertical lines are offset by (-1,-1)
203 gGL.begin( LLVertexBuffer::LINES ); 203 gGL.begin( LLRender::LINES );
204 204
205 // Verticals 205 // Verticals
206 gGL.vertex2i(left + 1, top); 206 gGL.vertex2i(left + 1, top);
@@ -223,7 +223,7 @@ void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled )
223 { 223 {
224 top--; 224 top--;
225 right--; 225 right--;
226 gGL.begin( LLVertexBuffer::LINE_STRIP ); 226 gGL.begin( LLRender::LINE_STRIP );
227 gGL.vertex2i(left, top); 227 gGL.vertex2i(left, top);
228 gGL.vertex2i(left, bottom); 228 gGL.vertex2i(left, bottom);
229 gGL.vertex2i(right, bottom); 229 gGL.vertex2i(right, bottom);
@@ -254,7 +254,7 @@ void gl_rect_2d( const LLRect& rect, const LLColor4& color, BOOL filled )
254void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &start_color, S32 lines) 254void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &start_color, S32 lines)
255{ 255{
256 stop_glerror(); 256 stop_glerror();
257 LLGLSNoTexture no_texture; 257 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
258 258
259 // HACK: Overlap with the rectangle by a single pixel. 259 // HACK: Overlap with the rectangle by a single pixel.
260 right--; 260 right--;
@@ -264,7 +264,7 @@ void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &st
264 LLColor4 end_color = start_color; 264 LLColor4 end_color = start_color;
265 end_color.mV[VALPHA] = 0.f; 265 end_color.mV[VALPHA] = 0.f;
266 266
267 gGL.begin(LLVertexBuffer::QUADS); 267 gGL.begin(LLRender::QUADS);
268 268
269 // Right edge, CCW faces screen 269 // Right edge, CCW faces screen
270 gGL.color4fv(start_color.mV); 270 gGL.color4fv(start_color.mV);
@@ -324,9 +324,9 @@ void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2 )
324 y2++; 324 y2++;
325 } 325 }
326 326
327 LLGLSNoTexture no_texture; 327 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
328 328
329 gGL.begin(LLVertexBuffer::LINES); 329 gGL.begin(LLRender::LINES);
330 gGL.vertex2i(x1, y1); 330 gGL.vertex2i(x1, y1);
331 gGL.vertex2i(x2, y2); 331 gGL.vertex2i(x2, y2);
332 gGL.end(); 332 gGL.end();
@@ -343,11 +343,11 @@ void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color )
343 y2++; 343 y2++;
344 } 344 }
345 345
346 LLGLSNoTexture no_texture; 346 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
347 347
348 gGL.color4fv( color.mV ); 348 gGL.color4fv( color.mV );
349 349
350 gGL.begin(LLVertexBuffer::LINES); 350 gGL.begin(LLRender::LINES);
351 gGL.vertex2i(x1, y1); 351 gGL.vertex2i(x1, y1);
352 gGL.vertex2i(x2, y2); 352 gGL.vertex2i(x2, y2);
353 gGL.end(); 353 gGL.end();
@@ -355,17 +355,17 @@ void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color )
355 355
356void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColor4& color, BOOL filled) 356void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColor4& color, BOOL filled)
357{ 357{
358 LLGLSNoTexture no_texture; 358 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
359 359
360 gGL.color4fv(color.mV); 360 gGL.color4fv(color.mV);
361 361
362 if (filled) 362 if (filled)
363 { 363 {
364 gGL.begin(LLVertexBuffer::TRIANGLES); 364 gGL.begin(LLRender::TRIANGLES);
365 } 365 }
366 else 366 else
367 { 367 {
368 gGL.begin(LLVertexBuffer::LINE_LOOP); 368 gGL.begin(LLRender::LINE_LOOP);
369 } 369 }
370 gGL.vertex2i(x1, y1); 370 gGL.vertex2i(x1, y1);
371 gGL.vertex2i(x2, y2); 371 gGL.vertex2i(x2, y2);
@@ -375,11 +375,11 @@ void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColo
375 375
376void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max_frac) 376void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max_frac)
377{ 377{
378 LLGLSNoTexture no_texture; 378 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
379 379
380 length = llmin((S32)(max_frac*(right - left)), length); 380 length = llmin((S32)(max_frac*(right - left)), length);
381 length = llmin((S32)(max_frac*(top - bottom)), length); 381 length = llmin((S32)(max_frac*(top - bottom)), length);
382 gGL.begin(LLVertexBuffer::LINES); 382 gGL.begin(LLRender::LINES);
383 gGL.vertex2i(left, top); 383 gGL.vertex2i(left, top);
384 gGL.vertex2i(left + length, top); 384 gGL.vertex2i(left + length, top);
385 385
@@ -496,11 +496,11 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLIma
496 { 496 {
497 gGL.translatef((F32)x, (F32)y, 0.f); 497 gGL.translatef((F32)x, (F32)y, 0.f);
498 498
499 image->bind(); 499 gGL.getTexUnit(0)->bind(image);
500 500
501 gGL.color4fv(color.mV); 501 gGL.color4fv(color.mV);
502 502
503 gGL.begin(LLVertexBuffer::QUADS); 503 gGL.begin(LLRender::QUADS);
504 { 504 {
505 // draw bottom left 505 // draw bottom left
506 gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom); 506 gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
@@ -656,11 +656,11 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
656 gGL.translatef( -offset_x, -offset_y, 0.f ); 656 gGL.translatef( -offset_x, -offset_y, 0.f );
657 } 657 }
658 658
659 image->bind(); 659 gGL.getTexUnit(0)->bind(image);
660 660
661 gGL.color4fv(color.mV); 661 gGL.color4fv(color.mV);
662 662
663 gGL.begin(LLVertexBuffer::QUADS); 663 gGL.begin(LLRender::QUADS);
664 { 664 {
665 gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop); 665 gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
666 gGL.vertex2i(width, height ); 666 gGL.vertex2i(width, height );
@@ -694,11 +694,11 @@ void gl_draw_scaled_image_inverted(S32 x, S32 y, S32 width, S32 height, LLImageG
694 { 694 {
695 gGL.translatef((F32)x, (F32)y, 0.f); 695 gGL.translatef((F32)x, (F32)y, 0.f);
696 696
697 image->bind(); 697 gGL.getTexUnit(0)->bind(image);
698 698
699 gGL.color4fv(color.mV); 699 gGL.color4fv(color.mV);
700 700
701 gGL.begin(LLVertexBuffer::QUADS); 701 gGL.begin(LLRender::QUADS);
702 { 702 {
703 gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom); 703 gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
704 gGL.vertex2i(width, height ); 704 gGL.vertex2i(width, height );
@@ -733,7 +733,7 @@ void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LL
733 glLineWidth(2.5f); 733 glLineWidth(2.5f);
734 glLineStipple(2, 0x3333 << shift); 734 glLineStipple(2, 0x3333 << shift);
735 735
736 gGL.begin(LLVertexBuffer::LINES); 736 gGL.begin(LLRender::LINES);
737 { 737 {
738 gGL.vertex3fv( start.mV ); 738 gGL.vertex3fv( start.mV );
739 gGL.vertex3fv( end.mV ); 739 gGL.vertex3fv( end.mV );
@@ -750,7 +750,7 @@ void gl_rect_2d_xor(S32 left, S32 top, S32 right, S32 bottom)
750 glLogicOp( GL_XOR ); 750 glLogicOp( GL_XOR );
751 stop_glerror(); 751 stop_glerror();
752 752
753 gGL.begin(LLVertexBuffer::QUADS); 753 gGL.begin(LLRender::QUADS);
754 gGL.vertex2i(left, top); 754 gGL.vertex2i(left, top);
755 gGL.vertex2i(left, bottom); 755 gGL.vertex2i(left, bottom);
756 gGL.vertex2i(right, bottom); 756 gGL.vertex2i(right, bottom);
@@ -782,14 +782,14 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F
782 782
783 if (filled) 783 if (filled)
784 { 784 {
785 gGL.begin(LLVertexBuffer::TRIANGLE_FAN); 785 gGL.begin(LLRender::TRIANGLE_FAN);
786 gGL.vertex2f(0.f, 0.f); 786 gGL.vertex2f(0.f, 0.f);
787 // make sure circle is complete 787 // make sure circle is complete
788 steps += 1; 788 steps += 1;
789 } 789 }
790 else 790 else
791 { 791 {
792 gGL.begin(LLVertexBuffer::LINE_STRIP); 792 gGL.begin(LLRender::LINE_STRIP);
793 } 793 }
794 794
795 while( steps-- ) 795 while( steps-- )
@@ -809,7 +809,7 @@ void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled
809{ 809{
810 gGL.pushMatrix(); 810 gGL.pushMatrix();
811 { 811 {
812 LLGLSNoTexture gls_no_texture; 812 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
813 gGL.translatef(center_x, center_y, 0.f); 813 gGL.translatef(center_x, center_y, 0.f);
814 814
815 // Inexact, but reasonably fast. 815 // Inexact, but reasonably fast.
@@ -821,14 +821,14 @@ void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled
821 821
822 if (filled) 822 if (filled)
823 { 823 {
824 gGL.begin(LLVertexBuffer::TRIANGLE_FAN); 824 gGL.begin(LLRender::TRIANGLE_FAN);
825 gGL.vertex2f(0.f, 0.f); 825 gGL.vertex2f(0.f, 0.f);
826 // make sure circle is complete 826 // make sure circle is complete
827 steps += 1; 827 steps += 1;
828 } 828 }
829 else 829 else
830 { 830 {
831 gGL.begin(LLVertexBuffer::LINE_LOOP); 831 gGL.begin(LLRender::LINE_LOOP);
832 } 832 }
833 833
834 while( steps-- ) 834 while( steps-- )
@@ -850,7 +850,7 @@ void gl_deep_circle( F32 radius, F32 depth, S32 steps )
850 F32 x = radius; 850 F32 x = radius;
851 F32 y = 0.f; 851 F32 y = 0.f;
852 F32 angle_delta = F_TWO_PI / (F32)steps; 852 F32 angle_delta = F_TWO_PI / (F32)steps;
853 gGL.begin( LLVertexBuffer::TRIANGLE_STRIP ); 853 gGL.begin( LLRender::TRIANGLE_STRIP );
854 { 854 {
855 S32 step = steps + 1; // An extra step to close the circle. 855 S32 step = steps + 1; // An extra step to close the circle.
856 while( step-- ) 856 while( step-- )
@@ -905,7 +905,7 @@ void gl_rect_2d_checkerboard(const LLRect& rect)
905 first = FALSE; 905 first = FALSE;
906 } 906 }
907 907
908 LLGLSNoTexture gls_no_texture; 908 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
909 909
910 // ...white squares 910 // ...white squares
911 gGL.color3f( 1.f, 1.f, 1.f ); 911 gGL.color3f( 1.f, 1.f, 1.f );
@@ -935,9 +935,9 @@ void gl_washer_2d(F32 outer_radius, F32 inner_radius, S32 steps, const LLColor4&
935 F32 x2 = inner_radius; 935 F32 x2 = inner_radius;
936 F32 y2 = 0.f; 936 F32 y2 = 0.f;
937 937
938 LLGLSNoTexture gls_no_texture; 938 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
939 939
940 gGL.begin( LLVertexBuffer::TRIANGLE_STRIP ); 940 gGL.begin( LLRender::TRIANGLE_STRIP );
941 { 941 {
942 steps += 1; // An extra step to close the circle. 942 steps += 1; // An extra step to close the circle.
943 while( steps-- ) 943 while( steps-- )
@@ -972,8 +972,8 @@ void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians,
972 F32 x2 = inner_radius * cos( start_radians ); 972 F32 x2 = inner_radius * cos( start_radians );
973 F32 y2 = inner_radius * sin( start_radians ); 973 F32 y2 = inner_radius * sin( start_radians );
974 974
975 LLGLSNoTexture gls_no_texture; 975 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
976 gGL.begin( LLVertexBuffer::TRIANGLE_STRIP ); 976 gGL.begin( LLRender::TRIANGLE_STRIP );
977 { 977 {
978 steps += 1; // An extra step to close the circle. 978 steps += 1; // An extra step to close the circle.
979 while( steps-- ) 979 while( steps-- )
@@ -1008,9 +1008,9 @@ void gl_washer_spokes_2d(F32 outer_radius, F32 inner_radius, S32 count, const LL
1008 F32 x2 = inner_radius * cos( HALF_DELTA ); 1008 F32 x2 = inner_radius * cos( HALF_DELTA );
1009 F32 y2 = inner_radius * sin( HALF_DELTA ); 1009 F32 y2 = inner_radius * sin( HALF_DELTA );
1010 1010
1011 LLGLSNoTexture gls_no_texture; 1011 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
1012 1012
1013 gGL.begin( LLVertexBuffer::LINES ); 1013 gGL.begin( LLRender::LINES );
1014 { 1014 {
1015 while( count-- ) 1015 while( count-- )
1016 { 1016 {
@@ -1033,7 +1033,7 @@ void gl_washer_spokes_2d(F32 outer_radius, F32 inner_radius, S32 count, const LL
1033 1033
1034void gl_rect_2d_simple_tex( S32 width, S32 height ) 1034void gl_rect_2d_simple_tex( S32 width, S32 height )
1035{ 1035{
1036 gGL.begin( LLVertexBuffer::QUADS ); 1036 gGL.begin( LLRender::QUADS );
1037 1037
1038 gGL.texCoord2f(1.f, 1.f); 1038 gGL.texCoord2f(1.f, 1.f);
1039 gGL.vertex2i(width, height); 1039 gGL.vertex2i(width, height);
@@ -1052,7 +1052,7 @@ void gl_rect_2d_simple_tex( S32 width, S32 height )
1052 1052
1053void gl_rect_2d_simple( S32 width, S32 height ) 1053void gl_rect_2d_simple( S32 width, S32 height )
1054{ 1054{
1055 gGL.begin( LLVertexBuffer::QUADS ); 1055 gGL.begin( LLRender::QUADS );
1056 gGL.vertex2i(width, height); 1056 gGL.vertex2i(width, height);
1057 gGL.vertex2i(0, height); 1057 gGL.vertex2i(0, height);
1058 gGL.vertex2i(0, 0); 1058 gGL.vertex2i(0, 0);
@@ -1094,7 +1094,7 @@ void gl_segmented_rect_2d_tex(const S32 left,
1094 LLVector2 width_vec((F32)width, 0.f); 1094 LLVector2 width_vec((F32)width, 0.f);
1095 LLVector2 height_vec(0.f, (F32)height); 1095 LLVector2 height_vec(0.f, (F32)height);
1096 1096
1097 gGL.begin(LLVertexBuffer::QUADS); 1097 gGL.begin(LLRender::QUADS);
1098 { 1098 {
1099 // draw bottom left 1099 // draw bottom left
1100 gGL.texCoord2f(0.f, 0.f); 1100 gGL.texCoord2f(0.f, 0.f);
@@ -1262,7 +1262,7 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
1262 LLVector2 x_min; 1262 LLVector2 x_min;
1263 LLVector2 x_max; 1263 LLVector2 x_max;
1264 1264
1265 gGL.begin(LLVertexBuffer::QUADS); 1265 gGL.begin(LLRender::QUADS);
1266 { 1266 {
1267 if (start_fragment < middle_start) 1267 if (start_fragment < middle_start)
1268 { 1268 {
@@ -1419,7 +1419,7 @@ void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& bo
1419 LLVector3 bottom_border_height = ((edges & (~(U32)ROUNDED_RECT_TOP)) != 0) ? border_height : LLVector3::zero; 1419 LLVector3 bottom_border_height = ((edges & (~(U32)ROUNDED_RECT_TOP)) != 0) ? border_height : LLVector3::zero;
1420 1420
1421 1421
1422 gGL.begin(LLVertexBuffer::QUADS); 1422 gGL.begin(LLRender::QUADS);
1423 { 1423 {
1424 // draw bottom left 1424 // draw bottom left
1425 gGL.texCoord2f(0.f, 0.f); 1425 gGL.texCoord2f(0.f, 0.f);
@@ -1575,7 +1575,7 @@ void LLUI::initClass(LLControlGroup* config,
1575void LLUI::cleanupClass() 1575void LLUI::cleanupClass()
1576{ 1576{
1577 sImageProvider->cleanUp(); 1577 sImageProvider->cleanUp();
1578 LLLineEditor::cleanupClass(); 1578 LLLineEditor::cleanupLineEditor();
1579} 1579}
1580 1580
1581 1581
diff --git a/linden/indra/llui/llview.cpp b/linden/indra/llui/llview.cpp
index 034c49b..bc6fe7e 100644
--- a/linden/indra/llui/llview.cpp
+++ b/linden/indra/llui/llview.cpp
@@ -1281,7 +1281,7 @@ void LLView::drawDebugRect()
1281 LLUI::pushMatrix(); 1281 LLUI::pushMatrix();
1282 { 1282 {
1283 // drawing solids requires texturing be disabled 1283 // drawing solids requires texturing be disabled
1284 LLGLSNoTexture no_texture; 1284 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
1285 1285
1286 if (mUseBoundingRect) 1286 if (mUseBoundingRect)
1287 { 1287 {
@@ -1303,7 +1303,7 @@ void LLView::drawDebugRect()
1303 1303
1304 gGL.color4fv( border_color.mV ); 1304 gGL.color4fv( border_color.mV );
1305 1305
1306 gGL.begin(LLVertexBuffer::LINES); 1306 gGL.begin(LLRender::LINES);
1307 gGL.vertex2i(0, debug_rect.getHeight() - 1); 1307 gGL.vertex2i(0, debug_rect.getHeight() - 1);
1308 gGL.vertex2i(0, 0); 1308 gGL.vertex2i(0, 0);
1309 1309
diff --git a/linden/indra/llui/llviewborder.cpp b/linden/indra/llui/llviewborder.cpp
index 8a5beea..a1c26d6 100644
--- a/linden/indra/llui/llviewborder.cpp
+++ b/linden/indra/llui/llviewborder.cpp
@@ -111,7 +111,7 @@ void LLViewBorder::draw()
111 111
112void LLViewBorder::drawOnePixelLines() 112void LLViewBorder::drawOnePixelLines()
113{ 113{
114 LLGLSNoTexture uiNoTexture; 114 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
115 115
116 LLColor4 top_color = mHighlightLight; 116 LLColor4 top_color = mHighlightLight;
117 LLColor4 bottom_color = mHighlightLight; 117 LLColor4 bottom_color = mHighlightLight;
@@ -158,7 +158,7 @@ void LLViewBorder::drawOnePixelLines()
158 158
159void LLViewBorder::drawTwoPixelLines() 159void LLViewBorder::drawTwoPixelLines()
160{ 160{
161 LLGLSNoTexture no_texture; 161 gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
162 162
163 LLColor4 focus_color = gFocusMgr.getFocusColor(); 163 LLColor4 focus_color = gFocusMgr.getFocusColor();
164 164
@@ -230,7 +230,7 @@ void LLViewBorder::drawTextures()
230 230
231 //gGL.color4fv(UI_VERTEX_COLOR.mV); 231 //gGL.color4fv(UI_VERTEX_COLOR.mV);
232 232
233 //mTexture->bind(); 233 //gGL.getTexUnit(0)->bind(mTexture);
234 //glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); 234 //glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
235 //glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT ); 235 //glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
236 236
@@ -248,7 +248,7 @@ void LLViewBorder::drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32
248 gGL.translatef(start_x, start_y, 0.f); 248 gGL.translatef(start_x, start_y, 0.f);
249 glRotatef( degrees, 0, 0, 1 ); 249 glRotatef( degrees, 0, 0, 1 );
250 250
251 gGL.begin(LLVertexBuffer::QUADS); 251 gGL.begin(LLRender::QUADS);
252 { 252 {
253 // width, width /---------\ length-width, width // 253 // width, width /---------\ length-width, width //
254 // / \ // 254 // / \ //