Fix a segmentation fault when changing perspectives.

Some general code clean up.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5948 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-07-23 03:53:18 +00:00
parent ba67333053
commit 2e6c5b36ab
5 changed files with 188 additions and 247 deletions

View File

@ -15,7 +15,6 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// Include // Include
#include "Common.h" #include "Common.h"
@ -60,7 +59,6 @@
#include "PluginManager.h" #include "PluginManager.h"
#include "ConfigManager.h" #include "ConfigManager.h"
extern "C" // Bitmaps extern "C" // Bitmaps
{ {
#include "../resources/toolbar_play.c" #include "../resources/toolbar_play.c"
@ -73,83 +71,73 @@ extern "C" // Bitmaps
class CPluginInfo; class CPluginInfo;
class CPluginManager; class CPluginManager;
// ------- // -------
// Main // Main
BEGIN_EVENT_TABLE(CCodeWindow, wxPanel) BEGIN_EVENT_TABLE(CCodeWindow, wxPanel)
// Menu bar // Menu bar
EVT_MENU(IDM_AUTOMATICSTART, CCodeWindow::OnCPUMode) // Options EVT_MENU(IDM_AUTOMATICSTART, CCodeWindow::OnCPUMode) // Options
EVT_MENU(IDM_BOOTTOPAUSE, CCodeWindow::OnCPUMode) EVT_MENU(IDM_BOOTTOPAUSE, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_FONTPICKER, CCodeWindow::OnChangeFont) EVT_MENU(IDM_FONTPICKER, CCodeWindow::OnChangeFont)
EVT_MENU(IDM_INTERPRETER, CCodeWindow::OnCPUMode) // Jit EVT_MENU(IDM_INTERPRETER, CCodeWindow::OnCPUMode) // Jit
EVT_MENU(IDM_JITNOBLOCKCACHE, CCodeWindow::OnCPUMode) EVT_MENU(IDM_JITNOBLOCKCACHE, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITOFF, CCodeWindow::OnCPUMode) EVT_MENU(IDM_JITOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITLSOFF, CCodeWindow::OnCPUMode) EVT_MENU(IDM_JITLSOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITLSLXZOFF, CCodeWindow::OnCPUMode) EVT_MENU(IDM_JITLSLXZOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITLSLWZOFF, CCodeWindow::OnCPUMode) EVT_MENU(IDM_JITLSLWZOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITLSLBZXOFF, CCodeWindow::OnCPUMode) EVT_MENU(IDM_JITLSLBZXOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITLSFOFF, CCodeWindow::OnCPUMode) EVT_MENU(IDM_JITLSFOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITLSPOFF, CCodeWindow::OnCPUMode) EVT_MENU(IDM_JITLSPOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITFPOFF, CCodeWindow::OnCPUMode) EVT_MENU(IDM_JITFPOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITIOFF, CCodeWindow::OnCPUMode) EVT_MENU(IDM_JITIOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITPOFF, CCodeWindow::OnCPUMode) EVT_MENU(IDM_JITPOFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_JITSROFF, CCodeWindow::OnCPUMode) EVT_MENU(IDM_JITSROFF, CCodeWindow::OnCPUMode)
EVT_MENU(IDM_CLEARCODECACHE, CCodeWindow::OnJitMenu) EVT_MENU(IDM_CLEARCODECACHE, CCodeWindow::OnJitMenu)
EVT_MENU(IDM_LOGINSTRUCTIONS, CCodeWindow::OnJitMenu) EVT_MENU(IDM_LOGINSTRUCTIONS, CCodeWindow::OnJitMenu)
EVT_MENU(IDM_SEARCHINSTRUCTION, CCodeWindow::OnJitMenu) EVT_MENU(IDM_SEARCHINSTRUCTION, CCodeWindow::OnJitMenu)
EVT_MENU(IDM_REGISTERWINDOW, CCodeWindow::OnToggleWindow) // View EVT_MENU(IDM_REGISTERWINDOW, CCodeWindow::OnToggleWindow) // View
EVT_MENU(IDM_BREAKPOINTWINDOW, CCodeWindow::OnToggleWindow) EVT_MENU(IDM_BREAKPOINTWINDOW, CCodeWindow::OnToggleWindow)
EVT_MENU(IDM_MEMORYWINDOW, CCodeWindow::OnToggleWindow) EVT_MENU(IDM_MEMORYWINDOW, CCodeWindow::OnToggleWindow)
EVT_MENU(IDM_JITWINDOW, CCodeWindow::OnToggleWindow) EVT_MENU(IDM_JITWINDOW, CCodeWindow::OnToggleWindow)
EVT_MENU(IDM_SOUNDWINDOW, CCodeWindow::OnToggleWindow) EVT_MENU(IDM_SOUNDWINDOW, CCodeWindow::OnToggleWindow)
EVT_MENU(IDM_VIDEOWINDOW, CCodeWindow::OnToggleWindow) EVT_MENU(IDM_VIDEOWINDOW, CCodeWindow::OnToggleWindow)
EVT_MENU(IDM_CLEARSYMBOLS, CCodeWindow::OnSymbolsMenu) EVT_MENU(IDM_CLEARSYMBOLS, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_LOADMAPFILE, CCodeWindow::OnSymbolsMenu) EVT_MENU(IDM_LOADMAPFILE, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_SCANFUNCTIONS, CCodeWindow::OnSymbolsMenu) EVT_MENU(IDM_SCANFUNCTIONS, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_SAVEMAPFILE, CCodeWindow::OnSymbolsMenu) EVT_MENU(IDM_SAVEMAPFILE, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_SAVEMAPFILEWITHCODES, CCodeWindow::OnSymbolsMenu) EVT_MENU(IDM_SAVEMAPFILEWITHCODES, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_CREATESIGNATUREFILE, CCodeWindow::OnSymbolsMenu) EVT_MENU(IDM_CREATESIGNATUREFILE, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_USESIGNATUREFILE, CCodeWindow::OnSymbolsMenu) EVT_MENU(IDM_USESIGNATUREFILE, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_PATCHHLEFUNCTIONS, CCodeWindow::OnSymbolsMenu) EVT_MENU(IDM_PATCHHLEFUNCTIONS, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_RENAME_SYMBOLS, CCodeWindow::OnSymbolsMenu) EVT_MENU(IDM_RENAME_SYMBOLS, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_PROFILEBLOCKS, CCodeWindow::OnProfilerMenu) EVT_MENU(IDM_PROFILEBLOCKS, CCodeWindow::OnProfilerMenu)
EVT_MENU(IDM_WRITEPROFILE, CCodeWindow::OnProfilerMenu) EVT_MENU(IDM_WRITEPROFILE, CCodeWindow::OnProfilerMenu)
// Menu tooltips
//EVT_MENU_HIGHLIGHT_ALL( CCodeWindow::OnStatusBar)
// Do this to to avoid that the ToolTips get stuck when only the wxMenu is changed
// and not any wxMenuItem that is required by EVT_MENU_HIGHLIGHT_ALL
//EVT_UPDATE_UI(wxID_ANY, CCodeWindow::OnStatusBar_)
// Toolbar // Toolbar
EVT_MENU(IDM_STEP, CCodeWindow::OnCodeStep) EVT_MENU(IDM_STEP, CCodeWindow::OnCodeStep)
EVT_MENU(IDM_STEPOVER, CCodeWindow::OnCodeStep) EVT_MENU(IDM_STEPOVER, CCodeWindow::OnCodeStep)
EVT_MENU(IDM_SKIP, CCodeWindow::OnCodeStep) EVT_MENU(IDM_SKIP, CCodeWindow::OnCodeStep)
EVT_MENU(IDM_SETPC, CCodeWindow::OnCodeStep) EVT_MENU(IDM_SETPC, CCodeWindow::OnCodeStep)
EVT_MENU(IDM_GOTOPC, CCodeWindow::OnCodeStep) EVT_MENU(IDM_GOTOPC, CCodeWindow::OnCodeStep)
EVT_TEXT(IDM_ADDRBOX, CCodeWindow::OnAddrBoxChange) EVT_TEXT(IDM_ADDRBOX, CCodeWindow::OnAddrBoxChange)
// Other // Other
EVT_LISTBOX(ID_SYMBOLLIST, CCodeWindow::OnSymbolListChange) EVT_LISTBOX(ID_SYMBOLLIST, CCodeWindow::OnSymbolListChange)
EVT_LISTBOX(ID_CALLSTACKLIST, CCodeWindow::OnCallstackListChange) EVT_LISTBOX(ID_CALLSTACKLIST, CCodeWindow::OnCallstackListChange)
EVT_LISTBOX(ID_CALLERSLIST, CCodeWindow::OnCallersListChange) EVT_LISTBOX(ID_CALLERSLIST, CCodeWindow::OnCallersListChange)
EVT_LISTBOX(ID_CALLSLIST, CCodeWindow::OnCallsListChange) EVT_LISTBOX(ID_CALLSLIST, CCodeWindow::OnCallsListChange)
EVT_HOST_COMMAND(wxID_ANY, CCodeWindow::OnHostMessage) EVT_HOST_COMMAND(wxID_ANY, CCodeWindow::OnHostMessage)
//EVT_COMMAND(ID_CODEVIEW, wxEVT_CODEVIEW_CHANGE, CCodeWindow::OnCodeViewChange)
END_EVENT_TABLE() END_EVENT_TABLE()
// Class // Class
CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, CFrame *parent, CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, CFrame *parent,
wxWindowID id, const wxPoint& position, const wxSize& size, long style, const wxString& name) wxWindowID id, const wxPoint& position, const wxSize& size, long style, const wxString& name)
@ -170,17 +158,12 @@ CCodeWindow::CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter
wxKeyEventHandler(CCodeWindow::OnKeyDown), wxKeyEventHandler(CCodeWindow::OnKeyDown),
(wxObject*)0, this); (wxObject*)0, this);
} }
CCodeWindow::~CCodeWindow()
{
//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() wxMenuBar *CCodeWindow::GetMenuBar()
{ {
return Parent->GetMenuBar(); return Parent->GetMenuBar();
} }
wxAuiToolBar *CCodeWindow::GetToolBar() wxAuiToolBar *CCodeWindow::GetToolBar()
{ {
return Parent->m_ToolBarDebug; return Parent->m_ToolBarDebug;
@ -203,10 +186,6 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event)
case IDM_NOTIFYMAPLOADED: case IDM_NOTIFYMAPLOADED:
NotifyMapLoaded(); NotifyMapLoaded();
break; break;
// Is this still necessary ?
//case IDM_UPDATELOGDISPLAY:
// if (m_LogWindow) m_LogWindow->NotifyUpdate();
// break;
case IDM_UPDATEDISASMDIALOG: case IDM_UPDATEDISASMDIALOG:
Update(); Update();
@ -215,20 +194,9 @@ void CCodeWindow::OnHostMessage(wxCommandEvent& event)
break; break;
case IDM_UPDATEBREAKPOINTS: case IDM_UPDATEBREAKPOINTS:
Update(); Update();
if (m_BreakpointWindow) m_BreakpointWindow->NotifyUpdate(); if (m_BreakpointWindow) m_BreakpointWindow->NotifyUpdate();
break; break;
case IDM_UPDATESTATUSBAR:
//if (main_frame->m_pStatusBar != NULL)
{
//this->GetParent()->m_p
//this->GetParent()->
//parent->m_pStatusBar->SetStatusText(wxT("Hi"), 0);
//m_pStatusBar->SetStatusText(event.GetString(), event.GetInt());
//this->GetParent()->m_pStatusBar->SetStatusText(event.GetString(), event.GetInt());
//main_frame->m_pStatusBar->SetStatusText(event.GetString(), event.GetInt());
}
break;
} }
} }
@ -265,14 +233,12 @@ void CCodeWindow::OnCodeStep(wxCommandEvent& event)
Parent->UpdateGUI(); Parent->UpdateGUI();
} }
void CCodeWindow::JumpToAddress(u32 _Address) void CCodeWindow::JumpToAddress(u32 _Address)
{ {
codeview->Center(_Address); codeview->Center(_Address);
UpdateLists(); UpdateLists();
} }
void CCodeWindow::OnCodeViewChange(wxCommandEvent &event) void CCodeWindow::OnCodeViewChange(wxCommandEvent &event)
{ {
UpdateLists(); UpdateLists();
@ -300,7 +266,8 @@ void CCodeWindow::OnAddrBoxChange(wxCommandEvent& event)
void CCodeWindow::OnCallstackListChange(wxCommandEvent& event) void CCodeWindow::OnCallstackListChange(wxCommandEvent& event)
{ {
int index = callstack->GetSelection(); int index = callstack->GetSelection();
if (index >= 0) { if (index >= 0)
{
u32 address = (u32)(u64)(callstack->GetClientData(index)); u32 address = (u32)(u64)(callstack->GetClientData(index));
if (address) if (address)
JumpToAddress(address); JumpToAddress(address);
@ -310,7 +277,8 @@ void CCodeWindow::OnCallstackListChange(wxCommandEvent& event)
void CCodeWindow::OnCallersListChange(wxCommandEvent& event) void CCodeWindow::OnCallersListChange(wxCommandEvent& event)
{ {
int index = callers->GetSelection(); int index = callers->GetSelection();
if (index >= 0) { if (index >= 0)
{
u32 address = (u32)(u64)(callers->GetClientData(index)); u32 address = (u32)(u64)(callers->GetClientData(index));
if (address) if (address)
JumpToAddress(address); JumpToAddress(address);
@ -320,7 +288,8 @@ void CCodeWindow::OnCallersListChange(wxCommandEvent& event)
void CCodeWindow::OnCallsListChange(wxCommandEvent& event) void CCodeWindow::OnCallsListChange(wxCommandEvent& event)
{ {
int index = calls->GetSelection(); int index = calls->GetSelection();
if (index >= 0) { if (index >= 0)
{
u32 address = (u32)(u64)(calls->GetClientData(index)); u32 address = (u32)(u64)(calls->GetClientData(index));
if (address) if (address)
JumpToAddress(address); JumpToAddress(address);
@ -330,8 +299,6 @@ void CCodeWindow::OnCallsListChange(wxCommandEvent& event)
void CCodeWindow::SingleCPUStep() void CCodeWindow::SingleCPUStep()
{ {
CCPU::StepOpcode(&sync_event); CCPU::StepOpcode(&sync_event);
// if (CCPU::IsStepping())
// sync_event.Wait();
wxThread::Sleep(20); wxThread::Sleep(20);
// need a short wait here // need a short wait here
JumpToAddress(PC); JumpToAddress(PC);
@ -350,8 +317,10 @@ void CCodeWindow::UpdateLists()
{ {
u32 caller_addr = symbol->callers[i].callAddress; u32 caller_addr = symbol->callers[i].callAddress;
Symbol *caller_symbol = g_symbolDB.GetSymbolFromAddr(caller_addr); Symbol *caller_symbol = g_symbolDB.GetSymbolFromAddr(caller_addr);
if (caller_symbol) { if (caller_symbol)
int idx = callers->Append(wxString::FromAscii(StringFromFormat("< %s (%08x)", caller_symbol->name.c_str(), caller_addr).c_str())); {
int idx = callers->Append(wxString::FromAscii(StringFromFormat
("< %s (%08x)", caller_symbol->name.c_str(), caller_addr).c_str()));
callers->SetClientData(idx, (void*)caller_addr); callers->SetClientData(idx, (void*)caller_addr);
} }
} }
@ -361,8 +330,10 @@ void CCodeWindow::UpdateLists()
{ {
u32 call_addr = symbol->calls[i].function; u32 call_addr = symbol->calls[i].function;
Symbol *call_symbol = g_symbolDB.GetSymbolFromAddr(call_addr); Symbol *call_symbol = g_symbolDB.GetSymbolFromAddr(call_addr);
if (call_symbol) { if (call_symbol)
int idx = calls->Append(wxString::FromAscii(StringFromFormat("> %s (%08x)", call_symbol->name.c_str(), call_addr).c_str())); {
int idx = calls->Append(wxString::FromAscii(StringFromFormat
("> %s (%08x)", call_symbol->name.c_str(), call_addr).c_str()));
calls->SetClientData(idx, (void*)call_addr); calls->SetClientData(idx, (void*)call_addr);
} }
} }
@ -370,7 +341,6 @@ void CCodeWindow::UpdateLists()
void CCodeWindow::UpdateCallstack() void CCodeWindow::UpdateCallstack()
{ {
//if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN) return;
if (Core::GetState() == Core::CORE_STOPPING) return; if (Core::GetState() == Core::CORE_STOPPING) return;
callstack->Clear(); callstack->Clear();
@ -401,10 +371,14 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
sizerBig->Add(sizerLeft, 2, wxEXPAND); sizerBig->Add(sizerLeft, 2, wxEXPAND);
sizerBig->Add(codeview, 5, wxEXPAND); sizerBig->Add(codeview, 5, wxEXPAND);
sizerLeft->Add(callstack = new wxListBox(this, ID_CALLSTACKLIST, wxDefaultPosition, wxSize(90, 100)), 0, wxEXPAND); sizerLeft->Add(callstack = new wxListBox(this, ID_CALLSTACKLIST,
sizerLeft->Add(symbols = new wxListBox(this, ID_SYMBOLLIST, wxDefaultPosition, wxSize(90, 100), 0, NULL, wxLB_SORT), 1, wxEXPAND); wxDefaultPosition, wxSize(90, 100)), 0, wxEXPAND);
sizerLeft->Add(calls = new wxListBox(this, ID_CALLSLIST, wxDefaultPosition, wxSize(90, 100), 0, NULL, wxLB_SORT), 0, wxEXPAND); sizerLeft->Add(symbols = new wxListBox(this, ID_SYMBOLLIST,
sizerLeft->Add(callers = new wxListBox(this, ID_CALLERSLIST, wxDefaultPosition, wxSize(90, 100), 0, NULL, wxLB_SORT), 0, wxEXPAND); wxDefaultPosition, wxSize(90, 100), 0, NULL, wxLB_SORT), 1, wxEXPAND);
sizerLeft->Add(calls = new wxListBox(this, ID_CALLSLIST, wxDefaultPosition,
wxSize(90, 100), 0, NULL, wxLB_SORT), 0, wxEXPAND);
sizerLeft->Add(callers = new wxListBox(this, ID_CALLERSLIST, wxDefaultPosition,
wxSize(90, 100), 0, NULL, wxLB_SORT), 0, wxEXPAND);
SetSizer(sizerBig); SetSizer(sizerBig);
@ -416,19 +390,12 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
sync_event.Init(); sync_event.Init();
} }
// -------
// Menus
// Create CPU Mode menus // Create CPU Mode menus
void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar * _pMenuBar) void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter,
wxMenuBar * _pMenuBar)
{ {
// Create menu
//pMenuBar = new wxMenuBar(wxMB_DOCKABLE);
pMenuBar = _pMenuBar; pMenuBar = _pMenuBar;
// Add separator to mark beginning of debugging menus
// CPU Mode // CPU Mode
wxMenu* pCoreMenu = new wxMenu; wxMenu* pCoreMenu = new wxMenu;
@ -454,45 +421,57 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
pCoreMenu->Append(IDM_LOGINSTRUCTIONS, _T("&Log JIT instruction coverage")); pCoreMenu->Append(IDM_LOGINSTRUCTIONS, _T("&Log JIT instruction coverage"));
pCoreMenu->Append(IDM_SEARCHINSTRUCTION, _T("&Search for an op")); pCoreMenu->Append(IDM_SEARCHINSTRUCTION, _T("&Search for an op"));
pCoreMenu->AppendSeparator(); pCoreMenu->AppendSeparator();
jitoff = pCoreMenu->Append(IDM_JITOFF, _T("&JIT off (JIT core)"), jitoff = pCoreMenu->Append(IDM_JITOFF, _T("&JIT off (JIT core)"),
_T("Turn off all JIT functions, but still use the JIT core from Jit.cpp"), _T("Turn off all JIT functions, but still use the JIT core from Jit.cpp"),
wxITEM_CHECK); wxITEM_CHECK);
jitlsoff = pCoreMenu->Append(IDM_JITLSOFF, _T("&JIT LoadStore off"), wxEmptyString, wxITEM_CHECK); jitlsoff = pCoreMenu->Append(IDM_JITLSOFF, _T("&JIT LoadStore off"),
jitlslbzxoff = pCoreMenu->Append(IDM_JITLSLBZXOFF, _T(" &JIT LoadStore lbzx off"), wxEmptyString, wxITEM_CHECK); wxEmptyString, wxITEM_CHECK);
jitlslxzoff = pCoreMenu->Append(IDM_JITLSLXZOFF, _T(" &JIT LoadStore lXz off"), wxEmptyString, wxITEM_CHECK); jitlslbzxoff = pCoreMenu->Append(IDM_JITLSLBZXOFF, _T(" &JIT LoadStore lbzx off"),
jitlslwzoff = pCoreMenu->Append(IDM_JITLSLWZOFF, _T(" &JIT LoadStore lwz off"), wxEmptyString, wxITEM_CHECK); wxEmptyString, wxITEM_CHECK);
jitlspoff = pCoreMenu->Append(IDM_JITLSFOFF, _T("&JIT LoadStore Floating off"), wxEmptyString, wxITEM_CHECK); jitlslxzoff = pCoreMenu->Append(IDM_JITLSLXZOFF, _T(" &JIT LoadStore lXz off"),
jitlsfoff = pCoreMenu->Append(IDM_JITLSPOFF, _T("&JIT LoadStore Paired off"), wxEmptyString, wxITEM_CHECK); wxEmptyString, wxITEM_CHECK);
jitfpoff = pCoreMenu->Append(IDM_JITFPOFF, _T("&JIT FloatingPoint off"), wxEmptyString, wxITEM_CHECK); jitlslwzoff = pCoreMenu->Append(IDM_JITLSLWZOFF, _T(" &JIT LoadStore lwz off"),
jitioff = pCoreMenu->Append(IDM_JITIOFF, _T("&JIT Integer off"), wxEmptyString, wxITEM_CHECK); wxEmptyString, wxITEM_CHECK);
jitpoff = pCoreMenu->Append(IDM_JITPOFF, _T("&JIT Paired off"), wxEmptyString, wxITEM_CHECK); jitlspoff = pCoreMenu->Append(IDM_JITLSFOFF, _T("&JIT LoadStore Floating off"),
jitsroff = pCoreMenu->Append(IDM_JITSROFF, _T("&JIT SystemRegisters off"), wxEmptyString, wxITEM_CHECK); wxEmptyString, wxITEM_CHECK);
jitlsfoff = pCoreMenu->Append(IDM_JITLSPOFF, _T("&JIT LoadStore Paired off"),
wxEmptyString, wxITEM_CHECK);
jitfpoff = pCoreMenu->Append(IDM_JITFPOFF, _T("&JIT FloatingPoint off"),
wxEmptyString, wxITEM_CHECK);
jitioff = pCoreMenu->Append(IDM_JITIOFF, _T("&JIT Integer off"),
wxEmptyString, wxITEM_CHECK);
jitpoff = pCoreMenu->Append(IDM_JITPOFF, _T("&JIT Paired off"),
wxEmptyString, wxITEM_CHECK);
jitsroff = pCoreMenu->Append(IDM_JITSROFF, _T("&JIT SystemRegisters off"),
wxEmptyString, wxITEM_CHECK);
pMenuBar->Append(pCoreMenu, _T("&JIT")); pMenuBar->Append(pCoreMenu, _T("&JIT"));
CreateMenuSymbols(); CreateMenuSymbols();
} }
// Create View menu // Create View menu
void CCodeWindow::CreateMenuView(wxMenuBar * _pMenuBar, wxMenu* _pMenu) void CCodeWindow::CreateMenuView(wxMenuBar * _pMenuBar, wxMenu* _pMenu)
{ {
//wxMenu* pDebugDialogs = new wxMenu; wxMenuItem* pRegister = _pMenu->Append(IDM_REGISTERWINDOW, _T("&Registers"),
wxEmptyString, wxITEM_CHECK);
wxMenuItem* pRegister = _pMenu->Append(IDM_REGISTERWINDOW, _T("&Registers"), wxEmptyString, wxITEM_CHECK);
pRegister->Check(bRegisterWindow); pRegister->Check(bRegisterWindow);
wxMenuItem* pBreakPoints = _pMenu->Append(IDM_BREAKPOINTWINDOW, _T("&BreakPoints"), wxEmptyString, wxITEM_CHECK); wxMenuItem* pBreakPoints = _pMenu->Append(IDM_BREAKPOINTWINDOW, _T("&BreakPoints"),
wxEmptyString, wxITEM_CHECK);
pBreakPoints->Check(bBreakpointWindow); pBreakPoints->Check(bBreakpointWindow);
wxMenuItem* pMemory = _pMenu->Append(IDM_MEMORYWINDOW, _T("&Memory"), wxEmptyString, wxITEM_CHECK); wxMenuItem* pMemory = _pMenu->Append(IDM_MEMORYWINDOW, _T("&Memory"),
wxEmptyString, wxITEM_CHECK);
pMemory->Check(bMemoryWindow); pMemory->Check(bMemoryWindow);
wxMenuItem* pJit = _pMenu->Append(IDM_JITWINDOW, _T("&Jit"), wxEmptyString, wxITEM_CHECK); wxMenuItem* pJit = _pMenu->Append(IDM_JITWINDOW, _T("&Jit"),
wxEmptyString, wxITEM_CHECK);
pJit->Check(bJitWindow); pJit->Check(bJitWindow);
wxMenuItem* pSound = _pMenu->Append(IDM_SOUNDWINDOW, _T("&Sound"), wxEmptyString, wxITEM_CHECK); wxMenuItem* pSound = _pMenu->Append(IDM_SOUNDWINDOW, _T("&Sound"),
wxEmptyString, wxITEM_CHECK);
pSound->Check(bSoundWindow); pSound->Check(bSoundWindow);
wxMenuItem* pVideo = _pMenu->Append(IDM_VIDEOWINDOW, _T("&Video"), wxEmptyString, wxITEM_CHECK); wxMenuItem* pVideo = _pMenu->Append(IDM_VIDEOWINDOW, _T("&Video"),
wxEmptyString, wxITEM_CHECK);
pVideo->Check(bVideoWindow); pVideo->Check(bVideoWindow);
//pMenuBar->Append(pDebugDialogs, _T("&Views"));
} }
void CCodeWindow::CreateMenuOptions(wxMenuBar * _pMenuBar, wxMenu* _pMenu) void CCodeWindow::CreateMenuOptions(wxMenuBar * _pMenuBar, wxMenu* _pMenu)
@ -520,34 +499,47 @@ void CCodeWindow::OnCPUMode(wxCommandEvent& event)
switch (event.GetId()) switch (event.GetId())
{ {
case IDM_INTERPRETER: case IDM_INTERPRETER:
PowerPC::SetMode(UseInterpreter() ? PowerPC::MODE_INTERPRETER : PowerPC::MODE_JIT); break; PowerPC::SetMode(UseInterpreter() ? PowerPC::MODE_INTERPRETER : PowerPC::MODE_JIT);
break;
case IDM_BOOTTOPAUSE: case IDM_BOOTTOPAUSE:
bBootToPause = !bBootToPause; return; bBootToPause = !bBootToPause;
return;
case IDM_AUTOMATICSTART: case IDM_AUTOMATICSTART:
bAutomaticStart = !bAutomaticStart; return; bAutomaticStart = !bAutomaticStart;
return;
case IDM_JITOFF: case IDM_JITOFF:
Core::g_CoreStartupParameter.bJITOff = event.IsChecked(); break; Core::g_CoreStartupParameter.bJITOff = event.IsChecked();
break;
case IDM_JITLSOFF: case IDM_JITLSOFF:
Core::g_CoreStartupParameter.bJITLoadStoreOff = event.IsChecked(); break; Core::g_CoreStartupParameter.bJITLoadStoreOff = event.IsChecked();
case IDM_JITLSLXZOFF: break;
Core::g_CoreStartupParameter.bJITLoadStorelXzOff = event.IsChecked(); break; case IDM_JITLSLXZOFF:
case IDM_JITLSLWZOFF: Core::g_CoreStartupParameter.bJITLoadStorelXzOff = event.IsChecked();
Core::g_CoreStartupParameter.bJITLoadStorelwzOff = event.IsChecked(); break; break;
case IDM_JITLSLBZXOFF: case IDM_JITLSLWZOFF:
Core::g_CoreStartupParameter.bJITLoadStorelbzxOff = event.IsChecked(); break; Core::g_CoreStartupParameter.bJITLoadStorelwzOff = event.IsChecked();
break;
case IDM_JITLSLBZXOFF:
Core::g_CoreStartupParameter.bJITLoadStorelbzxOff = event.IsChecked();
break;
case IDM_JITLSFOFF: case IDM_JITLSFOFF:
Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff = event.IsChecked(); break; Core::g_CoreStartupParameter.bJITLoadStoreFloatingOff = event.IsChecked();
break;
case IDM_JITLSPOFF: case IDM_JITLSPOFF:
Core::g_CoreStartupParameter.bJITLoadStorePairedOff = event.IsChecked(); break; Core::g_CoreStartupParameter.bJITLoadStorePairedOff = event.IsChecked();
break;
case IDM_JITFPOFF: case IDM_JITFPOFF:
Core::g_CoreStartupParameter.bJITFloatingPointOff = event.IsChecked(); break; Core::g_CoreStartupParameter.bJITFloatingPointOff = event.IsChecked();
break;
case IDM_JITIOFF: case IDM_JITIOFF:
Core::g_CoreStartupParameter.bJITIntegerOff = event.IsChecked(); break; Core::g_CoreStartupParameter.bJITIntegerOff = event.IsChecked();
break;
case IDM_JITPOFF: case IDM_JITPOFF:
Core::g_CoreStartupParameter.bJITPairedOff = event.IsChecked(); break; Core::g_CoreStartupParameter.bJITPairedOff = event.IsChecked();
break;
case IDM_JITSROFF: case IDM_JITSROFF:
Core::g_CoreStartupParameter.bJITSystemRegistersOff = event.IsChecked(); break; Core::g_CoreStartupParameter.bJITSystemRegistersOff = event.IsChecked();
break;
} }
// Clear the JIT cache to enable these changes // Clear the JIT cache to enable these changes
@ -555,23 +547,28 @@ void CCodeWindow::OnCPUMode(wxCommandEvent& event)
// Update // Update
UpdateButtonStates(); UpdateButtonStates();
} }
void CCodeWindow::OnJitMenu(wxCommandEvent& event) void CCodeWindow::OnJitMenu(wxCommandEvent& event)
{ {
switch (event.GetId()) switch (event.GetId())
{ {
case IDM_LOGINSTRUCTIONS: case IDM_LOGINSTRUCTIONS:
PPCTables::LogCompiledInstructions(); break; PPCTables::LogCompiledInstructions();
break;
case IDM_CLEARCODECACHE: case IDM_CLEARCODECACHE:
jit->ClearCache(); break; jit->ClearCache();
break;
case IDM_SEARCHINSTRUCTION: case IDM_SEARCHINSTRUCTION:
{ {
wxString str; wxString str;
str = wxGetTextFromUser(_(""), wxT("Op?"), wxEmptyString, this); str = wxGetTextFromUser(_(""), wxT("Op?"), wxEmptyString, this);
for (u32 addr = 0x80000000; addr < 0x80100000; addr += 4) { for (u32 addr = 0x80000000; addr < 0x80100000; addr += 4)
{
const char *name = PPCTables::GetInstructionName(Memory::ReadUnchecked_U32(addr)); const char *name = PPCTables::GetInstructionName(Memory::ReadUnchecked_U32(addr));
if (name && !strcmp((const char *)str.mb_str(), name)) { if (name && !strcmp((const char *)str.mb_str(), name))
{
std::string mb_str(str.mb_str()); std::string mb_str(str.mb_str());
NOTICE_LOG(POWERPC, "Found %s at %08x", mb_str.c_str(), addr); NOTICE_LOG(POWERPC, "Found %s at %08x", mb_str.c_str(), addr);
} }
@ -581,30 +578,32 @@ void CCodeWindow::OnJitMenu(wxCommandEvent& event)
} }
} }
// Shortcuts // Shortcuts
bool CCodeWindow::UseInterpreter() bool CCodeWindow::UseInterpreter()
{ {
return GetMenuBar()->IsChecked(IDM_INTERPRETER); return GetMenuBar()->IsChecked(IDM_INTERPRETER);
} }
bool CCodeWindow::BootToPause() bool CCodeWindow::BootToPause()
{ {
return GetMenuBar()->IsChecked(IDM_BOOTTOPAUSE); return GetMenuBar()->IsChecked(IDM_BOOTTOPAUSE);
} }
bool CCodeWindow::AutomaticStart() bool CCodeWindow::AutomaticStart()
{ {
return GetMenuBar()->IsChecked(IDM_AUTOMATICSTART); return GetMenuBar()->IsChecked(IDM_AUTOMATICSTART);
} }
bool CCodeWindow::JITNoBlockCache() bool CCodeWindow::JITNoBlockCache()
{ {
return GetMenuBar()->IsChecked(IDM_JITNOBLOCKCACHE); return GetMenuBar()->IsChecked(IDM_JITNOBLOCKCACHE);
} }
bool CCodeWindow::JITBlockLinking() bool CCodeWindow::JITBlockLinking()
{ {
return GetMenuBar()->IsChecked(IDM_JITBLOCKLINKING); return GetMenuBar()->IsChecked(IDM_JITBLOCKLINKING);
} }
// Toolbar // Toolbar
void CCodeWindow::InitBitmaps() void CCodeWindow::InitBitmaps()
{ {
@ -619,12 +618,9 @@ void CCodeWindow::InitBitmaps()
// scale to 24x24 for toolbar // scale to 24x24 for toolbar
for (size_t n = Toolbar_DebugGo; n < ToolbarDebugBitmapMax; n++) for (size_t n = Toolbar_DebugGo; n < ToolbarDebugBitmapMax; n++)
{
m_Bitmaps[n] = wxBitmap(m_Bitmaps[n].ConvertToImage().Scale(24, 24)); m_Bitmaps[n] = wxBitmap(m_Bitmaps[n].ConvertToImage().Scale(24, 24));
}
} }
void CCodeWindow::PopulateToolbar(wxAuiToolBar* toolBar) void CCodeWindow::PopulateToolbar(wxAuiToolBar* toolBar)
{ {
int w = m_Bitmaps[Toolbar_DebugGo].GetWidth(), int w = m_Bitmaps[Toolbar_DebugGo].GetWidth(),
@ -640,8 +636,6 @@ void CCodeWindow::PopulateToolbar(wxAuiToolBar* toolBar)
toolBar->AddSeparator(); toolBar->AddSeparator();
toolBar->AddControl(new wxTextCtrl(toolBar, IDM_ADDRBOX, _T(""))); toolBar->AddControl(new wxTextCtrl(toolBar, IDM_ADDRBOX, _T("")));
// after adding the buttons to the toolbar, must call Realize() to reflect
// the changes
toolBar->Realize(); toolBar->Realize();
} }
@ -654,21 +648,19 @@ void CCodeWindow::Update()
UpdateCallstack(); UpdateCallstack();
UpdateButtonStates(); UpdateButtonStates();
/* DO NOT Automatically show the current PC position when a breakpoint is hit or // Do not automatically show the current PC position when a breakpoint is hit or
when we pause SINCE THIS CAN BE CALLED AT OTHER TIMES TOO */ // when we pause since this can be called at other times too.
//codeview->Center(PC); //codeview->Center(PC);
} }
void CCodeWindow::UpdateButtonStates() void CCodeWindow::UpdateButtonStates()
{ {
bool Initialized = (Core::GetState() != Core::CORE_UNINITIALIZED); bool Initialized = (Core::GetState() != Core::CORE_UNINITIALIZED);
// bool Running = (Core::GetState() == Core::CORE_RUN);
bool Pause = (Core::GetState() == Core::CORE_PAUSE); bool Pause = (Core::GetState() == Core::CORE_PAUSE);
bool Stepping = CCPU::IsStepping(); bool Stepping = CCPU::IsStepping();
wxAuiToolBar* ToolBar = GetToolBar(); wxAuiToolBar* ToolBar = GetToolBar();
// Toolbar // Toolbar
// ------------------
if (!ToolBar) return; if (!ToolBar) return;
if (!Initialized) if (!Initialized)
@ -721,7 +713,7 @@ void CCodeWindow::UpdateButtonStates()
GetMenuBar()->Enable(IDM_SAVEMAPFILE, Initialized); GetMenuBar()->Enable(IDM_SAVEMAPFILE, Initialized);
GetMenuBar()->Enable(IDM_SAVEMAPFILEWITHCODES, Initialized); GetMenuBar()->Enable(IDM_SAVEMAPFILEWITHCODES, Initialized);
GetMenuBar()->Enable(IDM_CREATESIGNATUREFILE, Initialized); GetMenuBar()->Enable(IDM_CREATESIGNATUREFILE, Initialized);
GetMenuBar()->Enable(IDM_RENAME_SYMBOLS, Initialized); GetMenuBar()->Enable(IDM_RENAME_SYMBOLS, Initialized);
GetMenuBar()->Enable(IDM_USESIGNATUREFILE, Initialized); GetMenuBar()->Enable(IDM_USESIGNATUREFILE, Initialized);
GetMenuBar()->Enable(IDM_PATCHHLEFUNCTIONS, Initialized); GetMenuBar()->Enable(IDM_PATCHHLEFUNCTIONS, Initialized);
@ -731,52 +723,3 @@ void CCodeWindow::UpdateButtonStates()
callers->SetFont(DebuggerFont); callers->SetFont(DebuggerFont);
calls->SetFont(DebuggerFont); calls->SetFont(DebuggerFont);
} }
// Show Tool Tip for menu items
void CCodeWindow::DoTip(wxString text)
{
// Create a blank tooltip to clear the eventual old one
static wxTipWindow *tw = NULL;
if (tw)
{
tw->SetTipWindowPtr(NULL);
tw->Close();
}
tw = NULL;
// Don't make a new one for blank text
if(text.empty()) return;
tw = new wxTipWindow(this, text, 175, &tw);
// Move it to the right
#ifdef _WIN32
POINT point;
GetCursorPos(&point);
tw->SetPosition(wxPoint(point.x + 25, point.y));
#endif
}
// See the comment under BEGIN_EVENT_TABLE for an explanation of why we use both these events.
void CCodeWindow::OnStatusBar(wxMenuEvent& event)
{
event.Skip(); // This doesn't hurt right?
/* We assume the debug build user don't need to see this all the time. And these tooltips
may not be entirely stable. So we leave them out of debug builds. I could for example
get it to crash at wxWindowBase::DoHitTest(), that may be fixed in wxWidgets 2.9.0. */
#if !defined(_DEBUG) || defined(DEBUGFAST)
//DoTip(pMenuBar->GetHelpString(event.GetId()));
#endif
}
void CCodeWindow::OnStatusBar_(wxUpdateUIEvent& event)
{
event.Skip();
#if !defined(_DEBUG) || defined(DEBUGFAST)
// The IDM_ADDRBOX id seems to come with this outside the toolbar
//if(event.GetId() != IDM_ADDRBOX) DoTip(wxEmptyString);
#endif
}

View File

@ -52,7 +52,6 @@ class CCodeWindow
const wxString& name = wxT("Code") const wxString& name = wxT("Code")
); );
~CCodeWindow();
void Load(); void Load();
void Save(); void Save();
@ -60,7 +59,6 @@ class CCodeWindow
CFrame *Parent; CFrame *Parent;
wxMenuBar * GetMenuBar(); wxMenuBar * GetMenuBar();
wxAuiToolBar * GetToolBar(); wxAuiToolBar * GetToolBar();
int GetNootebookAffiliation(wxString);
wxBitmap m_Bitmaps[ToolbarDebugBitmapMax]; wxBitmap m_Bitmaps[ToolbarDebugBitmapMax];
bool UseInterpreter(); bool UseInterpreter();
@ -68,11 +66,12 @@ class CCodeWindow
bool AutomaticStart(); bool AutomaticStart();
bool JITNoBlockCache(); bool JITNoBlockCache();
bool JITBlockLinking(); bool JITBlockLinking();
void JumpToAddress(u32 _Address); void JumpToAddress(u32 _Address);
void Update(); void Update();
void NotifyMapLoaded(); void NotifyMapLoaded();
void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar * pMenuBar); void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter,
wxMenuBar * pMenuBar);
void CreateMenuView(wxMenuBar * pMenuBar, wxMenu*); void CreateMenuView(wxMenuBar * pMenuBar, wxMenu*);
void CreateMenuOptions(wxMenuBar * pMenuBar, wxMenu*); void CreateMenuOptions(wxMenuBar * pMenuBar, wxMenu*);
void CreateMenuSymbols(); void CreateMenuSymbols();
@ -145,8 +144,6 @@ class CCodeWindow
void UpdateLists(); void UpdateLists();
void UpdateCallstack(); void UpdateCallstack();
void OnStatusBar(wxMenuEvent& event); void OnStatusBar_(wxUpdateUIEvent& event);
void DoTip(wxString text);
void OnKeyDown(wxKeyEvent& event); void OnKeyDown(wxKeyEvent& event);
void InitBitmaps(); void InitBitmaps();
@ -173,4 +170,4 @@ class CCodeWindow
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
#endif /*CODEWINDOW_*/ #endif // CODEWINDOW_H_

View File

@ -320,8 +320,6 @@ EVT_AUINOTEBOOK_TAB_RIGHT_UP(wxID_ANY, CFrame::OnTab)
// Post events to child panels // Post events to child panels
EVT_MENU(wxID_ANY, CFrame::PostEvent) EVT_MENU(wxID_ANY, CFrame::PostEvent)
EVT_TEXT(wxID_ANY, CFrame::PostEvent) EVT_TEXT(wxID_ANY, CFrame::PostEvent)
//EVT_MENU_HIGHLIGHT_ALL(CFrame::PostMenuEvent)
//EVT_UPDATE_UI(wxID_ANY, CFrame::PostUpdateUIEvent)
END_EVENT_TABLE() END_EVENT_TABLE()
@ -361,6 +359,7 @@ CFrame::CFrame(wxFrame* parent,
if (SConfig::GetInstance().m_InterfaceConsole) Console->Open(); if (SConfig::GetInstance().m_InterfaceConsole) Console->Open();
m_LogWindow = new CLogWindow(this, IDM_LOGWINDOW); m_LogWindow = new CLogWindow(this, IDM_LOGWINDOW);
m_LogWindow->Hide(); m_LogWindow->Hide();
m_LogWindow->Disable();
// Start debugging mazimized // Start debugging mazimized
if (UseDebugger) this->Maximize(true); if (UseDebugger) this->Maximize(true);
@ -600,14 +599,6 @@ void CFrame::PostEvent(wxCommandEvent& event)
else else
event.Skip(); event.Skip();
} }
void CFrame::PostMenuEvent(wxMenuEvent& event)
{
if (g_pCodeWindow) g_pCodeWindow->GetEventHandler()->AddPendingEvent(event);
}
void CFrame::PostUpdateUIEvent(wxUpdateUIEvent& event)
{
if (g_pCodeWindow) g_pCodeWindow->GetEventHandler()->AddPendingEvent(event);
}
void CFrame::OnMove(wxMoveEvent& event) void CFrame::OnMove(wxMoveEvent& event)
{ {

View File

@ -126,8 +126,6 @@ class CFrame : public CRenderFrame
void ToggleLogWindow(bool, int i = -1); void ToggleLogWindow(bool, int i = -1);
void ToggleConsole(bool, int i = -1); void ToggleConsole(bool, int i = -1);
void PostEvent(wxCommandEvent& event); void PostEvent(wxCommandEvent& event);
void PostMenuEvent(wxMenuEvent& event);
void PostUpdateUIEvent(wxUpdateUIEvent& event);
void StatusBarMessage(const char * Text, ...); void StatusBarMessage(const char * Text, ...);
void ClearStatusBar(); void ClearStatusBar();
void OnSizeRequest(int& x, int& y, int& width, int& height); void OnSizeRequest(int& x, int& y, int& width, int& height);

View File

@ -99,10 +99,14 @@ void CFrame::ToggleLogWindow(bool bShow, int i)
if (bShow) if (bShow)
{ {
if (!m_LogWindow) m_LogWindow = new CLogWindow(this, IDM_LOGWINDOW); if (!m_LogWindow) m_LogWindow = new CLogWindow(this, IDM_LOGWINDOW);
m_LogWindow->Enable();
DoAddPage(m_LogWindow, i, bFloatWindow[0]); DoAddPage(m_LogWindow, i, bFloatWindow[0]);
} }
else else
{
m_LogWindow->Disable();
DoRemovePage(m_LogWindow, bShow); DoRemovePage(m_LogWindow, bShow);
}
// Hide or Show the pane // Hide or Show the pane
if (!g_pCodeWindow) if (!g_pCodeWindow)
@ -142,6 +146,7 @@ void CFrame::ToggleConsole(bool bShow, int i)
ConsoleWin->AdoptAttributesFromHWND(); ConsoleWin->AdoptAttributesFromHWND();
ConsoleWin->Reparent(ConsoleParent); ConsoleWin->Reparent(ConsoleParent);
ConsoleParent->Enable();
DoAddPage(ConsoleParent, i, bFloatWindow[1]); DoAddPage(ConsoleParent, i, bFloatWindow[1]);
} }
else // Hide else // Hide
@ -149,6 +154,10 @@ void CFrame::ToggleConsole(bool bShow, int i)
if(GetConsoleWindow()) if(GetConsoleWindow())
ShowWindow(GetConsoleWindow(), SW_HIDE); // WIN32 ShowWindow(GetConsoleWindow(), SW_HIDE); // WIN32
wxPanel *ConsoleParent = (wxPanel*)FindWindowById(IDM_CONSOLEWINDOW);
if (ConsoleParent)
ConsoleParent->Disable();
// Then close the page // Then close the page
DoRemovePageId(IDM_CONSOLEWINDOW, true, true); DoRemovePageId(IDM_CONSOLEWINDOW, true, true);
} }
@ -268,7 +277,7 @@ void CFrame::OnTab(wxAuiNotebookEvent& event)
for (int i = IDM_LOGWINDOW; i <= IDM_VIDEOWINDOW; i++) for (int i = IDM_LOGWINDOW; i <= IDM_VIDEOWINDOW; i++)
{ {
wxWindow *Win = FindWindowById(i); wxWindow *Win = FindWindowById(i);
if (Win) if (Win && Win->IsEnabled())
{ {
Item = new wxMenuItem(MenuPopup, i + IDM_FLOAT_LOGWINDOW - IDM_LOGWINDOW, Item = new wxMenuItem(MenuPopup, i + IDM_FLOAT_LOGWINDOW - IDM_LOGWINDOW,
Win->GetName(), wxT(""), wxITEM_CHECK); Win->GetName(), wxT(""), wxITEM_CHECK);
@ -330,7 +339,10 @@ void CFrame::DoRemovePage(wxWindow * Win, bool _Hide)
{ {
GetNotebookFromId(i)->RemovePage(GetNotebookFromId(i)->GetPageIndex(Win)); GetNotebookFromId(i)->RemovePage(GetNotebookFromId(i)->GetPageIndex(Win));
if (_Hide) if (_Hide)
Win->Hide(); {
Win->Hide();
Win->Reparent(this);
}
else else
Win->Close(); Win->Close();
} }