wxMenu objects are now deleted by wxwidgets - should fix a few GUI-related crashes

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4602 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-11-23 08:05:54 +00:00
parent 425ee74c76
commit 66b80131d6
8 changed files with 124 additions and 123 deletions

View File

@ -138,7 +138,8 @@ IWII_IPC_HLE_Device* AccessDeviceByID(u32 _ID)
if (g_DeviceMap.find(_ID) != g_DeviceMap.end()) if (g_DeviceMap.find(_ID) != g_DeviceMap.end())
return g_DeviceMap[_ID]; return g_DeviceMap[_ID];
_dbg_assert_msg_(WII_IPC, 0, "IOP tries to access an unknown device 0x%x", _ID); // ID = 0 just means it hasn't been created yet
_dbg_assert_msg_(WII_IPC, _ID == 0, "IOP tries to access an unknown device 0x%x", _ID);
return NULL; return NULL;
} }

View File

@ -348,26 +348,26 @@ void CCodeView::OnMouseUpR(wxMouseEvent& event)
{ {
bool isSymbol = symbol_db->GetSymbolFromAddr(selection) != 0; bool isSymbol = symbol_db->GetSymbolFromAddr(selection) != 0;
// popup menu // popup menu
wxMenu menu; wxMenu* menu = new wxMenu;
//menu.Append(IDM_GOTOINMEMVIEW, "&Goto in mem view"); //menu->Append(IDM_GOTOINMEMVIEW, "&Goto in mem view");
menu.Append(IDM_FOLLOWBRANCH, wxString::FromAscii("&Follow branch"))->Enable(AddrToBranch(selection) ? true : false); menu->Append(IDM_FOLLOWBRANCH, wxString::FromAscii("&Follow branch"))->Enable(AddrToBranch(selection) ? true : false);
menu.AppendSeparator(); menu->AppendSeparator();
#if wxUSE_CLIPBOARD #if wxUSE_CLIPBOARD
menu.Append(IDM_COPYADDRESS, wxString::FromAscii("Copy &address")); menu->Append(IDM_COPYADDRESS, wxString::FromAscii("Copy &address"));
menu.Append(IDM_COPYFUNCTION, wxString::FromAscii("Copy &function"))->Enable(isSymbol); menu->Append(IDM_COPYFUNCTION, wxString::FromAscii("Copy &function"))->Enable(isSymbol);
menu.Append(IDM_COPYCODE, wxString::FromAscii("Copy &code line")); menu->Append(IDM_COPYCODE, wxString::FromAscii("Copy &code line"));
menu.Append(IDM_COPYHEX, wxString::FromAscii("Copy &hex")); menu->Append(IDM_COPYHEX, wxString::FromAscii("Copy &hex"));
menu.AppendSeparator(); menu->AppendSeparator();
#endif #endif
menu.Append(IDM_RENAMESYMBOL, wxString::FromAscii("Rename &symbol"))->Enable(isSymbol); menu->Append(IDM_RENAMESYMBOL, wxString::FromAscii("Rename &symbol"))->Enable(isSymbol);
menu.AppendSeparator(); menu->AppendSeparator();
menu.Append(IDM_RUNTOHERE, _T("&Run To Here")); menu->Append(IDM_RUNTOHERE, _T("&Run To Here"));
menu.Append(IDM_ADDFUNCTION, _T("&Add function")); menu->Append(IDM_ADDFUNCTION, _T("&Add function"));
menu.Append(IDM_JITRESULTS, wxString::FromAscii("PPC vs X86")); menu->Append(IDM_JITRESULTS, wxString::FromAscii("PPC vs X86"));
menu.Append(IDM_INSERTBLR, wxString::FromAscii("Insert &blr")); menu->Append(IDM_INSERTBLR, wxString::FromAscii("Insert &blr"));
menu.Append(IDM_INSERTNOP, wxString::FromAscii("Insert &nop")); menu->Append(IDM_INSERTNOP, wxString::FromAscii("Insert &nop"));
menu.Append(IDM_PATCHALERT, wxString::FromAscii("Patch alert")); menu->Append(IDM_PATCHALERT, wxString::FromAscii("Patch alert"));
PopupMenu(&menu); PopupMenu(menu);
event.Skip(true); event.Skip(true);
} }

View File

@ -227,20 +227,20 @@ void CMemoryView::OnPopupMenu(wxCommandEvent& event)
void CMemoryView::OnMouseDownR(wxMouseEvent& event) void CMemoryView::OnMouseDownR(wxMouseEvent& event)
{ {
// popup menu // popup menu
wxMenu menu; wxMenu* menu = new wxMenu;
//menu.Append(IDM_GOTOINMEMVIEW, "&Goto in mem view"); //menu.Append(IDM_GOTOINMEMVIEW, "&Goto in mem view");
#if wxUSE_CLIPBOARD #if wxUSE_CLIPBOARD
menu.Append(IDM_COPYADDRESS, wxString::FromAscii("Copy &address")); menu->Append(IDM_COPYADDRESS, wxString::FromAscii("Copy &address"));
menu.Append(IDM_COPYHEX, wxString::FromAscii("Copy &hex")); menu->Append(IDM_COPYHEX, wxString::FromAscii("Copy &hex"));
#endif #endif
menu.Append(IDM_TOGGLEMEMORY, wxString::FromAscii("Toggle &memory (RAM/ARAM)")); menu->Append(IDM_TOGGLEMEMORY, wxString::FromAscii("Toggle &memory (RAM/ARAM)"));
wxMenu viewAsSubMenu; wxMenu* viewAsSubMenu = new wxMenu;
viewAsSubMenu.Append(IDM_VIEWASFP, wxString::FromAscii("FP value")); viewAsSubMenu->Append(IDM_VIEWASFP, wxString::FromAscii("FP value"));
viewAsSubMenu.Append(IDM_VIEWASASCII, wxString::FromAscii("ASCII")); viewAsSubMenu->Append(IDM_VIEWASASCII, wxString::FromAscii("ASCII"));
menu.AppendSubMenu(&viewAsSubMenu, wxString::FromAscii("View As:")); menu->AppendSubMenu(viewAsSubMenu, wxString::FromAscii("View As:"));
PopupMenu(&menu); PopupMenu(menu);
event.Skip(true); event.Skip(true);
} }

View File

@ -164,7 +164,7 @@ CNANDContentLoader::CNANDContentLoader(const std::string& _rName)
} }
else else
{ {
_dbg_assert_msg_(BOOT, 0, "CNANDContentLoader loads neither folder nor file"); // _dbg_assert_msg_(BOOT, 0, "CNANDContentLoader loads neither folder nor file");
} }
} }

View File

@ -277,40 +277,40 @@ void CFrame::OnTab(wxAuiNotebookEvent& event)
if (!g_pCodeWindow) return; if (!g_pCodeWindow) return;
// Create the popup menu // Create the popup menu
wxMenu MenuPopup; wxMenu* MenuPopup = new wxMenu;
wxMenuItem* Item = new wxMenuItem(&MenuPopup, wxID_ANY, wxT("Select floating windows")); wxMenuItem* Item = new wxMenuItem(MenuPopup, wxID_ANY, wxT("Select floating windows"));
MenuPopup.Append(Item); MenuPopup->Append(Item);
Item->Enable(false); Item->Enable(false);
MenuPopup.Append(new wxMenuItem(&MenuPopup)); MenuPopup->Append(new wxMenuItem(MenuPopup));
Item = new wxMenuItem(&MenuPopup, IDM_FLOAT_LOGWINDOW, WindowNameFromId(IDM_LOGWINDOW), wxT(""), wxITEM_CHECK); Item = new wxMenuItem(MenuPopup, IDM_FLOAT_LOGWINDOW, WindowNameFromId(IDM_LOGWINDOW), wxT(""), wxITEM_CHECK);
MenuPopup.Append(Item); MenuPopup->Append(Item);
Item->Check(!!FindWindowById(IDM_LOGWINDOW_PARENT)); Item->Check(!!FindWindowById(IDM_LOGWINDOW_PARENT));
Item = new wxMenuItem(&MenuPopup, IDM_FLOAT_CONSOLEWINDOW, WindowNameFromId(IDM_CONSOLEWINDOW), wxT(""), wxITEM_CHECK); Item = new wxMenuItem(MenuPopup, IDM_FLOAT_CONSOLEWINDOW, WindowNameFromId(IDM_CONSOLEWINDOW), wxT(""), wxITEM_CHECK);
MenuPopup.Append(Item); MenuPopup->Append(Item);
Item->Check(!!FindWindowById(IDM_CONSOLEWINDOW_PARENT)); Item->Check(!!FindWindowById(IDM_CONSOLEWINDOW_PARENT));
MenuPopup.Append(new wxMenuItem(&MenuPopup)); MenuPopup->Append(new wxMenuItem(MenuPopup));
Item = new wxMenuItem(&MenuPopup, IDM_FLOAT_CODEWINDOW, WindowNameFromId(IDM_CODEWINDOW), wxT(""), wxITEM_CHECK); Item = new wxMenuItem(MenuPopup, IDM_FLOAT_CODEWINDOW, WindowNameFromId(IDM_CODEWINDOW), wxT(""), wxITEM_CHECK);
MenuPopup.Append(Item); MenuPopup->Append(Item);
Item->Check(!!FindWindowById(IDM_CODEWINDOW_PARENT)); Item->Check(!!FindWindowById(IDM_CODEWINDOW_PARENT));
Item = new wxMenuItem(&MenuPopup, IDM_FLOAT_REGISTERWINDOW, WindowNameFromId(IDM_REGISTERWINDOW), wxT(""), wxITEM_CHECK); Item = new wxMenuItem(MenuPopup, IDM_FLOAT_REGISTERWINDOW, WindowNameFromId(IDM_REGISTERWINDOW), wxT(""), wxITEM_CHECK);
MenuPopup.Append(Item); MenuPopup->Append(Item);
Item->Check(!!FindWindowById(IDM_REGISTERWINDOW_PARENT)); Item->Check(!!FindWindowById(IDM_REGISTERWINDOW_PARENT));
Item = new wxMenuItem(&MenuPopup, IDM_FLOAT_BREAKPOINTWINDOW, WindowNameFromId(IDM_BREAKPOINTWINDOW), wxT(""), wxITEM_CHECK); Item = new wxMenuItem(MenuPopup, IDM_FLOAT_BREAKPOINTWINDOW, WindowNameFromId(IDM_BREAKPOINTWINDOW), wxT(""), wxITEM_CHECK);
MenuPopup.Append(Item); MenuPopup->Append(Item);
Item->Check(!!FindWindowById(IDM_BREAKPOINTWINDOW_PARENT)); Item->Check(!!FindWindowById(IDM_BREAKPOINTWINDOW_PARENT));
Item = new wxMenuItem(&MenuPopup, IDM_FLOAT_MEMORYWINDOW, WindowNameFromId(IDM_MEMORYWINDOW), wxT(""), wxITEM_CHECK); Item = new wxMenuItem(MenuPopup, IDM_FLOAT_MEMORYWINDOW, WindowNameFromId(IDM_MEMORYWINDOW), wxT(""), wxITEM_CHECK);
MenuPopup.Append(Item); MenuPopup->Append(Item);
Item->Check(!!FindWindowById(IDM_MEMORYWINDOW_PARENT)); Item->Check(!!FindWindowById(IDM_MEMORYWINDOW_PARENT));
Item = new wxMenuItem(&MenuPopup, IDM_FLOAT_JITWINDOW, WindowNameFromId(IDM_JITWINDOW), wxT(""), wxITEM_CHECK); Item = new wxMenuItem(MenuPopup, IDM_FLOAT_JITWINDOW, WindowNameFromId(IDM_JITWINDOW), wxT(""), wxITEM_CHECK);
MenuPopup.Append(Item); MenuPopup->Append(Item);
Item->Check(!!FindWindowById(IDM_JITWINDOW_PARENT)); Item->Check(!!FindWindowById(IDM_JITWINDOW_PARENT));
Item = new wxMenuItem(&MenuPopup, IDM_FLOAT_SOUNDWINDOW, WindowNameFromId(IDM_SOUNDWINDOW), wxT(""), wxITEM_CHECK); Item = new wxMenuItem(MenuPopup, IDM_FLOAT_SOUNDWINDOW, WindowNameFromId(IDM_SOUNDWINDOW), wxT(""), wxITEM_CHECK);
MenuPopup.Append(Item); MenuPopup->Append(Item);
Item->Check(!!FindWindowById(IDM_SOUNDWINDOW_PARENT)); Item->Check(!!FindWindowById(IDM_SOUNDWINDOW_PARENT));
Item->Enable(false); Item->Enable(false);
Item = new wxMenuItem(&MenuPopup, IDM_FLOAT_VIDEOWINDOW, WindowNameFromId(IDM_VIDEOWINDOW), wxT(""), wxITEM_CHECK); Item = new wxMenuItem(MenuPopup, IDM_FLOAT_VIDEOWINDOW, WindowNameFromId(IDM_VIDEOWINDOW), wxT(""), wxITEM_CHECK);
MenuPopup.Append(Item); MenuPopup->Append(Item);
Item->Check(!!FindWindowById(IDM_VIDEOWINDOW_PARENT)); Item->Check(!!FindWindowById(IDM_VIDEOWINDOW_PARENT));
Item->Enable(false); Item->Enable(false);
@ -318,7 +318,7 @@ void CFrame::OnTab(wxAuiNotebookEvent& event)
wxPoint Pt = ::wxGetMousePosition(); wxPoint Pt = ::wxGetMousePosition();
Pt = ScreenToClient(Pt); Pt = ScreenToClient(Pt);
// Show // Show
PopupMenu(&MenuPopup, Pt); PopupMenu(MenuPopup, Pt);
} }
void CFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& event) void CFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& event)
{ {
@ -513,16 +513,16 @@ void CFrame::OnDropDownSettingsToolbar(wxAuiToolBarEvent& event)
Tb->SetToolSticky(event.GetId(), true); Tb->SetToolSticky(event.GetId(), true);
// Create the popup menu // Create the popup menu
wxMenu menuPopup; 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);
// Line up our menu with the button // Line up our menu with the button
@ -530,7 +530,7 @@ void CFrame::OnDropDownSettingsToolbar(wxAuiToolBarEvent& event)
wxPoint Pt = Tb->ClientToScreen(rect.GetBottomLeft()); wxPoint Pt = Tb->ClientToScreen(rect.GetBottomLeft());
Pt = ScreenToClient(Pt); Pt = ScreenToClient(Pt);
// Show // Show
PopupMenu(&menuPopup, Pt); PopupMenu(menuPopup, Pt);
// Make the button un-stuck again // Make the button un-stuck again
if (!m_bEdit) Tb->SetToolSticky(event.GetId(), false); if (!m_bEdit) Tb->SetToolSticky(event.GetId(), false);
} }
@ -546,17 +546,17 @@ void CFrame::OnDropDownToolbarItem(wxAuiToolBarEvent& event)
tb->SetToolSticky(event.GetId(), true); tb->SetToolSticky(event.GetId(), true);
// create the popup menu // create the popup menu
wxMenu menuPopup; 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 (u32 i = 0; i < Perspectives.size(); i++)
{ {
wxMenuItem* mItem = new wxMenuItem(&menuPopup, IDM_PERSPECTIVES_0 + i, wxString::FromAscii(Perspectives.at(i).Name.c_str()), wxT(""), wxITEM_CHECK); wxMenuItem* mItem = new wxMenuItem(menuPopup, IDM_PERSPECTIVES_0 + i, wxString::FromAscii(Perspectives.at(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);
} }
} }
@ -566,7 +566,7 @@ void CFrame::OnDropDownToolbarItem(wxAuiToolBarEvent& event)
wxPoint pt = tb->ClientToScreen(rect.GetBottomLeft()); wxPoint pt = tb->ClientToScreen(rect.GetBottomLeft());
pt = ScreenToClient(pt); pt = ScreenToClient(pt);
// show // show
PopupMenu(&menuPopup, pt); PopupMenu(menuPopup, pt);
// make sure the button is "un-stuck" // make sure the button is "un-stuck"
tb->SetToolSticky(event.GetId(), false); tb->SetToolSticky(event.GetId(), false);
} }

View File

@ -785,44 +785,44 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
const GameListItem *selected_iso = GetSelectedISO(); const GameListItem *selected_iso = GetSelectedISO();
if (selected_iso) if (selected_iso)
{ {
wxMenu popupMenu; wxMenu* popupMenu = new wxMenu;
popupMenu.Append(IDM_PROPERTIES, _("&Properties")); popupMenu->Append(IDM_PROPERTIES, _("&Properties"));
popupMenu.AppendSeparator(); popupMenu->AppendSeparator();
if (selected_iso->GetPlatform() != GameListItem::GAMECUBE_DISC) if (selected_iso->GetPlatform() != GameListItem::GAMECUBE_DISC)
popupMenu.Append(IDM_OPENSAVEFOLDER, _("Open Wii &save folder")); popupMenu->Append(IDM_OPENSAVEFOLDER, _("Open Wii &save folder"));
popupMenu.Append(IDM_OPENCONTAININGFOLDER, _("Open &containing folder")); popupMenu->Append(IDM_OPENCONTAININGFOLDER, _("Open &containing folder"));
popupMenu.AppendCheckItem(IDM_SETDEFAULTGCM, _("Set as &default ISO")); popupMenu->AppendCheckItem(IDM_SETDEFAULTGCM, _("Set as &default ISO"));
// First we have to decide a starting value when we append it // First we have to decide a starting value when we append it
if(selected_iso->GetFileName() == SConfig::GetInstance(). if(selected_iso->GetFileName() == SConfig::GetInstance().
m_LocalCoreStartupParameter.m_strDefaultGCM) m_LocalCoreStartupParameter.m_strDefaultGCM)
popupMenu.FindItem(IDM_SETDEFAULTGCM)->Check(); popupMenu->FindItem(IDM_SETDEFAULTGCM)->Check();
popupMenu.AppendSeparator(); popupMenu->AppendSeparator();
popupMenu.Append(IDM_DELETEGCM, _("&Delete ISO...")); popupMenu->Append(IDM_DELETEGCM, _("&Delete ISO..."));
if (selected_iso->GetPlatform() != GameListItem::WII_WAD) if (selected_iso->GetPlatform() != GameListItem::WII_WAD)
{ {
if (selected_iso->IsCompressed()) if (selected_iso->IsCompressed())
popupMenu.Append(IDM_COMPRESSGCM, _("Decompress ISO...")); popupMenu->Append(IDM_COMPRESSGCM, _("Decompress ISO..."));
else else
popupMenu.Append(IDM_COMPRESSGCM, _("Compress ISO...")); popupMenu->Append(IDM_COMPRESSGCM, _("Compress ISO..."));
} else } else
popupMenu.Append(IDM_INSTALLWAD, _("Install to Wii Menu")); popupMenu->Append(IDM_INSTALLWAD, _("Install to Wii Menu"));
PopupMenu(&popupMenu); PopupMenu(popupMenu);
} }
} }
else if (GetSelectedItemCount() > 1) else if (GetSelectedItemCount() > 1)
{ {
wxMenu popupMenu; wxMenu* popupMenu = new wxMenu;
popupMenu.Append(IDM_DELETEGCM, _("&Delete selected ISOs...")); popupMenu->Append(IDM_DELETEGCM, _("&Delete selected ISOs..."));
popupMenu.AppendSeparator(); popupMenu->AppendSeparator();
popupMenu.Append(IDM_MULTICOMPRESSGCM, _("Compress selected ISOs...")); popupMenu->Append(IDM_MULTICOMPRESSGCM, _("Compress selected ISOs..."));
popupMenu.Append(IDM_MULTIDECOMPRESSGCM, _("Decompress selected ISOs...")); popupMenu->Append(IDM_MULTIDECOMPRESSGCM, _("Decompress selected ISOs..."));
PopupMenu(&popupMenu); PopupMenu(popupMenu);
} }
} }

View File

@ -537,9 +537,9 @@ void CISOProperties::OnCloseClick(wxCommandEvent& WXUNUSED (event))
void CISOProperties::RightClickOnBanner(wxMouseEvent& event) void CISOProperties::RightClickOnBanner(wxMouseEvent& event)
{ {
wxMenu popupMenu; wxMenu* popupMenu = new wxMenu;
popupMenu.Append(IDM_BNRSAVEAS, _("Save as...")); popupMenu->Append(IDM_BNRSAVEAS, _("Save as..."));
PopupMenu(&popupMenu); PopupMenu(popupMenu);
event.Skip(); event.Skip();
} }
@ -560,19 +560,19 @@ void CISOProperties::OnRightClickOnTree(wxTreeEvent& event)
{ {
m_Treectrl->SelectItem(event.GetItem()); m_Treectrl->SelectItem(event.GetItem());
wxMenu popupMenu; wxMenu* popupMenu = new wxMenu;
if (m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 0 if (m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 0
&& m_Treectrl->GetFirstVisibleItem() != m_Treectrl->GetSelection()) && m_Treectrl->GetFirstVisibleItem() != m_Treectrl->GetSelection())
popupMenu.Append(IDM_EXTRACTDIR, _("Extract Partition...")); popupMenu->Append(IDM_EXTRACTDIR, _("Extract Partition..."));
else if (m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 1) else if (m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 1)
popupMenu.Append(IDM_EXTRACTDIR, _("Extract Directory...")); popupMenu->Append(IDM_EXTRACTDIR, _("Extract Directory..."));
else if (m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 2) else if (m_Treectrl->GetItemImage(m_Treectrl->GetSelection()) == 2)
popupMenu.Append(IDM_EXTRACTFILE, _("Extract File...")); popupMenu->Append(IDM_EXTRACTFILE, _("Extract File..."));
popupMenu.Append(IDM_EXTRACTALL, _("Extract All Files...")); popupMenu->Append(IDM_EXTRACTALL, _("Extract All Files..."));
PopupMenu(&popupMenu); PopupMenu(popupMenu);
event.Skip(); event.Skip();
} }

View File

@ -883,7 +883,7 @@ void CMemcardManager::CMemcardListCtrl::OnRightClick(wxMouseEvent& event)
int flags; int flags;
long item = HitTest(event.GetPosition(), flags); long item = HitTest(event.GetPosition(), flags);
wxMenu popupMenu; wxMenu* popupMenu = new wxMenu;
if (item != wxNOT_FOUND) if (item != wxNOT_FOUND)
{ {
@ -894,47 +894,47 @@ void CMemcardManager::CMemcardListCtrl::OnRightClick(wxMouseEvent& event)
SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED); SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED);
int slot = event.GetId() - ID_MEMCARDLIST_A; int slot = event.GetId() - ID_MEMCARDLIST_A;
popupMenu.Append(ID_COPYFROM_A + slot, wxString::Format(wxT("Copy to Memcard %c"), 'B' - slot)); popupMenu->Append(ID_COPYFROM_A + slot, wxString::Format(wxT("Copy to Memcard %c"), 'B' - slot));
popupMenu.Append(ID_DELETE_A + slot, wxT("Delete Save")); popupMenu->Append(ID_DELETE_A + slot, wxT("Delete Save"));
popupMenu.Append(ID_SAVEIMPORT_A + slot, wxT("Import Save")); popupMenu->Append(ID_SAVEIMPORT_A + slot, wxT("Import Save"));
popupMenu.Append(ID_SAVEEXPORT_A + slot, wxT("Export Save")); popupMenu->Append(ID_SAVEEXPORT_A + slot, wxT("Export Save"));
popupMenu.Append(ID_EXPORTALL_A + slot, wxT("Export all saves")); popupMenu->Append(ID_EXPORTALL_A + slot, wxT("Export all saves"));
if (!twoCardsLoaded) if (!twoCardsLoaded)
popupMenu.FindItem(ID_COPYFROM_A + slot)->Enable(false); popupMenu->FindItem(ID_COPYFROM_A + slot)->Enable(false);
popupMenu.AppendSeparator(); popupMenu->AppendSeparator();
popupMenu.Append(ID_FIXCHECKSUM_A + slot, wxT("Fix Checksums")); popupMenu->Append(ID_FIXCHECKSUM_A + slot, wxT("Fix Checksums"));
popupMenu.Append(ID_PREVPAGE_A + slot, wxT("Previous Page")); popupMenu->Append(ID_PREVPAGE_A + slot, wxT("Previous Page"));
popupMenu.Append(ID_NEXTPAGE_A + slot, wxT("Next Page")); popupMenu->Append(ID_NEXTPAGE_A + slot, wxT("Next Page"));
popupMenu.Append(ID_MEMCARDPATH_A + slot, wxString::Format(wxT("Set as default Memcard %c"), 'A' + slot)); popupMenu->Append(ID_MEMCARDPATH_A + slot, wxString::Format(wxT("Set as default Memcard %c"), 'A' + slot));
popupMenu.AppendCheckItem(ID_USEPAGES, wxT("Enable pages")); popupMenu->AppendCheckItem(ID_USEPAGES, wxT("Enable pages"));
if (!prevPage || !usePages) if (!prevPage || !usePages)
popupMenu.FindItem(ID_PREVPAGE_A + slot)->Enable(false); popupMenu->FindItem(ID_PREVPAGE_A + slot)->Enable(false);
if (!nextPage || !usePages) if (!nextPage || !usePages)
popupMenu.FindItem(ID_NEXTPAGE_A + slot)->Enable(false); popupMenu->FindItem(ID_NEXTPAGE_A + slot)->Enable(false);
if(usePages) if(usePages)
popupMenu.FindItem(ID_USEPAGES)->Check(); popupMenu->FindItem(ID_USEPAGES)->Check();
popupMenu.AppendSeparator(); popupMenu->AppendSeparator();
popupMenu.AppendCheckItem(COLUMN_BANNER, wxT("Show save banner")); popupMenu->AppendCheckItem(COLUMN_BANNER, wxT("Show save banner"));
popupMenu.AppendCheckItem(COLUMN_TITLE, wxT("Show save title")); popupMenu->AppendCheckItem(COLUMN_TITLE, wxT("Show save title"));
popupMenu.AppendCheckItem(COLUMN_COMMENT, wxT("Show save comment")); popupMenu->AppendCheckItem(COLUMN_COMMENT, wxT("Show save comment"));
popupMenu.AppendCheckItem(COLUMN_ICON, wxT("Show save icon")); popupMenu->AppendCheckItem(COLUMN_ICON, wxT("Show save icon"));
popupMenu.AppendCheckItem(COLUMN_BLOCKS, wxT("Show save blocks")); popupMenu->AppendCheckItem(COLUMN_BLOCKS, wxT("Show save blocks"));
for (int i = COLUMN_BANNER; i <= COLUMN_BLOCKS; i++) for (int i = COLUMN_BANNER; i <= COLUMN_BLOCKS; i++)
{ {
if (column[i]) popupMenu.FindItem(i)->Check(); if (column[i]) popupMenu->FindItem(i)->Check();
} }
#ifdef DEBUG_MCM #ifdef DEBUG_MCM
popupMenu.AppendCheckItem(NUMBER_OF_COLUMN, wxT("Debug Memcard")); popupMenu->AppendCheckItem(NUMBER_OF_COLUMN, wxT("Debug Memcard"));
if (column[NUMBER_OF_COLUMN]) popupMenu.FindItem(NUMBER_OF_COLUMN)->Check(); if (column[NUMBER_OF_COLUMN]) popupMenu->FindItem(NUMBER_OF_COLUMN)->Check();
#endif #endif
} }
PopupMenu(&popupMenu); PopupMenu(popupMenu);
} }