Ongoing wipwork of the BaseUI update. Some bugfixes pending

This commit is contained in:
Areloch 2023-12-16 23:18:33 -06:00
parent 616d974212
commit ce4c8dabc9
53 changed files with 2033 additions and 3892 deletions

View file

@ -83,6 +83,8 @@ IMPLEMENT_CALLBACK( GuiButtonBaseCtrl, onMouseDragged, void, (), (),
"pressed the left mouse button on the control and then moves the mouse over a certain distance threshold with "
"the mouse button still pressed." );
IMPLEMENT_CALLBACK(GuiButtonBaseCtrl, onHighlighted, void, (bool highlighted), (highlighted),
"Called when the status of the button being highlighted changes.");
ImplementEnumType( GuiButtonType,
"Type of button control.\n\n"
@ -290,6 +292,7 @@ void GuiButtonBaseCtrl::onMouseEnter(const GuiEvent &event)
{
mDepressed = true;
mHighlighted = true;
onHighlighted_callback(true);
}
else
{
@ -297,6 +300,7 @@ void GuiButtonBaseCtrl::onMouseEnter(const GuiEvent &event)
SFX->playOnce(mProfile->getSoundButtonOverProfile());
mHighlighted = true;
onHighlighted_callback(true);
}
}
@ -311,6 +315,7 @@ void GuiButtonBaseCtrl::onMouseLeave(const GuiEvent &)
if( isMouseLocked() )
mDepressed = false;
mHighlighted = false;
onHighlighted_callback(false);
}
//-----------------------------------------------------------------------------

View file

@ -73,6 +73,7 @@ class GuiButtonBaseCtrl : public GuiControl
DECLARE_CALLBACK( void, onMouseEnter, () );
DECLARE_CALLBACK( void, onMouseLeave, () );
DECLARE_CALLBACK( void, onMouseDragged, () );
DECLARE_CALLBACK( void, onHighlighted, (bool));
/// @}
@ -95,9 +96,18 @@ class GuiButtonBaseCtrl : public GuiControl
bool getStateOn() const { return mStateOn; }
void setDepressed( bool depressed ) { mDepressed = depressed; }
void resetState() {mDepressed = false; mHighlighted = false;}
void resetState()
{
mDepressed = false;
mHighlighted = false;
onHighlighted_callback(false);
}
void setHighlighted(bool highlighted) { mHighlighted = highlighted; }
void setHighlighted(bool highlighted)
{
mHighlighted = highlighted;
onHighlighted_callback(highlighted);
}
bool isHighlighted() { return mHighlighted; }
void acceleratorKeyPress(U32 index);

View file

@ -253,7 +253,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
if (mProfile->mBorder != 0)
renderFilledBorder(boundsRect, borderColor, fillColor, mProfile->mBorderThickness);
else
GFX->getDrawUtil()->drawRectFill(boundsRect, mProfile->mFillColor);
GFX->getDrawUtil()->drawRectFill(boundsRect, fillColor);
}
}
else if(mHighlighted && mActive)
@ -269,7 +269,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
if (mProfile->mBorder != 0)
renderFilledBorder(boundsRect, borderColor, fillColor, mProfile->mBorderThickness);
else
GFX->getDrawUtil()->drawRectFill(boundsRect, mProfile->mFillColor);
GFX->getDrawUtil()->drawRectFill(boundsRect, fillColor);
}
}
else
@ -388,6 +388,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
start.x = iconRect.extent.x + mButtonMargin.x + mTextMargin;
}
drawer->setBitmapModulation(fontColor);
drawer->drawText( mProfile->mFont, start + offset, text, mProfile->mFontColors );
}
@ -395,6 +396,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
{
Point2I start( mTextMargin, ( getHeight() - mProfile->mFont->getHeight() ) / 2 );
drawer->setBitmapModulation(fontColor);
drawer->drawText( mProfile->mFont, start + offset, text, mProfile->mFontColors );
}
@ -408,6 +410,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
}
else
start.set( ( getWidth() - textWidth ) / 2, ( getHeight() - mProfile->mFont->getHeight() ) / 2 );
drawer->setBitmapModulation( fontColor );
drawer->drawText( mProfile->mFont, start + offset, text, mProfile->mFontColors );
}

View file

@ -218,7 +218,8 @@ GuiControl::GuiControl() : mAddGroup( NULL ),
mLangTable(NULL),
mFirstResponder(NULL),
mHorizSizing(horizResizeRight),
mVertSizing(vertResizeBottom)
mVertSizing(vertResizeBottom),
mCategory(StringTable->EmptyString())
{
mConsoleVariable = StringTable->EmptyString();
mAcceleratorKey = StringTable->EmptyString();
@ -294,6 +295,10 @@ void GuiControl::initPersistFields()
addField("accelerator", TypeString, Offset(mAcceleratorKey, GuiControl),
"Key combination that triggers the control's primary action when the control is on the canvas." );
addField("category", TypeString, Offset(mCategory, GuiControl),
"Name of the category this gui control should be grouped into for organizational purposes. Primarily for tooling.");
endGroup( "Control" );
addGroup( "ToolTip" );

View file

@ -218,6 +218,8 @@ class GuiControl : public SimGroup
String mAltConsoleCommand;
String mTooltip;
StringTableEntry mCategory;
/// @}

View file

@ -729,7 +729,8 @@ bool ActionMap::nextBoundNode( const char* function, U32 &devMapIndex, U32 &node
for ( U32 j = nodeIndex; j < dvcMap->nodeMap.size(); j++ )
{
const Node* node = &dvcMap->nodeMap[j];
if ( !( node->flags & Node::BindCmd ) && ( dStricmp( function, node->consoleFunction ) == 0 ) )
if ( ( (node->flags & Node::BindCmd) && (dStricmp(function, node->makeConsoleCommand) == 0 || dStricmp(function, node->breakConsoleCommand) == 0) )
|| (!(node->flags & Node::BindCmd) && dStricmp( function, node->consoleFunction ) == 0 ) )
{
devMapIndex = i;
nodeIndex = j;
@ -1805,6 +1806,7 @@ bool ActionMap::handleEvent(const InputEventInfo* pEvent)
for (SimSet::iterator itr = pActionMapSet->end() - 1;
itr > pActionMapSet->begin(); itr--) {
ActionMap* pMap = static_cast<ActionMap*>(*itr);
if (pMap->processAction(pEvent) == true)
return true;
}