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) if (Win)
{ {
Parent->DoRemovePage(Win, false); Parent->DoRemovePage(Win, false);
Win->Close();
Win->Destroy(); Win->Destroy();
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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