Commit 1e90e2d9 authored by cutealien's avatar cutealien

Merge revision 3848-3875 from 1.7 branch:

- EMIE_MOUSE_WHEEL messages now handled correctly in several gui-element when wheel isn't just 1.0 or -1.0
- Fix serialization for CBillboardSceneNode, it had missed 2 color
- Fix 'k' in bigfont.png
- Recalculate FrameRect and ScrollPos in CGUIEditBox when AbsoluteRect gets changed


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3876 dfc29bdd-3216-0410-991c-e03cc46cb475
parent e373bc4c
...@@ -286,7 +286,16 @@ The following names can be queried for the given types: ...@@ -286,7 +286,16 @@ The following names can be queried for the given types:
----------------------------- -----------------------------
Changes in 1.7.3 (??.??.2011) Changes in 1.7.3 (??.??.2011)
- Fix problems in Textwrapping in CGUIStaticText. Did use wrong size and did ignore last word of the text in wrapping (thx @ Reiko for bugreport)
- Recalculate FrameRect and ScrollPos in CGUIEditBox when AbsoluteRect gets changed (thx @ serengeor for report + testcase)
- Fix 'k' in bigfont.png (thx @ Scrappi for reporting)
- fix serialization for CBillboardSceneNode, it had missed 2 color (thx for finding + patch from pc0de)
- EMIE_MOUSE_WHEEL messages now handled correctly in several gui-element when wheel isn't just 1.0 or -1.0 (thx @ Reiko for reporting)
- Fix problems in Textwrapping in CGUIStaticText. Did use wrong size and did ignore last word of the text (thx @ Reiko for bugreport)
- Fix crash in collada (.dae) loading - Fix crash in collada (.dae) loading
......
...@@ -284,7 +284,7 @@ struct SEvent ...@@ -284,7 +284,7 @@ struct SEvent
//! Y position of mouse cursor //! Y position of mouse cursor
s32 Y; s32 Y;
//! mouse wheel delta, usually 1.0 or -1.0. //! mouse wheel delta, often 1.0 or -1.0, but can have other values < 0.f or > 0.f;
/** Only valid if event was EMIE_MOUSE_WHEEL */ /** Only valid if event was EMIE_MOUSE_WHEEL */
f32 Wheel; f32 Wheel;
......
media/bigfont.png

20.7 KB | W: | H:

media/bigfont.png

20.8 KB | W: | H:

