GUI: Dock plugin windows

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4069 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-08-26 23:28:30 +00:00
parent b0a09c55b4
commit 1b6b56692d
7 changed files with 122 additions and 40 deletions

View file

@ -61,6 +61,11 @@ class CCodeWindow
void UpdateToolbar(wxAuiToolBar *);
void UpdateNotebook(int, wxAuiNotebook *);
wxBitmap page_bmp;
#ifdef _WIN32
wxWindow * GetWxWindow(wxString);
#endif
wxWindow * GetNootebookPage(wxString);
void DoToggleWindow(int,bool);
void Load_(IniFile &file);
void Load(IniFile &file);
@ -131,7 +136,7 @@ class CCodeWindow
void OnCodeViewChange(wxCommandEvent &event);
void SingleCPUStep();
void OnAddrBoxChange(wxCommandEvent& event);
void OnAddrBoxChange(wxCommandEvent& event);
void OnToggleWindow(wxCommandEvent& event);
void OnToggleRegisterWindow(bool,wxAuiNotebook*);

View file

@ -325,11 +325,54 @@ void CCodeWindow::OnChangeFont(wxCommandEvent& event)
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Toogle windows
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
wxWindow * CCodeWindow::GetNootebookPage(wxString Name)
{
if (!m_NB0 || !m_NB1) return NULL;
for(int i = 0; i <= m_NB0->GetPageCount(); i++)
{
if (m_NB0->GetPageText(i).IsSameAs(Name)) return m_NB0->GetPage(i);
}
for(int i = 0; i <= m_NB1->GetPageCount(); i++)
{
if (m_NB1->GetPageText(i).IsSameAs(Name)) return m_NB1->GetPage(i);
}
return NULL;
}
#ifdef _WIN32
wxWindow * CCodeWindow::GetWxWindow(wxString Name)
{
HWND hWnd = ::FindWindow(NULL, Name.c_str());
if (hWnd)
{
wxWindow * Win = new wxWindow();
Win->SetHWND((WXHWND)hWnd);
Win->AdoptAttributesFromHWND();
return Win;
}
else if (GetParent()->GetParent()->FindWindowByName(Name))
{
return GetParent()->GetParent()->FindWindowByName(Name);
}
else if (GetParent()->GetParent()->FindWindowByLabel(Name))
{
return GetParent()->GetParent()->FindWindowByLabel(Name);
}
else if (GetNootebookPage(Name))
{
return GetNootebookPage(Name);
}
else
return NULL;
}
#endif
void CCodeWindow::OnToggleWindow(wxCommandEvent& event)
{
bool Show = GetMenuBar()->IsChecked(event.GetId());
switch (event.GetId())
DoToggleWindow(event.GetId(), GetMenuBar()->IsChecked(event.GetId()));
}
void CCodeWindow::DoToggleWindow(int Id, bool Show)
{
switch (Id)
{
case IDM_REGISTERWINDOW: OnToggleRegisterWindow(Show, m_NB0); break;
case IDM_BREAKPOINTWINDOW: OnToggleBreakPointWindow(Show, m_NB1); break;
@ -337,9 +380,8 @@ void CCodeWindow::OnToggleWindow(wxCommandEvent& event)
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)
@ -441,17 +483,40 @@ void CCodeWindow::OnToggleMemoryWindow(bool Show, wxAuiNotebook * _NB)
//Toggle Sound Debugging Window
void CCodeWindow::OnToggleSoundWindow(bool Show, wxAuiNotebook * _NB)
{
//ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
if (Show)
{
// TODO: add some kind of if() check here to?
CPluginManager::GetInstance().OpenDebug(
GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
PLUGIN_TYPE_DSP, true // DSP, show
);
#ifdef _WIN32
wxWindow *Win = GetWxWindow(wxT("Sound"));
if (Win && _NB->GetPageIndex(Win) != wxNOT_FOUND) return;
{
#endif
//Console->Log(LogTypes::LNOTICE, StringFromFormat("OpenDebug\n").c_str());
CPluginManager::GetInstance().OpenDebug(
GetParent()->GetParent()->GetHandle(),
//GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
PLUGIN_TYPE_DSP, true // DSP, show
);
#ifdef _WIN32
}
Win = GetWxWindow(wxT("Sound"));
if (Win)
{
//Console->Log(LogTypes::LNOTICE, StringFromFormat("AddPage\n").c_str());
_NB->AddPage(Win, wxT("Sound"), true, page_bmp );
}
#endif
}
else // hide
{
#ifdef _WIN32
wxWindow *Win = GetWxWindow(wxT("Sound"));
if (Win) _NB->RemovePage(_NB->GetPageIndex(Win));
#endif
// Close the sound dll that has an open debugger
CPluginManager::GetInstance().OpenDebug(
GetHandle(),
@ -461,7 +526,6 @@ void CCodeWindow::OnToggleSoundWindow(bool Show, wxAuiNotebook * _NB)
}
}
// Toggle Video Debugging Window
void CCodeWindow::OnToggleVideoWindow(bool Show, wxAuiNotebook * _NB)
{
@ -469,22 +533,31 @@ void CCodeWindow::OnToggleVideoWindow(bool Show, wxAuiNotebook * _NB)
if (Show)
{
// It works now, but I'll keep this message in case the problem reappears
/*if(Core::GetState() == Core::CORE_UNINITIALIZED)
{
wxMessageBox(_T("Warning, opening this window before a game is started \n\
may cause a crash when a game is later started. Todo: figure out why and fix it."), wxT("OpenGL Debugging Window"));
}*/
#ifdef _WIN32
wxWindow *Win = GetWxWindow(wxT("Video"));
if (Win && _NB->GetPageIndex(Win) != wxNOT_FOUND) return;
// TODO: add some kind of if() check here to?
CPluginManager::GetInstance().OpenDebug(
GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
PLUGIN_TYPE_VIDEO, true // Video, show
);
{
#endif
// Show and/or create the window
CPluginManager::GetInstance().OpenDebug(
GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
PLUGIN_TYPE_VIDEO, true // Video, show
);
#ifdef _WIN32
}
Win = GetWxWindow(wxT("Video"));
if (Win) _NB->AddPage(Win, wxT("Video"), true, page_bmp );
#endif
}
else // hide
{
#ifdef _WIN32
wxWindow *Win = GetWxWindow(wxT("Video"));
if (Win) _NB->RemovePage(_NB->GetPageIndex(Win));
#endif
// Close the video dll that has an open debugger
CPluginManager::GetInstance().OpenDebug(
GetHandle(),

View file

@ -521,13 +521,18 @@ void CFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& event)
}
void CFrame::OnNotebookPageClose(wxAuiNotebookEvent& event)
{
event.Skip();
// Don't skip the event, override it
//event.Skip();
event.Veto();
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; }
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Registers"))) { GetMenuBar()->FindItem(IDM_REGISTERWINDOW)->Check(false); g_pCodeWindow->DoToggleWindow(IDM_REGISTERWINDOW, false); }
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Breakpoints"))) { GetMenuBar()->FindItem(IDM_BREAKPOINTWINDOW)->Check(false); g_pCodeWindow->DoToggleWindow(IDM_BREAKPOINTWINDOW, false); }
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("JIT"))) { GetMenuBar()->FindItem(IDM_JITWINDOW)->Check(false); g_pCodeWindow->DoToggleWindow(IDM_JITWINDOW, false); }
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Memory"))) { GetMenuBar()->FindItem(IDM_MEMORYWINDOW)->Check(false); g_pCodeWindow->DoToggleWindow(IDM_MEMORYWINDOW, false); }
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Sound"))) { GetMenuBar()->FindItem(IDM_SOUNDWINDOW)->Check(false); g_pCodeWindow->DoToggleWindow(IDM_SOUNDWINDOW, false); }
if (Ctrl->GetPageText(event.GetSelection()).IsSameAs(wxT("Video"))) { GetMenuBar()->FindItem(IDM_VIDEOWINDOW)->Check(false); g_pCodeWindow->DoToggleWindow(IDM_VIDEOWINDOW, false); }
}
void CFrame::DoFullscreen(bool _F)

