bool Application::CloseProject() { if(IsControllerOpen()) return false; bool flag = true; bool cancel = false; cpw::PersistentError ferror; if(layer_tree.isModified()) { wxMessageDialog message (NULL, wxT("Save changes from the layer tree before quit?"), wxT("Warning"),wxICON_EXCLAMATION |wxYES_NO |wxCANCEL); int modal = message.ShowModal(); if(modal == wxID_YES) { cpw::controllers::EntityController controller(status_controller); ferror = controller.Save(layer_tree.GetTopLayer(), true, true); if (ferror != cpw::PERSISTENTOK) { wxMessageDialog message (NULL, wxT("Some entities from the layer tree could not be saved."), wxT("Warning"),wxICON_EXCLAMATION |wxOK); message.ShowModal(); } flag = true; } if(modal == wxID_NO) { flag = true; } if(modal == wxID_CANCEL) { cancel = true; flag = false; } } if (!cancel) { remote_controller->DisconnectAllEntities(); DeleteControllers(); main_frame->SetTitle(wxT("Rvzware")); project_controller->CloseProject(layer_tree); navigator_manager->GetFocusedOrFirstNavigator()->ShowHUD(false); navigator_manager->GetFocusedOrFirstNavigator() ->ClearMouseEventCallBack(); TestDependencies("WmsLayer"); layer_tree.Detach(&video_controller); main_frame->EnableGUI(false); video_controller.Update(); navigator_manager->Draw(); } return flag; }
bool Application::Close() { if(IsControllerOpen()) return false; bool flag = true; bool cancel = false; cpw::PersistentError ferror; cpw::ApplicationConfiguration* appconfig = cpw::ApplicationConfiguration::GetInstance(); handler_controller.ActivateAllHandlers(false); appconfig->SetUIConfiguration(main_frame->GetUIConfiguration()); if(appconfig->isModified()) { cpw::controllers::ConfigurationController config; config.Save(appconfig); } if(layer_tree.isModified()) { wxMessageDialog message (NULL,wxT("Save changes from the layer tree before quit?"), wxT("Warning"),wxICON_EXCLAMATION |wxYES_NO |wxCANCEL); int modal = message.ShowModal(); if(modal == wxID_YES) { cpw::controllers::EntityController controller(status_controller); ferror = controller.Save(layer_tree.GetTopLayer(), true, true); if (ferror != cpw::PERSISTENTOK) { wxMessageDialog message (NULL, wxT("Some entities from the layer tree could not be saved."), wxT("Warning"),wxICON_EXCLAMATION |wxOK); message.ShowModal(); } flag = true; } if(modal == wxID_NO) { flag = true; } if(modal == wxID_CANCEL) { cancel = true; flag = false; } } if (!cancel) { if (remote_controller) { delete remote_controller; remote_controller = NULL; } DeleteControllers(); if (graphic_factory) { delete graphic_factory; graphic_factory = NULL; } if (wms_request_manager) { delete wms_request_manager; wms_request_manager = NULL; } if (three_dimension_camera_controller) { delete three_dimension_camera_controller; three_dimension_camera_controller = NULL; } if (two_dimension_camera_controller) { delete two_dimension_camera_controller; two_dimension_camera_controller = NULL; } video_controller.SetAllowUpdate(false); if (navigator_manager) { delete navigator_manager; navigator_manager = NULL; } if (main_frame) { delete main_frame; main_frame = NULL; } application_time->Off(); cpw::EntityRegistry::ReleaseInstance(); cpw::ApplicationScene::ReleaseInstance(); cpw::EntityFactory::ReleaseInstance(); cpw::ApplicationLog::ReleaseInstance(); cpw::ApplicationConfiguration::ReleaseInstance(); cpw::controllers::KeyboardControl::ReleaseInstance(); cpw::ApplicationConfiguration::ReleaseInstance(); ApplicationTime::ReleaseInstance(); wmsFinalize(); } return flag; }
nsXULControllers::~nsXULControllers(void) { DeleteControllers(); }