Merge remote-tracking branch 'refs/remotes/GarageGames/development' into ColorPickerAdvanced

This commit is contained in:
Anis A. Hireche 2016-02-26 20:15:33 +01:00
commit 2ff18cfc3f
629 changed files with 33887 additions and 3352 deletions

View file

@ -136,6 +136,8 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
{
GFX->setClipRect(updateRect);
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
//draw the outline
RectI winRect;
winRect.point = offset;
@ -148,11 +150,11 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
winRect.extent.y -= mBitmapBounds[BorderTop].extent.y + mBitmapBounds[BorderBottom].extent.y;
if(mProfile->mOpaque)
GFX->getDrawUtil()->drawRectFill(winRect, mProfile->mFillColor);
drawUtil->drawRectFill(winRect, mProfile->mFillColor);
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset, mBitmapBounds[BorderTopLeft]);
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[BorderTopRight].extent.x, offset.y),
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapSR(mTextureObject, offset, mBitmapBounds[BorderTopLeft]);
drawUtil->drawBitmapSR(mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[BorderTopRight].extent.x, offset.y),
mBitmapBounds[BorderTopRight]);
RectI destRect;
@ -162,7 +164,7 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
destRect.extent.y = mBitmapBounds[BorderTop].extent.y;
RectI stretchRect = mBitmapBounds[BorderTop];
stretchRect.inset(1,0);
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
destRect.point.x = offset.x;
destRect.point.y = offset.y + mBitmapBounds[BorderTopLeft].extent.y;
@ -170,7 +172,7 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
destRect.extent.y = getHeight() - mBitmapBounds[BorderTopLeft].extent.y - mBitmapBounds[BorderBottomLeft].extent.y;
stretchRect = mBitmapBounds[BorderLeft];
stretchRect.inset(0,1);
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
destRect.point.x = offset.x + getWidth() - mBitmapBounds[BorderRight].extent.x;
destRect.extent.x = mBitmapBounds[BorderRight].extent.x;
@ -179,10 +181,10 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
stretchRect = mBitmapBounds[BorderRight];
stretchRect.inset(0,1);
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset + Point2I(0, getHeight() - mBitmapBounds[BorderBottomLeft].extent.y), mBitmapBounds[BorderBottomLeft]);
GFX->getDrawUtil()->drawBitmapSR(mTextureObject, offset + getExtent() - mBitmapBounds[BorderBottomRight].extent, mBitmapBounds[BorderBottomRight]);
drawUtil->drawBitmapSR(mTextureObject, offset + Point2I(0, getHeight() - mBitmapBounds[BorderBottomLeft].extent.y), mBitmapBounds[BorderBottomLeft]);
drawUtil->drawBitmapSR(mTextureObject, offset + getExtent() - mBitmapBounds[BorderBottomRight].extent, mBitmapBounds[BorderBottomRight]);
destRect.point.x = offset.x + mBitmapBounds[BorderBottomLeft].extent.x;
destRect.extent.x = getWidth() - mBitmapBounds[BorderBottomLeft].extent.x - mBitmapBounds[BorderBottomRight].extent.x;
@ -192,6 +194,6 @@ void GuiBitmapBorderCtrl::onRender(Point2I offset, const RectI &updateRect)
stretchRect = mBitmapBounds[BorderBottom];
stretchRect.inset(1,0);
GFX->getDrawUtil()->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
}
}

View file

