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

View File

@ -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 <wx/datetime.h> // wxWidgets
// ------------
// Aui events

View File

@ -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))

View File

@ -67,12 +67,13 @@ private:
ConsoleListener *m_console;
LogManager *m_LogManager;
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
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();