// notifyDrawMgr = 0; Defaults to 0 int DisplayManager::addDisplay(DisplayPtr disp, bool notifyDrawMgr) { vprDEBUG(vrjDBG_DISP_MGR, vprDBG_VERB_LVL) << "vrj::DisplayManager::addDisplay()\n" << vprDEBUG_FLUSH; // Test if active or not, to determine correct list // The place it in the list // --- Update Local Display structures if (disp->isActive()) { mActiveDisplays.push_back(disp); } else { mInactiveDisplays.push_back(disp); } // If we are supposed to notify about, and valid draw mgr, and disp is active if ((notifyDrawMgr) && (mDrawManager != NULL) && (disp->isActive())) { mDrawManager->addDisplay(disp);; // Tell Draw Manager to add dislay; } return 1; }
/** * Closes the given display. * * @pre disp is a display we know about. * @post disp has been removed from the list of displays * (notifyDrawMgr == true) && (drawMgr != NULL) && (disp is active) * ==> Draw manager has been told to clode the window for the display */ int DisplayManager::closeDisplay(DisplayPtr disp, bool notifyDrawMgr) { vprASSERT(isMemberDisplay(disp)); // Make sure that display actually exists vprDEBUG(vrjDBG_DISP_MGR, vprDBG_STATE_LVL) << "[vrj::DisplayManager::closeDisplay()] Closing display named '" << disp->getName() << "'" << std::endl << vprDEBUG_FLUSH; // Notify the draw manager to get rid of it // Note: if it is not active, then the draw manager doesn't know about it if ((notifyDrawMgr) && (mDrawManager != NULL) && (disp->isActive())) { mDrawManager->removeDisplay(disp); } // Remove it from local data structures size_t num_before_close = mActiveDisplays.size() + mInactiveDisplays.size(); mActiveDisplays.erase( std::remove(mActiveDisplays.begin(), mActiveDisplays.end(), disp), mActiveDisplays.end()); mInactiveDisplays.erase( std::remove(mInactiveDisplays.begin(), mInactiveDisplays.end(), disp), mInactiveDisplays.end()); vprASSERT(num_before_close == (1+mActiveDisplays.size() + mInactiveDisplays.size())); boost::ignore_unused_variable_warning(num_before_close); return 1; }