From b185fedb858cd261906abf0edb556d13af033ad1 Mon Sep 17 00:00:00 2001
From: John Peterson <jpeterson57@gmail.com>
Date: Wed, 26 Aug 2009 09:19:15 +0000
Subject: [PATCH] GUI debugger: Added more windows to aui

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4065 8ced0084-cf51-0410-be5f-012b33b47a6e
---
 Source/Core/DebuggerWX/Src/BreakpointWindow.h |   5 +-
 Source/Core/DebuggerWX/Src/CodeWindow.cpp     |  64 +++--
 Source/Core/DebuggerWX/Src/CodeWindow.h       |  36 +--
 Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp  | 231 +++++++++---------
 Source/Core/DebuggerWX/Src/JitWindow.h        |   2 +-
 Source/Core/DebuggerWX/Src/MemoryWindow.h     |   2 +-
 Source/Core/DebuggerWX/Src/RegisterWindow.cpp |   7 +-
 Source/Core/DebuggerWX/Src/RegisterWindow.h   |   6 +-
 Source/Core/DolphinWX/Src/Frame.cpp           |  38 ++-
 Source/Core/DolphinWX/Src/Frame.h             |   3 +
 10 files changed, 216 insertions(+), 178 deletions(-)

diff --git a/Source/Core/DebuggerWX/Src/BreakpointWindow.h b/Source/Core/DebuggerWX/Src/BreakpointWindow.h
index 22624237a1..bc3f9cbf1c 100644
--- a/Source/Core/DebuggerWX/Src/BreakpointWindow.h
+++ b/Source/Core/DebuggerWX/Src/BreakpointWindow.h
@@ -23,9 +23,6 @@ class CCodeWindow;
 class wxListEvent;
 class IniFile;
 
-#undef BREAKPOINT_WINDOW_STYLE
-#define BREAKPOINT_WINDOW_STYLE wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX | wxRESIZE_BORDER
-
 class CBreakPointWindow
 	: public wxFrame
 {
@@ -37,7 +34,7 @@ class CBreakPointWindow
 
 		CBreakPointWindow(CCodeWindow* _pCodeWindow, wxWindow* parent, wxWindowID id = 1, const wxString& title = wxT("Breakpoints"), 
 			const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(400, 250), 
-			long style = BREAKPOINT_WINDOW_STYLE);
+			long style = wxNO_BORDER);
 
 		virtual ~CBreakPointWindow();
 
diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.cpp b/Source/Core/DebuggerWX/Src/CodeWindow.cpp
index ccd78580fc..fa743583ba 100644
--- a/Source/Core/DebuggerWX/Src/CodeWindow.cpp
+++ b/Source/Core/DebuggerWX/Src/CodeWindow.cpp
@@ -116,12 +116,12 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxPanel)
 	EVT_MENU(IDM_JITPOFF,			CCodeWindow::OnCPUMode)
 	EVT_MENU(IDM_JITSROFF,			CCodeWindow::OnCPUMode)
 
-	EVT_MENU(IDM_REGISTERWINDOW,    CCodeWindow::OnToggleRegisterWindow) //views
-	EVT_MENU(IDM_BREAKPOINTWINDOW,  CCodeWindow::OnToggleBreakPointWindow)
-	EVT_MENU(IDM_MEMORYWINDOW,      CCodeWindow::OnToggleMemoryWindow)
-	EVT_MENU(IDM_JITWINDOW,			CCodeWindow::OnToggleJitWindow)
-	EVT_MENU(IDM_SOUNDWINDOW,		CCodeWindow::OnToggleSoundWindow)
-	EVT_MENU(IDM_VIDEOWINDOW,		CCodeWindow::OnToggleVideoWindow)
+	EVT_MENU(IDM_REGISTERWINDOW,    CCodeWindow::OnToggleWindow) //views
+	EVT_MENU(IDM_BREAKPOINTWINDOW,  CCodeWindow::OnToggleWindow)
+	EVT_MENU(IDM_MEMORYWINDOW,      CCodeWindow::OnToggleWindow)
+	EVT_MENU(IDM_JITWINDOW,			CCodeWindow::OnToggleWindow)
+	EVT_MENU(IDM_SOUNDWINDOW,		CCodeWindow::OnToggleWindow)
+	EVT_MENU(IDM_VIDEOWINDOW,		CCodeWindow::OnToggleWindow)
 	EVT_MENU(IDM_FONTPICKER,		CCodeWindow::OnChangeFont)
 
 	EVT_MENU(IDM_CLEARSYMBOLS,      CCodeWindow::OnSymbolsMenu)
