hide locked songs from EditMenu in HomeEditMode
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
#include "Foreach.h"
|
#include "Foreach.h"
|
||||||
#include "CommonMetrics.h"
|
#include "CommonMetrics.h"
|
||||||
#include "BannerCache.h"
|
#include "BannerCache.h"
|
||||||
|
#include "UnlockManager.h"
|
||||||
|
|
||||||
|
|
||||||
static const CString EditMenuRowNames[NUM_EDIT_MENU_ROWS] = {
|
static const CString EditMenuRowNames[NUM_EDIT_MENU_ROWS] = {
|
||||||
@@ -47,6 +48,35 @@ StringToX( EditMenuAction );
|
|||||||
#define ROW_Y( i ) THEME->GetMetricF("EditMenu",ssprintf("Row%dY",i+1))
|
#define ROW_Y( i ) THEME->GetMetricF("EditMenu",ssprintf("Row%dY",i+1))
|
||||||
|
|
||||||
|
|
||||||
|
static void GetSongsToShowForGroup( const CString &sGroup, vector<Song*> &vpSongsOut )
|
||||||
|
{
|
||||||
|
vpSongsOut.clear();
|
||||||
|
SONGMAN->GetSongs( vpSongsOut, sGroup );
|
||||||
|
if( HOME_EDIT_MODE )
|
||||||
|
{
|
||||||
|
// strip groups that have no unlocked songs
|
||||||
|
for( int i=vpSongsOut.size()-1; i>=0; i-- )
|
||||||
|
{
|
||||||
|
const Song* pSong = vpSongsOut[i];
|
||||||
|
if( UNLOCKMAN->SongIsLocked(pSong) )
|
||||||
|
vpSongsOut.erase( vpSongsOut.begin()+i );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void GetGroupsToShow( vector<CString> &vsGroupsOut )
|
||||||
|
{
|
||||||
|
vsGroupsOut.clear();
|
||||||
|
SONGMAN->GetGroupNames( vsGroupsOut );
|
||||||
|
for( int i = vsGroupsOut.size()-1; i>=0; i-- )
|
||||||
|
{
|
||||||
|
const CString &sGroup = vsGroupsOut[i];
|
||||||
|
vector<Song*> vpSongs;
|
||||||
|
GetSongsToShowForGroup( sGroup, vpSongs );
|
||||||
|
if( vpSongs.empty() )
|
||||||
|
vsGroupsOut.erase( vsGroupsOut.begin()+i );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EditMenu::EditMenu()
|
EditMenu::EditMenu()
|
||||||
{
|
{
|
||||||
LOG->Trace( "EditMenu::EditMenu()" );
|
LOG->Trace( "EditMenu::EditMenu()" );
|
||||||
@@ -122,8 +152,10 @@ EditMenu::EditMenu()
|
|||||||
m_soundChangeValue.Load( THEME->GetPathS("EditMenu","value") );
|
m_soundChangeValue.Load( THEME->GetPathS("EditMenu","value") );
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
// fill in data structures
|
// fill in data structures
|
||||||
SONGMAN->GetGroupNames( m_sGroups );
|
//
|
||||||
|
GetGroupsToShow( m_sGroups );
|
||||||
m_StepsTypes = STEPS_TYPES_TO_SHOW.GetValue();
|
m_StepsTypes = STEPS_TYPES_TO_SHOW.GetValue();
|
||||||
if( HOME_EDIT_MODE )
|
if( HOME_EDIT_MODE )
|
||||||
{
|
{
|
||||||
@@ -315,7 +347,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
|
|||||||
m_GroupBanner.LoadFromGroup( GetSelectedGroup() );
|
m_GroupBanner.LoadFromGroup( GetSelectedGroup() );
|
||||||
m_GroupBanner.ScaleToClipped( GROUP_BANNER_WIDTH, GROUP_BANNER_HEIGHT );
|
m_GroupBanner.ScaleToClipped( GROUP_BANNER_WIDTH, GROUP_BANNER_HEIGHT );
|
||||||
m_pSongs.clear();
|
m_pSongs.clear();
|
||||||
SONGMAN->GetSongs( m_pSongs, GetSelectedGroup() );
|
GetSongsToShowForGroup( GetSelectedGroup(), m_pSongs );
|
||||||
m_iSelection[ROW_SONG] = 0;
|
m_iSelection[ROW_SONG] = 0;
|
||||||
// fall through
|
// fall through
|
||||||
case ROW_SONG:
|
case ROW_SONG:
|
||||||
|
|||||||
Reference in New Issue
Block a user