GUI: Save page views

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4071 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-08-27 01:30:08 +00:00
parent d46927207a
commit bc938c4b01
4 changed files with 71 additions and 108 deletions

View File

@ -171,21 +171,17 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
, m_BreakpointWindow(NULL) , m_BreakpointWindow(NULL)
, m_MemoryWindow(NULL) , m_MemoryWindow(NULL)
, m_JitWindow(NULL) , m_JitWindow(NULL)
, m_ToolBar2(NULL) , m_ToolBar2(NULL), m_NB0(NULL), m_NB1(NULL)
{ {
// Load ini settings // Load ini settings
IniFile file; this->Load();
file.Load(DEBUGGER_CONFIG_FILE);
this->Load_(file);
page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16)); aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
InitBitmaps(); InitBitmaps();
CreateGUIControls(_LocalCoreStartupParameter); CreateGUIControls(_LocalCoreStartupParameter);
// Create the toolbar // Create the toolbar
//RecreateToolbar(); //RecreateToolbar();
// Update bitmap buttons // Update bitmap buttons
//UpdateButtonStates(); //UpdateButtonStates();
@ -195,34 +191,17 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
(wxObject*)0, this); (wxObject*)0, this);
// Load settings for selectable windows, but only if they have been created // Load settings for selectable windows, but only if they have been created
this->Load(file); //this->Load();
if (m_BreakpointWindow) m_BreakpointWindow->Load(file);
if (m_RegisterWindow) m_RegisterWindow->Load(file);
if (m_MemoryWindow) m_MemoryWindow->Load(file);
if (m_JitWindow) m_JitWindow->Load(file);
} }
CCodeWindow::~CCodeWindow() CCodeWindow::~CCodeWindow()
{ {
// Will be fixed. Pointers currently non-NULL while object is deleted on close
/*
IniFile file;
file.Load(DEBUGGER_CONFIG_FILE);
this->Save(file);
if (m_BreakpointWindow) m_BreakpointWindow->Save(file);
if (m_RegisterWindow) m_RegisterWindow->Save(file);
if (m_MemoryWindow) m_MemoryWindow->Save(file);
if (m_JitWindow) m_JitWindow->Save(file);
file.Save(DEBUGGER_CONFIG_FILE);
*/
} }
///////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////
//Redirect old wxFrame calls // Redirect old wxFrame calls
// ------------ // ------------
wxFrame *CCodeWindow::GetParentFrame() wxFrame *CCodeWindow::GetParentFrame()
{ {
@ -274,39 +253,23 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event)
case IDM_NOTIFYMAPLOADED: case IDM_NOTIFYMAPLOADED:
NotifyMapLoaded(); NotifyMapLoaded();
break; break;
/*
/* case IDM_UPDATELOGDISPLAY: case IDM_UPDATELOGDISPLAY:
if (m_LogWindow) m_LogWindow->NotifyUpdate();
if (m_LogWindow) break;
{ */
m_LogWindow->NotifyUpdate();
}
break;
*/
case IDM_UPDATEDISASMDIALOG: case IDM_UPDATEDISASMDIALOG:
Update(); Update();
if (m_RegisterWindow) m_RegisterWindow->NotifyUpdate();
if (m_RegisterWindow)
{
m_RegisterWindow->NotifyUpdate();
}
break; break;
case IDM_UPDATEBREAKPOINTS: case IDM_UPDATEBREAKPOINTS:
Update(); Update();
if (m_BreakpointWindow) m_BreakpointWindow->NotifyUpdate();
if (m_BreakpointWindow)
{
m_BreakpointWindow->NotifyUpdate();
}
break; break;
case IDM_UPDATESTATUSBAR: case IDM_UPDATESTATUSBAR:
//if (main_frame->m_pStatusBar != NULL) //if (main_frame->m_pStatusBar != NULL)
{ {
// What is this PanicAlert() for?
//PanicAlert("");
//this->GetParent()->m_p //this->GetParent()->m_p
//this->GetParent()-> //this->GetParent()->
//parent->m_pStatusBar->SetStatusText(wxT("Hi"), 0); //parent->m_pStatusBar->SetStatusText(wxT("Hi"), 0);
@ -315,7 +278,6 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event)
//main_frame->m_pStatusBar->SetStatusText(event.GetString(), event.GetInt()); //main_frame->m_pStatusBar->SetStatusText(event.GetString(), event.GetInt());
} }
break; break;
} }
} }
@ -323,8 +285,11 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event)
// Load these settings before CreateGUIControls() // Load these settings before CreateGUIControls()
void CCodeWindow::Load_( IniFile &ini ) void CCodeWindow::Load()
{ {
IniFile ini;
ini.Load(DEBUGGER_CONFIG_FILE);
// The font to override DebuggerFont with // The font to override DebuggerFont with
std::string fontDesc; std::string fontDesc;
ini.Get("ShowOnStart", "DebuggerFont", &fontDesc); ini.Get("ShowOnStart", "DebuggerFont", &fontDesc);
@ -337,15 +302,14 @@ void CCodeWindow::Load_( IniFile &ini )
ini.Get("ShowOnStart", "MemoryWindow", &bMemoryWindow, true); ini.Get("ShowOnStart", "MemoryWindow", &bMemoryWindow, true);
ini.Get("ShowOnStart", "JitWindow", &bJitWindow, true); ini.Get("ShowOnStart", "JitWindow", &bJitWindow, true);
ini.Get("ShowOnStart", "SoundWindow", &bSoundWindow, false); ini.Get("ShowOnStart", "SoundWindow", &bSoundWindow, false);
ini.Get("ShowOnStart", "VideoWindow", &bVideoWindow, false); ini.Get("ShowOnStart", "VideoWindow", &bVideoWindow, false);
// Boot to pause or not // Boot to pause or not
ini.Get("ShowOnStart", "AutomaticStart", &bAutomaticStart, false); ini.Get("ShowOnStart", "AutomaticStart", &bAutomaticStart, false);
ini.Get("ShowOnStart", "BootToPause", &bBootToPause, true); ini.Get("ShowOnStart", "BootToPause", &bBootToPause, true);
} }
/*
void CCodeWindow::Load( IniFile &ini ) void CCodeWindow::Load( IniFile &ini )
{ {
int x,y,w,h; int x,y,w,h;
@ -360,21 +324,13 @@ void CCodeWindow::Load( IniFile &ini )
ini.Get("MainWindow", "h", &h, 600); ini.Get("MainWindow", "h", &h, 600);
GetParent()->SetSize(x, y, w, h); GetParent()->SetSize(x, y, w, h);
} }
*/
void CCodeWindow::Save(IniFile &ini) void CCodeWindow::Save()
{ {
// Crashes on exit, will be fixed IniFile ini;
return; ini.Load(DEBUGGER_CONFIG_FILE);
ini.Set("CodeWindow", "x", GetPosition().x);
ini.Set("CodeWindow", "y", GetPosition().y);
ini.Set("CodeWindow", "w", GetSize().GetWidth());
ini.Set("CodeWindow", "h", GetSize().GetHeight());
ini.Set("MainWindow", "x", GetParent()->GetPosition().x);
ini.Set("MainWindow", "y", GetParent()->GetPosition().y);
ini.Set("MainWindow", "w", GetParent()->GetSize().GetWidth());
ini.Set("MainWindow", "h", GetParent()->GetSize().GetHeight());
ini.Set("ShowOnStart", "DebuggerFont", std::string(DebuggerFont.GetNativeFontInfoUserDesc().mb_str())); ini.Set("ShowOnStart", "DebuggerFont", std::string(DebuggerFont.GetNativeFontInfoUserDesc().mb_str()));
@ -389,6 +345,25 @@ void CCodeWindow::Save(IniFile &ini)
ini.Set("ShowOnStart", "JitWindow", GetMenuBar()->IsChecked(IDM_JITWINDOW)); ini.Set("ShowOnStart", "JitWindow", GetMenuBar()->IsChecked(IDM_JITWINDOW));
ini.Set("ShowOnStart", "SoundWindow", GetMenuBar()->IsChecked(IDM_SOUNDWINDOW)); ini.Set("ShowOnStart", "SoundWindow", GetMenuBar()->IsChecked(IDM_SOUNDWINDOW));
ini.Set("ShowOnStart", "VideoWindow", GetMenuBar()->IsChecked(IDM_VIDEOWINDOW)); ini.Set("ShowOnStart", "VideoWindow", GetMenuBar()->IsChecked(IDM_VIDEOWINDOW));
// Save window settings
/*
ini.Set("CodeWindow", "x", GetPosition().x);
ini.Set("CodeWindow", "y", GetPosition().y);
ini.Set("CodeWindow", "w", GetSize().GetWidth());
ini.Set("CodeWindow", "h", GetSize().GetHeight());
ini.Set("MainWindow", "x", GetParent()->GetPosition().x);
ini.Set("MainWindow", "y", GetParent()->GetPosition().y);
ini.Set("MainWindow", "w", GetParent()->GetSize().GetWidth());
ini.Set("MainWindow", "h", GetParent()->GetSize().GetHeight());
if (m_BreakpointWindow) m_BreakpointWindow->Save(file);
if (m_RegisterWindow) m_RegisterWindow->Save(file);
if (m_MemoryWindow) m_MemoryWindow->Save(file);
if (m_JitWindow) m_JitWindow->Save(file);
*/
ini.Save(DEBUGGER_CONFIG_FILE);
} }
void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter) void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStartupParameter)
@ -418,34 +393,6 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
sizerBig->Fit(this); sizerBig->Fit(this);
sync_event.Init(); sync_event.Init();
if (bRegisterWindow) OnToggleRegisterWindow(true, m_NB0);
if (bBreakpointWindow) OnToggleBreakPointWindow(true, m_NB1);
if (bMemoryWindow) OnToggleMemoryWindow(true, m_NB0);
if (bJitWindow) OnToggleJitWindow(true, m_NB0);
if (bSoundWindow) OnToggleSoundWindow(true, m_NB1);
/*
{
// Possible todo: add some kind of if here to? can it fail?
CPluginManager::GetInstance().OpenDebug(
GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
PLUGIN_TYPE_DSP, true
);
} // don't have any else, just ignore it
*/
if (bVideoWindow) OnToggleVideoWindow(true, m_NB1);
/*
{
// possible todo: add some kind of if here to? can it fail?
CPluginManager::GetInstance().OpenDebug(
GetHandle(),
_LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
PLUGIN_TYPE_VIDEO, true
);
} // don't have any else, just ignore it
*/
} }