@ -113,7 +113,10 @@ void GuiConsoleTextCtrl::onPreRender()
{
if ( mConsoleExpression.isNotEmpty() )
{
mResult = (const char*)Con::evaluatef( "$guiConsoleTextCtrlTemp = %s;", mConsoleExpression.c_str() );
Con::evaluatef( "$guiConsoleTextCtrlTemp = %s;", mConsoleExpression.c_str() );
//Fixes a bug with the above not always grabbing the console text.
mResult = Con::getVariable("$guiConsoleTextCtrlTemp");
// Of the resulting string we will be printing,
// Find the number of lines and length of each.

View file

@ -56,6 +56,8 @@ void GuiGameListMenuCtrl::onRender(Point2I offset, const RectI &updateRect)
{
GuiGameListMenuProfile * profile = (GuiGameListMenuProfile *) mProfile;
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
F32 xScale = (float) getWidth() / profile->getRowWidth();
bool profileHasIcons = profile->hasArrows();
@ -121,19 +123,19 @@ void GuiGameListMenuCtrl::onRender(Point2I offset, const RectI &updateRect)
}
// render the row bitmap
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretchSR(profile->mTextureObject, RectI(currentOffset, rowExtent), profile->getBitmapArrayRect(buttonTextureIndex));
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretchSR(profile->mTextureObject, RectI(currentOffset, rowExtent), profile->getBitmapArrayRect(buttonTextureIndex));
// render the row icon if it has one
if ((iconIndex != NO_ICON) && profileHasIcons && (! profile->getBitmapArrayRect((U32)iconIndex).extent.isZero()))
{
iconIndex += Profile::TEX_FIRST_ICON;
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretchSR(profile->mTextureObject, RectI(currentOffset + iconOffset, iconExtent), profile->getBitmapArrayRect(iconIndex));
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretchSR(profile->mTextureObject, RectI(currentOffset + iconOffset, iconExtent), profile->getBitmapArrayRect(iconIndex));
}
// render the row text
GFX->getDrawUtil()->setBitmapModulation(fontColor);
drawUtil->setBitmapModulation(fontColor);
renderJustifiedText(currentOffset + textOffset, textExtent, (*row)->mLabel);
}

View file

@ -249,8 +249,9 @@ bool GuiGradientCtrl::onAdd()
{
Parent::onAdd();
S32 l = getBounds().point.x + mSwatchFactor, r = getBounds().point.x + getBounds().extent.x - mSwatchFactor;
S32 t = getBounds().point.y, b = getBounds().point.y + getBounds().extent.y - mSwatchFactor;
RectI bounds = getBounds();
S32 l = bounds.point.x + mSwatchFactor, r = bounds.point.x + bounds.extent.x - mSwatchFactor;
S32 t = bounds.point.y, b = bounds.point.y + bounds.extent.y - mSwatchFactor;
mBlendRangeBox = RectI( Point2I(l, t), Point2I(r, b) );
setupDefaultRange();
@ -330,16 +331,18 @@ void GuiGradientCtrl::drawBlendRangeBox(RectI &bounds, bool vertical, Vector<Col
// Update local dimensions
mBlendRangeBox.point = globalToLocalCoord(Point2I(l, t));
mBlendRangeBox.extent = globalToLocalCoord(Point2I(r, b));
ColorRange& firstColorRange = colorRange.first();
if(colorRange.size() == 1) // Only one color to draw
{
PrimBuild::begin( GFXTriangleFan, 4 );
PrimBuild::color( colorRange.first().swatch->getColor() );
PrimBuild::color(firstColorRange.swatch->getColor());
PrimBuild::vertex2i( l, t );
PrimBuild::vertex2i( l, b );
PrimBuild::color( colorRange.first().swatch->getColor() );
PrimBuild::color(firstColorRange.swatch->getColor());
PrimBuild::vertex2i( r, b );
PrimBuild::vertex2i( r, t );
@ -349,13 +352,13 @@ void GuiGradientCtrl::drawBlendRangeBox(RectI &bounds, bool vertical, Vector<Col
{
PrimBuild::begin( GFXTriangleFan, 4 );
PrimBuild::color( colorRange.first().swatch->getColor() );
PrimBuild::color(firstColorRange.swatch->getColor());
PrimBuild::vertex2i( l, t );
PrimBuild::vertex2i( l, b );
PrimBuild::color( colorRange.first().swatch->getColor() );
PrimBuild::vertex2i( l + colorRange.first().swatch->getPosition().x, b );
PrimBuild::vertex2i( l + colorRange.first().swatch->getPosition().x, t );
PrimBuild::color(firstColorRange.swatch->getColor());
PrimBuild::vertex2i(l + firstColorRange.swatch->getPosition().x, b);
PrimBuild::vertex2i(l + firstColorRange.swatch->getPosition().x, t);
PrimBuild::end();
@ -377,13 +380,15 @@ void GuiGradientCtrl::drawBlendRangeBox(RectI &bounds, bool vertical, Vector<Col
PrimBuild::end();
}
ColorRange& lastColorRange = colorRange.last();
PrimBuild::begin( GFXTriangleFan, 4 );
PrimBuild::color( colorRange.last().swatch->getColor() );
PrimBuild::vertex2i( l + colorRange.last().swatch->getPosition().x, t );
PrimBuild::vertex2i( l + colorRange.last().swatch->getPosition().x, b );
PrimBuild::color(lastColorRange.swatch->getColor());
PrimBuild::vertex2i(l + lastColorRange.swatch->getPosition().x, t);
PrimBuild::vertex2i(l + lastColorRange.swatch->getPosition().x, b);
PrimBuild::color( colorRange.last().swatch->getColor() );
PrimBuild::color(lastColorRange.swatch->getColor());
PrimBuild::vertex2i( r, b );
PrimBuild::vertex2i( r, t );
@ -521,7 +526,7 @@ void GuiGradientCtrl::reInitSwatches( GuiGradientCtrl::PickMode )
}
}
void GuiGradientCtrl::addColorRange( Point2I pos, ColorF color )
void GuiGradientCtrl::addColorRange(Point2I pos, const ColorF& color)
{
if( pos.x + mSwatchFactor < mBlendRangeBox.point.x &&
pos.x + mSwatchFactor > mBlendRangeBox.extent.x )

View file

@ -148,7 +148,7 @@ public:
void inspectPreApply();
void inspectPostApply();
void reInitSwatches( GuiGradientCtrl::PickMode );
void addColorRange( Point2I pos, ColorF color );
void addColorRange(Point2I pos, const ColorF& color);
void removeColorRange( GuiGradientSwatchCtrl* swatch );
void sortColorRange();

View file

@ -677,7 +677,7 @@ DefineEngineMethod( GuiListBoxCtrl, setItemColor, void, (S32 index, ColorF color
object->setItemColor( index, color );
}
void GuiListBoxCtrl::setItemColor( S32 index, ColorF color )
void GuiListBoxCtrl::setItemColor(S32 index, const ColorF& color)
{
if ((index >= mItems.size()) || index < 0)
{
@ -748,11 +748,6 @@ S32 GuiListBoxCtrl::insertItem( S32 index, StringTableEntry text, void *itemData
}
LBItem *newItem = new LBItem;
if( !newItem )
{
Con::warnf("GuiListBoxCtrl::insertItem - error allocating item memory!" );
return -1;
}
// Assign item data
newItem->itemText = StringTable->insert(text, true);
@ -792,11 +787,6 @@ S32 GuiListBoxCtrl::insertItemWithColor( S32 index, StringTableEntry text, Color
}
LBItem *newItem = new LBItem;
if( !newItem )
{
Con::warnf("GuiListBoxCtrl::insertItem - error allocating item memory!" );
return -1;
}
// Assign item data
newItem->itemText = StringTable->insert(text, true);
@ -1090,7 +1080,7 @@ void GuiListBoxCtrl::onRender( Point2I offset, const RectI &updateRect )
GFX->setClipRect( oldClipRect );
}
void GuiListBoxCtrl::onRenderItem( RectI itemRect, LBItem *item )
void GuiListBoxCtrl::onRenderItem(const RectI& itemRect, LBItem *item)
{
if( item->isSelected )
GFX->getDrawUtil()->drawRectFill( itemRect, mProfile->mFillColorSEL );

View file

@ -107,7 +107,7 @@ public:
S32 insertItemWithColor( S32 index, StringTableEntry text, ColorF color = ColorF(-1, -1, -1), void *itemData = NULL);
S32 findItemText( StringTableEntry text, bool caseSensitive = false );
void setItemColor(S32 index, ColorF color);
void setItemColor(S32 index, const ColorF& color);
void clearItemColor(S32 index);
void deleteItem( S32 index );
@ -128,7 +128,7 @@ public:
// Rendering
virtual void onRender( Point2I offset, const RectI &updateRect );
virtual void onRenderItem( RectI itemRect, LBItem *item );
virtual void onRenderItem(const RectI& itemRect, LBItem *item);
void drawBox( const Point2I &box, S32 size, ColorI &outlineColor, ColorI &boxColor );
bool renderTooltip( const Point2I &hoverPos, const Point2I& cursorPos, const char* tipText );
void addFilteredItem( String item );

View file

@ -168,7 +168,7 @@ DefineEngineMethod( GuiMLTextCtrl, scrollToTag, void, (S32 tagID),,
object->scrollToTag( tagID );
}
DefineEngineMethod( GuiMLTextCtrl, scrollToTop, void, ( S32 param1, S32 param2),,
DefineEngineMethod( GuiMLTextCtrl, scrollToTop, void, (),,
"@brief Scroll to the top of the text.\n\n"
"@tsexample\n"
"// Inform GuiMLTextCtrl object to scroll to its top\n"
@ -631,7 +631,7 @@ bool GuiMLTextCtrl::setCursorPosition(const S32 newPosition)
mCursorPosition = 0;
return true;
}
else if (newPosition >= mTextBuffer.length())
else if (newPosition >= mTextBuffer.length() - 1)
{
mCursorPosition = mTextBuffer.length();
return true;
@ -669,11 +669,11 @@ void GuiMLTextCtrl::getCursorPositionAndColor(Point2I &cursorTop, Point2I &curso
{
S32 x = 0;
S32 y = 0;
S32 height = mProfile->mFont->getHeight();
S32 height = (mProfile && mProfile->mFont) ? mProfile->mFont->getHeight() : 0;
color = mProfile->mCursorColor;
for(Line *walk = mLineList; walk; walk = walk->next)
{
if ((mCursorPosition <= walk->textStart + walk->len) || (walk->next == NULL))
if ((mCursorPosition < walk->textStart + walk->len) || (walk->next == NULL))
{
// it's in the atoms on this line...
y = walk->y;
@ -768,7 +768,7 @@ void GuiMLTextCtrl::onMouseDown(const GuiEvent& event)
mSelectionAnchorDropped = event.mousePoint;
if (mSelectionAnchor < 0)
mSelectionAnchor = 0;
else if (mSelectionAnchor >= mTextBuffer.length())
else if (mSelectionAnchor >= mTextBuffer.length() - 1)
mSelectionAnchor = mTextBuffer.length();
mVertMoveAnchorValid = false;

View file

@ -852,6 +852,8 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
if ( mScrollDir != GuiScrollCtrl::None )
autoScroll();
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
RectI r( offset, getExtent() );
if ( mInAction )
{
@ -868,30 +870,30 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
else
{
//renderSlightlyLoweredBox(r, mProfile);
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColor );
drawUtil->drawRectFill( r, mProfile->mFillColor );
}
// Draw a bitmap over the background?
if ( mTextureDepressed )
{
RectI rect(offset, mBitmapBounds);
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretch( mTextureDepressed, rect );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch( mTextureDepressed, rect );
}
else if ( mTextureNormal )
{
RectI rect(offset, mBitmapBounds);
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch( mTextureNormal, rect );
}
// Do we render a bitmap border or lines?
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
{
GFX->getDrawUtil()->drawLine( l, t, l, b, colorWhite );
GFX->getDrawUtil()->drawLine( l, t, r2, t, colorWhite );
GFX->getDrawUtil()->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
GFX->getDrawUtil()->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
drawUtil->drawLine( l, t, l, b, colorWhite );
drawUtil->drawLine( l, t, r2, t, colorWhite );
drawUtil->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
drawUtil->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
}
}
@ -912,24 +914,24 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
}
else
{
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColorHL );
drawUtil->drawRectFill( r, mProfile->mFillColorHL );
}
// Draw a bitmap over the background?
if ( mTextureNormal )
{
RectI rect( offset, mBitmapBounds );
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch( mTextureNormal, rect );
}
// Do we render a bitmap border or lines?
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
{
GFX->getDrawUtil()->drawLine( l, t, l, b, colorWhite );
GFX->getDrawUtil()->drawLine( l, t, r2, t, colorWhite );
GFX->getDrawUtil()->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
GFX->getDrawUtil()->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
drawUtil->drawLine( l, t, l, b, colorWhite );
drawUtil->drawLine( l, t, r2, t, colorWhite );
drawUtil->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
drawUtil->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
}
}
else
@ -942,21 +944,21 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
}
else
{
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColorNA );
drawUtil->drawRectFill( r, mProfile->mFillColorNA );
}
// Draw a bitmap over the background?
if ( mTextureNormal )
{
RectI rect(offset, mBitmapBounds);
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch( mTextureNormal, rect );
}
// Do we render a bitmap border or lines?
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
{
GFX->getDrawUtil()->drawRect( r, mProfile->mBorderColorNA );
drawUtil->drawRect( r, mProfile->mBorderColorNA );
}
}
// renderSlightlyRaisedBox(r, mProfile); // Used to be the only 'else' condition to mInAction above.
@ -1027,8 +1029,8 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
{
Point2I coloredboxsize( 15, 10 );
RectI r( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y );
GFX->getDrawUtil()->drawRectFill( r, boxColor);
GFX->getDrawUtil()->drawRect( r, ColorI(0,0,0));
drawUtil->drawRectFill( r, boxColor);
drawUtil->drawRect( r, ColorI(0,0,0));
localStart.x += coloredboxsize.x + mProfile->mTextOffset.x;
}
@ -1036,7 +1038,7 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
// Draw the text
Point2I globalStart = localToGlobalCoord( localStart );
ColorI fontColor = mActive ? ( mInAction ? mProfile->mFontColor : mProfile->mFontColorNA ) : mProfile->mFontColorNA;
GFX->getDrawUtil()->setBitmapModulation( fontColor ); // was: (mProfile->mFontColor);
drawUtil->setBitmapModulation( fontColor ); // was: (mProfile->mFontColor);
// Get the number of columns in the text
S32 colcount = getColumnCount( mText, "\t" );
@ -1048,7 +1050,7 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
// Draw the first column
getColumn( mText, buff, 0, "\t" );
GFX->getDrawUtil()->drawText( mProfile->mFont, globalStart, buff, mProfile->mFontColors );
drawUtil->drawText( mProfile->mFont, globalStart, buff, mProfile->mFontColors );
// Draw the second column to the right
getColumn( mText, buff, 1, "\t" );
@ -1059,17 +1061,17 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect )
// right cap of the border.
RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - bitmapBounds[2].extent.x, localStart.y ) );
GFX->getDrawUtil()->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
} else
{
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - 12, localStart.y ) );
GFX->getDrawUtil()->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
}
} else
{
GFX->getDrawUtil()->drawText( mProfile->mFont, globalStart, mText, mProfile->mFontColors );
drawUtil->drawText( mProfile->mFont, globalStart, mText, mProfile->mFontColors );
}
// If we're rendering a bitmap border, then it will take care of the arrow.

View file

@ -1034,6 +1034,8 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
if ( mScrollDir != GuiScrollCtrl::None )
autoScroll();
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
RectI r( offset, getExtent() );
if ( mInAction )
{
@ -1050,30 +1052,30 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
else
{
//renderSlightlyLoweredBox(r, mProfile);
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColor );
drawUtil->drawRectFill( r, mProfile->mFillColor );
}
// Draw a bitmap over the background?
if ( mTextureDepressed )
{
RectI rect(offset, mBitmapBounds);
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretch( mTextureDepressed, rect );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch( mTextureDepressed, rect );
}
else if ( mTextureNormal )
{
RectI rect(offset, mBitmapBounds);
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch( mTextureNormal, rect );
}
// Do we render a bitmap border or lines?
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
{
GFX->getDrawUtil()->drawLine( l, t, l, b, colorWhite );
GFX->getDrawUtil()->drawLine( l, t, r2, t, colorWhite );
GFX->getDrawUtil()->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
GFX->getDrawUtil()->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
drawUtil->drawLine( l, t, l, b, colorWhite );
drawUtil->drawLine( l, t, r2, t, colorWhite );
drawUtil->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
drawUtil->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
}
}
@ -1094,24 +1096,24 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
}
else
{
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColorHL );
drawUtil->drawRectFill( r, mProfile->mFillColorHL );
}
// Draw a bitmap over the background?
if ( mTextureNormal )
{
RectI rect( offset, mBitmapBounds );
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch( mTextureNormal, rect );
}
// Do we render a bitmap border or lines?
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
{
GFX->getDrawUtil()->drawLine( l, t, l, b, colorWhite );
GFX->getDrawUtil()->drawLine( l, t, r2, t, colorWhite );
GFX->getDrawUtil()->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
GFX->getDrawUtil()->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
drawUtil->drawLine( l, t, l, b, colorWhite );
drawUtil->drawLine( l, t, r2, t, colorWhite );
drawUtil->drawLine( l + 1, b, r2, b, mProfile->mBorderColor );
drawUtil->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor );
}
}
else
@ -1124,21 +1126,21 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
}
else
{
GFX->getDrawUtil()->drawRectFill( r, mProfile->mFillColorNA );
drawUtil->drawRectFill( r, mProfile->mFillColorNA );
}
// Draw a bitmap over the background?
if ( mTextureNormal )
{
RectI rect(offset, mBitmapBounds);
GFX->getDrawUtil()->clearBitmapModulation();
GFX->getDrawUtil()->drawBitmapStretch( mTextureNormal, rect );
drawUtil->clearBitmapModulation();
drawUtil->drawBitmapStretch( mTextureNormal, rect );
}
// Do we render a bitmap border or lines?
if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) )
{
GFX->getDrawUtil()->drawRect( r, mProfile->mBorderColorNA );
drawUtil->drawRect( r, mProfile->mBorderColorNA );
}
}
// renderSlightlyRaisedBox(r, mProfile); // Used to be the only 'else' condition to mInAction above.
@ -1209,8 +1211,8 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
{
Point2I coloredboxsize( 15, 10 );
RectI r( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y );
GFX->getDrawUtil()->drawRectFill( r, boxColor);
GFX->getDrawUtil()->drawRect( r, ColorI(0,0,0));
drawUtil->drawRectFill( r, boxColor);
drawUtil->drawRect( r, ColorI(0,0,0));
localStart.x += coloredboxsize.x + mProfile->mTextOffset.x;
}
@ -1218,7 +1220,7 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
// Draw the text
Point2I globalStart = localToGlobalCoord( localStart );
ColorI fontColor = mActive ? ( mInAction ? mProfile->mFontColor : mProfile->mFontColorNA ) : mProfile->mFontColorNA;
GFX->getDrawUtil()->setBitmapModulation( fontColor ); // was: (mProfile->mFontColor);
drawUtil->setBitmapModulation( fontColor ); // was: (mProfile->mFontColor);
// Get the number of columns in the text
S32 colcount = getColumnCount( mText, "\t" );
@ -1230,7 +1232,7 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
// Draw the first column
getColumn( mText, buff, 0, "\t" );
GFX->getDrawUtil()->drawText( mProfile->mFont, globalStart, buff, mProfile->mFontColors );
drawUtil->drawText( mProfile->mFont, globalStart, buff, mProfile->mFontColors );
// Draw the second column to the right
getColumn( mText, buff, 1, "\t" );
@ -1241,17 +1243,17 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect)
// right cap of the border.
RectI* bitmapBounds = mProfile->mBitmapArrayRects.address();
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - bitmapBounds[2].extent.x, localStart.y ) );
GFX->getDrawUtil()->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
} else
{
Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - 12, localStart.y ) );
GFX->getDrawUtil()->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors );
}
} else
{
GFX->getDrawUtil()->drawText( mProfile->mFont, globalStart, mText, mProfile->mFontColors );
drawUtil->drawText( mProfile->mFont, globalStart, mText, mProfile->mFontColors );
}
// If we're rendering a bitmap border, then it will take care of the arrow.

