Fix an issue that caused the DSP-LLE window to be openned twice in windows. (Thanks shuffle2).

Fix an issue that prevented the code window settings from taking effect on application start.  (Thanks shuffle2, skid_au, and sanchez).
Fix a potential segmentation fault with the DSP-LLE debugger window.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5988 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-07-28 15:22:27 +00:00
parent a122a4dc2c
commit 71d4ece44e
8 changed files with 117 additions and 163 deletions

View File

@ -560,7 +560,6 @@ void CCodeWindow::ToggleDLLWindow(int Id, bool bShow)
if (Win)
{
Parent->DoRemovePage(Win, false);
Win->Close();
Win->Destroy();
}
}

View File

@ -365,8 +365,9 @@ CFrame::CFrame(wxFrame* parent,
if (UseDebugger)
{
g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, IDM_CODEWINDOW);
g_pCodeWindow->Hide();
LoadIniPerspectives();
g_pCodeWindow->Load();
g_pCodeWindow->Hide();
}
// Create timer
@ -446,7 +447,6 @@ CFrame::CFrame(wxFrame* parent,
if (g_pCodeWindow)
{
// Load perspective
LoadIniPerspectives();
DoLoadPerspective();
}
else

View File

@ -145,7 +145,7 @@ class CFrame : public CRenderFrame
// Utility
wxWindow * GetNotebookPageFromId(wxWindowID Id);
wxAuiNotebook * GetNotebookFromId(u32);
wxAuiNotebook * GetNotebookFromId(size_t NBId);
int GetNotebookCount();
wxString GetMenuLabel(int Id);
@ -159,8 +159,6 @@ class CFrame : public CRenderFrame
void OnTab(wxAuiNotebookEvent& event);
int GetNotebookAffiliation(wxWindowID Id);
void ClosePages();
void ShowAllNotebooks(bool Window = false);
void HideAllNotebooks(bool Window = false);
void CloseAllNotebooks();
void DoAddPage(wxWindow *Win, int i, bool Float);
void DoRemovePage(wxWindow *, bool bHide = true);

View File

@ -169,19 +169,19 @@ void CFrame::ToggleConsole(bool bShow)
void CFrame::OnToggleWindow(wxCommandEvent& event)
{
bool bShow = GetMenuBar()->IsChecked(event.GetId());
bool bShow = event.IsChecked();
switch(event.GetId())
{
case IDM_LOGWINDOW:
if (!g_pCodeWindow)
SConfig::GetInstance().m_InterfaceLogWindow = event.IsChecked();
SConfig::GetInstance().m_InterfaceLogWindow = bShow;
ToggleLogWindow(bShow);
break;
case IDM_CONSOLEWINDOW:
if (!g_pCodeWindow)
SConfig::GetInstance().m_InterfaceConsole = event.IsChecked();
ToggleConsole(event.IsChecked());
SConfig::GetInstance().m_InterfaceConsole = bShow;
ToggleConsole(bShow);
break;
case IDM_REGISTERWINDOW:
g_pCodeWindow->ToggleRegisterWindow(bShow);
@ -202,7 +202,6 @@ void CFrame::OnToggleWindow(wxCommandEvent& event)
g_pCodeWindow->ToggleDLLWindow(IDM_VIDEOWINDOW, bShow);
break;
}
event.Skip();
}
// Notebooks
@ -308,7 +307,8 @@ void CFrame::DoFloatNotebookPage(wxWindowID Id)
{
nb->RemovePage(nb->GetPageIndex(Win));
// Create the parent frame and reparent the window
CreateParentFrame(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW, Win->GetName(), Win);
CreateParentFrame(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW,
Win->GetName(), Win);
if (nb->GetPageCount() == 0)
AddRemoveBlankPage();
}
@ -320,7 +320,7 @@ void CFrame::DoUnfloatPage(int Id)
wxFrame * Win = (wxFrame*)FindWindowById(Id);
if (!Win) return;
wxWindow * Child = Win->GetWindowChildren().Item(0)->GetData();
wxWindow * Child = Win->GetChildren().Item(0)->GetData();
Child->Reparent(this);
DoAddPage(Child, g_pCodeWindow->iNbAffiliation[Child->GetId() - IDM_LOGWINDOW], false);
Win->Destroy();
@ -369,10 +369,10 @@ void CFrame::TogglePane()
{
// Get the first notebook
wxAuiNotebook * NB = NULL;
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
for (size_t i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{
if (m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook)))
NB = (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window;
if (m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window;
}
if (NB)
{
@ -401,7 +401,8 @@ void CFrame::DoRemovePage(wxWindow *Win, bool bHide)
{
if (!Win) return;
wxWindow *Parent = FindWindowById(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW);
wxWindow *Parent = FindWindowById(Win->GetId() +
IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW);
if (Parent)
{
@ -439,13 +440,13 @@ void CFrame::DoRemovePage(wxWindow *Win, bool bHide)
void CFrame::DoAddPage(wxWindow *Win, int i, bool Float)
{
if (!Win) return;
if (GetNotebookCount() == 0) return;
if (i < 0 || i > GetNotebookCount()-1) i = 0;
if (Win && GetNotebookFromId(i)->GetPageIndex(Win) != wxNOT_FOUND) return;
if (!Float)
GetNotebookFromId(i)->AddPage(Win, Win->GetName(), true);
else
CreateParentFrame(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW, Win->GetName(), Win);
CreateParentFrame(Win->GetId() + IDM_LOGWINDOW_PARENT - IDM_LOGWINDOW,
Win->GetName(), Win);
}
// Toolbar
@ -462,13 +463,16 @@ void CFrame::OnDropDownSettingsToolbar(wxAuiToolBarEvent& event)
// Create the popup menu
wxMenu* menuPopup = new wxMenu;
wxMenuItem* Item = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_ADD_PANE, wxT("Add new pane"));
wxMenuItem* Item = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_ADD_PANE,
wxT("Add new pane"));
menuPopup->Append(Item);
menuPopup->Append(new wxMenuItem(menuPopup));
Item = new wxMenuItem(menuPopup, IDM_TAB_SPLIT, wxT("Tab split"), wxT(""), wxITEM_CHECK);
Item = new wxMenuItem(menuPopup, IDM_TAB_SPLIT, wxT("Tab split"),
wxT(""), wxITEM_CHECK);
menuPopup->Append(Item);
Item->Check(m_bTabSplit);
Item = new wxMenuItem(menuPopup, IDM_NO_DOCKING, wxT("No docking"), wxT(""), wxITEM_CHECK);
Item = new wxMenuItem(menuPopup, IDM_NO_DOCKING, wxT("No docking"),
wxT(""), wxITEM_CHECK);
menuPopup->Append(Item);
Item->Check(m_bNoDocking);
@ -495,16 +499,18 @@ void CFrame::OnDropDownToolbarItem(wxAuiToolBarEvent& event)
// create the popup menu
wxMenu* menuPopup = new wxMenu;
wxMenuItem* Item = new wxMenuItem(menuPopup, IDM_ADD_PERSPECTIVE, wxT("Create new perspective"));
wxMenuItem* Item = new wxMenuItem(menuPopup, IDM_ADD_PERSPECTIVE,
wxT("Create new perspective"));
menuPopup->Append(Item);
if (Perspectives.size() > 0)
{
menuPopup->Append(new wxMenuItem(menuPopup));
for (u32 i = 0; i < Perspectives.size(); i++)
for (size_t i = 0; i < Perspectives.size(); i++)
{
wxMenuItem* mItem = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_0 + i,
wxString::FromAscii(Perspectives[i].Name.c_str()), wxT(""), wxITEM_CHECK);
wxString::FromAscii(Perspectives[i].Name.c_str()),
wxT(""), wxITEM_CHECK);
menuPopup->Append(mItem);
if (i == ActivePerspective) mItem->Check(true);
}
@ -557,7 +563,8 @@ void CFrame::OnDropDownToolbarSelect(wxCommandEvent& event)
{
case IDM_ADD_PERSPECTIVE:
{
wxTextEntryDialog dlg(this, wxT("Enter a name for the new perspective:"),
wxTextEntryDialog dlg(this,
wxT("Enter a name for the new perspective:"),
wxT("Create new perspective"));
wxString DefaultValue = wxString::Format(wxT("Perspective %d"),
Perspectives.size() + 1);
@ -612,7 +619,7 @@ void CFrame::ResetToolbarStyle()
wxAuiPaneInfoArray& AllPanes = m_Mgr->GetAllPanes();
for (int i = 0, Count = (int)AllPanes.GetCount(); i < Count; ++i)
{
wxAuiPaneInfo& Pane = AllPanes.Item(i);
wxAuiPaneInfo& Pane = AllPanes[i];
if (Pane.window->IsKindOf(CLASSINFO(wxAuiToolBar)))
{
Pane.Show();
@ -627,9 +634,9 @@ void CFrame::ResetToolbarStyle()
void CFrame::TogglePaneStyle(bool On, int EventId)
{
wxAuiPaneInfoArray& AllPanes = m_Mgr->GetAllPanes();
for (u32 i = 0; i < AllPanes.GetCount(); ++i)
for (size_t i = 0; i < AllPanes.GetCount(); ++i)
{
wxAuiPaneInfo& Pane = AllPanes.Item(i);
wxAuiPaneInfo& Pane = AllPanes[i];
if (Pane.window->IsKindOf(CLASSINFO(wxAuiNotebook)))
{
// Default
@ -659,7 +666,7 @@ void CFrame::ToggleNotebookStyle(bool On, long Style)
wxAuiPaneInfoArray& AllPanes = m_Mgr->GetAllPanes();
for (int i = 0, Count = (int)AllPanes.GetCount(); i < Count; ++i)
{
wxAuiPaneInfo& Pane = AllPanes.Item(i);
wxAuiPaneInfo& Pane = AllPanes[i];
if (Pane.window->IsKindOf(CLASSINFO(wxAuiNotebook)))
{
wxAuiNotebook* NB = (wxAuiNotebook*)Pane.window;
@ -676,7 +683,7 @@ void CFrame::ToggleNotebookStyle(bool On, long Style)
void CFrame::OnSelectPerspective(wxCommandEvent& event)
{
u32 _Selection = event.GetId() - IDM_PERSPECTIVES_0;
size_t _Selection = event.GetId() - IDM_PERSPECTIVES_0;
if (Perspectives.size() <= _Selection) _Selection = 0;
ActivePerspective = _Selection;
DoLoadPerspective();
@ -689,46 +696,24 @@ void CFrame::ResizeConsole()
wxWindow * Win = FindWindowById(IDM_CONSOLEWINDOW);
if (!Win) return;
// Get OS version
int wxBorder, Border, LowerBorder, MenuBar, ScrollBar, WidthReduction;
OSVERSIONINFO osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osvi);
if (osvi.dwMajorVersion == 6) // Vista (same as 7?)
{
wxBorder = 2;
Border = 4;
LowerBorder = 6;
MenuBar = 30; // Including upper border
ScrollBar = 19;
}
else // XP
{
wxBorder = 2;
Border = 4;
LowerBorder = 6;
MenuBar = 30;
ScrollBar = 19;
}
WidthReduction = 30 - Border;
const int wxBorder = 2, Border = 4, LowerBorder = 6,
MenuBar = 30, ScrollBar = 19;
const int WidthReduction = 30 - Border;
// Get the client size
int X = Win->GetClientSize().GetX();
int Y = Win->GetClientSize().GetY();
int InternalWidth = X - wxBorder*2 - ScrollBar;
int InternalHeight = Y - wxBorder*2;
int WindowWidth = InternalWidth + Border*2 + /*max out the width in the word wrap mode*/ 100;
int WindowWidth = InternalWidth + Border*2 +
/*max out the width in the word wrap mode*/ 100;
int WindowHeight = InternalHeight + MenuBar;
// Resize buffer
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
Console->PixelSpace(0,0, InternalWidth,InternalHeight, false);
// Move the window to hide the border
MoveWindow(GetConsoleWindow(), -Border-wxBorder,-MenuBar-wxBorder, WindowWidth + 100,WindowHeight, true);
// Move it to the bottom of the view order so that it doesn't hide the notebook tabs
// ...
// Log
//NOTICE_LOG(CONSOLE, "Size: %ix%i", X, Y);
MoveWindow(GetConsoleWindow(), -Border-wxBorder, -MenuBar-wxBorder,
WindowWidth + 100,WindowHeight, true);
#endif
}
@ -744,15 +729,15 @@ void CFrame::SetPaneSize()
if (Perspectives.size() <= ActivePerspective) return;
int iClientX = GetSize().GetX(), iClientY = GetSize().GetY();
for (u32 i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
for (size_t i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiToolBar)))
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiToolBar)))
{
if (!m_Mgr->GetAllPanes().Item(i).IsOk()) return;
if (!m_Mgr->GetAllPanes()[i].IsOk()) return;
if (Perspectives[ActivePerspective].Width.size() <= j ||
Perspectives[ActivePerspective].Height.size() <= j)
continue;
u32 W = Perspectives[ActivePerspective].Width[j],
size_t W = Perspectives[ActivePerspective].Width[j],
H = Perspectives[ActivePerspective].Height[j];
// Check limits
W = Limit(W, 5, 95);
@ -760,40 +745,37 @@ void CFrame::SetPaneSize()
// Convert percentages to pixel lengths
W = (W * iClientX) / 100;
H = (H * iClientY) / 100;
m_Mgr->GetAllPanes().Item(i).BestSize(W,H).MinSize(W,H);
m_Mgr->GetAllPanes()[i].BestSize(W,H).MinSize(W,H);
j++;
}
}
m_Mgr->Update();
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
for (size_t i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiToolBar)))
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiToolBar)))
{
m_Mgr->GetAllPanes().Item(i).MinSize(-1,-1);
m_Mgr->GetAllPanes()[i].MinSize(-1,-1);
}
}
}
void CFrame::ReloadPanes()
{
// Hide to avoid flickering
HideAllNotebooks(true);
// Close all pages
ClosePages();
CloseAllNotebooks();
// Create new panes with notebooks
for (u32 i = 0; i < Perspectives[ActivePerspective].Width.size() - 1; i++)
for (size_t i = 0; i < Perspectives[ActivePerspective].Width.size() - 1; i++)
{
wxString PaneName = wxString::Format(wxT("Pane %i"), i + 1);
m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo().Hide()
.CaptionVisible(m_bEdit).Dockable(!m_bNoDocking).Position(i)
.Name(PaneName).Caption(PaneName));
}
HideAllNotebooks(true);
// Perspectives
m_Mgr->LoadPerspective(Perspectives[ActivePerspective].Perspective, false);
@ -817,8 +799,8 @@ void CFrame::DoLoadPerspective()
ReloadPanes();
// Restore the exact window sizes, which LoadPerspective doesn't always do
SetPaneSize();
// Show
ShowAllNotebooks(true);
m_Mgr->Update();
}
// Update the local perspectives array
@ -834,7 +816,7 @@ void CFrame::LoadIniPerspectives()
ini.Get("Perspectives", "Active", &ActivePerspective, 0);
SplitString(_Perspectives, ",", VPerspectives);
for (u32 i = 0; i < VPerspectives.size(); i++)
for (size_t i = 0; i < VPerspectives.size(); i++)
{
SPerspectives Tmp;
std::string _Section, _Perspective, _Width, _Height;
@ -856,12 +838,12 @@ void CFrame::LoadIniPerspectives()
SplitString(_Width, ",", _SWidth);
SplitString(_Height, ",", _SHeight);
for (u32 j = 0; j < _SWidth.size(); j++)
for (size_t j = 0; j < _SWidth.size(); j++)
{
int _Tmp;
if (TryParseInt(_SWidth[j].c_str(), &_Tmp)) Tmp.Width.push_back(_Tmp);
}
for (u32 j = 0; j < _SHeight.size(); j++)
for (size_t j = 0; j < _SHeight.size(); j++)
{
int _Tmp;
if (TryParseInt(_SHeight[j].c_str(), &_Tmp)) Tmp.Height.push_back(_Tmp);
@ -881,15 +863,15 @@ void CFrame::UpdateCurrentPerspective()
current->Height.clear();
for (size_t i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{
if (!m_Mgr->GetAllPanes().Item(i).window->
if (!m_Mgr->GetAllPanes()[i].window->
IsKindOf(CLASSINFO(wxAuiToolBar)))
{
// Save width and height as a percentage of the client width and height
current->Width.push_back(
(m_Mgr->GetAllPanes().Item(i).window->GetClientSize().GetX() * 100) /
(m_Mgr->GetAllPanes()[i].window->GetClientSize().GetX() * 100) /
iClientX);
current->Height.push_back(
(m_Mgr->GetAllPanes().Item(i).window->GetClientSize().GetY() * 100) /
(m_Mgr->GetAllPanes()[i].window->GetClientSize().GetY() * 100) /
iClientY);
}
}
@ -910,7 +892,7 @@ void CFrame::SaveIniPerspectives()
// Save perspective names
std::string STmp = "";
for (u32 i = 0; i < Perspectives.size(); i++)
for (size_t i = 0; i < Perspectives.size(); i++)
{
STmp += Perspectives[i].Name + ",";
}
@ -961,11 +943,12 @@ void CFrame::AddPane()
wxWindow * CFrame::GetNotebookPageFromId(wxWindowID Id)
{
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
for (size_t 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;
for(u32 j = 0; j < NB->GetPageCount(); j++)
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
continue;
wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window;
for(size_t j = 0; j < NB->GetPageCount(); j++)
{
if (NB->GetPage(j)->GetId() == Id) return NB->GetPage(j);
}
@ -973,12 +956,13 @@ wxWindow * CFrame::GetNotebookPageFromId(wxWindowID Id)
return NULL;
}
wxFrame * CFrame::CreateParentFrame(wxWindowID Id, const wxString& Title, wxWindow * Child)
wxFrame * CFrame::CreateParentFrame(wxWindowID Id, const wxString& Title,
wxWindow * Child)
{
wxFrame * Frame = new wxFrame(this, Id, Title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE);
wxFrame * Frame = new wxFrame(this, Id, Title,
wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE);
Child->Reparent(Frame);
Child->Show();
wxBoxSizer * m_MainSizer = new wxBoxSizer(wxHORIZONTAL);
@ -998,42 +982,49 @@ wxFrame * CFrame::CreateParentFrame(wxWindowID Id, const wxString& Title, wxWind
// Main sizer
Frame->SetSizer(m_MainSizer);
// Minimum frame size
Frame->SetMinSize(wxSize(200, -1));
Frame->SetMinSize(wxSize(200, 200));
Frame->Show();
return Frame;
}
wxAuiNotebook* CFrame::CreateEmptyNotebook()
{
long NOTEBOOK_STYLE = wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_EXTERNAL_MOVE
| wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_WINDOWLIST_BUTTON | wxNO_BORDER;
wxAuiNotebook* NB = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, NOTEBOOK_STYLE);
const long NOTEBOOK_STYLE = wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT |
wxAUI_NB_TAB_EXTERNAL_MOVE | wxAUI_NB_SCROLL_BUTTONS |
wxAUI_NB_WINDOWLIST_BUTTON | wxNO_BORDER;
wxAuiNotebook* NB = new wxAuiNotebook(this, wxID_ANY,
wxDefaultPosition, wxDefaultSize, NOTEBOOK_STYLE);
return NB;
}
void CFrame::AddRemoveBlankPage()
{
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
for (size_t 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;
for(u32 j = 0; j < NB->GetPageCount(); j++)
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
continue;
wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window;
for(size_t j = 0; j < NB->GetPageCount(); j++)
{
if (NB->GetPageText(j).IsSameAs(wxT("<>")) && NB->GetPageCount() > 1) NB->DeletePage(j);
if (NB->GetPageText(j).IsSameAs(wxT("<>")) && NB->GetPageCount() > 1)
NB->DeletePage(j);
}
if (NB->GetPageCount() == 0) NB->AddPage(new wxPanel(this, wxID_ANY), wxT("<>"), true);
if (NB->GetPageCount() == 0)
NB->AddPage(new wxPanel(this, wxID_ANY), wxT("<>"), true);
}
}
int CFrame::GetNotebookAffiliation(wxWindowID Id)
{
for (u32 i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
for (size_t i = 0, j = 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;
for(u32 k = 0; k < NB->GetPageCount(); k++)
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
continue;
wxAuiNotebook * NB = (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window;
for(size_t k = 0; k < NB->GetPageCount(); k++)
{
if (NB->GetPage(k)->GetId() == Id) return j;
if (NB->GetPage(k)->GetId() == Id)
return j;
}
j++;
}
@ -1043,70 +1034,37 @@ int CFrame::GetNotebookAffiliation(wxWindowID Id)
// Close all panes with notebooks
void CFrame::CloseAllNotebooks()
{
int i = 0;
while(GetNotebookCount() > 0)
wxAuiPaneInfoArray AllPanes = m_Mgr->GetAllPanes();
for (size_t i = 0; i < AllPanes.GetCount(); i++)
{
if (m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook)))
if (AllPanes[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);
i = 0;
AllPanes[i].DestroyOnClose(true);
m_Mgr->ClosePane(AllPanes[i]);
}
else
i++;
}
}
int CFrame::GetNotebookCount()
{
int Ret = 0;
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
for (size_t i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{
if (m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) Ret++;
if (m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
Ret++;
}
return Ret;
}
wxAuiNotebook * CFrame::GetNotebookFromId(u32 NBId)
wxAuiNotebook * CFrame::GetNotebookFromId(size_t NBId)
{
for (u32 i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
for (size_t i = 0, j = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{
if (!m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook))) continue;
if (j == NBId) return (wxAuiNotebook*)m_Mgr->GetAllPanes().Item(i).window;
if (!m_Mgr->GetAllPanes()[i].window->IsKindOf(CLASSINFO(wxAuiNotebook)))
continue;
if (j == NBId)
return (wxAuiNotebook*)m_Mgr->GetAllPanes()[i].window;
j++;
}
return NULL;
}
void CFrame::ShowAllNotebooks(bool bShow)
{
for (u32 i = 0; i < m_Mgr->GetAllPanes().GetCount(); i++)
{
if (m_Mgr->GetAllPanes().Item(i).window->IsKindOf(CLASSINFO(wxAuiNotebook)))
{
if (bShow)
m_Mgr->GetAllPanes().Item(i).Show();
else
m_Mgr->GetAllPanes().Item(i).window->Hide();
}
}
m_Mgr->Update();
}
void CFrame::HideAllNotebooks(bool Window)
{
for (u32 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();
}

View File

@ -413,12 +413,6 @@ void CLogWindow::OnOptionsCheck(wxCommandEvent& event)
m_LogManager->removeListener((LogTypes::LOG_TYPE)i, m_console);
}
}
/*
if (m_writeConsole && !m_console->IsOpen())
wxGetApp().GetCFrame()->ToggleConsole(true);
else if (!m_writeConsole && m_console->IsOpen())
wxGetApp().GetCFrame()->ToggleConsole(false);
*/
break;
}
SaveSettings();

View File

@ -32,6 +32,8 @@
void Host_NotifyMapLoaded() {}
void Host_UpdateBreakPointView() {}
DSPDebuggerLLE* m_DebuggerFrame = NULL;
BEGIN_EVENT_TABLE(DSPDebuggerLLE, wxPanel)
EVT_CLOSE(DSPDebuggerLLE::OnClose)
EVT_MENU_RANGE(ID_RUNTOOL, ID_STEPTOOL, DSPDebuggerLLE::OnChangeState)
@ -109,18 +111,17 @@ DSPDebuggerLLE::DSPDebuggerLLE(wxWindow* parent)
UpdateState();
m_mgr.Update();
Show();
}
DSPDebuggerLLE::~DSPDebuggerLLE()
{
m_mgr.UnInit();
m_DebuggerFrame = NULL;
}
void DSPDebuggerLLE::OnClose(wxCloseEvent& event)
{
Hide();
event.Skip();
}
void DSPDebuggerLLE::OnChangeState(wxCommandEvent& event)
@ -176,12 +177,15 @@ void DSPDebuggerLLE::FocusOnPC()
void DSPDebuggerLLE::UpdateState()
{
if (DSPCore_GetState() == DSPCORE_RUNNING) {
if (DSPCore_GetState() == DSPCORE_RUNNING)
{
m_Toolbar->SetToolLabel(ID_RUNTOOL, wxT("Pause"));
m_Toolbar->SetToolBitmap(ID_RUNTOOL,
wxArtProvider::GetBitmap(wxART_TICK_MARK, wxART_OTHER, wxSize(10,10)));
m_Toolbar->EnableTool(ID_STEPTOOL, false);
} else {
}
else
{
m_Toolbar->SetToolLabel(ID_RUNTOOL, wxT("Run"));
m_Toolbar->SetToolBitmap(ID_RUNTOOL,
wxArtProvider::GetBitmap(wxART_GO_FORWARD, wxART_OTHER, wxSize(10,10)));

View File

@ -102,4 +102,6 @@ private:
void UnselectAll();
};
extern DSPDebuggerLLE* m_DebuggerFrame;
#endif //_DSP_DEBUGGER_LLE_H

View File

@ -41,7 +41,6 @@
#include "DSPConfigDlgLLE.h"
DSPConfigDialogLLE* m_ConfigFrame = NULL;
#include "Debugger/DSPDebugWindow.h"
DSPDebuggerLLE* m_DebuggerFrame = NULL;
#endif
PLUGIN_GLOBALS* globals = NULL;