GUI: Bugfixes

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4137 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-09-01 12:44:02 +00:00
parent bd227d3831
commit 478ed4b11e
10 changed files with 299 additions and 112 deletions

View file

@ -47,6 +47,8 @@ ConsoleListener::~ConsoleListener()
void ConsoleListener::Open(int Width, int Height, const char *Title)
{
#ifdef _WIN32
if (!GetConsoleWindow())
{
// Open the console window and create the window handle for GetStdHandle()
AllocConsole();
// Save the window handle that AllocConsole() created
@ -54,7 +56,20 @@ void ConsoleListener::Open(int Width, int Height, const char *Title)
// Set the console window title
SetConsoleTitle(Title);
// Set letter space
LetterSpace(80, 4000);
LetterSpace(80, 1000);
MoveWindow(GetConsoleWindow(), 200,200, 800,800, true);
}
else
{
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
}
#endif
}
void ConsoleListener::UpdateHandle()
{
#ifdef _WIN32
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
#endif
}
@ -271,7 +286,7 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
Color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
break;
}
if (strlen(Text) > 10)
if (Level != CUSTOM_LEVEL && strlen(Text) > 10)
{
// First 10 chars white
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);

View file

@ -23,6 +23,7 @@
#define WARNING_LEVEL 3 // Something is suspicious.
#define INFO_LEVEL 4 // General information.
#define DEBUG_LEVEL 5 // Detailed debugging - might make things slow.
#define CUSTOM_LEVEL 6 // Custom level, no text formatting
namespace LogTypes
{
@ -81,6 +82,7 @@ enum LOG_LEVELS {
LWARNING = WARNING_LEVEL,
LINFO = INFO_LEVEL,
LDEBUG = DEBUG_LEVEL,
LCUSTOM = CUSTOM_LEVEL
};
} // namespace

View file

@ -73,8 +73,8 @@ public:
ConsoleListener();
~ConsoleListener();
void Open(int Width = 100, int Height = 100,
const char * Name = "Console");
void Open(int Width = 100, int Height = 100, const char * Name = "Console");
void UpdateHandle();
void Close();
bool IsOpen();
void LetterSpace(int Width, int Height);

View file

@ -174,7 +174,9 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
}
CCodeWindow::~CCodeWindow()
{
Parent->g_pCodeWindow = NULL;
//if (Parent) Parent->g_pCodeWindow = NULL;
//ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
//Console->Log(LogTypes::LERROR, StringFromFormat(" >>> CCodeWindow Destroyed\n").c_str());
}
// Redirect old wxFrame calls
wxMenuBar *CCodeWindow::GetMenuBar()

View file

