From ad666d5e5c86bdf7bacc3e031e737a5bbf63dfc1 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Sat, 19 Feb 2011 04:43:51 +0000 Subject: [PATCH] Save and load the line wrap option of the log window from ini. Add Portuguese translation to the windows build. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7198 8ced0084-cf51-0410-be5f-012b33b47a6e --- Languages/Languages.vcxproj | 2 ++ Source/Core/DolphinWX/Src/FrameAui.cpp | 23 +---------------------- Source/Core/DolphinWX/Src/LogWindow.cpp | 21 +++++++++++++++------ Source/Core/DolphinWX/Src/LogWindow.h | 6 ++++-- 4 files changed, 22 insertions(+), 30 deletions(-) diff --git a/Languages/Languages.vcxproj b/Languages/Languages.vcxproj index b589a1088d..9b2e31fb2a 100644 --- a/Languages/Languages.vcxproj +++ b/Languages/Languages.vcxproj @@ -76,6 +76,7 @@ + @@ -100,6 +101,7 @@ + diff --git a/Source/Core/DolphinWX/Src/FrameAui.cpp b/Source/Core/DolphinWX/Src/FrameAui.cpp index db393b1173..3021f24f23 100644 --- a/Source/Core/DolphinWX/Src/FrameAui.cpp +++ b/Source/Core/DolphinWX/Src/FrameAui.cpp @@ -15,35 +15,14 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ -#include "Setup.h" // Common - -#include "NetWindow.h" - #include "Common.h" // Common -#include "FileUtil.h" -#include "FileSearch.h" -#include "Timer.h" +#include "ConsoleListener.h" #include "Globals.h" // Local #include "Frame.h" -#include "ConfigMain.h" -#include "CheatsWindow.h" -#include "AboutDolphin.h" -#include "GameListCtrl.h" -#include "BootManager.h" #include "LogWindow.h" -#include "WxUtils.h" #include "ConfigManager.h" // Core -#include "ConsoleListener.h" -#include "Core.h" -#include "OnFrame.h" -#include "HW/DVDInterface.h" -#include "State.h" -#include "VolumeHandler.h" -#include "NANDContentLoader.h" - -#include // wxWidgets // ------------ // Aui events diff --git a/Source/Core/DolphinWX/Src/LogWindow.cpp b/Source/Core/DolphinWX/Src/LogWindow.cpp index 9de3dd36b0..e263f1a790 100644 --- a/Source/Core/DolphinWX/Src/LogWindow.cpp +++ b/Source/Core/DolphinWX/Src/LogWindow.cpp @@ -69,6 +69,9 @@ CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxPoint& pos, LoadSettings(); + m_WrapLine->SetValue(m_bWrapLines); + ToggleWrapLine(m_bWrapLines); + m_LogTimer = new wxTimer(this, IDTM_UPDATELOG); m_LogTimer->Start(UPDATETIME); } @@ -88,8 +91,7 @@ void CLogWindow::CreateGUIControls() LogFont.push_back(MonoSpaceFont); LogFont.push_back(DebuggerFont); - // Line wrap - wxCheckBox * m_WrapLine = new wxCheckBox(this, IDM_WRAPLINE, _("Word Wrap")); + m_WrapLine = new wxCheckBox(this, IDM_WRAPLINE, _("Word Wrap")); // Log viewer and submit row m_Log = CreateTextCtrl(this, IDM_LOG, wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP); @@ -154,6 +156,7 @@ void CLogWindow::SaveSettings() ini.Set("LogWindow", "pos", winpos); } ini.Set("Options", "Font", m_FontChoice->GetSelection()); + ini.Set("Options", "WrapLines", m_bWrapLines); ini.Save(File::GetUserPath(F_LOGGERCONFIG_IDX)); } @@ -176,6 +179,8 @@ void CLogWindow::LoadSettings() if (m_FontChoice->GetSelection() < (int)LogFont.size()) m_Log->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, LogFont[m_FontChoice->GetSelection()])); + ini.Get("Options", "WrapLines", &m_bWrapLines, false); + ini.Get("Options", "WriteToFile", &m_writeFile, false); ini.Get("Options", "WriteToConsole", &m_writeConsole, true); ini.Get("Options", "WriteToWindow", &m_writeWindow, true); @@ -265,11 +270,17 @@ void CLogWindow::OnFontChange(wxCommandEvent& event) // When an option is changed, save the change void CLogWindow::OnWrapLineCheck(wxCommandEvent& event) { - wxString Text; + m_bWrapLines ^= true; + ToggleWrapLine(event.IsChecked()); + SaveSettings(); +} +void CLogWindow::ToggleWrapLine(bool word_wrap) +{ #ifdef __WXGTK__ m_Log->SetWindowStyleFlag(m_Log->GetWindowStyleFlag() ^ (wxTE_WORDWRAP | wxTE_DONTWRAP)); #else + wxString Text; // Unfortunately wrapping styles can only be changed dynamically with wxGTK // Notice: To retain the colors when changing word wrapping we need to // loop through every letter with GetStyle and then reapply them letter by letter @@ -278,7 +289,7 @@ void CLogWindow::OnWrapLineCheck(wxCommandEvent& event) UnPopulateRight(); Text = m_Log->GetValue(); m_Log->Destroy(); - if (event.IsChecked()) + if (word_wrap) m_Log = CreateTextCtrl(this, IDM_LOG, wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_WORDWRAP); else @@ -289,8 +300,6 @@ void CLogWindow::OnWrapLineCheck(wxCommandEvent& event) PopulateRight(); m_LogAccess = true; #endif - - SaveSettings(); } void CLogWindow::OnLogTimer(wxTimerEvent& WXUNUSED(event)) diff --git a/Source/Core/DolphinWX/Src/LogWindow.h b/Source/Core/DolphinWX/Src/LogWindow.h index 55fcc37f0c..2cd30f02e6 100644 --- a/Source/Core/DolphinWX/Src/LogWindow.h +++ b/Source/Core/DolphinWX/Src/LogWindow.h @@ -67,12 +67,13 @@ private: ConsoleListener *m_console; LogManager *m_LogManager; std::queue > msgQueue; - bool m_writeFile, m_writeConsole, m_writeWindow, m_LogAccess; + bool m_writeFile, m_writeConsole, m_writeWindow, m_LogAccess, m_bWrapLines; // Controls wxBoxSizer *sBottom; wxTextCtrl *m_Log, *m_cmdline; - wxChoice * m_FontChoice; + wxChoice *m_FontChoice; + wxCheckBox *m_WrapLine; Common::CriticalSection m_LogSection; @@ -88,6 +89,7 @@ private: void OnSubmit(wxCommandEvent& event); void OnFontChange(wxCommandEvent& event); void OnWrapLineCheck(wxCommandEvent& event); + void ToggleWrapLine(bool word_wrap); void OnClear(wxCommandEvent& event); void OnLogTimer(wxTimerEvent& WXUNUSED(event)); void UpdateLog();