/** * This function will call ModelObject::addReference. * It will stop handling the notifications for the old object, * start handling the notifications for the new object * and reset this ViewObject (derived) class. * * See ViewObject::resetViewObject */ void ViewObject::rebindModelObject(ModelObjectPtr aModelObject) { if(modelObject) { stopHandlingNotificationsFor(*modelObject); } modelObject = aModelObject; if(modelObject) { handleNotificationsFor(*modelObject); } }
void Robot::calculateRoute(GoalPtr aGoal) { path.clear(); if (aGoal) { // Turn off logging if not debugging AStar Logger::setDisable(); front = Vector( aGoal->getPosition(), position); handleNotificationsFor( astar); path = astar.search( position, aGoal->getPosition(), size); stopHandlingNotificationsFor( astar); Logger::setDisable( false); } }
void QFMotionPlayer::gotHeader() { #ifdef TRACE stampTime(); *debugOutput << "Got header:" << '\t' << &qf << endl; #endif if (qf.window() && !window_p) setWindow(*qf.window()); if (qf.disabled()) return; if (moviePlayer) // In case we are retrying open in response to error { stopHandlingNotificationsFor(*moviePlayer); moviePlayer->disableNotification(); delete moviePlayer; } else qf.playerCreated(); // Tell plugin we're here (on thread 1, first time only) // Create player and launch thread to prepare the movie if (isMusicOnly_p) moviePlayer = new IMMSequencer(false); else if (isSoundOnly_p) moviePlayer = new IMMWaveAudio(false); else moviePlayer = new IMMDigitalVideo(false); moviePlayer->enableNotification(); handleNotificationsFor(*moviePlayer); if (qf.streamDone()) { autoStartPointReached = true; finishStream(); if (qf.controller()) qf.controller()->setFullPercent(1.0); } prepareThread = new IThread(new IThreadMemberFn<QFMotionPlayer>(*this, QFMotionPlayer::prepare)); }
QFMotionPlayer::~QFMotionPlayer() { qf.setStreamStopped(); handler.QFPlayerHandler::stopHandlingEventsFor(&qf.mainThreadWindow()); if (window_p) { handler.IPaintHandler::stopHandlingEventsFor(window_p); handler.IResizeHandler::stopHandlingEventsFor(window_p); handler.ICommandHandler::stopHandlingEventsFor(window_p); handler.QFPlayerHandler::stopHandlingEventsFor(window_p); } if (serviceThreadWindow) handler.QFPlayerHandler::stopHandlingEventsFor(serviceThreadWindow); if (moviePlayer) { if (isPositionTracking) moviePlayer->stopPositionTracking(); stopHandlingNotificationsFor(*moviePlayer); moviePlayer->disableNotification(); if (moviePlayer->isOpen() && moviePlayer->deviceId()) moviePlayer->stop(); if (!oldPlayerCursor) // No setWindow was done for this player delete moviePlayer; else { oldPlayers.elementAt(*oldPlayerCursor).isDeletable = true; // Flag this player as deletable delete oldPlayerCursor; // That was cursor's sole purpose while (!oldPlayers.isEmpty() && oldPlayers.lastElement().isDeletable) // Delete deletable players from the top of the stack { delete oldPlayers.lastElement().moviePlayer; oldPlayers.removeLast(); } } } if (movieWindow) { handler.IMouseHandler::stopHandlingEventsFor(movieWindow); handler.IMenuHandler::stopHandlingEventsFor(movieWindow); delete movieWindow; } if (screen) { handler.IMenuHandler::stopHandlingEventsFor(screen); delete screen; } delete menu; // Close semaphores DosCloseEventSem(proceedWithPrepare); if (prepareThread && prepareThread->isStarted()) IThread::current().waitFor(*prepareThread); }