@ -418,6 +418,20 @@ void CCodeWindow::OnToggleMemoryWindow(bool Show, int i)
#endif
}
/*
Notice: This windows docking for plugin windows will produce several wx debugging messages when
::GetWindowRect and ::DestroyWindow fails in wxApp::CleanUp() for the plugin.
*/
//Toggle Sound Debugging Window
void CCodeWindow::OnToggleSoundWindow(bool Show, int i)
{
@ -446,13 +460,10 @@ void CCodeWindow::OnToggleSoundWindow(bool Show, int i)
Win = Parent->GetWxWindow(wxT("Sound"));
if (Win)
{
//Parent->ListChildren();
Win->SetName(wxT("Sound"));
Win->Reparent(Parent);
//Console->Log(LogTypes::LNOTICE, StringFromFormat("Reparent\n").c_str());
//Parent->ListChildren();
Parent->GetNotebook(i)->AddPage(Win, wxT("Sound"), true, Parent->aNormalFile );
Console->Log(LogTypes::LNOTICE, StringFromFormat("AddPage\n").c_str());
//Console->Log(LogTypes::LNOTICE, StringFromFormat("AddPage\n").c_str());
//Parent->ListChildren();
//Console->Log(LogTypes::LNOTICE, StringFromFormat("OpenDebug: Win %i\n", FindWindowByName(wxT("Sound"))).c_str());
}
@ -466,7 +477,15 @@ void CCodeWindow::OnToggleSoundWindow(bool Show, int i)
{
#ifdef _WIN32
wxWindow *Win = Parent->GetWxWindow(wxT("Sound"));
if (Win)
{
Parent->DoRemovePage(Win, false);
//Console->Log(LogTypes::LNOTICE, StringFromFormat("Sound removed from NB (Win %i)\n", FindWindowByName(wxT("Sound"))).c_str());
}
else
{
//Console->Log(LogTypes::LNOTICE, StringFromFormat("Sound not found (Win %i)\n", FindWindowByName(wxT("Sound"))).c_str());
}
#endif
// Close the sound dll that has an open debugger
CPluginManager::GetInstance().OpenDebug(

View file

@ -17,16 +17,22 @@
/*
//////////////////////////////////////////////////////////////////////////////////////////
// Windows
/* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
CFrame is the main parent window. Inside CFrame there is an m_Panel that is the
parent for the rendering window (when we render to the main window). In Windows
the rendering window is created by giving CreateWindow() m_Panel->GetHandle()
as parent window and creating a new child window to m_Panel. The new child
window handle that is returned by CreateWindow() can be accessed from
Core::GetWindowHandle().
*/
CFrame is the main parent window. Inside CFrame there is an m_Panel that is the parent for
the rendering window (when we render to the main window). In Windows the rendering window is
created by giving CreateWindow() m_Panel->GetHandle() as parent window and creating a new
child window to m_Panel. The new child window handle that is returned by CreateWindow() can
be accessed from Core::GetWindowHandle().
///////////////////////////////////////////////*/
// ----------------------------------------------------------------------------
// includes
// ----------------------------------------------------------------------------
#include "Common.h" // Common
#include "FileUtil.h"
@ -51,6 +57,10 @@ Core::GetWindowHandle().
#include <wx/datetime.h> // wxWidgets
// ----------------------------------------------------------------------------
// resources
// ----------------------------------------------------------------------------
extern "C" {
#include "../resources/Dolphin.c" // Dolphin icon
#include "../resources/toolbar_browse.c"
@ -72,10 +82,10 @@ extern "C" {
};
/* Windows functions. Setting the cursor with wxSetCursor() did not work in
this instance. Probably because it's somehow reset from the WndProc() in
the child window */
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/* Windows functions. Setting the cursor with wxSetCursor() did not work in this instance.
Probably because it's somehow reset from the WndProc() in the child window */
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
#ifdef _WIN32
// Declare a blank icon and one that will be the normal cursor
HCURSOR hCursor = NULL, hCursorBlank = NULL;
@ -103,7 +113,13 @@ HWND MSWGetParent_(HWND Parent)
return GetParent(Parent);
}
#endif
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/* The CPanel class to receive MSWWindowProc messages from the video plugin. */
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
extern CFrame* main_frame;
class CPanel : public wxPanel
@ -177,8 +193,9 @@ int abc = 0;
Core::ReconnectWiimote();
return 0;
// -----------------------------------------
#ifdef RERECORDING
// -----------------
case INPUT_FRAME_COUNTER:
// Wind back the frame counter after a save state has been loaded
Core::WindBack((int)lParam);
@ -196,6 +213,12 @@ int abc = 0;
return wxPanel::MSWWindowProc(nMsg, wParam, lParam);
}
#endif
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// event tables
// ----------------------------
// Notice that wxID_HELP will be processed for the 'About' menu and the toolbar
// help button.
@ -288,8 +311,12 @@ EVT_AUINOTEBOOK_ALLOW_DND(wxID_ANY, CFrame::OnAllowNotebookDnD)
EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, CFrame::OnNotebookPageChanged)
END_EVENT_TABLE()
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Creation and close, quit functions
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
CFrame::CFrame(bool showLogWindow,
wxFrame* parent,
wxWindowID id,
@ -300,7 +327,7 @@ CFrame::CFrame(bool showLogWindow,
long style)
: wxFrame(parent, id, title, pos, size, style)
, UseDebugger(_UseDebugger), m_LogWindow(NULL)
, m_pStatusBar(NULL), bRenderToMain(true), HaveLeds(false)
, m_GameListCtrl(NULL), m_pStatusBar(NULL), bRenderToMain(true), HaveLeds(false)
, HaveSpeakers(false), m_Panel(NULL), m_ToolBar(NULL), m_ToolBarDebug(NULL)
, m_bLogWindow(showLogWindow || SConfig::GetInstance().m_InterfaceLogWindow)
, m_fLastClickTime(0), m_iLastMotionTime(0), LastMouseX(0), LastMouseY(0)
@ -314,7 +341,7 @@ CFrame::CFrame(bool showLogWindow,
if (SConfig::GetInstance().m_InterfaceConsole) Console->Open();
// Start debugging mazimized
//if (UseDebugger) this->Maximize(true);
if (UseDebugger) this->Maximize(true);
// Debugger class
if (UseDebugger)
{
@ -345,6 +372,9 @@ CFrame::CFrame(bool showLogWindow,
// Give it a menu bar
CreateMenu();
// -------------------------------------------------------------------------
// Main panel
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
// This panel is the parent for rendering and it holds the gamelistctrl
m_Panel = new CPanel(this, IDM_MPANEL);
@ -355,6 +385,7 @@ CFrame::CFrame(bool showLogWindow,
sizerPanel = new wxBoxSizer(wxHORIZONTAL);
sizerPanel->Add(m_GameListCtrl, 1, wxEXPAND | wxALL);
m_Panel->SetSizer(sizerPanel);
// -------------------------------------------------------------------------
m_Mgr = new wxAuiManager();
m_Mgr->SetManagedWindow(this);
@ -425,6 +456,9 @@ CFrame::CFrame(bool showLogWindow,
CreateCursor();
#endif
// -------------------------
// Connect event handlers
// ----------
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN, // Keyboard
wxKeyEventHandler(CFrame::OnKeyDown),
(wxObject*)0, this);
@ -442,14 +476,20 @@ CFrame::CFrame(bool showLogWindow,
wxTheApp->Connect(wxID_ANY, wxEVT_MOTION,
wxMouseEventHandler(CFrame::OnMotion),
(wxObject*)0, this);
// ----------
// Update controls
UpdateGUI();
m_GameListCtrl->Update();
//if we are ever going back to optional iso caching:
//m_GameListCtrl->Update(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableIsoCache);
if (m_GameListCtrl) m_GameListCtrl->Update();
// If we are rerecording create the status bar now instead of later when a game starts
#ifdef RERECORDING
ModifyStatusBar();
// It's to early for the OnHostMessage(), we will update the status when Ctrl or Space is pressed
//Core::WriteStatus();
#endif
}
// Destructor
@ -461,6 +501,8 @@ CFrame::~CFrame()
#if wxUSE_TIMER
if (m_timer.IsRunning()) m_timer.Stop();
#endif
ClosePages();
}
void CFrame::OnQuit(wxCommandEvent& WXUNUSED (event))
@ -579,46 +621,66 @@ void CFrame::ListChildren()
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
wxAuiNotebook * NB = NULL;
Console->Log(LogTypes::LCUSTOM, "--------------------------------------------------------------------\n");
for (int i = 0; i < this->GetChildren().size(); i++)
{
wxWindow * Win = this->GetChildren().Item(i)->GetData();
// FIXME: fix POD passing error from uncommenting
// Console->Log(LogTypes::LNOTICE, StringFromFormat(
// "%i: %s (%s) :: %s", i,
// Win->GetName().mb_str(), Win->GetLabel().mb_str(), Win->GetParent()->GetName().mb_str()).c_str());
Console->Log(LogTypes::LCUSTOM, StringFromFormat(
"%i: %s (%s) :: %s", i,
Win->GetName().mb_str(), Win->GetLabel().mb_str(), Win->GetParent()->GetName().mb_str()).c_str());
//if (Win->GetName().IsSameAs(wxT("control")))
if (Win->IsKindOf(CLASSINFO(wxAuiNotebook)))
{
NB = (wxAuiNotebook*)Win;
Console->Log(LogTypes::LNOTICE, StringFromFormat("%s", NB->GetName().mb_str()).c_str());
Console->Log(LogTypes::LCUSTOM, StringFromFormat(" :: NB", NB->GetName().mb_str()).c_str());
}
else
{
NB = NULL;
}
Console->Log(LogTypes::LNOTICE, StringFromFormat("\n").c_str());
Console->Log(LogTypes::LCUSTOM, StringFromFormat("\n").c_str());
Win = this->GetChildren().Item(i)->GetData();
for (int j = 0; j < Win->GetChildren().size(); j++)
{
// FIXME: fix POD passing error from uncommenting
// Console->Log(LogTypes::LNOTICE, StringFromFormat(
// " %i.%i: %s (%s) :: %s", i, j,
// Win->GetName().mb_str(), Win->GetLabel().mb_str(), Win->GetParent()->GetName().mb_str()).c_str());
// if (NB)
// Console->Log(LogTypes::LNOTICE, StringFromFormat("%s", NB->GetPage(j)->GetName().mb_str()).c_str());
// Console->Log(LogTypes::LNOTICE, StringFromFormat("\n").c_str());
Console->Log(LogTypes::LCUSTOM, StringFromFormat(
" %i.%i: %s (%s) :: %s", i, j,
Win->GetName().mb_str(), Win->GetLabel().mb_str(), Win->GetParent()->GetName().mb_str()).c_str());
if (NB)
{
if (j < NB->GetPageCount())
Console->Log(LogTypes::LCUSTOM, StringFromFormat(" :: %s", NB->GetPage(j)->GetName().mb_str()).c_str());
}
Console->Log(LogTypes::LCUSTOM, StringFromFormat("\n").c_str());
/*
Win = this->GetChildren().Item(j)->GetData();
for (int k = 0; k < Win->GetChildren().size(); k++)
{
// FIXME: fix POD passing error from uncommenting
// Console->Log(LogTypes::LNOTICE, StringFromFormat(
// " %i.%i.%i: %s (%s) :: %s\n", i, j, k,
// Win->GetName().mb_str(), Win->GetLabel().mb_str(), Win->GetParent()->GetName().mb_str()).c_str());
Console->Log(LogTypes::LCUSTOM, StringFromFormat(
" %i.%i.%i: %s (%s) :: %s\n", i, j, k,
Win->GetName().mb_str(), Win->GetLabel().mb_str(), Win->GetParent()->GetName().mb_str()).c_str());
}
*/
}
}
Console->Log(LogTypes::LCUSTOM, "--------------------------------------------------------------------\n");
for (int i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) continue;
wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window;
Console->Log(LogTypes::LCUSTOM, StringFromFormat("%i: %s\n", i, m_Mgr->GetAllPanes().Item(i).name.mb_str()).c_str());
for (int j = 0; j < NB->GetPageCount(); j++)
{
Console->Log(LogTypes::LCUSTOM, StringFromFormat("%i.%i: %s\n", i, j, NB->GetPageText(j).mb_str()).c_str());
}
}
Console->Log(LogTypes::LCUSTOM, "--------------------------------------------------------------------\n");
}
void CFrame::ReloadPanes()
{
@ -626,8 +688,7 @@ void CFrame::ReloadPanes()
bool bConsole = SConfig::GetInstance().m_InterfaceConsole;
//ListChildren();
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
//ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
//Console->Log(LogTypes::LNOTICE, StringFromFormat("ReloadPanes begin: Sound %i\n", FindWindowByName(wxT("Sound"))).c_str());
if (ActivePerspective >= Perspectives.size()) ActivePerspective = 0;
@ -638,35 +699,25 @@ void CFrame::ReloadPanes()
// Check that the perspective was saved once before
if (Perspectives.at(ActivePerspective).Width.size() == 0) return;
// Hide to avoid flickering
HideAllNotebooks(true);
// Close all pages
ClosePages();
/*
Console->Log(LogTypes::LNOTICE, StringFromFormat(
"Will detached panes, have %i panes (%i NBs)\n", m_Mgr->GetAllPanes().GetCount(), GetNotebookCount()).c_str());
*/
CloseAllNotebooks();
m_Mgr->Update();
/*
Console->Log(LogTypes::LNOTICE, StringFromFormat(
"Detached panes, have %i panes (%i NBs)\n", m_Mgr->GetAllPanes().GetCount(), GetNotebookCount()).c_str());
*/
//m_Mgr->Update();
// Create new panes with notebooks
for (int i = 0; i < Perspectives.at(ActivePerspective).Width.size() - 1; i++)
{
m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo().Show());
m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo().Hide());
}
/*
Console->Log(LogTypes::LNOTICE, StringFromFormat(
"Created %i panes, have %i panes (%i NBs)\n",
Perspectives.at(ActivePerspective).Width.size() - 1, m_Mgr->GetAllPanes().GetCount(), GetNotebookCount()).c_str());
*/
HideAllNotebooks(true);
// Names
NamePanes();
// Perspectives
m_Mgr->LoadPerspective(Perspectives.at(ActivePerspective).Perspective, true);
m_Mgr->LoadPerspective(Perspectives.at(ActivePerspective).Perspective, false);
}
// Create one pane by default
else
@ -674,31 +725,33 @@ void CFrame::ReloadPanes()
m_Mgr->AddPane(CreateEmptyNotebook());
}
//Console->Log(LogTypes::LNOTICE, StringFromFormat("ReloadPanes end: Sound %i\n", FindWindowByName(wxT("Sound"))).c_str());
//ListChildren();
// If the code window was closed
if (!g_pCodeWindow) g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, this);
// Restore settings
SConfig::GetInstance().m_InterfaceConsole = bConsole;
// Load GUI settings
g_pCodeWindow->Load();
// Open notebook pages
AddRemoveBlankPage();
g_pCodeWindow->OpenPages();
if (m_bLogWindow) DoToggleWindow(IDM_LOGWINDOW, true);
//if (bConsole) DoToggleWindow(IDM_CONSOLEWINDOW, true);
if (SConfig::GetInstance().m_InterfaceConsole) DoToggleWindow(IDM_CONSOLEWINDOW, true);
//Console->Log(LogTypes::LNOTICE, StringFromFormat("ReloadPanes end: Sound %i\n", FindWindowByName(wxT("Sound"))).c_str());
//ListChildren();
}
void CFrame::DoLoadPerspective()
{
ReloadPanes();
// Restore the exact window sizes, which LoadPerspective doesn't always do
SetPaneSize();
// Show
ShowAllNotebooks(true);
/*
/* */
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
Console->Log(LogTypes::LNOTICE, StringFromFormat(
"Loaded: %s, NBs: %i, Non-NBs: %i, \n\n",
Perspectives.at(ActivePerspective).Name.c_str(), GetNotebookCount(), m_Mgr->GetAllPanes().GetCount() - GetNotebookCount()).c_str());
*/
Console->Log(LogTypes::LCUSTOM, StringFromFormat(
"Loaded: %s (%i panes, %i NBs)\n",
Perspectives.at(ActivePerspective).Name.c_str(), m_Mgr->GetAllPanes().GetCount(), GetNotebookCount()).c_str());
}
// Update the local perspectives array
void CFrame::SaveLocal()
@ -799,9 +852,9 @@ void CFrame::Save()
/**/
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
Console->Log(LogTypes::LNOTICE, StringFromFormat(
"Saved: %s, NBs: %i, Non-NBs: %i, \n\n",
Perspectives.at(ActivePerspective).Name.c_str(), GetNotebookCount(), m_Mgr->GetAllPanes().GetCount() - GetNotebookCount()).c_str());
Console->Log(LogTypes::LCUSTOM, StringFromFormat(
"Saved: %s (%i panes, %i NBs)\n",
Perspectives.at(ActivePerspective).Name.c_str(), m_Mgr->GetAllPanes().GetCount(), GetNotebookCount()).c_str());
TogglePaneStyle(m_ToolBarAui->GetToolToggled(IDM_EDIT_PERSPECTIVES));
@ -852,18 +905,24 @@ void CFrame::OnPaneClose(wxAuiManagerEvent& event)
{
/*
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
Console->Log(LogTypes::LNOTICE, StringFromFormat("GetNotebookCount before: %i\n", GetNotebookCount()).c_str());
Console->Log(LogTypes::LCUSTOM, StringFromFormat("GetNotebookCount before: %i\n", GetNotebookCount()).c_str());
*/
// Detach and delete the empty notebook
event.pane->DestroyOnClose(true);
m_Mgr->ClosePane(*event.pane);
//Console->Log(LogTypes::LNOTICE, StringFromFormat("GetNotebookCount after: %i\n", GetNotebookCount()).c_str());
//Console->Log(LogTypes::LCUSTOM, StringFromFormat("GetNotebookCount after: %i\n", GetNotebookCount()).c_str());
}
m_Mgr->Update();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Host messages
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
#ifdef _WIN32
WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
{
@ -921,8 +980,12 @@ void CFrame::PostUpdateUIEvent(wxUpdateUIEvent& event)
{
if (g_pCodeWindow) wxPostEvent(g_pCodeWindow, event);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Input
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event))
{
// Show all platforms and regions if...
@ -1012,7 +1075,12 @@ void CFrame::OnKeyUp(wxKeyEvent& event)
CPluginManager::GetInstance().GetPad(0)->PAD_Input(event.GetKeyCode(), 0); // 0 = Up
event.Skip();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// Detect double click. Kind of, for some reason we have to manually create the double click for now.
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void CFrame::OnDoubleClick(wxMouseEvent& event)
{
// Don't block the mouse click
@ -1136,3 +1204,4 @@ void CFrame::Update()
}
}
#endif
/////////////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -117,11 +117,13 @@ class CFrame : public wxFrame
void ListChildren();
void ClosePages();
void DoToggleWindow(int,bool);
void ShowAllNotebooks(bool Window = false);
void HideAllNotebooks(bool Window = false);
void CloseAllNotebooks();
int GetNotebookCount();
void DoAddPage(wxWindow *, int, std::string);
void DoRemovePage(wxWindow *, bool Hide = true);
void DoRemovePageString(wxString, bool Hide = true);
void DoRemovePageString(wxString, bool Hide = true, bool Destroy = false);
void HidePane();
void SetSimplePaneSize();
void SetPaneSize();

