File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1687,6 +1687,12 @@ Exec_stat MCMakeGroup::exec(MCExecPoint &ep)
16871687 MCeerror->add (EE_GROUP_NOBG , line, pos);
16881688 return ES_ERROR ;
16891689 }
1690+
1691+ if (optr->getparent () != (MCControl *)chunkptr->getdestobj ()->getparent ())
1692+ {
1693+ MCeerror->add (EE_GROUP_DIFFERENTPARENT , line, pos);
1694+ return ES_ERROR ;
1695+ }
16901696
16911697 chunkptr->setdestobj (optr);
16921698 chunkptr = chunkptr->next ;
@@ -1711,8 +1717,9 @@ Exec_stat MCMakeGroup::exec(MCExecPoint &ep)
17111717 gptr->makegroup (controls, tcard);
17121718 }
17131719 else
1714- MCselected->group ();
1720+ return MCselected->group (line,pos );
17151721 return ES_NORMAL ;
1722+
17161723}
17171724
17181725MCPasteCmd::~MCPasteCmd ()
Original file line number Diff line number Diff line change @@ -2371,6 +2371,9 @@ enum Exec_errors
23712371
23722372 // {EE-0778} image cache limit: not a number
23732373 EE_PROPERTY_BADIMAGECACHELIMIT ,
2374+
2375+ // {EE-0779} controls don't have the same owner
2376+ EE_GROUP_DIFFERENTPARENT ,
23742377};
23752378
23762379extern const char * MCexecutionerrors ;
Original file line number Diff line number Diff line change @@ -271,23 +271,28 @@ MCControl *MCSellist::clone(MCObject *target)
271271 return t_result;
272272}
273273
274- void MCSellist::group ()
274+ Exec_stat MCSellist::group (uint2 line, uint2 pos )
275275{
276276 MCresult->clear (False);
277277 if (objects != NULL && objects->ref ->gettype () <= CT_FIELD
278278 && objects->ref ->gettype () >= CT_GROUP )
279279 {
280280 MCObject *parent = objects->ref ->getparent ();
281- MCSelnode *tptr = objects->next ();
282- while (tptr != objects)
283- {
281+ MCSelnode *tptr = objects;
282+ do {
283+ if (tptr->ref ->gettype () == CT_GROUP && static_cast <MCGroup *>(tptr->ref )->isshared ())
284+ {
285+ MCeerror->add (EE_GROUP_NOBG , line, pos);
286+ return ES_ERROR ;
287+ }
284288 if (tptr->ref ->getparent () != parent)
285289 {
286- MCresult-> sets ( " controls don't have the same owner " );
287- return ;
288- }
290+ MCeerror-> add ( EE_GROUP_DIFFERENTPARENT , line, pos );
291+ return ES_ERROR ;
292+ }
289293 tptr = tptr->next ();
290- }
294+ } while (tptr != objects);
295+
291296 sort ();
292297 MCControl *controls = NULL ;
293298 while (objects != NULL )
@@ -318,6 +323,7 @@ void MCSellist::group()
318323 objects = new MCSelnode (gptr);
319324 gptr->message (MCM_selected_object_changed);
320325 }
326+ return ES_NORMAL ;
321327}
322328
323329bool MCSellist::clipboard (bool p_is_cut)
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ class MCSellist
8484 void sort ();
8585 uint32_t count ();
8686 MCControl *clone (MCObject *target);
87- void group ();
87+ Exec_stat group (uint2 line, uint2 pos );
8888 Boolean copy ();
8989 Boolean cut ();
9090 Boolean del ();
You can’t perform that action at this time.
0 commit comments