View File

@ -51,6 +51,8 @@ class CCodeWindow
*/ */
~CCodeWindow(); ~CCodeWindow();
void Load();
void Save();
// Function redirection // Function redirection
wxFrame *GetParentFrame(); wxFrame *GetParentFrame();
@ -60,17 +62,13 @@ class CCodeWindow
bool IsActive(); bool IsActive();
void UpdateToolbar(wxAuiToolBar *); void UpdateToolbar(wxAuiToolBar *);
void UpdateNotebook(int, wxAuiNotebook *); void UpdateNotebook(int, wxAuiNotebook *);
wxBitmap page_bmp; wxBitmap aNormalFile;
#ifdef _WIN32 #ifdef _WIN32
wxWindow * GetWxWindow(wxString); wxWindow * GetWxWindow(wxString);
#endif #endif
wxWindow * GetNootebookPage(wxString); wxWindow * GetNootebookPage(wxString);
void DoToggleWindow(int,bool); void DoToggleWindow(int,bool);
void Load_(IniFile &file);
void Load(IniFile &file);
void Save(IniFile &file);
bool UseInterpreter(); bool UseInterpreter();
bool BootToPause(); bool BootToPause();
bool AutomaticStart(); bool AutomaticStart();
@ -86,7 +84,8 @@ class CCodeWindow
void PopulateToolbar(wxAuiToolBar* toolBar); void PopulateToolbar(wxAuiToolBar* toolBar);
void CreateSymbolsMenu(); void CreateSymbolsMenu();
void UpdateButtonStates(); void UpdateButtonStates();
void CCodeWindow::UpdateManager(); void OpenPages();
void UpdateManager();
// Sub dialogs // Sub dialogs
wxMenuBar* pMenuBar; wxMenuBar* pMenuBar;