@@ -178,6 +178,7 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
 	file.Load(DEBUGGER_CONFIG_FILE);
 	this->Load_(file);
 
+	page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
 	InitBitmaps();
 
 	CreateGUIControls(_LocalCoreStartupParameter);
@@ -203,6 +204,9 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
 
 CCodeWindow::~CCodeWindow()
 {
+	// Will be fixed. Pointers currently non-NULL while object is deleted on close
+
+	/*
 	IniFile file;
 	file.Load(DEBUGGER_CONFIG_FILE);
 
@@ -213,6 +217,7 @@ CCodeWindow::~CCodeWindow()
 	if (m_JitWindow) m_JitWindow->Save(file);
 
 	file.Save(DEBUGGER_CONFIG_FILE);
+	*/
 }
 
 
@@ -220,8 +225,8 @@ CCodeWindow::~CCodeWindow()
 //Redirect old wxFrame calls
 // ------------
 wxFrame *CCodeWindow::GetParentFrame()
-{	
-	wxFrame *Parent = wxDynamicCast(GetParent(), wxFrame);
+{
+	wxFrame *Parent = wxDynamicCast(GetParent()->GetParent(), wxFrame);
 	return Parent;
 }
 wxMenuBar *CCodeWindow::GetMenuBar()
@@ -240,6 +245,13 @@ void CCodeWindow::UpdateToolbar(wxAuiToolBar * _ToolBar2)
 {
 	m_ToolBar2 = _ToolBar2;
 }
+void CCodeWindow::UpdateNotebook(int _i, wxAuiNotebook * _NB)
+{
+	if (_i == 0)
+		m_NB0 = _NB;
+	else
+		m_NB1 = _NB;
+}
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 
 
@@ -407,31 +419,12 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
 
 	sync_event.Init();
 
-	if (bRegisterWindow)
-	{
-		m_RegisterWindow = new CRegisterWindow(this);
-		m_RegisterWindow->Show(true);
-	}
-
-	if (bBreakpointWindow)
-	{
-		m_BreakpointWindow = new CBreakPointWindow(this, this);
-		m_BreakpointWindow->Show(true);
-	}
-
-	if (bMemoryWindow)
-	{
-		m_MemoryWindow = new CMemoryWindow(this);
-		m_MemoryWindow->Show(true);
-	}
-
-	if (bJitWindow)
-	{
-		m_JitWindow = new CJitWindow(this);
-		m_JitWindow->Show(true);
-	}
-
-	if (bSoundWindow)
+	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(
@@ -440,8 +433,10 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
 			PLUGIN_TYPE_DSP, true
 		);
 	} // don't have any else, just ignore it
+	*/
 
-	if (bVideoWindow)
+	if (bVideoWindow)		OnToggleVideoWindow(true, m_NB1);
+	/*
 	{
 		// possible todo: add some kind of if here to? can it fail?
 		CPluginManager::GetInstance().OpenDebug(
@@ -450,6 +445,7 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
 			PLUGIN_TYPE_VIDEO, true
 		);
 	} // don't have any else, just ignore it
+	*/
 }
 
 
diff --git a/Source/Core/DebuggerWX/Src/CodeWindow.h b/Source/Core/DebuggerWX/Src/CodeWindow.h
index a145fa7863..ec984e4573 100644
--- a/Source/Core/DebuggerWX/Src/CodeWindow.h
+++ b/Source/Core/DebuggerWX/Src/CodeWindow.h
@@ -22,6 +22,7 @@
 #include <wx/dialog.h>
 #include <wx/textctrl.h>
 #include <wx/listbox.h>
+#include <wx/artprov.h>
 #include <wx/aui/aui.h>
 
 #include "Thread.h"
@@ -54,10 +55,12 @@ class CCodeWindow
 		// Function redirection
 		wxFrame *GetParentFrame();
 		wxMenuBar * GetMenuBar();
-		wxAuiToolBar * GetToolBar();
-		wxAuiToolBar * m_ToolBar2;
+		wxAuiToolBar * GetToolBar(), * m_ToolBar2;
+		wxAuiNotebook *m_NB0, *m_NB1;
 		bool IsActive();
 		void UpdateToolbar(wxAuiToolBar *);
