move dialog handling into a separate arch; it doesn't belong in ArchHooks
This commit is contained in:
@@ -0,0 +1,156 @@
|
||||
#include "global.h"
|
||||
#include "Dialog.h"
|
||||
#include "DialogDriver.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "RageUtil.h"
|
||||
|
||||
/* Hmm. I don't want this to depend on other arch drivers--we should be able to test
|
||||
* this without linking to them. We probably don't actually have to do that just by
|
||||
* #including the headers in arch_Win32.h, etc., but it's still messy ... */
|
||||
#if defined(WIN32)
|
||||
#include "DialogDriver_Win32.h"
|
||||
#endif
|
||||
|
||||
#if defined(DARWIN)
|
||||
#include "DialogDriver_Cocoa.h"
|
||||
#endif
|
||||
|
||||
static DialogDriver *g_pImpl = NULL;
|
||||
static DialogDriverNull g_pNullDriver;
|
||||
static bool g_bWindowed = false;
|
||||
|
||||
void Dialog::Init()
|
||||
{
|
||||
ASSERT( g_pImpl == NULL );
|
||||
|
||||
CString drivers = "win32,cocoa,null";
|
||||
CStringArray DriversToTry;
|
||||
split(drivers, ",", DriversToTry, true);
|
||||
|
||||
ASSERT( DriversToTry.size() != 0 );
|
||||
|
||||
CString Driver;
|
||||
for( unsigned i = 0; g_pImpl == NULL && i < DriversToTry.size(); ++i )
|
||||
{
|
||||
try {
|
||||
Driver = DriversToTry[i];
|
||||
|
||||
#if defined(HAVE_DIALOG_WIN32)
|
||||
if( !DriversToTry[i].CompareNoCase("Win32") ) g_pImpl = new DialogDriver_Win32;
|
||||
#endif
|
||||
#if defined(HAVE_DIALOG_COCOA)
|
||||
if( !DriversToTry[i].CompareNoCase("Cocoa") ) g_pImpl = new LoadingWindow_Cocoa;
|
||||
#endif
|
||||
if( !DriversToTry[i].CompareNoCase("Null") ) g_pImpl = new DialogDriverNull;
|
||||
}
|
||||
catch(...)//const RageException &e)
|
||||
{
|
||||
// if( LOG )
|
||||
// LOG->Info("Couldn't load driver %s: %s", DriversToTry[i].c_str(), e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Dialog::Shutdown()
|
||||
{
|
||||
ASSERT( g_pImpl != NULL );
|
||||
|
||||
}
|
||||
|
||||
static bool MessageIsIgnored( CString ID )
|
||||
{
|
||||
vector<CString> list;
|
||||
split( PREFSMAN->m_sIgnoredMessageWindows, ",", list );
|
||||
for( unsigned i = 0; i < list.size(); ++i )
|
||||
if( !ID.CompareNoCase(list[i]) )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void Dialog::IgnoreMessage( CString ID )
|
||||
{
|
||||
if( ID == "" )
|
||||
|
||||
if( MessageIsIgnored(ID) )
|
||||
return;
|
||||
|
||||
vector<CString> list;
|
||||
split( PREFSMAN->m_sIgnoredMessageWindows, ",", list );
|
||||
list.push_back( ID );
|
||||
PREFSMAN->m_sIgnoredMessageWindows = join( ",", list );
|
||||
PREFSMAN->SaveGlobalPrefsToDisk();
|
||||
}
|
||||
|
||||
void Dialog::Error( CString sMessage, CString ID )
|
||||
{
|
||||
if( ID != "" && MessageIsIgnored( ID ) )
|
||||
return;
|
||||
|
||||
g_pImpl->Error( sMessage, ID );
|
||||
}
|
||||
|
||||
void Dialog::SetWindowed( bool bWindowed )
|
||||
{
|
||||
g_bWindowed = bWindowed;
|
||||
}
|
||||
|
||||
void Dialog::OK( CString sMessage, CString ID )
|
||||
{
|
||||
if( ID != "" && MessageIsIgnored( ID ) )
|
||||
return;
|
||||
|
||||
// only show Dialog if windowed
|
||||
if( !g_bWindowed )
|
||||
g_pNullDriver.OK( sMessage, ID );
|
||||
else
|
||||
g_pImpl->OK( sMessage, ID ); // call derived version
|
||||
}
|
||||
|
||||
Dialog::Result Dialog::AbortRetryIgnore( CString sMessage, CString ID )
|
||||
{
|
||||
if( ID != "" && MessageIsIgnored( ID ) )
|
||||
return Dialog::AbortRetryIgnore( sMessage, ID );
|
||||
|
||||
// only show Dialog if windowed
|
||||
if( !g_bWindowed )
|
||||
return g_pNullDriver.AbortRetryIgnore( sMessage, ID );
|
||||
else
|
||||
return g_pImpl->AbortRetryIgnore( sMessage, ID ); // call derived version
|
||||
}
|
||||
|
||||
Dialog::Result Dialog::RetryCancel( CString sMessage, CString ID )
|
||||
{
|
||||
if( ID != "" && MessageIsIgnored( ID ) )
|
||||
return Dialog::RetryCancel( sMessage, ID );
|
||||
|
||||
// only show Dialog if windowed
|
||||
if( !g_bWindowed )
|
||||
return g_pNullDriver.RetryCancel( sMessage, ID );
|
||||
else
|
||||
return g_pImpl->RetryCancel( sMessage, ID ); // call derived version
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2003-2004 Glenn Maynard, 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.
|
||||
*/
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifndef DIALOG_BOX_H
|
||||
#define DIALOG_BOX_H
|
||||
|
||||
namespace Dialog
|
||||
{
|
||||
/* ID can be used to identify a class of messages, for "don't display this
|
||||
* dialog"-type prompts. */
|
||||
void Init();
|
||||
void Shutdown();
|
||||
|
||||
void SetWindowed( bool bWindowed );
|
||||
|
||||
enum Result { abort, retry, ignore, cancel };
|
||||
void Error( CString error, CString ID = "" );
|
||||
void OK( CString sMessage, CString ID = "" );
|
||||
Result AbortRetryIgnore( CString sMessage, CString ID = "" );
|
||||
Result RetryCancel( CString sMessage, CString ID = "" );
|
||||
|
||||
/* for DialogDrivers */
|
||||
void IgnoreMessage( CString ID );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2003-2004 Glenn Maynard, 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.
|
||||
*/
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef DIALOG_BOX_DRIVER_H
|
||||
#define DIALOG_BOX_DRIVER_H
|
||||
|
||||
#include "Dialog.h"
|
||||
|
||||
class DialogDriver
|
||||
{
|
||||
public:
|
||||
virtual void Error( CString sMessage, CString ID ) { printf("Error: %s\n", sMessage.c_str()); }
|
||||
virtual void OK( CString sMessage, CString ID ) {}
|
||||
virtual Dialog::Result AbortRetryIgnore( CString sMessage, CString ID ) { return Dialog::ignore; }
|
||||
virtual Dialog::Result RetryCancel( CString sMessage, CString ID ) { return Dialog::cancel; }
|
||||
|
||||
virtual ~DialogDriver() { }
|
||||
};
|
||||
|
||||
class DialogDriverNull: public DialogDriver { };
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2003-2004 Glenn Maynard, 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.
|
||||
*/
|
||||
@@ -0,0 +1,94 @@
|
||||
#include "global.h"
|
||||
#include "DialogDriver_Cocoa.h"
|
||||
#include "RageLog.h"
|
||||
#include "RageThreads.h"
|
||||
#include "RageUtil.h"
|
||||
#define Random Random_ // work around namespace pollution
|
||||
#include <Carbon/Carbon.h>
|
||||
#undef Random_
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
static SInt16 ShowAlert( int type, CFStringRef message, CFStringRef OK, CFStringRef cancel = NULL )
|
||||
{
|
||||
struct AlertStdCFStringAlertParamRec params = {kStdCFStringAlertVersionOne, true, false, OK, cancel, NULL,
|
||||
kAlertStdAlertOKButton, kAlertStdAlertCancelButton, kWindowAlertPositionParentWindowScreen, NULL};
|
||||
DialogRef dialog;
|
||||
SInt16 result;
|
||||
OSErr err;
|
||||
|
||||
CreateStandardAlert(type, message, NULL, ¶ms, &dialog);
|
||||
err = AutoSizeDialog(dialog);
|
||||
ASSERT(err == noErr);
|
||||
RunStandardAlert(dialog, NULL, &result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void DialogDriver_Cocoa::OK( CString sMessage, CString ID )
|
||||
{
|
||||
bool allowHush = ID != "";
|
||||
|
||||
CFStringRef message = CFStringCreateWithCString(NULL, sMessage, kCFStringEncodingASCII);
|
||||
SInt16 result = ShowAlert(kAlertNoteAlert, message, CFSTR("OK"), CFSTR("Don't show again"));
|
||||
|
||||
CFRelease(message);
|
||||
if( result == kAlertStdAlertCancelButton )
|
||||
Dialog::IgnoreMessage( ID );
|
||||
}
|
||||
|
||||
void DialogDriver_Cocoa::Error( CString sError, CString ID )
|
||||
{
|
||||
CFStringRef error = CFStringCreateWithCString( NULL, sError, kCFStringEncodingASCII );
|
||||
ShowAlert(kAlertStopAlert, error, CFSTR("OK"));
|
||||
|
||||
CFRelease(error);
|
||||
}
|
||||
|
||||
Dialog::Result DialogDriver_Cocoa::AbortRetryIgnore( CString sMessage, CString ID )
|
||||
{
|
||||
CFStringRef error = CFStringCreateWithCString( NULL, sMessage, kCFStringEncodingASCII );
|
||||
SInt16 result = ShowAlert( kAlertNoteAlert, error, CFSTR("Retry"), CFSTR("Ignore") );
|
||||
ArchHooks::MessageBoxResult ret;
|
||||
|
||||
CFRelease(error);
|
||||
switch (result)
|
||||
{
|
||||
case kAlertStdAlertOKButton:
|
||||
ret = retry;
|
||||
break;
|
||||
case kAlertStdAlertCancelButton:
|
||||
ret = ignore;
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
ret = ignore;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2003-2004 Steve Checkoway
|
||||
* 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.
|
||||
*/
|
||||
@@ -0,0 +1,41 @@
|
||||
#ifndef DIALOG_BOX_DRIVER_COCOA_H
|
||||
#define DIALOG_BOX_DRIVER_COCOA_H
|
||||
|
||||
#include "DialogDriver.h"
|
||||
|
||||
class DialogDriver_Cocoa: public DialogDriver
|
||||
{
|
||||
public:
|
||||
void Error(CString sError, CString ID);
|
||||
void OK(CString sMessage, CString ID);
|
||||
MessageBoxResult AbortRetryIgnore(CString sMessage, CString ID);
|
||||
};
|
||||
|
||||
#define HAVE_DIALOG_COCOA
|
||||
|
||||
#endif /* ARCH_HOOKS_DARWIN_H */
|
||||
|
||||
/*
|
||||
* (c) 2003-2004 Steve Checkoway
|
||||
* 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.
|
||||
*/
|
||||
@@ -0,0 +1,187 @@
|
||||
#include "global.h"
|
||||
#include "DialogDriver_Win32.h"
|
||||
#include "RageUtil.h"
|
||||
#include "ProductInfo.h"
|
||||
#include "DialogDriver.h"
|
||||
|
||||
#include "archutils/win32/AppInstance.h"
|
||||
#include "archutils/win32/GotoURL.h"
|
||||
#include "archutils/win32/RestartProgram.h"
|
||||
#include "archutils/win32/WindowsResources.h"
|
||||
|
||||
static bool g_Hush;
|
||||
static CString g_sMessage;
|
||||
static bool g_AllowHush;
|
||||
|
||||
static BOOL CALLBACK OKWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
switch( msg )
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
g_Hush = false;
|
||||
CString sMessage = g_sMessage;
|
||||
|
||||
sMessage.Replace( "\n", "\r\n" );
|
||||
HWND hush = GetDlgItem( hWnd, IDC_HUSH );
|
||||
int style = GetWindowLong(hush, GWL_STYLE);
|
||||
|
||||
if( g_AllowHush )
|
||||
style |= WS_VISIBLE;
|
||||
else
|
||||
style &= ~WS_VISIBLE;
|
||||
SetWindowLong( hush, GWL_STYLE, style );
|
||||
|
||||
SendDlgItemMessage(
|
||||
hWnd,
|
||||
IDC_MESSAGE,
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
(LPARAM)(LPCTSTR)sMessage
|
||||
);
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDOK:
|
||||
g_Hush = !!IsDlgButtonChecked(hWnd, IDC_HUSH);
|
||||
/* fall through */
|
||||
case IDCANCEL:
|
||||
EndDialog( hWnd, 0 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void DialogDriver_Win32::OK( CString sMessage, CString ID )
|
||||
{
|
||||
g_AllowHush = ID != "";
|
||||
g_sMessage = sMessage;
|
||||
AppInstance handle;
|
||||
DialogBox(handle.Get(), MAKEINTRESOURCE(IDD_OK), NULL, OKWndProc);
|
||||
if( g_AllowHush && g_Hush )
|
||||
Dialog::IgnoreMessage( ID );
|
||||
}
|
||||
|
||||
static CString g_sErrorString;
|
||||
|
||||
static BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
switch( msg )
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
CString sMessage = g_sErrorString;
|
||||
|
||||
sMessage.Replace( "\n", "\r\n" );
|
||||
|
||||
SendDlgItemMessage(
|
||||
hWnd,
|
||||
IDC_EDIT_ERROR,
|
||||
WM_SETTEXT,
|
||||
0,
|
||||
(LPARAM)(LPCTSTR)sMessage
|
||||
);
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_BUTTON_VIEW_LOG:
|
||||
{
|
||||
PROCESS_INFORMATION pi;
|
||||
STARTUPINFO si;
|
||||
ZeroMemory( &si, sizeof(si) );
|
||||
|
||||
CreateProcess(
|
||||
NULL, // pointer to name of executable module
|
||||
"notepad.exe log.txt", // pointer to command line string
|
||||
NULL, // process security attributes
|
||||
NULL, // thread security attributes
|
||||
false, // handle inheritance flag
|
||||
0, // creation flags
|
||||
NULL, // pointer to new environment block
|
||||
NULL, // pointer to current directory name
|
||||
&si, // pointer to STARTUPINFO
|
||||
&pi // pointer to PROCESS_INFORMATION
|
||||
);
|
||||
}
|
||||
break;
|
||||
case IDC_BUTTON_REPORT:
|
||||
GotoURL( "http://sourceforge.net/tracker/?func=add&group_id=37892&atid=421366" );
|
||||
break;
|
||||
case IDC_BUTTON_RESTART:
|
||||
Win32RestartProgram();
|
||||
/* not reached */
|
||||
ASSERT( 0 );
|
||||
|
||||
EndDialog( hWnd, 0 );
|
||||
break;
|
||||
|
||||
case IDOK:
|
||||
EndDialog( hWnd, 0 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void DialogDriver_Win32::Error( CString error, CString ID )
|
||||
{
|
||||
g_sErrorString = error;
|
||||
// throw up a pretty error dialog
|
||||
AppInstance handle;
|
||||
DialogBox(handle.Get(), MAKEINTRESOURCE(IDD_ERROR_DIALOG),
|
||||
NULL, ErrorWndProc);
|
||||
}
|
||||
|
||||
Dialog::Result DialogDriver_Win32::AbortRetryIgnore( CString sMessage, CString ID )
|
||||
{
|
||||
switch( MessageBox(NULL, sMessage, PRODUCT_NAME, MB_ABORTRETRYIGNORE|MB_DEFBUTTON2 ) )
|
||||
{
|
||||
case IDABORT: return Dialog::abort;
|
||||
case IDRETRY: return Dialog::retry;
|
||||
default: ASSERT(0);
|
||||
case IDIGNORE: return Dialog::ignore;
|
||||
}
|
||||
}
|
||||
|
||||
Dialog::Result DialogDriver_Win32::RetryCancel( CString sMessage, CString ID )
|
||||
{
|
||||
switch( MessageBox(NULL, sMessage, PRODUCT_NAME, MB_RETRYCANCEL ) )
|
||||
{
|
||||
case IDRETRY: return Dialog::retry;
|
||||
default: ASSERT(0);
|
||||
case IDCANCEL: return Dialog::cancel;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (c) 2003-2004 Glenn Maynard, 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.
|
||||
*/
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef DIALOG_BOX_DRIVER_WIN32_H
|
||||
#define DIALOG_BOX_DRIVER_WIN32_H
|
||||
|
||||
#include "DialogDriver.h"
|
||||
|
||||
class DialogDriver_Win32: public DialogDriver
|
||||
{
|
||||
public:
|
||||
void Error( CString sMessage, CString ID );
|
||||
void OK( CString sMessage, CString ID );
|
||||
Dialog::Result AbortRetryIgnore( CString sMessage, CString ID );
|
||||
Dialog::Result RetryCancel( CString sMessage, CString ID );
|
||||
};
|
||||
|
||||
#define HAVE_DIALOG_WIN32
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2003-2004 Glenn Maynard, 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.
|
||||
*/
|
||||
Reference in New Issue
Block a user