Resent ISO list menu: Items order reversed such the the most recent ones appear at the top.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4524 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
avihal@gmail.com 2011-04-02 08:09:36 +00:00
parent f76e0e1d0d
commit b65a70033d
1 changed files with 9 additions and 13 deletions

View File

@ -121,7 +121,9 @@ void RecentIsoManager::Repopulate()
m_Separator = m_Menu->AppendSeparator(); m_Separator = m_Menu->AppendSeparator();
for( int i=0; i<cnt; ++i ) //Note: the internal recent iso list (m_Items) has the most recent item last (also at the INI file)
// but the menu is composed in reverse order such that the most recent item appears at the top.
for( int i=cnt-1; i>=0; --i )
InsertIntoMenu( i ); InsertIntoMenu( i );
} }
@ -152,25 +154,19 @@ void RecentIsoManager::Add( const wxString& src )
} }
} }
//New item doesn't exist at the menu/internal-list, add it. //New item doesn't exist at the menu/internal-list - add it, and refresh the menu.
RemoveAllFromMenu();
m_Items.push_back( RecentItem( normalized ) ); m_Items.push_back( RecentItem( normalized ) );
InsertIntoMenu( m_Items.size()-1 );
while( m_Items.size() > m_MaxLength ) while( m_Items.size() > m_MaxLength )
{ //We're removing items from the internal list, need to keep the menu IDs in sync, by refreshing the menu.
//This 'while' loop typically iterates at most once.
RemoveAllFromMenu();
m_Items.erase( m_Items.begin() ); m_Items.erase( m_Items.begin() );
Repopulate();
}
//check the new (last) item Repopulate();
m_Items[m_Items.size()-1].ItemPtr->Check(); m_Items[m_cursel = m_Items.size()-1].ItemPtr->Check();
m_cursel = m_Items.size()-1;
} }
//id here is the position index at the list of recent ISOs //id here is the position index at the internal list of recent ISOs (m_Items)
void RecentIsoManager::InsertIntoMenu( int id ) void RecentIsoManager::InsertIntoMenu( int id )
{ {
if( m_Menu == NULL ) return; if( m_Menu == NULL ) return;