diff --git a/apps/openmw/mwgui/journalwindow.cpp b/apps/openmw/mwgui/journalwindow.cpp index 7c09c3220..7d83539e0 100644 --- a/apps/openmw/mwgui/journalwindow.cpp +++ b/apps/openmw/mwgui/journalwindow.cpp @@ -83,6 +83,10 @@ MWGui::JournalWindow::JournalWindow (WindowManager& parWindowManager) getWidget(mLeftTextWidget, "LeftText"); getWidget(mRightTextWidget, "RightText"); + getWidget(mPrevBtn, "PrevPageBTN"); + mPrevBtn->eventMouseButtonClick = MyGUI::newDelegate(this,&MWGui::JournalWindow::notifyPrevPage); + getWidget(mNextBtn, "NextPageBTN"); + mNextBtn->eventMouseButtonClick = MyGUI::newDelegate(this,&MWGui::JournalWindow::notifyNextPage); //MyGUI::ItemBox* list = new MyGUI::ItemBox(); //list->addItem("qaq","aqzazaz"); //mScrollerWidget->addChildItem(list); @@ -107,11 +111,9 @@ MWGui::JournalWindow::JournalWindow (WindowManager& parWindowManager) void MWGui::JournalWindow::open() { + mPageNumber = 0; if(mWindowManager.getEnvironment().mJournal->begin()!=mWindowManager.getEnvironment().mJournal->end()) { - std::vector leftPages; - std::vector rightPages; - book journal; journal.endLine = 0; @@ -119,7 +121,7 @@ void MWGui::JournalWindow::open() { std::string a = it->getText(mWindowManager.getEnvironment().mWorld->getStore()); std::cout << a; - journal = formatText(a,journal,10,20); + journal = formatText(a,journal,10,17); journal.endLine = journal.endLine +1; journal.pages.back() = journal.pages.back() + std::string("\n"); } @@ -140,8 +142,9 @@ void MWGui::JournalWindow::open() } if(!left) rightPages.push_back(""); - displayLeftText(leftPages.back()); - displayRightText(rightPages.back()); + mPageNumber = leftPages.size()-1; + displayLeftText(leftPages[mPageNumber]); + displayRightText(rightPages[mPageNumber]); } else @@ -165,4 +168,27 @@ void MWGui::JournalWindow::displayRightText(std::string text) { mRightTextWidget->eraseText(0,mRightTextWidget->getTextLength()); mRightTextWidget->addText(text); +} + + +void MWGui::JournalWindow::notifyNextPage(MyGUI::WidgetPtr _sender) +{ + std::cout << mPageNumber; + if(mPageNumber < int(leftPages.size())-1) + { + mPageNumber = mPageNumber + 1; + displayLeftText(leftPages[mPageNumber]); + displayRightText(rightPages[mPageNumber]); + } +} + +void MWGui::JournalWindow::notifyPrevPage(MyGUI::WidgetPtr _sender) +{ + std::cout << mPageNumber; + if(mPageNumber > 0) + { + mPageNumber = mPageNumber - 1; + displayLeftText(leftPages[mPageNumber]); + displayRightText(rightPages[mPageNumber]); + } } \ No newline at end of file diff --git a/apps/openmw/mwgui/journalwindow.hpp b/apps/openmw/mwgui/journalwindow.hpp index 67450d8e9..e66448763 100644 --- a/apps/openmw/mwgui/journalwindow.hpp +++ b/apps/openmw/mwgui/journalwindow.hpp @@ -31,6 +31,13 @@ namespace MWGui void displayLeftText(std::string text); void displayRightText(std::string text); + + /** + *Called when next/prev button is used. + */ + void notifyNextPage(MyGUI::WidgetPtr _sender); + void notifyPrevPage(MyGUI::WidgetPtr _sender); + static const int lineHeight; MyGUI::WidgetPtr skillAreaWidget, skillClientWidget; @@ -38,6 +45,11 @@ namespace MWGui int lastPos, clientHeight; MyGUI::EditPtr mLeftTextWidget; MyGUI::EditPtr mRightTextWidget; + MyGUI::ButtonPtr mPrevBtn; + MyGUI::ButtonPtr mNextBtn; + std::vector leftPages; + std::vector rightPages; + int mPageNumber; //store the number of the current left page }; } diff --git a/extern/mygui_3.0.1/openmw_resources/openmw_journal_layout.xml b/extern/mygui_3.0.1/openmw_resources/openmw_journal_layout.xml index 1d9a11dd8..dc2116ee0 100644 --- a/extern/mygui_3.0.1/openmw_resources/openmw_journal_layout.xml +++ b/extern/mygui_3.0.1/openmw_resources/openmw_journal_layout.xml @@ -1,6 +1,5 @@  - @@ -9,8 +8,14 @@ - - + + + + + + + + diff --git a/extern/mygui_3.0.1/openmw_resources/openmw_journal_skin.xml b/extern/mygui_3.0.1/openmw_resources/openmw_journal_skin.xml new file mode 100644 index 000000000..b6cb1bca7 --- /dev/null +++ b/extern/mygui_3.0.1/openmw_resources/openmw_journal_skin.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +