Have OptionRows subscribe to a Message in order to refresh
This commit is contained in:
@@ -31,6 +31,12 @@ void MessageManager::Subscribe( IMessageSubscriber* pSubscriber, const CString&
|
||||
#endif
|
||||
subs.insert( pSubscriber );
|
||||
}
|
||||
|
||||
void MessageManager::Subscribe( IMessageSubscriber* pSubscriber, Message m )
|
||||
{
|
||||
Subscribe( pSubscriber, MessageToString(m) );
|
||||
}
|
||||
|
||||
void MessageManager::Unsubscribe( IMessageSubscriber* pSubscriber, const CString& sMessage )
|
||||
{
|
||||
SubscribersSet& subs = m_MessageToSubscribers[sMessage];
|
||||
@@ -39,6 +45,11 @@ void MessageManager::Unsubscribe( IMessageSubscriber* pSubscriber, const CString
|
||||
subs.erase( iter );
|
||||
}
|
||||
|
||||
void MessageManager::Unsubscribe( IMessageSubscriber* pSubscriber, Message m )
|
||||
{
|
||||
Unsubscribe( pSubscriber, MessageToString(m) );
|
||||
}
|
||||
|
||||
void MessageManager::Broadcast( const CString& sMessage )
|
||||
{
|
||||
SubscribersSet& subs = m_MessageToSubscribers[sMessage];
|
||||
|
||||
@@ -38,7 +38,9 @@ public:
|
||||
~MessageManager();
|
||||
|
||||
void Subscribe( IMessageSubscriber* pSubscriber, const CString& sMessage );
|
||||
void Subscribe( IMessageSubscriber* pSubscriber, Message m );
|
||||
void Unsubscribe( IMessageSubscriber* pSubscriber, const CString& sMessage );
|
||||
void Unsubscribe( IMessageSubscriber* pSubscriber, Message m );
|
||||
void Broadcast( const CString& sMessage );
|
||||
|
||||
private:
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
#include "Font.h"
|
||||
#include "Foreach.h"
|
||||
#include "OptionRowHandler.h"
|
||||
|
||||
static const CString SelectTypeNames[NUM_SELECT_TYPES] = {
|
||||
"SelectOne",
|
||||
@@ -52,6 +54,12 @@ void OptionRow::Clear()
|
||||
m_Underline[p].clear();
|
||||
}
|
||||
|
||||
if( m_pHand )
|
||||
{
|
||||
FOREACH_CONST( CString, m_pHand->m_vsReloadRowMessages, m )
|
||||
MESSAGEMAN->Unsubscribe( this, *m );
|
||||
}
|
||||
|
||||
m_pHand = NULL;
|
||||
}
|
||||
|
||||
@@ -61,6 +69,12 @@ void OptionRow::LoadNormal( const OptionRowDefinition &def, OptionRowHandler *pH
|
||||
m_RowType = OptionRow::ROW_NORMAL;
|
||||
m_pHand = pHand;
|
||||
|
||||
if( m_pHand )
|
||||
{
|
||||
FOREACH_CONST( CString, m_pHand->m_vsReloadRowMessages, m )
|
||||
MESSAGEMAN->Subscribe( this, *m );
|
||||
}
|
||||
|
||||
if( !def.choices.size() )
|
||||
RageException::Throw( "Screen %s menu entry \"%s\" has no choices",
|
||||
m_sName.c_str(), def.name.c_str() );
|
||||
@@ -565,6 +579,36 @@ void OptionRow::SetExitText( CString sExitText )
|
||||
bt->SetText( sExitText );
|
||||
}
|
||||
|
||||
void OptionRow::Reload()
|
||||
{
|
||||
if( m_pHand == NULL )
|
||||
return;
|
||||
|
||||
OptionRowDefinition def;
|
||||
m_pHand->Reload( def );
|
||||
|
||||
switch( GetRowType() )
|
||||
{
|
||||
case OptionRow::ROW_NORMAL:
|
||||
{
|
||||
ASSERT( m_RowDef.layoutType == LAYOUT_SHOW_ONE_IN_ROW );
|
||||
m_RowDef = def;
|
||||
UpdateText( true );
|
||||
}
|
||||
break;
|
||||
case OptionRow::ROW_EXIT:
|
||||
// nothing to do
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
||||
void OptionRow::HandleMessage( const CString& sMessage )
|
||||
{
|
||||
Reload();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford
|
||||
|
||||
@@ -153,6 +153,13 @@ public:
|
||||
|
||||
void SetExitText( CString sExitText );
|
||||
|
||||
void Reload();
|
||||
|
||||
//
|
||||
// Messages
|
||||
//
|
||||
virtual void HandleMessage( const CString& sMessage );
|
||||
|
||||
protected:
|
||||
OptionRowDefinition m_RowDef;
|
||||
RowType m_RowType;
|
||||
|
||||
@@ -55,9 +55,9 @@ public:
|
||||
Default.Init();
|
||||
m_bUseModNameForIcon = false;
|
||||
}
|
||||
virtual void Load( OptionRowDefinition &defOut, CString sParam );
|
||||
virtual void ImportOption( const OptionRowDefinition &def, PlayerNumber pn, vector<bool> &vbSelectedOut ) const;
|
||||
virtual int ExportOption( const OptionRowDefinition &def, PlayerNumber pn, const vector<bool> &vbSelected ) const;
|
||||
virtual void Reload( OptionRowDefinition &defOut );
|
||||
virtual CString GetIconText( const OptionRowDefinition &def, int iFirstSelection ) const
|
||||
{
|
||||
return m_bUseModNameForIcon ?
|
||||
@@ -80,7 +80,6 @@ public:
|
||||
return "";
|
||||
}
|
||||
|
||||
void FillList( OptionRowDefinition &defOut, CString param );
|
||||
void FillNoteSkins( OptionRowDefinition &defOut );
|
||||
void FillSteps( OptionRowDefinition &defOut );
|
||||
void FillEditsAndNull( OptionRowDefinition &defOut );
|
||||
@@ -103,11 +102,9 @@ public:
|
||||
delete m_pLuaTable;
|
||||
m_pLuaTable = new LuaExpression;
|
||||
}
|
||||
virtual void Load( OptionRowDefinition &defOut, CString sLuaFunction );
|
||||
virtual void ImportOption( const OptionRowDefinition &def, PlayerNumber pn, vector<bool> &vbSelectedOut ) const;
|
||||
virtual int ExportOption( const OptionRowDefinition &def, PlayerNumber pn, const vector<bool> &vbSelected ) const;
|
||||
virtual void Reload( OptionRowDefinition &defOut );
|
||||
|
||||
void FillLua( OptionRowDefinition &defOut, CString sLuaFunction );
|
||||
};
|
||||
|
||||
class OptionRowHandlerConfig : public OptionRowHandler
|
||||
@@ -121,10 +118,9 @@ public:
|
||||
OptionRowHandler::Init();
|
||||
opt = NULL;
|
||||
}
|
||||
virtual void Load( OptionRowDefinition &defOut, CString sParam );
|
||||
virtual void ImportOption( const OptionRowDefinition &row, PlayerNumber pn, vector<bool> &vbSelectedOut ) const;
|
||||
virtual int ExportOption( const OptionRowDefinition &def, PlayerNumber pn, const vector<bool> &vbSelected ) const;
|
||||
|
||||
void FillConfig( OptionRowDefinition &defOut, CString param );
|
||||
};
|
||||
|
||||
class OptionRowHandlerStepsType : public OptionRowHandler
|
||||
@@ -140,29 +136,8 @@ public:
|
||||
m_pstToFill = NULL;
|
||||
m_vStepsTypesToShow.clear();
|
||||
}
|
||||
virtual void ImportOption( const OptionRowDefinition &row, PlayerNumber pn, vector<bool> &vbSelectedOut ) const
|
||||
{
|
||||
if( GAMESTATE->m_pCurSteps[0] )
|
||||
{
|
||||
StepsType st = GAMESTATE->m_pCurSteps[0]->m_StepsType;
|
||||
vector<StepsType>::const_iterator iter = find( m_vStepsTypesToShow.begin(), m_vStepsTypesToShow.end(), st );
|
||||
if( iter != m_vStepsTypesToShow.end() )
|
||||
{
|
||||
unsigned i = iter - m_vStepsTypesToShow.begin();
|
||||
vbSelectedOut[i] = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
vbSelectedOut[0] = true;
|
||||
}
|
||||
virtual int ExportOption( const OptionRowDefinition &def, PlayerNumber pn, const vector<bool> &vbSelected ) const
|
||||
{
|
||||
int index = GetOneSelection( vbSelected );
|
||||
*m_pstToFill = m_vStepsTypesToShow[index];
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FillStepsType( OptionRowDefinition &defOut, CString sParam )
|
||||
virtual void Load( OptionRowDefinition &defOut, CString sParam )
|
||||
{
|
||||
Init();
|
||||
defOut.Init();
|
||||
@@ -206,6 +181,27 @@ public:
|
||||
if( *m_pstToFill == STEPS_TYPE_INVALID )
|
||||
*m_pstToFill = m_vStepsTypesToShow[0];
|
||||
}
|
||||
virtual void ImportOption( const OptionRowDefinition &row, PlayerNumber pn, vector<bool> &vbSelectedOut ) const
|
||||
{
|
||||
if( GAMESTATE->m_pCurSteps[0] )
|
||||
{
|
||||
StepsType st = GAMESTATE->m_pCurSteps[0]->m_StepsType;
|
||||
vector<StepsType>::const_iterator iter = find( m_vStepsTypesToShow.begin(), m_vStepsTypesToShow.end(), st );
|
||||
if( iter != m_vStepsTypesToShow.end() )
|
||||
{
|
||||
unsigned i = iter - m_vStepsTypesToShow.begin();
|
||||
vbSelectedOut[i] = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
vbSelectedOut[0] = true;
|
||||
}
|
||||
virtual int ExportOption( const OptionRowDefinition &def, PlayerNumber pn, const vector<bool> &vbSelected ) const
|
||||
{
|
||||
int index = GetOneSelection( vbSelected );
|
||||
*m_pstToFill = m_vStepsTypesToShow[index];
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -222,6 +218,40 @@ public:
|
||||
m_ppStepsToFill = NULL;
|
||||
m_vSteps.clear();
|
||||
}
|
||||
|
||||
virtual void Load( OptionRowDefinition &defOut, CString sParam )
|
||||
{
|
||||
Init();
|
||||
defOut.Init();
|
||||
|
||||
if( sParam == "EditSourceSteps" )
|
||||
m_ppStepsToFill = &GAMESTATE->m_pStepsEditSource;
|
||||
else
|
||||
RageException::Throw( "invalid StepsType param \"%s\"", sParam.c_str() );
|
||||
|
||||
m_sName = sParam;
|
||||
defOut.name = sParam;
|
||||
defOut.bOneChoiceForAllPlayers = true;
|
||||
defOut.layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
||||
defOut.m_bExportOnChange = true;
|
||||
m_vsReloadRowMessages.push_back( MessageToString(MESSAGE_CURRENT_SONG_CHANGED) );
|
||||
|
||||
GAMESTATE->m_pCurSong->GetSteps( m_vSteps, GAMESTATE->m_stEditSource );
|
||||
StepsUtil::SortNotesArrayByDifficulty( m_vSteps );
|
||||
for( unsigned i=0; i<m_vSteps.size(); i++ )
|
||||
{
|
||||
Steps* pSteps = m_vSteps[i];
|
||||
|
||||
CString s;
|
||||
if( pSteps->GetDifficulty() == DIFFICULTY_EDIT )
|
||||
s = pSteps->GetDescription();
|
||||
else
|
||||
s = DifficultyToThemedString( pSteps->GetDifficulty() );
|
||||
s += ssprintf( " (%d)", pSteps->GetMeter() );
|
||||
|
||||
defOut.choices.push_back( s );
|
||||
}
|
||||
}
|
||||
virtual void ImportOption( const OptionRowDefinition &row, PlayerNumber pn, vector<bool> &vbSelectedOut ) const
|
||||
{
|
||||
vector<Steps*>::const_iterator iter = find( m_vSteps.begin(), m_vSteps.end(), *m_ppStepsToFill );
|
||||
@@ -239,39 +269,6 @@ public:
|
||||
*m_ppStepsToFill = m_vSteps[index];
|
||||
return 0;
|
||||
}
|
||||
|
||||
void FillSteps( OptionRowDefinition &defOut, CString sParam )
|
||||
{
|
||||
Init();
|
||||
defOut.Init();
|
||||
|
||||
if( sParam == "EditSourceSteps" )
|
||||
m_ppStepsToFill = &GAMESTATE->m_pStepsEditSource;
|
||||
else
|
||||
RageException::Throw( "invalid StepsType param \"%s\"", sParam.c_str() );
|
||||
|
||||
m_sName = sParam;
|
||||
defOut.name = sParam;
|
||||
defOut.bOneChoiceForAllPlayers = true;
|
||||
defOut.layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
||||
defOut.m_bExportOnChange = true;
|
||||
|
||||
GAMESTATE->m_pCurSong->GetSteps( m_vSteps, GAMESTATE->m_stEditSource );
|
||||
StepsUtil::SortNotesArrayByDifficulty( m_vSteps );
|
||||
for( unsigned i=0; i<m_vSteps.size(); i++ )
|
||||
{
|
||||
Steps* pSteps = m_vSteps[i];
|
||||
|
||||
CString s;
|
||||
if( pSteps->GetDifficulty() == DIFFICULTY_EDIT )
|
||||
s = pSteps->GetDescription();
|
||||
else
|
||||
s = DifficultyToThemedString( pSteps->GetDifficulty() );
|
||||
s += ssprintf( " (%d)", pSteps->GetMeter() );
|
||||
|
||||
defOut.choices.push_back( s );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -337,11 +334,6 @@ int OptionRowHandlerList::ExportOption( const OptionRowDefinition &def, PlayerNu
|
||||
return 0;
|
||||
}
|
||||
|
||||
void OptionRowHandlerList::Reload( OptionRowDefinition &defOut )
|
||||
{
|
||||
FillList( defOut, m_sName );
|
||||
}
|
||||
|
||||
|
||||
void OptionRowHandlerLua::ImportOption( const OptionRowDefinition &def, PlayerNumber pn, vector<bool> &vbSelectedOut ) const
|
||||
{
|
||||
@@ -435,11 +427,6 @@ int OptionRowHandlerLua::ExportOption( const OptionRowDefinition &def, PlayerNum
|
||||
return 0;
|
||||
}
|
||||
|
||||
void OptionRowHandlerLua::Reload( OptionRowDefinition &defOut )
|
||||
{
|
||||
FillLua( defOut, m_sName );
|
||||
}
|
||||
|
||||
|
||||
void OptionRowHandlerConfig::ImportOption( const OptionRowDefinition &def, PlayerNumber pn, vector<bool> &vbSelectedOut ) const
|
||||
{
|
||||
@@ -471,7 +458,7 @@ int OptionRowHandlerConfig::ExportOption( const OptionRowDefinition &def, Player
|
||||
|
||||
|
||||
/* Add the list named "ListName" to the given row/handler. */
|
||||
void OptionRowHandlerList::FillList( OptionRowDefinition &defOut, CString sListName )
|
||||
void OptionRowHandlerList::Load( OptionRowDefinition &defOut, CString sListName )
|
||||
{
|
||||
m_sName = sListName;
|
||||
|
||||
@@ -509,10 +496,10 @@ void OptionRowHandlerList::FillList( OptionRowDefinition &defOut, CString sListN
|
||||
else if( sName == "selectmultiple" ) defOut.selectType = SELECT_MULTIPLE;
|
||||
else if( sName == "selectnone" ) defOut.selectType = SELECT_NONE;
|
||||
else if( sName == "showoneinrow" ) defOut.layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
||||
else if( sName == "reloadrownames" )
|
||||
else if( sName == "reloadrowmessages" )
|
||||
{
|
||||
for( unsigned a=1; a<cmd.m_vsArgs.size(); a++ )
|
||||
m_vsRefreshRowNames.push_back( cmd.m_vsArgs[a] );
|
||||
m_vsReloadRowMessages.push_back( cmd.m_vsArgs[a] );
|
||||
}
|
||||
else if( sName == "enabledforplayers" )
|
||||
{
|
||||
@@ -547,7 +534,7 @@ void OptionRowHandlerList::FillList( OptionRowDefinition &defOut, CString sListN
|
||||
}
|
||||
}
|
||||
|
||||
void OptionRowHandlerLua::FillLua( OptionRowDefinition &defOut, CString sLuaFunction )
|
||||
void OptionRowHandlerLua::Load( OptionRowDefinition &defOut, CString sLuaFunction )
|
||||
{
|
||||
Init();
|
||||
defOut.Init();
|
||||
@@ -656,15 +643,15 @@ void OptionRowHandlerLua::FillLua( OptionRowDefinition &defOut, CString sLuaFunc
|
||||
lua_pop( LUA->L, 1 ); /* pop ExportOnChange value */
|
||||
|
||||
|
||||
/* Iterate over the "RefreshRowNames" table. */
|
||||
lua_pushstring( LUA->L, "RefreshRowNames" );
|
||||
/* Iterate over the "ReloadRowMessages" table. */
|
||||
lua_pushstring( LUA->L, "ReloadRowMessages" );
|
||||
lua_gettable( LUA->L, -2 );
|
||||
if( !lua_isnil( LUA->L, -1 ) )
|
||||
{
|
||||
if( !lua_istable( LUA->L, -1 ) )
|
||||
RageException::Throw( "\"%s\" \"RefreshRowNames\" is not a table", sLuaFunction.c_str() );
|
||||
RageException::Throw( "\"%s\" \"ReloadRowMessages\" is not a table", sLuaFunction.c_str() );
|
||||
|
||||
m_vsRefreshRowNames.clear(); // and fill in with supplied PlayerNumbers below
|
||||
m_vsReloadRowMessages.clear(); // and fill in with supplied PlayerNumbers below
|
||||
|
||||
lua_pushnil( LUA->L );
|
||||
while( lua_next(LUA->L, -2) != 0 )
|
||||
@@ -675,12 +662,12 @@ void OptionRowHandlerLua::FillLua( OptionRowDefinition &defOut, CString sLuaFunc
|
||||
RageException::Throw( "\"%s\" Column entry is not a string", sLuaFunction.c_str() );
|
||||
LOG->Trace( "'%s'", pValue);
|
||||
|
||||
m_vsRefreshRowNames.push_back( pValue );
|
||||
m_vsReloadRowMessages.push_back( pValue );
|
||||
|
||||
lua_pop( LUA->L, 1 ); /* removes `value'; keeps `key' for next iteration */
|
||||
}
|
||||
}
|
||||
lua_pop( LUA->L, 1 ); /* pop RefreshRowNames table */
|
||||
lua_pop( LUA->L, 1 ); /* pop ReloadRowMessages table */
|
||||
|
||||
|
||||
lua_pop( LUA->L, 1 ); /* pop main table */
|
||||
@@ -775,6 +762,7 @@ void OptionRowHandlerList::FillEditsAndNull( OptionRowDefinition &defOut )
|
||||
defOut.bOneChoiceForAllPlayers = true;
|
||||
defOut.layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
||||
defOut.m_bExportOnChange = true;
|
||||
m_vsReloadRowMessages.push_back( MessageToString(MESSAGE_CURRENT_SONG_CHANGED) );
|
||||
|
||||
vector<Steps*> vSteps;
|
||||
GAMESTATE->m_pCurSong->GetSteps( vSteps, GAMESTATE->m_stEdit, DIFFICULTY_EDIT );
|
||||
@@ -800,7 +788,7 @@ void OptionRowHandlerList::FillEditsAndNull( OptionRowDefinition &defOut )
|
||||
|
||||
|
||||
/* Add the given configuration value to the given row/handler. */
|
||||
void OptionRowHandlerConfig::FillConfig( OptionRowDefinition &defOut, CString param )
|
||||
void OptionRowHandlerConfig::Load( OptionRowDefinition &defOut, CString param )
|
||||
{
|
||||
Init();
|
||||
defOut.Init();
|
||||
@@ -971,11 +959,13 @@ OptionRowHandler* OptionRowHandlerUtil::Make( const Command &command, OptionRowD
|
||||
|
||||
const CString &name = command.GetName();
|
||||
|
||||
if( name == "list" ) { OptionRowHandlerList *p = new OptionRowHandlerList; p->FillList( defOut, sArg(1) ); pHand = p; }
|
||||
else if( name == "lua" ) { OptionRowHandlerLua *p = new OptionRowHandlerLua; p->FillLua( defOut, sArg(1) ); pHand = p; }
|
||||
else if( name == "conf" ) { OptionRowHandlerConfig *p = new OptionRowHandlerConfig; p->FillConfig( defOut, sArg(1) ); pHand = p; }
|
||||
else if( name == "stepstype" ) { OptionRowHandlerStepsType *p = new OptionRowHandlerStepsType; p->FillStepsType( defOut, sArg(1) ); pHand = p; }
|
||||
else if( name == "steps" ) { OptionRowHandlerSteps *p = new OptionRowHandlerSteps; p->FillSteps( defOut, sArg(1) ); pHand = p; }
|
||||
#define MAKE( type ) { type *p = new type; p->Load( defOut, sArg(1) ); pHand = p; }
|
||||
|
||||
if( name == "list" ) MAKE( OptionRowHandlerList )
|
||||
else if( name == "lua" ) MAKE( OptionRowHandlerLua )
|
||||
else if( name == "conf" ) MAKE( OptionRowHandlerConfig )
|
||||
else if( name == "stepstype" ) MAKE( OptionRowHandlerStepsType )
|
||||
else if( name == "steps" ) MAKE( OptionRowHandlerSteps )
|
||||
|
||||
EndHandleArgs;
|
||||
|
||||
|
||||
@@ -13,18 +13,19 @@ class OptionRowHandler
|
||||
{
|
||||
public:
|
||||
CString m_sName;
|
||||
vector<CString> m_vsRefreshRowNames; // refresh these rows when the value of this row changes
|
||||
vector<CString> m_vsReloadRowMessages; // refresh this row on on these messages
|
||||
|
||||
OptionRowHandler::OptionRowHandler() { Init(); }
|
||||
virtual void Init()
|
||||
{
|
||||
m_sName = "";
|
||||
m_vsRefreshRowNames.clear();
|
||||
m_vsReloadRowMessages.clear();
|
||||
}
|
||||
virtual void Load( OptionRowDefinition &defOut, CString sParam ) = 0;
|
||||
void Reload( OptionRowDefinition &defOut ) { this->Load(defOut,m_sName); }
|
||||
virtual void ImportOption( const OptionRowDefinition &row, PlayerNumber pn, vector<bool> &vbSelectedOut ) const = 0;
|
||||
/* Returns an OPT mask. */
|
||||
virtual int ExportOption( const OptionRowDefinition &def, PlayerNumber pn, const vector<bool> &vbSelected ) const = 0;
|
||||
virtual void Reload( OptionRowDefinition &defOut ) {}
|
||||
virtual CString GetIconText( const OptionRowDefinition &def, int iFirstSelection ) const { return ""; }
|
||||
virtual CString GetAndEraseScreen( int iChoice ) { return ""; }
|
||||
};
|
||||
|
||||
@@ -1142,47 +1142,6 @@ int ScreenOptions::GetCurrentRow( PlayerNumber pn ) const
|
||||
return r;
|
||||
}
|
||||
|
||||
void ScreenOptions::RefreshRowChoices( int r, const OptionRowDefinition &newdef )
|
||||
{
|
||||
OptionRow &row = *m_Rows[r];
|
||||
|
||||
switch( row.GetRowType() )
|
||||
{
|
||||
case OptionRow::ROW_NORMAL:
|
||||
{
|
||||
Font* pFont = FONT->LoadFont( THEME->GetPathF(m_sName,"item") );
|
||||
row.Clear();
|
||||
row.LoadNormal( newdef, row.GetHandler() );
|
||||
row.AfterImportOptions(
|
||||
pFont,
|
||||
ITEMS_START_X,
|
||||
ITEMS_GAP_X,
|
||||
ITEMS_END_X,
|
||||
ITEMS_LONG_ROW_SHARED_X,
|
||||
ITEMS_LONG_ROW_X,
|
||||
ITEMS_ZOOM,
|
||||
CAPITALIZE_ALL_OPTION_NAMES,
|
||||
THEME->GetPathF(m_sName,"item"),
|
||||
THEME->GetPathF(m_sName,"title"),
|
||||
GetExplanationTitle( r ),
|
||||
THEME->GetPathG(m_sName,"bullet"),
|
||||
LABELS_X,
|
||||
ARROWS_X,
|
||||
row.GetRowY(),
|
||||
LABELS_ON_COMMAND
|
||||
);
|
||||
FONT->UnloadFont( pFont );
|
||||
pFont = NULL;
|
||||
UpdateEnabledDisabled( r );
|
||||
}
|
||||
break;
|
||||
case OptionRow::ROW_EXIT:
|
||||
// nothing to do
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||
|
||||
@@ -49,7 +49,6 @@ protected:
|
||||
void UpdateEnabledDisabled();
|
||||
void UpdateEnabledDisabled( int row );
|
||||
virtual void OnChange( PlayerNumber pn );
|
||||
void RefreshRowChoices( int row, const OptionRowDefinition &def );
|
||||
|
||||
virtual void MenuBack( PlayerNumber pn );
|
||||
virtual void MenuStart( PlayerNumber pn, const InputEventType type );
|
||||
@@ -59,7 +58,7 @@ protected:
|
||||
virtual void GoToNextScreen() = 0;
|
||||
virtual void GoToPrevScreen() = 0;
|
||||
|
||||
virtual void ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat );
|
||||
void ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat );
|
||||
void MoveRow( PlayerNumber pn, int dir, bool Repeat );
|
||||
|
||||
void MenuLeft( PlayerNumber pn, const InputEventType type ) { ChangeValueInRow(pn,-1,type != IET_FIRST_PRESS); }
|
||||
|
||||
@@ -105,9 +105,7 @@ void ScreenOptionsMaster::Init()
|
||||
|
||||
ASSERT( OptionRowHandlers.size() == asLineNames.size() );
|
||||
|
||||
vector<OptionRowHandler*> vHands( m_OptionRowAlloc.size(), NULL );
|
||||
|
||||
InitMenu( im, m_OptionRowAlloc, vHands, bShowUnderlines );
|
||||
InitMenu( im, m_OptionRowAlloc, OptionRowHandlers, bShowUnderlines );
|
||||
}
|
||||
|
||||
ScreenOptionsMaster::~ScreenOptionsMaster()
|
||||
@@ -283,35 +281,6 @@ void ScreenOptionsMaster::RefreshIcons()
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenOptionsMaster::ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat )
|
||||
{
|
||||
ScreenOptions::ChangeValueInRow( pn, iDelta, Repeat );
|
||||
|
||||
int iRow = m_iCurrentRow[pn];
|
||||
|
||||
const OptionRowHandler *pHand = OptionRowHandlers[iRow];
|
||||
|
||||
FOREACH_CONST( CString, pHand->m_vsRefreshRowNames, sRowToRefreshName )
|
||||
{
|
||||
for( unsigned r=0; r<m_Rows.size(); r++ )
|
||||
{
|
||||
OptionRow &rowOther = *m_Rows[r];
|
||||
|
||||
if( rowOther.GetRowType() == OptionRow::ROW_EXIT )
|
||||
continue;
|
||||
|
||||
OptionRowHandler *pHandOther = OptionRowHandlers[r];
|
||||
OptionRowDefinition &defOther = m_OptionRowAlloc[r];
|
||||
|
||||
if( *sRowToRefreshName == pHandOther->m_sName )
|
||||
{
|
||||
pHandOther->Reload( defOther );
|
||||
ScreenOptions::RefreshRowChoices( r, defOther );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM )
|
||||
{
|
||||
switch( SM )
|
||||
|
||||
@@ -24,8 +24,6 @@ protected:
|
||||
protected:
|
||||
void HandleScreenMessage( const ScreenMessage SM );
|
||||
|
||||
virtual void ChangeValueInRow( PlayerNumber pn, int iDelta, bool Repeat );
|
||||
|
||||
virtual void ImportOptions( int row );
|
||||
virtual void ExportOptions( int row );
|
||||
virtual void ImportOptionsForPlayer( PlayerNumber pn ); // used by ScreenPlayerOptions
|
||||
|
||||
Reference in New Issue
Block a user