View file

@ -225,13 +225,12 @@ void DSPDebuggerHLE::Load(IniFile& _IniFile)
// -------------
void DSPDebuggerHLE::CreateGUIControls()
{
SetTitle(wxT("Sound Debugging"));
//SetTitle(wxT("Sound"));
// Basic settings
SetIcon(wxNullIcon);
SetSize(8, 8, 200, 100); // These will become the minimin sizes allowed by resizing
Center();
//SetIcon(wxNullIcon);
//SetSize(8, 8, 200, 100); // These will become the minimin sizes allowed by resizing
//Center();
// Declarations
wxBoxSizer * m_MainSizer, * sMain, *_sMail, * sBlock;

View file

@ -60,10 +60,10 @@ class DSPDebuggerHLE : public wxDialog
public:
DSPDebuggerHLE(wxWindow *parent,
wxWindowID id = 1,
const wxString &title = wxT("Sound Debugger"),
const wxString &title = wxT("Sound"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);
long style = wxNO_BORDER);
virtual ~DSPDebuggerHLE();

View file

@ -30,10 +30,10 @@ class GFXDebuggerOGL : public wxDialog
public:
GFXDebuggerOGL(wxWindow *parent,
wxWindowID id = 1,
const wxString &title = wxT("OGL Debugguer"),
const wxString &title = wxT("Video"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE);
long style = wxNO_BORDER);
virtual ~GFXDebuggerOGL();

View file

@ -158,7 +158,7 @@ void DllDebugger(HWND _hParent, bool Show)
m_DebuggerFrame = new GFXDebuggerOGL(GetParentedWxWindow(_hParent));
if (Show)
m_DebuggerFrame->ShowModal();
m_DebuggerFrame->Show();
else
m_DebuggerFrame->Hide();
}