Allow custom format strings for the editor.

The number of notes have been formatted differently as an example.
This commit is contained in:
Jason Felds
2011-02-22 00:32:21 -05:00
parent 574da5c63b
commit 2787054444
2 changed files with 65 additions and 21 deletions
+43 -21
View File
@@ -1030,6 +1030,28 @@ static LocalizedString ROLLS("ScreenEdit", "Rolls");
static LocalizedString BEAT_0_OFFSET("ScreenEdit", "Beat 0 offset");
static LocalizedString PREVIEW_START("ScreenEdit", "Preview Start");
static LocalizedString PREVIEW_LENGTH("ScreenEdit", "Preview Length");
static ThemeMetric<RString> CURRENT_BEAT_FORMAT("ScreenEdit", "CurrentBeatFormat");
static ThemeMetric<RString> CURRENT_SECOND_FORMAT("ScreenEdit", "CurrentSecondFormat");
static ThemeMetric<RString> SNAP_TO_FORMAT("ScreenEdit", "SnapToFormat");
static ThemeMetric<RString> SELECTION_BEAT_BEGIN_FORMAT("ScreenEdit", "SelectionBeatBeginFormat");
static ThemeMetric<RString> SELECTION_BEAT_UNFINISHED_FORMAT("ScreenEdit", "SelectionBeatUnfinishedFormat");
static ThemeMetric<RString> SELECTION_BEAT_END_FORMAT("ScreenEdit", "SelectionBeatEndFormat");
static ThemeMetric<RString> DIFFICULTY_FORMAT("ScreenEdit", "DifficultyFormat");
static ThemeMetric<RString> ROUTINE_PLAYER_FORMAT("ScreenEdit", "RoutinePlayerFormat");
static ThemeMetric<RString> DESCRIPTION_FORMAT("ScreenEdit", "DescriptionFormat");
static ThemeMetric<RString> CHART_STYLE_FORMAT("ScreenEdit", "ChartStyleFormat");
static ThemeMetric<RString> MAIN_TITLE_FORMAT("ScreenEdit", "MainTitleFormat");
static ThemeMetric<RString> SUBTITLE_FORMAT("ScreenEdit", "SubtitleFormat");
static ThemeMetric<RString> NUM_STEPS_FORMAT("ScreenEdit", "NumStepsFormat");
static ThemeMetric<RString> NUM_JUMPS_FORMAT("ScreenEdit", "NumJumpsFormat");
static ThemeMetric<RString> NUM_HOLDS_FORMAT("ScreenEdit", "NumHoldsFormat");
static ThemeMetric<RString> NUM_MINES_FORMAT("ScreenEdit", "NumMinesFormat");
static ThemeMetric<RString> NUM_HANDS_FORMAT("ScreenEdit", "NumHandsFormat");
static ThemeMetric<RString> NUM_ROLLS_FORMAT("ScreenEdit", "NumRollsFormat");
static ThemeMetric<RString> BEAT_0_OFFSET_FORMAT("ScreenEdit", "Beat0OffsetFormat");
static ThemeMetric<RString> PREVIEW_START_FORMAT("ScreenEdit", "PreviewStartFormat");
static ThemeMetric<RString> PREVIEW_LENGTH_FORMAT("ScreenEdit", "PreviewLengthFormat");
void ScreenEdit::UpdateTextInfo()
{
if( m_pSteps == NULL )
@@ -1047,8 +1069,8 @@ void ScreenEdit::UpdateTextInfo()
RString sNoteType = ssprintf( NOTES.GetValue(), NoteTypeToLocalizedString(m_SnapDisplay.GetNoteType()).c_str() );
RString sText;
sText += ssprintf( "%s:\n %.5f\n", CURRENT_BEAT.GetValue().c_str(), GAMESTATE->m_fSongBeat );
sText += ssprintf( "%s:\n %.5f\n", CURRENT_SECOND.GetValue().c_str(), m_pSong->GetElapsedTimeFromBeat(GAMESTATE->m_fSongBeat) );
sText += ssprintf( CURRENT_BEAT_FORMAT.GetValue(), CURRENT_BEAT.GetValue().c_str(), GAMESTATE->m_fSongBeat );
sText += ssprintf( CURRENT_SECOND_FORMAT.GetValue(), CURRENT_SECOND.GetValue().c_str(), m_pSong->GetElapsedTimeFromBeat(GAMESTATE->m_fSongBeat) );
switch( EDIT_MODE.GetValue() )
{
DEFAULT_FAIL( EDIT_MODE.GetValue() );
@@ -1057,18 +1079,18 @@ void ScreenEdit::UpdateTextInfo()
case EditMode_CourseMods:
case EditMode_Home:
case EditMode_Full:
sText += ssprintf( "%s:\n %s\n", SNAP_TO.GetValue().c_str(), sNoteType.c_str() );
sText += ssprintf( SNAP_TO_FORMAT.GetValue(), SNAP_TO.GetValue().c_str(), sNoteType.c_str() );
break;
}
if( m_NoteFieldEdit.m_iBeginMarker != -1 )
{
sText += ssprintf( "%s:\n %.5f", SELECTION_BEAT.GetValue().c_str(), NoteRowToBeat(m_NoteFieldEdit.m_iBeginMarker) );
sText += ssprintf( SELECTION_BEAT_BEGIN_FORMAT.GetValue(), SELECTION_BEAT.GetValue().c_str(), NoteRowToBeat(m_NoteFieldEdit.m_iBeginMarker) );
if( m_NoteFieldEdit.m_iEndMarker != -1 )
sText += ssprintf( "-%.5f\n", NoteRowToBeat(m_NoteFieldEdit.m_iEndMarker) );
sText += ssprintf( SELECTION_BEAT_END_FORMAT.GetValue(), NoteRowToBeat(m_NoteFieldEdit.m_iEndMarker) );
else
sText += " ...\n";
sText += SELECTION_BEAT_UNFINISHED_FORMAT;
}
switch( EDIT_MODE.GetValue() )
@@ -1079,22 +1101,22 @@ void ScreenEdit::UpdateTextInfo()
case EditMode_Home:
break;
case EditMode_Full:
sText += ssprintf( "%s:\n %s\n", DIFFICULTY.GetValue().c_str(), DifficultyToString( m_pSteps->GetDifficulty() ).c_str() );
sText += ssprintf( DIFFICULTY_FORMAT.GetValue(), DIFFICULTY.GetValue().c_str(), DifficultyToString( m_pSteps->GetDifficulty() ).c_str() );
if ( m_InputPlayerNumber != PLAYER_INVALID )
sText += ssprintf( "%s:\n %d\n", ROUTINE_PLAYER.GetValue().c_str(), m_InputPlayerNumber + 1 );
sText += ssprintf( "%s:\n %s\n", DESCRIPTION.GetValue().c_str(), m_pSteps->GetDescription().c_str() );
sText += ssprintf( "%s:\n %s\n", CHART_STYLE.GetValue().c_str(), m_pSteps->GetChartStyle().c_str() );
sText += ssprintf( "%s:\n %s\n", MAIN_TITLE.GetValue().c_str(), m_pSong->m_sMainTitle.c_str() );
sText += ssprintf( ROUTINE_PLAYER_FORMAT.GetValue(), ROUTINE_PLAYER.GetValue().c_str(), m_InputPlayerNumber + 1 );
sText += ssprintf( DESCRIPTION_FORMAT.GetValue(), DESCRIPTION.GetValue().c_str(), m_pSteps->GetDescription().c_str() );
sText += ssprintf( CHART_STYLE_FORMAT.GetValue(), CHART_STYLE.GetValue().c_str(), m_pSteps->GetChartStyle().c_str() );
sText += ssprintf( MAIN_TITLE_FORMAT.GetValue(), MAIN_TITLE.GetValue().c_str(), m_pSong->m_sMainTitle.c_str() );
if( m_pSong->m_sSubTitle.size() )
sText += ssprintf( "%s:\n %s\n", SUBTITLE.GetValue().c_str(), m_pSong->m_sSubTitle.c_str() );
sText += ssprintf( SUBTITLE_FORMAT.GetValue(), SUBTITLE.GetValue().c_str(), m_pSong->m_sSubTitle.c_str() );
break;
}
sText += ssprintf( "%s:\n %d\n", TAP_STEPS.GetValue().c_str(), m_NoteDataEdit.GetNumTapNotes() );
sText += ssprintf( "%s:\n %d\n", JUMPS.GetValue().c_str(), m_NoteDataEdit.GetNumJumps() );
sText += ssprintf( "%s:\n %d\n", HANDS.GetValue().c_str(), m_NoteDataEdit.GetNumHands() );
sText += ssprintf( "%s:\n %d\n", HOLDS.GetValue().c_str(), m_NoteDataEdit.GetNumHoldNotes() );
sText += ssprintf( "%s:\n %d\n", MINES.GetValue().c_str(), m_NoteDataEdit.GetNumMines() );
sText += ssprintf( "%s:\n %d\n", ROLLS.GetValue().c_str(), m_NoteDataEdit.GetNumRolls() );
sText += ssprintf( NUM_STEPS_FORMAT.GetValue(), TAP_STEPS.GetValue().c_str(), m_NoteDataEdit.GetNumTapNotes() );
sText += ssprintf( NUM_JUMPS_FORMAT.GetValue(), JUMPS.GetValue().c_str(), m_NoteDataEdit.GetNumJumps() );
sText += ssprintf( NUM_HANDS_FORMAT.GetValue(), HANDS.GetValue().c_str(), m_NoteDataEdit.GetNumHands() );
sText += ssprintf( NUM_HOLDS_FORMAT.GetValue(), HOLDS.GetValue().c_str(), m_NoteDataEdit.GetNumHoldNotes() );
sText += ssprintf( NUM_MINES_FORMAT.GetValue(), MINES.GetValue().c_str(), m_NoteDataEdit.GetNumMines() );
sText += ssprintf( NUM_ROLLS_FORMAT.GetValue(), ROLLS.GetValue().c_str(), m_NoteDataEdit.GetNumRolls() );
switch( EDIT_MODE.GetValue() )
{
DEFAULT_FAIL( EDIT_MODE.GetValue() );
@@ -1103,9 +1125,9 @@ void ScreenEdit::UpdateTextInfo()
case EditMode_Home:
break;
case EditMode_Full:
sText += ssprintf( "%s:\n %.5f secs\n", BEAT_0_OFFSET.GetValue().c_str(), m_pSong->m_Timing.m_fBeat0OffsetInSeconds );
sText += ssprintf( "%s:\n %.5f secs\n", PREVIEW_START.GetValue().c_str(), m_pSong->m_fMusicSampleStartSeconds );
sText += ssprintf( "%s:\n %.5f secs\n", PREVIEW_LENGTH.GetValue().c_str(), m_pSong->m_fMusicSampleLengthSeconds );
sText += ssprintf( BEAT_0_OFFSET_FORMAT.GetValue(), BEAT_0_OFFSET.GetValue().c_str(), m_pSong->m_Timing.m_fBeat0OffsetInSeconds );
sText += ssprintf( PREVIEW_START_FORMAT.GetValue(), PREVIEW_START.GetValue().c_str(), m_pSong->m_fMusicSampleStartSeconds );
sText += ssprintf( PREVIEW_LENGTH_FORMAT.GetValue(), PREVIEW_LENGTH.GetValue().c_str(), m_pSong->m_fMusicSampleLengthSeconds );
break;
}