openmw-tes3coop/apps/openmw/mwgui/journalwindow.cpp

658 lines
23 KiB
C++
Raw Normal View History

#include "journalwindow.hpp"
#include <sstream>
#include <set>
#include <stack>
#include <string>
#include <utility>
2015-01-10 01:50:43 +00:00
#include <MyGUI_TextBox.h>
#include <MyGUI_Button.h>
#include <MyGUI_InputManager.h>
2015-01-10 01:50:43 +00:00
#include <components/misc/stringops.hpp>
#include <components/widgets/imagebutton.hpp>
#include <components/widgets/list.hpp>
2015-01-10 01:50:43 +00:00
#include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp"
#include "../mwbase/journal.hpp"
#include "bookpage.hpp"
#include "windowbase.hpp"
#include "journalviewmodel.hpp"
#include "journalbooks.hpp"
2012-01-17 12:53:27 +00:00
namespace
{
static char const OptionsOverlay [] = "OptionsOverlay";
static char const OptionsBTN [] = "OptionsBTN";
static char const PrevPageBTN [] = "PrevPageBTN";
static char const NextPageBTN [] = "NextPageBTN";
static char const CloseBTN [] = "CloseBTN";
static char const JournalBTN [] = "JournalBTN";
static char const TopicsBTN [] = "TopicsBTN";
static char const QuestsBTN [] = "QuestsBTN";
static char const CancelBTN [] = "CancelBTN";
static char const ShowAllBTN [] = "ShowAllBTN";
static char const ShowActiveBTN [] = "ShowActiveBTN";
static char const PageOneNum [] = "PageOneNum";
static char const PageTwoNum [] = "PageTwoNum";
static char const TopicsList [] = "TopicsList";
static char const QuestsList [] = "QuestsList";
static char const LeftBookPage [] = "LeftBookPage";
static char const RightBookPage [] = "RightBookPage";
static char const LeftTopicIndex [] = "LeftTopicIndex";
static char const RightTopicIndex [] = "RightTopicIndex";
struct JournalWindowImpl : MWGui::JournalBooks, MWGui::JournalWindow
{
struct DisplayState
{
unsigned int mPage;
Book mBook;
};
typedef std::stack <DisplayState> DisplayStateStack;
DisplayStateStack mStates;
Book mTopicIndexBook;
bool mQuestMode;
bool mOptionsMode;
bool mTopicsMode;
bool mAllQuests;
template <typename T>
T * getWidget (char const * name)
{
T * widget;
WindowBase::getWidget (widget, name);
return widget;
}
template <typename value_type>
void setText (char const * name, value_type const & value)
{
2013-05-06 14:04:28 +00:00
getWidget <MyGUI::TextBox> (name) ->
setCaption (MyGUI::utility::toString (value));
}
void setVisible (char const * name, bool visible)
{
2013-05-06 14:04:28 +00:00
getWidget <MyGUI::Widget> (name) ->
setVisible (visible);
}
2013-05-06 14:04:28 +00:00
void adviseButtonClick (char const * name, void (JournalWindowImpl::*Handler) (MyGUI::Widget* _sender))
{
getWidget <MyGUI::Widget> (name) ->
eventMouseButtonClick += newDelegate(this, Handler);
}
void adviseKeyPress (char const * name, void (JournalWindowImpl::*Handler) (MyGUI::Widget* _sender, MyGUI::KeyCode key, MyGUI::Char character))
{
getWidget <MyGUI::Widget> (name) ->
eventKeyButtonPressed += newDelegate(this, Handler);
}
MWGui::BookPage* getPage (char const * name)
{
return getWidget <MWGui::BookPage> (name);
}
JournalWindowImpl (MWGui::JournalViewModel::Ptr Model, bool questList, ToUTF8::FromType encoding)
: JournalBooks (Model, encoding), JournalWindow()
{
center();
adviseButtonClick (OptionsBTN, &JournalWindowImpl::notifyOptions );
adviseButtonClick (PrevPageBTN, &JournalWindowImpl::notifyPrevPage );
adviseButtonClick (NextPageBTN, &JournalWindowImpl::notifyNextPage );
adviseButtonClick (CloseBTN, &JournalWindowImpl::notifyClose );
adviseButtonClick (JournalBTN, &JournalWindowImpl::notifyJournal );
adviseButtonClick (TopicsBTN, &JournalWindowImpl::notifyTopics );
adviseButtonClick (QuestsBTN, &JournalWindowImpl::notifyQuests );
adviseButtonClick (CancelBTN, &JournalWindowImpl::notifyCancel );
adviseButtonClick (ShowAllBTN, &JournalWindowImpl::notifyShowAll );
adviseButtonClick (ShowActiveBTN, &JournalWindowImpl::notifyShowActive);
adviseKeyPress (OptionsBTN, &JournalWindowImpl::notifyKeyPress);
adviseKeyPress (PrevPageBTN, &JournalWindowImpl::notifyKeyPress);
adviseKeyPress (NextPageBTN, &JournalWindowImpl::notifyKeyPress);
adviseKeyPress (CloseBTN, &JournalWindowImpl::notifyKeyPress);
adviseKeyPress (JournalBTN, &JournalWindowImpl::notifyKeyPress);
Gui::MWList* list = getWidget<Gui::MWList>(QuestsList);
list->eventItemSelected += MyGUI::newDelegate(this, &JournalWindowImpl::notifyQuestClicked);
Gui::MWList* topicsList = getWidget<Gui::MWList>(TopicsList);
topicsList->eventItemSelected += MyGUI::newDelegate(this, &JournalWindowImpl::notifyTopicSelected);
{
2013-05-06 14:04:28 +00:00
MWGui::BookPage::ClickCallback callback;
2013-02-09 18:44:20 +00:00
2017-05-06 13:12:06 +00:00
callback = std::bind (&JournalWindowImpl::notifyTopicClicked, this, std::placeholders::_1);
getPage (LeftBookPage)->adviseLinkClicked (callback);
getPage (RightBookPage)->adviseLinkClicked (callback);
getPage (LeftBookPage)->eventMouseWheel += MyGUI::newDelegate(this, &JournalWindowImpl::notifyMouseWheel);
getPage (RightBookPage)->eventMouseWheel += MyGUI::newDelegate(this, &JournalWindowImpl::notifyMouseWheel);
}
{
2013-05-06 14:04:28 +00:00
MWGui::BookPage::ClickCallback callback;
2013-02-09 18:44:20 +00:00
2017-05-06 13:12:06 +00:00
callback = std::bind(&JournalWindowImpl::notifyIndexLinkClicked, this, std::placeholders::_1);
getPage (LeftTopicIndex)->adviseLinkClicked (callback);
getPage (RightTopicIndex)->adviseLinkClicked (callback);
}
2013-05-08 11:55:15 +00:00
adjustButton(PrevPageBTN);
adjustButton(NextPageBTN);
adjustButton(CloseBTN);
adjustButton(CancelBTN);
adjustButton(JournalBTN);
Gui::ImageButton* optionsButton = getWidget<Gui::ImageButton>(OptionsBTN);
Gui::ImageButton* showActiveButton = getWidget<Gui::ImageButton>(ShowActiveBTN);
Gui::ImageButton* showAllButton = getWidget<Gui::ImageButton>(ShowAllBTN);
Gui::ImageButton* questsButton = getWidget<Gui::ImageButton>(QuestsBTN);
Gui::ImageButton* nextButton = getWidget<Gui::ImageButton>(NextPageBTN);
if (nextButton->getSize().width == 64)
{
// english button has a 7 pixel wide strip of garbage on its right edge
nextButton->setSize(64-7, nextButton->getSize().height);
nextButton->setImageCoord(MyGUI::IntCoord(0,0,64-7,nextButton->getSize().height));
}
if (!questList)
{
// If tribunal is not installed (-> no options button), we still want the Topics button available,
// so place it where the options button would have been
Gui::ImageButton* topicsButton = getWidget<Gui::ImageButton>(TopicsBTN);
topicsButton->detachFromWidget();
topicsButton->attachToWidget(optionsButton->getParent());
topicsButton->setPosition(optionsButton->getPosition());
topicsButton->eventMouseButtonClick.clear();
topicsButton->eventMouseButtonClick += MyGUI::newDelegate(this, &JournalWindowImpl::notifyOptions);
optionsButton->setVisible(false);
showActiveButton->setVisible(false);
showAllButton->setVisible(false);
questsButton->setVisible(false);
adjustButton(TopicsBTN);
}
else
{
optionsButton->setImage("textures/tx_menubook_options.dds");
showActiveButton->setImage("textures/tx_menubook_quests_active.dds");
showAllButton->setImage("textures/tx_menubook_quests_all.dds");
questsButton->setImage("textures/tx_menubook_quests.dds");
adjustButton(ShowAllBTN);
adjustButton(ShowActiveBTN);
adjustButton(OptionsBTN);
adjustButton(QuestsBTN);
adjustButton(TopicsBTN);
int topicsWidth = getWidget<MyGUI::Widget>(TopicsBTN)->getSize().width;
int cancelLeft = getWidget<MyGUI::Widget>(CancelBTN)->getPosition().left;
int cancelRight = getWidget<MyGUI::Widget>(CancelBTN)->getPosition().left + getWidget<MyGUI::Widget>(CancelBTN)->getSize().width;
getWidget<MyGUI::Widget>(QuestsBTN)->setPosition(cancelRight, getWidget<MyGUI::Widget>(QuestsBTN)->getPosition().top);
// Usually Topics, Quests, and Cancel buttons have the 64px width, so we can place the Topics left-up from the Cancel button, and the Quests right-up from the Cancel button.
// But in some installations, e.g. German one, the Topics button has the 128px width, so we should place it exactly left from the Quests button.
if (topicsWidth == 64)
{
getWidget<MyGUI::Widget>(TopicsBTN)->setPosition(cancelLeft - topicsWidth, getWidget<MyGUI::Widget>(TopicsBTN)->getPosition().top);
}
else
{
int questLeft = getWidget<MyGUI::Widget>(QuestsBTN)->getPosition().left;
getWidget<MyGUI::Widget>(TopicsBTN)->setPosition(questLeft - topicsWidth, getWidget<MyGUI::Widget>(TopicsBTN)->getPosition().top);
}
}
mQuestMode = false;
mAllQuests = false;
mOptionsMode = false;
mTopicsMode = false;
}
void adjustButton (char const * name)
2013-05-08 11:55:15 +00:00
{
Gui::ImageButton* button = getWidget<Gui::ImageButton>(name);
2013-05-08 11:55:15 +00:00
MyGUI::IntSize diff = button->getSize() - button->getRequestedSize();
button->setSize(button->getRequestedSize());
2013-05-08 11:55:15 +00:00
if (button->getAlign().isRight())
button->setPosition(button->getPosition() + MyGUI::IntPoint(diff.width,0));
}
void onOpen()
{
2013-05-16 11:35:28 +00:00
if (!MWBase::Environment::get().getWindowManager ()->getJournalAllowed ())
{
MWBase::Environment::get().getWindowManager()->popGuiMode ();
}
mModel->load ();
setBookMode ();
Book journalBook;
if (mModel->isEmpty ())
journalBook = createEmptyJournalBook ();
else
journalBook = createJournalBook ();
pushBook (journalBook, 0);
// fast forward to the last page
if (!mStates.empty ())
{
unsigned int & page = mStates.top ().mPage;
page = mStates.top().mBook->pageCount()-1;
if (page%2)
--page;
}
updateShowingPages();
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(getWidget<MyGUI::Widget>(CloseBTN));
}
void onClose()
{
mModel->unload ();
getPage (LeftBookPage)->showPage (Book (), 0);
getPage (RightBookPage)->showPage (Book (), 0);
2013-02-09 18:44:20 +00:00
while (!mStates.empty ())
mStates.pop ();
mTopicIndexBook.reset ();
}
void setVisible (bool newValue)
{
WindowBase::setVisible (newValue);
}
void setBookMode ()
{
mOptionsMode = false;
mTopicsMode = false;
setVisible (OptionsBTN, true);
setVisible (OptionsOverlay, false);
updateShowingPages ();
updateCloseJournalButton ();
}
void setOptionsMode ()
{
mOptionsMode = true;
mTopicsMode = false;
setVisible (OptionsBTN, false);
setVisible (OptionsOverlay, true);
setVisible (PrevPageBTN, false);
setVisible (NextPageBTN, false);
setVisible (CloseBTN, false);
setVisible (JournalBTN, false);
setVisible (TopicsList, false);
setVisible (QuestsList, mQuestMode);
setVisible (LeftTopicIndex, !mQuestMode);
setVisible (RightTopicIndex, !mQuestMode);
setVisible (ShowAllBTN, mQuestMode && !mAllQuests);
setVisible (ShowActiveBTN, mQuestMode && mAllQuests);
//TODO: figure out how to make "options" page overlay book page
// correctly, so that text may show underneath
getPage (RightBookPage)->showPage (Book (), 0);
// If in quest mode, ensure the quest list is updated
if (mQuestMode)
notifyQuests(getWidget<MyGUI::Widget>(QuestsList));
2017-07-29 15:41:46 +00:00
else
notifyTopics(getWidget<MyGUI::Widget>(TopicsList));
}
void pushBook (Book book, unsigned int page)
{
DisplayState bs;
bs.mPage = page;
bs.mBook = book;
mStates.push (bs);
updateShowingPages ();
updateCloseJournalButton ();
}
void replaceBook (Book book, unsigned int page)
{
assert (!mStates.empty ());
mStates.top ().mBook = book;
mStates.top ().mPage = page;
updateShowingPages ();
}
void popBook ()
{
mStates.pop ();
updateShowingPages ();
updateCloseJournalButton ();
}
void updateCloseJournalButton ()
{
setVisible (CloseBTN, mStates.size () < 2);
setVisible (JournalBTN, mStates.size () >= 2);
}
void updateShowingPages ()
{
Book book;
unsigned int page;
unsigned int relPages;
if (!mStates.empty ())
{
book = mStates.top ().mBook;
page = mStates.top ().mPage;
relPages = book->pageCount () - page;
}
else
{
page = 0;
relPages = 0;
}
MyGUI::Widget* nextPageBtn = getWidget<MyGUI::Widget>(NextPageBTN);
MyGUI::Widget* prevPageBtn = getWidget<MyGUI::Widget>(PrevPageBTN);
MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getKeyFocusWidget();
bool nextPageVisible = relPages > 2;
nextPageBtn->setVisible(nextPageVisible);
bool prevPageVisible = page > 0;
prevPageBtn->setVisible(prevPageVisible);
if (focus == nextPageBtn && !nextPageVisible && prevPageVisible)
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(prevPageBtn);
else if (focus == prevPageBtn && !prevPageVisible && nextPageVisible)
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(nextPageBtn);
setVisible (PageOneNum, relPages > 0);
setVisible (PageTwoNum, relPages > 1);
getPage (LeftBookPage)->showPage ((relPages > 0) ? book : Book (), page+0);
getPage (RightBookPage)->showPage ((relPages > 0) ? book : Book (), page+1);
setText (PageOneNum, page + 1);
setText (PageTwoNum, page + 2);
}
void notifyKeyPress(MyGUI::Widget* sender, MyGUI::KeyCode key, MyGUI::Char character)
{
if (key == MyGUI::KeyCode::ArrowUp)
notifyPrevPage(sender);
else if (key == MyGUI::KeyCode::ArrowDown)
notifyNextPage(sender);
}
void notifyTopicClicked (intptr_t linkId)
{
Book topicBook = createTopicBook (linkId);
if (mStates.size () > 1)
replaceBook (topicBook, 0);
else
pushBook (topicBook, 0);
setVisible (OptionsOverlay, false);
setVisible (OptionsBTN, true);
setVisible (JournalBTN, true);
mOptionsMode = false;
mTopicsMode = false;
2017-07-29 15:41:46 +00:00
MWBase::Environment::get().getWindowManager()->playSound("book page");
}
void notifyTopicSelected (const std::string& topic, int id)
{
const MWBase::Journal* journal = MWBase::Environment::get().getJournal();
intptr_t topicId = 0; /// \todo get rid of intptr ids
for(MWBase::Journal::TTopicIter i = journal->topicBegin(); i != journal->topicEnd (); ++i)
{
if (Misc::StringUtils::ciEqual(i->first, topic))
topicId = intptr_t (&i->second);
}
notifyTopicClicked(topicId);
}
void notifyQuestClicked (const std::string& name, int id)
{
Book book = createQuestBook (name);
if (mStates.size () > 1)
replaceBook (book, 0);
else
pushBook (book, 0);
setVisible (OptionsOverlay, false);
setVisible (OptionsBTN, true);
setVisible (JournalBTN, true);
mOptionsMode = false;
2017-07-29 15:41:46 +00:00
MWBase::Environment::get().getWindowManager()->playSound("book page");
}
2011-12-29 16:58:58 +00:00
2013-05-06 14:04:28 +00:00
void notifyOptions(MyGUI::Widget* _sender)
{
setOptionsMode ();
if (!mTopicIndexBook)
mTopicIndexBook = createTopicIndexBook ();
getPage (LeftTopicIndex)->showPage (mTopicIndexBook, 0);
getPage (RightTopicIndex)->showPage (mTopicIndexBook, 1);
}
2013-05-06 14:04:28 +00:00
void notifyJournal(MyGUI::Widget* _sender)
{
assert (mStates.size () > 1);
popBook ();
2017-07-29 15:41:46 +00:00
MWBase::Environment::get().getWindowManager()->playSound("book page");
}
2012-01-16 16:46:25 +00:00
2017-08-04 16:21:13 +00:00
void notifyIndexLinkClicked (MWGui::TypesetBook::InteractiveId index)
{
setVisible (LeftTopicIndex, false);
setVisible (RightTopicIndex, false);
setVisible (TopicsList, true);
mTopicsMode = true;
Gui::MWList* list = getWidget<Gui::MWList>(TopicsList);
list->clear();
AddNamesToList add(list);
2017-08-04 16:21:13 +00:00
mModel->visitTopicNamesStartingWith(index, add);
list->adjustSize();
2017-07-29 15:41:46 +00:00
MWBase::Environment::get().getWindowManager()->playSound("book page");
}
2013-05-06 14:04:28 +00:00
void notifyTopics(MyGUI::Widget* _sender)
{
mQuestMode = false;
mTopicsMode = false;
setVisible (LeftTopicIndex, true);
setVisible (RightTopicIndex, true);
setVisible (TopicsList, false);
setVisible (QuestsList, false);
setVisible (ShowAllBTN, false);
setVisible (ShowActiveBTN, false);
2017-07-29 15:41:46 +00:00
MWBase::Environment::get().getWindowManager()->playSound("book page");
}
struct AddNamesToList
{
AddNamesToList(Gui::MWList* list) : mList(list) {}
Gui::MWList* mList;
void operator () (const std::string& name, bool finished=false)
{
mList->addItem(name);
}
};
struct SetNamesInactive
{
SetNamesInactive(Gui::MWList* list) : mList(list) {}
Gui::MWList* mList;
void operator () (const std::string& name, bool finished)
{
if (finished)
{
mList->getItemWidget(name)->setStateSelected(true);
}
}
};
2013-05-06 14:04:28 +00:00
void notifyQuests(MyGUI::Widget* _sender)
{
mQuestMode = true;
setVisible (LeftTopicIndex, false);
setVisible (RightTopicIndex, false);
setVisible (TopicsList, false);
setVisible (QuestsList, true);
setVisible (ShowAllBTN, !mAllQuests);
setVisible (ShowActiveBTN, mAllQuests);
Gui::MWList* list = getWidget<Gui::MWList>(QuestsList);
list->clear();
AddNamesToList add(list);
mModel->visitQuestNames(!mAllQuests, add);
list->adjustSize();
if (mAllQuests)
{
SetNamesInactive setInactive(list);
Some PVS-Studio and cppcheck fixes cppcheck: [apps/esmtool/record.cpp:697]: (performance) Prefer prefix ++/-- operators for non-primitive types. [apps/esmtool/record.cpp:1126]: (performance) Prefer prefix ++/-- operators for non-primitive types. [apps/esmtool/record.cpp:1138]: (performance) Prefer prefix ++/-- operators for non-primitive types. [apps/niftest/niftest.cpp:36]: (performance) Function parameter 'filename' should be passed by reference. [apps/niftest/niftest.cpp:41]: (performance) Function parameter 'filename' should be passed by reference. [apps/opencs/model/prefs/boolsetting.cpp:25]: (warning) Possible leak in public function. The pointer 'mWidget' is not deallocated before it is allocated. [apps/opencs/model/prefs/shortcuteventhandler.cpp:52]: (warning) Return value of std::remove() ignored. Elements remain in container. [apps/openmw/mwstate/quicksavemanager.cpp:5]: (performance) Variable 'mSaveName' is assigned in constructor body. Consider performing initialization in initialization list. PVS-Studio: apps/opencs/model/filter/parser.cpp 582 warn V560 A part of conditional expression is always true: allowPredefined. apps/opencs/view/world/referencecreator.cpp 67 warn V547 Expression '!errors.empty()' is always false. apps/opencs/view/world/referencecreator.cpp 74 warn V547 Expression '!errors.empty()' is always false. apps/opencs/view/doc/loader.cpp 170 warn V560 A part of conditional expression is always true: !completed. apps/opencs/view/doc/loader.cpp 170 warn V560 A part of conditional expression is always true: !error.empty(). apps/opencs/model/tools/pathgridcheck.cpp 32 err V517 The use of 'if (A) {...} else if (A) {...}' pattern was detected. There is a probability of logical error presence. Check lines: 32, 34. apps/opencs/model/world/refidadapterimp.cpp 1376 err V547 Expression 'subColIndex < 3' is always true. apps/openmw/mwgui/widgets.hpp 318 warn V703 It is odd that the 'mEnableRepeat' field in derived class 'MWScrollBar' overwrites field in base class 'ScrollBar'. Check lines: widgets.hpp:318, MyGUI_ScrollBar.h:179. apps/openmw/mwgui/widgets.hpp 319 warn V703 It is odd that the 'mRepeatTriggerTime' field in derived class 'MWScrollBar' overwrites field in base class 'ScrollBar'. Check lines: widgets.hpp:319, MyGUI_ScrollBar.h:180. apps/openmw/mwgui/widgets.hpp 320 warn V703 It is odd that the 'mRepeatStepTime' field in derived class 'MWScrollBar' overwrites field in base class 'ScrollBar'. Check lines: widgets.hpp:320, MyGUI_ScrollBar.h:181 apps/openmw/mwmechanics/actors.cpp 1425 warn V547 Expression '!detected' is always true. apps/openmw/mwmechanics/character.cpp 2155 err V547 Expression 'mode == 0' is always true. apps/openmw/mwmechanics/character.cpp 1192 warn V592 The expression was enclosed by parentheses twice: ((expression)). One pair of parentheses is unnecessary or misprint is present. apps/openmw/mwmechanics/character.cpp 521 warn V560 A part of conditional expression is always true: (idle == mIdleState). apps/openmw/mwmechanics/pathfinding.cpp 317 err V547 Expression 'mPath.size() >= 2' is always true. apps/openmw/mwscript/interpretercontext.cpp 409 warn V560 A part of conditional expression is always false: rank > 9. apps/openmw/mwgui/windowbase.cpp 28 warn V560 A part of conditional expression is always true: !visible. apps/openmw/mwgui/journalwindow.cpp 561 warn V547 Expression '!mAllQuests' is always false. apps/openmw/mwgui/referenceinterface.cpp 18 warn V571 Recurring check. The '!mPtr.isEmpty()' condition was already verified in line 16. apps/openmw/mwworld/scene.cpp 463 warn V547 Expression 'adjustPlayerPos' is always true. apps/openmw/mwworld/worldimp.cpp 409 err V766 An item with the same key '"sCompanionShare"' has already been added. apps/openmw/mwworld/cellstore.cpp 691 warn V519 The 'state.mWaterLevel' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 689, 691. apps/openmw/mwworld/weather.cpp 1125 warn V519 The 'mResult.mParticleEffect' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 1123, 1125. apps/openmw/mwworld/weather.cpp 1137 warn V519 The 'mResult.mParticleEffect' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 1135, 1137. apps/wizard/unshield/unshieldworker.cpp 475 warn V728 An excessive check can be simplified. The '(A && B) || (!A && !B)' expression is equivalent to the 'bool(A) == bool(B)' expression. apps/wizard/installationpage.cpp 163 warn V735 Possibly an incorrect HTML. The "</p" closing tag was encountered, while the "</span" tag was expected. components/fontloader/fontloader.cpp 427 err V547 Expression 'i == 1' is always true. components/nifosg/nifloader.cpp 282 warn V519 The 'created' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 278, 282. components/esm/loadregn.cpp 119 err V586 The 'clear' function is called twice for deallocation of the same resource. Check lines: 112, 119. components/esm/cellref.cpp 178 warn V581 The conditional expressions of the 'if' statements situated alongside each other are identical. Check lines: 175, 178. components/esmterrain/storage.cpp 235 warn V560 A part of conditional expression is always true: colStart == 0. components/esmterrain/storage.cpp 237 warn V560 A part of conditional expression is always true: rowStart == 0.
2018-04-09 15:55:16 +00:00
mModel->visitQuestNames(false, setInactive);
}
2017-07-29 15:41:46 +00:00
MWBase::Environment::get().getWindowManager()->playSound("book page");
}
2013-05-06 14:04:28 +00:00
void notifyShowAll(MyGUI::Widget* _sender)
{
mAllQuests = true;
notifyQuests(_sender);
}
2013-05-06 14:04:28 +00:00
void notifyShowActive(MyGUI::Widget* _sender)
{
mAllQuests = false;
notifyQuests(_sender);
}
2013-05-06 14:04:28 +00:00
void notifyCancel(MyGUI::Widget* _sender)
{
if (mTopicsMode)
{
notifyTopics(_sender);
}
else
{
setBookMode();
MWBase::Environment::get().getWindowManager()->playSound("book page");
}
2017-07-29 15:41:46 +00:00
}
2013-05-06 14:04:28 +00:00
void notifyClose(MyGUI::Widget* _sender)
{
MWBase::WindowManager *winMgr = MWBase::Environment::get().getWindowManager();
winMgr->playSound("book close");
winMgr->popGuiMode();
}
void notifyMouseWheel(MyGUI::Widget* sender, int rel)
{
if (rel < 0)
notifyNextPage(sender);
else
notifyPrevPage(sender);
}
2013-05-06 14:04:28 +00:00
void notifyNextPage(MyGUI::Widget* _sender)
{
if (mOptionsMode)
return;
if (!mStates.empty ())
{
unsigned int & page = mStates.top ().mPage;
Book book = mStates.top ().mBook;
if (page+2 < book->pageCount())
{
MWBase::Environment::get().getWindowManager()->playSound("book page", true);
2017-07-29 15:41:46 +00:00
page += 2;
updateShowingPages ();
}
}
}
2013-05-06 14:04:28 +00:00
void notifyPrevPage(MyGUI::Widget* _sender)
{
if (mOptionsMode)
return;
if (!mStates.empty ())
{
unsigned int & page = mStates.top ().mPage;
if(page >= 2)
{
MWBase::Environment::get().getWindowManager()->playSound("book page", true);
2017-07-29 15:41:46 +00:00
page -= 2;
updateShowingPages ();
}
}
}
};
2012-01-17 12:53:27 +00:00
}
// glue the implementation to the interface
MWGui::JournalWindow * MWGui::JournalWindow::create (JournalViewModel::Ptr Model, bool questList, ToUTF8::FromType encoding)
{
return new JournalWindowImpl (Model, questList, encoding);
}
MWGui::JournalWindow::JournalWindow()
:WindowBase("openmw_journal.layout")
{
}