View file

@ -363,6 +363,8 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
Point2I ext(getWidth() - mShiftExtent, getHeight());
RectI thumb = mThumb;
GFXDrawUtil* drawUtil = GFX->getDrawUtil();
if( mHasTexture )
{
if(mTicks > 0)
@ -402,12 +404,12 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
S32 index = SliderButtonNormal;
if(mMouseOver)
index = SliderButtonHighlight;
GFX->getDrawUtil()->clearBitmapModulation();
drawUtil->clearBitmapModulation();
//left border
GFX->getDrawUtil()->drawBitmapSR(mProfile->mTextureObject, Point2I(offset.x,offset.y), mBitmapBounds[SliderLineLeft]);
drawUtil->drawBitmapSR(mProfile->mTextureObject, Point2I(offset.x,offset.y), mBitmapBounds[SliderLineLeft]);
//right border
GFX->getDrawUtil()->drawBitmapSR(mProfile->mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[SliderLineRight].extent.x, offset.y), mBitmapBounds[SliderLineRight]);
drawUtil->drawBitmapSR(mProfile->mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[SliderLineRight].extent.x, offset.y), mBitmapBounds[SliderLineRight]);
//draw our center piece to our slider control's border and stretch it
@ -421,11 +423,11 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
stretchRect = mBitmapBounds[SliderLineCenter];
stretchRect.inset(1,0);
GFX->getDrawUtil()->drawBitmapStretchSR(mProfile->mTextureObject, destRect, stretchRect);
drawUtil->drawBitmapStretchSR(mProfile->mTextureObject, destRect, stretchRect);
//draw our control slider button
thumb.point += pos;
GFX->getDrawUtil()->drawBitmapSR(mProfile->mTextureObject,Point2I(thumb.point.x,offset.y ),mBitmapBounds[index]);
drawUtil->drawBitmapSR(mProfile->mTextureObject,Point2I(thumb.point.x,offset.y ),mBitmapBounds[index]);
}
else if (getWidth() >= getHeight())
@ -490,8 +492,8 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
else if(textStart.x + txt_w > offset.x+getWidth())
textStart.x -=((textStart.x + txt_w) - (offset.x+getWidth()));
GFX->getDrawUtil()->setBitmapModulation(mProfile->mFontColor);
GFX->getDrawUtil()->drawText(mProfile->mFont, textStart, buf, mProfile->mFontColors);
drawUtil->setBitmapModulation(mProfile->mFontColor);
drawUtil->drawText(mProfile->mFont, textStart, buf, mProfile->mFontColors);
}
renderChildControls(offset, updateRect);
}

View file

@ -215,7 +215,7 @@ void GuiTextEditCtrl::execConsoleCallback()
// Update the console variable:
if ( mConsoleVariable[0] )
Con::setVariable( mConsoleVariable, mTextBuffer.getPtr8() );
Con::setVariable(mConsoleVariable, mTextBuffer.getPtr8());
}
void GuiTextEditCtrl::updateHistory( StringBuffer *inTxt, bool moveIndex )
@ -376,6 +376,8 @@ S32 GuiTextEditCtrl::calculateCursorPos( const Point2I &globalPos )
void GuiTextEditCtrl::onMouseDown( const GuiEvent &event )
{
if(!isActive())
return;
mDragHit = false;
// If we have a double click, select all text. Otherwise

View file

@ -4641,6 +4641,8 @@ S32 GuiTreeViewCtrl::findItemByValue(const char *name)
{
for (S32 i = 0; i < mItems.size(); i++)
{
if (!mItems[i])
continue;
if( mItems[i]->mState.test( Item::InspectorData ) )
continue;
if (mItems[i] && dStrcmp(mItems[i]->getValue(),name) == 0)