diff --git a/changes.txt b/changes.txt index a897fa90..f9e9b63c 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,10 @@ Changes in 1.6 - - Fixed a bug in the edit box where events are sometimes sent to a null parent, reported by Sudi + + - EGDS_MESSAGE_BOX_HEIGHT is now honoured, bug reported by Spkka + + - Fixed a bug in the edit box where events are sometimes sent to a null parent, reported by Sudi. + + - Coordinate system fix for OpenGL in SDL device - Added generic console device. You can now use Irrlicht to create and manipuate graphics on a shell where no graphics hardware or windowing system is available. To enable it uncomment #define _IRR_USE_CONSOLE_DEVICE_ in IrrCompileConfig.h diff --git a/source/Irrlicht/CGUIMessageBox.cpp b/source/Irrlicht/CGUIMessageBox.cpp index 57e524a0..4f76a26a 100644 --- a/source/Irrlicht/CGUIMessageBox.cpp +++ b/source/Irrlicht/CGUIMessageBox.cpp @@ -72,15 +72,15 @@ void CGUIMessageBox::refreshControls() const IGUISkin* skin = Environment->getSkin(); IGUIElement* focusMe = 0; - const s32 buttonHeight = skin->getSize(EGDS_BUTTON_HEIGHT); - const s32 buttonWidth = skin->getSize(EGDS_BUTTON_WIDTH); - const s32 titleHeight = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH)+2; + const s32 buttonHeight = skin->getSize(EGDS_BUTTON_HEIGHT); + const s32 buttonWidth = skin->getSize(EGDS_BUTTON_WIDTH); + const s32 titleHeight = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH)+2; const s32 buttonDistance = skin->getSize(EGDS_WINDOW_BUTTON_WIDTH); // add static multiline text core::dimension2d dim(AbsoluteClippingRect.getWidth() - buttonWidth, - AbsoluteClippingRect.getHeight() - (buttonHeight * 3)); + AbsoluteClippingRect.getHeight() - (buttonHeight * 2)); const core::position2d pos((AbsoluteClippingRect.getWidth() - dim.Width) / 2, buttonHeight / 2 + titleHeight); @@ -100,20 +100,21 @@ void CGUIMessageBox::refreshControls() // adjust static text height - const s32 textHeight = StaticText->getTextHeight(); - core::rect tmp = StaticText->getRelativePosition(); + const s32 textHeight = StaticText->getTextHeight(); + core::rect tmp = StaticText->getRelativePosition(); tmp.LowerRightCorner.Y = tmp.UpperLeftCorner.Y + textHeight; StaticText->setRelativePosition(tmp); - dim.Height = textHeight; + dim.Height = dim.Height - buttonHeight < tmp.getHeight() ? tmp.getHeight() : dim.Height - buttonHeight; - // adjust message box height + // adjust message box height if required tmp = getRelativePosition(); s32 msgBoxHeight = textHeight + core::floor32(2.5f * buttonHeight) + titleHeight; + msgBoxHeight = tmp.getHeight() < msgBoxHeight ? msgBoxHeight : tmp.getHeight(); // adjust message box position - tmp.UpperLeftCorner.Y = (Parent->getAbsolutePosition().getHeight() - msgBoxHeight) / 2; + tmp.UpperLeftCorner.Y = (Parent->getAbsolutePosition().getHeight() - msgBoxHeight) / 2; tmp.LowerRightCorner.Y = tmp.UpperLeftCorner.Y + msgBoxHeight; setRelativePosition(tmp); @@ -130,10 +131,11 @@ void CGUIMessageBox::refreshControls() ++countButtons; core::rect btnRect; - btnRect.UpperLeftCorner.Y = pos.Y + dim.Height + buttonHeight / 2; + btnRect.UpperLeftCorner.Y = pos.Y + dim.Height + buttonHeight / 2; btnRect.LowerRightCorner.Y = btnRect.UpperLeftCorner.Y + buttonHeight; - btnRect.UpperLeftCorner.X = (AbsoluteClippingRect.getWidth() - - ((buttonWidth + buttonDistance)*countButtons)) / 2; + btnRect.UpperLeftCorner.X = (AbsoluteClippingRect.getWidth() - + (buttonWidth*countButtons + (buttonDistance*countButtons+1))) / 2 + + buttonDistance / 2; btnRect.LowerRightCorner.X = btnRect.UpperLeftCorner.X + buttonWidth; // add/remove ok button @@ -151,7 +153,7 @@ void CGUIMessageBox::refreshControls() OkButton->setText(skin->getDefaultText(EGDT_MSG_BOX_OK)); btnRect.LowerRightCorner.X += buttonWidth + buttonDistance; - btnRect.UpperLeftCorner.X += buttonWidth + buttonDistance; + btnRect.UpperLeftCorner.X += buttonWidth + buttonDistance; focusMe = OkButton; }