diff --git a/Engine/source/gui/buttons/guiIconButtonCtrl.cpp b/Engine/source/gui/buttons/guiIconButtonCtrl.cpp index f49c15748..8196d59b0 100644 --- a/Engine/source/gui/buttons/guiIconButtonCtrl.cpp +++ b/Engine/source/gui/buttons/guiIconButtonCtrl.cpp @@ -68,11 +68,12 @@ ConsoleDocClass( GuiIconButtonCtrl, " makeIconSquare = \"1\";\n" " textLocation = \"Bottom\";\n" " textMargin = \"-2\";\n" - " autoSize = \"0\";\n" - " text = \"Lag Icon\";\n" - " textID = \"\"STR_LAG\"\";\n" - " buttonType = \"PushButton\";\n" - " profile = \"GuiIconButtonProfile\";\n" + " bitmapMargin = \"0\";\n" + " autoSize = \"0\";\n" + " text = \"Lag Icon\";\n" + " textID = \"\"STR_LAG\"\";\n" + " buttonType = \"PushButton\";\n" + " profile = \"GuiIconButtonProfile\";\n" "};\n" "@endtsexample\n\n" @@ -96,6 +97,8 @@ GuiIconButtonCtrl::GuiIconButtonCtrl() mAutoSize = false; + mBitmapMargin = 0; + setExtent(140, 30); } @@ -134,6 +137,8 @@ void GuiIconButtonCtrl::initPersistFields() "Options are 0 (None), 1 (Bottom), 2 (Right), 3 (Top), 4 (Left), 5 (Center).\n"); addField( "textMargin", TypeS32, Offset( mTextMargin, GuiIconButtonCtrl ),"Margin between the icon and the text.\n"); addField( "autoSize", TypeBool, Offset( mAutoSize, GuiIconButtonCtrl ),"If true, the text and icon will be automatically sized to the size of the control.\n"); + addField( "bitmapMargin", TypeS32, Offset( mBitmapMargin, GuiIconButtonCtrl), "Margin between the icon and the border.\n"); + Parent::initPersistFields(); } @@ -299,10 +304,16 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect ) // Render the normal bitmap drawer->clearBitmapModulation(); + // Size of the bitmap + Point2I textureSize(mBitmap->getWidth(), mBitmap->getHeight()); + + // Reduce the size with the margin (if set) + textureSize.x = textureSize.x - (mBitmapMargin * 2); + textureSize.y = textureSize.y - (mBitmapMargin * 2); + // Maintain the bitmap size or fill the button? if ( !mFitBitmapToButton ) { - Point2I textureSize(mBitmap->getWidth(), mBitmap->getHeight() ); iconRect.set( offset + mButtonMargin, textureSize ); if ( mIconLocation == IconLocRight ) @@ -326,7 +337,11 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect ) } else { - iconRect.set( offset + mButtonMargin, getExtent() - (Point2I(mAbs(mButtonMargin.x), mAbs(mButtonMargin.y)) * 2) ); + // adding offset with the bitmap margin next to the button margin + Point2I bitMapOffset(mBitmapMargin, mBitmapMargin); + + // set the offset + iconRect.set( offset + mButtonMargin + bitMapOffset, getExtent() - (Point2I(mAbs(mButtonMargin.x - (mBitmapMargin * 2)), mAbs(mButtonMargin.y - (mBitmapMargin * 2))) * 2) ); if ( mMakeIconSquare ) { diff --git a/Engine/source/gui/buttons/guiIconButtonCtrl.h b/Engine/source/gui/buttons/guiIconButtonCtrl.h index 081201ad8..492602397 100644 --- a/Engine/source/gui/buttons/guiIconButtonCtrl.h +++ b/Engine/source/gui/buttons/guiIconButtonCtrl.h @@ -49,6 +49,9 @@ protected: S32 mTextLocation; S32 mTextMargin; Point2I mButtonMargin; + + /// Margin between the icon and the button border + S32 mBitmapMargin; /// Make the bitmap fill the button extent. bool mFitBitmapToButton; diff --git a/Engine/source/gui/containers/guiWindowCtrl.cpp b/Engine/source/gui/containers/guiWindowCtrl.cpp index 833407f73..2da707a60 100644 --- a/Engine/source/gui/containers/guiWindowCtrl.cpp +++ b/Engine/source/gui/containers/guiWindowCtrl.cpp @@ -68,6 +68,8 @@ IMPLEMENT_CALLBACK( GuiWindowCtrl, onRestore, void, (), (), "Called when the window is restored from minimized, maximized, or collapsed state." ); IMPLEMENT_CALLBACK(GuiWindowCtrl, onResize, void, (S32 posX, S32 posY, S32 width, S32 height), (0, 0, 0, 0), "Called when the window is resized in a regular manner by mouse manipulation."); +IMPLEMENT_CALLBACK(GuiWindowCtrl, onMouseDragged, void, (), (), + "Called when the height has changed."); //----------------------------------------------------------------------------- @@ -87,7 +89,8 @@ GuiWindowCtrl::GuiWindowCtrl() mCollapseGroup(-1), mCollapseGroupNum(-1), mIsCollapsed(false), - mIsMouseResizing(false) + mIsMouseResizing(false), + mButtonOffset(0, 3) { // mTitleHeight will change in instanciation most likely... mTitleHeight = 24; @@ -154,6 +157,8 @@ void GuiWindowCtrl::initPersistFields() "Script code to execute when the window is closed." ); addField( "edgeSnap", TypeBool, Offset( mEdgeSnap,GuiWindowCtrl ), "If true, the window will snap to the edges of other windows when moved close to them." ); + addField( "buttonOffset", TypePoint2I, Offset (mButtonOffset, GuiWindowCtrl), + "Margin between window edge and the button(s)."); endGroup( "Window" ); @@ -1019,6 +1024,9 @@ void GuiWindowCtrl::onMouseDragged(const GuiEvent &event) } else // Normal window sizing functionality resize(newPosition, newExtent); + + // Add a callback for the GUI scripts + onMouseDragged_callback(); } //----------------------------------------------------------------------------- @@ -1409,7 +1417,7 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect) } drawUtil->clearBitmapModulation(); - drawUtil->drawBitmapSR(mTextureObject, offset + mCloseButton.point, mBitmapBounds[bmp]); + drawUtil->drawBitmapSR(mTextureObject, mButtonOffset + offset + mCloseButton.point, mBitmapBounds[bmp]); } // Draw the maximize button @@ -1428,7 +1436,7 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect) } drawUtil->clearBitmapModulation(); - drawUtil->drawBitmapSR( mTextureObject, offset + mMaximizeButton.point, mBitmapBounds[bmp] ); + drawUtil->drawBitmapSR( mTextureObject, mButtonOffset + offset + mMaximizeButton.point, mBitmapBounds[bmp] ); } // Draw the minimize button @@ -1447,7 +1455,7 @@ void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect) } drawUtil->clearBitmapModulation(); - drawUtil->drawBitmapSR( mTextureObject, offset + mMinimizeButton.point, mBitmapBounds[bmp] ); + drawUtil->drawBitmapSR( mTextureObject, mButtonOffset + offset + mMinimizeButton.point, mBitmapBounds[bmp] ); } if( !mMinimized ) diff --git a/Engine/source/gui/containers/guiWindowCtrl.h b/Engine/source/gui/containers/guiWindowCtrl.h index d484973e6..294ff7a9e 100644 --- a/Engine/source/gui/containers/guiWindowCtrl.h +++ b/Engine/source/gui/containers/guiWindowCtrl.h @@ -124,6 +124,8 @@ class GuiWindowCtrl : public GuiContainer bool mCanDock; ///< Show a docking button on the title bar? bool mEdgeSnap; ///< Should this window snap to other windows edges? + + Point2I mButtonOffset; /// @} @@ -202,6 +204,7 @@ class GuiWindowCtrl : public GuiContainer DECLARE_CALLBACK( void, onCollapse, () ); DECLARE_CALLBACK( void, onRestore, () ); DECLARE_CALLBACK(void, onResize, (S32 posX, S32 posY, S32 width, S32 height)); + DECLARE_CALLBACK(void, onMouseDragged, ()); /// @} diff --git a/Engine/source/gui/controls/guiSliderCtrl.cpp b/Engine/source/gui/controls/guiSliderCtrl.cpp index 5fc81d5f3..c5f4a90b6 100644 --- a/Engine/source/gui/controls/guiSliderCtrl.cpp +++ b/Engine/source/gui/controls/guiSliderCtrl.cpp @@ -412,7 +412,7 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect) PrimBuild::end(); // TODO: it would be nice, if the primitive builder were a little smarter, // so that we could change colors midstream. - PrimBuild::color4f(0.9f, 0.9f, 0.9f, 1.0f); + PrimBuild::color4f(0.6f, 0.6f, 0.6f, 1.0f); PrimBuild::begin( GFXLineList, ( mTicks + 2 ) * 2 ); // tick marks for (U32 t = 0; t <= (mTicks+1); t++) diff --git a/Engine/source/gui/controls/guiTextEditSliderBitmapCtrl.cpp b/Engine/source/gui/controls/guiTextEditSliderBitmapCtrl.cpp index bdc8c77e9..1f8fd3e9c 100644 --- a/Engine/source/gui/controls/guiTextEditSliderBitmapCtrl.cpp +++ b/Engine/source/gui/controls/guiTextEditSliderBitmapCtrl.cpp @@ -415,7 +415,7 @@ void GuiTextEditSliderBitmapCtrl::onRender(Point2I offset, const RectI &updateRe // Draw the line that splits the number and bitmaps GFX->getDrawUtil()->drawLine(Point2I(offset.x + getWidth() - 14 -2, offset.y + 1 ), - Point2I(arrowUpStart.x -2, arrowUpStart.y + getExtent().y), + Point2I(arrowUpStart.x -2, arrowUpStart.y + getExtent().y + 2), mProfile->mBorderColor); GFX->getDrawUtil()->clearBitmapModulation(); diff --git a/Engine/source/gui/controls/guiTextEditSliderCtrl.cpp b/Engine/source/gui/controls/guiTextEditSliderCtrl.cpp index 3b4bd605b..a22327b8c 100644 --- a/Engine/source/gui/controls/guiTextEditSliderCtrl.cpp +++ b/Engine/source/gui/controls/guiTextEditSliderCtrl.cpp @@ -360,12 +360,12 @@ void GuiTextEditSliderCtrl::onRender(Point2I offset, const RectI &updateRect) GFXVertexBufferHandle verts(GFX, 6, GFXBufferTypeVolatile); verts.lock(); - verts[0].color.set( 0, 0, 0 ); - verts[1].color.set( 0, 0, 0 ); - verts[2].color.set( 0, 0, 0 ); - verts[3].color.set( 0, 0, 0 ); - verts[4].color.set( 0, 0, 0 ); - verts[5].color.set( 0, 0, 0 ); + verts[0].color.set(128, 128, 128); + verts[1].color.set(128, 128, 128); + verts[2].color.set(128, 128, 128); + verts[3].color.set(128, 128, 128); + verts[4].color.set(128, 128, 128); + verts[5].color.set(128, 128, 128); if(mTextAreaHit == ArrowUp) { diff --git a/Engine/source/gui/editor/guiEditCtrl.cpp b/Engine/source/gui/editor/guiEditCtrl.cpp index e95857c8c..94edf135b 100644 --- a/Engine/source/gui/editor/guiEditCtrl.cpp +++ b/Engine/source/gui/editor/guiEditCtrl.cpp @@ -2873,7 +2873,7 @@ class GuiEditorRuler : public GuiControl void onRender(Point2I offset, const RectI &updateRect) { - GFX->getDrawUtil()->drawRectFill(updateRect, ColorI::WHITE); + GFX->getDrawUtil()->drawRectFill(updateRect, ColorI::DARK); Point2I choffset(0,0); if( mRefCtrl != NULL ) @@ -2893,7 +2893,7 @@ class GuiEditorRuler : public GuiControl start = 4; if(!(pos % 100)) start = 1; - GFX->getDrawUtil()->drawLine(x, offset.y + start, x, offset.y + 10, ColorI::BLACK); + GFX->getDrawUtil()->drawLine(x, offset.y + start, x, offset.y + 10, ColorI::LIGHT); } } } @@ -2911,7 +2911,7 @@ class GuiEditorRuler : public GuiControl start = 4; if(!(pos % 100)) start = 1; - GFX->getDrawUtil()->drawLine(offset.x + start, y, offset.x + 10, y, ColorI::BLACK); + GFX->getDrawUtil()->drawLine(offset.x + start, y, offset.x + 10, y, ColorI::LIGHT); } } } diff --git a/Engine/source/gui/editor/guiMenuBar.cpp b/Engine/source/gui/editor/guiMenuBar.cpp index a8364c80d..2c7367cd1 100644 --- a/Engine/source/gui/editor/guiMenuBar.cpp +++ b/Engine/source/gui/editor/guiMenuBar.cpp @@ -1100,8 +1100,8 @@ GuiMenuBar::GuiMenuBar() mHorizontalMargin = 6; // Default number of pixels on the left and right side of a manu's text mVerticalMargin = 1; // Default number of pixels on the top and bottom of a menu's text mBitmapMargin = 2; // Default number of pixels between a menu's bitmap and text - - mMenubarHeight = 20; + + mMenubarHeight = 24; // Added: mouseDownSubmenu = NULL;