Merge pull request #1481 from Areloch/MiscFixes_20250525

Misc Fixes and improvements including updated autosave handling
This commit is contained in:
Brian Roberts 2025-05-27 08:03:08 -05:00 committed by GitHub
commit a43458677a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 978 additions and 237 deletions

View file

@ -382,7 +382,7 @@ void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
Point2I start( mTextMargin, ( getHeight() - mProfile->mFont->getHeight() ) / 2 );
if (mBitmapAsset.notNull() && mIconLocation != IconLocNone)
{
start.x = iconRect.extent.x + mButtonMargin.x + mTextMargin;
start.x = getWidth() - (iconRect.extent.x + mButtonMargin.x + textWidth);
}
drawer->setBitmapModulation(fontColor);

View file

@ -2855,6 +2855,23 @@ DefineEngineMethod( GuiControl, getGlobalCenter, Point2I, (),,
//-----------------------------------------------------------------------------
DefineEngineMethod(GuiControl, setGlobalCenter, void, (S32 x, S32 y), ,
"Set the coordinate of the control's center point in coordinates relative to the root control in its control hierarchy.\n"
"@param x The X coordinate of the new center point of the control relative to the root control's.\n"
"@param y The Y coordinate of the new center point of the control relative to the root control's.")
{
//see if we can turn the x/y into ints directly,
Point2I lPosOffset = object->globalToLocalCoord(Point2I(x, y));
lPosOffset += object->getPosition();
const Point2I ext = object->getExtent();
Point2I newpos(lPosOffset.x - ext.x / 2, lPosOffset.y - ext.y / 2);
object->setPosition(newpos);
}
//-----------------------------------------------------------------------------
DefineEngineMethod( GuiControl, getGlobalPosition, Point2I, (),,
"Get the position of the control relative to the root of the GuiControl hierarchy it is contained in.\n"
"@return The control's current position in root-relative coordinates." )

View file

@ -133,6 +133,25 @@ void GuiInputCtrl::onSleep()
clearFirstResponder();
}
void GuiInputCtrl::setActive(bool value)
{
Parent::setActive(value);
if (value)
{
if (!smDesignTime && !mIgnoreMouseEvents)
mouseLock();
setFirstResponder();
}
else
{
mouseUnlock();
clearFirstResponder();
}
}
//------------------------------------------------------------------------------
static bool isModifierKey( U16 keyCode )

View file

@ -51,6 +51,8 @@ public:
bool onWake() override;
void onSleep() override;
virtual void setActive(bool state);
bool onInputEvent( const InputEventInfo &event ) override;
static void initPersistFields();

View file

@ -1409,3 +1409,13 @@ DefineEngineMethod( EditTSCtrl, isMiddleMouseDown, bool, (),, "" )
{
return object->isMiddleMouseDown();
}
DefineEngineMethod(EditTSCtrl, isLeftMouseDown, bool, (), , "")
{
return object->isLeftMouseDown();
}
DefineEngineMethod(EditTSCtrl, isRightMouseDown, bool, (), , "")
{
return object->isRightMouseDown();
}

View file

@ -189,7 +189,9 @@ class EditTSCtrl : public GuiTSCtrl
virtual void on3DMouseWheelDown(const Gui3DMouseEvent &){};
virtual void get3DCursor(GuiCursor *&cursor, bool &visible, const Gui3DMouseEvent &);
virtual bool isLeftMouseDown() { return mLeftMouseDown; }
virtual bool isMiddleMouseDown() {return mMiddleMouseDown;}
virtual bool isRightMouseDown() { return mLeftMouseDown; }
bool resize(const Point2I& newPosition, const Point2I& newExtent) override;