+		void UpdateNotebook(int, wxAuiNotebook *);
+		wxBitmap page_bmp;
 
 		void Load_(IniFile &file);
 		void Load(IniFile &file);
@@ -79,6 +82,13 @@ class CCodeWindow
 		void CreateSymbolsMenu();
 		void UpdateButtonStates();
 
+		// Sub dialogs
+		wxMenuBar* pMenuBar;
+		CRegisterWindow* m_RegisterWindow;
+		CBreakPointWindow* m_BreakpointWindow;
+		CMemoryWindow* m_MemoryWindow;
+		CJitWindow* m_JitWindow;
+
 	private:
 
 		enum
@@ -122,13 +132,14 @@ class CCodeWindow
 		void SingleCPUStep();
 
 		void OnAddrBoxChange(wxCommandEvent& event);
-
-		void OnToggleRegisterWindow(wxCommandEvent& event);
-		void OnToggleBreakPointWindow(wxCommandEvent& event);
-		void OnToggleMemoryWindow(wxCommandEvent& event);
-		void OnToggleJitWindow(wxCommandEvent& event);
-		void OnToggleSoundWindow(wxCommandEvent& event);
-		void OnToggleVideoWindow(wxCommandEvent& event);
+		
+		void OnToggleWindow(wxCommandEvent& event);
+		void OnToggleRegisterWindow(bool,wxAuiNotebook*);
+		void OnToggleBreakPointWindow(bool,wxAuiNotebook*);
+		void OnToggleMemoryWindow(bool,wxAuiNotebook*);
+		void OnToggleJitWindow(bool,wxAuiNotebook*);
+		void OnToggleSoundWindow(bool,wxAuiNotebook*);
+		void OnToggleVideoWindow(bool,wxAuiNotebook*);
 		void OnChangeFont(wxCommandEvent& event);
 	
 		void OnHostMessage(wxCommandEvent& event);
@@ -145,13 +156,6 @@ class CCodeWindow
 		void DoTip(wxString text);
 		void OnKeyDown(wxKeyEvent& event);
 
-		// Sub dialogs
-		wxMenuBar* pMenuBar;
-		CRegisterWindow* m_RegisterWindow;
-		CBreakPointWindow* m_BreakpointWindow;
-		CMemoryWindow* m_MemoryWindow;
-		CJitWindow* m_JitWindow;
-
 		wxMenuItem* jitblocklinking, *jitunlimited, *jitoff;
 		wxMenuItem* jitlsoff, *jitlslxzoff, *jitlslwzoff, *jitlslbzxoff;
 		wxMenuItem* jitlspoff;
diff --git a/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp b/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp
index 18b350431d..13a194f802 100644
--- a/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp
+++ b/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp
@@ -308,14 +308,45 @@ void CCodeWindow::OnSymbolListContextMenu(wxContextMenuEvent& event)
 {
 }
 
-void CCodeWindow::OnToggleRegisterWindow(wxCommandEvent& event)
+
+// Change the global DebuggerFont
+void CCodeWindow::OnChangeFont(wxCommandEvent& event)
+{
+	wxFontData data;
+	data.SetInitialFont(GetFont());
+
+	wxFontDialog dialog(this, data);
+	if ( dialog.ShowModal() == wxID_OK )
+		DebuggerFont = dialog.GetFontData().GetChosenFont();
+}
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Toogle windows
+// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
+void CCodeWindow::OnToggleWindow(wxCommandEvent& event)
 {
 	bool Show = GetMenuBar()->IsChecked(event.GetId());
 
+	switch (event.GetId())
+	{
+		case IDM_REGISTERWINDOW: OnToggleRegisterWindow(Show, m_NB0); break;
+		case IDM_BREAKPOINTWINDOW: OnToggleBreakPointWindow(Show, m_NB1); break;
+		case IDM_MEMORYWINDOW: OnToggleMemoryWindow(Show, m_NB0); break;
+		case IDM_JITWINDOW: OnToggleJitWindow(Show, m_NB0); break;
+		case IDM_SOUNDWINDOW: OnToggleSoundWindow(Show, m_NB1); break;
+		case IDM_VIDEOWINDOW: OnToggleVideoWindow(Show, m_NB1); break;
+	}
+}
+
+void CCodeWindow::OnToggleRegisterWindow(bool Show, wxAuiNotebook * _NB)
+{
 	if (Show)
 	{
-		if (!m_RegisterWindow) m_RegisterWindow = new CRegisterWindow(this);
-		m_RegisterWindow->Show(true);
+		if (m_RegisterWindow && _NB->GetPageIndex(m_RegisterWindow) != wxNOT_FOUND) return;
+		if (!m_RegisterWindow) m_RegisterWindow = new CRegisterWindow(GetParent()->GetParent());		
+		_NB->AddPage(m_RegisterWindow, wxT("Registers"), true, page_bmp );
 	}
 	else // hide
 	{
@@ -324,19 +355,93 @@ void CCodeWindow::OnToggleRegisterWindow(wxCommandEvent& event)
 		// It should be true just after the menu item was selected,
 		// if there was no modeless dialog yet.
 		wxASSERT(m_RegisterWindow != NULL);
-		if (m_RegisterWindow) m_RegisterWindow->Hide();
+		//if (m_RegisterWindow) m_RegisterWindow->Hide();
+		if (m_RegisterWindow)
+		{
+			_NB->RemovePage(_NB->GetPageIndex(m_RegisterWindow));
+			m_RegisterWindow->Hide();
+		}
 	}
 }
 
 
