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
This commit is contained in:
Glenn Rice 2011-02-19 04:43:51 +00:00
parent c6c0137df4
commit ad666d5e5c
4 changed files with 22 additions and 30 deletions

View File

@ -76,6 +76,7 @@
<msgfmt Include="nl.po" /> <msgfmt Include="nl.po" />
<msgfmt Include="pl.po" /> <msgfmt Include="pl.po" />
<msgfmt Include="pt_BR.po" /> <msgfmt Include="pt_BR.po" />
<msgfmt Include="pt.po" />
<msgfmt Include="ru.po" /> <msgfmt Include="ru.po" />
<msgfmt Include="tr.po" /> <msgfmt Include="tr.po" />
<msgfmt Include="zh_CN.po" /> <msgfmt Include="zh_CN.po" />
@ -100,6 +101,7 @@
<None Include="nl.po" /> <None Include="nl.po" />
<None Include="pl.po" /> <None Include="pl.po" />
<None Include="pt_BR.po" /> <None Include="pt_BR.po" />
<None Include="pt.po" />
<None Include="ru.po" /> <None Include="ru.po" />
<None Include="tr.po" /> <None Include="tr.po" />
<None Include="zh_CN.po" /> <None Include="zh_CN.po" />

View File

@ -15,35 +15,14 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Setup.h" // Common
#include "NetWindow.h"
#include "Common.h" // Common #include "Common.h" // Common
#include "FileUtil.h" #include "ConsoleListener.h"
#include "FileSearch.h"
#include "Timer.h"
#include "Globals.h" // Local #include "Globals.h" // Local
#include "Frame.h" #include "Frame.h"
#include "ConfigMain.h"
#include "CheatsWindow.h"
#include "AboutDolphin.h"
#include "GameListCtrl.h"
#include "BootManager.h"
#include "LogWindow.h" #include "LogWindow.h"
#include "WxUtils.h"
#include "ConfigManager.h" // Core #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 <wx/datetime.h> // wxWidgets
// ------------ // ------------
// Aui events // Aui events

View File

