Core/MRI: Fix handling of Etc/Font properties

The gist of it is that for Etc and Font props, the assignment
operator (eg. 'sprite.color=') does not take a reference of the
right hand parameter and replaces its previous one with it (this
was the old behavior). Rather, it keeps its internal property
object and copies the parameter object into it by value.
The getter is unchanged; it still returns a reference to the
internal property object.

s = Sprite.new
c = Color.new
s.color = c
p s.color == c # => true
p s.color.object_id == c.object_id # => false (true before)
c = s.color
p s.color.object_id == c.object_id # => true
This commit is contained in:
Jonas Kulla 2014-09-05 01:26:03 +02:00
parent f665d8b41c
commit f8c26fc515
28 changed files with 337 additions and 243 deletions

View file

@ -870,7 +870,6 @@ DEF_ATTR_SIMPLE(WindowVX, Y, int, p->geo.y)
DEF_ATTR_RD_SIMPLE(WindowVX, Windowskin, Bitmap*, p->windowskin)
DEF_ATTR_RD_SIMPLE(WindowVX, Contents, Bitmap*, p->contents)
DEF_ATTR_RD_SIMPLE(WindowVX, CursorRect, Rect*, p->cursorRect)
DEF_ATTR_RD_SIMPLE(WindowVX, Active, bool, p->active)
DEF_ATTR_RD_SIMPLE(WindowVX, ArrowsVisible, bool, p->arrowsVisible)
DEF_ATTR_RD_SIMPLE(WindowVX, Pause, bool, p->pause)
@ -884,7 +883,9 @@ DEF_ATTR_RD_SIMPLE(WindowVX, Opacity, int, p->opacity)
DEF_ATTR_RD_SIMPLE(WindowVX, BackOpacity, int, p->backOpacity)
DEF_ATTR_RD_SIMPLE(WindowVX, ContentsOpacity, int, p->contentsOpacity)
DEF_ATTR_RD_SIMPLE(WindowVX, Openness, int, p->openness)
DEF_ATTR_RD_SIMPLE(WindowVX, Tone, Tone*, p->tone)
DEF_ATTR_OBJ_VALUE(WindowVX, CursorRect, Rect*, p->cursorRect)
DEF_ATTR_OBJ_VALUE(WindowVX, Tone, Tone*, p->tone)
void WindowVX::setWindowskin(Bitmap *value)
{
@ -909,16 +910,6 @@ void WindowVX::setContents(Bitmap *value)
p->ctrlVertDirty = true;
}
void WindowVX::setCursorRect(Rect *value)
{
if (p->cursorRect == value)
return;
p->cursorRect = value;
p->cursorVertDirty = true;
p->refreshCursorRectCon();
}
void WindowVX::setActive(bool value)
{
if (p->active == value)
@ -1050,12 +1041,12 @@ void WindowVX::setOpenness(int value)
p->updateBaseQuad();
}
void WindowVX::setTone(Tone *value)
void WindowVX::initDynAttribs()
{
if (p->tone == value)
return;
p->cursorRect = new Rect;
p->tone = new Tone;
p->tone = value;
p->refreshCursorRectCon();
p->refreshToneCon();
}