View file

@ -293,6 +293,7 @@ void CFrame::RecreateToolbar()
m_ToolBar = new wxAuiToolBar(this, ID_TOOLBAR, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_TEXT);
PopulateToolbar(m_ToolBar);
m_Mgr->AddPane(m_ToolBar, wxAuiPaneInfo().
Name(wxT("TBMain")).Caption(wxT("TBMain")).
ToolbarPane().Top().
@ -303,12 +304,11 @@ void CFrame::RecreateToolbar()
m_ToolBarDebug = new wxAuiToolBar(this, ID_TOOLBAR_DEBUG, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_TEXT);
g_pCodeWindow->PopulateToolbar(m_ToolBarDebug);
/*
m_Mgr->AddPane(m_ToolBarDebug, wxAuiPaneInfo().
Name(wxT("TBDebug")).Caption(wxT("TBDebug")).
ToolbarPane().Top().
LeftDockable(false).RightDockable(false).Floatable(false));
*/
m_ToolBarAui = new wxAuiToolBar(this, ID_TOOLBAR_AUI, wxDefaultPosition, wxDefaultSize,
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW | wxAUI_TB_TEXT);
@ -1070,7 +1070,7 @@ int CFrame::GetNootebookAffiliation(wxString Name)
void CFrame::ClosePages()
{
DoToggleWindow(IDM_LOGWINDOW, false);
//DoToggleWindow(IDM_CONSOLEWINDOW, false);
DoToggleWindow(IDM_CONSOLEWINDOW, false);
DoToggleWindow(IDM_CODEWINDOW, false);
DoToggleWindow(IDM_REGISTERWINDOW, false);
DoToggleWindow(IDM_BREAKPOINTWINDOW, false);
@ -1085,6 +1085,12 @@ void CFrame::DoToggleWindow(int Id, bool Show)
{
case IDM_LOGWINDOW: ToggleLogWindow(Show, UseDebugger ? g_pCodeWindow->iLogWindow : 0); break;
case IDM_CONSOLEWINDOW: ToggleConsole(Show, UseDebugger ? g_pCodeWindow->iConsoleWindow : 0); break;
}
if (!UseDebugger) return;
switch (Id)
{
case IDM_CODEWINDOW: g_pCodeWindow->OnToggleCodeWindow(Show, g_pCodeWindow->iCodeWindow); break;
case IDM_REGISTERWINDOW: g_pCodeWindow->OnToggleRegisterWindow(Show, g_pCodeWindow->iRegisterWindow); break;
case IDM_BREAKPOINTWINDOW: g_pCodeWindow->OnToggleBreakPointWindow(Show, g_pCodeWindow->iBreakpointWindow); break;
@ -1154,7 +1160,7 @@ void CFrame::HidePane()
SetSimplePaneSize();
}
void CFrame::DoRemovePageString(wxString Str, bool Hide)
void CFrame::DoRemovePageString(wxString Str, bool Hide, bool Destroy)
{
for (int i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{
@ -1162,10 +1168,25 @@ void CFrame::DoRemovePageString(wxString Str, bool Hide)
wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window;
for (int j = 0; j < NB->GetPageCount(); j++)
{
if (NB->GetPageText(j).IsSameAs(Str)) { NB->RemovePage(j); break; }
if (NB->GetPageText(j).IsSameAs(Str))
{
if (!Destroy)
{
// Reparent to avoid destruction if the notebook is closed and destroyed
wxWindow * Win = NB->GetPage(j);
NB->RemovePage(j);
Win->Reparent(this);
}
else
{
NB->DeletePage(j);
}
//if (Hide) Win->Hide();
break;
}
}
}
}
wxAuiNotebook * CFrame::GetNotebook(int NBId)
{
@ -1178,6 +1199,34 @@ wxAuiNotebook * CFrame::GetNotebook(int NBId)
}
return NULL;
}
void CFrame::ShowAllNotebooks(bool Window)
{
for (int i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{
if (m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook)))
{
if (Window)
m_Mgr->GetAllPanes().Item(i).Show();
else
m_Mgr->GetAllPanes().Item(i).window->Hide();
}
}
m_Mgr->Update();
}
void CFrame::HideAllNotebooks(bool Window)
{
for (int i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{
if (m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook)))
{
if (Window)
m_Mgr->GetAllPanes().Item(i).Hide();
else
m_Mgr->GetAllPanes().Item(i).window->Hide();
}
}
m_Mgr->Update();
}
// Close all panes with notebooks
void CFrame::CloseAllNotebooks()
{
@ -1186,10 +1235,10 @@ void CFrame::CloseAllNotebooks()
{
if (m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook)))
{
//m_Mgr->GetAllPanes().Item(i).DestroyOnClose(true);
//m_Mgr->ClosePane(m_Mgr->GetAllPanes().Item(i));
m_Mgr->GetAllPanes().Item(i).window->Hide();
m_Mgr->DetachPane(m_Mgr->GetAllPanes().Item(i).window);
m_Mgr->GetAllPanes().Item(i).DestroyOnClose(true);
m_Mgr->ClosePane(m_Mgr->GetAllPanes().Item(i));
//m_Mgr->GetAllPanes().Item(i).window->Hide();
//m_Mgr->DetachPane(m_Mgr->GetAllPanes().Item(i).window);
i = 0;
//Console->Log(LogTypes::LCUSTOM, StringFromFormat(" %i Pane\n", i).c_str());
@ -1236,6 +1285,9 @@ void CFrame::DoRemovePage(wxWindow * Win, bool Hide)
{
if (GetNotebook(i)->GetPageIndex(Win) != wxNOT_FOUND) GetNotebook(i)->RemovePage(GetNotebook(i)->GetPageIndex(Win));
}
// Reparent to avoid destruction if the notebook is closed and destroyed
Win->Reparent(this);
if (Hide) Win->Hide();
}
}
@ -1318,6 +1370,8 @@ void CFrame::ToggleConsole(bool Show, int i)
if (Show)
{
//Console->Log(LogTypes::LCUSTOM, StringFromFormat(" >>> Show\n").c_str());
if (GetNotebookCount() == 0) return;
if (i < 0 || i > GetNotebookCount()-1) i = 0;
@ -1346,17 +1400,19 @@ void CFrame::ToggleConsole(bool Show, int i)
}
else // hide
{
//Console->Log(LogTypes::LCUSTOM, StringFromFormat(" >>> Show\n").c_str());
#ifdef _WIN32
//wxWindow *Win = GetWxWindowHwnd(GetConsoleWindow());
//DoRemovePage (Win, true);
DoRemovePageString(wxT("Console"), true);
// Hide
if(GetConsoleWindow()) ShowWindow(GetConsoleWindow(),SW_HIDE);
// Release the console to Windows
::SetParent(GetConsoleWindow(), NULL);
// Destroy the empty parent of the console
DoRemovePageString(wxT("Console"), true, true);
#else
Console->Close();
#endif
}
// Hide pane
@ -1388,6 +1444,8 @@ void CFrame::OnResize(wxSizeEvent& event)
// Update the enabled/disabled status
void CFrame::UpdateGUI()
{
return;
// Save status
bool initialized = Core::isRunning();
bool running = Core::GetState() == Core::CORE_RUN;
@ -1451,21 +1509,27 @@ void CFrame::UpdateGUI()
if (!initialized)
{
if (m_GameListCtrl && !m_GameListCtrl->IsShown())
if (m_GameListCtrl)
{
if (!m_GameListCtrl->IsShown())
{
m_GameListCtrl->Enable();
m_GameListCtrl->Show();
sizerPanel->FitInside(m_Panel);
}
}
}
else
{
if (m_GameListCtrl && m_GameListCtrl->IsShown())
if (m_GameListCtrl)
{
if (m_GameListCtrl->IsShown())
{
m_GameListCtrl->Disable();
m_GameListCtrl->Hide();
}
}
}
// Commit changes to toolbar
if (m_ToolBar != NULL) m_ToolBar->Realize();

View file

@ -31,12 +31,14 @@
#include <stdlib.h>
#endif
#include "Debugger.h"
#include "PBView.h"
#include "IniFile.h"
#include "IniFile.h" // Common
#include "FileUtil.h"
#include "StringUtil.h"
#include "FileSearch.h"
#include "LogManager.h"
#include "Debugger.h"
#include "PBView.h"
#include "../Debugger/File.h" // Write to file
//////////////////////////////
@ -147,6 +149,12 @@ DSPDebuggerHLE::~DSPDebuggerHLE()
file.Load(DEBUGGER_CONFIG_FILE);
this->Save(file);
file.Save(DEBUGGER_CONFIG_FILE);
// Reset
m_DebuggerFrame = NULL;
// Talk
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
Console->Log(LogTypes::LNOTICE, StringFromFormat("Sound closed\n").c_str());
}
// ====================
@ -241,7 +249,7 @@ void DSPDebuggerHLE::CreateGUIControls()
wxStaticBoxSizer* sLeft;
int m_radioBoxNChoices[3];
int m_radioBoxNChoices[4];
// Notebook -----------------------------------------------------

View file

@ -25,6 +25,12 @@
#include "../../../Core/Core/Src/ConfigManager.h" // FIXME
extern DSPInitialize g_dspInitialize;
#if defined(HAVE_WX) && HAVE_WX
#include "Debugger/Debugger.h"
class DSPDebuggerHLE;
extern DSPDebuggerHLE* m_DebuggerFrame;
#endif
extern bool gSSBM;
extern bool gSSBMremedy1;
extern bool gSSBMremedy2;