-// =======================================================================================
-// Toggle Sound Debugging Window
-// ------------
-void CCodeWindow::OnToggleSoundWindow(wxCommandEvent& event)
+void CCodeWindow::OnToggleBreakPointWindow(bool Show, wxAuiNotebook * _NB)
 {
-	bool show = GetMenuBar()->IsChecked(event.GetId());
+	if (Show)
+	{
+		if (m_BreakpointWindow && _NB->GetPageIndex(m_BreakpointWindow) != wxNOT_FOUND) return;
+		if (!m_BreakpointWindow) m_BreakpointWindow = new CBreakPointWindow(this, GetParent()->GetParent());
+		_NB->AddPage(m_BreakpointWindow, wxT("Breakpoints"), true, page_bmp );
+	}
+	else // hide
+	{
+		// If m_dialog is NULL, then possibly the system
+		// didn't report the checked menu item status correctly.
+		// It should be true just after the menu item was selected,
+		// if there was no modeless dialog yet.
+		wxASSERT(m_BreakpointWindow != NULL);
 
-	if (show)
+		if (m_BreakpointWindow)
+		{
+			_NB->RemovePage(_NB->GetPageIndex(m_BreakpointWindow));
+			m_BreakpointWindow->Hide();
+		}
+	}
+}
+
+void CCodeWindow::OnToggleJitWindow(bool Show, wxAuiNotebook * _NB)
+{
+	if (Show)
+	{
+		if (m_JitWindow && _NB->GetPageIndex(m_JitWindow) != wxNOT_FOUND) return;
+		if (!m_JitWindow) m_JitWindow = new CJitWindow(GetParent()->GetParent());
+		_NB->AddPage(m_JitWindow, wxT("JIT"), true, page_bmp );
+	}
+	else // hide
+	{
+		// If m_dialog is NULL, then possibly the system
+		// didn't report the checked menu item status correctly.
+		// It should be true just after the menu item was selected,
+		// if there was no modeless dialog yet.
+		wxASSERT(m_JitWindow != NULL);
+
+		if (m_JitWindow)
+		{
+			_NB->RemovePage(_NB->GetPageIndex(m_JitWindow));
+			m_JitWindow->Hide();
+		}
+	}
+}
+
+
+void CCodeWindow::OnToggleMemoryWindow(bool Show, wxAuiNotebook * _NB)
+{
+	if (Show)
+	{
+		if (m_MemoryWindow && _NB->GetPageIndex(m_MemoryWindow) != wxNOT_FOUND) return;
+		if (!m_MemoryWindow) m_MemoryWindow = new CMemoryWindow(GetParent()->GetParent());
+		_NB->AddPage(m_MemoryWindow, wxT("Memory"), true, page_bmp );
+	}
+	else // hide
+	{
+		// If m_dialog is NULL, then possibly the system
+		// didn't report the checked menu item status correctly.
+		// It should be true just after the menu item was selected,
+		// if there was no modeless dialog yet.
+		wxASSERT(m_MemoryWindow != NULL);
+
+		if (m_MemoryWindow)
+		{
+			_NB->RemovePage(_NB->GetPageIndex(m_MemoryWindow));
+			m_MemoryWindow->Hide();
+		}
+	}
+}
+
+//Toggle Sound Debugging Window
+void CCodeWindow::OnToggleSoundWindow(bool Show, wxAuiNotebook * _NB)
+{
+	if (Show)
 	{
 		// TODO: add some kind of if() check here to?
 		CPluginManager::GetInstance().OpenDebug(
@@ -355,18 +460,14 @@ void CCodeWindow::OnToggleSoundWindow(wxCommandEvent& event)
 			);
 	}
 }
