//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ GameObjectType::pDocument_type GameObjectType::getDocument() { if (m_pDocument.isValid()) { return m_pDocument; } // Create a document and return it. // Get a reference to the workbench Zen::Studio::Workbench::I_WorkbenchService& workbench(m_project.getController().getWorkbenchService()); // TODO Create a spread sheet document user data. // Since GameObjectTypeDocument is a user-implemented document, // the user data isn't needed, but possibly eventually it will be. //Zen::Studio::Workbench::I_SpreadSheetDocument::pUserData_type // pUserData(); // Get the parent document. Zen::Studio::Workbench::I_ExplorerNode* const pParentNode = getNode()->getParent(); pDocument_type* ppParentDocument = NULL; // If the parent node isn't NULL, see if the user data is a GameObjectType if (pParentNode != NULL) { GameObjectType* pParent = dynamic_cast<GameObjectType*>(pParentNode->getUserData().get()); if (pParent) { ppParentDocument = new pDocument_type(pParent->getDocument()); } } // Create the document. GameObjectTypeDocument* pRawDocument = new GameObjectTypeDocument(m_project, ppParentDocument); Zen::Studio::Workbench::I_Document::pDocument_type pGameObjectTypeDocument(pRawDocument, &GameObjectType::destroyDocument); // TODO Create a future and pass it to this method. Then have // this method fire the future event when the document is fully loaded. pRawDocument->load(*this); m_pDocument = pGameObjectTypeDocument; onOpened(pRawDocument); // TODO Return a future. return m_pDocument; }
void Player::openStream() { bool ok = _decoder->open(_downloader); if(ok) { ScopedCS lock(cs); _playerState = Playing; } else { _openThread.detach(); stop(); } if(onOpened) onOpened(); }