use OptionRowHandler::m_Def

This commit is contained in:
Glenn Maynard
2006-01-17 21:23:26 +00:00
parent 3bd5beeb53
commit 2b9bb0ec44
5 changed files with 140 additions and 106 deletions
+34 -26
View File
@@ -11,6 +11,7 @@
#include "ScreenPrompt.h" #include "ScreenPrompt.h"
#include "CourseUtil.h" #include "CourseUtil.h"
#include "LocalizedString.h" #include "LocalizedString.h"
#include "OptionRowHandler.h"
enum EditCourseRow enum EditCourseRow
{ {
@@ -59,42 +60,49 @@ void ScreenOptionsEditCourse::BeginScreen()
vector<OptionRowDefinition> vDefs; vector<OptionRowDefinition> vDefs;
vector<OptionRowHandler*> vHands; vector<OptionRowHandler*> vHands;
OptionRowDefinition def; OptionRowHandler *pHand = OptionRowHandlerUtil::MakeNull();
def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW; pHand->m_Def.m_sName = "Type";
def.m_bExportOnChange = true; pHand->m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
pHand->m_Def.m_bExportOnChange = true;
pHand->m_Def.m_vsChoices.clear();
def.m_sName = "Type";
def.m_vsChoices.clear();
FOREACH_CourseType( i ) FOREACH_CourseType( i )
def.m_vsChoices.push_back( CourseTypeToLocalizedString(i) ); pHand->m_Def.m_vsChoices.push_back( CourseTypeToLocalizedString(i) );
vDefs.push_back( def ); vDefs.push_back( pHand->m_Def );
vHands.push_back( NULL ); vHands.push_back( pHand );
def.m_sName = "Meter"; pHand = OptionRowHandlerUtil::MakeNull();
def.m_vsChoices.clear(); pHand->m_Def.m_sName = "Meter";
def.m_vsChoices.push_back( "Auto" ); pHand->m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
pHand->m_Def.m_bExportOnChange = true;
pHand->m_Def.m_vsChoices.clear();
pHand->m_Def.m_vsChoices.push_back( "Auto" );
for( int i=MIN_METER; i<=MAX_METER; i++ ) for( int i=MIN_METER; i<=MAX_METER; i++ )
def.m_vsChoices.push_back( ssprintf("%d",i) ); pHand->m_Def.m_vsChoices.push_back( ssprintf("%d",i) );
vDefs.push_back( def ); vDefs.push_back( pHand->m_Def );
vHands.push_back( NULL ); vHands.push_back( pHand );
FOREACH_CONST( CourseEntry, pCourse->m_vEntries, ce ) FOREACH_CONST( CourseEntry, pCourse->m_vEntries, ce )
{ {
pHand = OptionRowHandlerUtil::MakeNull();
int iEntryIndex = ce - pCourse->m_vEntries.begin(); int iEntryIndex = ce - pCourse->m_vEntries.begin();
def.m_sName = ssprintf( "Entry %d", iEntryIndex+1 ); pHand->m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
def.m_vsChoices.clear(); pHand->m_Def.m_bExportOnChange = true;
pHand->m_Def.m_sName = ssprintf( "Entry %d", iEntryIndex+1 );
pHand->m_Def.m_vsChoices.clear();
FOREACH_CONST( Song*, m_vpDisplayedSongs, s ) FOREACH_CONST( Song*, m_vpDisplayedSongs, s )
def.m_vsChoices.push_back( (*s)->GetTranslitFullTitle() ); pHand->m_Def.m_vsChoices.push_back( (*s)->GetTranslitFullTitle() );
vDefs.push_back( def ); vDefs.push_back( pHand->m_Def );
vHands.push_back( NULL ); vHands.push_back( pHand );
} }
def.m_sName = ""; pHand = OptionRowHandlerUtil::MakeNull();
def.m_vsChoices.clear(); pHand->m_Def.m_sName = "";
def.m_vsChoices.push_back( "Insert Entry" ); pHand->m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
vDefs.push_back( def ); pHand->m_Def.m_bExportOnChange = true;
vHands.push_back( NULL ); pHand->m_Def.m_vsChoices.clear();
pHand->m_Def.m_vsChoices.push_back( "Insert Entry" );
vDefs.push_back( pHand->m_Def );
vHands.push_back( pHand );
ScreenOptions::InitMenu( vDefs, vHands ); ScreenOptions::InitMenu( vDefs, vHands );
+70 -48
View File
@@ -8,6 +8,7 @@
#include "GameManager.h" #include "GameManager.h"
#include "song.h" #include "song.h"
#include "Steps.h" #include "Steps.h"
#include "OptionRowHandler.h"
enum EditCourseEntryRow enum EditCourseEntryRow
{ {
@@ -63,70 +64,91 @@ void ScreenOptionsEditCourseEntry::BeginScreen()
vector<OptionRowDefinition> vDefs; vector<OptionRowDefinition> vDefs;
vector<OptionRowHandler*> vHands; vector<OptionRowHandler*> vHands;
OptionRowDefinition def; OptionRowHandler *pHand = OptionRowHandlerUtil::MakeNull();
def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW; vHands.push_back( OptionRowHandlerUtil::MakeNull() );
def.m_bExportOnChange = true; pHand->m_Def.m_sName = "Song Group";
pHand->m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
def.m_sName = "Song Group"; pHand->m_Def.m_bExportOnChange = true;
def.m_vsChoices.clear(); pHand->m_Def.m_vsChoices.clear();
vector<CString> vsSongGroups; vector<CString> vsSongGroups;
SONGMAN->GetSongGroupNames( vsSongGroups ); SONGMAN->GetSongGroupNames( vsSongGroups );
def.m_vsChoices.push_back( "(any)" ); pHand->m_Def.m_vsChoices.push_back( "(any)" );
FOREACH_CONST( CString, vsSongGroups, song ) FOREACH_CONST( CString, vsSongGroups, song )
def.m_vsChoices.push_back( *song ); pHand->m_Def.m_vsChoices.push_back( *song );
vDefs.push_back( def ); vDefs.push_back( pHand->m_Def );
vHands.push_back( NULL ); vHands.push_back( pHand );
def.m_sName = "Song"; pHand = OptionRowHandlerUtil::MakeNull();
def.m_vsChoices.clear(); pHand->m_Def.m_sName = "Song";
FillSongsAndChoices( ce.sSongGroup, m_vpDisplayedSongs, def.m_vsChoices ); pHand->m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
vDefs.push_back( def ); pHand->m_Def.m_bExportOnChange = true;
vHands.push_back( NULL ); pHand->m_Def.m_vsChoices.clear();
FillSongsAndChoices( ce.sSongGroup, m_vpDisplayedSongs, pHand->m_Def.m_vsChoices );
vDefs.push_back( pHand->m_Def );
vHands.push_back( pHand );
def.m_sName = "Base Difficulty"; pHand = OptionRowHandlerUtil::MakeNull();
def.m_vsChoices.clear(); pHand->m_Def.m_sName = "Base Difficulty";
def.m_vsChoices.push_back( "(any)" ); pHand->m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
pHand->m_Def.m_bExportOnChange = true;
pHand->m_Def.m_vsChoices.clear();
pHand->m_Def.m_vsChoices.push_back( "(any)" );
FOREACH_CONST( Difficulty, CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue(), dc ) FOREACH_CONST( Difficulty, CommonMetrics::DIFFICULTIES_TO_SHOW.GetValue(), dc )
def.m_vsChoices.push_back( DifficultyToLocalizedString(*dc) ); pHand->m_Def.m_vsChoices.push_back( DifficultyToLocalizedString(*dc) );
vDefs.push_back( def ); vDefs.push_back( pHand->m_Def );
vHands.push_back( NULL ); vHands.push_back( pHand );
def.m_sName = "Low Meter"; pHand = OptionRowHandlerUtil::MakeNull();
def.m_vsChoices.clear(); pHand->m_Def.m_sName = "Low Meter";
def.m_vsChoices.push_back( "(any)" ); pHand->m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
pHand->m_Def.m_bExportOnChange = true;
pHand->m_Def.m_vsChoices.clear();
pHand->m_Def.m_vsChoices.push_back( "(any)" );
for( int i=MIN_METER; i<=MAX_METER; i++ ) for( int i=MIN_METER; i<=MAX_METER; i++ )
def.m_vsChoices.push_back( ssprintf("%i",i) ); pHand->m_Def.m_vsChoices.push_back( ssprintf("%i",i) );
vDefs.push_back( def ); vDefs.push_back( pHand->m_Def );
vHands.push_back( NULL ); vHands.push_back( pHand );
def.m_sName = "High Meter"; pHand = OptionRowHandlerUtil::MakeNull();
def.m_vsChoices.clear(); pHand->m_Def.m_sName = "High Meter";
def.m_vsChoices.push_back( "(any)" ); pHand->m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
pHand->m_Def.m_bExportOnChange = true;
pHand->m_Def.m_vsChoices.clear();
pHand->m_Def.m_vsChoices.push_back( "(any)" );
for( int i=MIN_METER; i<=MAX_METER; i++ ) for( int i=MIN_METER; i<=MAX_METER; i++ )
def.m_vsChoices.push_back( ssprintf("%i",i) ); pHand->m_Def.m_vsChoices.push_back( ssprintf("%i",i) );
vDefs.push_back( def ); vDefs.push_back( pHand->m_Def );
vHands.push_back( NULL ); vHands.push_back( pHand );
def.m_sName = "Sort"; pHand = OptionRowHandlerUtil::MakeNull();
def.m_vsChoices.clear(); pHand->m_Def.m_sName = "Sort";
pHand->m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
pHand->m_Def.m_bExportOnChange = true;
pHand->m_Def.m_vsChoices.clear();
FOREACH_SongSort( i ) FOREACH_SongSort( i )
def.m_vsChoices.push_back( SongSortToLocalizedString(i) ); pHand->m_Def.m_vsChoices.push_back( SongSortToLocalizedString(i) );
vDefs.push_back( def ); vDefs.push_back( pHand->m_Def );
vHands.push_back( NULL ); vHands.push_back( pHand );
def.m_sName = "Choose"; pHand = OptionRowHandlerUtil::MakeNull();
def.m_vsChoices.clear(); pHand->m_Def.m_sName = "Choose";
pHand->m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
pHand->m_Def.m_bExportOnChange = true;
pHand->m_Def.m_vsChoices.clear();
for( int i=0; i<20; i++ ) for( int i=0; i<20; i++ )
def.m_vsChoices.push_back( FormatNumberAndSuffix(i+1) ); pHand->m_Def.m_vsChoices.push_back( FormatNumberAndSuffix(i+1) );
vDefs.push_back( def ); vDefs.push_back( pHand->m_Def );
vHands.push_back( NULL ); vHands.push_back( pHand );
def.m_sName = "Set Mods"; pHand = OptionRowHandlerUtil::MakeNull();
def.m_vsChoices.clear(); pHand->m_Def.m_sName = "Set Mods";
pHand->m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
pHand->m_Def.m_bExportOnChange = true;
pHand->m_Def.m_vsChoices.clear();
CString s = ssprintf( "%d mod changes", ce.GetNumModChanges() ); CString s = ssprintf( "%d mod changes", ce.GetNumModChanges() );
def.m_vsChoices.push_back( s ); pHand->m_Def.m_vsChoices.push_back( s );
vDefs.push_back( def ); vDefs.push_back( pHand->m_Def );
vHands.push_back( NULL ); vHands.push_back( pHand );
ScreenOptions::InitMenu( vDefs, vHands ); ScreenOptions::InitMenu( vDefs, vHands );
+9 -9
View File
@@ -10,6 +10,7 @@
#include "Profile.h" #include "Profile.h"
#include "Character.h" #include "Character.h"
#include "CharacterManager.h" #include "CharacterManager.h"
#include "OptionRowHandler.h"
enum EditProfileRow enum EditProfileRow
{ {
@@ -30,18 +31,18 @@ void ScreenOptionsEditProfile::BeginScreen()
vector<OptionRowDefinition> vDefs; vector<OptionRowDefinition> vDefs;
vector<OptionRowHandler*> vHands; vector<OptionRowHandler*> vHands;
OptionRowDefinition def;
def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
def.m_bOneChoiceForAllPlayers = true;
def.m_bAllowThemeItems = false;
def.m_bAllowThemeTitle = false;
def.m_bAllowExplanation = false;
def.m_bExportOnChange = true;
Profile *pProfile = PROFILEMAN->GetLocalProfile( GAMESTATE->m_sEditLocalProfileID ); Profile *pProfile = PROFILEMAN->GetLocalProfile( GAMESTATE->m_sEditLocalProfileID );
ASSERT( pProfile ); ASSERT( pProfile );
{ {
vHands.push_back( OptionRowHandlerUtil::MakeNull() );
OptionRowDefinition &def = vHands.back()->m_Def;
def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
def.m_bOneChoiceForAllPlayers = true;
def.m_bAllowThemeItems = false;
def.m_bAllowThemeTitle = false;
def.m_bAllowExplanation = false;
def.m_bExportOnChange = true;
def.m_sName = "Character"; def.m_sName = "Character";
def.m_vsChoices.clear(); def.m_vsChoices.clear();
vector<Character*> vpCharacters; vector<Character*> vpCharacters;
@@ -49,7 +50,6 @@ void ScreenOptionsEditProfile::BeginScreen()
FOREACH_CONST( Character*, vpCharacters, c ) FOREACH_CONST( Character*, vpCharacters, c )
def.m_vsChoices.push_back( (*c)->GetDisplayName() ); def.m_vsChoices.push_back( (*c)->GetDisplayName() );
vDefs.push_back( def ); vDefs.push_back( def );
vHands.push_back( NULL );
} }
InitMenu( vDefs, vHands ); InitMenu( vDefs, vHands );
+8 -3
View File
@@ -7,6 +7,7 @@
#include "ScreenManager.h" #include "ScreenManager.h"
#include "ScreenPrompt.h" #include "ScreenPrompt.h"
#include "LocalizedString.h" #include "LocalizedString.h"
#include "OptionRowHandler.h"
REGISTER_SCREEN_CLASS( ScreenOptionsMemoryCard ); REGISTER_SCREEN_CLASS( ScreenOptionsMemoryCard );
@@ -15,6 +16,8 @@ void ScreenOptionsMemoryCard::Init()
{ {
ScreenOptions::Init(); ScreenOptions::Init();
vector<OptionRowHandler*> vHands;
FOREACH_CONST( UsbStorageDevice, MEMCARDMAN->GetStorageDevices(), iter ) FOREACH_CONST( UsbStorageDevice, MEMCARDMAN->GetStorageDevices(), iter )
{ {
// TODO: Make these string themable // TODO: Make these string themable
@@ -33,8 +36,12 @@ void ScreenOptionsMemoryCard::Init()
else else
vs.push_back( ssprintf("%dMB",iter->iVolumeSizeMB) ); vs.push_back( ssprintf("%dMB",iter->iVolumeSizeMB) );
vHands.push_back( OptionRowHandlerUtil::MakeNull() );
OptionRowDefinition &def = vHands.back()->m_Def;
CString sDescription = join(", ", vs); CString sDescription = join(", ", vs);
OptionRowDefinition def( sDescription, true, "" ); def.m_sName = sDescription;
def.m_vsChoices.push_back( "" );
def.m_sExplanationName = "Memory Card"; def.m_sExplanationName = "Memory Card";
def.m_bAllowThemeTitle = false; def.m_bAllowThemeTitle = false;
def.m_bOneChoiceForAllPlayers = true; def.m_bOneChoiceForAllPlayers = true;
@@ -47,8 +54,6 @@ void ScreenOptionsMemoryCard::Init()
m_vDefs.push_back( def ); m_vDefs.push_back( def );
} }
vector<OptionRowHandler*> vHands( m_vDefs.size(), NULL );
InitMenu( m_vDefs, vHands ); InitMenu( m_vDefs, vHands );
} }
+19 -20
View File
@@ -14,44 +14,43 @@
#include "ScreenTextEntry.h" #include "ScreenTextEntry.h"
#include "Profile.h" #include "Profile.h"
#include "LocalizedString.h" #include "LocalizedString.h"
#include "OptionRowHandler.h"
REGISTER_SCREEN_CLASS(ScreenSMOnlineLogin); REGISTER_SCREEN_CLASS(ScreenSMOnlineLogin);
AutoScreenMessage( SM_SMOnlinePack ) AutoScreenMessage( SM_SMOnlinePack )
AutoScreenMessage( SM_PasswordDone ) AutoScreenMessage( SM_PasswordDone )
OptionRowDefinition g_ProfileLine[1] = {
OptionRowDefinition("Profile",false)
};
static LocalizedString DEFINE_A_PROFILE( "ScreenSMOnlineLogin", "You must define a Profile." ); static LocalizedString DEFINE_A_PROFILE( "ScreenSMOnlineLogin", "You must define a Profile." );
void ScreenSMOnlineLogin::Init() void ScreenSMOnlineLogin::Init()
{ {
ScreenOptions::Init(); ScreenOptions::Init();
m_iPlayer = 0; m_iPlayer = 0;
g_ProfileLine[0].m_vsChoices.clear(); vector<OptionRowDefinition> vDefs;
PROFILEMAN->GetLocalProfileDisplayNames( g_ProfileLine[0].m_vsChoices ); vector<OptionRowHandler*> vHands;
vHands.push_back( OptionRowHandlerUtil::MakeNull() );
if( g_ProfileLine[0].m_vsChoices.empty() ) OptionRowDefinition &def = vHands.back()->m_Def;
def.m_sName = "Profile";
def.m_bOneChoiceForAllPlayers = false;
def.m_bAllowThemeItems = false;
def.m_vEnabledForPlayers.clear();
FOREACH_PlayerNumber( pn )
def.m_vEnabledForPlayers.insert( pn );
def.m_vsChoices.clear();
PROFILEMAN->GetLocalProfileDisplayNames( def.m_vsChoices );
if( def.m_vsChoices.empty() )
{ {
SCREENMAN->SystemMessage( DEFINE_A_PROFILE ); SCREENMAN->SystemMessage( DEFINE_A_PROFILE );
SCREENMAN->SetNewScreen("ScreenProfileOptions"); SCREENMAN->SetNewScreen("ScreenProfileOptions");
} }
else
{
FOREACH_PlayerNumber( pn )
g_ProfileLine[0].m_vEnabledForPlayers.insert( pn );
g_ProfileLine[0].m_bAllowThemeItems = false; vDefs.push_back( def );
vector<OptionRowDefinition> vDefs( &g_ProfileLine[0], &g_ProfileLine[ARRAYSIZE(g_ProfileLine)] );
vector<OptionRowHandler*> vHands( vDefs.size(), NULL );
InitMenu( vDefs, vHands ); InitMenu( vDefs, vHands );
SOUND->PlayMusic( THEME->GetPathS("ScreenMachineOptions", "music")); SOUND->PlayMusic( THEME->GetPathS("ScreenMachineOptions", "music"));
OptionRow &row = *m_pRows.back(); OptionRow &row = *m_pRows.back();
row.SetExitText("Login"); row.SetExitText("Login");
}
} }
void ScreenSMOnlineLogin::ImportOptions( int iRow, const vector<PlayerNumber> &vpns ) void ScreenSMOnlineLogin::ImportOptions( int iRow, const vector<PlayerNumber> &vpns )