/*********************************************************** destructor ***********************************************************/ LetterViewerBox::~LetterViewerBox() { { CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> ( CEGUI::WindowManager::getSingleton().getWindow("LetterViewerWIndowFrame")); CEGUI::UVector2 vec = frw->getPosition(); ConfigurationManager::GetInstance()->SetFloat("Gui.LetterViewerFrame.PosX", vec.d_x.d_scale); ConfigurationManager::GetInstance()->SetFloat("Gui.LetterViewerFrame.PosY", vec.d_y.d_scale); ConfigurationManager::GetInstance()->SetFloat("Gui.LetterViewerFrame.SizeX", frw->getWidth().d_scale); ConfigurationManager::GetInstance()->SetFloat("Gui.LetterViewerFrame.SizeY", frw->getHeight().d_scale); ConfigurationManager::GetInstance()->SetFloat("Gui.LetterViewerFrame.OffsetPosX", vec.d_x.d_offset); ConfigurationManager::GetInstance()->SetFloat("Gui.LetterViewerFrame.OffsetPosY", vec.d_y.d_offset); ConfigurationManager::GetInstance()->SetFloat("Gui.LetterViewerFrame.OffsetSizeX", frw->getWidth().d_offset); ConfigurationManager::GetInstance()->SetFloat("Gui.LetterViewerFrame.OffsetSizeY", frw->getHeight().d_offset); } }
/*********************************************************** save size of windows to be restored after resize of the application ***********************************************************/ void JournalBox::SaveGUISizes(int oldscreenX, int oldscreenY) { CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> ( CEGUI::WindowManager::getSingleton().getWindow("JournalFrame")); CEGUI::UVector2 vec = frw->getPosition(); _savedPosX = vec.d_x.asRelative((float)oldscreenX); _savedPosY = vec.d_y.asRelative((float)oldscreenY); _savedSizeX = frw->getWidth().asRelative((float)oldscreenX); _savedSizeY = frw->getHeight().asRelative((float)oldscreenY); }
/*********************************************************** destructor ***********************************************************/ CommunityBox::~CommunityBox() { try { CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> ( CEGUI::WindowManager::getSingleton().getWindow("CommunityFrame")); CEGUI::UVector2 vec = frw->getPosition(); ConfigurationManager::GetInstance()->SetFloat("Gui.Communitybox.PosX", vec.d_x.d_scale); ConfigurationManager::GetInstance()->SetFloat("Gui.Communitybox.PosY", vec.d_y.d_scale); ConfigurationManager::GetInstance()->SetFloat("Gui.Communitybox.SizeX", frw->getWidth().d_scale); ConfigurationManager::GetInstance()->SetFloat("Gui.Communitybox.SizeY", frw->getHeight().d_scale); ConfigurationManager::GetInstance()->SetFloat("Gui.Communitybox.OffsetPosX", vec.d_x.d_offset); ConfigurationManager::GetInstance()->SetFloat("Gui.Communitybox.OffsetPosY", vec.d_y.d_offset); ConfigurationManager::GetInstance()->SetFloat("Gui.Communitybox.OffsetSizeX", frw->getWidth().d_offset); ConfigurationManager::GetInstance()->SetFloat("Gui.Communitybox.OffsetSizeY", frw->getHeight().d_offset); ConfigurationManager::GetInstance()->SetBool("Gui.Communitybox.Visible", frw->isVisible()); } catch(CEGUI::Exception &ex) { LogHandler::getInstance()->LogToFile(std::string("Exception destructor community box: ") + ex.getMessage().c_str()); } }
/*********************************************************** destructor ***********************************************************/ JournalBox::~JournalBox() { try { CEGUI::FrameWindow * frw = static_cast<CEGUI::FrameWindow *> ( CEGUI::WindowManager::getSingleton().getWindow("JournalFrame")); int resX, resY; bool fullscreen; OsgHandler::getInstance()->GetScreenAttributes(resX, resY, fullscreen); CEGUI::UVector2 vec = frw->getPosition(); ConfigurationManager::GetInstance()->SetValue("Gui.JournalBox.PosX", vec.d_x.asRelative((float)resX)); ConfigurationManager::GetInstance()->SetValue("Gui.JournalBox.PosY", vec.d_y.asRelative((float)resY)); ConfigurationManager::GetInstance()->SetValue("Gui.JournalBox.SizeX", frw->getWidth().asRelative((float)resX)); ConfigurationManager::GetInstance()->SetValue("Gui.JournalBox.SizeY", frw->getHeight().asRelative((float)resY)); ConfigurationManager::GetInstance()->SetValue("Gui.JournalBox.Visible", frw->isVisible()); { std::string qtreedown; std::string selected; std::map<std::string, CEGUI::TreeItem *>::iterator itm = _mapquestarea.begin(); std::map<std::string, CEGUI::TreeItem *>::iterator endm = _mapquestarea.end(); for(; itm != endm; ++itm) { if(itm->second->getIsOpen()) { qtreedown += "##" + itm->first; } std::vector<CEGUI::TreeItem*> items = itm->second->getItemList(); for(size_t i=0; i<items.size(); ++i) { if(items[i]->isSelected()) selected = items[i]->getText().c_str(); } } ConfigurationManager::GetInstance()->SetValue("Gui.JournalBox.QuestTreeOpen", qtreedown); ConfigurationManager::GetInstance()->SetValue("Gui.JournalBox.QuestTreeSelected", selected); } { std::string qtreedown; std::string selected; std::map<std::string, CEGUI::TreeItem *>::iterator itm = _mapquestdonearea.begin(); std::map<std::string, CEGUI::TreeItem *>::iterator endm = _mapquestdonearea.end(); for(; itm != endm; ++itm) { if(itm->second->getIsOpen()) { qtreedown += "##" + itm->first; } std::vector<CEGUI::TreeItem*> items = itm->second->getItemList(); for(size_t i=0; i<items.size(); ++i) { if(items[i]->isSelected()) selected = items[i]->getText().c_str(); } } ConfigurationManager::GetInstance()->SetValue("Gui.JournalBox.QuestDoneTreeOpen", qtreedown); ConfigurationManager::GetInstance()->SetValue("Gui.JournalBox.QuestDoneTreeSelected", selected); } } catch(CEGUI::Exception &ex) { LogHandler::getInstance()->LogToFile(std::string("Exception destructor Inventorybox: ") + ex.getMessage().c_str()); } }