enum name cleanup

fix "CapitalizeAll" not applied if "ShowOneInRow"
This commit is contained in:
Chris Danford
2005-02-13 18:15:10 +00:00
parent 202170ab53
commit dae8bf0332
2 changed files with 17 additions and 14 deletions
+3 -3
View File
@@ -12,7 +12,7 @@ enum SelectType { SELECT_ONE, SELECT_MULTIPLE, SELECT_NONE, NUM_SELECT_TYPES, SE
const CString& SelectTypeToString( SelectType pm );
SelectType StringToSelectType( const CString& s );
enum LayoutType { SHOW_ALL_IN_LINE, SHOW_ONE_IN_LINE, NUM_LAYOUT_TYPES, LAYOUT_INVALID };
enum LayoutType { LAYOUT_SHOW_ALL_IN_ROW, LAYOUT_SHOW_ONE_IN_ROW, NUM_LAYOUT_TYPES, LAYOUT_INVALID };
const CString& LayoutTypeToString( LayoutType pm );
LayoutType StringToLayoutType( const CString& s );
@@ -24,10 +24,10 @@ struct OptionRowDefinition
enum LayoutType layoutType;
vector<CString> choices;
OptionRowDefinition(): name(""), bOneChoiceForAllPlayers(false), selectType(SELECT_ONE), layoutType(SHOW_ALL_IN_LINE) { }
OptionRowDefinition(): name(""), bOneChoiceForAllPlayers(false), selectType(SELECT_ONE), layoutType(LAYOUT_SHOW_ALL_IN_ROW) { }
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 ) :
name(n), bOneChoiceForAllPlayers(b), selectType(SELECT_ONE), layoutType(SHOW_ALL_IN_LINE)
name(n), bOneChoiceForAllPlayers(b), selectType(SELECT_ONE), layoutType(LAYOUT_SHOW_ALL_IN_ROW)
{
#define PUSH( c ) if(c) choices.push_back(c);
PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);PUSH(c12);PUSH(c13);PUSH(c14);PUSH(c15);PUSH(c16);PUSH(c17);PUSH(c18);PUSH(c19);
+14 -11
View File
@@ -283,7 +283,7 @@ void ScreenOptions::InitMenu( InputMode im, OptionRowDefinition defs[], int iNum
if( fX > ITEMS_END_X )
{
row.m_RowDef.layoutType = SHOW_ONE_IN_LINE;
row.m_RowDef.layoutType = LAYOUT_SHOW_ONE_IN_ROW;
break;
}
}
@@ -291,7 +291,7 @@ void ScreenOptions::InitMenu( InputMode im, OptionRowDefinition defs[], int iNum
switch( row.m_RowDef.layoutType )
{
case SHOW_ONE_IN_LINE:
case LAYOUT_SHOW_ONE_IN_ROW:
// init text
FOREACH_HumanPlayer( p )
{
@@ -301,7 +301,10 @@ void ScreenOptions::InitMenu( InputMode im, OptionRowDefinition defs[], int iNum
const int iChoiceInRowWithFocus = row.m_iChoiceInRowWithFocus[p];
bt->LoadFromFont( THEME->GetPathF(m_sName,"item") );
bt->SetText( optline.choices[iChoiceInRowWithFocus] );
CString sText = optline.choices[iChoiceInRowWithFocus];
if( CAPITALIZE_ALL_OPTION_NAMES )
sText.MakeUpper();
bt->SetText( sText );
bt->SetZoom( ITEMS_ZOOM );
bt->SetShadowLength( 0 );
@@ -329,7 +332,7 @@ void ScreenOptions::InitMenu( InputMode im, OptionRowDefinition defs[], int iNum
}
break;
case SHOW_ALL_IN_LINE:
case LAYOUT_SHOW_ALL_IN_ROW:
{
float fX = ITEMS_START_X;
for( unsigned c=0; c<optline.choices.size(); c++ )
@@ -572,13 +575,13 @@ BitmapText &ScreenOptions::GetTextItemForRow( PlayerNumber pn, int iRow, int iCh
int index = -1;
switch( row.m_RowDef.layoutType )
{
case SHOW_ONE_IN_LINE:
case LAYOUT_SHOW_ONE_IN_ROW:
index = bOneChoice ? 0 : pn;
/* If only P2 is enabled, his selections will be in index 0. */
if( row.m_textItems.size() == 1 )
index = 0;
break;
case SHOW_ALL_IN_LINE:
case LAYOUT_SHOW_ALL_IN_ROW:
index = iChoiceOnRow;
break;
default:
@@ -648,13 +651,13 @@ void ScreenOptions::PositionUnderlines()
{
vector<OptionsCursor*> &vpUnderlines = row.m_Underline[p];
const int iNumUnderlines = (row.m_RowDef.layoutType == SHOW_ONE_IN_LINE) ? 1 : vpUnderlines.size();
const int iNumUnderlines = (row.m_RowDef.layoutType == LAYOUT_SHOW_ONE_IN_ROW) ? 1 : vpUnderlines.size();
for( int i=0; i<iNumUnderlines; i++ )
{
OptionsCursor& ul = *vpUnderlines[i];
int iChoiceWithFocus = (row.m_RowDef.layoutType == SHOW_ONE_IN_LINE) ? row.m_iChoiceInRowWithFocus[p] : i;
int iChoiceWithFocus = (row.m_RowDef.layoutType == LAYOUT_SHOW_ONE_IN_ROW) ? row.m_iChoiceInRowWithFocus[p] : i;
/* Don't tween X movement and color changes. */
int iWidth, iX, iY;
@@ -783,7 +786,7 @@ void ScreenOptions::UpdateText( int iRow )
OptionRow &row = *m_Rows[iRow];
const OptionRowDefinition &data = row.m_RowDef;
if( !row.m_RowDef.layoutType == SHOW_ONE_IN_LINE )
if( !row.m_RowDef.layoutType == LAYOUT_SHOW_ONE_IN_ROW )
return;
FOREACH_HumanPlayer( pn )
@@ -1255,7 +1258,7 @@ void ScreenOptions::StoreFocus( PlayerNumber pn )
{
/* Long rows always put us in the center, so don't update the focus. */
const OptionRow &OptionRow = *m_Rows[m_iCurrentRow[pn]];
if( OptionRow.m_RowDef.layoutType == SHOW_ONE_IN_LINE )
if( OptionRow.m_RowDef.layoutType == LAYOUT_SHOW_ONE_IN_ROW )
return;
int iWidth, iY;
@@ -1399,7 +1402,7 @@ void ScreenOptions::MoveRow( PlayerNumber pn, int dir, bool Repeat )
{
case NAV_TOGGLE_THREE_KEY:
case NAV_TOGGLE_FIVE_KEY:
if( m_Rows[row]->m_RowDef.layoutType != SHOW_ONE_IN_LINE )
if( m_Rows[row]->m_RowDef.layoutType != LAYOUT_SHOW_ONE_IN_ROW )
{
int iSelectionDist = -1;
for( unsigned i = 0; i < m_Rows[row]->m_textItems.size(); ++i )