Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Commit

Permalink
Merge branch 'feature-lock_updates_of_group' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
runrevmark committed Jun 2, 2013
2 parents 4af1b0b + 9b8e5f1 commit 28a93bb
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 9 deletions.
25 changes: 25 additions & 0 deletions engine/src/group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ MCGroup::MCGroup()
scrollx = scrolly = 0;
scrollbarwidth = MCscrollbarwidth;
minrect.x = minrect.y = minrect.width = minrect.height = 0;

// MERG-2013-06-02: [[ LckGrpUpdates ]] Make sure the group's updates are unlocked
// when created.
m_updates_locked = false;
}

MCGroup::MCGroup(const MCGroup &gref) : MCControl(gref)
Expand Down Expand Up @@ -139,6 +143,10 @@ MCGroup::MCGroup(const MCGroup &gref, bool p_copy_ids) : MCControl(gref)
scrollx = gref.scrollx;
scrolly = gref.scrolly;
scrollbarwidth = gref.scrollbarwidth;

// MERG-2013-06-02: [[ LckGrpUpdates ]] Make sure the group's updates are unlocked
// when cloned.
m_updates_locked = false;
}

MCGroup::~MCGroup()
Expand Down Expand Up @@ -1292,6 +1300,23 @@ Exec_stat MCGroup::setprop(uint4 parid, Properties p, MCExecPoint &ep, Boolean e
dirty = False;
flags ^= F_SELECT_GROUP;
break;
// MERG-2013-06-02: [[ GrpLckUpdates ]] Handle setting of the lockUpdates property.
case P_LOCK_UPDATES:
{
Exec_stat t_stat;
Boolean t_lock;

t_stat = ep.getboolean(t_lock, 0, 0, EE_PROPERTY_NAB);
if (t_stat == ES_NORMAL)
m_updates_locked = t_lock ? true : false;

// When the lock is turned off, make sure we update the group.
if (!t_lock)
computeminrect(True);

return t_stat;
}
break;
default:
return MCControl::setprop(parid, p, ep, effective);
}
Expand Down
8 changes: 8 additions & 0 deletions engine/src/group.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ class MCGroup : public MCControl
MCRectangle minrect;
uint2 number;
Boolean mgrabbed;

// MERG-2013-06-02: [[ GrpLckUpdates ]] True if updates to bounding rect and
// parents locked.
bool m_updates_locked : 1;

static uint2 labeloffset;
public:
Expand Down Expand Up @@ -166,6 +170,10 @@ class MCGroup : public MCControl
// MW-2012-03-01: [[ Bug 10045 ]] Clear the mfocus setting of the group without
// dispatching any messages.
void clearmfocus(void);

// MERG-2013-06-02: [[ GrpLckUpdates ]] Returns the update locking state of the
// group.
bool islocked(void) { return m_updates_locked; }

MCGroup *next()
{
Expand Down
2 changes: 2 additions & 0 deletions engine/src/lextable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,8 @@ LT factor_table[] =
{"lockrecent", TT_PROPERTY, P_LOCK_RECENT},
{"lockscreen", TT_PROPERTY, P_LOCK_SCREEN},
{"locktext", TT_PROPERTY, P_LOCK_TEXT},
// MERG-2013-06-02: [[ GrpLckUpdates ]] The lockUpdates group property.
{"lockupdates", TT_PROPERTY, P_LOCK_UPDATES},
{"log10", TT_FUNCTION, F_LOG10},
{"log2", TT_FUNCTION, F_LOG2},
{"long", TT_PROPERTY, P_LONG},
Expand Down
24 changes: 15 additions & 9 deletions engine/src/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1203,16 +1203,22 @@ Boolean MCObject::resizeparent()
if (parent != NULL && parent->gettype() == CT_GROUP)
{
MCGroup *gptr = (MCGroup *)parent;
// MM-2012-09-05: [[ Property Listener ]] Moving/resizing an object within a group will potentially effect the location/rect properties of the group.
if (gptr->computeminrect((state & (CS_MOVE | CS_SIZE)) != 0))

// MERG-2013-06-02: [[ GrpLckUpdates ]] Only recalculate the group if not locked.
if (!gptr -> islocked())
{
if (state & CS_MOVE)
gptr -> signallisteners(P_LOCATION);
else
gptr -> signallisteners(P_RECTANGLE);
return True;
} else
return False;
// MM-2012-09-05: [[ Property Listener ]] Moving/resizing an object within a group will potentially effect the location/rect properties of the group.
if (gptr->computeminrect((state & (CS_MOVE | CS_SIZE)) != 0))
{
if (state & CS_MOVE)
gptr -> signallisteners(P_LOCATION);
else
gptr -> signallisteners(P_RECTANGLE);
return True;
}
else
return False;
}
}
return False;
}
Expand Down
2 changes: 2 additions & 0 deletions engine/src/parsedef.h
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@ enum Properties {
P_LOCK_MOVES,
P_LOCK_RECENT,
P_LOCK_SCREEN,
// MERG-2013-06-02: [[ GrpLckUpdates ]] Property tag for 'the lockUpdates' of groups.
P_LOCK_UPDATES,
P_BEEP_LOUDNESS,
P_BEEP_PITCH,
P_BEEP_DURATION,
Expand Down

0 comments on commit 28a93bb

Please sign in to comment.