@ -69,6 +69,9 @@ CLogWindow::CLogWindow(CFrame *parent, wxWindowID id, const wxPoint& pos,
LoadSettings(); LoadSettings();
m_WrapLine->SetValue(m_bWrapLines);
ToggleWrapLine(m_bWrapLines);
m_LogTimer = new wxTimer(this, IDTM_UPDATELOG); m_LogTimer = new wxTimer(this, IDTM_UPDATELOG);
m_LogTimer->Start(UPDATETIME); m_LogTimer->Start(UPDATETIME);
} }
@ -88,8 +91,7 @@ void CLogWindow::CreateGUIControls()
LogFont.push_back(MonoSpaceFont); LogFont.push_back(MonoSpaceFont);
LogFont.push_back(DebuggerFont); LogFont.push_back(DebuggerFont);
// Line wrap m_WrapLine = new wxCheckBox(this, IDM_WRAPLINE, _("Word Wrap"));
wxCheckBox * m_WrapLine = new wxCheckBox(this, IDM_WRAPLINE, _("Word Wrap"));
// Log viewer and submit row // Log viewer and submit row
m_Log = CreateTextCtrl(this, IDM_LOG, wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP); 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("LogWindow", "pos", winpos);
} }
ini.Set("Options", "Font", m_FontChoice->GetSelection()); ini.Set("Options", "Font", m_FontChoice->GetSelection());
ini.Set("Options", "WrapLines", m_bWrapLines);
ini.Save(File::GetUserPath(F_LOGGERCONFIG_IDX)); ini.Save(File::GetUserPath(F_LOGGERCONFIG_IDX));
} }
@ -176,6 +179,8 @@ void CLogWindow::LoadSettings()
if (m_FontChoice->GetSelection() < (int)LogFont.size()) if (m_FontChoice->GetSelection() < (int)LogFont.size())
m_Log->SetDefaultStyle(wxTextAttr(wxNullColour, wxNullColour, LogFont[m_FontChoice->GetSelection()])); 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", "WriteToFile", &m_writeFile, false);
ini.Get("Options", "WriteToConsole", &m_writeConsole, true); ini.Get("Options", "WriteToConsole", &m_writeConsole, true);
ini.Get("Options", "WriteToWindow", &m_writeWindow, 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 // When an option is changed, save the change
void CLogWindow::OnWrapLineCheck(wxCommandEvent& event) void CLogWindow::OnWrapLineCheck(wxCommandEvent& event)
{ {
wxString Text; m_bWrapLines ^= true;
ToggleWrapLine(event.IsChecked());
SaveSettings();
}
void CLogWindow::ToggleWrapLine(bool word_wrap)
{
#ifdef __WXGTK__ #ifdef __WXGTK__
m_Log->SetWindowStyleFlag(m_Log->GetWindowStyleFlag() ^ (wxTE_WORDWRAP | wxTE_DONTWRAP)); m_Log->SetWindowStyleFlag(m_Log->GetWindowStyleFlag() ^ (wxTE_WORDWRAP | wxTE_DONTWRAP));
#else #else
wxString Text;
// Unfortunately wrapping styles can only be changed dynamically with wxGTK // Unfortunately wrapping styles can only be changed dynamically with wxGTK
// Notice: To retain the colors when changing word wrapping we need to // 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 // loop through every letter with GetStyle and then reapply them letter by letter
@ -278,7 +289,7 @@ void CLogWindow::OnWrapLineCheck(wxCommandEvent& event)
UnPopulateRight(); UnPopulateRight();
Text = m_Log->GetValue(); Text = m_Log->GetValue();
m_Log->Destroy(); m_Log->Destroy();
if (event.IsChecked()) if (word_wrap)
m_Log = CreateTextCtrl(this, IDM_LOG, m_Log = CreateTextCtrl(this, IDM_LOG,
wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_WORDWRAP); wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_WORDWRAP);
else else
@ -289,8 +300,6 @@ void CLogWindow::OnWrapLineCheck(wxCommandEvent& event)
PopulateRight(); PopulateRight();
m_LogAccess = true; m_LogAccess = true;
#endif #endif
SaveSettings();
} }
void CLogWindow::OnLogTimer(wxTimerEvent& WXUNUSED(event)) void CLogWindow::OnLogTimer(wxTimerEvent& WXUNUSED(event))

View File

@ -67,12 +67,13 @@ private:
ConsoleListener *m_console; ConsoleListener *m_console;
LogManager *m_LogManager; LogManager *m_LogManager;
std::queue<std::pair<u8, wxString> > msgQueue; std::queue<std::pair<u8, wxString> > msgQueue;
bool m_writeFile, m_writeConsole, m_writeWindow, m_LogAccess; bool m_writeFile, m_writeConsole, m_writeWindow, m_LogAccess, m_bWrapLines;
// Controls // Controls
wxBoxSizer *sBottom; wxBoxSizer *sBottom;
wxTextCtrl *m_Log, *m_cmdline; wxTextCtrl *m_Log, *m_cmdline;
wxChoice *m_FontChoice; wxChoice *m_FontChoice;
wxCheckBox *m_WrapLine;
Common::CriticalSection m_LogSection; Common::CriticalSection m_LogSection;
@ -88,6 +89,7 @@ private:
void OnSubmit(wxCommandEvent& event); void OnSubmit(wxCommandEvent& event);
void OnFontChange(wxCommandEvent& event); void OnFontChange(wxCommandEvent& event);
void OnWrapLineCheck(wxCommandEvent& event); void OnWrapLineCheck(wxCommandEvent& event);
void ToggleWrapLine(bool word_wrap);
void OnClear(wxCommandEvent& event); void OnClear(wxCommandEvent& event);
void OnLogTimer(wxTimerEvent& WXUNUSED(event)); void OnLogTimer(wxTimerEvent& WXUNUSED(event));
void UpdateLog(); void UpdateLog();