-// ===========
 
 
-// =======================================================================================
 // Toggle Video Debugging Window
-// ------------
-void CCodeWindow::OnToggleVideoWindow(wxCommandEvent& event)
+void CCodeWindow::OnToggleVideoWindow(bool Show, wxAuiNotebook * _NB)
 {
-	bool show = GetMenuBar()->IsChecked(event.GetId());
 	//GetMenuBar()->Check(event.GetId(), false); // Turn off
 
-	if (show)
+	if (Show)
 	{
 		// It works now, but I'll keep this message in case the problem reappears
 		/*if(Core::GetState() == Core::CORE_UNINITIALIZED)
@@ -392,101 +493,5 @@ may cause a crash when a game is later started. Todo: figure out why and fix it.
 			);
 	}
 }
-// ===========
 
-
-void CCodeWindow::OnToggleJitWindow(wxCommandEvent& event)
-{
-	bool show = GetMenuBar()->IsChecked(event.GetId());
-
-	if (show)
-	{
-		if (!m_JitWindow)
-		{
-			m_JitWindow = new CJitWindow(this);
-		}
-
-		m_JitWindow->Show(true);
-	}
-	else // hide
-	{
-		// If m_dialog is NULL, then possibly the system
-		// didn't report the checked menu item status correctly.
-		// It should be true just after the menu item was selected,
-		// if there was no modeless dialog yet.
-		wxASSERT(m_JitWindow != NULL);
-
-		if (m_JitWindow)
-		{
-			m_JitWindow->Hide();
-		}
-	}
-}
-
-
-void CCodeWindow::OnToggleBreakPointWindow(wxCommandEvent& event)
-{
-	bool show = GetMenuBar()->IsChecked(event.GetId());
-
-	if (show)
-	{
-		if (!m_BreakpointWindow)
-		{
-			m_BreakpointWindow = new CBreakPointWindow(this, this);
-		}
-
-		m_BreakpointWindow->Show(true);
-	}
-	else // hide
-	{
-		// If m_dialog is NULL, then possibly the system
-		// didn't report the checked menu item status correctly.
-		// It should be true just after the menu item was selected,
-		// if there was no modeless dialog yet.
-		wxASSERT(m_BreakpointWindow != NULL);
-
-		if (m_BreakpointWindow)
-		{
-			m_BreakpointWindow->Hide();
-		}
-	}
-}
-
-void CCodeWindow::OnToggleMemoryWindow(wxCommandEvent& event)
-{
-	bool show = GetMenuBar()->IsChecked(event.GetId());
-
-	if (show)
-	{
-		if (!m_MemoryWindow)
-		{
-			m_MemoryWindow = new CMemoryWindow(this);
-		}
-
-		m_MemoryWindow->Show(true);
-	}
-	else // hide
-	{
-		// If m_dialog is NULL, then possibly the system
-		// didn't report the checked menu item status correctly.
-		// It should be true just after the menu item was selected,
-		// if there was no modeless dialog yet.
-		wxASSERT(m_MemoryWindow != NULL);
-
-		if (m_MemoryWindow)
-		{
-			m_MemoryWindow->Hide();
-		}
-	}
-}
-//////////////////////////////////////////////////////////////////////////
-// Change the global DebuggerFont
-void CCodeWindow::OnChangeFont(wxCommandEvent& event)
-{
-	wxFontData data;
-	data.SetInitialFont(GetFont());
-
-	wxFontDialog dialog(this, data);
-	if ( dialog.ShowModal() == wxID_OK )
-		DebuggerFont = dialog.GetFontData().GetChosenFont();
-}
+/////////////////////////////////////////////////////////////////////////////////////////////////////////
\ No newline at end of file
diff --git a/Source/Core/DebuggerWX/Src/JitWindow.h b/Source/Core/DebuggerWX/Src/JitWindow.h
index 0e7c1de0d3..76e0066c31 100644
--- a/Source/Core/DebuggerWX/Src/JitWindow.h
+++ b/Source/Core/DebuggerWX/Src/JitWindow.h
@@ -49,7 +49,7 @@ public:
 		const wxString& title = _T("JIT block viewer"),
 		const wxPoint& pos = wxPoint(950, 100),
 		const wxSize& size = wxSize(400, 500),
-		long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE);
+		long style = wxNO_BORDER);
 
     ~CJitWindow();
 
diff --git a/Source/Core/DebuggerWX/Src/MemoryWindow.h b/Source/Core/DebuggerWX/Src/MemoryWindow.h
index 8396127136..29e241b5ee 100644
--- a/Source/Core/DebuggerWX/Src/MemoryWindow.h
+++ b/Source/Core/DebuggerWX/Src/MemoryWindow.h
@@ -41,7 +41,7 @@ class CMemoryWindow
 			const wxString& title = _T("Dolphin-Memory"),
 		const wxPoint& pos = wxPoint(950, 100),
 		const wxSize& size = wxSize(400, 500),
-		long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE);
+		long style = wxNO_BORDER);
 
         ~CMemoryWindow();
 
diff --git a/Source/Core/DebuggerWX/Src/RegisterWindow.cpp b/Source/Core/DebuggerWX/Src/RegisterWindow.cpp
index 2e9da61ad7..aa20f3697a 100644
--- a/Source/Core/DebuggerWX/Src/RegisterWindow.cpp
+++ b/Source/Core/DebuggerWX/Src/RegisterWindow.cpp
@@ -26,6 +26,7 @@ BEGIN_EVENT_TABLE(CRegisterWindow, wxDialog)
 	EVT_CLOSE(CRegisterWindow::OnClose)
 END_EVENT_TABLE()
 
+
 CRegisterWindow::CRegisterWindow(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
 	: wxDialog(parent, id, title, position, size, style)
 	, m_GPRGridView(NULL)
@@ -57,9 +58,9 @@ void CRegisterWindow::Load(IniFile& _IniFile)
 
 void CRegisterWindow::CreateGUIControls()
 {
-	SetTitle(wxT("Registers"));
-	SetIcon(wxNullIcon);
-	Center();
+	//SetTitle(wxT("Registers"));
+	//SetIcon(wxNullIcon);
+	//Center();
 
 	wxBoxSizer *sGrid = new wxBoxSizer(wxVERTICAL);
 	m_GPRGridView = new CRegisterView(this, ID_GPR);
diff --git a/Source/Core/DebuggerWX/Src/RegisterWindow.h b/Source/Core/DebuggerWX/Src/RegisterWindow.h
index 3a0600014b..dc5b2a6bd0 100644
--- a/Source/Core/DebuggerWX/Src/RegisterWindow.h
+++ b/Source/Core/DebuggerWX/Src/RegisterWindow.h
@@ -25,12 +25,12 @@ class CRegisterWindow
 	: public wxDialog
 {
 public:
-	CRegisterWindow(wxWindow* parent,
-		wxWindowID id = 1,
+	CRegisterWindow(wxWindow* parent, wxWindowID id = 1,
 		const wxString& title = wxT("Registers"),
 		const wxPoint& pos = wxDefaultPosition,
 		const wxSize& size = wxDefaultSize,
-		long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER);
+		long style = wxNO_BORDER);
+
 	virtual ~CRegisterWindow();
 
 	void Save(IniFile& _IniFile) const;
diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp
index 27e56afdc3..d7c6514518 100644
--- a/Source/Core/DolphinWX/Src/Frame.cpp
+++ b/Source/Core/DolphinWX/Src/Frame.cpp
@@ -297,6 +297,8 @@ EVT_TEXT(wxID_ANY, CFrame::PostEvent)
 //EVT_MENU_HIGHLIGHT_ALL(CFrame::PostMenuEvent)
 //EVT_UPDATE_UI(wxID_ANY, CFrame::PostUpdateUIEvent)
 
+EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY, CFrame::OnNotebookPageClose)
+
 END_EVENT_TABLE()
 /////////////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -356,8 +358,27 @@ CFrame::CFrame(bool showLogWindow,
 	if (SConfig::GetInstance().m_InterfaceConsole)
 		console->Open();
 
+	// -------------------------------------------------------------------------
+	// Panels
+	// �������������
 	m_Panel = new CPanel(this, IDM_MPANEL);
-	wxPanel * m_Panel2 = new wxPanel(this, wxID_ANY);
+	//wxPanel * m_Panel2 = new wxPanel(this, wxID_ANY);
+
+	if (UseDebugger)
+	{
+		wxBitmap page_bmp = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
+
+		m_NB1 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxSize(430,200),
+									wxAUI_NB_DEFAULT_STYLE | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER);
+
+		m_NB0 = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxSize(430,200),
+									wxAUI_NB_DEFAULT_STYLE | wxAUI_NB_TAB_EXTERNAL_MOVE | wxNO_BORDER);
+		m_NB0->AddPage(g_pCodeWindow, wxT("Code"), false, page_bmp );
+
+		g_pCodeWindow->UpdateNotebook(0, m_NB0);
+		g_pCodeWindow->UpdateNotebook(1, m_NB1);
+	}
+	// -------------------------------------------------------------------------
 
 	m_GameListCtrl = new CGameListCtrl(m_Panel, LIST_CTRL,
 			wxDefaultPosition, wxDefaultSize,
@@ -379,11 +400,11 @@ CFrame::CFrame(bool showLogWindow,
 		AuiFullscreen = m_Mgr->SavePerspective();
 		m_Mgr->GetPane(wxT("Pane1")).PaneBorder(true);
 
-		m_Mgr->AddPane(m_Panel2, wxAuiPaneInfo().
+		m_Mgr->AddPane(m_NB1, wxAuiPaneInfo().
 					Name(wxT("Pane2")).Caption(wxT("Pane2")).
 					CenterPane().Layer(1));
 
-		m_Mgr->AddPane(g_pCodeWindow, wxAuiPaneInfo().
+		m_Mgr->AddPane(m_NB0, wxAuiPaneInfo().
 					Name(wxT("Pane3")).Caption(wxT("Pane3")).
 					CenterPane().Layer(2));
 	}
@@ -492,6 +513,17 @@ void CFrame::OnClose(wxCloseEvent& event)
 	}
 }
 
+void CFrame::OnNotebookPageClose(wxAuiNotebookEvent& event)
+{
+	event.Skip();
+    wxAuiNotebook* ctrl = (wxAuiNotebook*)event.GetEventObject();
+
+	if (ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Registers"))) { GetMenuBar()->FindItem(IDM_REGISTERWINDOW)->Check(false); g_pCodeWindow->m_RegisterWindow = NULL; }
+	if (ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Breakpoints"))) { GetMenuBar()->FindItem(IDM_BREAKPOINTWINDOW)->Check(false); g_pCodeWindow->m_BreakpointWindow = NULL; }
+	if (ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("JIT"))) { GetMenuBar()->FindItem(IDM_JITWINDOW)->Check(false); g_pCodeWindow->m_JitWindow = NULL; }
+	if (ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Memory"))) { GetMenuBar()->FindItem(IDM_MEMORYWINDOW)->Check(false); g_pCodeWindow->m_MemoryWindow = NULL; }
+}
+
 void CFrame::DoFullscreen(bool _F)
 {
 	ShowFullScreen(_F);
diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h
index 0b9db173fa..ad5e764ba2 100644
--- a/Source/Core/DolphinWX/Src/Frame.h
+++ b/Source/Core/DolphinWX/Src/Frame.h
@@ -23,6 +23,7 @@
 #include <wx/busyinfo.h>
 #include <wx/mstream.h>
 #include <wx/listctrl.h>
+#include <wx/artprov.h>
 #include <wx/aui/aui.h>
 
 #include "CDUtils.h"
@@ -109,11 +110,13 @@ class CFrame : public wxFrame
 		// AUI
 		wxAuiManager *m_Mgr;
 		wxAuiToolBar *m_ToolBar, *m_ToolBar2;
+		wxAuiNotebook *m_NB0, *m_NB1;
 		// Perspectives
 		wxString AuiFullscreen;
 		wxString AuiMode1;
 		wxString AuiMode2;
 		wxString AuiCurrent;
+		void OnNotebookPageClose(wxAuiNotebookEvent& evt);
 
 		char **drives;