remove extra zeros from editor textentry

This commit is contained in:
Devin J. Pohly
2012-12-28 16:18:21 -05:00
parent 28e5530357
commit b03b3adf41
+38 -38
View File
@@ -2511,7 +2511,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
if( iAttack >= 0 )
{
const RString sDuration = ssprintf( "%.6f", ce.attacks[iAttack].fSecsRemaining );
const RString sDuration = FloatToString(ce.attacks[iAttack].fSecsRemaining );
g_InsertCourseAttack.rows[remove].bEnabled = true;
if( g_InsertCourseAttack.rows[duration].choices.size() == 9 )
@@ -3653,14 +3653,14 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
{
ScreenTextEntry::TextEntry(SM_BackFromEditingAttackStart,
EDIT_ATTACK_START,
ssprintf("%.5f", attack.fStartSecond),
FloatToString(attack.fStartSecond),
10);
}
else if (option == 1) // adjusting the length of the attack
{
ScreenTextEntry::TextEntry(SM_BackFromEditingAttackLength,
EDIT_ATTACK_LENGTH,
ssprintf("%.5f", attack.fSecsRemaining),
FloatToString(attack.fSecsRemaining),
10);
}
else if (option >= 2 + mods.size()) // adding a new mod
@@ -3732,7 +3732,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
true,
0,
NULL));
g_IndividualAttack.rows[0].SetOneUnthemedChoice(ssprintf("%.5f", attack.fStartSecond));
g_IndividualAttack.rows[0].SetOneUnthemedChoice(FloatToString(attack.fStartSecond));
g_IndividualAttack.rows.push_back(MenuRowDef(1,
"Secs Remaining",
true,
@@ -3741,7 +3741,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
true,
0,
NULL));
g_IndividualAttack.rows[1].SetOneUnthemedChoice(ssprintf("%.5f", attack.fSecsRemaining));
g_IndividualAttack.rows[1].SetOneUnthemedChoice(FloatToString(attack.fSecsRemaining));
vector<RString> mods;
split(attack.sModifiers, ",", mods);
for (unsigned i = 0; i < mods.size(); ++i)
@@ -4218,10 +4218,10 @@ void ScreenEdit::DisplayTimingMenu()
// bool bIsSelecting = ( (m_NoteFieldEdit.m_iEndMarker != -1) && (m_NoteFieldEdit.m_iBeginMarker != -1) );
g_TimingDataInformation.rows[beat_0_offset].SetOneUnthemedChoice( ssprintf("%.6f", pTime.m_fBeat0OffsetInSeconds) );
g_TimingDataInformation.rows[bpm].SetOneUnthemedChoice( ssprintf("%.6f", pTime.GetBPMAtRow( row ) ) );
g_TimingDataInformation.rows[stop].SetOneUnthemedChoice( ssprintf("%.6f", pTime.GetStopAtRow( row ) ) ) ;
g_TimingDataInformation.rows[delay].SetOneUnthemedChoice( ssprintf("%.6f", pTime.GetDelayAtRow( row ) ) );
g_TimingDataInformation.rows[beat_0_offset].SetOneUnthemedChoice( FloatToString(pTime.m_fBeat0OffsetInSeconds) );
g_TimingDataInformation.rows[bpm].SetOneUnthemedChoice( FloatToString(pTime.GetBPMAtRow( row ) ) );
g_TimingDataInformation.rows[stop].SetOneUnthemedChoice( FloatToString(pTime.GetStopAtRow( row ) ) ) ;
g_TimingDataInformation.rows[delay].SetOneUnthemedChoice( FloatToString(pTime.GetDelayAtRow( row ) ) );
g_TimingDataInformation.rows[time_signature].SetOneUnthemedChoice(
ssprintf( "%d / %d",
@@ -4235,15 +4235,15 @@ void ScreenEdit::DisplayTimingMenu()
g_TimingDataInformation.rows[combo].SetOneUnthemedChoice( ssprintf("%d / %d",
pTime.GetComboAtRow( row ),
pTime.GetMissComboAtRow( row ) ) );
g_TimingDataInformation.rows[warp].SetOneUnthemedChoice( ssprintf("%.6f", pTime.GetWarpAtRow( row ) ) );
g_TimingDataInformation.rows[speed_percent].SetOneUnthemedChoice( bHasSpeedOnThisRow ? ssprintf("%.6f", pTime.GetSpeedPercentAtRow( row ) ) : "---" );
g_TimingDataInformation.rows[speed_wait].SetOneUnthemedChoice( bHasSpeedOnThisRow ? ssprintf("%.6f", pTime.GetSpeedWaitAtRow( row ) ) : "---" );
g_TimingDataInformation.rows[warp].SetOneUnthemedChoice( FloatToString(pTime.GetWarpAtRow( row ) ) );
g_TimingDataInformation.rows[speed_percent].SetOneUnthemedChoice( bHasSpeedOnThisRow ? FloatToString(pTime.GetSpeedPercentAtRow( row ) ) : "---" );
g_TimingDataInformation.rows[speed_wait].SetOneUnthemedChoice( bHasSpeedOnThisRow ? FloatToString(pTime.GetSpeedWaitAtRow( row ) ) : "---" );
RString starting = ( pTime.GetSpeedModeAtRow( row ) == 1 ? "Seconds" : "Beats" );
g_TimingDataInformation.rows[speed_mode].SetOneUnthemedChoice( starting.c_str() );
g_TimingDataInformation.rows[scroll].SetOneUnthemedChoice( ssprintf("%.6f", pTime.GetScrollAtRow( row ) ) );
g_TimingDataInformation.rows[fake].SetOneUnthemedChoice( ssprintf("%.6f", pTime.GetFakeAtRow( row ) ) );
g_TimingDataInformation.rows[scroll].SetOneUnthemedChoice( FloatToString(pTime.GetScrollAtRow( row ) ) );
g_TimingDataInformation.rows[fake].SetOneUnthemedChoice( FloatToString(pTime.GetFakeAtRow( row ) ) );
// g_TimingDataInformation.rows[speed_percent].bEnabled = !bIsSelecting;
g_TimingDataInformation.rows[speed_wait].bEnabled = bHasSpeedOnThisRow;
@@ -4347,8 +4347,8 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
g_StepsInformation.rows[step_credit].bEnabled = (EDIT_MODE.GetValue() >= EditMode_Full);
g_StepsInformation.rows[step_credit].SetOneUnthemedChoice( pSteps->GetCredit() );
g_StepsInformation.rows[step_display_bpm].iDefaultChoice = pSteps->GetDisplayBPM();
g_StepsInformation.rows[step_min_bpm].SetOneUnthemedChoice( ssprintf("%.6f", pSteps->GetMinBPM()));
g_StepsInformation.rows[step_max_bpm].SetOneUnthemedChoice( ssprintf("%.6f", pSteps->GetMaxBPM()));
g_StepsInformation.rows[step_min_bpm].SetOneUnthemedChoice( FloatToString(pSteps->GetMinBPM()));
g_StepsInformation.rows[step_max_bpm].SetOneUnthemedChoice( FloatToString(pSteps->GetMaxBPM()));
EditMiniMenu( &g_StepsInformation, SM_BackFromStepsInformation, SM_None );
}
break;
@@ -4488,12 +4488,12 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
g_SongInformation.rows[main_title_transliteration].SetOneUnthemedChoice( pSong->m_sMainTitleTranslit );
g_SongInformation.rows[sub_title_transliteration].SetOneUnthemedChoice( pSong->m_sSubTitleTranslit );
g_SongInformation.rows[artist_transliteration].SetOneUnthemedChoice( pSong->m_sArtistTranslit );
g_SongInformation.rows[last_second_hint].SetOneUnthemedChoice( ssprintf("%.6f", pSong->GetSpecifiedLastSecond()) );
g_SongInformation.rows[preview_start].SetOneUnthemedChoice( ssprintf("%.6f", pSong->m_fMusicSampleStartSeconds) );
g_SongInformation.rows[preview_length].SetOneUnthemedChoice( ssprintf("%.6f", pSong->m_fMusicSampleLengthSeconds) );
g_SongInformation.rows[last_second_hint].SetOneUnthemedChoice( FloatToString(pSong->GetSpecifiedLastSecond()) );
g_SongInformation.rows[preview_start].SetOneUnthemedChoice( FloatToString(pSong->m_fMusicSampleStartSeconds) );
g_SongInformation.rows[preview_length].SetOneUnthemedChoice( FloatToString(pSong->m_fMusicSampleLengthSeconds) );
g_SongInformation.rows[display_bpm].iDefaultChoice = pSong->m_DisplayBPMType;
g_SongInformation.rows[min_bpm].SetOneUnthemedChoice( ssprintf("%.6f", pSong->m_fSpecifiedBPMMin) );
g_SongInformation.rows[max_bpm].SetOneUnthemedChoice( ssprintf("%.6f", pSong->m_fSpecifiedBPMMax) );
g_SongInformation.rows[min_bpm].SetOneUnthemedChoice( FloatToString(pSong->m_fSpecifiedBPMMin) );
g_SongInformation.rows[max_bpm].SetOneUnthemedChoice( FloatToString(pSong->m_fSpecifiedBPMMax) );
EditMiniMenu( &g_SongInformation, SM_BackFromSongInformation );
}
@@ -5096,7 +5096,7 @@ void ScreenEdit::HandleStepsInformationChoice( StepsInformationChoice c, const v
case step_min_bpm:
{
ScreenTextEntry::TextEntry(SM_None, ENTER_MIN_BPM,
ssprintf("%.6f", pSteps->GetMinBPM()), 20,
FloatToString(pSteps->GetMinBPM()), 20,
ScreenTextEntry::FloatValidate,
ChangeStepsMinBPM, NULL);
break;
@@ -5104,7 +5104,7 @@ void ScreenEdit::HandleStepsInformationChoice( StepsInformationChoice c, const v
case step_max_bpm:
{
ScreenTextEntry::TextEntry(SM_None, ENTER_MAX_BPM,
ssprintf("%.6f", pSteps->GetMaxBPM()), 20,
FloatToString(pSteps->GetMaxBPM()), 20,
ScreenTextEntry::FloatValidate,
ChangeStepsMaxBPM, NULL);
break;
@@ -5159,27 +5159,27 @@ void ScreenEdit::HandleSongInformationChoice( SongInformationChoice c, const vec
break;
case last_second_hint:
ScreenTextEntry::TextEntry( SM_None, ENTER_LAST_SECOND_HINT,
ssprintf("%.6f", pSong->GetSpecifiedLastSecond()), 20,
FloatToString(pSong->GetSpecifiedLastSecond()), 20,
ScreenTextEntry::FloatValidate, ChangeLastSecondHint, NULL );
break;
case preview_start:
ScreenTextEntry::TextEntry( SM_None, ENTER_PREVIEW_START,
ssprintf("%.6f", pSong->m_fMusicSampleStartSeconds), 20,
FloatToString(pSong->m_fMusicSampleStartSeconds), 20,
ScreenTextEntry::FloatValidate, ChangePreviewStart, NULL );
break;
case preview_length:
ScreenTextEntry::TextEntry( SM_None, ENTER_PREVIEW_LENGTH,
ssprintf("%.6f", pSong->m_fMusicSampleLengthSeconds), 20,
FloatToString(pSong->m_fMusicSampleLengthSeconds), 20,
ScreenTextEntry::FloatValidate, ChangePreviewLength, NULL );
break;
case min_bpm:
ScreenTextEntry::TextEntry( SM_None, ENTER_MIN_BPM,
ssprintf("%.6f", pSong->m_fSpecifiedBPMMin), 20,
FloatToString(pSong->m_fSpecifiedBPMMin), 20,
ScreenTextEntry::FloatValidate, ChangeMinBPM, NULL );
break;
case max_bpm:
ScreenTextEntry::TextEntry( SM_None, ENTER_MAX_BPM,
ssprintf("%.6f", pSong->m_fSpecifiedBPMMax), 20,
FloatToString(pSong->m_fSpecifiedBPMMax), 20,
ScreenTextEntry::FloatValidate, ChangeMaxBPM, NULL );
break;
default: break;
@@ -5210,14 +5210,14 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
DEFAULT_FAIL( c );
case beat_0_offset:
ScreenTextEntry::TextEntry( SM_None, ENTER_BEAT_0_OFFSET,
ssprintf("%.6f", GetAppropriateTiming().m_fBeat0OffsetInSeconds), 20,
FloatToString(GetAppropriateTiming().m_fBeat0OffsetInSeconds), 20,
ScreenTextEntry::FloatValidate, ChangeBeat0Offset, NULL );
break;
case bpm:
ScreenTextEntry::TextEntry(
SM_BackFromBPMChange,
ENTER_BPM_VALUE,
ssprintf( "%.4f", GetAppropriateTiming().GetBPMAtBeat( GetBeat() ) ),
FloatToString( GetAppropriateTiming().GetBPMAtBeat( GetBeat() ) ),
10
);
break;
@@ -5225,7 +5225,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry(
SM_BackFromStopChange,
ENTER_STOP_VALUE,
ssprintf( "%.4f", GetAppropriateTiming().GetStopAtBeat( GetBeat() ) ),
FloatToString( GetAppropriateTiming().GetStopAtBeat( GetBeat() ) ),
10
);
break;
@@ -5233,7 +5233,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry(
SM_BackFromDelayChange,
ENTER_DELAY_VALUE,
ssprintf( "%.4f", GetAppropriateTiming().GetDelayAtBeat( GetBeat() ) ),
FloatToString( GetAppropriateTiming().GetDelayAtBeat( GetBeat() ) ),
10
);
break;
@@ -5279,7 +5279,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry(
SM_BackFromWarpChange,
ENTER_WARP_VALUE,
ssprintf( "%.6f", GetAppropriateTiming().GetWarpAtBeat( GetBeat() ) ),
FloatToString( GetAppropriateTiming().GetWarpAtBeat( GetBeat() ) ),
10
);
break;
@@ -5287,7 +5287,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry(
SM_BackFromSpeedPercentChange,
ENTER_SPEED_PERCENT_VALUE,
ssprintf( "%.6f", GetAppropriateTiming().GetSpeedSegmentAtBeat( GetBeat() )->GetRatio() ),
FloatToString( GetAppropriateTiming().GetSpeedSegmentAtBeat( GetBeat() )->GetRatio() ),
10
);
break;
@@ -5295,7 +5295,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry(
SM_BackFromScrollChange,
ENTER_SCROLL_VALUE,
ssprintf( "%.6f", GetAppropriateTiming().GetScrollSegmentAtBeat( GetBeat() )->GetRatio() ),
FloatToString( GetAppropriateTiming().GetScrollSegmentAtBeat( GetBeat() )->GetRatio() ),
10
);
break;
@@ -5303,7 +5303,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry(
SM_BackFromSpeedWaitChange,
ENTER_SPEED_WAIT_VALUE,
ssprintf( "%.6f", GetAppropriateTiming().GetSpeedSegmentAtBeat( GetBeat() )->GetDelay() ),
FloatToString( GetAppropriateTiming().GetSpeedSegmentAtBeat( GetBeat() )->GetDelay() ),
10
);
break;
@@ -5323,7 +5323,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry(
SM_BackFromFakeChange,
ENTER_FAKE_VALUE,
ssprintf("%.6f", GetAppropriateTiming().GetFakeAtBeat( GetBeat() ) ),
FloatToString(GetAppropriateTiming().GetFakeAtBeat( GetBeat() ) ),
10
);
break;
@@ -5780,7 +5780,7 @@ void ScreenEdit::DoStepAttackMenu()
FOREACH(int, points, i)
{
const Attack &attack = attacks[*i];
RString desc = ssprintf("%.5f -> %.5f (%d mod[s])",
RString desc = ssprintf("%g -> %g (%d mod[s])",
startTime, startTime + attack.fSecsRemaining,
attack.GetNumAttacks());