diff --git a/stepmania/src/OptionRow.cpp b/stepmania/src/OptionRow.cpp index 27ab5b7355..d7b5ebc586 100644 --- a/stepmania/src/OptionRow.cpp +++ b/stepmania/src/OptionRow.cpp @@ -47,9 +47,15 @@ void OptionRow::PrepareItemText( CString &s ) const if( CAPITALIZE_ALL_OPTION_NAMES ) s.MakeUpper(); } -static CString OPTION_TITLE( CString s ) + +CString OptionRow::OptionTitle( CString s ) const { - return THEME->GetMetric("OptionTitles",s); + bool bTheme = false; + + // HACK: Always theme the NEXT_ROW and EXIT items, even if metrics says not to theme. + if( THEME_TITLES && m_RowDef.m_bAllowThemeTitles ) bTheme = true; + + return bTheme ? THEME->GetMetric("OptionTitles",s) : s; } CString ITEMS_LONG_ROW_X_NAME( size_t p ) { return ssprintf("ItemsLongRowP%dX",int(p+1)); } @@ -174,7 +180,7 @@ void OptionRow::LoadNormal( const OptionRowDefinition &def, OptionRowHandler *pH CString OptionRow::GetRowTitle() const { CString sLineName = m_RowDef.name; - CString sTitle = THEME_TITLES ? OPTION_TITLE(sLineName) : sLineName; + CString sTitle = OptionTitle(sLineName); // HACK: tack the BPM onto the name of the speed line if( sLineName.CompareNoCase("speed")==0 ) diff --git a/stepmania/src/OptionRow.h b/stepmania/src/OptionRow.h index b98b3b639c..1e809cfdcf 100644 --- a/stepmania/src/OptionRow.h +++ b/stepmania/src/OptionRow.h @@ -42,6 +42,9 @@ struct OptionRowDefinition set m_vEnabledForPlayers; // only players in this set may change focus to this row bool m_bExportOnChange; bool m_bAllowThemeItems; // if false, ignores ScreenOptions::THEME_ITEMS + bool m_bAllowThemeTitles; // if false, ignores ScreenOptions::THEME_TITLES + bool m_bAllowExplanation; // if false, ignores ScreenOptions::SHOW_EXPLANATIONS + bool m_bShowChoicesListOnSelect; bool IsEnabledForPlayer( PlayerNumber pn ) const { @@ -61,6 +64,9 @@ struct OptionRowDefinition m_vEnabledForPlayers.insert( pn ); m_bExportOnChange = false; m_bAllowThemeItems = true; + m_bAllowThemeTitles = true; + m_bAllowExplanation = true; + m_bShowChoicesListOnSelect = false; } OptionRowDefinition( const char *n, bool b, const char *c0=NULL, const char *c1=NULL, const char *c2=NULL, const char *c3=NULL, const char *c4=NULL, const char *c5=NULL, const char *c6=NULL, const char *c7=NULL, const char *c8=NULL, const char *c9=NULL, const char *c10=NULL, const char *c11=NULL, const char *c12=NULL, const char *c13=NULL, const char *c14=NULL, const char *c15=NULL, const char *c16=NULL, const char *c17=NULL, const char *c18=NULL, const char *c19=NULL ) @@ -146,6 +152,7 @@ public: bool GetFirstItemGoesDown() { return m_bFirstItemGoesDown; } void PrepareItemText( CString &s ) const; + CString OptionTitle( CString s ) const; void SetExitText( CString sExitText ); diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index f0287396b5..b9673acc01 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -319,7 +319,9 @@ CString ScreenOptions::GetExplanationText( int iRow ) const CString sLineName = row.GetRowDef().name; ASSERT( !sLineName.empty() ); - return SHOW_EXPLANATIONS ? OPTION_EXPLANATION(sLineName) : ""; + + bool bAllowExplanation = row.GetRowDef().m_bAllowExplanation; + return (bAllowExplanation && SHOW_EXPLANATIONS.GetValue()) ? OPTION_EXPLANATION(sLineName) : ""; } BitmapText &ScreenOptions::GetTextItemForRow( PlayerNumber pn, int iRow, int iChoiceOnRow ) diff --git a/stepmania/src/ScreenOptionsMaster.h b/stepmania/src/ScreenOptionsMaster.h index 7d1e97a6df..0b3377be96 100644 --- a/stepmania/src/ScreenOptionsMaster.h +++ b/stepmania/src/ScreenOptionsMaster.h @@ -19,7 +19,7 @@ protected: vector OptionRowHandlers; protected: - void HandleScreenMessage( const ScreenMessage SM ); + virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void ImportOptions( int row, const vector &vpns ); virtual void ExportOptions( int row, const vector &vpns ); diff --git a/stepmania/src/ScreenOptionsProfiles.cpp b/stepmania/src/ScreenOptionsProfiles.cpp new file mode 100644 index 0000000000..58f984285f --- /dev/null +++ b/stepmania/src/ScreenOptionsProfiles.cpp @@ -0,0 +1,169 @@ +#include "global.h" + +#include "ScreenOptionsProfiles.h" +#include "ScreenMiniMenu.h" +#include "ProfileManager.h" +#include "ScreenTextEntry.h" +#include "RageUtil.h" + +AutoScreenMessage( SM_BackFromCreateNewName ) +AutoScreenMessage( SM_BackFromProfileContextMenu ) + +enum ContextMenuAnswer +{ + A_EDIT, + A_RENAME, + A_DELETE, + A_CANCEL, +}; + +static MenuDef g_ProfileContextMenu( + "ScreenMiniMenuProfiles", + MenuRowDef( -1, "Edit", true, EDIT_MODE_PRACTICE, 0, "" ), + MenuRowDef( -1, "Rename", true, EDIT_MODE_PRACTICE, 0, "" ), + MenuRowDef( -1, "Delete", true, EDIT_MODE_PRACTICE, 0, "" ), + MenuRowDef( -1, "Cancel", true, EDIT_MODE_PRACTICE, 0, "" ) +); + +REGISTER_SCREEN_CLASS( ScreenOptionsProfiles ); +ScreenOptionsProfiles::ScreenOptionsProfiles( CString sName ) : + ScreenOptions( sName ) +{ + +} + +void ScreenOptionsProfiles::Init() +{ + ScreenOptions::Init(); + + + vector vDefs; + vector vHands; + + OptionRowDefinition def; + def.layoutType = LAYOUT_SHOW_ONE_IN_ROW; + def.m_bAllowThemeItems = false; + def.m_bAllowThemeTitles = false; + def.m_bAllowExplanation = false; + + def.name = "Create New"; + def.choices.clear(); + vDefs.push_back( def ); + vHands.push_back( NULL ); + + vector vsProfileNames; + PROFILEMAN->GetLocalProfileNames( vsProfileNames ); + + FOREACH_CONST( CString, vsProfileNames, s ) + { + def.name = *s; + def.choices.clear(); + vDefs.push_back( def ); + vHands.push_back( NULL ); + } + + + InitMenu( INPUTMODE_SHARE_CURSOR, vDefs, vHands ); +} + +ScreenOptionsProfiles::~ScreenOptionsProfiles() +{ + +} + +void ScreenOptionsProfiles::ImportOptions( int row, const vector &vpns ) +{ + +} + +void ScreenOptionsProfiles::ExportOptions( int row, const vector &vpns ) +{ + +} + +void ScreenOptionsProfiles::GoToNextScreen() +{ + SCREENMAN->SetNewScreen( "ScreenOptionsMenu" ); +} + +void ScreenOptionsProfiles::GoToPrevScreen() +{ + SCREENMAN->SetNewScreen( "ScreenOptionsMenu" ); +} + +void ScreenOptionsProfiles::HandleScreenMessage( const ScreenMessage SM ) +{ + if( SM == SM_BackFromCreateNewName ) + { + if( !ScreenTextEntry::s_bCancelledLast && ScreenTextEntry::s_sLastAnswer != "" ) + { + CString sNewName = ScreenTextEntry::s_sLastAnswer; + bool bResult = PROFILEMAN->CreateLocalProfile( sNewName ); + if( bResult ) + SCREENMAN->SetNewScreen( m_sName ); // reload + else + SCREENMAN->Prompt( SM_None, ssprintf("Error creating profile '%s'.", sNewName.c_str()) ); + } + } + else if( SM == SM_BackFromProfileContextMenu ) + { + switch( ScreenMiniMenu::s_iLastRowCode ) + { + default: + ASSERT(0); + case A_EDIT: + case A_RENAME: + case A_DELETE: + case A_CANCEL: + SCREENMAN->PlayInvalidSound(); + break; + } + } +} + +void ScreenOptionsProfiles::ProcessMenuStart( PlayerNumber pn, const InputEventType type ) +{ + int iRow = GetCurrentRow();; + OptionRow &row = *m_pRows[iRow]; + + if( iRow == 0 ) // "create new" + { + //ScreenOptions::BeginFadingOut(); + SCREENMAN->TextEntry( SM_BackFromCreateNewName, "Enter a name for a new profile.", "", 64 ); + } + else if( row.GetRowType() == OptionRow::ROW_EXIT ) + { + ScreenOptions::ProcessMenuStart( pn, type ); + } + else + { + SCREENMAN->MiniMenu( &g_ProfileContextMenu, SM_BackFromProfileContextMenu ); + + } +} + + +/* + * (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. + */ diff --git a/stepmania/src/ScreenOptionsProfiles.h b/stepmania/src/ScreenOptionsProfiles.h new file mode 100644 index 0000000000..af6dc3979d --- /dev/null +++ b/stepmania/src/ScreenOptionsProfiles.h @@ -0,0 +1,50 @@ +#ifndef ScreenOptionsProfiles_H +#define ScreenOptionsProfiles_H + +#include "ScreenOptions.h" + +class ScreenOptionsProfiles : public ScreenOptions +{ +public: + ScreenOptionsProfiles( CString sName ); + virtual void Init(); + virtual ~ScreenOptionsProfiles(); + +protected: +private: + virtual void ImportOptions( int row, const vector &vpns ); + virtual void ExportOptions( int row, const vector &vpns ); + + virtual void GoToNextScreen(); + virtual void GoToPrevScreen(); + + virtual void HandleScreenMessage( const ScreenMessage SM ); + virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type ); +}; + +#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. + */ diff --git a/stepmania/src/ScreenProfileOptions.cpp b/stepmania/src/ScreenProfileOptions.cpp index 39e274870a..253d40e7fb 100644 --- a/stepmania/src/ScreenProfileOptions.cpp +++ b/stepmania/src/ScreenProfileOptions.cpp @@ -146,7 +146,7 @@ void ScreenProfileOptions::HandleScreenMessage( const ScreenMessage SM ) CString sNewName = ScreenTextEntry::s_sLastAnswer; bool bResult = PROFILEMAN->CreateLocalProfile( sNewName ); if( bResult ) - SCREENMAN->SetNewScreen( "ScreenProfileOptions" ); // reload + SCREENMAN->SetNewScreen( m_sName ); // reload else ScreenPrompt::Prompt( SM_None, ssprintf("Error creating profile '%s'.", sNewName.c_str()) ); }