Remove getEncoding() from WindowManager

new-script-api
Andrei Kortunov 7 years ago
parent 67acb83b62
commit 3571f7f413

@ -351,7 +351,6 @@ namespace MWBase
virtual void writeFog(MWWorld::CellStore* cell) = 0;
virtual const MWGui::TextColours& getTextColours() = 0;
virtual ToUTF8::FromType getEncoding() = 0;
virtual bool injectKeyPress(MyGUI::KeyCode key, unsigned int text) = 0;
};
}

@ -156,8 +156,8 @@ MWGui::BookTypesetter::Utf8Span to_utf8_span (char const * text)
typedef TypesetBook::Ptr book;
JournalBooks::JournalBooks (JournalViewModel::Ptr model) :
mModel (model)
JournalBooks::JournalBooks (JournalViewModel::Ptr model, ToUTF8::FromType encoding) :
mModel (model), mEncoding(encoding)
{
}
@ -220,8 +220,7 @@ book JournalBooks::createQuestBook (const std::string& questName)
book JournalBooks::createTopicIndexBook ()
{
ToUTF8::FromType encoding = MWBase::Environment::get().getWindowManager()->getEncoding();
bool isRussian = (encoding == ToUTF8::WINDOWS_1251);
bool isRussian = (mEncoding == ToUTF8::WINDOWS_1251);
BookTypesetter::Ptr typesetter = isRussian ? createCyrillicJournalIndex() : createLatinJournalIndex();

@ -4,6 +4,8 @@
#include "bookpage.hpp"
#include "journalviewmodel.hpp"
#include <components/to_utf8/to_utf8.hpp>
namespace MWGui
{
MWGui::BookTypesetter::Utf8Span to_utf8_span (char const * text);
@ -13,7 +15,7 @@ namespace MWGui
typedef TypesetBook::Ptr Book;
JournalViewModel::Ptr mModel;
JournalBooks (JournalViewModel::Ptr model);
JournalBooks (JournalViewModel::Ptr model, ToUTF8::FromType encoding);
Book createEmptyJournalBook ();
Book createJournalBook ();
@ -22,6 +24,8 @@ namespace MWGui
Book createQuestBook (const std::string& questName);
Book createTopicIndexBook ();
ToUTF8::FromType mEncoding;
private:
BookTypesetter::Ptr createTypesetter ();
BookTypesetter::Ptr createLatinJournalIndex ();

@ -100,8 +100,8 @@ namespace
return getWidget <MWGui::BookPage> (name);
}
JournalWindowImpl (MWGui::JournalViewModel::Ptr Model, bool questList)
: JournalBooks (Model), JournalWindow()
JournalWindowImpl (MWGui::JournalViewModel::Ptr Model, bool questList, ToUTF8::FromType encoding)
: JournalBooks (Model, encoding), JournalWindow()
{
center();
@ -643,9 +643,9 @@ namespace
}
// glue the implementation to the interface
MWGui::JournalWindow * MWGui::JournalWindow::create (JournalViewModel::Ptr Model, bool questList)
MWGui::JournalWindow * MWGui::JournalWindow::create (JournalViewModel::Ptr Model, bool questList, ToUTF8::FromType encoding)
{
return new JournalWindowImpl (Model, questList);
return new JournalWindowImpl (Model, questList, encoding);
}
MWGui::JournalWindow::JournalWindow()

@ -3,6 +3,8 @@
#include "windowbase.hpp"
#include <components/to_utf8/to_utf8.hpp>
#include <memory>
namespace MWBase { class WindowManager; }
@ -16,7 +18,7 @@ namespace MWGui
JournalWindow();
/// construct a new instance of the one JournalWindow implementation
static JournalWindow * create (std::shared_ptr <JournalViewModel> Model, bool questList);
static JournalWindow * create (std::shared_ptr <JournalViewModel> Model, bool questList, ToUTF8::FromType encoding);
/// destroy this instance of the JournalWindow implementation
virtual ~JournalWindow () {};

@ -347,7 +347,7 @@ namespace MWGui
mGuiModeStates[GM_Console] = GuiModeState(mConsole);
bool questList = mResourceSystem->getVFS()->exists("textures/tx_menubook_options_over.dds");
JournalWindow* journal = JournalWindow::create(JournalViewModel::create (), questList);
JournalWindow* journal = JournalWindow::create(JournalViewModel::create (), questList, mEncoding);
mWindows.push_back(journal);
mGuiModeStates[GM_Journal] = GuiModeState(journal);
mGuiModeStates[GM_Journal].mCloseSound = "book close";
@ -2034,11 +2034,6 @@ namespace MWGui
return mTextColours;
}
ToUTF8::FromType WindowManager::getEncoding()
{
return mEncoding;
}
bool WindowManager::injectKeyPress(MyGUI::KeyCode key, unsigned int text)
{
if (!mKeyboardNavigation->injectKeyPress(key, text))

@ -378,7 +378,6 @@ namespace MWGui
void writeFog(MWWorld::CellStore* cell);
virtual const MWGui::TextColours& getTextColours();
virtual ToUTF8::FromType getEncoding();
virtual bool injectKeyPress(MyGUI::KeyCode key, unsigned int text);

Loading…
Cancel
Save