media/bigfont.png
media/bigfont.png
media/bigfont.png
media/bigfont.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -181,6 +181,8 @@ void CBillboardSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttrib ...@@ -181,6 +181,8 @@ void CBillboardSceneNode::deserializeAttributes(io::IAttributes* in, io::SAttrib
Size.Height = in->getAttributeAsFloat("Height"); Size.Height = in->getAttributeAsFloat("Height");
vertices[1].Color = in->getAttributeAsColor ( "Shade_Top" ); vertices[1].Color = in->getAttributeAsColor ( "Shade_Top" );
vertices[0].Color = in->getAttributeAsColor ( "Shade_Down" ); vertices[0].Color = in->getAttributeAsColor ( "Shade_Down" );
vertices[2].Color = vertices[1].Color;
vertices[3].Color = vertices[0].Color;
setSize(Size); setSize(Size);
} }
......
...@@ -55,17 +55,7 @@ CGUIEditBox::CGUIEditBox(const wchar_t* text, bool border, ...@@ -55,17 +55,7 @@ CGUIEditBox::CGUIEditBox(const wchar_t* text, bool border,
setTabStop(true); setTabStop(true);
setTabOrder(-1); setTabOrder(-1);
IGUISkin *skin = 0; calculateFrameRect();
if (Environment)
skin = Environment->getSkin();
if (Border && skin)
{
FrameRect.UpperLeftCorner.X += skin->getSize(EGDS_TEXT_DISTANCE_X)+1;
FrameRect.UpperLeftCorner.Y += skin->getSize(EGDS_TEXT_DISTANCE_Y)+1;
FrameRect.LowerRightCorner.X -= skin->getSize(EGDS_TEXT_DISTANCE_X)+1;
FrameRect.LowerRightCorner.Y -= skin->getSize(EGDS_TEXT_DISTANCE_Y)+1;
}
breakText(); breakText();
calculateScrollPos(); calculateScrollPos();
...@@ -169,7 +159,9 @@ void CGUIEditBox::updateAbsolutePosition() ...@@ -169,7 +159,9 @@ void CGUIEditBox::updateAbsolutePosition()
IGUIElement::updateAbsolutePosition(); IGUIElement::updateAbsolutePosition();
if ( oldAbsoluteRect != AbsoluteRect ) if ( oldAbsoluteRect != AbsoluteRect )
{ {
calculateFrameRect();
breakText(); breakText();
calculateScrollPos();
} }
} }
...@@ -723,25 +715,21 @@ void CGUIEditBox::draw() ...@@ -723,25 +715,21 @@ void CGUIEditBox::draw()
if (!skin) if (!skin)
return; return;
FrameRect = AbsoluteRect;
EGUI_DEFAULT_COLOR bgCol = EGDC_GRAY_EDITABLE; EGUI_DEFAULT_COLOR bgCol = EGDC_GRAY_EDITABLE;
if ( isEnabled() ) if ( isEnabled() )
bgCol = focus ? EGDC_FOCUSED_EDITABLE : EGDC_EDITABLE; bgCol = focus ? EGDC_FOCUSED_EDITABLE : EGDC_EDITABLE;
if (!Border && Background) if (!Border && Background)
{ {
skin->draw2DRectangle(this, skin->getColor(bgCol), FrameRect, &AbsoluteClippingRect); skin->draw2DRectangle(this, skin->getColor(bgCol), AbsoluteRect, &AbsoluteClippingRect);
} }
if (Border) if (Border)
{ {
// draw the border // draw the border
skin->draw3DSunkenPane(this, skin->getColor(bgCol), false, Background, FrameRect, &AbsoluteClippingRect); skin->draw3DSunkenPane(this, skin->getColor(bgCol), false, Background, AbsoluteRect, &AbsoluteClippingRect);
FrameRect.UpperLeftCorner.X += skin->getSize(EGDS_TEXT_DISTANCE_X)+1;
FrameRect.UpperLeftCorner.Y += skin->getSize(EGDS_TEXT_DISTANCE_Y)+1; calculateFrameRect();
FrameRect.LowerRightCorner.X -= skin->getSize(EGDS_TEXT_DISTANCE_X)+1;
FrameRect.LowerRightCorner.Y -= skin->getSize(EGDS_TEXT_DISTANCE_Y)+1;
} }
core::rect<s32> localClipRect = FrameRect; core::rect<s32> localClipRect = FrameRect;
...@@ -1379,6 +1367,21 @@ void CGUIEditBox::calculateScrollPos() ...@@ -1379,6 +1367,21 @@ void CGUIEditBox::calculateScrollPos()
// todo: adjust scrollbar // todo: adjust scrollbar
} }
void CGUIEditBox::calculateFrameRect()
{
FrameRect = AbsoluteRect;
IGUISkin *skin = 0;
if (Environment)
skin = Environment->getSkin();
if (Border && skin)
{
FrameRect.UpperLeftCorner.X += skin->getSize(EGDS_TEXT_DISTANCE_X)+1;
FrameRect.UpperLeftCorner.Y += skin->getSize(EGDS_TEXT_DISTANCE_Y)+1;
FrameRect.LowerRightCorner.X -= skin->getSize(EGDS_TEXT_DISTANCE_X)+1;
FrameRect.LowerRightCorner.Y -= skin->getSize(EGDS_TEXT_DISTANCE_Y)+1;
}
}
//! set text markers //! set text markers
void CGUIEditBox::setTextMarkers(s32 begin, s32 end) void CGUIEditBox::setTextMarkers(s32 begin, s32 end)
{ {
......
...@@ -136,6 +136,8 @@ namespace gui ...@@ -136,6 +136,8 @@ namespace gui
void inputChar(wchar_t c); void inputChar(wchar_t c);
//! calculates the current scroll position //! calculates the current scroll position
void calculateScrollPos(); void calculateScrollPos();
//! calculated the FrameRect
void calculateFrameRect();
//! send some gui event to parent //! send some gui event to parent
void sendGuiEvent(EGUI_EVENT_TYPE type); void sendGuiEvent(EGUI_EVENT_TYPE type);
//! set text markers //! set text markers
......
...@@ -405,7 +405,7 @@ bool CGUIListBox::OnEvent(const SEvent& event) ...@@ -405,7 +405,7 @@ bool CGUIListBox::OnEvent(const SEvent& event)
switch(event.MouseInput.Event) switch(event.MouseInput.Event)
{ {
case EMIE_MOUSE_WHEEL: case EMIE_MOUSE_WHEEL:
ScrollBar->setPos(ScrollBar->getPos() + (s32)event.MouseInput.Wheel*-ItemHeight/2); ScrollBar->setPos(ScrollBar->getPos() + (event.MouseInput.Wheel < 0 ? -1 : 1)*-ItemHeight/2);
return true; return true;
case EMIE_LMOUSE_PRESSED_DOWN: case EMIE_LMOUSE_PRESSED_DOWN:
......
...@@ -146,7 +146,7 @@ bool CGUIScrollBar::OnEvent(const SEvent& event) ...@@ -146,7 +146,7 @@ bool CGUIScrollBar::OnEvent(const SEvent& event)
// thanks to tommi by tommi for another bugfix // thanks to tommi by tommi for another bugfix
// everybody needs a little thanking. hallo niko!;-) // everybody needs a little thanking. hallo niko!;-)
setPos( getPos() + setPos( getPos() +
( (s32)event.MouseInput.Wheel * SmallStep * (Horizontal ? 1 : -1 ) ) ( (event.MouseInput.Wheel < 0 ? -1 : 1) * SmallStep * (Horizontal ? 1 : -1 ) )
); );
SEvent newEvent; SEvent newEvent;
......
...@@ -189,7 +189,7 @@ bool CGUISpinBox::OnEvent(const SEvent& event) ...@@ -189,7 +189,7 @@ bool CGUISpinBox::OnEvent(const SEvent& event)
{ {
case EMIE_MOUSE_WHEEL: case EMIE_MOUSE_WHEEL:
{ {
f32 val = getValue() + (StepSize * event.MouseInput.Wheel); f32 val = getValue() + (StepSize * (event.MouseInput.Wheel < 0 ? -1.f : 1.f));
setValue(val); setValue(val);
changeEvent = true; changeEvent = true;
} }
......
...@@ -583,7 +583,7 @@ bool CGUITable::OnEvent(const SEvent &event) ...@@ -583,7 +583,7 @@ bool CGUITable::OnEvent(const SEvent &event)
switch(event.MouseInput.Event) switch(event.MouseInput.Event)
{ {
case EMIE_MOUSE_WHEEL: case EMIE_MOUSE_WHEEL:
VerticalScrollBar->setPos(VerticalScrollBar->getPos() + (s32)event.MouseInput.Wheel*-10); VerticalScrollBar->setPos(VerticalScrollBar->getPos() + (event.MouseInput.Wheel < 0 ? -1 : 1)*-10);
return true; return true;
case EMIE_LMOUSE_PRESSED_DOWN: case EMIE_LMOUSE_PRESSED_DOWN:
......
...@@ -625,7 +625,7 @@ bool CGUITreeView::OnEvent( const SEvent &event ) ...@@ -625,7 +625,7 @@ bool CGUITreeView::OnEvent( const SEvent &event )
{ {
case EMIE_MOUSE_WHEEL: case EMIE_MOUSE_WHEEL:
if ( ScrollBarV ) if ( ScrollBarV )
ScrollBarV->setPos( ScrollBarV->getPos() + (s32)event.MouseInput.Wheel * -10 ); ScrollBarV->setPos( ScrollBarV->getPos() + (event.MouseInput.Wheel < 0 ? -1 : 1) * -10 );
return true; return true;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment