From d59284a09611c962a0e510c2cf2c7f8805ae81f7 Mon Sep 17 00:00:00 2001 From: gugus Date: Thu, 29 Dec 2011 17:58:58 +0100 Subject: [PATCH] first attempt to read the journal --- apps/openmw/mwgui/journalwindow.cpp | 22 ++++++++++++++++++++-- apps/openmw/mwgui/journalwindow.hpp | 2 +- apps/openmw/mwgui/window_manager.cpp | 6 ++++++ apps/openmw/mwgui/window_manager.hpp | 2 ++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwgui/journalwindow.cpp b/apps/openmw/mwgui/journalwindow.cpp index 12909aebc..c42e6de88 100644 --- a/apps/openmw/mwgui/journalwindow.cpp +++ b/apps/openmw/mwgui/journalwindow.cpp @@ -1,5 +1,8 @@ #include "journalwindow.hpp" #include "window_manager.hpp" +#include "../mwdialogue/journal.hpp" +#include "../mwworld/environment.hpp" +#include "../mwworld/world.hpp" std::list formatText(std::string text) @@ -84,13 +87,28 @@ MWGui::JournalWindow::JournalWindow (WindowManager& parWindowManager) mLeftTextWidget->setEditStatic(true); mRightTextWidget->addText("Right texxt "); - std::list list = formatText("OpenMW rgh dsfg sqef srg ZT uzql n ZLIEHRF LQSJH GLOIjf qjfmj hslkdgn jlkdjhg qlr isgli shli uhs fiuh qksf cg ksjnf lkqsnbf ksbf sbfkl zbf kuyzflkj sbgdfkj zlfh ozhjfmo hzmfh lizuf rty qzt ezy tkyEZT RYYJ DG fgh is an open-source implementation of the game engine found in the game Morrowind. This is a dumb test text msodjbg smojg smoig fiiinnn"); - displayLeftText(list.front()); + //std::list list = formatText("OpenMW rgh dsfg sqef srg ZT uzql n ZLIEHRF LQSJH GLOIjf qjfmj hslkdgn jlkdjhg qlr isgli shli uhs fiuh qksf cg ksjnf lkqsnbf ksbf sbfkl zbf kuyzflkj sbgdfkj zlfh ozhjfmo hzmfh lizuf rty qzt ezy tkyEZT RYYJ DG fgh is an open-source implementation of the game engine found in the game Morrowind. This is a dumb test text msodjbg smojg smoig fiiinnn"); + //std::list list = formatText(); + //displayLeftText(list.front()); MyGUI::WindowPtr t = static_cast(mMainWidget); t->eventWindowChangeCoord = MyGUI::newDelegate(this, &JournalWindow::onWindowResize); } +void MWGui::JournalWindow::open() +{ + if(mWindowManager.getEnvironment().mJournal->begin()!=mWindowManager.getEnvironment().mJournal->end()) + { + std::string a = mWindowManager.getEnvironment().mJournal->begin()->getText(mWindowManager.getEnvironment().mWorld->getStore()); + std::cout << a; + } + else + { + std::cout << "empty"; + //std::cout << mWindowManager.getEnvironment().mJournal->begin()->getText(mWindowManager.getEnvironment().mWorld->getStore()); + } +} + void MWGui::JournalWindow::onWindowResize(MyGUI::Window* window) { } diff --git a/apps/openmw/mwgui/journalwindow.hpp b/apps/openmw/mwgui/journalwindow.hpp index 9b4698398..67450d8e9 100644 --- a/apps/openmw/mwgui/journalwindow.hpp +++ b/apps/openmw/mwgui/journalwindow.hpp @@ -5,7 +5,6 @@ #include #include #include -#include "../mwdialogue/journal.hpp" #include "window_base.hpp" @@ -17,6 +16,7 @@ namespace MWGui { public: JournalWindow(WindowManager& parWindowManager); + void open(); private: enum ColorStyle diff --git a/apps/openmw/mwgui/window_manager.cpp b/apps/openmw/mwgui/window_manager.cpp index be4632b41..feef07043 100644 --- a/apps/openmw/mwgui/window_manager.cpp +++ b/apps/openmw/mwgui/window_manager.cpp @@ -144,6 +144,11 @@ void WindowManager::update() } } +MWWorld::Environment& WindowManager::getEnvironment() +{ + return environment; +} + void WindowManager::setNextMode(GuiMode newMode) { nextMode = newMode; @@ -351,6 +356,7 @@ void WindowManager::updateVisible() if(mode == GM_Journal) { mJournal->setVisible(true); + mJournal->open(); return; } diff --git a/apps/openmw/mwgui/window_manager.hpp b/apps/openmw/mwgui/window_manager.hpp index 9db3f8c60..44b7da086 100644 --- a/apps/openmw/mwgui/window_manager.hpp +++ b/apps/openmw/mwgui/window_manager.hpp @@ -174,6 +174,8 @@ namespace MWGui */ void update(); + MWWorld::Environment& getEnvironment(); + void setMode(GuiMode newMode) { if (newMode==GM_Inventory && allowed==GW_None)