Trying to make a button that disable panic alerts popups please test

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2680 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee
2009-03-18 22:05:31 +00:00
parent da288c5780
commit dc9a4860b9
9 changed files with 48 additions and 46 deletions

View File

@ -1,6 +1,5 @@
#include "LogManager.h"
#include "Timer.h"
#include "../../Core/Src/PowerPC/PowerPC.h" // Core
LogManager *LogManager::m_logManager = NULL;

View File

@ -16,9 +16,6 @@
// http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////
// Include and declarations
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#include <stdio.h> // System
#include "Common.h" // Local
@ -26,20 +23,22 @@
bool DefaultMsgHandler(const char* caption, const char* text, bool yes_no, int Style);
static MsgAlertHandler msg_handler = DefaultMsgHandler;
/////////////////////////////
static bool AlertEnabled = true;
/* Select which of these functions that are used for message boxes. If wxWidgets is enabled
we will use wxMsgAlert() that is defined in main.cpp */
/* Select which of these functions that are used for message boxes. If
wxWidgets is enabled we will use wxMsgAlert() that is defined in main.cpp */
void RegisterMsgAlertHandler(MsgAlertHandler handler)
{
msg_handler = handler;
}
/////////////////////////////////////////////////////////////
/* This is the first stop for messages where the log is updated and the correct windows
is shown */
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// enable/disable the alert handler
void SetEnableAlert(bool enable) {
AlertEnabled = enable;
}
/* This is the first stop for gui alerts where the log is updated and the
correct windows is shown */
bool MsgAlert(const char* caption, bool yes_no, int Style, const char* format, ...)
{
// ---------------------------------
@ -54,17 +53,14 @@ bool MsgAlert(const char* caption, bool yes_no, int Style, const char* format, .
va_end(args);
ERROR_LOG(MASTER_LOG, "%s: %s", caption, buffer);
// -----------
if (msg_handler) {
if (msg_handler && AlertEnabled) {
ret = msg_handler(caption, buffer, yes_no, Style);
}
return ret;
}
/////////////////////////////////////////////////////////////
/* This is used in the No-GUI build */
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Default non library depended panic alert
bool DefaultMsgHandler(const char* caption, const char* text, bool yes_no, int Style)
{
#ifdef _WIN32

View File

@ -29,6 +29,7 @@ typedef bool (*MsgAlertHandler)(const char* caption, const char* text,
bool yes_no, int Style);
void RegisterMsgAlertHandler(MsgAlertHandler handler);
extern bool MsgAlert(const char* caption, bool yes_no, int Style, const char* format, ...);
void SetEnableAlert(bool enable);
#ifdef _WIN32
#define SuccessAlert(format, ...) MsgAlert("Information", false, INFORMATION, format, __VA_ARGS__)
@ -36,10 +37,10 @@ extern bool MsgAlert(const char* caption, bool yes_no, int Style, const char* fo
#define PanicYesNo(format, ...) MsgAlert("Warning", true, WARNING, format, __VA_ARGS__)
#define AskYesNo(format, ...) MsgAlert("Question", true, QUESTION, format, __VA_ARGS__)
#else
#define SuccessAlert(format, ...) MsgAlert("SUCCESS", false, INFORMATION, format, ##__VA_ARGS__)
#define PanicAlert(format, ...) MsgAlert("PANIC", false, WARNING, format, ##__VA_ARGS__)
#define PanicYesNo(format, ...) MsgAlert("PANIC", true, WARNING, format, ##__VA_ARGS__)
#define AskYesNo(format, ...) MsgAlert("ASK", true, QUESTION, format, ##__VA_ARGS__)
#define SuccessAlert(format, ...) MsgAlert("Information", false, INFORMATION, format, ##__VA_ARGS__)
#define PanicAlert(format, ...) MsgAlert("Warning", false, WARNING, format, ##__VA_ARGS__)
#define PanicYesNo(format, ...) MsgAlert("Warning", true, WARNING, format, ##__VA_ARGS__)
#define AskYesNo(format, ...) MsgAlert("Question", true, QUESTION, format, ##__VA_ARGS__)
#endif
#endif //MSGHANDLER