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) void ConsoleListener::Open(int Width, int Height, const char *Title)
{ {
#ifdef _WIN32 #ifdef _WIN32
if (!GetConsoleWindow())
{
// Open the console window and create the window handle for GetStdHandle() // Open the console window and create the window handle for GetStdHandle()
AllocConsole(); AllocConsole();
// Save the window handle that AllocConsole() created // 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 // Set the console window title
SetConsoleTitle(Title); SetConsoleTitle(Title);
// Set letter space // 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 #endif
} }
@ -271,7 +286,7 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
Color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE; Color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
break; break;
} }
if (strlen(Text) > 10) if (Level != CUSTOM_LEVEL && strlen(Text) > 10)
{ {
// First 10 chars white // First 10 chars white
SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY); SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);

View File

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

View File

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

View File

@ -174,7 +174,9 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
} }
CCodeWindow::~CCodeWindow() 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 // Redirect old wxFrame calls
wxMenuBar *CCodeWindow::GetMenuBar() wxMenuBar *CCodeWindow::GetMenuBar()

View File

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

View File

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

View File

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

View File

@ -31,12 +31,14 @@
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#include "Debugger.h" #include "IniFile.h" // Common
#include "PBView.h"
#include "IniFile.h"
#include "FileUtil.h" #include "FileUtil.h"
#include "StringUtil.h" #include "StringUtil.h"
#include "FileSearch.h" #include "FileSearch.h"
#include "LogManager.h"
#include "Debugger.h"
#include "PBView.h"
#include "../Debugger/File.h" // Write to file #include "../Debugger/File.h" // Write to file
////////////////////////////// //////////////////////////////
@ -147,6 +149,12 @@ DSPDebuggerHLE::~DSPDebuggerHLE()
file.Load(DEBUGGER_CONFIG_FILE); file.Load(DEBUGGER_CONFIG_FILE);
this->Save(file); this->Save(file);
file.Save(DEBUGGER_CONFIG_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; wxStaticBoxSizer* sLeft;
int m_radioBoxNChoices[3]; int m_radioBoxNChoices[4];
// Notebook ----------------------------------------------------- // Notebook -----------------------------------------------------

View File

@ -25,6 +25,12 @@
#include "../../../Core/Core/Src/ConfigManager.h" // FIXME #include "../../../Core/Core/Src/ConfigManager.h" // FIXME
extern DSPInitialize g_dspInitialize; 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 gSSBM;
extern bool gSSBMremedy1; extern bool gSSBMremedy1;
extern bool gSSBMremedy2; extern bool gSSBMremedy2;