#define hacks for smtools. Clean this up later.
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
#include "global.h"
|
||||
#include "Dialog.h"
|
||||
#include "DialogDriver.h"
|
||||
#if !defined(SMPACKAGE)
|
||||
#include "PrefsManager.h"
|
||||
#endif
|
||||
#include "RageUtil.h"
|
||||
#include "RageLog.h"
|
||||
#include "arch/arch.h"
|
||||
@@ -73,22 +75,24 @@ void Dialog::Shutdown()
|
||||
|
||||
static bool MessageIsIgnored( CString sID )
|
||||
{
|
||||
#if !defined(SMPACKAGE)
|
||||
vector<CString> asList;
|
||||
split( PREFSMAN->m_sIgnoredMessageWindows, ",", asList );
|
||||
for( unsigned i = 0; i < asList.size(); ++i )
|
||||
if( !sID.CompareNoCase(asList[i]) )
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
void Dialog::IgnoreMessage( CString sID )
|
||||
{
|
||||
/* We can't ignore messages before PREFSMAN is around. */
|
||||
#if !defined(SMPACKAGE)
|
||||
if( PREFSMAN == NULL )
|
||||
{
|
||||
if( sID != "" && LOG )
|
||||
LOG->Warn( "Dialog: message \"%s\" set ID too early for ignorable messages", sID.c_str() );
|
||||
|
||||
LOG->Warn( "Dialog: message \"%s\" set ID too early for ignorable messages", sID.c_str() );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -103,6 +107,7 @@ void Dialog::IgnoreMessage( CString sID )
|
||||
asList.push_back( sID );
|
||||
PREFSMAN->m_sIgnoredMessageWindows.Set( join(",",asList) );
|
||||
PREFSMAN->SavePrefsToDisk();
|
||||
#endif
|
||||
}
|
||||
|
||||
void Dialog::Error( CString sMessage, CString sID )
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#include "global.h"
|
||||
#include "DialogDriver_Win32.h"
|
||||
#include "RageUtil.h"
|
||||
#include "CommonMetrics.h" // for WINDOW_TITLE
|
||||
#if !defined(SMPACKAGE)
|
||||
#include "CommonMetrics.h"
|
||||
#endif
|
||||
#include "ThemeManager.h"
|
||||
#include "ProductInfo.h"
|
||||
|
||||
@@ -9,7 +11,9 @@
|
||||
#include "archutils/win32/GotoURL.h"
|
||||
#include "archutils/win32/RestartProgram.h"
|
||||
#include "archutils/win32/WindowsResources.h"
|
||||
#if !defined(SMPACKAGE)
|
||||
#include "archutils/win32/GraphicsWindow.h"
|
||||
#endif
|
||||
|
||||
static bool g_bHush;
|
||||
static CString g_sMessage;
|
||||
@@ -65,17 +69,35 @@ static BOOL CALLBACK OKWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static HWND GetHwnd()
|
||||
{
|
||||
#if !defined(SMPACKAGE)
|
||||
return GraphicsWindow::GetHwnd();
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static CString GetWindowTitle()
|
||||
{
|
||||
#if !defined(SMPACKAGE)
|
||||
return CommonMetrics::WINDOW_TITLE.IsLoaded() ? CommonMetrics::WINDOW_TITLE.GetValue() : PRODUCT_NAME;
|
||||
#else
|
||||
return PRODUCT_NAME;
|
||||
#endif
|
||||
}
|
||||
|
||||
void DialogDriver_Win32::OK( CString sMessage, CString sID )
|
||||
{
|
||||
g_bAllowHush = sID != "";
|
||||
g_sMessage = sMessage;
|
||||
AppInstance handle;
|
||||
DialogBox( handle.Get(), MAKEINTRESOURCE(IDD_OK), GraphicsWindow::GetHwnd(), OKWndProc );
|
||||
DialogBox( handle.Get(), MAKEINTRESOURCE(IDD_OK), ::GetHwnd(), OKWndProc );
|
||||
if( g_bAllowHush && g_bHush )
|
||||
Dialog::IgnoreMessage( sID );
|
||||
}
|
||||
|
||||
#if !defined(SMPACKAGE)
|
||||
static CString g_sErrorString;
|
||||
|
||||
static BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||
@@ -131,21 +153,22 @@ static BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
void DialogDriver_Win32::Error( CString sError, CString sID )
|
||||
{
|
||||
#if !defined(SMPACKAGE)
|
||||
g_sErrorString = sError;
|
||||
|
||||
// throw up a pretty error dialog
|
||||
AppInstance handle;
|
||||
DialogBox( handle.Get(), MAKEINTRESOURCE(IDD_ERROR_DIALOG), NULL, ErrorWndProc );
|
||||
#endif
|
||||
}
|
||||
|
||||
Dialog::Result DialogDriver_Win32::AbortRetryIgnore( CString sMessage, CString ID )
|
||||
{
|
||||
CString sWindowTitle = CommonMetrics::WINDOW_TITLE.IsLoaded() ? CommonMetrics::WINDOW_TITLE.GetValue() : "";
|
||||
|
||||
switch( MessageBox(GraphicsWindow::GetHwnd(), sMessage, sWindowTitle, MB_ABORTRETRYIGNORE|MB_DEFBUTTON3 ) )
|
||||
switch( MessageBox(::GetHwnd(), sMessage, ::GetWindowTitle(), MB_ABORTRETRYIGNORE|MB_DEFBUTTON3 ) )
|
||||
{
|
||||
case IDABORT: return Dialog::abort;
|
||||
case IDRETRY: return Dialog::retry;
|
||||
@@ -156,9 +179,7 @@ Dialog::Result DialogDriver_Win32::AbortRetryIgnore( CString sMessage, CString I
|
||||
|
||||
Dialog::Result DialogDriver_Win32::AbortRetry( CString sMessage, CString sID )
|
||||
{
|
||||
CString sWindowTitle = CommonMetrics::WINDOW_TITLE.IsLoaded() ? CommonMetrics::WINDOW_TITLE.GetValue() : "";
|
||||
|
||||
switch( MessageBox(GraphicsWindow::GetHwnd(), sMessage, sWindowTitle, MB_RETRYCANCEL) )
|
||||
switch( MessageBox(::GetHwnd(), sMessage, ::GetWindowTitle(), MB_RETRYCANCEL) )
|
||||
{
|
||||
case IDRETRY: return Dialog::retry;
|
||||
default: ASSERT(0);
|
||||
|
||||
Reference in New Issue
Block a user