summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorBrad Kittenbrink <brad@lindenlab.com>2008-02-27 18:58:14 +0000
committerBrad Kittenbrink <brad@lindenlab.com>2008-02-27 18:58:14 +0000
commit6d52efe452aa8469e0343da1c7d108f3f52ab651 (patch)
treea87be48e9840d7fc1f7ee514d7c7f994e71fdb3c /indra/llui
parent6027ad2630b8650cabcf00628ee9b0d25bedd67f (diff)
Merge of windlight into release (QAR-286). This includes all changes in
windlight14 which have passed QA (up through r79932). svn merge -r 80831:80833 svn+ssh://svn.lindenlab.com/svn/linden/branches/merge_windlight14_r80620
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llbutton.cpp9
-rw-r--r--indra/llui/llcheckboxctrl.cpp11
-rw-r--r--indra/llui/llfloater.cpp30
-rw-r--r--indra/llui/llmenugl.cpp33
-rw-r--r--indra/llui/llmultislider.cpp677
-rw-r--r--indra/llui/llmultislider.h129
-rw-r--r--indra/llui/llmultisliderctrl.cpp634
-rw-r--r--indra/llui/llmultisliderctrl.h160
-rw-r--r--indra/llui/llpanel.h2
-rw-r--r--indra/llui/llscrollbar.cpp5
-rw-r--r--indra/llui/llscrollcontainer.cpp3
-rw-r--r--indra/llui/llscrolllistctrl.cpp7
-rw-r--r--indra/llui/llslider.h4
-rw-r--r--indra/llui/llsliderctrl.h13
-rw-r--r--indra/llui/llspinctrl.h2
-rw-r--r--indra/llui/lltabcontainer.cpp13
-rw-r--r--indra/llui/lltexteditor.cpp8
-rw-r--r--indra/llui/llui.cpp1034
-rw-r--r--indra/llui/llui.h2
-rw-r--r--indra/llui/lluictrlfactory.cpp16
-rw-r--r--indra/llui/lluictrlfactory.h2
-rw-r--r--indra/llui/llview.cpp25
-rw-r--r--indra/llui/llviewborder.cpp41
-rw-r--r--indra/llui/llviewborder.h3
24 files changed, 2258 insertions, 605 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 435e1d1701..8132396cb5 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -48,6 +48,7 @@
#include "llglheaders.h"
#include "llfocusmgr.h"
#include "llwindow.h"
+#include "llglimmediate.h"
// globals loaded from settings.xml
S32 LLBUTTON_ORIG_H_PAD = 6; // Pre-zoomable UI
@@ -601,9 +602,9 @@ void LLButton::draw()
mImagep->draw(0, 0, getEnabled() ? mImageColor : mDisabledImageColor );
if (mCurGlowStrength > 0.01f)
{
- glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ gGL.blendFunc(GL_SRC_ALPHA, GL_ONE);
mImagep->drawSolid(0, 0, LLColor4(1.f, 1.f, 1.f, mCurGlowStrength));
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
}
else
@@ -612,9 +613,9 @@ void LLButton::draw()
mImagep->draw(0, 0, getRect().getWidth(), getRect().getHeight(), getEnabled() ? mImageColor : mDisabledImageColor );
if (mCurGlowStrength > 0.01f)
{
- glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ gGL.blendFunc(GL_SRC_ALPHA, GL_ONE);
mImagep->drawSolid(0, 0, getRect().getWidth(), getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, mCurGlowStrength));
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
}
else
diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp
index 536e9a6dc6..0b3156fa1e 100644
--- a/indra/llui/llcheckboxctrl.cpp
+++ b/indra/llui/llcheckboxctrl.cpp
@@ -89,7 +89,16 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLString& name, const LLRect& rect,
LLCHECKBOXCTRL_VPAD + 1, // padding to get better alignment
text_width + LLCHECKBOXCTRL_HPAD,
text_height );
- mLabel = new LLTextBox( "CheckboxCtrl Label", label_rect, label.c_str(), mFont );
+
+ // *HACK Get rid of this with SL-55508...
+ // this allows blank check boxes and radio boxes for now
+ LLString local_label = label;
+ if(local_label.empty())
+ {
+ local_label = " ";
+ }
+
+ mLabel = new LLTextBox( "CheckboxCtrl Label", label_rect, local_label.c_str(), mFont );
mLabel->setFollowsLeft();
mLabel->setFollowsBottom();
addChild(mLabel);
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 68719bea40..fed39b7917 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -2123,42 +2123,40 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out
if( floater->isResizable() )
{
LLRect view_rect = floater->getRect();
- S32 view_width = view_rect.getWidth();
- S32 view_height = view_rect.getHeight();
+ S32 old_width = view_rect.getWidth();
+ S32 old_height = view_rect.getHeight();
S32 min_width;
S32 min_height;
floater->getResizeLimits( &min_width, &min_height );
// Make sure floater isn't already smaller than its min height/width?
- S32 new_width = llmax( min_width, view_width );
- S32 new_height = llmax( min_height, view_height );
+ S32 new_width = llmax( min_width, old_width );
+ S32 new_height = llmax( min_height, old_height);
- if( !allow_partial_outside
- && ( (new_width > screen_width)
- || (new_height > screen_height) ) )
+ if((new_width > screen_width) || (new_height > screen_height))
{
- // We have to force this window to be inside the screen.
+ // We have to make this window able to fit on screen
new_width = llmin(new_width, screen_width);
new_height = llmin(new_height, screen_height);
- // Still respect minimum width/height
+ // ...while respecting minimum width/height
new_width = llmax(new_width, min_width);
new_height = llmax(new_height, min_height);
floater->reshape( new_width, new_height, TRUE );
+ if (floater->followsRight())
+ {
+ floater->translate(old_width - new_width, 0);
+ }
- // Make sure the damn thing is actually onscreen.
- if (floater->translateIntoRect(snap_rect_local, FALSE))
+ if (floater->followsTop())
{
- floater->clearSnapTarget();
+ floater->translate(0, old_height - new_height);
}
}
- else if (!floater->isMinimized())
- {
- floater->reshape(new_width, new_height, TRUE);
- }
}
+ // move window fully onscreen
if (floater->translateIntoRect( snap_rect_local, allow_partial_outside ))
{
floater->clearSnapTarget();
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 4e94aff7a5..00b4c37bb0 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -47,6 +47,7 @@
#include "llmath.h"
#include "llgl.h"
+#include "llglimmediate.h"
#include "llfocusmgr.h"
#include "llfont.h"
#include "llcoord.h"
@@ -470,7 +471,7 @@ void LLMenuItemGL::draw( void )
// let disabled items be highlighted, just don't draw them as such
if( getEnabled() && getHighlight() && !mBriefItem)
{
- glColor4fv( sHighlightBackground.mV );
+ gGL.color4fv( sHighlightBackground.mV );
gl_rect_2d( 0, getRect().getHeight(), getRect().getWidth(), 0 );
}
@@ -580,7 +581,7 @@ LLMenuItemSeparatorGL::LLMenuItemSeparatorGL( const LLString &name ) :
void LLMenuItemSeparatorGL::draw( void )
{
- glColor4fv( getDisabledColor().mV );
+ gGL.color4fv( getDisabledColor().mV );
const S32 y = getRect().getHeight() / 2;
const S32 PAD = 6;
gl_line_2d( PAD, y, getRect().getWidth() - PAD, y );
@@ -701,17 +702,17 @@ void LLMenuItemTearOffGL::draw()
// disabled items can be highlighted, but shouldn't render as such
if( getEnabled() && getHighlight() && !isBriefItem())
{
- glColor4fv( getHighlightBGColor().mV );
+ gGL.color4fv( getHighlightBGColor().mV );
gl_rect_2d( 0, getRect().getHeight(), getRect().getWidth(), 0 );
}
if (getEnabled())
{
- glColor4fv( getEnabledColor().mV );
+ gGL.color4fv( getEnabledColor().mV );
}
else
{
- glColor4fv( getDisabledColor().mV );
+ gGL.color4fv( getDisabledColor().mV );
}
const S32 y = getRect().getHeight() / 3;
const S32 PAD = 6;
@@ -1638,7 +1639,7 @@ void LLMenuItemBranchDownGL::draw( void )
if( getHighlight() )
{
- glColor4fv( getHighlightBGColor().mV );
+ gGL.color4fv( getHighlightBGColor().mV );
gl_rect_2d( 0, getRect().getHeight(), getRect().getWidth(), 0 );
}
@@ -2949,7 +2950,7 @@ void LLMenuGL::draw( void )
void LLMenuGL::drawBackground(LLMenuItemGL* itemp, LLColor4& color)
{
- glColor4fv( color.mV );
+ gGL.color4fv( color.mV );
LLRect item_rect = itemp->getRect();
gl_rect_2d( 0, item_rect.getHeight(), item_rect.getWidth(), 0);
}
@@ -3476,9 +3477,9 @@ void LLPieMenu::draw()
F32 center_y = height/2;
S32 steps = 100;
- glPushMatrix();
+ gGL.pushMatrix();
{
- glTranslatef(center_x, center_y, 0.f);
+ gGL.translatef(center_x, center_y, 0.f);
F32 line_width = LLUI::sConfigGroup->getF32("PieMenuLineWidth");
LLColor4 line_color = LLUI::sColorsGroup->getColor("PieMenuLineColor");
@@ -3517,16 +3518,16 @@ void LLPieMenu::draw()
gl_washer_spokes_2d( mCurRadius, (F32)PIE_CENTER_SIZE, 8, line_color, outer_color );
// inner circle
- glColor4fv( line_color.mV );
+ gGL.color4fv( line_color.mV );
gl_circle_2d( 0, 0, (F32)PIE_CENTER_SIZE, steps, FALSE );
// outer circle
- glColor4fv( outer_color.mV );
+ gGL.color4fv( outer_color.mV );
gl_circle_2d( 0, 0, mCurRadius, steps, FALSE );
LLUI::setLineWidth(1.0f);
}
- glPopMatrix();
+ gGL.popMatrix();
mHoverThisFrame = FALSE;
@@ -3541,10 +3542,10 @@ void LLPieMenu::drawBackground(LLMenuItemGL* itemp, LLColor4& color)
F32 center_y = height/2;
S32 steps = 100;
- glColor4fv( color.mV );
- glPushMatrix();
+ gGL.color4fv( color.mV );
+ gGL.pushMatrix();
{
- glTranslatef(center_x - itemp->getRect().mLeft, center_y - itemp->getRect().mBottom, 0.f);
+ gGL.translatef(center_x - itemp->getRect().mLeft, center_y - itemp->getRect().mBottom, 0.f);
item_list_t::iterator item_iter;
S32 i = 0;
@@ -3564,7 +3565,7 @@ void LLPieMenu::drawBackground(LLMenuItemGL* itemp, LLColor4& color)
i++;
}
}
- glPopMatrix();
+ gGL.popMatrix();
}
// virtual
diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp
new file mode 100644
index 0000000000..b4bf3a92d5
--- /dev/null
+++ b/indra/llui/llmultislider.cpp
@@ -0,0 +1,677 @@
+/**
+ * @file llmultisldr.cpp
+ * @brief LLMultiSlider base class
+ *
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ *
+ * Copyright (c) 2007-2007, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "linden_common.h"
+
+#include "llmultislider.h"
+#include "llui.h"
+
+#include "llgl.h"
+#include "llwindow.h"
+#include "llfocusmgr.h"
+#include "llkeyboard.h" // for the MASK constants
+#include "llcontrol.h"
+#include "llimagegl.h"
+
+#include <sstream>
+
+const S32 MULTI_THUMB_WIDTH = 8;
+const S32 MULTI_TRACK_HEIGHT = 6;
+const F32 FLOAT_THRESHOLD = 0.00001f;
+const S32 EXTRA_TRIANGLE_WIDTH = 2;
+const S32 EXTRA_TRIANGLE_HEIGHT = -2;
+
+S32 LLMultiSlider::mNameCounter = 0;
+
+LLMultiSlider::LLMultiSlider(
+ const LLString& name,
+ const LLRect& rect,
+ void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata),
+ void* callback_userdata,
+ F32 initial_value,
+ F32 min_value,
+ F32 max_value,
+ F32 increment,
+ S32 max_sliders,
+ BOOL allow_overlap,
+ BOOL draw_track,
+ BOOL use_triangle,
+ const LLString& control_name)
+ :
+ LLUICtrl( name, rect, TRUE, on_commit_callback, callback_userdata,
+ FOLLOWS_LEFT | FOLLOWS_TOP),
+
+ mInitialValue( initial_value ),
+ mMinValue( min_value ),
+ mMaxValue( max_value ),
+ mIncrement( increment ),
+ mMaxNumSliders(max_sliders),
+ mAllowOverlap(allow_overlap),
+ mDrawTrack(draw_track),
+ mUseTriangle(use_triangle),
+ mMouseOffset( 0 ),
+ mDragStartThumbRect( 0, getRect().getHeight(), MULTI_THUMB_WIDTH, 0 ),
+ mTrackColor( LLUI::sColorsGroup->getColor( "MultiSliderTrackColor" ) ),
+ mThumbOutlineColor( LLUI::sColorsGroup->getColor( "MultiSliderThumbOutlineColor" ) ),
+ mThumbCenterColor( LLUI::sColorsGroup->getColor( "MultiSliderThumbCenterColor" ) ),
+ mThumbCenterSelectedColor( LLUI::sColorsGroup->getColor( "MultiSliderThumbCenterSelectedColor" ) ),
+ mDisabledThumbColor(LLUI::sColorsGroup->getColor( "MultiSliderDisabledThumbColor" ) ),
+ mTriangleColor(LLUI::sColorsGroup->getColor( "MultiSliderTriangleColor" ) ),
+ mMouseDownCallback( NULL ),
+ mMouseUpCallback( NULL )
+{
+ mValue.emptyMap();
+ mCurSlider = LLString::null;
+
+ // properly handle setting the starting thumb rect
+ // do it this way to handle both the operating-on-settings
+ // and standalone ways of using this
+ setControlName(control_name, NULL);
+ setValue(getValue());
+}
+
+EWidgetType LLMultiSlider::getWidgetType() const
+{
+ return WIDGET_TYPE_MULTI_SLIDER_BAR;
+}
+
+LLString LLMultiSlider::getWidgetTag() const
+{
+ return LL_MULTI_SLIDER_TAG;
+}
+
+void LLMultiSlider::setSliderValue(const LLString& name, F32 value, BOOL from_event)
+{
+ // exit if not there
+ if(!mValue.has(name)) {
+ return;
+ }
+
+ value = llclamp( value, mMinValue, mMaxValue );
+
+ // Round to nearest increment (bias towards rounding down)
+ value -= mMinValue;
+ value += mIncrement/2.0001f;
+ value -= fmod(value, mIncrement);
+ F32 newValue = mMinValue + value;
+
+ // now, make sure no overlap
+ // if we want that
+ if(!mAllowOverlap) {
+ bool hit = false;
+
+ // look at the current spot
+ // and see if anything is there
+ LLSD::map_iterator mIt = mValue.beginMap();
+ for(;mIt != mValue.endMap(); mIt++) {
+
+ F32 testVal = (F32)mIt->second.asReal() - newValue;
+ if(testVal > -FLOAT_THRESHOLD && testVal < FLOAT_THRESHOLD &&
+ mIt->first != name) {
+ hit = true;
+ break;
+ }
+ }
+
+ // if none found, stop
+ if(hit) {
+ return;
+ }
+ }
+
+
+ // now set it in the map
+ mValue[name] = newValue;
+
+ // set the control if it's the current slider and not from an event
+ if (!from_event && name == mCurSlider)
+ {
+ setControlValue(mValue);
+ }
+
+ F32 t = (newValue - mMinValue) / (mMaxValue - mMinValue);
+
+ S32 left_edge = MULTI_THUMB_WIDTH/2;
+ S32 right_edge = getRect().getWidth() - (MULTI_THUMB_WIDTH/2);
+
+ S32 x = left_edge + S32( t * (right_edge - left_edge) );
+ mThumbRects[name].mLeft = x - (MULTI_THUMB_WIDTH/2);
+ mThumbRects[name].mRight = x + (MULTI_THUMB_WIDTH/2);
+}
+
+void LLMultiSlider::setValue(const LLSD& value)
+{
+ // only do if it's a map
+ if(value.isMap()) {
+
+ // add each value... the first in the map becomes the current
+ LLSD::map_const_iterator mIt = value.beginMap();
+ mCurSlider = mIt->first;
+
+ for(; mIt != value.endMap(); mIt++) {
+ setSliderValue(mIt->first, (F32)mIt->second.asReal(), TRUE);
+ }
+ }
+}
+
+F32 LLMultiSlider::getSliderValue(const LLString& name) const
+{
+ return (F32)mValue[name].asReal();
+}
+
+void LLMultiSlider::setCurSlider(const LLString& name)
+{
+ if(mValue.has(name)) {
+ mCurSlider = name;
+ }
+}
+
+const LLString& LLMultiSlider::addSlider()
+{
+ return addSlider(mInitialValue);
+}
+
+const LLString& LLMultiSlider::addSlider(F32 val)
+{
+ std::stringstream newName;
+ F32 initVal = val;
+
+ if(mValue.size() >= mMaxNumSliders) {
+ return LLString::null;
+ }
+
+ // create a new name
+ newName << "sldr" << mNameCounter;
+ mNameCounter++;
+
+ bool foundOne = findUnusedValue(initVal);
+ if(!foundOne) {
+ return LLString::null;
+ }
+
+ // add a new thumb rect
+ mThumbRects[newName.str()] = LLRect( 0, getRect().getHeight(), MULTI_THUMB_WIDTH, 0 );
+
+ // add the value and set the current slider to this one
+ mValue.insert(newName.str(), initVal);
+ mCurSlider = newName.str();
+
+ // move the slider
+ setSliderValue(mCurSlider, initVal, TRUE);
+
+ return mCurSlider;
+}
+
+bool LLMultiSlider::findUnusedValue(F32& initVal)
+{
+ bool firstTry = true;
+
+ // find the first open slot starting with
+ // the initial value
+ while(true) {
+
+ bool hit = false;
+
+ // look at the current spot
+ // and see if anything is there
+ LLSD::map_iterator mIt = mValue.beginMap();
+ for(;mIt != mValue.endMap(); mIt++) {
+
+ F32 testVal = (F32)mIt->second.asReal() - initVal;
+ if(testVal > -FLOAT_THRESHOLD && testVal < FLOAT_THRESHOLD) {
+ hit = true;
+ break;
+ }
+ }
+
+ // if we found one
+ if(!hit) {
+ break;
+ }
+
+ // increment and wrap if need be
+ initVal += mIncrement;
+ if(initVal > mMaxValue) {
+ initVal = mMinValue;
+ }
+
+ // stop if it's filled
+ if(initVal == mInitialValue && !firstTry) {
+ llwarns << "Whoa! Too many multi slider elements to add one to" << llendl;
+ return false;
+ }
+
+ firstTry = false;
+ continue;
+ }
+
+ return true;
+}
+
+
+void LLMultiSlider::deleteSlider(const LLString& name)
+{
+ // can't delete last slider
+ if(mValue.size() <= 0) {
+ return;
+ }
+
+ // get rid of value from mValue and its thumb rect
+ mValue.erase(name);
+ mThumbRects.erase(name);
+
+ // set to the last created
+ if(mValue.size() > 0) {
+ std::map<LLString, LLRect>::iterator mIt = mThumbRects.end();
+ mIt--;
+ mCurSlider = mIt->first;
+ }
+}
+
+void LLMultiSlider::clear()
+{
+ while(mThumbRects.size() > 0) {
+ deleteCurSlider();
+ }
+
+ LLUICtrl::clear();
+}
+
+BOOL LLMultiSlider::handleHover(S32 x, S32 y, MASK mask)
+{
+ if( gFocusMgr.getMouseCapture() == this )
+ {
+ S32 left_edge = MULTI_THUMB_WIDTH/2;
+ S32 right_edge = getRect().getWidth() - (MULTI_THUMB_WIDTH/2);
+
+ x += mMouseOffset;
+ x = llclamp( x, left_edge, right_edge );
+
+ F32 t = F32(x - left_edge) / (right_edge - left_edge);
+ setCurSliderValue(t * (mMaxValue - mMinValue) + mMinValue );
+ onCommit();
+
+ getWindow()->setCursor(UI_CURSOR_ARROW);
+ lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (active)" << llendl;
+ }
+ else
+ {
+ getWindow()->setCursor(UI_CURSOR_ARROW);
+ lldebugst(LLERR_USER_INPUT) << "hover handled by " << getName() << " (inactive)" << llendl;
+ }
+ return TRUE;
+}
+
+BOOL LLMultiSlider::handleMouseUp(S32 x, S32 y, MASK mask)
+{
+ BOOL handled = FALSE;
+
+ if( gFocusMgr.getMouseCapture() == this )
+ {
+ gFocusMgr.setMouseCapture( NULL );
+
+ if( mMouseUpCallback )
+ {
+ mMouseUpCallback( this, mCallbackUserData );
+ }
+ handled = TRUE;
+ make_ui_sound("UISndClickRelease");
+ }
+ else
+ {
+ handled = TRUE;
+ }
+
+ return handled;
+}
+
+BOOL LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask)
+{
+ // only do sticky-focus on non-chrome widgets
+ if (!getIsChrome())
+ {
+ setFocus(TRUE);
+ }
+ if( mMouseDownCallback )
+ {
+ mMouseDownCallback( this, mCallbackUserData );
+ }
+
+ if (MASK_CONTROL & mask) // if CTRL is modifying
+ {
+ setCurSliderValue(mInitialValue);
+ onCommit();
+ }
+ else
+ {
+ // scroll through thumbs to see if we have a new one selected and select that one
+ std::map<LLString, LLRect>::iterator mIt = mThumbRects.begin();
+ for(; mIt != mThumbRects.end(); mIt++) {
+
+ // check if inside. If so, set current slider and continue
+ if(mIt->second.pointInRect(x,y)) {
+ mCurSlider = mIt->first;
+ break;
+ }
+ }
+
+ // Find the offset of the actual mouse location from the center of the thumb.
+ if (mThumbRects[mCurSlider].pointInRect(x,y))
+ {
+ mMouseOffset = (mThumbRects[mCurSlider].mLeft + MULTI_THUMB_WIDTH/2) - x;
+ }
+ else
+ {
+ mMouseOffset = 0;
+ }
+
+ // Start dragging the thumb
+ // No handler needed for focus lost since this class has no state that depends on it.
+ gFocusMgr.setMouseCapture( this );
+ mDragStartThumbRect = mThumbRects[mCurSlider];
+ }
+ make_ui_sound("UISndClick");
+
+ return TRUE;
+}
+
+BOOL LLMultiSlider::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
+{
+ BOOL handled = FALSE;
+ if( getVisible() && getEnabled() && !called_from_parent )
+ {
+ switch(key)
+ {
+ case KEY_UP:
+ case KEY_DOWN:
+ // eat up and down keys to be consistent
+ handled = TRUE;
+ break;
+ case KEY_LEFT:
+ setCurSliderValue(getCurSliderValue() - getIncrement());
+ onCommit();
+ handled = TRUE;
+ break;
+ case KEY_RIGHT:
+ setCurSliderValue(getCurSliderValue() + getIncrement());
+ onCommit();
+ handled = TRUE;
+ break;
+ default:
+ break;
+ }
+ }
+ return handled;
+}
+
+void LLMultiSlider::draw()
+{
+ LLColor4 curThumbColor;
+
+ std::map<LLString, LLRect>::iterator mIt;
+ std::map<LLString, LLRect>::iterator curSldrIt;
+ if( getVisible() )
+ {
+ // Draw background and thumb.
+
+ // drawing solids requires texturing be disabled
+ LLGLSNoTexture no_texture;
+
+ LLRect rect(mDragStartThumbRect);
+
+ F32 opacity = getEnabled() ? 1.f : 0.3f;
+
+ // Track
+ LLUUID thumb_image_id;
+ thumb_image_id.set(LLUI::sAssetsGroup->getString("rounded_square.tga"));
+ LLPointer<LLImageGL> thumb_imagep(LLUI::sImageProvider->getUIImageByID(thumb_image_id)->getImage());
+
+ S32 height_offset = (getRect().getHeight() - MULTI_TRACK_HEIGHT) / 2;
+ LLRect track_rect(0, getRect().getHeight() - height_offset, getRect().getWidth(), height_offset );
+
+
+ if(mDrawTrack)
+ {
+ track_rect.stretch(-1);
+ gl_draw_scaled_image_with_border(track_rect.mLeft, track_rect.mBottom, 16, 16, track_rect.getWidth(), track_rect.getHeight(),
+ thumb_imagep, mTrackColor % opacity);
+ }
+
+ // if we're supposed to use a drawn triangle
+ // simple gl call for the triangle
+ if(mUseTriangle) {
+
+ for(mIt = mThumbRects.begin(); mIt != mThumbRects.end(); mIt++) {
+
+ gl_triangle_2d(
+ mIt->second.mLeft - EXTRA_TRIANGLE_WIDTH,
+ mIt->second.mTop + EXTRA_TRIANGLE_HEIGHT,
+ mIt->second.mRight + EXTRA_TRIANGLE_WIDTH,
+ mIt->second.mTop + EXTRA_TRIANGLE_HEIGHT,
+ mIt->second.mLeft + mIt->second.getWidth() / 2,
+ mIt->second.mBottom - EXTRA_TRIANGLE_HEIGHT,
+ mTriangleColor, TRUE);
+ }
+ }
+ else if (!thumb_imagep)
+ {
+ // draw all the thumbs
+ curSldrIt = mThumbRects.end();
+ for(mIt = mThumbRects.begin(); mIt != mThumbRects.end(); mIt++) {
+
+ // choose the color
+ curThumbColor = mThumbCenterColor;
+ if(mIt->first == mCurSlider) {
+
+ curSldrIt = mIt;
+ continue;
+ //curThumbColor = mThumbCenterSelectedColor;
+ }
+
+ // the draw command
+ gl_rect_2d(mIt->second, curThumbColor, TRUE);
+ }
+
+ // now draw the current slider
+ if(curSldrIt != mThumbRects.end()) {
+ gl_rect_2d(curSldrIt->second, mThumbCenterSelectedColor, TRUE);
+ }
+
+ // and draw the drag start
+ if (gFocusMgr.getMouseCapture() == this)
+ {
+ gl_rect_2d(mDragStartThumbRect, mThumbCenterColor % opacity, FALSE);
+ }
+ }
+ else if( gFocusMgr.getMouseCapture() == this )
+ {
+ // draw drag start
+ gl_draw_scaled_image_with_border(mDragStartThumbRect.mLeft,
+ mDragStartThumbRect.mBottom, 16, 16,
+ mDragStartThumbRect.getWidth(),
+ mDragStartThumbRect.getHeight(),
+ thumb_imagep, mThumbCenterColor % 0.3f, TRUE);
+
+ // draw the highlight
+ if (hasFocus())
+ {
+ F32 lerp_amt = gFocusMgr.getFocusFlashAmt();
+ LLRect highlight_rect = mThumbRects[mCurSlider];
+ highlight_rect.stretch(llround(lerp(1.f, 3.f, lerp_amt)));
+ gl_draw_scaled_image_with_border(highlight_rect.mLeft,
+ highlight_rect.mBottom, 16, 16, highlight_rect.getWidth(),
+ highlight_rect.getHeight(),
+ thumb_imagep, gFocusMgr.getFocusColor());
+ }
+
+ // draw the thumbs
+ curSldrIt = mThumbRects.end();
+ for(mIt = mThumbRects.begin(); mIt != mThumbRects.end(); mIt++) {
+
+ // choose the color
+ curThumbColor = mThumbCenterColor;
+ if(mIt->first == mCurSlider) {
+ // don't draw now, draw last
+ curSldrIt = mIt;
+ continue;
+ }
+
+ // the draw command
+ gl_draw_scaled_image_with_border(
+ mIt->second.mLeft,
+ mIt->second.mBottom, 16, 16,
+ mIt->second.getWidth(),
+ mIt->second.getHeight(), thumb_imagep,
+ curThumbColor, TRUE);
+ }
+
+ // draw cur slider last
+ if(curSldrIt != mThumbRects.end()) {
+ gl_draw_scaled_image_with_border(
+ curSldrIt->second.mLeft,
+ curSldrIt->second.mBottom, 16, 16,
+ curSldrIt->second.getWidth(),
+ curSldrIt->second.getHeight(), thumb_imagep,
+ mThumbCenterSelectedColor, TRUE);
+ }
+
+ }
+ else
+ {
+ // draw highlight
+ if (hasFocus())
+ {
+ F32 lerp_amt = gFocusMgr.getFocusFlashAmt();
+ LLRect highlight_rect = mThumbRects[mCurSlider];
+ highlight_rect.stretch(llround(lerp(1.f, 3.f, lerp_amt)));
+ gl_draw_scaled_image_with_border(highlight_rect.mLeft, highlight_rect.mBottom, 16, 16, highlight_rect.getWidth(), highlight_rect.getHeight(),
+ thumb_imagep, gFocusMgr.getFocusColor());
+ }
+
+ // draw thumbs
+ curSldrIt = mThumbRects.end();
+ for(mIt = mThumbRects.begin(); mIt != mThumbRects.end(); mIt++) {
+
+ // choose the color
+ curThumbColor = mThumbCenterColor;
+ if(mIt->first == mCurSlider) {
+ curSldrIt = mIt;
+ continue;
+ //curThumbColor = mThumbCenterSelectedColor;
+ }
+
+ // the draw command
+ gl_draw_scaled_image_with_border(
+ mIt->second.mLeft,
+ mIt->second.mBottom, 16, 16,
+ mIt->second.getWidth(),
+ mIt->second.getHeight(), thumb_imagep,
+ curThumbColor % opacity, TRUE);
+ }
+
+ if(curSldrIt != mThumbRects.end()) {
+ gl_draw_scaled_image_with_border(
+ curSldrIt->second.mLeft,
+ curSldrIt->second.mBottom, 16, 16,
+ curSldrIt->second.getWidth(),
+ curSldrIt->second.getHeight(), thumb_imagep,
+ mThumbCenterSelectedColor % opacity, TRUE);
+ }
+ }
+
+ LLUICtrl::draw();
+ }
+}
+
+// virtual
+LLXMLNodePtr LLMultiSlider::getXML(bool save_children) const
+{
+ LLXMLNodePtr node = LLUICtrl::getXML();
+
+ node->createChild("initial_val", TRUE)->setFloatValue(getInitialValue());
+ node->createChild("min_val", TRUE)->setFloatValue(getMinValue());
+ node->createChild("max_val", TRUE)->setFloatValue(getMaxValue());
+ node->createChild("increment", TRUE)->setFloatValue(getIncrement());
+
+ return node;
+}
+
+
+//static
+LLView* LLMultiSlider::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
+{
+ LLString name("multi_slider_bar");
+ node->getAttributeString("name", name);
+
+ LLRect rect;
+ createRect(node, rect, parent, LLRect());
+
+ F32 initial_value = 0.f;
+ node->getAttributeF32("initial_val", initial_value);
+
+ F32 min_value = 0.f;
+ node->getAttributeF32("min_val", min_value);
+
+ F32 max_value = 1.f;
+ node->getAttributeF32("max_val", max_value);
+
+ F32 increment = 0.1f;
+ node->getAttributeF32("increment", increment);
+
+ S32 max_sliders = 1;
+ node->getAttributeS32("max_sliders", max_sliders);
+
+ BOOL allow_overlap = FALSE;
+ node->getAttributeBOOL("allow_overlap", allow_overlap);
+
+ BOOL draw_track = TRUE;
+ node->getAttributeBOOL("draw_track", draw_track);
+
+ BOOL use_triangle = FALSE;
+ node->getAttributeBOOL("use_triangle", use_triangle);
+
+ LLMultiSlider* multiSlider = new LLMultiSlider(name,
+ rect,
+ NULL,
+ NULL,
+ initial_value,
+ min_value,
+ max_value,
+ increment,
+ max_sliders,
+ allow_overlap,
+ draw_track,
+ use_triangle);
+
+ multiSlider->initFromXML(node, parent);
+
+ return multiSlider;
+}
diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h
new file mode 100644
index 0000000000..67f627d21c
--- /dev/null
+++ b/indra/llui/llmultislider.h
@@ -0,0 +1,129 @@
+/**
+ * @file llmultislider.h
+ * @brief A simple multislider
+ *
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ *
+ * Copyright (c) 2007-2007, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_MULTI_SLIDER_H
+#define LL_MULTI_SLIDER_H
+
+#include "lluictrl.h"
+#include "v4color.h"
+
+class LLUICtrlFactory;
+
+class LLMultiSlider : public LLUICtrl
+{
+public:
+ LLMultiSlider(
+ const LLString& name,
+ const LLRect& rect,
+ void (*on_commit_callback)(LLUICtrl* ctrl, void* userdata),
+ void* callback_userdata,
+ F32 initial_value,
+ F32 min_value,
+ F32 max_value,
+ F32 increment,
+ S32 max_sliders,
+ BOOL allow_overlap,
+ BOOL draw_track,
+ BOOL use_triangle,
+ const LLString& control_name = LLString::null );
+
+ virtual EWidgetType getWidgetType() const;
+ virtual LLString getWidgetTag() const;
+ virtual LLXMLNodePtr getXML(bool save_children = true) const;
+ static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
+
+ void setSliderValue(const LLString& name, F32 value, BOOL from_event = FALSE);
+ F32 getSliderValue(const LLString& name) const;
+
+ const LLString& getCurSlider() const { return mCurSlider; }
+ F32 getCurSliderValue() const { return getSliderValue(mCurSlider); }
+ void setCurSlider(const LLString& name);
+ void setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mCurSlider, val, from_event); }
+
+ virtual void setValue(const LLSD& value);
+ virtual LLSD getValue() const { return mValue; }
+
+ virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); }
+ virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); }
+
+ F32 getInitialValue() const { return mInitialValue; }
+ F32 getMinValue() const { return mMinValue; }
+ F32 getMaxValue() const { return mMaxValue; }
+ F32 getIncrement() const { return mIncrement; }
+ void setMinValue(F32 min_value) { mMinValue = min_value; }
+ void setMaxValue(F32 max_value) { mMaxValue = max_value; }
+ void setIncrement(F32 increment) { mIncrement = increment; }
+ void setMouseDownCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseDownCallback = cb; }
+ void setMouseUpCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseUpCallback = cb; }
+
+ bool findUnusedValue(F32& initVal);
+ const LLString& addSlider();
+ const LLString& addSlider(F32 val);
+ void deleteSlider(const LLString& name);
+ void deleteCurSlider() { deleteSlider(mCurSlider); }
+ void clear();
+
+ virtual BOOL handleHover(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ virtual BOOL handleKeyHere(KEY key, MASK mask, BOOL called_from_parent);
+ virtual void draw();
+
+protected:
+ LLSD mValue;
+ F32 mInitialValue;
+ F32 mMinValue;
+ F32 mMaxValue;
+ F32 mIncrement;
+ LLString mCurSlider;
+ static S32 mNameCounter;
+
+ S32 mMaxNumSliders;
+ BOOL mAllowOverlap;
+ BOOL mDrawTrack;
+ BOOL mUseTriangle; /// hacked in toggle to use a triangle
+
+ S32 mMouseOffset;
+ LLRect mDragStartThumbRect;
+
+ std::map<LLString, LLRect> mThumbRects;
+ LLColor4 mTrackColor;
+ LLColor4 mThumbOutlineColor;
+ LLColor4 mThumbCenterColor;
+ LLColor4 mThumbCenterSelectedColor;
+ LLColor4 mDisabledThumbColor;
+ LLColor4 mTriangleColor;
+
+ void (*mMouseDownCallback)(LLUICtrl* ctrl, void* userdata);
+ void (*mMouseUpCallback)(LLUICtrl* ctrl, void* userdata);
+};
+
+#endif // LL_LLSLIDER_H
diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp
new file mode 100644
index 0000000000..6f921a4e5e
--- /dev/null
+++ b/indra/llui/llmultisliderctrl.cpp
@@ -0,0 +1,634 @@
+/**
+ * @file llmultisliderctrl.cpp
+ * @brief LLMultiSliderCtrl base class
+ *
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ *
+ * Copyright (c) 2007-2007, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "linden_common.h"
+
+#include "llmultisliderctrl.h"
+
+#include "audioengine.h"
+#include "sound_ids.h"
+
+#include "llmath.h"
+#include "llfontgl.h"
+#include "llgl.h"
+#include "llkeyboard.h"
+#include "lllineeditor.h"
+#include "llmultislider.h"
+#include "llstring.h"
+#include "lltextbox.h"
+#include "llui.h"
+#include "lluiconstants.h"
+#include "llcontrol.h"
+#include "llfocusmgr.h"
+#include "llresmgr.h"
+
+const U32 MAX_STRING_LENGTH = 10;
+
+
+LLMultiSliderCtrl::LLMultiSliderCtrl(const LLString& name, const LLRect& rect,
+ const LLString& label,
+ const LLFontGL* font,
+ S32 label_width,
+ S32 text_left,
+ BOOL show_text,
+ BOOL can_edit_text,
+ void (*commit_callback)(LLUICtrl*, void*),
+ void* callback_user_data,
+ F32 initial_value, F32 min_value, F32 max_value, F32 increment,
+ S32 max_sliders, BOOL allow_overlap,
+ BOOL draw_track,
+ BOOL use_triangle,
+ const LLString& control_which)
+ : LLUICtrl(name, rect, TRUE, commit_callback, callback_user_data ),
+ mFont(font),
+ mShowText( show_text ),
+ mCanEditText( can_edit_text ),
+ mPrecision( 3 ),
+ mLabelBox( NULL ),
+ mLabelWidth( label_width ),
+
+ mEditor( NULL ),
+ mTextBox( NULL ),
+ mTextEnabledColor( LLUI::sColorsGroup->getColor( "LabelTextColor" ) ),
+ mTextDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ),
+ mSliderMouseUpCallback( NULL ),
+ mSliderMouseDownCallback( NULL )
+{
+ S32 top = getRect().getHeight();
+ S32 bottom = 0;
+ S32 left = 0;
+
+ // Label
+ if( !label.empty() )
+ {
+ if (label_width == 0)
+ {
+ label_width = font->getWidth(label);
+ }
+ LLRect label_rect( left, top, label_width, bottom );
+ mLabelBox = new LLTextBox( "MultiSliderCtrl Label", label_rect, label.c_str(), font );
+ addChild(mLabelBox);
+ }
+
+ S32 slider_right = getRect().getWidth();
+ if( show_text )
+ {
+ slider_right = text_left - MULTI_SLIDERCTRL_SPACING;
+ }
+
+ S32 slider_left = label_width ? label_width + MULTI_SLIDERCTRL_SPACING : 0;
+ LLRect slider_rect( slider_left, top, slider_right, bottom );
+ mMultiSlider = new LLMultiSlider(
+ "multi_slider",
+ slider_rect,
+ LLMultiSliderCtrl::onSliderCommit, this,
+ initial_value, min_value, max_value, increment,
+ max_sliders, allow_overlap, draw_track,
+ use_triangle,
+ control_which );
+ addChild( mMultiSlider );
+ mCurValue = mMultiSlider->getCurSliderValue();
+
+ if( show_text )
+ {
+ LLRect text_rect( text_left, top, getRect().getWidth(), bottom );
+ if( can_edit_text )
+ {
+ mEditor = new LLLineEditor( "MultiSliderCtrl Editor", text_rect,
+ "", font,
+ MAX_STRING_LENGTH,
+ &LLMultiSliderCtrl::onEditorCommit, NULL, NULL, this,
+ &LLLineEditor::prevalidateFloat );
+ mEditor->setFollowsLeft();
+ mEditor->setFollowsBottom();
+ mEditor->setFocusReceivedCallback( &LLMultiSliderCtrl::onEditorGainFocus );
+ mEditor->setIgnoreTab(TRUE);
+ // don't do this, as selecting the entire text is single clicking in some cases
+ // and double clicking in others
+ //mEditor->setSelectAllonFocusReceived(TRUE);
+ addChild(mEditor);
+ }
+ else
+ {
+ mTextBox = new LLTextBox( "MultiSliderCtrl Text", text_rect, "", font);
+ mTextBox->setFollowsLeft();
+ mTextBox->setFollowsBottom();
+ addChild(mTextBox);
+ }
+ }
+
+ updateText();
+}
+
+LLMultiSliderCtrl::~LLMultiSliderCtrl()
+{
+ // Children all cleaned up by default view destructor.
+}
+
+// static
+void LLMultiSliderCtrl::onEditorGainFocus( LLFocusableElement* caller, void *userdata )
+{
+ LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata;
+ llassert( caller == self->mEditor );
+
+ self->onFocusReceived();
+}
+
+
+void LLMultiSliderCtrl::setValue(const LLSD& value)
+{
+ mMultiSlider->setValue(value);
+ mCurValue = mMultiSlider->getCurSliderValue();
+ updateText();
+}
+
+void LLMultiSliderCtrl::setSliderValue(const LLString& name, F32 v, BOOL from_event)
+{
+ mMultiSlider->setSliderValue(name, v, from_event );
+ mCurValue = mMultiSlider->getCurSliderValue();
+ updateText();
+}
+
+void LLMultiSliderCtrl::setCurSlider(const LLString& name)
+{
+ mMultiSlider->setCurSlider(name);
+ mCurValue = mMultiSlider->getCurSliderValue();
+}
+
+BOOL LLMultiSliderCtrl::setLabelArg( const LLString& key, const LLString& text )
+{
+ BOOL res = FALSE;
+ if (mLabelBox)
+ {
+ res = mLabelBox->setTextArg(key, text);
+ if (res && mLabelWidth == 0)
+ {
+ S32 label_width = mFont->getWidth(mLabelBox->getText());
+ LLRect rect = mLabelBox->getRect();
+ S32 prev_right = rect.mRight;
+ rect.mRight = rect.mLeft + label_width;
+ mLabelBox->setRect(rect);
+
+ S32 delta = rect.mRight - prev_right;
+ rect = mMultiSlider->getRect();
+ S32 left = rect.mLeft + delta;
+ left = llclamp(left, 0, rect.mRight-MULTI_SLIDERCTRL_SPACING);
+ rect.mLeft = left;
+ mMultiSlider->setRect(rect);
+ }
+ }
+ return res;
+}
+
+const LLString& LLMultiSliderCtrl::addSlider()
+{
+ const LLString& name = mMultiSlider->addSlider();
+
+ // if it returns null, pass it on
+ if(name == LLString::null) {
+ return LLString::null;
+ }
+
+ // otherwise, update stuff
+ mCurValue = mMultiSlider->getCurSliderValue();
+ updateText();
+ return name;
+}
+
+const LLString& LLMultiSliderCtrl::addSlider(F32 val)
+{
+ const LLString& name = mMultiSlider->addSlider(val);
+
+ // if it returns null, pass it on
+ if(name == LLString::null) {
+ return LLString::null;
+ }
+
+ // otherwise, update stuff
+ mCurValue = mMultiSlider->getCurSliderValue();
+ updateText();
+ return name;
+}
+
+void LLMultiSliderCtrl::deleteSlider(const LLString& name)
+{
+ mMultiSlider->deleteSlider(name);
+ mCurValue = mMultiSlider->getCurSliderValue();
+ updateText();
+}
+
+
+void LLMultiSliderCtrl::clear()
+{
+ setCurSliderValue(0.0f);
+ if( mEditor )
+ {
+ mEditor->setText(LLString(""));
+ }
+ if( mTextBox )
+ {
+ mTextBox->setText(LLString(""));
+ }
+
+ // get rid of sliders
+ mMultiSlider->clear();
+
+}
+
+BOOL LLMultiSliderCtrl::isMouseHeldDown()
+{
+ return gFocusMgr.getMouseCapture() == mMultiSlider;
+}
+
+void LLMultiSliderCtrl::updateText()
+{
+ if( mEditor || mTextBox )
+ {
+ LLLocale locale(LLLocale::USER_LOCALE);
+
+ // Don't display very small negative values as -0.000
+ F32 displayed_value = (F32)(floor(getCurSliderValue() * pow(10.0, (F64)mPrecision) + 0.5) / pow(10.0, (F64)mPrecision));
+
+ LLString format = llformat("%%.%df", mPrecision);
+ LLString text = llformat(format.c_str(), displayed_value);
+ if( mEditor )
+ {
+ mEditor->setText( text );
+ }
+ else
+ {
+ mTextBox->setText( text );
+ }
+ }
+}
+
+// static
+void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* caller, void *userdata )
+{
+ LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata;
+ llassert( caller == self->mEditor );
+
+ BOOL success = FALSE;
+ F32 val = self->mCurValue;
+ F32 saved_val = self->mCurValue;
+
+ LLString text = self->mEditor->getText();
+ if( LLLineEditor::postvalidateFloat( text ) )
+ {
+ LLLocale locale(LLLocale::USER_LOCALE);
+ val = (F32) atof( text.c_str() );
+ if( self->mMultiSlider->getMinValue() <= val && val <= self->mMultiSlider->getMaxValue() )
+ {
+ if( self->mValidateCallback )
+ {
+ self->setCurSliderValue( val ); // set the value temporarily so that the callback can retrieve it.
+ if( self->mValidateCallback( self, self->mCallbackUserData ) )
+ {
+ success = TRUE;
+ }
+ }
+ else
+ {
+ self->setCurSliderValue( val );
+ success = TRUE;
+ }
+ }
+ }
+
+ if( success )
+ {
+ self->onCommit();
+ }
+ else
+ {
+ if( self->getCurSliderValue() != saved_val )
+ {
+ self->setCurSliderValue( saved_val );
+ }
+ self->reportInvalidData();
+ }
+ self->updateText();
+}
+
+// static
+void LLMultiSliderCtrl::onSliderCommit( LLUICtrl* caller, void *userdata )
+{
+ LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata;
+ //llassert( caller == self->mSlider );
+
+ BOOL success = FALSE;
+ F32 saved_val = self->mCurValue;
+ F32 new_val = self->mMultiSlider->getCurSliderValue();
+
+ if( self->mValidateCallback )
+ {
+ self->mCurValue = new_val; // set the value temporarily so that the callback can retrieve it.
+ if( self->mValidateCallback( self, self->mCallbackUserData ) )
+ {
+ success = TRUE;
+ }
+ }
+ else
+ {
+ self->mCurValue = new_val;
+ success = TRUE;
+ }
+
+ if( success )
+ {
+ self->onCommit();
+ }
+ else
+ {
+ if( self->mCurValue != saved_val )
+ {
+ self->setCurSliderValue( saved_val );
+ }
+ self->reportInvalidData();
+ }
+ self->updateText();
+}
+
+void LLMultiSliderCtrl::setEnabled(BOOL b)
+{
+ LLUICtrl::setEnabled( b );
+
+ if( mLabelBox )
+ {
+ mLabelBox->setColor( b ? mTextEnabledColor : mTextDisabledColor );
+ }
+
+ mMultiSlider->setEnabled( b );
+
+ if( mEditor )
+ {
+ mEditor->setEnabled( b );
+ }
+
+ if( mTextBox )
+ {
+ mTextBox->setColor( b ? mTextEnabledColor : mTextDisabledColor );
+ }
+}
+
+
+void LLMultiSliderCtrl::setTentative(BOOL b)
+{
+ if( mEditor )
+ {
+ mEditor->setTentative(b);
+ }
+ LLUICtrl::setTentative(b);
+}
+
+
+void LLMultiSliderCtrl::onCommit()
+{
+ setTentative(FALSE);
+
+ if( mEditor )
+ {
+ mEditor->setTentative(FALSE);
+ }
+
+ LLUICtrl::onCommit();
+}
+
+
+void LLMultiSliderCtrl::setPrecision(S32 precision)
+{
+ if (precision < 0 || precision > 10)
+ {
+ llerrs << "LLMultiSliderCtrl::setPrecision - precision out of range" << llendl;
+ return;
+ }
+
+ mPrecision = precision;
+ updateText();
+}
+
+void LLMultiSliderCtrl::setSliderMouseDownCallback( void (*slider_mousedown_callback)(LLUICtrl* caller, void* userdata) )
+{
+ mSliderMouseDownCallback = slider_mousedown_callback;
+ mMultiSlider->setMouseDownCallback( LLMultiSliderCtrl::onSliderMouseDown );
+}
+
+// static
+void LLMultiSliderCtrl::onSliderMouseDown(LLUICtrl* caller, void* userdata)
+{
+ LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata;
+ if( self->mSliderMouseDownCallback )
+ {
+ self->mSliderMouseDownCallback( self, self->mCallbackUserData );
+ }
+}
+
+
+void LLMultiSliderCtrl::setSliderMouseUpCallback( void (*slider_mouseup_callback)(LLUICtrl* caller, void* userdata) )
+{
+ mSliderMouseUpCallback = slider_mouseup_callback;
+ mMultiSlider->setMouseUpCallback( LLMultiSliderCtrl::onSliderMouseUp );
+}
+
+// static
+void LLMultiSliderCtrl::onSliderMouseUp(LLUICtrl* caller, void* userdata)
+{
+ LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata;
+ if( self->mSliderMouseUpCallback )
+ {
+ self->mSliderMouseUpCallback( self, self->mCallbackUserData );
+ }
+}
+
+void LLMultiSliderCtrl::onTabInto()
+{
+ if( mEditor )
+ {
+ mEditor->onTabInto();
+ }
+}
+
+void LLMultiSliderCtrl::reportInvalidData()
+{
+ make_ui_sound("UISndBadKeystroke");
+}
+
+//virtual
+LLString LLMultiSliderCtrl::getControlName() const
+{
+ return mMultiSlider->getControlName();
+}
+
+// virtual
+void LLMultiSliderCtrl::setControlName(const LLString& control_name, LLView* context)
+{
+ mMultiSlider->setControlName(control_name, context);
+}
+
+// virtual
+LLXMLNodePtr LLMultiSliderCtrl::getXML(bool save_children) const
+{
+ LLXMLNodePtr node = LLUICtrl::getXML();
+
+ node->createChild("show_text", TRUE)->setBoolValue(mShowText);
+
+ node->createChild("can_edit_text", TRUE)->setBoolValue(mCanEditText);
+
+ node->createChild("decimal_digits", TRUE)->setIntValue(mPrecision);
+
+ if (mLabelBox)
+ {
+ node->createChild("label", TRUE)->setStringValue(mLabelBox->getText());
+ }
+
+ // TomY TODO: Do we really want to export the transient state of the slider?
+ node->createChild("value", TRUE)->setFloatValue(mCurValue);
+
+ if (mMultiSlider)
+ {
+ node->createChild("initial_val", TRUE)->setFloatValue(mMultiSlider->getInitialValue());
+ node->createChild("min_val", TRUE)->setFloatValue(mMultiSlider->getMinValue());
+ node->createChild("max_val", TRUE)->setFloatValue(mMultiSlider->getMaxValue());
+ node->createChild("increment", TRUE)->setFloatValue(mMultiSlider->getIncrement());
+ }
+ addColorXML(node, mTextEnabledColor, "text_enabled_color", "LabelTextColor");
+ addColorXML(node, mTextDisabledColor, "text_disabled_color", "LabelDisabledColor");
+
+ return node;
+}
+
+LLView* LLMultiSliderCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
+{
+ LLString name("multi_slider");
+ node->getAttributeString("name", name);
+
+ LLString label;
+ node->getAttributeString("label", label);
+
+ LLRect rect;
+ createRect(node, rect, parent, LLRect());
+
+ LLFontGL* font = LLView::selectFont(node);
+
+ // HACK: Font might not be specified.
+ if (!font)
+ {
+ font = LLFontGL::sSansSerifSmall;
+ }
+
+ S32 label_width = 0;
+ node->getAttributeS32("label_width", label_width);
+
+ BOOL show_text = TRUE;
+ node->getAttributeBOOL("show_text", show_text);
+
+ BOOL can_edit_text = FALSE;
+ node->getAttributeBOOL("can_edit_text", can_edit_text);
+
+ BOOL allow_overlap = FALSE;
+ node->getAttributeBOOL("allow_overlap", allow_overlap);
+
+ BOOL draw_track = TRUE;
+ node->getAttributeBOOL("draw_track", draw_track);
+
+ BOOL use_triangle = FALSE;
+ node->getAttributeBOOL("use_triangle", use_triangle);
+
+ F32 initial_value = 0.f;
+ node->getAttributeF32("initial_val", initial_value);
+
+ F32 min_value = 0.f;
+ node->getAttributeF32("min_val", min_value);
+
+ F32 max_value = 1.f;
+ node->getAttributeF32("max_val", max_value);
+
+ F32 increment = 0.1f;
+ node->getAttributeF32("increment", increment);
+
+ U32 precision = 3;
+ node->getAttributeU32("decimal_digits", precision);
+
+ S32 max_sliders = 1;
+ node->getAttributeS32("max_sliders", max_sliders);
+
+
+ S32 text_left = 0;
+ if (show_text)
+ {
+ // calculate the size of the text box (log max_value is number of digits - 1 so plus 1)
+ if ( max_value )
+ text_left = font->getWidth("0") * ( static_cast < S32 > ( log10 ( max_value ) ) + precision + 1 );
+
+ if ( increment < 1.0f )
+ text_left += font->getWidth("."); // (mostly) take account of decimal point in value
+
+ if ( min_value < 0.0f || max_value < 0.0f )
+ text_left += font->getWidth("-"); // (mostly) take account of minus sign
+
+ // padding to make things look nicer
+ text_left += 8;
+ }
+
+ LLUICtrlCallback callback = NULL;
+
+ if (label.empty())
+ {
+ label.assign(node->getTextContents());
+ }
+
+ LLMultiSliderCtrl* slider = new LLMultiSliderCtrl(name,
+ rect,
+ label,
+ font,
+ label_width,
+ rect.getWidth() - text_left,
+ show_text,
+ can_edit_text,
+ callback,
+ NULL,
+ initial_value,
+ min_value,
+ max_value,
+ increment,
+ max_sliders,
+ allow_overlap,
+ draw_track,
+ use_triangle);
+
+ slider->setPrecision(precision);
+
+ slider->initFromXML(node, parent);
+
+ slider->updateText();
+
+ return slider;
+}
diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h
new file mode 100644
index 0000000000..028f54ed5e
--- /dev/null
+++ b/indra/llui/llmultisliderctrl.h
@@ -0,0 +1,160 @@
+/**
+ * @file llmultisliderctrl.h
+ * @brief LLMultiSliderCtrl base class
+ *
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
+ *
+ * Copyright (c) 2007-2007, Linden Research, Inc.
+ *
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ *
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ *
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ *
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_MULTI_SLIDERCTRL_H
+#define LL_MULTI_SLIDERCTRL_H
+
+#include "lluictrl.h"
+#include "v4color.h"
+#include "llmultislider.h"
+#include "lltextbox.h"
+#include "llrect.h"
+
+//
+// Constants
+//
+const S32 MULTI_SLIDERCTRL_SPACING = 4; // space between label, slider, and text
+const S32 MULTI_SLIDERCTRL_HEIGHT = 16;
+
+//
+// Classes
+//
+class LLFontGL;
+class LLLineEditor;
+class LLSlider;
+
+
+class LLMultiSliderCtrl : public LLUICtrl
+{
+public:
+ LLMultiSliderCtrl(const LLString& name,
+ const LLRect& rect,
+ const LLString& label,
+ const LLFontGL* font,
+ S32 slider_left,
+ S32 text_left,
+ BOOL show_text,
+ BOOL can_edit_text,
+ void (*commit_callback)(LLUICtrl*, void*),
+ void* callback_userdata,
+ F32 initial_value, F32 min_value, F32 max_value, F32 increment,
+ S32 max_sliders, BOOL allow_overlap, BOOL draw_track,
+ BOOL use_triangle,
+ const LLString& control_which = LLString::null );
+
+ virtual ~LLMultiSliderCtrl();
+ virtual EWidgetType getWidgetType() const { return WIDGET_TYPE_MULTI_SLIDER; }
+ virtual LLString getWidgetTag() const { return LL_MULTI_SLIDER_CTRL_TAG; }
+ virtual LLXMLNodePtr getXML(bool save_children = true) const;
+ static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
+
+ F32 getSliderValue(const LLString& name) const;
+ void setSliderValue(const LLString& name, F32 v, BOOL from_event = FALSE);
+
+ virtual void setValue(const LLSD& value );
+ virtual LLSD getValue() const { return mMultiSlider->getValue(); }
+ virtual BOOL setLabelArg( const LLString& key, const LLString& text );
+
+ const LLString& getCurSlider() const { return mMultiSlider->getCurSlider(); }
+ F32 getCurSliderValue() const { return mCurValue; }
+ void setCurSlider(const LLString& name);
+ void setCurSliderValue(F32 val, BOOL from_event = false) { setSliderValue(mMultiSlider->getCurSlider(), val, from_event); }
+
+ virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); }
+ virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); }
+
+ BOOL isMouseHeldDown();
+
+ virtual void setEnabled( BOOL b );
+ virtual void clear();
+ virtual void setPrecision(S32 precision);
+ void setMinValue(F32 min_value) {mMultiSlider->setMinValue(min_value);}
+ void setMaxValue(F32 max_value) {mMultiSlider->setMaxValue(max_value);}
+ void setIncrement(F32 increment) {mMultiSlider->setIncrement(increment);}
+
+ /// for adding and deleting sliders
+ const LLString& addSlider();
+ const LLString& addSlider(F32 val);
+ void deleteSlider(const LLString& name);
+ void deleteCurSlider() { deleteSlider(mMultiSlider->getCurSlider()); }
+
+ F32 getMinValue() { return mMultiSlider->getMinValue(); }
+ F32 getMaxValue() { return mMultiSlider->getMaxValue(); }
+
+ void setLabel(const LLString& label) { if (mLabelBox) mLabelBox->setText(label); }
+ void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; }
+ void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; }
+
+ void setSliderMouseDownCallback( void (*slider_mousedown_callback)(LLUICtrl* caller, void* userdata) );
+ void setSliderMouseUpCallback( void (*slider_mouseup_callback)(LLUICtrl* caller, void* userdata) );
+
+ virtual void onTabInto();
+
+ virtual void setTentative(BOOL b); // marks value as tentative
+ virtual void onCommit(); // mark not tentative, then commit
+
+ virtual void setControlName(const LLString& control_name, LLView* context);
+ virtual LLString getControlName() const;
+
+ static void onSliderCommit(LLUICtrl* caller, void* userdata);
+ static void onSliderMouseDown(LLUICtrl* caller,void* userdata);
+ static void onSliderMouseUp(LLUICtrl* caller,void* userdata);
+
+ static void onEditorCommit(LLUICtrl* caller, void* userdata);
+ static void onEditorGainFocus(LLFocusableElement* caller, void *userdata);
+ static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata);
+
+private:
+ void updateText();
+ void reportInvalidData();
+
+private:
+ const LLFontGL* mFont;
+ BOOL mShowText;
+ BOOL mCanEditText;
+
+ S32 mPrecision;
+ LLTextBox* mLabelBox;
+ S32 mLabelWidth;
+
+ F32 mCurValue;
+ LLMultiSlider* mMultiSlider;
+ LLLineEditor* mEditor;
+ LLTextBox* mTextBox;
+
+ LLColor4 mTextEnabledColor;
+ LLColor4 mTextDisabledColor;
+
+ void (*mSliderMouseUpCallback)( LLUICtrl* ctrl, void* userdata );
+ void (*mSliderMouseDownCallback)( LLUICtrl* ctrl, void* userdata );
+};
+
+#endif // LL_MULTI_SLIDERCTRL_H
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index 6c2df683e4..96417d358b 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -188,7 +188,7 @@ public:
BOOL childSetLabelArg(const LLString& id, const LLString& key, const LLStringExplicit& text);
BOOL childSetToolTipArg(const LLString& id, const LLString& key, const LLStringExplicit& text);
- // LLSlider / LLSpinCtrl
+ // LLSlider / LLMultiSlider / LLSpinCtrl
void childSetMinValue(const LLString& id, LLSD min_value);
void childSetMaxValue(const LLString& id, LLSD max_value);
diff --git a/indra/llui/llscrollbar.cpp b/indra/llui/llscrollbar.cpp
index 056a94afb8..c3afb32570 100644
--- a/indra/llui/llscrollbar.cpp
+++ b/indra/llui/llscrollbar.cpp
@@ -46,6 +46,7 @@
#include "llwindow.h"
#include "llglheaders.h"
#include "llcontrol.h"
+#include "llglimmediate.h"
LLScrollbar::LLScrollbar(
const LLString& name, LLRect rect,
@@ -538,10 +539,10 @@ void LLScrollbar::draw()
rounded_rect_imagep, mThumbColor );
if (mCurGlowStrength > 0.01f)
{
- glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ gGL.blendFunc(GL_SRC_ALPHA, GL_ONE);
gl_draw_scaled_image_with_border(mThumbRect.mLeft, mThumbRect.mBottom, 16, 16, mThumbRect.getWidth(), mThumbRect.getHeight(),
rounded_rect_imagep, LLColor4(1.f, 1.f, 1.f, mCurGlowStrength), TRUE);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
}
diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp
index b9d5141eb7..991ba0ed04 100644
--- a/indra/llui/llscrollcontainer.cpp
+++ b/indra/llui/llscrollcontainer.cpp
@@ -33,6 +33,7 @@
#include "linden_common.h"
#include "llgl.h"
+#include "llglimmediate.h"
#include "llscrollcontainer.h"
#include "llscrollbar.h"
@@ -459,7 +460,7 @@ void LLScrollableContainerView::draw()
if( mIsOpaque )
{
LLGLSNoTexture no_texture;
- glColor4fv( mBackgroundColor.mV );
+ gGL.color4fv( mBackgroundColor.mV );
gl_rect_2d( mInnerRect );
}
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 4227a34777..35e8f7300b 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -43,6 +43,7 @@
#include "llclipboard.h"
#include "llfocusmgr.h"
#include "llgl.h"
+#include "llglimmediate.h"
#include "llglheaders.h"
#include "llresmgr.h"
#include "llscrollbar.h"
@@ -280,7 +281,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col
if (mHighlightCount > 0)
{
mRoundedRectImage->bind();
- glColor4fv(highlight_color.mV);
+ gGL.color4fv(highlight_color.mV);
S32 left = 0;
switch(mFontAlignment)
{
@@ -392,7 +393,7 @@ void LLScrollListItem::draw(const LLRect& rect, const LLColor4& fg_color, const
bg_rect.stretch(LIST_BORDER_PAD, 0);
{
LLGLSNoTexture no_texture;
- glColor4fv(bg_color.mV);
+ gGL.color4fv(bg_color.mV);
gl_rect_2d( bg_rect );
}
@@ -1711,7 +1712,7 @@ void LLScrollListCtrl::draw()
if (mBackgroundVisible)
{
LLGLSNoTexture no_texture;
- glColor4fv( getEnabled() ? mBgWriteableColor.mV : mBgReadOnlyColor.mV );
+ gGL.color4fv( getEnabled() ? mBgWriteableColor.mV : mBgReadOnlyColor.mV );
gl_rect_2d(background);
}
diff --git a/indra/llui/llslider.h b/indra/llui/llslider.h
index 6b1acfeaaa..9ca51120fc 100644
--- a/indra/llui/llslider.h
+++ b/indra/llui/llslider.h
@@ -70,8 +70,8 @@ public:
F32 getMinValue() const { return mMinValue; }
F32 getMaxValue() const { return mMaxValue; }
F32 getIncrement() const { return mIncrement; }
- void setMinValue(F32 min_value) {mMinValue = min_value;}
- void setMaxValue(F32 max_value) {mMaxValue = max_value;}
+ void setMinValue(F32 min_value) {mMinValue = min_value; updateThumbRect(); }
+ void setMaxValue(F32 max_value) {mMaxValue = max_value; updateThumbRect(); }
void setIncrement(F32 increment) {mIncrement = increment;}
void setMouseDownCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseDownCallback = cb; }
void setMouseUpCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseUpCallback = cb; }
diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h
index f154c230f4..4f96b0915c 100644
--- a/indra/llui/llsliderctrl.h
+++ b/indra/llui/llsliderctrl.h
@@ -83,9 +83,9 @@ public:
virtual void setEnabled( BOOL b );
virtual void clear();
virtual void setPrecision(S32 precision);
- void setMinValue(F32 min_value) { mSlider->setMinValue(min_value); }
- void setMaxValue(F32 max_value) { mSlider->setMaxValue(max_value); }
- void setIncrement(F32 increment) { mSlider->setIncrement(increment); }
+ void setMinValue(F32 min_value) { mSlider->setMinValue(min_value); updateText(); }
+ void setMaxValue(F32 max_value) { mSlider->setMaxValue(max_value); updateText(); }
+ void setIncrement(F32 increment) { mSlider->setIncrement(increment);}
F32 getMinValue() { return mSlider->getMinValue(); }
F32 getMaxValue() { return mSlider->getMaxValue(); }
@@ -102,7 +102,12 @@ public:
virtual void setTentative(BOOL b); // marks value as tentative
virtual void onCommit(); // mark not tentative, then commit
- virtual void setControlName(const LLString& control_name, LLView* context) { mSlider->setControlName(control_name, context); }
+ virtual void setControlName(const LLString& control_name, LLView* context)
+ {
+ LLView::setControlName(control_name, context);
+ mSlider->setControlName(control_name, context);
+ }
+
virtual LLString getControlName() const { return mSlider->getControlName(); }
static void onSliderCommit(LLUICtrl* caller, void* userdata);
diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h
index 77a91f80c1..2e1c06d2c4 100644
--- a/indra/llui/llspinctrl.h
+++ b/indra/llui/llspinctrl.h
@@ -86,6 +86,8 @@ public:
virtual void setMinValue(F32 min) { mMinValue = min; }
virtual void setMaxValue(F32 max) { mMaxValue = max; }
virtual void setIncrement(F32 inc) { mIncrement = inc; }
+ virtual F32 getMinValue() { return mMinValue ; }
+ virtual F32 getMaxValue() { return mMaxValue ; }
void setLabel(const LLStringExplicit& label);
void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; }
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 4568ebac29..0e64c6df5c 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -40,6 +40,7 @@
#include "llcriticaldamp.h"
#include "lluictrlfactory.h"
#include "lltabcontainervertical.h"
+#include "llglimmediate.h"
const F32 SCROLL_STEP_TIME = 0.4f;
@@ -287,15 +288,15 @@ void LLTabContainer::draw()
if( mIsVertical && has_scroll_arrows )
{
// Redraw the arrows so that they appears on top.
- glPushMatrix();
- glTranslatef((F32)mPrevArrowBtn->getRect().mLeft, (F32)mPrevArrowBtn->getRect().mBottom, 0.f);
+ gGL.pushMatrix();
+ gGL.translatef((F32)mPrevArrowBtn->getRect().mLeft, (F32)mPrevArrowBtn->getRect().mBottom, 0.f);
mPrevArrowBtn->draw();
- glPopMatrix();
+ gGL.popMatrix();
- glPushMatrix();
- glTranslatef((F32)mNextArrowBtn->getRect().mLeft, (F32)mNextArrowBtn->getRect().mBottom, 0.f);
+ gGL.pushMatrix();
+ gGL.translatef((F32)mNextArrowBtn->getRect().mLeft, (F32)mNextArrowBtn->getRect().mBottom, 0.f);
mNextArrowBtn->draw();
- glPopMatrix();
+ gGL.popMatrix();
}
}
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 540283c3fe..c76576895c 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -37,6 +37,7 @@
#include "llfontgl.h"
#include "llgl.h"
+#include "llglimmediate.h"
#include "llui.h"
#include "lluictrlfactory.h"
#include "llrect.h"
@@ -424,7 +425,7 @@ void LLTextEditor::updateLineStartList(S32 startpos)
else
{
const llwchar* str = mWText.c_str() + start_idx;
- S32 drawn = mGLFont->maxDrawableChars(str, (F32)mTextRect.getWidth() - line_width,
+ S32 drawn = mGLFont->maxDrawableChars(str, (F32)abs(mTextRect.getWidth()) - line_width,
end_idx - start_idx, mWordWrap, mAllowEmbeddedItems );
if( 0 == drawn && line_width == 0)
{
@@ -2601,7 +2602,7 @@ void LLTextEditor::drawSelectionBackground()
LLGLSNoTexture no_texture;
const LLColor4& color = mReadOnly ? mReadOnlyBgColor : mWriteableBgColor;
F32 alpha = hasFocus() ? 1.f : 0.5f;
- glColor4f( 1.f - color.mV[0], 1.f - color.mV[1], 1.f - color.mV[2], alpha );
+ gGL.color4f( 1.f - color.mV[0], 1.f - color.mV[1], 1.f - color.mV[2], alpha );
if( selection_left_y == selection_right_y )
{
@@ -2729,7 +2730,7 @@ void LLTextEditor::drawCursor()
LLGLSNoTexture no_texture;
- glColor4fv( mCursorColor.mV );
+ gGL.color4fv( mCursorColor.mV );
gl_rect_2d(llfloor(cursor_left), llfloor(cursor_top),
llfloor(cursor_right), llfloor(cursor_bottom));
@@ -2750,7 +2751,6 @@ void LLTextEditor::drawCursor()
{
text_color = mFgColor;
}
- LLGLSTexture texture;
mGLFont->render(text, mCursorPos, next_char_left, cursor_bottom + line_height,
LLColor4(1.f - text_color.mV[VRED], 1.f - text_color.mV[VGREEN], 1.f - text_color.mV[VBLUE], 1.f),
LLFontGL::LEFT, LLFontGL::TOP,
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index ad523db78b..aed7893df7 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -42,6 +42,7 @@
#include "v2math.h"
#include "v4color.h"
#include "llgl.h"
+#include "llglimmediate.h"
#include "llrect.h"
#include "llimagegl.h"
//#include "llviewerimage.h"
@@ -148,26 +149,26 @@ void gl_draw_x(const LLRect& rect, const LLColor4& color)
{
LLGLSNoTexture no_texture;
- glColor4fv( color.mV );
+ gGL.color4fv( color.mV );
- glBegin( GL_LINES );
- glVertex2i( rect.mLeft, rect.mTop );
- glVertex2i( rect.mRight, rect.mBottom );
- glVertex2i( rect.mLeft, rect.mBottom );
- glVertex2i( rect.mRight, rect.mTop );
- glEnd();
+ gGL.begin( GL_LINES );
+ gGL.vertex2i( rect.mLeft, rect.mTop );
+ gGL.vertex2i( rect.mRight, rect.mBottom );
+ gGL.vertex2i( rect.mLeft, rect.mBottom );
+ gGL.vertex2i( rect.mRight, rect.mTop );
+ gGL.end();
}
void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, S32 pixel_offset, BOOL filled)
{
- glColor4fv(color.mV);
+ gGL.color4fv(color.mV);
gl_rect_2d_offset_local(left, top, right, bottom, pixel_offset, filled);
}
void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixel_offset, BOOL filled)
{
- glPushMatrix();
+ gGL.pushMatrix();
left += LLFontGL::sCurOrigin.mX;
right += LLFontGL::sCurOrigin.mX;
bottom += LLFontGL::sCurOrigin.mY;
@@ -179,7 +180,7 @@ void gl_rect_2d_offset_local( S32 left, S32 top, S32 right, S32 bottom, S32 pixe
llfloor((F32)right * LLUI::sGLScaleFactor.mV[VX]) + pixel_offset,
llfloor((F32)bottom * LLUI::sGLScaleFactor.mV[VY]) - pixel_offset,
filled);
- glPopMatrix();
+ gGL.popMatrix();
}
@@ -191,48 +192,48 @@ void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled )
// Counterclockwise quad will face the viewer
if( filled )
{
- glBegin( GL_QUADS );
- glVertex2i(left, top);
- glVertex2i(left, bottom);
- glVertex2i(right, bottom);
- glVertex2i(right, top);
- glEnd();
+ gGL.begin( GL_QUADS );
+ gGL.vertex2i(left, top);
+ gGL.vertex2i(left, bottom);
+ gGL.vertex2i(right, bottom);
+ gGL.vertex2i(right, top);
+ gGL.end();
}
else
{
if( gGLManager.mATIOffsetVerticalLines )
{
// Work around bug in ATI driver: vertical lines are offset by (-1,-1)
- glBegin( GL_LINES );
+ gGL.begin( GL_LINES );
// Verticals
- glVertex2i(left + 1, top);
- glVertex2i(left + 1, bottom);
+ gGL.vertex2i(left + 1, top);
+ gGL.vertex2i(left + 1, bottom);
- glVertex2i(right, bottom);
- glVertex2i(right, top);
+ gGL.vertex2i(right, bottom);
+ gGL.vertex2i(right, top);
// Horizontals
top--;
right--;
- glVertex2i(left, bottom);
- glVertex2i(right, bottom);
+ gGL.vertex2i(left, bottom);
+ gGL.vertex2i(right, bottom);
- glVertex2i(left, top);
- glVertex2i(right, top);
- glEnd();
+ gGL.vertex2i(left, top);
+ gGL.vertex2i(right, top);
+ gGL.end();
}
else
{
top--;
right--;
- glBegin( GL_LINE_STRIP );
- glVertex2i(left, top);
- glVertex2i(left, bottom);
- glVertex2i(right, bottom);
- glVertex2i(right, top);
- glVertex2i(left, top);
- glEnd();
+ gGL.begin( GL_LINE_STRIP );
+ gGL.vertex2i(left, top);
+ gGL.vertex2i(left, bottom);
+ gGL.vertex2i(right, bottom);
+ gGL.vertex2i(right, top);
+ gGL.vertex2i(left, top);
+ gGL.end();
}
}
stop_glerror();
@@ -240,14 +241,14 @@ void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, BOOL filled )
void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &color, BOOL filled )
{
- glColor4fv( color.mV );
+ gGL.color4fv( color.mV );
gl_rect_2d( left, top, right, bottom, filled );
}
void gl_rect_2d( const LLRect& rect, const LLColor4& color, BOOL filled )
{
- glColor4fv( color.mV );
+ gGL.color4fv( color.mV );
gl_rect_2d( rect.mLeft, rect.mTop, rect.mRight, rect.mBottom, filled );
}
@@ -267,52 +268,52 @@ void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &st
LLColor4 end_color = start_color;
end_color.mV[VALPHA] = 0.f;
- glBegin(GL_QUADS);
+ gGL.begin(GL_QUADS);
// Right edge, CCW faces screen
- glColor4fv(start_color.mV);
- glVertex2i(right, top-lines);
- glVertex2i(right, bottom);
- glColor4fv(end_color.mV);
- glVertex2i(right+lines, bottom);
- glVertex2i(right+lines, top-lines);
+ gGL.color4fv(start_color.mV);
+ gGL.vertex2i(right, top-lines);
+ gGL.vertex2i(right, bottom);
+ gGL.color4fv(end_color.mV);
+ gGL.vertex2i(right+lines, bottom);
+ gGL.vertex2i(right+lines, top-lines);
// Bottom edge, CCW faces screen
- glColor4fv(start_color.mV);
- glVertex2i(right, bottom);
- glVertex2i(left+lines, bottom);
- glColor4fv(end_color.mV);
- glVertex2i(left+lines, bottom-lines);
- glVertex2i(right, bottom-lines);
+ gGL.color4fv(start_color.mV);
+ gGL.vertex2i(right, bottom);
+ gGL.vertex2i(left+lines, bottom);
+ gGL.color4fv(end_color.mV);
+ gGL.vertex2i(left+lines, bottom-lines);
+ gGL.vertex2i(right, bottom-lines);
// bottom left Corner
- glColor4fv(start_color.mV);
- glVertex2i(left+lines, bottom);
- glColor4fv(end_color.mV);
- glVertex2i(left, bottom);
+ gGL.color4fv(start_color.mV);
+ gGL.vertex2i(left+lines, bottom);
+ gGL.color4fv(end_color.mV);
+ gGL.vertex2i(left, bottom);
// make the bottom left corner not sharp
- glVertex2i(left+1, bottom-lines+1);
- glVertex2i(left+lines, bottom-lines);
+ gGL.vertex2i(left+1, bottom-lines+1);
+ gGL.vertex2i(left+lines, bottom-lines);
// bottom right corner
- glColor4fv(start_color.mV);
- glVertex2i(right, bottom);
- glColor4fv(end_color.mV);
- glVertex2i(right, bottom-lines);
+ gGL.color4fv(start_color.mV);
+ gGL.vertex2i(right, bottom);
+ gGL.color4fv(end_color.mV);
+ gGL.vertex2i(right, bottom-lines);
// make the rightmost corner not sharp
- glVertex2i(right+lines-1, bottom-lines+1);
- glVertex2i(right+lines, bottom);
+ gGL.vertex2i(right+lines-1, bottom-lines+1);
+ gGL.vertex2i(right+lines, bottom);
// top right corner
- glColor4fv(start_color.mV);
- glVertex2i( right, top-lines );
- glColor4fv(end_color.mV);
- glVertex2i( right+lines, top-lines );
+ gGL.color4fv(start_color.mV);
+ gGL.vertex2i( right, top-lines );
+ gGL.color4fv(end_color.mV);
+ gGL.vertex2i( right+lines, top-lines );
// make the corner not sharp
- glVertex2i( right+lines-1, top-1 );
- glVertex2i( right, top );
+ gGL.vertex2i( right+lines-1, top-1 );
+ gGL.vertex2i( right, top );
- glEnd();
+ gGL.end();
stop_glerror();
}
@@ -329,10 +330,10 @@ void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2 )
LLGLSNoTexture no_texture;
- glBegin(GL_LINES);
- glVertex2i(x1, y1);
- glVertex2i(x2, y2);
- glEnd();
+ gGL.begin(GL_LINES);
+ gGL.vertex2i(x1, y1);
+ gGL.vertex2i(x2, y2);
+ gGL.end();
}
void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color )
@@ -348,32 +349,32 @@ void gl_line_2d(S32 x1, S32 y1, S32 x2, S32 y2, const LLColor4 &color )
LLGLSNoTexture no_texture;
- glColor4fv( color.mV );
+ gGL.color4fv( color.mV );
- glBegin(GL_LINES);
- glVertex2i(x1, y1);
- glVertex2i(x2, y2);
- glEnd();
+ gGL.begin(GL_LINES);
+ gGL.vertex2i(x1, y1);
+ gGL.vertex2i(x2, y2);
+ gGL.end();
}
void gl_triangle_2d(S32 x1, S32 y1, S32 x2, S32 y2, S32 x3, S32 y3, const LLColor4& color, BOOL filled)
{
LLGLSNoTexture no_texture;
- glColor4fv(color.mV);
+ gGL.color4fv(color.mV);
if (filled)
{
- glBegin(GL_TRIANGLES);
+ gGL.begin(GL_TRIANGLES);
}
else
{
- glBegin(GL_LINE_LOOP);
+ gGL.begin(GL_LINE_LOOP);
}
- glVertex2i(x1, y1);
- glVertex2i(x2, y2);
- glVertex2i(x3, y3);
- glEnd();
+ gGL.vertex2i(x1, y1);
+ gGL.vertex2i(x2, y2);
+ gGL.vertex2i(x3, y3);
+ gGL.end();
}
void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max_frac)
@@ -382,31 +383,31 @@ void gl_corners_2d(S32 left, S32 top, S32 right, S32 bottom, S32 length, F32 max
length = llmin((S32)(max_frac*(right - left)), length);
length = llmin((S32)(max_frac*(top - bottom)), length);
- glBegin(GL_LINES);
- glVertex2i(left, top);
- glVertex2i(left + length, top);
+ gGL.begin(GL_LINES);
+ gGL.vertex2i(left, top);
+ gGL.vertex2i(left + length, top);
- glVertex2i(left, top);
- glVertex2i(left, top - length);
+ gGL.vertex2i(left, top);
+ gGL.vertex2i(left, top - length);
- glVertex2i(left, bottom);
- glVertex2i(left + length, bottom);
+ gGL.vertex2i(left, bottom);
+ gGL.vertex2i(left + length, bottom);
- glVertex2i(left, bottom);
- glVertex2i(left, bottom + length);
+ gGL.vertex2i(left, bottom);
+ gGL.vertex2i(left, bottom + length);
- glVertex2i(right, top);
- glVertex2i(right - length, top);
+ gGL.vertex2i(right, top);
+ gGL.vertex2i(right - length, top);
- glVertex2i(right, top);
- glVertex2i(right, top - length);
+ gGL.vertex2i(right, top);
+ gGL.vertex2i(right, top - length);
- glVertex2i(right, bottom);
- glVertex2i(right - length, bottom);
+ gGL.vertex2i(right, bottom);
+ gGL.vertex2i(right - length, bottom);
- glVertex2i(right, bottom);
- glVertex2i(right, bottom + length);
- glEnd();
+ gGL.vertex2i(right, bottom);
+ gGL.vertex2i(right, bottom + length);
+ gGL.end();
}
@@ -499,136 +500,136 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLIma
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA_ARB, GL_SRC_ALPHA);
}
- glPushMatrix();
+ gGL.pushMatrix();
{
- glTranslatef((F32)x, (F32)y, 0.f);
+ gGL.translatef((F32)x, (F32)y, 0.f);
image->bind();
- glColor4fv(color.mV);
+ gGL.color4fv(color.mV);
- glBegin(GL_QUADS);
+ gGL.begin(GL_QUADS);
{
// draw bottom left
- glTexCoord2d(uv_rect.mLeft, uv_rect.mBottom);
- glVertex2i(0, 0);
+ gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
+ gGL.vertex2i(0, 0);
- glTexCoord2f(clipped_scale_rect.mLeft, uv_rect.mBottom);
- glVertex2i(draw_scale_rect.mLeft, 0);
+ gGL.texCoord2f(clipped_scale_rect.mLeft, uv_rect.mBottom);
+ gGL.vertex2i(draw_scale_rect.mLeft, 0);
- glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom);
- glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom);
+ gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom);
+ gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom);
- glTexCoord2d(uv_rect.mLeft, clipped_scale_rect.mBottom);
- glVertex2i(0, draw_scale_rect.mBottom);
+ gGL.texCoord2f(uv_rect.mLeft, clipped_scale_rect.mBottom);
+ gGL.vertex2i(0, draw_scale_rect.mBottom);
// draw bottom middle
- glTexCoord2f(clipped_scale_rect.mLeft, uv_rect.mBottom);
- glVertex2i(draw_scale_rect.mLeft, 0);
+ gGL.texCoord2f(clipped_scale_rect.mLeft, uv_rect.mBottom);
+ gGL.vertex2i(draw_scale_rect.mLeft, 0);
- glTexCoord2d(clipped_scale_rect.mRight, uv_rect.mBottom);
- glVertex2i(draw_scale_rect.mRight, 0);
+ gGL.texCoord2f(clipped_scale_rect.mRight, uv_rect.mBottom);
+ gGL.vertex2i(draw_scale_rect.mRight, 0);
- glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mBottom);
- glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom);
+ gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mBottom);
+ gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom);
- glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom);
- glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom);
+ gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom);
+ gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom);
// draw bottom right
- glTexCoord2d(clipped_scale_rect.mRight, uv_rect.mBottom);
- glVertex2i(draw_scale_rect.mRight, 0);
+ gGL.texCoord2f(clipped_scale_rect.mRight, uv_rect.mBottom);
+ gGL.vertex2i(draw_scale_rect.mRight, 0);
- glTexCoord2d(uv_rect.mRight, uv_rect.mBottom);
- glVertex2i(width, 0);
+ gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
+ gGL.vertex2i(width, 0);
- glTexCoord2d(uv_rect.mRight, clipped_scale_rect.mBottom);
- glVertex2i(width, draw_scale_rect.mBottom);
+ gGL.texCoord2f(uv_rect.mRight, clipped_scale_rect.mBottom);
+ gGL.vertex2i(width, draw_scale_rect.mBottom);
- glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mBottom);
- glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom);
+ gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mBottom);
+ gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom);
// draw left
- glTexCoord2d(uv_rect.mLeft, clipped_scale_rect.mBottom);
- glVertex2i(0, draw_scale_rect.mBottom);
+ gGL.texCoord2f(uv_rect.mLeft, clipped_scale_rect.mBottom);
+ gGL.vertex2i(0, draw_scale_rect.mBottom);
- glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom);
- glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom);
+ gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom);
+ gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom);
- glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop);
- glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop);
+ gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop);
+ gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop);
- glTexCoord2d(uv_rect.mLeft, clipped_scale_rect.mTop);
- glVertex2i(0, draw_scale_rect.mTop);
+ gGL.texCoord2f(uv_rect.mLeft, clipped_scale_rect.mTop);
+ gGL.vertex2i(0, draw_scale_rect.mTop);
// draw middle
- glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom);
- glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom);
+ gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mBottom);
+ gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mBottom);
- glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mBottom);
- glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom);
+ gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mBottom);
+ gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom);
- glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mTop);
- glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop);
+ gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mTop);
+ gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop);
- glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop);
- glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop);
+ gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop);
+ gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop);
// draw right
- glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mBottom);
- glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom);
+ gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mBottom);
+ gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mBottom);
- glTexCoord2d(uv_rect.mRight, clipped_scale_rect.mBottom);
- glVertex2i(width, draw_scale_rect.mBottom);
+ gGL.texCoord2f(uv_rect.mRight, clipped_scale_rect.mBottom);
+ gGL.vertex2i(width, draw_scale_rect.mBottom);
- glTexCoord2d(uv_rect.mRight, clipped_scale_rect.mTop);
- glVertex2i(width, draw_scale_rect.mTop);
+ gGL.texCoord2f(uv_rect.mRight, clipped_scale_rect.mTop);
+ gGL.vertex2i(width, draw_scale_rect.mTop);
- glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mTop);
- glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop);
+ gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mTop);
+ gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop);
// draw top left
- glTexCoord2d(uv_rect.mLeft, clipped_scale_rect.mTop);
- glVertex2i(0, draw_scale_rect.mTop);
+ gGL.texCoord2f(uv_rect.mLeft, clipped_scale_rect.mTop);
+ gGL.vertex2i(0, draw_scale_rect.mTop);
- glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop);
- glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop);
+ gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop);
+ gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop);
- glTexCoord2f(clipped_scale_rect.mLeft, uv_rect.mTop);
- glVertex2i(draw_scale_rect.mLeft, height);
+ gGL.texCoord2f(clipped_scale_rect.mLeft, uv_rect.mTop);
+ gGL.vertex2i(draw_scale_rect.mLeft, height);
- glTexCoord2d(uv_rect.mLeft, uv_rect.mTop);
- glVertex2i(0, height);
+ gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop);
+ gGL.vertex2i(0, height);
// draw top middle
- glTexCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop);
- glVertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop);
+ gGL.texCoord2f(clipped_scale_rect.mLeft, clipped_scale_rect.mTop);
+ gGL.vertex2i(draw_scale_rect.mLeft, draw_scale_rect.mTop);
- glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mTop);
- glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop);
+ gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mTop);
+ gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop);
- glTexCoord2d(clipped_scale_rect.mRight, uv_rect.mTop);
- glVertex2i(draw_scale_rect.mRight, height);
+ gGL.texCoord2f(clipped_scale_rect.mRight, uv_rect.mTop);
+ gGL.vertex2i(draw_scale_rect.mRight, height);
- glTexCoord2f(clipped_scale_rect.mLeft, uv_rect.mTop);
- glVertex2i(draw_scale_rect.mLeft, height);
+ gGL.texCoord2f(clipped_scale_rect.mLeft, uv_rect.mTop);
+ gGL.vertex2i(draw_scale_rect.mLeft, height);
// draw top right
- glTexCoord2d(clipped_scale_rect.mRight, clipped_scale_rect.mTop);
- glVertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop);
+ gGL.texCoord2f(clipped_scale_rect.mRight, clipped_scale_rect.mTop);
+ gGL.vertex2i(draw_scale_rect.mRight, draw_scale_rect.mTop);
- glTexCoord2d(uv_rect.mRight, clipped_scale_rect.mTop);
- glVertex2i(width, draw_scale_rect.mTop);
+ gGL.texCoord2f(uv_rect.mRight, clipped_scale_rect.mTop);
+ gGL.vertex2i(width, draw_scale_rect.mTop);
- glTexCoord2d(uv_rect.mRight, uv_rect.mTop);
- glVertex2i(width, height);
+ gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
+ gGL.vertex2i(width, height);
- glTexCoord2d(clipped_scale_rect.mRight, uv_rect.mTop);
- glVertex2i(draw_scale_rect.mRight, height);
+ gGL.texCoord2f(clipped_scale_rect.mRight, uv_rect.mTop);
+ gGL.vertex2i(draw_scale_rect.mRight, height);
}
- glEnd();
+ gGL.end();
}
- glPopMatrix();
+ gGL.popMatrix();
if (solid_color)
{
@@ -651,39 +652,39 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
LLGLSUIDefault gls_ui;
- glPushMatrix();
+ gGL.pushMatrix();
{
- glTranslatef((F32)x, (F32)y, 0.f);
+ gGL.translatef((F32)x, (F32)y, 0.f);
if( degrees )
{
F32 offset_x = F32(width/2);
F32 offset_y = F32(height/2);
- glTranslatef( offset_x, offset_y, 0.f);
+ gGL.translatef( offset_x, offset_y, 0.f);
glRotatef( degrees, 0.f, 0.f, 1.f );
- glTranslatef( -offset_x, -offset_y, 0.f );
+ gGL.translatef( -offset_x, -offset_y, 0.f );
}
image->bind();
- glColor4fv(color.mV);
+ gGL.color4fv(color.mV);
- glBegin(GL_QUADS);
+ gGL.begin(GL_QUADS);
{
- glTexCoord2f(uv_rect.mRight, uv_rect.mTop);
- glVertex2i(width, height );
+ gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
+ gGL.vertex2i(width, height );
- glTexCoord2f(uv_rect.mLeft, uv_rect.mTop);
- glVertex2i(0, height );
+ gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop);
+ gGL.vertex2i(0, height );
- glTexCoord2f(uv_rect.mLeft, uv_rect.mBottom);
- glVertex2i(0, 0);
+ gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
+ gGL.vertex2i(0, 0);
- glTexCoord2f(uv_rect.mRight, uv_rect.mBottom);
- glVertex2i(width, 0);
+ gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
+ gGL.vertex2i(width, 0);
}
- glEnd();
+ gGL.end();
}
- glPopMatrix();
+ gGL.popMatrix();
}
@@ -697,31 +698,31 @@ void gl_draw_scaled_image_inverted(S32 x, S32 y, S32 width, S32 height, LLImageG
LLGLSUIDefault gls_ui;
- glPushMatrix();
+ gGL.pushMatrix();
{
- glTranslatef((F32)x, (F32)y, 0.f);
+ gGL.translatef((F32)x, (F32)y, 0.f);
image->bind();
- glColor4fv(color.mV);
+ gGL.color4fv(color.mV);
- glBegin(GL_QUADS);
+ gGL.begin(GL_QUADS);
{
- glTexCoord2f(uv_rect.mRight, uv_rect.mBottom);
- glVertex2i(width, height );
+ gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
+ gGL.vertex2i(width, height );
- glTexCoord2f(uv_rect.mLeft, uv_rect.mBottom);
- glVertex2i(0, height );
+ gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
+ gGL.vertex2i(0, height );
- glTexCoord2f(uv_rect.mLeft, uv_rect.mTop);
- glVertex2i(0, 0);
+ gGL.texCoord2f(uv_rect.mLeft, uv_rect.mTop);
+ gGL.vertex2i(0, 0);
- glTexCoord2f(uv_rect.mRight, uv_rect.mTop);
- glVertex2i(width, 0);
+ gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
+ gGL.vertex2i(width, 0);
}
- glEnd();
+ gGL.end();
}
- glPopMatrix();
+ gGL.popMatrix();
}
@@ -734,16 +735,18 @@ void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LL
// Stippled line
LLGLEnable stipple(GL_LINE_STIPPLE);
- glColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], color.mV[VALPHA]);
+ gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], color.mV[VALPHA]);
+
+ gGL.flush();
glLineWidth(2.5f);
glLineStipple(2, 0x3333 << shift);
- glBegin(GL_LINES);
+ gGL.begin(GL_LINES);
{
- glVertex3fv( start.mV );
- glVertex3fv( end.mV );
+ gGL.vertex3fv( start.mV );
+ gGL.vertex3fv( end.mV );
}
- glEnd();
+ gGL.end();
LLUI::setLineWidth(1.f);
}
@@ -751,16 +754,16 @@ void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LL
void gl_rect_2d_xor(S32 left, S32 top, S32 right, S32 bottom)
{
- glColor4fv( LLColor4::white.mV );
+ gGL.color4fv( LLColor4::white.mV );
glLogicOp( GL_XOR );
stop_glerror();
- glBegin(GL_QUADS);
- glVertex2i(left, top);
- glVertex2i(left, bottom);
- glVertex2i(right, bottom);
- glVertex2i(right, top);
- glEnd();
+ gGL.begin(GL_QUADS);
+ gGL.vertex2i(left, top);
+ gGL.vertex2i(left, bottom);
+ gGL.vertex2i(right, bottom);
+ gGL.vertex2i(right, top);
+ gGL.end();
glLogicOp( GL_COPY );
stop_glerror();
@@ -774,9 +777,9 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F
end_angle += F_TWO_PI;
}
- glPushMatrix();
+ gGL.pushMatrix();
{
- glTranslatef(center_x, center_y, 0.f);
+ gGL.translatef(center_x, center_y, 0.f);
// Inexact, but reasonably fast.
F32 delta = (end_angle - start_angle) / steps;
@@ -787,35 +790,35 @@ void gl_arc_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled, F
if (filled)
{
- glBegin(GL_TRIANGLE_FAN);
- glVertex2f(0.f, 0.f);
+ gGL.begin(GL_TRIANGLE_FAN);
+ gGL.vertex2f(0.f, 0.f);
// make sure circle is complete
steps += 1;
}
else
{
- glBegin(GL_LINE_STRIP);
+ gGL.begin(GL_LINE_STRIP);
}
while( steps-- )
{
// Successive rotations
- glVertex2f( x, y );
+ gGL.vertex2f( x, y );
F32 x_new = x * cos_delta - y * sin_delta;
y = x * sin_delta + y * cos_delta;
x = x_new;
}
- glEnd();
+ gGL.end();
}
- glPopMatrix();
+ gGL.popMatrix();
}
void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled)
{
- glPushMatrix();
+ gGL.pushMatrix();
{
LLGLSNoTexture gls_no_texture;
- glTranslatef(center_x, center_y, 0.f);
+ gGL.translatef(center_x, center_y, 0.f);
// Inexact, but reasonably fast.
F32 delta = F_TWO_PI / steps;
@@ -826,27 +829,27 @@ void gl_circle_2d(F32 center_x, F32 center_y, F32 radius, S32 steps, BOOL filled
if (filled)
{
- glBegin(GL_TRIANGLE_FAN);
- glVertex2f(0.f, 0.f);
+ gGL.begin(GL_TRIANGLE_FAN);
+ gGL.vertex2f(0.f, 0.f);
// make sure circle is complete
steps += 1;
}
else
{
- glBegin(GL_LINE_LOOP);
+ gGL.begin(GL_LINE_LOOP);
}
while( steps-- )
{
// Successive rotations
- glVertex2f( x, y );
+ gGL.vertex2f( x, y );
F32 x_new = x * cos_delta - y * sin_delta;
y = x * sin_delta + y * cos_delta;
x = x_new;
}
- glEnd();
+ gGL.end();
}
- glPopMatrix();
+ gGL.popMatrix();
}
// Renders a ring with sides (tube shape)
@@ -855,40 +858,40 @@ void gl_deep_circle( F32 radius, F32 depth, S32 steps )
F32 x = radius;
F32 y = 0.f;
F32 angle_delta = F_TWO_PI / (F32)steps;
- glBegin( GL_TRIANGLE_STRIP );
+ gGL.begin( GL_TRIANGLE_STRIP );
{
S32 step = steps + 1; // An extra step to close the circle.
while( step-- )
{
- glVertex3f( x, y, depth );
- glVertex3f( x, y, 0.f );
+ gGL.vertex3f( x, y, depth );
+ gGL.vertex3f( x, y, 0.f );
F32 x_new = x * cosf(angle_delta) - y * sinf(angle_delta);
y = x * sinf(angle_delta) + y * cosf(angle_delta);
x = x_new;
}
}
- glEnd();
+ gGL.end();
}
void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color, S32 steps, BOOL render_center )
{
- glPushMatrix();
+ gGL.pushMatrix();
{
- glTranslatef(0.f, 0.f, -width / 2);
+ gGL.translatef(0.f, 0.f, -width / 2);
if( render_center )
{
- glColor4fv(center_color.mV);
+ gGL.color4fv(center_color.mV);
gl_deep_circle( radius, width, steps );
}
else
{
gl_washer_2d(radius, radius - width, steps, side_color, side_color);
- glTranslatef(0.f, 0.f, width);
+ gGL.translatef(0.f, 0.f, width);
gl_washer_2d(radius - width, radius, steps, side_color, side_color);
}
}
- glPopMatrix();
+ gGL.popMatrix();
}
// Draw gray and white checkerboard with black border
@@ -913,15 +916,17 @@ void gl_rect_2d_checkerboard(const LLRect& rect)
LLGLSNoTexture gls_no_texture;
// ...white squares
- glColor3f( 1.f, 1.f, 1.f );
+ gGL.color3f( 1.f, 1.f, 1.f );
gl_rect_2d(rect);
// ...gray squares
- glColor3f( .7f, .7f, .7f );
+ gGL.color3f( .7f, .7f, .7f );
+ gGL.flush();
glPolygonStipple( checkerboard );
LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE);
gl_rect_2d(rect);
+ gGL.flush();
}
@@ -940,15 +945,15 @@ void gl_washer_2d(F32 outer_radius, F32 inner_radius, S32 steps, const LLColor4&
LLGLSNoTexture gls_no_texture;
- glBegin( GL_TRIANGLE_STRIP );
+ gGL.begin( GL_TRIANGLE_STRIP );
{
steps += 1; // An extra step to close the circle.
while( steps-- )
{
- glColor4fv(outer_color.mV);
- glVertex2f( x1, y1 );
- glColor4fv(inner_color.mV);
- glVertex2f( x2, y2 );
+ gGL.color4fv(outer_color.mV);
+ gGL.vertex2f( x1, y1 );
+ gGL.color4fv(inner_color.mV);
+ gGL.vertex2f( x2, y2 );
F32 x1_new = x1 * COS_DELTA - y1 * SIN_DELTA;
y1 = x1 * SIN_DELTA + y1 * COS_DELTA;
@@ -959,7 +964,7 @@ void gl_washer_2d(F32 outer_radius, F32 inner_radius, S32 steps, const LLColor4&
x2 = x2_new;
}
}
- glEnd();
+ gGL.end();
}
// Draws the area between two concentric circles, like
@@ -976,15 +981,15 @@ void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians,
F32 y2 = inner_radius * sin( start_radians );
LLGLSNoTexture gls_no_texture;
- glBegin( GL_TRIANGLE_STRIP );
+ gGL.begin( GL_TRIANGLE_STRIP );
{
steps += 1; // An extra step to close the circle.
while( steps-- )
{
- glColor4fv(outer_color.mV);
- glVertex2f( x1, y1 );
- glColor4fv(inner_color.mV);
- glVertex2f( x2, y2 );
+ gGL.color4fv(outer_color.mV);
+ gGL.vertex2f( x1, y1 );
+ gGL.color4fv(inner_color.mV);
+ gGL.vertex2f( x2, y2 );
F32 x1_new = x1 * COS_DELTA - y1 * SIN_DELTA;
y1 = x1 * SIN_DELTA + y1 * COS_DELTA;
@@ -995,7 +1000,7 @@ void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians,
x2 = x2_new;
}
}
- glEnd();
+ gGL.end();
}
// Draws spokes around a circle.
@@ -1013,14 +1018,14 @@ void gl_washer_spokes_2d(F32 outer_radius, F32 inner_radius, S32 count, const LL
LLGLSNoTexture gls_no_texture;
- glBegin( GL_LINES );
+ gGL.begin( GL_LINES );
{
while( count-- )
{
- glColor4fv(outer_color.mV);
- glVertex2f( x1, y1 );
- glColor4fv(inner_color.mV);
- glVertex2f( x2, y2 );
+ gGL.color4fv(outer_color.mV);
+ gGL.vertex2f( x1, y1 );
+ gGL.color4fv(inner_color.mV);
+ gGL.vertex2f( x2, y2 );
F32 x1_new = x1 * COS_DELTA - y1 * SIN_DELTA;
y1 = x1 * SIN_DELTA + y1 * COS_DELTA;
@@ -1031,36 +1036,36 @@ void gl_washer_spokes_2d(F32 outer_radius, F32 inner_radius, S32 count, const LL
x2 = x2_new;
}
}
- glEnd();
+ gGL.end();
}
void gl_rect_2d_simple_tex( S32 width, S32 height )
{
- glBegin( GL_QUADS );
+ gGL.begin( GL_QUADS );
- glTexCoord2f(1.f, 1.f);
- glVertex2i(width, height);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex2i(width, height);
- glTexCoord2f(0.f, 1.f);
- glVertex2i(0, height);
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex2i(0, height);
- glTexCoord2f(0.f, 0.f);
- glVertex2i(0, 0);
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex2i(0, 0);
- glTexCoord2f(1.f, 0.f);
- glVertex2i(width, 0);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex2i(width, 0);
- glEnd();
+ gGL.end();
}
void gl_rect_2d_simple( S32 width, S32 height )
{
- glBegin( GL_QUADS );
- glVertex2i(width, height);
- glVertex2i(0, height);
- glVertex2i(0, 0);
- glVertex2i(width, 0);
- glEnd();
+ gGL.begin( GL_QUADS );
+ gGL.vertex2i(width, height);
+ gGL.vertex2i(0, height);
+ gGL.vertex2i(0, 0);
+ gGL.vertex2i(width, 0);
+ gGL.end();
}
void gl_segmented_rect_2d_tex(const S32 left,
@@ -1075,9 +1080,9 @@ void gl_segmented_rect_2d_tex(const S32 left,
S32 width = llabs(right - left);
S32 height = llabs(top - bottom);
- glPushMatrix();
+ gGL.pushMatrix();
- glTranslatef((F32)left, (F32)bottom, 0.f);
+ gGL.translatef((F32)left, (F32)bottom, 0.f);
LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height);
if (border_uv_scale.mV[VX] > 0.5f)
@@ -1097,128 +1102,128 @@ void gl_segmented_rect_2d_tex(const S32 left,
LLVector2 width_vec((F32)width, 0.f);
LLVector2 height_vec(0.f, (F32)height);
- glBegin(GL_QUADS);
+ gGL.begin(GL_QUADS);
{
// draw bottom left
- glTexCoord2f(0.f, 0.f);
- glVertex2f(0.f, 0.f);
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex2f(0.f, 0.f);
- glTexCoord2f(border_uv_scale.mV[VX], 0.f);
- glVertex2fv(border_width_left.mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], 0.f);
+ gGL.vertex2fv(border_width_left.mV);
- glTexCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
- glVertex2fv((border_width_left + border_height_bottom).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
+ gGL.vertex2fv((border_width_left + border_height_bottom).mV);
- glTexCoord2f(0.f, border_uv_scale.mV[VY]);
- glVertex2fv(border_height_bottom.mV);
+ gGL.texCoord2f(0.f, border_uv_scale.mV[VY]);
+ gGL.vertex2fv(border_height_bottom.mV);
// draw bottom middle
- glTexCoord2f(border_uv_scale.mV[VX], 0.f);
- glVertex2fv(border_width_left.mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], 0.f);
+ gGL.vertex2fv(border_width_left.mV);
- glTexCoord2f(1.f - border_uv_scale.mV[VX], 0.f);
- glVertex2fv((width_vec - border_width_right).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 0.f);
+ gGL.vertex2fv((width_vec - border_width_right).mV);
- glTexCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
- glVertex2fv((width_vec - border_width_right + border_height_bottom).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
+ gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV);
- glTexCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
- glVertex2fv((border_width_left + border_height_bottom).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
+ gGL.vertex2fv((border_width_left + border_height_bottom).mV);
// draw bottom right
- glTexCoord2f(1.f - border_uv_scale.mV[VX], 0.f);
- glVertex2fv((width_vec - border_width_right).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 0.f);
+ gGL.vertex2fv((width_vec - border_width_right).mV);
- glTexCoord2f(1.f, 0.f);
- glVertex2fv(width_vec.mV);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex2fv(width_vec.mV);
- glTexCoord2f(1.f, border_uv_scale.mV[VY]);
- glVertex2fv((width_vec + border_height_bottom).mV);
+ gGL.texCoord2f(1.f, border_uv_scale.mV[VY]);
+ gGL.vertex2fv((width_vec + border_height_bottom).mV);
- glTexCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
- glVertex2fv((width_vec - border_width_right + border_height_bottom).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
+ gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV);
// draw left
- glTexCoord2f(0.f, border_uv_scale.mV[VY]);
- glVertex2fv(border_height_bottom.mV);
+ gGL.texCoord2f(0.f, border_uv_scale.mV[VY]);
+ gGL.vertex2fv(border_height_bottom.mV);
- glTexCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
- glVertex2fv((border_width_left + border_height_bottom).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
+ gGL.vertex2fv((border_width_left + border_height_bottom).mV);
- glTexCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((border_width_left + height_vec - border_height_top).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV);
- glTexCoord2f(0.f, 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((height_vec - border_height_top).mV);
+ gGL.texCoord2f(0.f, 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((height_vec - border_height_top).mV);
// draw middle
- glTexCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
- glVertex2fv((border_width_left + border_height_bottom).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
+ gGL.vertex2fv((border_width_left + border_height_bottom).mV);
- glTexCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
- glVertex2fv((width_vec - border_width_right + border_height_bottom).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
+ gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV);
- glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV);
- glTexCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((border_width_left + height_vec - border_height_top).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV);
// draw right
- glTexCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
- glVertex2fv((width_vec - border_width_right + border_height_bottom).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
+ gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV);
- glTexCoord2f(1.f, border_uv_scale.mV[VY]);
- glVertex2fv((width_vec + border_height_bottom).mV);
+ gGL.texCoord2f(1.f, border_uv_scale.mV[VY]);
+ gGL.vertex2fv((width_vec + border_height_bottom).mV);
- glTexCoord2f(1.f, 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((width_vec + height_vec - border_height_top).mV);
+ gGL.texCoord2f(1.f, 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((width_vec + height_vec - border_height_top).mV);
- glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV);
// draw top left
- glTexCoord2f(0.f, 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((height_vec - border_height_top).mV);
+ gGL.texCoord2f(0.f, 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((height_vec - border_height_top).mV);
- glTexCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((border_width_left + height_vec - border_height_top).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV);
- glTexCoord2f(border_uv_scale.mV[VX], 1.f);
- glVertex2fv((border_width_left + height_vec).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], 1.f);
+ gGL.vertex2fv((border_width_left + height_vec).mV);
- glTexCoord2f(0.f, 1.f);
- glVertex2fv((height_vec).mV);
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex2fv((height_vec).mV);
// draw top middle
- glTexCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((border_width_left + height_vec - border_height_top).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV);
- glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV);
- glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f);
- glVertex2fv((width_vec - border_width_right + height_vec).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f);
+ gGL.vertex2fv((width_vec - border_width_right + height_vec).mV);
- glTexCoord2f(border_uv_scale.mV[VX], 1.f);
- glVertex2fv((border_width_left + height_vec).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], 1.f);
+ gGL.vertex2fv((border_width_left + height_vec).mV);
// draw top right
- glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV);
- glTexCoord2f(1.f, 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((width_vec + height_vec - border_height_top).mV);
+ gGL.texCoord2f(1.f, 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((width_vec + height_vec - border_height_top).mV);
- glTexCoord2f(1.f, 1.f);
- glVertex2fv((width_vec + height_vec).mV);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex2fv((width_vec + height_vec).mV);
- glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f);
- glVertex2fv((width_vec - border_width_right + height_vec).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f);
+ gGL.vertex2fv((width_vec - border_width_right + height_vec).mV);
}
- glEnd();
+ gGL.end();
- glPopMatrix();
+ gGL.popMatrix();
}
void gl_segmented_rect_2d_fragment_tex(const S32 left,
@@ -1235,9 +1240,9 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
S32 width = llabs(right - left);
S32 height = llabs(top - bottom);
- glPushMatrix();
+ gGL.pushMatrix();
- glTranslatef((F32)left, (F32)bottom, 0.f);
+ gGL.translatef((F32)left, (F32)bottom, 0.f);
LLVector2 border_uv_scale((F32)border_size / (F32)texture_width, (F32)border_size / (F32)texture_height);
if (border_uv_scale.mV[VX] > 0.5f)
@@ -1265,7 +1270,7 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
LLVector2 x_min;
LLVector2 x_max;
- glBegin(GL_QUADS);
+ gGL.begin(GL_QUADS);
{
if (start_fragment < middle_start)
{
@@ -1275,43 +1280,43 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
x_max = llmin(end_fragment / middle_start, 1.f) * border_width_left;
// draw bottom left
- glTexCoord2f(u_min, 0.f);
- glVertex2fv(x_min.mV);
+ gGL.texCoord2f(u_min, 0.f);
+ gGL.vertex2fv(x_min.mV);
- glTexCoord2f(border_uv_scale.mV[VX], 0.f);
- glVertex2fv(x_max.mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], 0.f);
+ gGL.vertex2fv(x_max.mV);
- glTexCoord2f(u_max, border_uv_scale.mV[VY]);
- glVertex2fv((x_max + border_height_bottom).mV);
+ gGL.texCoord2f(u_max, border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_max + border_height_bottom).mV);
- glTexCoord2f(u_min, border_uv_scale.mV[VY]);
- glVertex2fv((x_min + border_height_bottom).mV);
+ gGL.texCoord2f(u_min, border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_min + border_height_bottom).mV);
// draw left
- glTexCoord2f(u_min, border_uv_scale.mV[VY]);
- glVertex2fv((x_min + border_height_bottom).mV);
+ gGL.texCoord2f(u_min, border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_min + border_height_bottom).mV);
- glTexCoord2f(u_max, border_uv_scale.mV[VY]);
- glVertex2fv((x_max + border_height_bottom).mV);
+ gGL.texCoord2f(u_max, border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_max + border_height_bottom).mV);
- glTexCoord2f(u_max, 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((x_max + height_vec - border_height_top).mV);
+ gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_max + height_vec - border_height_top).mV);
- glTexCoord2f(u_min, 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((x_min + height_vec - border_height_top).mV);
+ gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
// draw top left
- glTexCoord2f(u_min, 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((x_min + height_vec - border_height_top).mV);
+ gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
- glTexCoord2f(u_max, 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((x_max + height_vec - border_height_top).mV);
+ gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_max + height_vec - border_height_top).mV);
- glTexCoord2f(u_max, 1.f);
- glVertex2fv((x_max + height_vec).mV);
+ gGL.texCoord2f(u_max, 1.f);
+ gGL.vertex2fv((x_max + height_vec).mV);
- glTexCoord2f(u_min, 1.f);
- glVertex2fv((x_min + height_vec).mV);
+ gGL.texCoord2f(u_min, 1.f);
+ gGL.vertex2fv((x_min + height_vec).mV);
}
if (end_fragment > middle_start || start_fragment < middle_end)
@@ -1320,43 +1325,43 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
x_max = border_width_left + ((llclamp(end_fragment, middle_start, middle_end) - middle_start)) * width_vec;
// draw bottom middle
- glTexCoord2f(border_uv_scale.mV[VX], 0.f);
- glVertex2fv(x_min.mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], 0.f);
+ gGL.vertex2fv(x_min.mV);
- glTexCoord2f(1.f - border_uv_scale.mV[VX], 0.f);
- glVertex2fv((x_max).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 0.f);
+ gGL.vertex2fv((x_max).mV);
- glTexCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
- glVertex2fv((x_max + border_height_bottom).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_max + border_height_bottom).mV);
- glTexCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
- glVertex2fv((x_min + border_height_bottom).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_min + border_height_bottom).mV);
// draw middle
- glTexCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
- glVertex2fv((x_min + border_height_bottom).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_min + border_height_bottom).mV);
- glTexCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
- glVertex2fv((x_max + border_height_bottom).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_max + border_height_bottom).mV);
- glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((x_max + height_vec - border_height_top).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_max + height_vec - border_height_top).mV);
- glTexCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((x_min + height_vec - border_height_top).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
// draw top middle
- glTexCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((x_min + height_vec - border_height_top).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
- glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((x_max + height_vec - border_height_top).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_max + height_vec - border_height_top).mV);
- glTexCoord2f(1.f - border_uv_scale.mV[VX], 1.f);
- glVertex2fv((x_max + height_vec).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f);
+ gGL.vertex2fv((x_max + height_vec).mV);
- glTexCoord2f(border_uv_scale.mV[VX], 1.f);
- glVertex2fv((x_min + height_vec).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], 1.f);
+ gGL.vertex2fv((x_min + height_vec).mV);
}
if (end_fragment > middle_end)
@@ -1367,48 +1372,48 @@ void gl_segmented_rect_2d_fragment_tex(const S32 left,
x_max = width_vec - ((1.f - ((end_fragment - middle_end) / middle_start)) * border_width_right);
// draw bottom right
- glTexCoord2f(u_min, 0.f);
- glVertex2fv((x_min).mV);
+ gGL.texCoord2f(u_min, 0.f);
+ gGL.vertex2fv((x_min).mV);
- glTexCoord2f(u_max, 0.f);
- glVertex2fv(x_max.mV);
+ gGL.texCoord2f(u_max, 0.f);
+ gGL.vertex2fv(x_max.mV);
- glTexCoord2f(u_max, border_uv_scale.mV[VY]);
- glVertex2fv((x_max + border_height_bottom).mV);
+ gGL.texCoord2f(u_max, border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_max + border_height_bottom).mV);
- glTexCoord2f(u_min, border_uv_scale.mV[VY]);
- glVertex2fv((x_min + border_height_bottom).mV);
+ gGL.texCoord2f(u_min, border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_min + border_height_bottom).mV);
// draw right
- glTexCoord2f(u_min, border_uv_scale.mV[VY]);
- glVertex2fv((x_min + border_height_bottom).mV);
+ gGL.texCoord2f(u_min, border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_min + border_height_bottom).mV);
- glTexCoord2f(u_max, border_uv_scale.mV[VY]);
- glVertex2fv((x_max + border_height_bottom).mV);
+ gGL.texCoord2f(u_max, border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_max + border_height_bottom).mV);
- glTexCoord2f(u_max, 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((x_max + height_vec - border_height_top).mV);
+ gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_max + height_vec - border_height_top).mV);
- glTexCoord2f(u_min, 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((x_min + height_vec - border_height_top).mV);
+ gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
// draw top right
- glTexCoord2f(u_min, 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((x_min + height_vec - border_height_top).mV);
+ gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
- glTexCoord2f(u_max, 1.f - border_uv_scale.mV[VY]);
- glVertex2fv((x_max + height_vec - border_height_top).mV);
+ gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_max + height_vec - border_height_top).mV);
- glTexCoord2f(u_max, 1.f);
- glVertex2fv((x_max + height_vec).mV);
+ gGL.texCoord2f(u_max, 1.f);
+ gGL.vertex2fv((x_max + height_vec).mV);
- glTexCoord2f(u_min, 1.f);
- glVertex2fv((x_min + height_vec).mV);
+ gGL.texCoord2f(u_min, 1.f);
+ gGL.vertex2fv((x_min + height_vec).mV);
}
}
- glEnd();
+ gGL.end();
- glPopMatrix();
+ gGL.popMatrix();
}
void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& border_width,
@@ -1421,126 +1426,128 @@ void gl_segmented_rect_3d_tex(const LLVector2& border_scale, const LLVector3& bo
LLVector3 top_border_height = ((edges & (~(U32)ROUNDED_RECT_BOTTOM)) != 0) ? border_height : LLVector3::zero;
LLVector3 bottom_border_height = ((edges & (~(U32)ROUNDED_RECT_TOP)) != 0) ? border_height : LLVector3::zero;
- glBegin(GL_QUADS);
+
+ gGL.begin(GL_QUADS);
{
// draw bottom left
- glTexCoord2f(0.f, 0.f);
- glVertex3f(0.f, 0.f, 0.f);
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex3f(0.f, 0.f, 0.f);
- glTexCoord2f(border_scale.mV[VX], 0.f);
- glVertex3fv(left_border_width.mV);
+ gGL.texCoord2f(border_scale.mV[VX], 0.f);
+ gGL.vertex3fv(left_border_width.mV);
- glTexCoord2f(border_scale.mV[VX], border_scale.mV[VY]);
- glVertex3fv((left_border_width + bottom_border_height).mV);
+ gGL.texCoord2f(border_scale.mV[VX], border_scale.mV[VY]);
+ gGL.vertex3fv((left_border_width + bottom_border_height).mV);
- glTexCoord2f(0.f, border_scale.mV[VY]);
- glVertex3fv(bottom_border_height.mV);
+ gGL.texCoord2f(0.f, border_scale.mV[VY]);
+ gGL.vertex3fv(bottom_border_height.mV);
// draw bottom middle
- glTexCoord2f(border_scale.mV[VX], 0.f);
- glVertex3fv(left_border_width.mV);
+ gGL.texCoord2f(border_scale.mV[VX], 0.f);
+ gGL.vertex3fv(left_border_width.mV);
- glTexCoord2f(1.f - border_scale.mV[VX], 0.f);
- glVertex3fv((width_vec - right_border_width).mV);
+ gGL.texCoord2f(1.f - border_scale.mV[VX], 0.f);
+ gGL.vertex3fv((width_vec - right_border_width).mV);
- glTexCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]);
- glVertex3fv((width_vec - right_border_width + bottom_border_height).mV);
+ gGL.texCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]);
+ gGL.vertex3fv((width_vec - right_border_width + bottom_border_height).mV);
- glTexCoord2f(border_scale.mV[VX], border_scale.mV[VY]);
- glVertex3fv((left_border_width + bottom_border_height).mV);
+ gGL.texCoord2f(border_scale.mV[VX], border_scale.mV[VY]);
+ gGL.vertex3fv((left_border_width + bottom_border_height).mV);
// draw bottom right
- glTexCoord2f(1.f - border_scale.mV[VX], 0.f);
- glVertex3fv((width_vec - right_border_width).mV);
+ gGL.texCoord2f(1.f - border_scale.mV[VX], 0.f);
+ gGL.vertex3fv((width_vec - right_border_width).mV);
- glTexCoord2f(1.f, 0.f);
- glVertex3fv(width_vec.mV);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex3fv(width_vec.mV);
- glTexCoord2f(1.f, border_scale.mV[VY]);
- glVertex3fv((width_vec + bottom_border_height).mV);
+ gGL.texCoord2f(1.f, border_scale.mV[VY]);
+ gGL.vertex3fv((width_vec + bottom_border_height).mV);
- glTexCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]);
- glVertex3fv((width_vec - right_border_width + bottom_border_height).mV);
+ gGL.texCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]);
+ gGL.vertex3fv((width_vec - right_border_width + bottom_border_height).mV);
// draw left
- glTexCoord2f(0.f, border_scale.mV[VY]);
- glVertex3fv(bottom_border_height.mV);
+ gGL.texCoord2f(0.f, border_scale.mV[VY]);
+ gGL.vertex3fv(bottom_border_height.mV);
- glTexCoord2f(border_scale.mV[VX], border_scale.mV[VY]);
- glVertex3fv((left_border_width + bottom_border_height).mV);
+ gGL.texCoord2f(border_scale.mV[VX], border_scale.mV[VY]);
+ gGL.vertex3fv((left_border_width + bottom_border_height).mV);
- glTexCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]);
- glVertex3fv((left_border_width + height_vec - top_border_height).mV);
+ gGL.texCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]);
+ gGL.vertex3fv((left_border_width + height_vec - top_border_height).mV);
- glTexCoord2f(0.f, 1.f - border_scale.mV[VY]);
- glVertex3fv((height_vec - top_border_height).mV);
+ gGL.texCoord2f(0.f, 1.f - border_scale.mV[VY]);
+ gGL.vertex3fv((height_vec - top_border_height).mV);
// draw middle
- glTexCoord2f(border_scale.mV[VX], border_scale.mV[VY]);
- glVertex3fv((left_border_width + bottom_border_height).mV);
+ gGL.texCoord2f(border_scale.mV[VX], border_scale.mV[VY]);
+ gGL.vertex3fv((left_border_width + bottom_border_height).mV);
- glTexCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]);
- glVertex3fv((width_vec - right_border_width + bottom_border_height).mV);
+ gGL.texCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]);
+ gGL.vertex3fv((width_vec - right_border_width + bottom_border_height).mV);
- glTexCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]);
- glVertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV);
+ gGL.texCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]);
+ gGL.vertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV);
- glTexCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]);
- glVertex3fv((left_border_width + height_vec - top_border_height).mV);
+ gGL.texCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]);
+ gGL.vertex3fv((left_border_width + height_vec - top_border_height).mV);
// draw right
- glTexCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]);
- glVertex3fv((width_vec - right_border_width + bottom_border_height).mV);
+ gGL.texCoord2f(1.f - border_scale.mV[VX], border_scale.mV[VY]);
+ gGL.vertex3fv((width_vec - right_border_width + bottom_border_height).mV);
- glTexCoord2f(1.f, border_scale.mV[VY]);
- glVertex3fv((width_vec + bottom_border_height).mV);
+ gGL.texCoord2f(1.f, border_scale.mV[VY]);
+ gGL.vertex3fv((width_vec + bottom_border_height).mV);
- glTexCoord2f(1.f, 1.f - border_scale.mV[VY]);
- glVertex3fv((width_vec + height_vec - top_border_height).mV);
+ gGL.texCoord2f(1.f, 1.f - border_scale.mV[VY]);
+ gGL.vertex3fv((width_vec + height_vec - top_border_height).mV);
- glTexCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]);
- glVertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV);
+ gGL.texCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]);
+ gGL.vertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV);
// draw top left
- glTexCoord2f(0.f, 1.f - border_scale.mV[VY]);
- glVertex3fv((height_vec - top_border_height).mV);
+ gGL.texCoord2f(0.f, 1.f - border_scale.mV[VY]);
+ gGL.vertex3fv((height_vec - top_border_height).mV);
- glTexCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]);
- glVertex3fv((left_border_width + height_vec - top_border_height).mV);
+ gGL.texCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]);
+ gGL.vertex3fv((left_border_width + height_vec - top_border_height).mV);
- glTexCoord2f(border_scale.mV[VX], 1.f);
- glVertex3fv((left_border_width + height_vec).mV);
+ gGL.texCoord2f(border_scale.mV[VX], 1.f);
+ gGL.vertex3fv((left_border_width + height_vec).mV);
- glTexCoord2f(0.f, 1.f);
- glVertex3fv((height_vec).mV);
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex3fv((height_vec).mV);
// draw top middle
- glTexCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]);
- glVertex3fv((left_border_width + height_vec - top_border_height).mV);
+ gGL.texCoord2f(border_scale.mV[VX], 1.f - border_scale.mV[VY]);
+ gGL.vertex3fv((left_border_width + height_vec - top_border_height).mV);
- glTexCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]);
- glVertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV);
+ gGL.texCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]);
+ gGL.vertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV);
- glTexCoord2f(1.f - border_scale.mV[VX], 1.f);
- glVertex3fv((width_vec - right_border_width + height_vec).mV);
+ gGL.texCoord2f(1.f - border_scale.mV[VX], 1.f);
+ gGL.vertex3fv((width_vec - right_border_width + height_vec).mV);
- glTexCoord2f(border_scale.mV[VX], 1.f);
- glVertex3fv((left_border_width + height_vec).mV);
+ gGL.texCoord2f(border_scale.mV[VX], 1.f);
+ gGL.vertex3fv((left_border_width + height_vec).mV);
// draw top right
- glTexCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]);
- glVertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV);
+ gGL.texCoord2f(1.f - border_scale.mV[VX], 1.f - border_scale.mV[VY]);
+ gGL.vertex3fv((width_vec - right_border_width + height_vec - top_border_height).mV);
- glTexCoord2f(1.f, 1.f - border_scale.mV[VY]);
- glVertex3fv((width_vec + height_vec - top_border_height).mV);
+ gGL.texCoord2f(1.f, 1.f - border_scale.mV[VY]);
+ gGL.vertex3fv((width_vec + height_vec - top_border_height).mV);
- glTexCoord2f(1.f, 1.f);
- glVertex3fv((width_vec + height_vec).mV);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex3fv((width_vec + height_vec).mV);
- glTexCoord2f(1.f - border_scale.mV[VX], 1.f);
- glVertex3fv((width_vec - right_border_width + height_vec).mV);
+ gGL.texCoord2f(1.f - border_scale.mV[VX], 1.f);
+ gGL.vertex3fv((width_vec - right_border_width + height_vec).mV);
}
- glEnd();
+ gGL.end();
+
}
void gl_segmented_rect_3d_tex_top(const LLVector2& border_scale, const LLVector3& border_width, const LLVector3& border_height, const LLVector3& width_vec, const LLVector3& height_vec)
@@ -1588,7 +1595,7 @@ void LLUI::cleanupClass()
//static
void LLUI::translate(F32 x, F32 y, F32 z)
{
- glTranslatef(x,y,z);
+ gGL.translatef(x,y,z);
LLFontGL::sCurOrigin.mX += (S32) x;
LLFontGL::sCurOrigin.mY += (S32) y;
LLFontGL::sCurOrigin.mZ += z;
@@ -1597,14 +1604,14 @@ void LLUI::translate(F32 x, F32 y, F32 z)
//static
void LLUI::pushMatrix()
{
- glPushMatrix();
+ gGL.pushMatrix();
LLFontGL::sOriginStack.push_back(LLFontGL::sCurOrigin);
}
//static
void LLUI::popMatrix()
{
- glPopMatrix();
+ gGL.popMatrix();
LLFontGL::sCurOrigin = *LLFontGL::sOriginStack.rbegin();
LLFontGL::sOriginStack.pop_back();
}
@@ -1627,6 +1634,7 @@ void LLUI::setScaleFactor(const LLVector2 &scale_factor)
//static
void LLUI::setLineWidth(F32 width)
{
+ gGL.flush();
glLineWidth(width * lerp(sGLScaleFactor.mV[VX], sGLScaleFactor.mV[VY], 0.5f));
}
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index b5b15eef23..e7750087cf 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -224,6 +224,8 @@ typedef enum e_widget_type
WIDGET_TYPE_SLIDER, // actually LLSliderCtrl
WIDGET_TYPE_SLIDER_BAR, // actually LLSlider
WIDGET_TYPE_VOLUME_SLIDER,//actually LLVolumeSliderCtrl
+ WIDGET_TYPE_MULTI_SLIDER, // actually LLMultiSliderCtrl
+ WIDGET_TYPE_MULTI_SLIDER_BAR, // actually LLMultiSlider
WIDGET_TYPE_SPINNER,
WIDGET_TYPE_TEXT_EDITOR,
WIDGET_TYPE_TEXTURE_PICKER,
diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp
index 47919408ab..4acfc69f3a 100644
--- a/indra/llui/lluictrlfactory.cpp
+++ b/indra/llui/lluictrlfactory.cpp
@@ -59,6 +59,8 @@
#include "llscrolllistctrl.h"
#include "llslider.h"
#include "llsliderctrl.h"
+#include "llmultislider.h"
+#include "llmultisliderctrl.h"
#include "llspinctrl.h"
#include "lltabcontainer.h"
#include "lltabcontainervertical.h"
@@ -92,6 +94,8 @@ const LLString LLUICtrlFactory::sUICtrlNames[WIDGET_TYPE_COUNT] =
LLString("slider"), //WIDGET_TYPE_SLIDER, actually LLSliderCtrl
LLString("slider_bar"), //WIDGET_TYPE_SLIDER_BAR, actually LLSlider
LLString("volume_slider"), //WIDGET_TYPE_VOLUME_SLIDER, actually LLSlider + "volume" param
+ LLString("multi_slider"), //WIDGET_TYPE_MULTI_SLIDER, actually LLMultiSliderCtrl
+ LLString("multi_slider_bar"), //WIDGET_TYPE_MULTI_SLIDER_BAR, actually LLMultiSlider
LLString("spinner"), //WIDGET_TYPE_SPINNER, actually LLSpinCtrl
LLString("text_editor"), //WIDGET_TYPE_TEXT_EDITOR
LLString("texture_picker"),//WIDGET_TYPE_TEXTURE_PICKER
@@ -206,6 +210,8 @@ LLUICtrlFactory::LLUICtrlFactory()
LLUICtrlCreator<LLSliderCtrl>::registerCreator(LL_SLIDER_CTRL_TAG, this);
LLUICtrlCreator<LLSlider>::registerCreator(LL_SLIDER_TAG, this);
LLUICtrlCreator<LLSlider>::registerCreator(LL_VOLUME_SLIDER_CTRL_TAG, this);
+ LLUICtrlCreator<LLMultiSliderCtrl>::registerCreator(LL_MULTI_SLIDER_CTRL_TAG, this);
+ LLUICtrlCreator<LLMultiSlider>::registerCreator(LL_MULTI_SLIDER_TAG, this);
LLUICtrlCreator<LLSpinCtrl>::registerCreator(LL_SPIN_CTRL_TAG, this);
LLUICtrlCreator<LLTextBox>::registerCreator(LL_TEXT_BOX_TAG, this);
LLUICtrlCreator<LLRadioGroup>::registerCreator(LL_RADIO_GROUP_TAG, this);
@@ -729,6 +735,16 @@ LLScrollingPanelList* LLUICtrlFactory::getScrollingPanelList(const LLPanel* pane
return panelp->getChild<LLScrollingPanelList>(name);
}
+LLMultiSliderCtrl* LLUICtrlFactory::getMultiSliderByName(const LLPanel* panelp, const LLString& name)
+{
+ return panelp->getChild<LLMultiSliderCtrl>(name);
+}
+
+LLMultiSlider* LLUICtrlFactory::getMultiSliderBarByName(const LLPanel* panelp, const LLString& name)
+{
+ return panelp->getChild<LLMultiSlider>(name);
+}
+
LLCtrlListInterface* LLUICtrlFactory::getListInterfaceByName(const LLPanel* panelp, const LLString& name)
{
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index 1b90e64322..c2a6cfe510 100644
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -91,6 +91,8 @@ public:
static class LLPanel* getPanelByName( const LLPanel* panelp, const LLString& name);
static class LLMenuItemCallGL* getMenuItemCallByName( const LLPanel* panelp, const LLString& name);
static class LLScrollingPanelList* getScrollingPanelList( const LLPanel* panelp, const LLString& name);
+ static class LLMultiSliderCtrl* getMultiSliderByName( const LLPanel* panelp, const LLString& name);
+ static class LLMultiSlider* getMultiSliderBarByName(const LLPanel* panelp, const LLString& name);
// interface getters
static LLCtrlListInterface* getListInterfaceByName( const LLPanel* panelp, const LLString& name);
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 56e24085ac..0a37c03ac5 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -37,6 +37,7 @@
#include <cassert>
#include <boost/tokenizer.hpp>
+#include "llglimmediate.h"
#include "llevent.h"
#include "llfontgl.h"
#include "llfocusmgr.h"
@@ -1290,28 +1291,28 @@ void LLView::drawDebugRect()
border_color.mV[sDepth%3] = 1.f;
}
- glColor4fv( border_color.mV );
+ gGL.color4fv( border_color.mV );
- glBegin(GL_LINES);
- glVertex2i(0, debug_rect.getHeight() - 1);
- glVertex2i(0, 0);
+ gGL.begin(GL_LINES);
+ gGL.vertex2i(0, debug_rect.getHeight() - 1);
+ gGL.vertex2i(0, 0);
- glVertex2i(0, 0);
- glVertex2i(debug_rect.getWidth() - 1, 0);
+ gGL.vertex2i(0, 0);
+ gGL.vertex2i(debug_rect.getWidth() - 1, 0);
- glVertex2i(debug_rect.getWidth() - 1, 0);
- glVertex2i(debug_rect.getWidth() - 1, debug_rect.getHeight() - 1);
+ gGL.vertex2i(debug_rect.getWidth() - 1, 0);
+ gGL.vertex2i(debug_rect.getWidth() - 1, debug_rect.getHeight() - 1);
- glVertex2i(debug_rect.getWidth() - 1, debug_rect.getHeight() - 1);
- glVertex2i(0, debug_rect.getHeight() - 1);
- glEnd();
+ gGL.vertex2i(debug_rect.getWidth() - 1, debug_rect.getHeight() - 1);
+ gGL.vertex2i(0, debug_rect.getHeight() - 1);
+ gGL.end();
// Draw the name if it's not a leaf node
if (mChildList.size() && !sEditingUI)
{
//char temp[256];
S32 x, y;
- glColor4fv( border_color.mV );
+ gGL.color4fv( border_color.mV );
x = debug_rect.getWidth()/2;
y = debug_rect.getHeight()/2;
LLString debug_text = llformat("%s (%d x %d)", getName().c_str(),
diff --git a/indra/llui/llviewborder.cpp b/indra/llui/llviewborder.cpp
index 546eb23c03..301efa3872 100644
--- a/indra/llui/llviewborder.cpp
+++ b/indra/llui/llviewborder.cpp
@@ -30,6 +30,7 @@
#include "linden_common.h"
#include "llviewborder.h"
+#include "llglimmediate.h"
#include "llfocusmgr.h"
LLViewBorder::LLViewBorder( const LLString& name, const LLRect& rect, EBevel bevel, EStyle style, S32 width )
@@ -145,11 +146,11 @@ void LLViewBorder::drawOnePixelLines()
S32 right = getRect().getWidth();
S32 bottom = 0;
- glColor4fv( top_color.mV );
+ gGL.color4fv( top_color.mV );
gl_line_2d(left, bottom, left, top);
gl_line_2d(left, top, right, top);
- glColor4fv( bottom_color.mV );
+ gGL.color4fv( bottom_color.mV );
gl_line_2d(right, top, right, bottom);
gl_line_2d(left, bottom, right, bottom);
@@ -205,19 +206,19 @@ void LLViewBorder::drawTwoPixelLines()
S32 bottom = 0;
// draw borders
- glColor3fv( top_out_color );
+ gGL.color3fv( top_out_color );
gl_line_2d(left, bottom, left, top-1);
gl_line_2d(left, top-1, right, top-1);
- glColor3fv( top_in_color );
+ gGL.color3fv( top_in_color );
gl_line_2d(left+1, bottom+1, left+1, top-2);
gl_line_2d(left+1, top-2, right-1, top-2);
- glColor3fv( bottom_out_color );
+ gGL.color3fv( bottom_out_color );
gl_line_2d(right-1, top-1, right-1, bottom);
gl_line_2d(left, bottom, right, bottom);
- glColor3fv( bottom_in_color );
+ gGL.color3fv( bottom_in_color );
gl_line_2d(right-2, top-2, right-2, bottom+1);
gl_line_2d(left+1, bottom+1, right-1, bottom+1);
}
@@ -228,7 +229,7 @@ void LLViewBorder::drawTextures()
llassert( FALSE ); // TODO: finish implementing
- glColor4fv(UI_VERTEX_COLOR.mV);
+ gGL.color4fv(UI_VERTEX_COLOR.mV);
mTexture->bind();
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT );
@@ -243,12 +244,12 @@ void LLViewBorder::drawTextures()
void LLViewBorder::drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32 start_x, F32 start_y )
{
- glPushMatrix();
+ gGL.pushMatrix();
{
- glTranslatef(start_x, start_y, 0.f);
+ gGL.translatef(start_x, start_y, 0.f);
glRotatef( degrees, 0, 0, 1 );
- glBegin(GL_QUADS);
+ gGL.begin(GL_QUADS);
{
// width, width /---------\ length-width, width //
// / \ //
@@ -256,21 +257,21 @@ void LLViewBorder::drawTextureTrapezoid( F32 degrees, S32 width, S32 length, F32
// /---------------\ //
// 0,0 length, 0 //
- glTexCoord2f( 0, 0 );
- glVertex2i( 0, 0 );
+ gGL.texCoord2f( 0, 0 );
+ gGL.vertex2i( 0, 0 );
- glTexCoord2f( (GLfloat)length, 0 );
- glVertex2i( length, 0 );
+ gGL.texCoord2f( (GLfloat)length, 0 );
+ gGL.vertex2i( length, 0 );
- glTexCoord2f( (GLfloat)(length - width), (GLfloat)width );
- glVertex2i( length - width, width );
+ gGL.texCoord2f( (GLfloat)(length - width), (GLfloat)width );
+ gGL.vertex2i( length - width, width );
- glTexCoord2f( (GLfloat)width, (GLfloat)width );
- glVertex2i( width, width );
+ gGL.texCoord2f( (GLfloat)width, (GLfloat)width );
+ gGL.vertex2i( width, width );
}
- glEnd();
+ gGL.end();
}
- glPopMatrix();
+ gGL.popMatrix();
}
BOOL LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style)
diff --git a/indra/llui/llviewborder.h b/indra/llui/llviewborder.h
index e9fd8aa4e1..d35663c857 100644
--- a/indra/llui/llviewborder.h
+++ b/indra/llui/llviewborder.h
@@ -64,6 +64,9 @@ public:
const LLColor4& highlight_light, const LLColor4& highlight_dark );
void setTexture( const class LLUUID &image_id );
+ LLColor4 getHighlightLight() {return mHighlightLight;}
+ LLColor4 getShadowDark() {return mHighlightDark;}
+
EStyle getStyle() const { return mStyle; }
void setKeyboardFocusHighlight( BOOL b ) { mHasKeyboardFocus = b; }