View File

@ -366,6 +366,16 @@ wxWindow * CCodeWindow::GetWxWindow(wxString Name)
return NULL; return NULL;
} }
#endif #endif
void CCodeWindow::OpenPages()
{
if (bRegisterWindow) OnToggleRegisterWindow(true, m_NB0);
if (bBreakpointWindow) OnToggleBreakPointWindow(true, m_NB1);
if (bMemoryWindow) OnToggleMemoryWindow(true, m_NB0);
if (bJitWindow) OnToggleJitWindow(true, m_NB0);
// Todo, potentially add a safety check here since it will crash if ScanForPlugins() is not run yet
if (bSoundWindow) OnToggleSoundWindow(true, m_NB1);
if (bVideoWindow) OnToggleVideoWindow(true, m_NB1);
}
void CCodeWindow::OnToggleWindow(wxCommandEvent& event) void CCodeWindow::OnToggleWindow(wxCommandEvent& event)
{ {
DoToggleWindow(event.GetId(), GetMenuBar()->IsChecked(event.GetId())); DoToggleWindow(event.GetId(), GetMenuBar()->IsChecked(event.GetId()));
@ -384,11 +394,13 @@ void CCodeWindow::DoToggleWindow(int Id, bool Show)
} }
void CCodeWindow::OnToggleRegisterWindow(bool Show, wxAuiNotebook * _NB) void CCodeWindow::OnToggleRegisterWindow(bool Show, wxAuiNotebook * _NB)
{ {
if(!_NB) return;
if (Show) if (Show)
{ {
if (m_RegisterWindow && _NB->GetPageIndex(m_RegisterWindow) != wxNOT_FOUND) return; if (m_RegisterWindow && _NB->GetPageIndex(m_RegisterWindow) != wxNOT_FOUND) return;
if (!m_RegisterWindow) m_RegisterWindow = new CRegisterWindow(GetParent()->GetParent()); if (!m_RegisterWindow) m_RegisterWindow = new CRegisterWindow(GetParent()->GetParent());
_NB->AddPage(m_RegisterWindow, wxT("Registers"), true, page_bmp ); _NB->AddPage(m_RegisterWindow, wxT("Registers"), true, aNormalFile );
} }
else // hide else // hide
{ {
@ -413,7 +425,7 @@ void CCodeWindow::OnToggleBreakPointWindow(bool Show, wxAuiNotebook * _NB)
{ {
if (m_BreakpointWindow && _NB->GetPageIndex(m_BreakpointWindow) != wxNOT_FOUND) return; if (m_BreakpointWindow && _NB->GetPageIndex(m_BreakpointWindow) != wxNOT_FOUND) return;
if (!m_BreakpointWindow) m_BreakpointWindow = new CBreakPointWindow(this, GetParent()->GetParent()); if (!m_BreakpointWindow) m_BreakpointWindow = new CBreakPointWindow(this, GetParent()->GetParent());
_NB->AddPage(m_BreakpointWindow, wxT("Breakpoints"), true, page_bmp ); _NB->AddPage(m_BreakpointWindow, wxT("Breakpoints"), true, aNormalFile );
} }
else // hide else // hide
{ {
@ -437,7 +449,7 @@ void CCodeWindow::OnToggleJitWindow(bool Show, wxAuiNotebook * _NB)
{ {
if (m_JitWindow && _NB->GetPageIndex(m_JitWindow) != wxNOT_FOUND) return; if (m_JitWindow && _NB->GetPageIndex(m_JitWindow) != wxNOT_FOUND) return;
if (!m_JitWindow) m_JitWindow = new CJitWindow(GetParent()->GetParent()); if (!m_JitWindow) m_JitWindow = new CJitWindow(GetParent()->GetParent());
_NB->AddPage(m_JitWindow, wxT("JIT"), true, page_bmp ); _NB->AddPage(m_JitWindow, wxT("JIT"), true, aNormalFile );
} }
else // hide else // hide
{ {
@ -462,7 +474,7 @@ void CCodeWindow::OnToggleMemoryWindow(bool Show, wxAuiNotebook * _NB)
{ {
if (m_MemoryWindow && _NB->GetPageIndex(m_MemoryWindow) != wxNOT_FOUND) return; if (m_MemoryWindow && _NB->GetPageIndex(m_MemoryWindow) != wxNOT_FOUND) return;
if (!m_MemoryWindow) m_MemoryWindow = new CMemoryWindow(GetParent()->GetParent()); if (!m_MemoryWindow) m_MemoryWindow = new CMemoryWindow(GetParent()->GetParent());
_NB->AddPage(m_MemoryWindow, wxT("Memory"), true, page_bmp ); _NB->AddPage(m_MemoryWindow, wxT("Memory"), true, aNormalFile );
} }
else // hide else // hide
{ {
@ -507,7 +519,7 @@ void CCodeWindow::OnToggleSoundWindow(bool Show, wxAuiNotebook * _NB)
if (Win) if (Win)
{ {
//Console->Log(LogTypes::LNOTICE, StringFromFormat("AddPage\n").c_str()); //Console->Log(LogTypes::LNOTICE, StringFromFormat("AddPage\n").c_str());
_NB->AddPage(Win, wxT("Sound"), true, page_bmp ); _NB->AddPage(Win, wxT("Sound"), true, aNormalFile );
} }
#endif #endif
} }
@ -549,7 +561,7 @@ void CCodeWindow::OnToggleVideoWindow(bool Show, wxAuiNotebook * _NB)
} }
Win = GetWxWindow(wxT("Video")); Win = GetWxWindow(wxT("Video"));
if (Win) _NB->AddPage(Win, wxT("Video"), true, page_bmp ); if (Win) _NB->AddPage(Win, wxT("Video"), true, aNormalFile );
#endif #endif
} }
else // hide else // hide

View File

@ -367,12 +367,12 @@ CFrame::CFrame(bool showLogWindow,
if (UseDebugger) if (UseDebugger)
{ {
wxBitmap page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16)); wxBitmap aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
static int Style = wxAUI_NB_TOP | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER; static int Style = wxAUI_NB_TOP | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ACTIVE_TAB | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER;
m_NB1 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxSize(430,200), Style); m_NB1 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxSize(430,200), Style);
m_NB0 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxSize(430,200), Style); m_NB0 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxSize(430,200), Style);
m_NB0->AddPage(g_pCodeWindow, wxT("Code"), false, page_bmp ); m_NB0->AddPage(g_pCodeWindow, wxT("Code"), false, aNormalFile );
g_pCodeWindow->UpdateNotebook(0, m_NB0); g_pCodeWindow->UpdateNotebook(0, m_NB0);
g_pCodeWindow->UpdateNotebook(1, m_NB1); g_pCodeWindow->UpdateNotebook(1, m_NB1);
@ -438,6 +438,9 @@ CFrame::CFrame(bool showLogWindow,
// Create list of available plugins for the configuration window // Create list of available plugins for the configuration window
CPluginManager::GetInstance().ScanForPlugins(); CPluginManager::GetInstance().ScanForPlugins();
// Open notebook pages
if (UseDebugger) g_pCodeWindow->OpenPages();
//if we are ever going back to optional iso caching: //if we are ever going back to optional iso caching:
//m_GameListCtrl->Update(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableIsoCache); //m_GameListCtrl->Update(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableIsoCache);
m_GameListCtrl->Update(); m_GameListCtrl->Update();
@ -502,6 +505,8 @@ void CFrame::OnClose(wxCloseEvent& event)
{ {
// Don't forget the skip or the window won't be destroyed // Don't forget the skip or the window won't be destroyed
event.Skip(); event.Skip();
// Save GUI settings
if (UseDebugger) g_pCodeWindow->Save();
if (Core::GetState() != Core::CORE_UNINITIALIZED) if (Core::GetState() != Core::CORE_UNINITIALIZED)
{ {