mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 17:26:38 +00:00 
			
		
		
		
	Remove getEncoding() from WindowManager
This commit is contained in:
		
							parent
							
								
									67acb83b62
								
							
						
					
					
						commit
						3571f7f413
					
				
					 7 changed files with 16 additions and 18 deletions
				
			
		|  | @ -351,7 +351,6 @@ namespace MWBase | ||||||
|             virtual void writeFog(MWWorld::CellStore* cell) = 0; |             virtual void writeFog(MWWorld::CellStore* cell) = 0; | ||||||
| 
 | 
 | ||||||
|             virtual const MWGui::TextColours& getTextColours() = 0; |             virtual const MWGui::TextColours& getTextColours() = 0; | ||||||
|             virtual ToUTF8::FromType getEncoding() = 0; |  | ||||||
|             virtual bool injectKeyPress(MyGUI::KeyCode key, unsigned int text) = 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; | typedef TypesetBook::Ptr book; | ||||||
| 
 | 
 | ||||||
| JournalBooks::JournalBooks (JournalViewModel::Ptr model) : | JournalBooks::JournalBooks (JournalViewModel::Ptr model, ToUTF8::FromType encoding) : | ||||||
|     mModel (model) |     mModel (model), mEncoding(encoding) | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -220,8 +220,7 @@ book JournalBooks::createQuestBook (const std::string& questName) | ||||||
| 
 | 
 | ||||||
