mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
Use only section-based ini reading.
This commit is contained in:
@ -62,14 +62,15 @@ void CCodeWindow::Load()
|
||||
|
||||
// The font to override DebuggerFont with
|
||||
std::string fontDesc;
|
||||
ini.Get("General", "DebuggerFont", &fontDesc);
|
||||
|
||||
IniFile::Section* general = ini.GetOrCreateSection("General");
|
||||
general->Get("DebuggerFont", &fontDesc);
|
||||
general->Get("AutomaticStart", &bAutomaticStart, false);
|
||||
general->Get("BootToPause", &bBootToPause, true);
|
||||
|
||||
if (!fontDesc.empty())
|
||||
DebuggerFont.SetNativeFontInfoUserDesc(StrToWxStr(fontDesc));
|
||||
|
||||
// Boot to pause or not
|
||||
ini.Get("General", "AutomaticStart", &bAutomaticStart, false);
|
||||
ini.Get("General", "BootToPause", &bBootToPause, true);
|
||||
|
||||
const char* SettingName[] = {
|
||||
"Log",
|
||||
"LogConfig",
|
||||
@ -85,19 +86,19 @@ void CCodeWindow::Load()
|
||||
|
||||
// Decide what windows to show
|
||||
for (int i = 0; i <= IDM_VIDEOWINDOW - IDM_LOGWINDOW; i++)
|
||||
ini.Get("ShowOnStart", SettingName[i], &bShowOnStart[i], false);
|
||||
ini.GetOrCreateSection("ShowOnStart")->Get(SettingName[i], &bShowOnStart[i], false);
|
||||
|
||||
// Get notebook affiliation
|
||||
std::string _Section = "P - " +
|
||||
std::string section = "P - " +
|
||||
((Parent->ActivePerspective < Parent->Perspectives.size())
|
||||
? Parent->Perspectives[Parent->ActivePerspective].Name : "Perspective 1");
|
||||
|
||||
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
|
||||
ini.Get(_Section, SettingName[i], &iNbAffiliation[i], 0);
|
||||
ini.GetOrCreateSection(section)->Get(SettingName[i], &iNbAffiliation[i], 0);
|
||||
|
||||
// Get floating setting
|
||||
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
|
||||
ini.Get("Float", SettingName[i], &Parent->bFloatWindow[i], false);
|
||||
ini.GetOrCreateSection("Float")->Get(SettingName[i], &Parent->bFloatWindow[i], false);
|
||||
}
|
||||
|
||||
void CCodeWindow::Save()
|
||||
@ -105,11 +106,10 @@ void CCodeWindow::Save()
|
||||
IniFile ini;
|
||||
ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
|
||||
|
||||
ini.Set("General", "DebuggerFont", WxStrToStr(DebuggerFont.GetNativeFontInfoUserDesc()));
|
||||
|
||||
// Boot to pause or not
|
||||
ini.Set("General", "AutomaticStart", GetMenuBar()->IsChecked(IDM_AUTOMATICSTART));
|
||||
ini.Set("General", "BootToPause", GetMenuBar()->IsChecked(IDM_BOOTTOPAUSE));
|
||||
IniFile::Section* general = ini.GetOrCreateSection("General");
|
||||
general->Set("DebuggerFont", WxStrToStr(DebuggerFont.GetNativeFontInfoUserDesc()));
|
||||
general->Set("AutomaticStart", GetMenuBar()->IsChecked(IDM_AUTOMATICSTART));
|
||||
general->Set("BootToPause", GetMenuBar()->IsChecked(IDM_BOOTTOPAUSE));
|
||||
|
||||
const char* SettingName[] = {
|
||||
"Log",
|
||||
@ -126,16 +126,16 @@ void CCodeWindow::Save()
|
||||
|
||||
// Save windows settings
|
||||
for (int i = IDM_LOGWINDOW; i <= IDM_VIDEOWINDOW; i++)
|
||||
ini.Set("ShowOnStart", SettingName[i - IDM_LOGWINDOW], GetMenuBar()->IsChecked(i));
|
||||
ini.GetOrCreateSection("ShowOnStart")->Set(SettingName[i - IDM_LOGWINDOW], GetMenuBar()->IsChecked(i));
|
||||
|
||||
// Save notebook affiliations
|
||||
std::string _Section = "P - " + Parent->Perspectives[Parent->ActivePerspective].Name;
|
||||
std::string section = "P - " + Parent->Perspectives[Parent->ActivePerspective].Name;
|
||||
for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
|
||||
ini.Set(_Section, SettingName[i], iNbAffiliation[i]);
|
||||
ini.GetOrCreateSection(section)->Set(SettingName[i], iNbAffiliation[i]);
|
||||
|
||||
// Save floating setting
|
||||
for (int i = IDM_LOGWINDOW_PARENT; i <= IDM_CODEWINDOW_PARENT; i++)
|
||||
ini.Set("Float", SettingName[i - IDM_LOGWINDOW_PARENT], !!FindWindowById(i));
|
||||
ini.GetOrCreateSection("Float")->Set(SettingName[i - IDM_LOGWINDOW_PARENT], !!FindWindowById(i));
|
||||
|
||||
ini.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
|
||||
}
|
||||
|
@ -88,10 +88,11 @@ void GFXDebuggerPanel::SaveSettings() const
|
||||
GetSize().GetWidth() < 1000 &&
|
||||
GetSize().GetHeight() < 1000)
|
||||
{
|
||||
file.Set("VideoWindow", "x", GetPosition().x);
|
||||
file.Set("VideoWindow", "y", GetPosition().y);
|
||||
file.Set("VideoWindow", "w", GetSize().GetWidth());
|
||||
file.Set("VideoWindow", "h", GetSize().GetHeight());
|
||||
IniFile::Section* video_window = file.GetOrCreateSection("VideoWindow");
|
||||
video_window->Set("x", GetPosition().x);
|
||||
video_window->Set("y", GetPosition().y);
|
||||
video_window->Set("w", GetSize().GetWidth());
|
||||
video_window->Set("h", GetSize().GetHeight());
|
||||
}
|
||||
|
||||
file.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
|
||||
@ -102,11 +103,17 @@ void GFXDebuggerPanel::LoadSettings()
|
||||
IniFile file;
|
||||
file.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
|
||||
|
||||
int x = 100, y = 100, w = 100, h = 100;
|
||||
file.Get("VideoWindow", "x", &x, GetPosition().x);
|
||||
file.Get("VideoWindow", "y", &y, GetPosition().y);
|
||||
file.Get("VideoWindow", "w", &w, GetSize().GetWidth());
|
||||
file.Get("VideoWindow", "h", &h, GetSize().GetHeight());
|
||||
int x = 100;
|
||||
int y = 100;
|
||||
int w = 100;
|
||||
int h = 100;
|
||||
|
||||
IniFile::Section* video_window = file.GetOrCreateSection("VideoWindow");
|
||||
video_window->Get("x", &x, GetPosition().x);
|
||||
video_window->Get("y", &y, GetPosition().y);
|
||||
video_window->Get("w", &w, GetSize().GetWidth());
|
||||
video_window->Get("h", &h, GetSize().GetHeight());
|
||||
|
||||
SetSize(x, y, w, h);
|
||||
}
|
||||
|
||||
|
@ -127,25 +127,29 @@ CMemoryWindow::CMemoryWindow(wxWindow* parent, wxWindowID id,
|
||||
sizerBig->Fit(this);
|
||||
}
|
||||
|
||||
void CMemoryWindow::Save(IniFile& _IniFile) const
|
||||
void CMemoryWindow::Save(IniFile& ini) const
|
||||
{
|
||||
// Prevent these bad values that can happen after a crash or hanging
|
||||
if (GetPosition().x != -32000 && GetPosition().y != -32000)
|
||||
{
|
||||
_IniFile.Set("MemoryWindow", "x", GetPosition().x);
|
||||
_IniFile.Set("MemoryWindow", "y", GetPosition().y);
|
||||
_IniFile.Set("MemoryWindow", "w", GetSize().GetWidth());
|
||||
_IniFile.Set("MemoryWindow", "h", GetSize().GetHeight());
|
||||
IniFile::Section* mem_window = ini.GetOrCreateSection("MemoryWindow");
|
||||
mem_window->Set("x", GetPosition().x);
|
||||
mem_window->Set("y", GetPosition().y);
|
||||
mem_window->Set("w", GetSize().GetWidth());
|
||||
mem_window->Set("h", GetSize().GetHeight());
|
||||
}
|
||||
}
|
||||
|
||||
void CMemoryWindow::Load(IniFile& _IniFile)
|
||||
void CMemoryWindow::Load(IniFile& ini)
|
||||
{
|
||||
int x, y, w, h;
|
||||
_IniFile.Get("MemoryWindow", "x", &x, GetPosition().x);
|
||||
_IniFile.Get("MemoryWindow", "y", &y, GetPosition().y);
|
||||
_IniFile.Get("MemoryWindow", "w", &w, GetSize().GetWidth());
|
||||
_IniFile.Get("MemoryWindow", "h", &h, GetSize().GetHeight());
|
||||
|
||||
IniFile::Section* mem_window = ini.GetOrCreateSection("MemoryWindow");
|
||||
mem_window->Get("x", &x, GetPosition().x);
|
||||
mem_window->Get("y", &y, GetPosition().y);
|
||||
mem_window->Get("w", &w, GetSize().GetWidth());
|
||||
mem_window->Get("h", &h, GetSize().GetHeight());
|
||||
|
||||
SetSize(x, y, w, h);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user