reToolManager::reToolManager(reComponent* component, wxFrame* owner, wxAuiManager* manager){ m_owner = owner; m_component = component; m_manager = manager; m_activeTool = nullptr; m_TransformToolbar = nullptr; m_activeToolId = reTOOL_NONE; m_component->Bind(reCommandProcessed, this, &reToolManager::OnCommandProcessed); CreateTools(); }
BOOL Module::InitModules() { // Initialise the list of Modules. Modules = new ModuleList; if (!Modules) return FALSE; if (!OILModule::Init()) // get OIL's list of modules. This works return FALSE; // by calling back to DescribeModule. // NB. OILModule::Init does it own error BOOL Finished; // reporting do { // All the modules have been 'new'ed now. We can now ask them to initialise themselves. // If they don't want to, they get 'delete'ed. ModuleListItem *Item = (ModuleListItem *) Modules->GetHead(); Finished = TRUE; while (Item != NULL) { Module *Module = Item->m_pModule; // If this module exists and has not been initialised yet, then try to // initialise it. If it initialises ok, set the item's flag, and force // another scan of the remaining modules in case one of them depends on // this module being present. if ((Module != NULL) && (!Item->m_Initialised) && (Module->Init())) { Item->m_Initialised = TRUE; // Tool initialised ok. Finished = FALSE; // At least one more loop to try } // Try the next module Item = (ModuleListItem *) Modules->GetNext(Item); } } while (!Finished); // Delete any un-initialised modules ModuleListItem *Item = (ModuleListItem *) Modules->GetHead(); while (Item != NULL) { if ((Item->m_pModule != NULL) && (!Item->m_Initialised)) { delete Item->m_pModule; Item->m_pModule = NULL; } // Try the next module Item = (ModuleListItem *) Modules->GetNext(Item); } // Scan all the modules and create (but do not initialise) any tools they provide. if (!Tool::InitToolList() || !CreateTools()) return FALSE; return TRUE; }