polish
This commit is contained in:
@@ -548,7 +548,7 @@ bool SMLoader::LoadEditFromMsd( const MsdFile &msd, CString sEditFilePath, Profi
|
||||
|
||||
pNewNotes->SetLoadedFromProfile( slot );
|
||||
pNewNotes->SetDifficulty( DIFFICULTY_EDIT );
|
||||
|
||||
pNewNotes->SetFilename( sEditFilePath );
|
||||
|
||||
if( pSong->IsEditAlreadyLoaded(pNewNotes) )
|
||||
{
|
||||
|
||||
@@ -258,7 +258,7 @@ void NotesWriterSM::GetEditFileContents( const Song *pSong, const Steps *pSteps,
|
||||
CString NotesWriterSM::GetEditFileName( const Song *pSong, const Steps *pSteps )
|
||||
{
|
||||
// guaranteed to be a unique name
|
||||
return pSong->GetTranslitFullTitle() + " - " + pSteps->GetDescription();
|
||||
return pSong->GetTranslitFullTitle() + " - " + pSteps->GetDescription() + ".edit";
|
||||
}
|
||||
|
||||
bool NotesWriterSM::WriteEditFileToMachine( const Song *pSong, Steps *pSteps )
|
||||
@@ -284,6 +284,8 @@ bool NotesWriterSM::WriteEditFileToMachine( const Song *pSong, Steps *pSteps )
|
||||
|
||||
int flags = RageFile::WRITE | RageFile::SLOW_FLUSH;
|
||||
|
||||
// TODO: Check to make sure that we're not clobering an existing file before opening.
|
||||
|
||||
RageFile f;
|
||||
if( !f.Open( sPath, flags ) )
|
||||
{
|
||||
|
||||
+14
-14
@@ -161,7 +161,7 @@ void OptionRowType::Load( const CString &sType )
|
||||
void OptionRow::LoadNormal( const OptionRowDefinition &def, OptionRowHandler *pHand, bool bFirstItemGoesDown )
|
||||
{
|
||||
m_RowDef = def;
|
||||
m_RowType = OptionRow::ROW_NORMAL;
|
||||
m_RowType = OptionRow::RowType_Normal;
|
||||
m_pHand = pHand;
|
||||
m_bFirstItemGoesDown = bFirstItemGoesDown;
|
||||
|
||||
@@ -261,7 +261,7 @@ void OptionRow::InitText()
|
||||
{
|
||||
switch( m_RowType )
|
||||
{
|
||||
case ROW_NORMAL:
|
||||
case RowType_Normal:
|
||||
FOREACH_PlayerNumber( p )
|
||||
{
|
||||
m_OptionIcons[p] = new OptionIcon( m_pParentType->m_OptionIcon );
|
||||
@@ -274,7 +274,7 @@ void OptionRow::InitText()
|
||||
SetOptionIcon( p, "", gc );
|
||||
}
|
||||
break;
|
||||
case ROW_EXIT:
|
||||
case RowType_Exit:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -344,7 +344,7 @@ void OptionRow::InitText()
|
||||
GetWidthXY( p, 0, iWidth, iX, iY );
|
||||
ul->SetX( float(iX) );
|
||||
ul->SetWidth( float(iWidth) );
|
||||
if( GetRowType() == OptionRow::ROW_EXIT )
|
||||
if( GetRowType() == OptionRow::RowType_Exit )
|
||||
ul->SetHidden( true );
|
||||
}
|
||||
}
|
||||
@@ -400,7 +400,7 @@ void OptionRow::InitText()
|
||||
|
||||
switch( GetRowType() )
|
||||
{
|
||||
case OptionRow::ROW_NORMAL:
|
||||
case OptionRow::RowType_Normal:
|
||||
m_textTitle->SetText( GetRowTitle() );
|
||||
m_textTitle->SetX( m_pParentType->TITLE_X );
|
||||
m_textTitle->RunCommands( m_pParentType->TITLE_ON_COMMAND );
|
||||
@@ -408,7 +408,7 @@ void OptionRow::InitText()
|
||||
m_sprBullet->SetX( m_pParentType->BULLET_X );
|
||||
m_sprBullet->RunCommands( m_pParentType->BULLET_ON_COMMAND );
|
||||
break;
|
||||
case OptionRow::ROW_EXIT:
|
||||
case OptionRow::RowType_Exit:
|
||||
m_textTitle->SetHidden( true );
|
||||
m_sprBullet->SetHidden( true );
|
||||
break;
|
||||
@@ -429,7 +429,7 @@ void OptionRow::AfterImportOptions()
|
||||
!m_RowDef.m_bOneChoiceForAllPlayers )
|
||||
m_textItems[p]->SetHidden( !GAMESTATE->IsHumanPlayer(p) );
|
||||
|
||||
if( m_RowType != OptionRow::ROW_EXIT )
|
||||
if( m_RowType != OptionRow::RowType_Exit )
|
||||
{
|
||||
for( unsigned c=0; c<m_Underline[p].size(); c++ )
|
||||
m_Underline[p][c]->SetHidden( !GAMESTATE->IsHumanPlayer(p) );
|
||||
@@ -490,7 +490,7 @@ void OptionRow::AfterImportOptions()
|
||||
|
||||
void OptionRow::LoadExit()
|
||||
{
|
||||
m_RowType = OptionRow::ROW_EXIT;
|
||||
m_RowType = OptionRow::RowType_Exit;
|
||||
m_RowDef.m_sName = EXIT_NAME;
|
||||
m_RowDef.m_vsChoices.push_back( "Exit" );
|
||||
m_RowDef.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
||||
@@ -506,7 +506,7 @@ void OptionRow::LoadExit()
|
||||
|
||||
void OptionRow::PositionUnderlines( PlayerNumber pn )
|
||||
{
|
||||
if( m_RowType == ROW_EXIT )
|
||||
if( m_RowType == RowType_Exit )
|
||||
return;
|
||||
|
||||
vector<OptionsCursor*> &vpUnderlines = m_Underline[pn];
|
||||
@@ -543,7 +543,7 @@ void OptionRow::PositionUnderlines( PlayerNumber pn )
|
||||
|
||||
void OptionRow::PositionIcons()
|
||||
{
|
||||
if( m_RowType == OptionRow::ROW_EXIT )
|
||||
if( m_RowType == OptionRow::RowType_Exit )
|
||||
return;
|
||||
|
||||
FOREACH_HumanPlayer( p ) // foreach player
|
||||
@@ -708,7 +708,7 @@ void OptionRow::UpdateEnabledDisabled()
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
if( m_RowType == OptionRow::ROW_EXIT )
|
||||
if( m_RowType == OptionRow::RowType_Exit )
|
||||
{
|
||||
if( bThisRowHasFocusByAll )
|
||||
m_textItems[0]->SetEffectDiffuseShift( 1.0f, m_pParentType->COLOR_SELECTED, m_pParentType->COLOR_NOT_SELECTED );
|
||||
@@ -748,7 +748,7 @@ void OptionRow::SetOptionIcon( PlayerNumber pn, const CString &sText, GameComman
|
||||
|
||||
BitmapText &OptionRow::GetTextItemForRow( PlayerNumber pn, int iChoiceOnRow )
|
||||
{
|
||||
if( m_RowType == OptionRow::ROW_EXIT )
|
||||
if( m_RowType == OptionRow::RowType_Exit )
|
||||
return *m_textItems[0];
|
||||
|
||||
bool bOneChoice = m_RowDef.m_bOneChoiceForAllPlayers;
|
||||
@@ -869,7 +869,7 @@ void OptionRow::Reload( const OptionRowDefinition &def )
|
||||
{
|
||||
switch( GetRowType() )
|
||||
{
|
||||
case OptionRow::ROW_NORMAL:
|
||||
case OptionRow::RowType_Normal:
|
||||
{
|
||||
vector<PlayerNumber> vpns;
|
||||
FOREACH_HumanPlayer( p )
|
||||
@@ -930,7 +930,7 @@ void OptionRow::Reload( const OptionRowDefinition &def )
|
||||
PositionUnderlines( p );
|
||||
}
|
||||
break;
|
||||
case OptionRow::ROW_EXIT:
|
||||
case OptionRow::RowType_Exit:
|
||||
// nothing to do
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -180,8 +180,8 @@ public:
|
||||
|
||||
enum RowType
|
||||
{
|
||||
ROW_NORMAL,
|
||||
ROW_EXIT
|
||||
RowType_Normal,
|
||||
RowType_Exit
|
||||
};
|
||||
const OptionRowDefinition &GetRowDef() const { return m_RowDef; }
|
||||
OptionRowDefinition &GetRowDef() { return m_RowDef; }
|
||||
|
||||
@@ -433,7 +433,7 @@ void ScreenOptions::RefreshIcons( int iRow, PlayerNumber pn )
|
||||
{
|
||||
OptionRow &row = *m_pRows[iRow];
|
||||
|
||||
if( row.GetRowType() == OptionRow::ROW_EXIT )
|
||||
if( row.GetRowType() == OptionRow::RowType_Exit )
|
||||
return; // skip
|
||||
|
||||
const OptionRowDefinition &def = row.GetRowDef();
|
||||
@@ -533,7 +533,7 @@ void ScreenOptions::TweenCursor( PlayerNumber pn )
|
||||
if( GAMESTATE->IsHumanPlayer(pn) )
|
||||
{
|
||||
COMMAND( m_sprLineHighlight[pn], "Change" );
|
||||
if( row.GetRowType() == OptionRow::ROW_EXIT )
|
||||
if( row.GetRowType() == OptionRow::RowType_Exit )
|
||||
COMMAND( m_sprLineHighlight[pn], "ChangeToExit" );
|
||||
m_sprLineHighlight[pn]->SetY( (float)iY );
|
||||
}
|
||||
@@ -658,7 +658,7 @@ void ScreenOptions::PositionRows()
|
||||
vector<OptionRow*> Rows( m_pRows );
|
||||
OptionRow *ExitRow = NULL;
|
||||
|
||||
if( (bool)SEPARATE_EXIT_ROW && !Rows.empty() && Rows.back()->GetRowType() == OptionRow::ROW_EXIT )
|
||||
if( (bool)SEPARATE_EXIT_ROW && !Rows.empty() && Rows.back()->GetRowType() == OptionRow::RowType_Exit )
|
||||
{
|
||||
ExitRow = &*Rows.back();
|
||||
|
||||
@@ -785,7 +785,7 @@ void ScreenOptions::AfterChangeValueOrRow( PlayerNumber pn )
|
||||
|
||||
|
||||
/* If the last row is EXIT, and is hidden, then show MORE. */
|
||||
const bool ShowMore = m_pRows.back()->GetRowType() == OptionRow::ROW_EXIT && m_pRows.back()->GetRowHidden();
|
||||
const bool ShowMore = m_pRows.back()->GetRowType() == OptionRow::RowType_Exit && m_pRows.back()->GetRowHidden();
|
||||
if( m_bMoreShown != ShowMore )
|
||||
{
|
||||
m_bMoreShown = ShowMore;
|
||||
@@ -800,7 +800,7 @@ void ScreenOptions::AfterChangeValueOrRow( PlayerNumber pn )
|
||||
|
||||
int iCurrentRow = m_iCurrentRow[pn];
|
||||
OptionRow &row = *m_pRows[iCurrentRow];
|
||||
const bool ExitSelected = row.GetRowType() == OptionRow::ROW_EXIT;
|
||||
const bool ExitSelected = row.GetRowType() == OptionRow::RowType_Exit;
|
||||
if( p == pn || GAMESTATE->GetNumHumanPlayers() == 1 )
|
||||
{
|
||||
if( m_bWasOnExit[p] != ExitSelected )
|
||||
|
||||
@@ -4,16 +4,16 @@
|
||||
#include "RageLog.h"
|
||||
#include "GameState.h"
|
||||
#include "SongManager.h"
|
||||
//#include "CommonMetrics.h"
|
||||
#include "ScreenTextEntry.h"
|
||||
#include "ScreenPrompt.h"
|
||||
//#include "ScreenMiniMenu.h"
|
||||
#include "GameManager.h"
|
||||
#include "Steps.h"
|
||||
#include "ScreenMiniMenu.h"
|
||||
#include "RageUtil.h"
|
||||
#include "RageFileManager.h"
|
||||
|
||||
AutoScreenMessage( SM_BackFromRename )
|
||||
AutoScreenMessage( SM_BackFromDelete )
|
||||
AutoScreenMessage( SM_BackFromContextMenu )
|
||||
|
||||
enum StepsEditAction
|
||||
@@ -36,10 +36,13 @@ static MenuDef g_TempMenu(
|
||||
);
|
||||
|
||||
|
||||
static bool ValidateEditStepsName( const CString &sAnswer, CString &sErrorOut )
|
||||
static bool ValidateEditStepsDescription( const CString &sAnswer, CString &sErrorOut )
|
||||
{
|
||||
if( sAnswer.empty() )
|
||||
{
|
||||
sErrorOut = "Description cannot be blank";
|
||||
return false;
|
||||
}
|
||||
|
||||
// Steps name must be unique
|
||||
vector<Steps*> v;
|
||||
@@ -50,7 +53,10 @@ static bool ValidateEditStepsName( const CString &sAnswer, CString &sErrorOut )
|
||||
continue; // don't comepare name against ourself
|
||||
|
||||
if( (*s)->GetDescription() == sAnswer )
|
||||
{
|
||||
sErrorOut = "There is already another edit steps with this description. Each description must be unique.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -75,12 +81,12 @@ void ScreenOptionsManageEditSteps::BeginScreen()
|
||||
|
||||
OptionRowDefinition def;
|
||||
def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
||||
def.m_bOneChoiceForAllPlayers = true;
|
||||
|
||||
int iIndex = 0;
|
||||
|
||||
{
|
||||
def.m_sName = "Create New Edit Steps";
|
||||
def.m_bAllowThemeTitle = false;
|
||||
def.m_sExplanationName = "Create New Edit Steps";
|
||||
def.m_vsChoices.clear();
|
||||
def.m_vsChoices.push_back( "" );
|
||||
@@ -93,12 +99,13 @@ void ScreenOptionsManageEditSteps::BeginScreen()
|
||||
|
||||
FOREACH_CONST( Steps*, m_vpSteps, s )
|
||||
{
|
||||
CString sType = GAMEMAN->StepsTypeToThemedString( (*s)->m_StepsType );
|
||||
def.m_sName = (*s)->GetDescription();
|
||||
def.m_bAllowThemeTitle = false; // not themable
|
||||
def.m_sExplanationName = "Edit Steps";
|
||||
def.m_bAllowThemeItems = false;
|
||||
def.m_vsChoices.clear();
|
||||
CString sType = GAMEMAN->StepsTypeToThemedString( (*s)->m_StepsType );
|
||||
def.m_vsChoices.push_back( sType );
|
||||
def.m_bAllowThemeItems = false; // already themed
|
||||
vDefs.push_back( def );
|
||||
vHands.push_back( NULL );
|
||||
iIndex++;
|
||||
@@ -124,33 +131,25 @@ void ScreenOptionsManageEditSteps::BeginScreen()
|
||||
|
||||
void ScreenOptionsManageEditSteps::HandleScreenMessage( const ScreenMessage SM )
|
||||
{
|
||||
if( SM == SM_Success )
|
||||
{
|
||||
LOG->Trace( "Delete successful; deleting Steps from memory" );
|
||||
|
||||
SONGMAN->DeleteSteps( GetStepsWithFocus() );
|
||||
SCREENMAN->SetNewScreen( this->m_sName ); // reload
|
||||
}
|
||||
else if( SM == SM_Failure )
|
||||
{
|
||||
LOG->Trace( "Delete failed; not deleting Steps" );
|
||||
}
|
||||
else if( SM == SM_GoToNextScreen )
|
||||
if( SM == SM_GoToNextScreen )
|
||||
{
|
||||
int iCurRow = m_iCurrentRow[PLAYER_1];
|
||||
|
||||
if( iCurRow == 0 ) // "create new"
|
||||
{
|
||||
SCREENMAN->SetNewScreen( "ScreenEditMenuNew" );
|
||||
return; // don't call base
|
||||
// do base behavior
|
||||
}
|
||||
else if( iCurRow == (int)m_pRows.size()-1 ) // "done"
|
||||
else if( m_pRows[iCurRow]->GetRowType() == OptionRow::RowType_Exit )
|
||||
{
|
||||
this->HandleScreenMessage( SM_GoToPrevScreen );
|
||||
return; // don't call base
|
||||
}
|
||||
else // a Steps
|
||||
{
|
||||
Steps *pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
|
||||
ASSERT( pSteps );
|
||||
const Style *pStyle = GAMEMAN->GetEditorStyleForStepsType( pSteps->m_StepsType );
|
||||
GAMESTATE->m_pCurStyle.Set( pStyle );
|
||||
SCREENMAN->SetNewScreen( "ScreenEdit" );
|
||||
return; // don't call base
|
||||
}
|
||||
@@ -166,6 +165,19 @@ void ScreenOptionsManageEditSteps::HandleScreenMessage( const ScreenMessage SM )
|
||||
SCREENMAN->SetNewScreen( this->m_sName ); // reload
|
||||
}
|
||||
}
|
||||
else if( SM == SM_BackFromDelete )
|
||||
{
|
||||
if( !ScreenTextEntry::s_bCancelledLast )
|
||||
{
|
||||
LOG->Trace( "Delete successful; deleting Steps from memory" );
|
||||
|
||||
Steps *pSteps = GetStepsWithFocus();
|
||||
FILEMAN->Remove( pSteps->GetFilename() );
|
||||
SONGMAN->DeleteSteps( pSteps );
|
||||
GAMESTATE->m_pCurSteps[PLAYER_1].Set( NULL );
|
||||
SCREENMAN->SetNewScreen( this->m_sName ); // reload
|
||||
}
|
||||
}
|
||||
else if( SM == SM_BackFromContextMenu )
|
||||
{
|
||||
if( !ScreenMiniMenu::s_bCancelled )
|
||||
@@ -189,12 +201,12 @@ void ScreenOptionsManageEditSteps::HandleScreenMessage( const ScreenMessage SM )
|
||||
"Enter a name for the Steps.",
|
||||
GAMESTATE->m_pCurSteps[PLAYER_1]->GetDescription(),
|
||||
MAX_EDIT_STEPS_DESCRIPTION_LENGTH,
|
||||
ValidateEditStepsName );
|
||||
ValidateEditStepsDescription );
|
||||
}
|
||||
break;
|
||||
case StepsEditAction_Delete:
|
||||
{
|
||||
ScreenPrompt::Prompt( SM_None, "This Steps will be lost permanently.\n\nContinue with delete?", PROMPT_YES_NO, ANSWER_NO );
|
||||
ScreenPrompt::Prompt( SM_BackFromDelete, "This Steps will be lost permanently.\n\nContinue with delete?", PROMPT_YES_NO, ANSWER_NO );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -242,7 +254,7 @@ void ScreenOptionsManageEditSteps::ProcessMenuStart( const InputEventPlus &input
|
||||
}
|
||||
this->BeginFadingOut();
|
||||
}
|
||||
else if( iCurRow == (int)m_pRows.size()-1 ) // "done"
|
||||
else if( m_pRows[iCurRow]->GetRowType() == OptionRow::RowType_Exit )
|
||||
{
|
||||
this->BeginFadingOut();
|
||||
}
|
||||
@@ -276,7 +288,7 @@ Steps *ScreenOptionsManageEditSteps::GetStepsWithFocus() const
|
||||
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber];
|
||||
if( iCurRow == 0 )
|
||||
return NULL;
|
||||
else if( iCurRow == (int)m_pRows.size()-1 ) // "done"
|
||||
else if( m_pRows[iCurRow]->GetRowType() == OptionRow::RowType_Exit )
|
||||
return NULL;
|
||||
|
||||
// a Steps
|
||||
|
||||
@@ -172,7 +172,7 @@ void ScreenOptionsManageProfiles::HandleScreenMessage( const ScreenMessage SM )
|
||||
{
|
||||
int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber];
|
||||
OptionRow &row = *m_pRows[iCurRow];
|
||||
if( row.GetRowType() == OptionRow::ROW_EXIT )
|
||||
if( row.GetRowType() == OptionRow::RowType_Exit )
|
||||
{
|
||||
this->HandleScreenMessage( SM_GoToPrevScreen );
|
||||
return; // don't call base
|
||||
@@ -330,7 +330,7 @@ void ScreenOptionsManageProfiles::ProcessMenuStart( const InputEventPlus &input
|
||||
PROFILE_MAX_DISPLAY_NAME_LENGTH,
|
||||
ValidateLocalProfileName );
|
||||
}
|
||||
else if( row.GetRowType() == OptionRow::ROW_EXIT )
|
||||
else if( row.GetRowType() == OptionRow::RowType_Exit )
|
||||
{
|
||||
this->BeginFadingOut();
|
||||
}
|
||||
@@ -383,7 +383,7 @@ int ScreenOptionsManageProfiles::GetLocalProfileIndexWithFocus() const
|
||||
|
||||
if( SHOW_CREATE_NEW && iCurRow == 0 ) // "create new"
|
||||
return -1;
|
||||
else if( row.GetRowType() == OptionRow::ROW_EXIT )
|
||||
else if( row.GetRowType() == OptionRow::RowType_Exit )
|
||||
return -1;
|
||||
|
||||
// a profile
|
||||
|
||||
@@ -136,7 +136,7 @@ void ScreenOptionsMaster::BeginFadingOut()
|
||||
ASSERT( iCurRow >= 0 && iCurRow < (int)m_pRows.size() );
|
||||
OptionRow &row = *m_pRows[iCurRow];
|
||||
|
||||
if( row.GetRowType() != OptionRow::ROW_EXIT )
|
||||
if( row.GetRowType() != OptionRow::RowType_Exit )
|
||||
{
|
||||
int iChoice = row.GetChoiceInRowWithFocus( GAMESTATE->m_MasterPlayerNumber );
|
||||
if( row.GetFirstItemGoesDown() )
|
||||
|
||||
Reference in New Issue
Block a user