Menu: recent-ISO-list (dynamic list with automatic menu IDs) was clashing with other fixed menu IDs (specifically, the first item on the recent ISOs list got an "automatic" id of 100 (decimal) which happened to clash with multitap 2 menu item. Result: when clicking multitap2 menu item, the first iso gets selected instead - multitap2 menu was b0rked).

Solution: reserve 100 IDs for the recent ISO list and use them.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4396 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
avihal@gmail.com 2011-03-07 16:58:24 +00:00
parent bfc4ab8e7d
commit 9f8f25fef2
4 changed files with 19 additions and 9 deletions

View File

@ -86,7 +86,8 @@ enum MenuIdentifiers
MenuId_Src_NoDisc,
MenuId_Boot_Iso, // Opens submenu with Iso browser, and recent isos.
MenuId_IsoSelector, // Contains a submenu of selectable "favorite" isos
MenuId_IsoBrowse, // Open dialog, runs selected iso.
MenuId_RecentIsos_reservedStart,
MenuId_IsoBrowse = MenuId_RecentIsos_reservedStart + 100, // Open dialog, runs selected iso.
MenuId_Boot_CDVD,
MenuId_Boot_CDVD2,
MenuId_Boot_ELF,

View File

@ -66,11 +66,11 @@ const wxImage& LoadImageAny(
return dest = onFail.Get();
}
RecentIsoList::RecentIsoList()
RecentIsoList::RecentIsoList(int firstIdForMenuItems_or_wxID_ANY)
{
Menu = new wxMenu();
Menu->Append( MenuId_IsoBrowse, _("Browse..."), _("Browse for an Iso that is not in your recent history.") );
Manager = new RecentIsoManager( Menu );
Manager = new RecentIsoManager( Menu, firstIdForMenuItems_or_wxID_ANY );
}
pxAppResources::pxAppResources()
@ -81,13 +81,13 @@ pxAppResources::~pxAppResources() throw() {}
wxMenu& Pcsx2App::GetRecentIsoMenu()
{
if (!m_RecentIsoList) m_RecentIsoList = new RecentIsoList();
if (!m_RecentIsoList) m_RecentIsoList = new RecentIsoList( MenuId_RecentIsos_reservedStart );
return *m_RecentIsoList->Menu;
}
RecentIsoManager& Pcsx2App::GetRecentIsoManager()
{
if (!m_RecentIsoList) m_RecentIsoList = new RecentIsoList();
if (!m_RecentIsoList) m_RecentIsoList = new RecentIsoList( MenuId_RecentIsos_reservedStart );
return *m_RecentIsoList->Manager;
}

View File

@ -28,8 +28,9 @@ extern wxString GetMsg_IsoImageChanged();
// selecting another iso would be undesirable).
RecentIsoManager::RecentIsoManager( wxMenu* menu )
RecentIsoManager::RecentIsoManager( wxMenu* menu, int firstIdForMenuItems_or_wxID_ANY )
: m_Menu( menu )
, m_firstIdForMenuItems_or_wxID_ANY ( firstIdForMenuItems_or_wxID_ANY )
, m_MaxLength( g_Conf->RecentIsoCount )
{
m_cursel = 0;
@ -160,11 +161,17 @@ void RecentIsoManager::Add( const wxString& src )
}
}
//id here is the position index at the list of recent ISOs
void RecentIsoManager::InsertIntoMenu( int id )
{
if( m_Menu == NULL ) return;
RecentItem& curitem( m_Items[id] );
curitem.ItemPtr = m_Menu->Append( wxID_ANY, Path::GetFilename(curitem.Filename), curitem.Filename, wxITEM_RADIO );
int wxid=wxID_ANY;
if (this->m_firstIdForMenuItems_or_wxID_ANY != wxID_ANY)
wxid = this->m_firstIdForMenuItems_or_wxID_ANY + id;
curitem.ItemPtr = m_Menu->Append( wxid, Path::GetFilename(curitem.Filename), curitem.Filename, wxITEM_RADIO );
if( m_cursel == id )
curitem.ItemPtr->Check();

View File

@ -44,10 +44,12 @@ protected:
uint m_MaxLength;
int m_cursel;
int m_firstIdForMenuItems_or_wxID_ANY;
wxMenuItem* m_Separator;
public:
RecentIsoManager( wxMenu* menu );
RecentIsoManager( wxMenu* menu , int firstIdForMenuItems_or_wxID_ANY );
virtual ~RecentIsoManager() throw();
void RemoveAllFromMenu();
@ -73,7 +75,7 @@ struct RecentIsoList
ScopedPtr<RecentIsoManager> Manager;
ScopedPtr<wxMenu> Menu;
RecentIsoList();
RecentIsoList(int firstIdForMenuItems_or_wxID_ANY);
virtual ~RecentIsoList() throw() { }
};