From 211f9b852a907e7f1b2d842bc5de79fcd1e32ca9 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 10 Jun 2004 22:47:51 +0000 Subject: [PATCH] use Dialog --- stepmania/src/Actor.cpp | 4 ++-- stepmania/src/ActorCommands.cpp | 4 ++-- stepmania/src/ActorFrame.cpp | 4 ++-- stepmania/src/BGAnimation.cpp | 4 ++-- stepmania/src/DifficultyIcon.cpp | 4 ++-- stepmania/src/NoteSkinManager.cpp | 6 ++--- stepmania/src/RageBitmapTexture.cpp | 4 ++-- stepmania/src/RageMath.cpp | 6 ++--- stepmania/src/Sprite.cpp | 12 +++++----- stepmania/src/ThemeManager.cpp | 35 ++++++++++++++--------------- 10 files changed, 41 insertions(+), 42 deletions(-) diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index c7e1e16801..055c253d6d 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -6,7 +6,7 @@ #include "RageMath.h" #include "GameConstantsAndTypes.h" #include "RageLog.h" -#include "arch/ArchHooks/ArchHooks.h" +#include "arch/Dialog/Dialog.h" #include "GameState.h" /* XXX: ugly dependency */ @@ -745,7 +745,7 @@ void Actor::HandleCommand( const ParsedCommand &command ) { CString sError = ssprintf( "Actor::HandleCommand: Unrecognized command name '%s'.", sName.c_str() ); LOG->Warn( sError ); - HOOKS->MessageBoxOK( sError ); + Dialog::OK( sError ); } CheckHandledParams; diff --git a/stepmania/src/ActorCommands.cpp b/stepmania/src/ActorCommands.cpp index ddc59dac67..02f8a439ab 100644 --- a/stepmania/src/ActorCommands.cpp +++ b/stepmania/src/ActorCommands.cpp @@ -2,14 +2,14 @@ #include "ActorCommands.h" #include "RageUtil.h" #include "RageLog.h" -#include "arch/ArchHooks/ArchHooks.h" +#include "arch/Dialog/Dialog.h" void IncorrectActorParametersWarning( const ParsedCommand &command, int iMaxIndexAccessed ) { const CString sError = ssprintf( "Actor::HandleCommand: Wrong number of parameters in command '%s'. Expected %d but there are %u.", command.GetOriginalCommandString().c_str(), iMaxIndexAccessed+1, unsigned(command.vTokens.size()) ); LOG->Warn( sError ); - HOOKS->MessageBoxOK( sError ); + Dialog::OK( sError ); } void ParsedCommandToken::Set( const CString &sToken ) diff --git a/stepmania/src/ActorFrame.cpp b/stepmania/src/ActorFrame.cpp index 54b989deb5..e8b363515f 100644 --- a/stepmania/src/ActorFrame.cpp +++ b/stepmania/src/ActorFrame.cpp @@ -1,6 +1,6 @@ #include "global.h" #include "ActorFrame.h" -#include "arch/ArchHooks/ArchHooks.h" +#include "arch/Dialog/Dialog.h" #include "RageUtil.h" void ActorFrame::AddChild( Actor* pActor ) @@ -9,7 +9,7 @@ void ActorFrame::AddChild( Actor* pActor ) // check that this Actor isn't already added. vector::iterator iter = find( m_SubActors.begin(), m_SubActors.end(), pActor ); if( iter != m_SubActors.end() ) - HOOKS->MessageBoxOK( ssprintf("Actor \"%s\" adds child \"%s\" more than once", m_sName.c_str(), pActor->m_sName.c_str()) ); + Dialog::OK( ssprintf("Actor \"%s\" adds child \"%s\" more than once", m_sName.c_str(), pActor->m_sName.c_str()) ); #endif ASSERT( pActor ); diff --git a/stepmania/src/BGAnimation.cpp b/stepmania/src/BGAnimation.cpp index 9db8eae9cd..9f3eb596f7 100644 --- a/stepmania/src/BGAnimation.cpp +++ b/stepmania/src/BGAnimation.cpp @@ -10,7 +10,7 @@ #include "RageFile.h" #include "ActorUtil.h" #include "LuaHelpers.h" -#include "arch/ArchHooks/ArchHooks.h" +#include "arch/Dialog/Dialog.h" const int MAX_LAYERS = 1000; @@ -133,7 +133,7 @@ void BGAnimation::LoadFromAniDir( CString sAniDir ) #define REQUIRED_GET_VALUE( szName, valueOut ) \ if( !ini.GetValue( "Scroller", szName, valueOut ) ) \ - HOOKS->MessageBoxOK( ssprintf("File '%s' is missing the value Scroller::%s", sPathToIni.c_str(), szName) ); + Dialog::OK( ssprintf("File '%s' is missing the value Scroller::%s", sPathToIni.c_str(), szName) ); float fSecondsPerItem = 1; int iNumItemsToDraw = 7; diff --git a/stepmania/src/DifficultyIcon.cpp b/stepmania/src/DifficultyIcon.cpp index 98f65bc979..ca4ba05cd6 100644 --- a/stepmania/src/DifficultyIcon.cpp +++ b/stepmania/src/DifficultyIcon.cpp @@ -14,7 +14,7 @@ #include "Steps.h" #include "GameState.h" #include "RageDisplay.h" -#include "arch/ArchHooks/ArchHooks.h" +#include "arch/Dialog/Dialog.h" #include "Trail.h" DifficultyIcon::DifficultyIcon() @@ -34,7 +34,7 @@ bool DifficultyIcon::Load( CString sPath ) NUM_DIFFICULTIES, NUM_DIFFICULTIES*2, iStates ); - HOOKS->MessageBoxOK( sError ); + Dialog::OK( sError ); } StopAnimating(); return true; diff --git a/stepmania/src/NoteSkinManager.cpp b/stepmania/src/NoteSkinManager.cpp index 1236aa6560..b1f2ee8629 100644 --- a/stepmania/src/NoteSkinManager.cpp +++ b/stepmania/src/NoteSkinManager.cpp @@ -10,7 +10,7 @@ #include "GameManager.h" #include "arch/arch.h" #include "RageDisplay.h" -#include "arch/ArchHooks/ArchHooks.h" +#include "arch/Dialog/Dialog.h" #include "PrefsManager.h" @@ -258,7 +258,7 @@ CString NoteSkinManager::GetPathToFromNoteSkinAndButton( CString NoteSkin, CStri "Verify that this redirect is correct.", sPath.c_str(), sNewFileName.c_str()); - if( ArchHooks::retry == HOOKS->MessageBoxAbortRetryIgnore(message) ) + if( Dialog::AbortRetryIgnore(message) == Dialog::retry ) { FlushDirCache(); g_PathCache.clear(); @@ -297,7 +297,7 @@ CString NoteSkinManager::GetPathToFromDir( CString sDir, CString sFileName ) if( matches.size() > 1 ) { CString sError = "Multiple files match '"+sDir+sFileName+"'. Please remove all but one of these files."; - HOOKS->MessageBoxOK( sError ); + Dialog::OK( sError ); } return matches[0]; diff --git a/stepmania/src/RageBitmapTexture.cpp b/stepmania/src/RageBitmapTexture.cpp index 57b5e38aa3..301424b886 100644 --- a/stepmania/src/RageBitmapTexture.cpp +++ b/stepmania/src/RageBitmapTexture.cpp @@ -6,7 +6,7 @@ #include "RageException.h" #include "RageDisplay.h" #include "RageTypes.h" -#include "arch/ArchHooks/ArchHooks.h" +#include "arch/Dialog/Dialog.h" #include "PrefsManager.h" #include "SDL.h" @@ -288,7 +288,7 @@ void RageBitmapTexture::Create() fBetterSourceWidth, fBetterSourceHeight, fBetterFrameWidth, fBetterFrameHeight ); LOG->Warn( sWarning ); - HOOKS->MessageBoxOK( sWarning, "FRAME_DIMENSIONS_WARNING" ); + Dialog::OK( sWarning, "FRAME_DIMENSIONS_WARNING" ); } } diff --git a/stepmania/src/RageMath.cpp b/stepmania/src/RageMath.cpp index 912bf937dc..f9c96922ea 100644 --- a/stepmania/src/RageMath.cpp +++ b/stepmania/src/RageMath.cpp @@ -4,7 +4,7 @@ #include "RageUtil.h" #include "RageDisplay.h" #include "RageLog.h" -#include "arch/ArchHooks/ArchHooks.h" +#include "arch/Dialog/Dialog.h" void RageVec3ClearBounds( RageVector3 &mins, RageVector3 &maxs ) { @@ -258,7 +258,7 @@ void RageMatrixCommand( CString sCommandString, RageMatrix &mat ) { CString sError = ssprintf( "MatrixCommand: Unrecognized matrix command name '%s' in command string '%s'.", sName.c_str(), sCommandString.c_str() ); LOG->Warn( sError ); - HOOKS->MessageBoxOK( sError ); + Dialog::OK( sError ); continue; } @@ -267,7 +267,7 @@ void RageMatrixCommand( CString sCommandString, RageMatrix &mat ) { CString sError = ssprintf( "MatrixCommand: Wrong number of parameters in command '%s'. Expected %d but there are %d.", join(",",asTokens).c_str(), iMaxIndexAccessed+1, (int)asTokens.size() ); LOG->Warn( sError ); - HOOKS->MessageBoxOK( sError ); + Dialog::OK( sError ); continue; } diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index ef39436803..bb553c4fdc 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -11,7 +11,7 @@ #include "RageTexture.h" #include "SDL_utils.h" #include "ActorUtil.h" -#include "arch/ArchHooks/ArchHooks.h" +#include "arch/Dialog/Dialog.h" Sprite::Sprite() { @@ -124,13 +124,13 @@ retry: if(asElementPaths.size() == 0) { CString sMessage = ssprintf( "The sprite file '%s' points to a texture '%s' which doesn't exist.", m_sSpritePath.c_str(), ID.filename.c_str() ); - switch( HOOKS->MessageBoxAbortRetryIgnore(sMessage) ) + switch( Dialog::AbortRetryIgnore(sMessage) ) { - case ArchHooks::abort: + case Dialog::abort: RageException::Throw( "Error reading value 'Texture' from %s.", m_sSpritePath.c_str() ); - case ArchHooks::retry: + case Dialog::retry: goto retry; - case ArchHooks::ignore: + case Dialog::ignore: return false; default: ASSERT(0); @@ -616,7 +616,7 @@ void Sprite::SetState( int iNewState ) else sError = ssprintf("A Sprite (\"%s\") tried to set state index %d but no texture is loaded.", this->m_sName.c_str(), iNewState ); - HOOKS->MessageBoxOK( sError ); + Dialog::OK( sError ); } CLAMP(iNewState, 0, (int)m_States.size()-1); diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index 3d87dfceaa..942300d860 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -12,8 +12,7 @@ #include "Font.h" #include "FontCharAliases.h" #include "RageDisplay.h" -#include "arch/ArchHooks/ArchHooks.h" -#include "arch/arch.h" +#include "arch/Dialog/Dialog.h" #include "RageFile.h" #include "ScreenManager.h" #include "StepMania.h" @@ -308,16 +307,16 @@ try_element_again: "'%s/%s/%s %s'. Please remove all but one of these matches.", sThemeName.c_str(), sCategory.c_str(), sClassName.c_str(), sElement.c_str() ); - switch( HOOKS->MessageBoxAbortRetryIgnore(message) ) + switch( Dialog::AbortRetryIgnore(message) ) { - case ArchHooks::abort: + case Dialog::abort: RageException::Throw( message ); break; - case ArchHooks::retry: + case Dialog::retry: FlushDirCache(); ReloadMetrics(); goto try_element_again; - case ArchHooks::ignore: + case Dialog::ignore: break; } } @@ -360,7 +359,7 @@ try_element_again: "Verify that this redirect is correct.", sPath.c_str(), sNewFileName.c_str()); - if( ArchHooks::retry == HOOKS->MessageBoxAbortRetryIgnore(message) ) + if( Dialog::AbortRetryIgnore(message) == Dialog::retry ) { FlushDirCache(); ReloadMetrics(); @@ -414,18 +413,18 @@ try_element_again: /* We can't fall back on _missing in Other: the file types are unknown. */ CString sMessage = "The theme element \"" + sCategory + "/" + sFileName +"\" is missing."; - ArchHooks::MessageBoxResult res; + Dialog::Result res; if( category != Other ) - res = HOOKS->MessageBoxAbortRetryIgnore(sMessage, "MissingThemeElement"); + res = Dialog::AbortRetryIgnore(sMessage, "MissingThemeElement"); else - res = HOOKS->MessageBoxRetryCancel(sMessage, "MissingThemeElement"); + res = Dialog::RetryCancel(sMessage, "MissingThemeElement"); switch( res ) { - case ArchHooks::retry: + case Dialog::retry: FlushDirCache(); ReloadMetrics(); goto try_element_again; - case ArchHooks::ignore: + case Dialog::ignore: LOG->Warn( "Theme element '%s/%s' could not be found in '%s' or '%s'.", sCategory.c_str(), @@ -440,8 +439,8 @@ try_element_again: Cache[sFileName] = GetPath( category, "", "_missing" ); return Cache[sFileName]; /* XXX: "abort" and "cancel" are synonyms; merge */ - case ArchHooks::abort: - case ArchHooks::cancel: + case Dialog::abort: + case Dialog::cancel: RageException::Throw( "Theme element '%s/%s' could not be found in '%s' or '%s'.", sCategory.c_str(), sFileName.c_str(), @@ -530,15 +529,15 @@ try_metric_again: CString sMessage = ssprintf( "The theme metric '%s-%s' is missing. Correct this and click Retry, or Cancel to break.",sClassName.c_str(),sValueName.c_str() ); - switch( HOOKS->MessageBoxAbortRetryIgnore(sMessage) ) + switch( Dialog::AbortRetryIgnore(sMessage) ) { - case ArchHooks::abort: + case Dialog::abort: break; // fall through - case ArchHooks::retry: + case Dialog::retry: FlushDirCache(); ReloadMetrics(); goto try_metric_again; - case ArchHooks::ignore: + case Dialog::ignore: return ""; default: ASSERT(0);