@@ -193,6 +193,8 @@ MCUIDC::MCUIDC()
193193 nmessages = maxmessages = 0 ;
194194 messages = NULL ;
195195 moving = NULL ;
196+ lockmoves = False;
197+ locktime = 0.0 ;
196198 ncolors = 0 ;
197199 colors = NULL ;
198200 allocs = NULL ;
@@ -1079,6 +1081,33 @@ Boolean MCUIDC::handlepending(real8& curtime, real8& eventtime, Boolean dispatch
10791081 return t_handled;
10801082}
10811083
1084+
1085+ Boolean MCUIDC::getlockmoves () const
1086+ {
1087+ return lockmoves;
1088+ }
1089+
1090+ void MCUIDC::setlockmoves (Boolean b)
1091+ {
1092+ lockmoves = b;
1093+
1094+ if (lockmoves) {
1095+ // then save the time the lock started
1096+ locktime = MCS_time ();
1097+
1098+ } else {
1099+ // adjust the start time of each movement.
1100+ real8 offset = MCS_time () - locktime;
1101+ if (moving != NULL ) {
1102+ MCMovingList *mptr = moving;
1103+ do {
1104+ mptr->starttime += offset;
1105+ mptr = mptr->next ();
1106+ } while (mptr != moving);
1107+ }
1108+ }
1109+ }
1110+
10821111void MCUIDC::addmove (MCObject *optr, MCPoint *pts, uint2 npts,
10831112 real8 &duration, Boolean waiting)
10841113{
@@ -1126,7 +1155,11 @@ void MCUIDC::addmove(MCObject *optr, MCPoint *pts, uint2 npts,
11261155 optr -> setrect (newrect);
11271156 }
11281157
1129- mptr->starttime = MCS_time ();
1158+ if (lockmoves) {
1159+ mptr->starttime = locktime;
1160+ } else {
1161+ mptr->starttime = MCS_time ();
1162+ }
11301163}
11311164
11321165void MCUIDC::listmoves (MCExecPoint &ep)
@@ -1186,21 +1219,14 @@ void MCUIDC::stopmove(MCObject *optr, Boolean finish)
11861219
11871220void MCUIDC::handlemoves (real8 &curtime, real8 &eventtime)
11881221{
1189- static real8 lasttime;
1222+ if (lockmoves)
1223+ return ;
11901224 eventtime = curtime + (real8)MCsyncrate / 1000.0 ;
11911225 MCMovingList *mptr = moving;
11921226 Boolean moved = False;
11931227 Boolean done = False;
11941228 do
11951229 {
1196- if (MClockmoves)
1197- {
1198- if (lasttime != 0.0 )
1199- mptr->starttime += curtime - lasttime;
1200- mptr = mptr->next ();
1201- }
1202- else
1203- {
12041230 MCRectangle rect = mptr->object ->getrect ();
12051231 MCRectangle newrect = rect;
12061232 real8 dt = 0.0 ;
@@ -1267,13 +1293,8 @@ void MCUIDC::handlemoves(real8 &curtime, real8 &eventtime)
12671293 }
12681294 else
12691295 mptr = mptr->next ();
1270- }
12711296 }
12721297 while (mptr != NULL && mptr != moving);
1273- if (MClockmoves)
1274- lasttime = curtime;
1275- else
1276- lasttime = 0.0 ;
12771298
12781299 // MW-2012-12-09: [[ Bug 9905 ]] Make sure we update the screen if something
12791300 // moved (previously it only did so if there were still things to move also!).
0 commit comments