| book JournalBooks::createTopicIndexBook () | book JournalBooks::createTopicIndexBook () | ||||||
| { | { | ||||||
|     ToUTF8::FromType encoding = MWBase::Environment::get().getWindowManager()->getEncoding(); |     bool isRussian = (mEncoding == ToUTF8::WINDOWS_1251); | ||||||
|     bool isRussian = (encoding == ToUTF8::WINDOWS_1251); |  | ||||||
| 
 | 
 | ||||||
|     BookTypesetter::Ptr typesetter = isRussian ? createCyrillicJournalIndex() : createLatinJournalIndex(); |     BookTypesetter::Ptr typesetter = isRussian ? createCyrillicJournalIndex() : createLatinJournalIndex(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -4,6 +4,8 @@ | ||||||
| #include "bookpage.hpp" | #include "bookpage.hpp" | ||||||
| #include "journalviewmodel.hpp" | #include "journalviewmodel.hpp" | ||||||
| 
 | 
 | ||||||
|  | #include <components/to_utf8/to_utf8.hpp> | ||||||
|  | 
 | ||||||
| namespace MWGui | namespace MWGui | ||||||
| { | { | ||||||
|     MWGui::BookTypesetter::Utf8Span to_utf8_span (char const * text); |     MWGui::BookTypesetter::Utf8Span to_utf8_span (char const * text); | ||||||
|  | @ -13,7 +15,7 @@ namespace MWGui | ||||||
|         typedef TypesetBook::Ptr Book; |         typedef TypesetBook::Ptr Book; | ||||||
|         JournalViewModel::Ptr mModel; |         JournalViewModel::Ptr mModel; | ||||||
| 
 | 
 | ||||||
|         JournalBooks (JournalViewModel::Ptr model); |         JournalBooks (JournalViewModel::Ptr model, ToUTF8::FromType encoding); | ||||||
| 
 | 
 | ||||||
|         Book createEmptyJournalBook (); |         Book createEmptyJournalBook (); | ||||||
|         Book createJournalBook (); |         Book createJournalBook (); | ||||||
|  | @ -22,6 +24,8 @@ namespace MWGui | ||||||
|         Book createQuestBook (const std::string& questName); |         Book createQuestBook (const std::string& questName); | ||||||
|         Book createTopicIndexBook (); |         Book createTopicIndexBook (); | ||||||
| 
 | 
 | ||||||
|  |         ToUTF8::FromType mEncoding; | ||||||
|  | 
 | ||||||
|     private: |     private: | ||||||
|         BookTypesetter::Ptr createTypesetter (); |         BookTypesetter::Ptr createTypesetter (); | ||||||
|         BookTypesetter::Ptr createLatinJournalIndex (); |         BookTypesetter::Ptr createLatinJournalIndex (); | ||||||
|  |  | ||||||
|  | @ -100,8 +100,8 @@ namespace | ||||||
|             return getWidget <MWGui::BookPage> (name); |             return getWidget <MWGui::BookPage> (name); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         JournalWindowImpl (MWGui::JournalViewModel::Ptr Model, bool questList) |         JournalWindowImpl (MWGui::JournalViewModel::Ptr Model, bool questList, ToUTF8::FromType encoding) | ||||||
|             : JournalBooks (Model), JournalWindow() |             : JournalBooks (Model, encoding), JournalWindow() | ||||||
|         { |         { | ||||||
|             center(); |             center(); | ||||||
| 
 | 
 | ||||||
|  | @ -643,9 +643,9 @@ namespace | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // glue the implementation to the interface
 | // 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() | MWGui::JournalWindow::JournalWindow() | ||||||
|  |  | ||||||
|  | @ -3,6 +3,8 @@ | ||||||
| 
 | 
 | ||||||
| #include "windowbase.hpp" | #include "windowbase.hpp" | ||||||
| 
 | 
 | ||||||
|  | #include <components/to_utf8/to_utf8.hpp> | ||||||
|  | 
 | ||||||
| #include <memory> | #include <memory> | ||||||
| 
 | 
 | ||||||
| namespace MWBase { class WindowManager; } | namespace MWBase { class WindowManager; } | ||||||
|  | @ -16,7 +18,7 @@ namespace MWGui | ||||||
|         JournalWindow(); |         JournalWindow(); | ||||||
| 
 | 
 | ||||||
|         /// construct a new instance of the one JournalWindow implementation
 |         /// 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
 |         /// destroy this instance of the JournalWindow implementation
 | ||||||
|         virtual ~JournalWindow () {}; |         virtual ~JournalWindow () {}; | ||||||
|  |  | ||||||
|  | @ -347,7 +347,7 @@ namespace MWGui | ||||||
|         mGuiModeStates[GM_Console] = GuiModeState(mConsole); |         mGuiModeStates[GM_Console] = GuiModeState(mConsole); | ||||||
| 
 | 
 | ||||||
|         bool questList = mResourceSystem->getVFS()->exists("textures/tx_menubook_options_over.dds"); |         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); |         mWindows.push_back(journal); | ||||||
|         mGuiModeStates[GM_Journal] = GuiModeState(journal); |         mGuiModeStates[GM_Journal] = GuiModeState(journal); | ||||||
|         mGuiModeStates[GM_Journal].mCloseSound = "book close"; |         mGuiModeStates[GM_Journal].mCloseSound = "book close"; | ||||||
|  | @ -2034,11 +2034,6 @@ namespace MWGui | ||||||
|         return mTextColours; |         return mTextColours; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     ToUTF8::FromType WindowManager::getEncoding() |  | ||||||
|     { |  | ||||||
|         return mEncoding; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     bool WindowManager::injectKeyPress(MyGUI::KeyCode key, unsigned int text) |     bool WindowManager::injectKeyPress(MyGUI::KeyCode key, unsigned int text) | ||||||
|     { |     { | ||||||
|         if (!mKeyboardNavigation->injectKeyPress(key, text)) |         if (!mKeyboardNavigation->injectKeyPress(key, text)) | ||||||
|  |  | ||||||
|  | @ -378,7 +378,6 @@ namespace MWGui | ||||||
|     void writeFog(MWWorld::CellStore* cell); |     void writeFog(MWWorld::CellStore* cell); | ||||||
| 
 | 
 | ||||||
|     virtual const MWGui::TextColours& getTextColours(); |     virtual const MWGui::TextColours& getTextColours(); | ||||||
|     virtual ToUTF8::FromType getEncoding(); |  | ||||||
| 
 | 
 | ||||||
|     virtual bool injectKeyPress(MyGUI::KeyCode key, unsigned int text); |     virtual bool injectKeyPress(MyGUI::KeyCode key, unsigned int text); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue