ScreenOptionsReviewWorkout -> ScreenOptionsCourseOverview

This commit is contained in:
Chris Danford
2009-04-11 19:19:03 +00:00
parent 311eace2b6
commit 004df80bf6
7 changed files with 290 additions and 25 deletions
+1 -1
View File
@@ -1241,7 +1241,7 @@ This file will be lost permanently.=This file will be lost permanently.
Continue with delete?=Continue with delete? Continue with delete?=Continue with delete?
Enter a name.=Enter a name. Enter a name.=Enter a name.
[ScreenOptionsReviewWorkout] [ScreenOptionsCourseOverview]
Error saving workout.=Error saving workout. Error saving workout.=Error saving workout.
Workout saved successfully.=Workout saved successfully. Workout saved successfully.=Workout saved successfully.
Enter a name for the workout.=Enter a name for the workout. Enter a name for the workout.=Enter a name for the workout.
+1 -1
View File
@@ -1722,7 +1722,7 @@ Enter a name.=Escribe un nombre para este workout.
Error deleting the file '%s'.=Error al eliminar el archivo de workout "%s". Error deleting the file '%s'.=Error al eliminar el archivo de workout "%s".
This file will be lost permanently.=Este workout se perderá permanentemente. This file will be lost permanently.=Este workout se perderá permanentemente.
[ScreenOptionsReviewWorkout] [ScreenOptionsCourseOverview]
Error saving workout.=Error al guardar el workout. Error saving workout.=Error al guardar el workout.
Workout saved successfully.=Workout guardado con éxito. Workout saved successfully.=Workout guardado con éxito.
Enter a name for the workout.=Escribe un nombre para este workout. Enter a name for the workout.=Escribe un nombre para este workout.
@@ -0,0 +1,212 @@
#include "global.h"
#include "ScreenOptionsCourseOverview.h"
#include "ScreenManager.h"
#include "RageUtil.h"
#include "GameState.h"
#include "OptionRowHandler.h"
#include "ProfileManager.h"
#include "ScreenMiniMenu.h"
#include "LocalizedString.h"
#include "SongManager.h"
#include "SongUtil.h"
#include "ScreenTextEntry.h"
#include "GameManager.h"
#include "Profile.h"
#include "ScreenPrompt.h"
#include "PlayerState.h"
#include "Style.h"
#include "PrefsManager.h"
enum ReviewWorkoutRow
{
ReviewWorkoutRow_Play,
ReviewWorkoutRow_Edit,
ReviewWorkoutRow_Shuffle,
ReviewWorkoutRow_Save,
NUM_ReviewWorkoutRow
};
static const MenuRowDef g_MenuRows[] =
{
MenuRowDef( -1, "Play", true, EditMode_Practice, true, false, 0, NULL ),
MenuRowDef( -1, "Edit Workout", true, EditMode_Practice, true, false, 0, NULL ),
MenuRowDef( -1, "Shuffle", true, EditMode_Practice, true, false, 0, NULL ),
MenuRowDef( -1, "Save", true, EditMode_Practice, true, false, 0, NULL ),
};
REGISTER_SCREEN_CLASS( ScreenOptionsCourseOverview );
AutoScreenMessage( SM_BackFromEnterName )
void ScreenOptionsCourseOverview::Init()
{
if( PREFSMAN->m_iArcadeOptionsNavigation )
SetNavigation( NAV_THREE_KEY_MENU );
ScreenOptions::Init();
m_soundSave.Load( THEME->GetPathS(m_sName,"Save") );
PLAY_SCREEN.Load(m_sName,"PlayScreen");
EDIT_SCREEN.Load(m_sName,"EditScreen");
}
void ScreenOptionsCourseOverview::BeginScreen()
{
vector<OptionRowHandler*> vHands;
FOREACH_ENUM( ReviewWorkoutRow, rowIndex )
{
const MenuRowDef &mr = g_MenuRows[rowIndex];
OptionRowHandler *pHand = OptionRowHandlerUtil::MakeSimple( mr );
vHands.push_back( pHand );
}
ScreenOptions::InitMenu( vHands );
ScreenOptions::BeginScreen();
// clear the current song in case it's set when we back out from gameplay
GAMESTATE->m_pCurSong.Set( NULL );
}
ScreenOptionsCourseOverview::~ScreenOptionsCourseOverview()
{
}
void ScreenOptionsCourseOverview::ImportOptions( int iRow, const vector<PlayerNumber> &vpns )
{
//OptionRow &row = *m_pRows[iRow];
}
void ScreenOptionsCourseOverview::ExportOptions( int iRow, const vector<PlayerNumber> &vpns )
{
OptionRow &row = *m_pRows[iRow];
int iIndex = row.GetOneSharedSelection( true );
RString sValue;
if( iIndex >= 0 )
sValue = row.GetRowDef().m_vsChoices[ iIndex ];
}
static LocalizedString ERROR_SAVING_WORKOUT ( "ScreenOptionsCourseOverview", "Error saving workout." );
static LocalizedString WORKOUT_SAVED ( "ScreenOptionsCourseOverview", "Workout saved successfully." );
void ScreenOptionsCourseOverview::HandleScreenMessage( const ScreenMessage SM )
{
if( SM == SM_GoToNextScreen )
{
int iRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber];
switch( iRow )
{
case ReviewWorkoutRow_Play:
EditCourseUtil::PrepareForPlay();
SCREENMAN->SetNewScreen( PLAY_SCREEN );
return; // handled
case ReviewWorkoutRow_Edit:
SCREENMAN->SetNewScreen( EDIT_SCREEN );
return; // handled
}
}
else if( SM == SM_BackFromEnterName )
{
if( !ScreenTextEntry::s_bCancelledLast )
{
ASSERT( ScreenTextEntry::s_sLastAnswer != "" ); // validate should have assured this
if( EditCourseUtil::RenameAndSave( GAMESTATE->m_pCurCourse, ScreenTextEntry::s_sLastAnswer ) )
{
m_soundSave.Play();
SCREENMAN->SystemMessage( WORKOUT_SAVED );
}
}
}
ScreenOptions::HandleScreenMessage( SM );
}
void ScreenOptionsCourseOverview::AfterChangeValueInRow( int iRow, PlayerNumber pn )
{
ScreenOptions::AfterChangeValueInRow( iRow, pn );
}
static LocalizedString ENTER_WORKOUT_NAME ( "ScreenOptionsCourseOverview", "Enter a name for the workout." );
void ScreenOptionsCourseOverview::ProcessMenuStart( const InputEventPlus &input )
{
if( IsTransitioning() )
return;
int iRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber];
switch( iRow )
{
case ReviewWorkoutRow_Play:
case ReviewWorkoutRow_Edit:
SCREENMAN->PlayStartSound();
this->BeginFadingOut();
return; // handled
case ReviewWorkoutRow_Shuffle:
{
Course *pCourse = GAMESTATE->m_pCurCourse;
random_shuffle( pCourse->m_vEntries.begin(), pCourse->m_vEntries.end() );
Trail *pTrail = pCourse->GetTrailForceRegenCache( GAMESTATE->m_pCurStyle->m_StepsType );
GAMESTATE->m_pCurTrail[PLAYER_1].Set( pTrail );
SCREENMAN->PlayStartSound();
MESSAGEMAN->Broadcast("CurrentCourseChanged");
}
return; // handled
case ReviewWorkoutRow_Save:
{
bool bPromptForName = EditCourseUtil::s_bNewCourseNeedsName;
if( bPromptForName )
{
ScreenTextEntry::TextEntry(
SM_BackFromEnterName,
ENTER_WORKOUT_NAME,
GAMESTATE->m_pCurCourse->GetDisplayFullTitle(),
EditCourseUtil::MAX_NAME_LENGTH,
EditCourseUtil::ValidateEditCourseName );
}
else
{
if( EditCourseUtil::Save( GAMESTATE->m_pCurCourse ) )
{
m_soundSave.Play();
SCREENMAN->SystemMessage( WORKOUT_SAVED );
}
else
{
SCREENMAN->PlayInvalidSound();
SCREENMAN->SystemMessage( ERROR_SAVING_WORKOUT );
}
}
}
return; // handled
}
ScreenOptions::ProcessMenuStart( input );
}
/*
* (c) 2003-2004 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
@@ -0,0 +1,53 @@
#ifndef ScreenOptionsCourseOverview_H
#define ScreenOptionsCourseOverview_H
#include "ScreenOptions.h"
class ScreenOptionsCourseOverview : public ScreenOptions
{
public:
virtual ~ScreenOptionsCourseOverview();
virtual void Init();
virtual void BeginScreen();
protected:
private:
virtual void ImportOptions( int row, const vector<PlayerNumber> &vpns );
virtual void ExportOptions( int row, const vector<PlayerNumber> &vpns );
virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void AfterChangeValueInRow( int iRow, PlayerNumber pn );
virtual void ProcessMenuStart( const InputEventPlus &input );
RageSound m_soundSave;
ThemeMetric<RString> PLAY_SCREEN;
ThemeMetric<RString> EDIT_SCREEN;
};
#endif
/*
* (c) 2003-2004 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+13 -13
View File
@@ -1,6 +1,6 @@
#include "global.h" #include "global.h"
#include "ScreenOptionsReviewWorkout.h" #include "ScreenOptionsCourseOverview.h"
#include "ScreenManager.h" #include "ScreenManager.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "GameState.h" #include "GameState.h"
@@ -35,11 +35,11 @@ static const MenuRowDef g_MenuRows[] =
MenuRowDef( -1, "Save", true, EditMode_Practice, true, false, 0, NULL ), MenuRowDef( -1, "Save", true, EditMode_Practice, true, false, 0, NULL ),
}; };
REGISTER_SCREEN_CLASS( ScreenOptionsReviewWorkout ); REGISTER_SCREEN_CLASS( ScreenOptionsCourseOverview );
AutoScreenMessage( SM_BackFromEnterName ) AutoScreenMessage( SM_BackFromEnterName )
void ScreenOptionsReviewWorkout::Init() void ScreenOptionsCourseOverview::Init()
{ {
if( PREFSMAN->m_iArcadeOptionsNavigation ) if( PREFSMAN->m_iArcadeOptionsNavigation )
SetNavigation( NAV_THREE_KEY_MENU ); SetNavigation( NAV_THREE_KEY_MENU );
@@ -51,7 +51,7 @@ void ScreenOptionsReviewWorkout::Init()
EDIT_SCREEN.Load(m_sName,"EditScreen"); EDIT_SCREEN.Load(m_sName,"EditScreen");
} }
void ScreenOptionsReviewWorkout::BeginScreen() void ScreenOptionsCourseOverview::BeginScreen()
{ {
vector<OptionRowHandler*> vHands; vector<OptionRowHandler*> vHands;
FOREACH_ENUM( ReviewWorkoutRow, rowIndex ) FOREACH_ENUM( ReviewWorkoutRow, rowIndex )
@@ -69,17 +69,17 @@ void ScreenOptionsReviewWorkout::BeginScreen()
GAMESTATE->m_pCurSong.Set( NULL ); GAMESTATE->m_pCurSong.Set( NULL );
} }
ScreenOptionsReviewWorkout::~ScreenOptionsReviewWorkout() ScreenOptionsCourseOverview::~ScreenOptionsCourseOverview()
{ {
} }
void ScreenOptionsReviewWorkout::ImportOptions( int iRow, const vector<PlayerNumber> &vpns ) void ScreenOptionsCourseOverview::ImportOptions( int iRow, const vector<PlayerNumber> &vpns )
{ {
//OptionRow &row = *m_pRows[iRow]; //OptionRow &row = *m_pRows[iRow];
} }
void ScreenOptionsReviewWorkout::ExportOptions( int iRow, const vector<PlayerNumber> &vpns ) void ScreenOptionsCourseOverview::ExportOptions( int iRow, const vector<PlayerNumber> &vpns )
{ {
OptionRow &row = *m_pRows[iRow]; OptionRow &row = *m_pRows[iRow];
int iIndex = row.GetOneSharedSelection( true ); int iIndex = row.GetOneSharedSelection( true );
@@ -88,9 +88,9 @@ void ScreenOptionsReviewWorkout::ExportOptions( int iRow, const vector<PlayerNum
sValue = row.GetRowDef().m_vsChoices[ iIndex ]; sValue = row.GetRowDef().m_vsChoices[ iIndex ];
} }
static LocalizedString ERROR_SAVING_WORKOUT ( "ScreenOptionsReviewWorkout", "Error saving workout." ); static LocalizedString ERROR_SAVING_WORKOUT ( "ScreenOptionsCourseOverview", "Error saving workout." );
static LocalizedString WORKOUT_SAVED ( "ScreenOptionsReviewWorkout", "Workout saved successfully." ); static LocalizedString WORKOUT_SAVED ( "ScreenOptionsCourseOverview", "Workout saved successfully." );
void ScreenOptionsReviewWorkout::HandleScreenMessage( const ScreenMessage SM ) void ScreenOptionsCourseOverview::HandleScreenMessage( const ScreenMessage SM )
{ {
if( SM == SM_GoToNextScreen ) if( SM == SM_GoToNextScreen )
{ {
@@ -123,14 +123,14 @@ void ScreenOptionsReviewWorkout::HandleScreenMessage( const ScreenMessage SM )
ScreenOptions::HandleScreenMessage( SM ); ScreenOptions::HandleScreenMessage( SM );
} }
void ScreenOptionsReviewWorkout::AfterChangeValueInRow( int iRow, PlayerNumber pn ) void ScreenOptionsCourseOverview::AfterChangeValueInRow( int iRow, PlayerNumber pn )
{ {
ScreenOptions::AfterChangeValueInRow( iRow, pn ); ScreenOptions::AfterChangeValueInRow( iRow, pn );
} }
static LocalizedString ENTER_WORKOUT_NAME ( "ScreenOptionsReviewWorkout", "Enter a name for the workout." ); static LocalizedString ENTER_WORKOUT_NAME ( "ScreenOptionsCourseOverview", "Enter a name for the workout." );
void ScreenOptionsReviewWorkout::ProcessMenuStart( const InputEventPlus &input ) void ScreenOptionsCourseOverview::ProcessMenuStart( const InputEventPlus &input )
{ {
if( IsTransitioning() ) if( IsTransitioning() )
return; return;
+4 -4
View File
@@ -1,12 +1,12 @@
#ifndef ScreenOptionsReviewWorkout_H #ifndef ScreenOptionsCourseOverview_H
#define ScreenOptionsReviewWorkout_H #define ScreenOptionsCourseOverview_H
#include "ScreenOptions.h" #include "ScreenOptions.h"
class ScreenOptionsReviewWorkout : public ScreenOptions class ScreenOptionsCourseOverview : public ScreenOptions
{ {
public: public:
virtual ~ScreenOptionsReviewWorkout(); virtual ~ScreenOptionsCourseOverview();
virtual void Init(); virtual void Init();
virtual void BeginScreen(); virtual void BeginScreen();
+6 -6
View File
@@ -442,6 +442,12 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File <File
RelativePath="ScreenOptions.h"> RelativePath="ScreenOptions.h">
</File> </File>
<File
RelativePath=".\ScreenOptionsCourseOverview.cpp">
</File>
<File
RelativePath=".\ScreenOptionsCourseOverview.h">
</File>
<File <File
RelativePath=".\ScreenOptionsEditCourse.cpp"> RelativePath=".\ScreenOptionsEditCourse.cpp">
</File> </File>
@@ -502,12 +508,6 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File <File
RelativePath=".\ScreenOptionsMemoryCard.h"> RelativePath=".\ScreenOptionsMemoryCard.h">
</File> </File>
<File
RelativePath=".\ScreenOptionsReviewWorkout.cpp">
</File>
<File
RelativePath=".\ScreenOptionsReviewWorkout.h">
</File>
<File <File
RelativePath=".\ScreenOptionsToggleSongs.cpp"> RelativePath=".\ScreenOptionsToggleSongs.cpp">
</File> </File>