errors.h File Reference

(r1785/r1140)

Go to the source code of this file.

Classes

class  ErrorInfo
 Describe the error/warning/question that is to be displayed. Fields are: MonoOn ErrorMsg - Resource ID of the error message. Title - resource ID of the dialogue title string (optional) Button - array of up to 4 button string resource IDs. OK - the button which is the 'OK' or default button, i.e. the one which should be activated by Enter (this in the range 1-4). Cancel - the button which is the 'Cancel' button, i.e. the one which should be activated by Esc (this in the range 1-4). Help - the index of the button which is the 'Help' button (this in the range 1-4). MonoOff. More...
class  Error
 The Error class consists only of static variables, one for the ID of the error, another for the string, and another for the ID of the module that generated the error (0 if the error happened in the kernel). The string is a simple TCHAR array to avoid the need for dynamic memory allocation during error handling. These variables must be set whenever an error condition manifests itself. The class provides static functions to do this, which are called by the ERRORIF and NERROR macros. More...
class  Error::StackWalker

Defines

#define ERRORTYPE_NORMAL   0
#define ERRORTYPE_QUESTION   1
#define ERRORTYPE_WARNING   2
#define ERRORTYPE_ERROR   3
#define ERRORTYPE_SERIOUS   4
#define ERRORTYPE_ENSURE   5
#define ERROR(errID, retparam)
 This macro should be used to return from a function when an error condition has been detected. The rule in Camelot is that every function which might fail should return a BOOL indicating success or failure. Thus, retvalue will usually be FALSE. However, functions which return pointers can indicate error conditions by returning NULL, so the retvalue parameter is there to give extra functionality. Obviously, TRUE or FALSE (or NULL) tells us very little about why a function failed, so we have a class containing static variables which must be set each time a function fails. A calling routine can look at the error value to see what the error was, or use the string to present the error in an error box. The macro has two incarnations - within module code in a separate DLL it passes a Module ID, which allows the string finding functions to look in another resource, while within kernel code, it just passes the error ID. It looks at the symbol MODULE_ID to see if it is being defined within a module, and defines the appropriate behaviour. MODULE_ID should be defined as a unique module identifier in all code running in a module. It should not be defined in any other code. Warning: Windows.h defines ERROR as 0 for region functions. Use of this together with errors.h should be treated carefully. Like ERROR, except specially for Tools to use. If you are a Tool you can use the TOOLERROR macro which takes a third parameter, that of your tool ID. MODULE_ID does not need to be defined for this to work.
#define TOOLERROR(errID, retparam, toolid)
#define ERRORIF(cond, returnID, retvalue)
 This is a general purpose macro which is a bit like ENSURE, except that it really does return an error to the calling code. This macro should be used at the beginning of a member function, to test for the known conditions that the function works to. All functions should know what conditions they expect before they start, and they should fail if those conditions are not met. The condition should be a boolean expression which should evaluate to TRUE if an error condition has manifested itself, at which time the ERROR macro is executed, making the function return whatever you put in retvalue. Usually, retvalue will be FALSE, since most functions that fail are expected to return a BOOL. However, some functions can usefully return other error indicators. For example, a function which returns a pointer can return NULL to indicate an error. Thus, you can use the macro as:Like ERRORIF, except specially for Tools to use. If you are a Tool you can use the TOOLERROR macro which takes a third parameter, that of your tool ID. MODULE_ID does not need to be defined for this to work.
#define TOOLERRORIF(cond, returnID, retvalue, toolid)
#define INLINE_MARKERROR   1
#define MARKERROR_BODY(Line, File)   { LastErrorLine = Line; LastErrorFile = File; }
#define MAXERRORFORMATLENGTH   256
#define MARKWHERE   Error::MarkError( __LINE__, __FILE__ )
#define MARKWHEREDB
#define ERROR1RAW(errorID)   do { MARKWHEREDB; Error::XSetError( errorID ); } while(0)
#define ERROR1(retvalue, errorID)   do { MARKWHEREDB; Error::XSetError( errorID ); return (retvalue); } while(0)
#define ERROR1IF(condition, retvalue, errorID)   do { if (condition) ERROR1( retvalue, errorID ); } while(0)
#define ERROR1_MSG(retvalue, args)   do { MARKWHEREDB; Error::XSetError args ; return (retvalue); } while(0)
#define ERROR1IF_MSG(condition, retvalue, args)   do { if (condition) ERROR1_MSG( retvalue, args ); } while(0)
#define ERROR2RAW(literal)   do { MARKWHERE; Error::XSetErrorC(); } while(0)
#define ERROR2(retvalue, literal)   do { MARKWHERE; Error::XSetErrorC(); return (retvalue); } while(0)
#define ERROR2IF(condition, retvalue, literal)   do { if (condition) ERROR2( retvalue, literal ); } while(0)
#define ERROR2_PF(retvalue, args)   do { MARKWHERE; Error::XSetError args ; return (retvalue); } while(0)
#define ERROR2IF_PF(condition, retvalue, args)   do { if (condition) ERROR2_PF( retvalue, args ); } while(0)
#define ERROR3(literal)   do { } while (0)
#define ERROR3IF(condition, literal)   do { } while (0)
#define ERROR3_PF(args)   do { } while (0)
#define ERROR3IF_PF(condition, args)   do { } while (0)
#define TRACEUSER   1 ? (void)0 : Error::TraceUser
#define TRACEALL   TRACE
#define RELTRACE   Error::ReleaseTrace
#define TRACE   1 ? (void)0 : Error::TraceAll
#define TRACE0   1 ? (void)0 : Error::TraceAll
#define TRACET   1 ? (void)0 : Error::TraceAll
#define ASSERT(condition)   do { } while (0)
#define PORTNOTE(section, text)
#define PORTNOTETRACE(section, text)

Functions

INT32 CCAPI InformGeneral (UINT32 Error, UINT32 modID, UINT32 ErrorMsg, UINT32 Butt1, UINT32 Butt2, UINT32 Butt3, UINT32 Butt4, UINT32 OK, UINT32 Cancel)
INT32 CCAPI InformGeneral (UINT32 Error, ErrorInfo *pInfo, UINT32 ModID=0)
 The underlying function for [Tool-Module]Inform[Warning-Error].
void CCAPI InformLastError (UINT32 Error=3)
 Report the last error that was set with ERROR, ERRORIF, TOOLERROR et al. Always presents the user with an OK button. If there isn't an unreported error, does nothing.
INT32 InformError (UINT32 ErrorMsg=0, UINT32 Butt1=0, UINT32 Butt2=0, UINT32 Butt3=0, UINT32 Butt4=0, UINT32 OK=1, UINT32 Cancel=2)
 Do NOT call directly. This func is used by the ERROR3xx macros. It does the _stprintf-thing, then puts up an ensure-type dialog box. It exists only in debug builds. Error:MarkError should be called beforehand. Scope: Public Static.
INT32 ToolInformError (UINT32 ToolID, UINT32 ErrorMsg=0, UINT32 Butt1=0, UINT32 Butt2=0, UINT32 Butt3=0, UINT32 Butt4=0, UINT32 OK=1, UINT32 Cancel=2)
INT32 ModuleInformError (UINT32 ModID, UINT32 ErrorMsg=0, UINT32 Butt1=0, UINT32 Butt2=0, UINT32 Butt3=0, UINT32 Butt4=0, UINT32 OK=1, UINT32 Cancel=2)
INT32 InformError (ErrorInfo *pInfo)
INT32 ToolInformError (UINT32 ToolID, ErrorInfo *pInfo)
INT32 ModuleInformError (UINT32 ModID, ErrorInfo *pInfo)
INT32 InformSeriousError (UINT32 ErrorMsg=0, UINT32 Butt1=0, UINT32 Butt2=0, UINT32 Butt3=0, UINT32 Butt4=0, UINT32 OK=1, UINT32 Cancel=2)
INT32 ToolInformSeriousError (UINT32 ToolID, UINT32 ErrorMsg=0, UINT32 Butt1=0, UINT32 Butt2=0, UINT32 Butt3=0, UINT32 Butt4=0, UINT32 OK=1, UINT32 Cancel=2)
INT32 ModuleInformSeriousError (UINT32 ModID, UINT32 ErrorMsg=0, UINT32 Butt1=0, UINT32 Butt2=0, UINT32 Butt3=0, UINT32 Butt4=0, UINT32 OK=1, UINT32 Cancel=2)
INT32 InformSeriousError (ErrorInfo *pInfo)
INT32 ToolInformSeriousError (UINT32 ToolID, ErrorInfo *pInfo)
INT32 ModuleInformSeriousError (UINT32 ModID, ErrorInfo *pInfo)
INT32 InformWarning (UINT32 ErrorMsg=0, UINT32 Butt1=0, UINT32 Butt2=0, UINT32 Butt3=0, UINT32 Butt4=0, UINT32 OK=1, UINT32 Cancel=2)
INT32 ToolInformWarning (UINT32 ToolID, UINT32 ErrorMsg=0, UINT32 Butt1=0, UINT32 Butt2=0, UINT32 Butt3=0, UINT32 Butt4=0, UINT32 OK=1, UINT32 Cancel=2)
INT32 ModuleInformWarning (UINT32 ModID, UINT32 ErrorMsg=0, UINT32 Butt1=0, UINT32 Butt2=0, UINT32 Butt3=0, UINT32 Butt4=0, UINT32 OK=1, UINT32 Cancel=2)
INT32 InformWarning (ErrorInfo *pInfo)
INT32 ToolInformWarning (UINT32 ToolID, ErrorInfo *pInfo)
INT32 ModuleInformWarning (UINT32 ModID, ErrorInfo *pInfo)
UINT32 AskQuestion (UINT32 ErrorMsg=0, UINT32 Butt1=0, UINT32 Butt2=0, UINT32 Butt3=0, UINT32 Butt4=0, UINT32 OK=1, UINT32 Cancel=2)
UINT32 ToolAskQuestion (UINT32 ToolID, UINT32 ErrorMsg=0, UINT32 Butt1=0, UINT32 Butt2=0, UINT32 Butt3=0, UINT32 Butt4=0, UINT32 OK=1, UINT32 Cancel=2)
INT32 ModuleAskQuestion (UINT32 ModID, UINT32 ErrorMsg=0, UINT32 Butt1=0, UINT32 Butt2=0, UINT32 Butt3=0, UINT32 Butt4=0, UINT32 OK=1, UINT32 Cancel=2)
INT32 AskQuestion (ErrorInfo *pInfo)
INT32 ToolAskQuestion (UINT32 ToolID, ErrorInfo *pInfo)
INT32 ModuleAskQuestion (UINT32 ModID, ErrorInfo *pInfo)
INT32 InformMessage (UINT32 ErrorMsg=0, UINT32 Butt1=0, UINT32 Butt2=0, UINT32 Butt3=0, UINT32 Butt4=0, UINT32 OK=1, UINT32 Cancel=2)
INT32 ToolInformMessage (UINT32 ToolID, UINT32 ErrorMsg=0, UINT32 Butt1=0, UINT32 Butt2=0, UINT32 Butt3=0, UINT32 Butt4=0, UINT32 OK=1, UINT32 Cancel=2)
INT32 ModuleInformMessage (UINT32 ModID, UINT32 ErrorMsg=0, UINT32 Butt1=0, UINT32 Butt2=0, UINT32 Butt3=0, UINT32 Butt4=0, UINT32 OK=1, UINT32 Cancel=2)
INT32 InformMessage (ErrorInfo *pInfo)
INT32 ToolInformMessage (UINT32 ToolID, ErrorInfo *pInfo)
INT32 ModuleInformMessage (UINT32 ModID, ErrorInfo *pInfo)


Define Documentation

#define ASSERT condition   )     do { } while (0)
 

Definition at line 797 of file errors.h.

#define ERROR errID,
retparam   ) 
 

Value:

Error::SetError( errID, 0 ); \
return retparam;
This macro should be used to return from a function when an error condition has been detected. The rule in Camelot is that every function which might fail should return a BOOL indicating success or failure. Thus, retvalue will usually be FALSE. However, functions which return pointers can indicate error conditions by returning NULL, so the retvalue parameter is there to give extra functionality. Obviously, TRUE or FALSE (or NULL) tells us very little about why a function failed, so we have a class containing static variables which must be set each time a function fails. A calling routine can look at the error value to see what the error was, or use the string to present the error in an error box. The macro has two incarnations - within module code in a separate DLL it passes a Module ID, which allows the string finding functions to look in another resource, while within kernel code, it just passes the error ID. It looks at the symbol MODULE_ID to see if it is being defined within a module, and defines the appropriate behaviour. MODULE_ID should be defined as a unique module identifier in all code running in a module. It should not be defined in any other code. Warning: Windows.h defines ERROR as 0 for region functions. Use of this together with errors.h should be treated carefully. Like ERROR, except specially for Tools to use. If you are a Tool you can use the TOOLERROR macro which takes a third parameter, that of your tool ID. MODULE_ID does not need to be defined for this to work.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/8/93
See also:
ERROR; TOOLERRORIF; Error

Definition at line 382 of file errors.h.

#define ERROR1 retvalue,
errorID   )     do { MARKWHEREDB; Error::XSetError( errorID ); return (retvalue); } while(0)
 

Definition at line 754 of file errors.h.

#define ERROR1_MSG retvalue,
args   )     do { MARKWHEREDB; Error::XSetError args ; return (retvalue); } while(0)
 

Definition at line 756 of file errors.h.

#define ERROR1IF condition,
retvalue,
errorID   )     do { if (condition) ERROR1( retvalue, errorID ); } while(0)
 

Definition at line 755 of file errors.h.

#define ERROR1IF_MSG condition,
retvalue,
args   )     do { if (condition) ERROR1_MSG( retvalue, args ); } while(0)
 

Definition at line 757 of file errors.h.

#define ERROR1RAW errorID   )     do { MARKWHEREDB; Error::XSetError( errorID ); } while(0)
 

Definition at line 753 of file errors.h.

#define ERROR2 retvalue,
literal   )     do { MARKWHERE; Error::XSetErrorC(); return (retvalue); } while(0)
 

Definition at line 781 of file errors.h.

#define ERROR2_PF retvalue,
args   )     do { MARKWHERE; Error::XSetError args ; return (retvalue); } while(0)
 

Definition at line 783 of file errors.h.

#define ERROR2IF condition,
retvalue,
literal   )     do { if (condition) ERROR2( retvalue, literal ); } while(0)
 

Definition at line 782 of file errors.h.

#define ERROR2IF_PF condition,
retvalue,
args   )     do { if (condition) ERROR2_PF( retvalue, args ); } while(0)
 

Definition at line 784 of file errors.h.

#define ERROR2RAW literal   )     do { MARKWHERE; Error::XSetErrorC(); } while(0)
 

Definition at line 780 of file errors.h.

#define ERROR3 literal   )     do { } while (0)
 

Definition at line 786 of file errors.h.

#define ERROR3_PF args   )     do { } while (0)
 

Definition at line 788 of file errors.h.

#define ERROR3IF condition,
literal   )     do { } while (0)
 

Definition at line 787 of file errors.h.

#define ERROR3IF_PF condition,
args   )     do { } while (0)
 

Definition at line 789 of file errors.h.

#define ERRORIF cond,
returnID,
retvalue   ) 
 

Value:

if (cond)                           \
    {                                   \
        ERROR( returnID, retvalue );    \
    }
This is a general purpose macro which is a bit like ENSURE, except that it really does return an error to the calling code. This macro should be used at the beginning of a member function, to test for the known conditions that the function works to. All functions should know what conditions they expect before they start, and they should fail if those conditions are not met. The condition should be a boolean expression which should evaluate to TRUE if an error condition has manifested itself, at which time the ERROR macro is executed, making the function return whatever you put in retvalue. Usually, retvalue will be FALSE, since most functions that fail are expected to return a BOOL. However, some functions can usefully return other error indicators. For example, a function which returns a pointer can return NULL to indicate an error. Thus, you can use the macro as:Like ERRORIF, except specially for Tools to use. If you are a Tool you can use the TOOLERROR macro which takes a third parameter, that of your tool ID. MODULE_ID does not need to be defined for this to work.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/8/93
See also:
ERRORIF; TOOLERROR; Error

Definition at line 444 of file errors.h.

#define ERRORTYPE_ENSURE   5
 

Definition at line 119 of file errors.h.

#define ERRORTYPE_ERROR   3
 

Definition at line 117 of file errors.h.

#define ERRORTYPE_NORMAL   0
 

Definition at line 114 of file errors.h.

#define ERRORTYPE_QUESTION   1
 

Definition at line 115 of file errors.h.

#define ERRORTYPE_SERIOUS   4
 

Definition at line 118 of file errors.h.

#define ERRORTYPE_WARNING   2
 

Definition at line 116 of file errors.h.

#define INLINE_MARKERROR   1
 

Definition at line 463 of file errors.h.

#define MARKERROR_BODY Line,
File   )     { LastErrorLine = Line; LastErrorFile = File; }
 

Definition at line 466 of file errors.h.

#define MARKWHERE   Error::MarkError( __LINE__, __FILE__ )
 

Definition at line 746 of file errors.h.

#define MARKWHEREDB
 

Definition at line 750 of file errors.h.

#define MAXERRORFORMATLENGTH   256
 

Definition at line 468 of file errors.h.

#define PORTNOTE section,
text   ) 
 

Definition at line 817 of file errors.h.

#define PORTNOTETRACE section,
text   ) 
 

Definition at line 818 of file errors.h.

#define RELTRACE   Error::ReleaseTrace
 

Definition at line 792 of file errors.h.

#define TOOLERROR errID,
retparam,
toolid   ) 
 

Value:

Error::SetErrorTool(errID, toolid); \
return retparam;

Definition at line 394 of file errors.h.

#define TOOLERRORIF cond,
returnID,
retvalue,
toolid   ) 
 

Value:

if (cond)                                       \
    {                                               \
        TOOLERROR((UINT32)returnID, retvalue,toolid);   \
    }

Definition at line 451 of file errors.h.

#define TRACE   1 ? (void)0 : Error::TraceAll
 

Definition at line 794 of file errors.h.

#define TRACE0   1 ? (void)0 : Error::TraceAll
 

Definition at line 795 of file errors.h.

#define TRACEALL   TRACE
 

Definition at line 791 of file errors.h.

#define TRACET   1 ? (void)0 : Error::TraceAll
 

Definition at line 796 of file errors.h.

#define TRACEUSER   1 ? (void)0 : Error::TraceUser
 

Definition at line 790 of file errors.h.


Function Documentation

INT32 AskQuestion ErrorInfo pInfo  ) 
 

Definition at line 1645 of file errors.cpp.

01646 {
01647     return InformGeneral(ERRORTYPE_QUESTION, pInfo);
01648 }

UINT32 AskQuestion UINT32  ErrorMsg = 0,
UINT32  Butt1 = 0,
UINT32  Butt2 = 0,
UINT32  Butt3 = 0,
UINT32  Butt4 = 0,
UINT32  OK = 1,
UINT32  Cancel = 2
 

Definition at line 1624 of file errors.cpp.

01625 {
01626     return InformGeneral(ERRORTYPE_QUESTION, 0, ErrorMsg, 
01627                          Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01628 }

INT32 InformError ErrorInfo pInfo  ) 
 

Definition at line 1532 of file errors.cpp.

01533 {
01534     return InformGeneral(ERRORTYPE_ERROR, pInfo);
01535 }

INT32 InformError UINT32  ErrorMsg,
UINT32  Butt1,
UINT32  Butt2,
UINT32  Butt3,
UINT32  Butt4,
UINT32  OK,
UINT32  Cancel
 

Do NOT call directly. This func is used by the ERROR3xx macros. It does the _stprintf-thing, then puts up an ensure-type dialog box. It exists only in debug builds. Error:MarkError should be called beforehand. Scope: Public Static.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/10/94
Parameters:
printf-style arg list. [INPUTS]

Definition at line 1507 of file errors.cpp.

01508 {
01509     return InformGeneral(ERRORTYPE_ERROR, 0, ErrorMsg, 
01510                          Butt1, Butt2, Butt3, Butt4,
01511                          OK, Cancel);
01512 
01513 }

INT32 CCAPI InformGeneral UINT32  Error,
ErrorInfo pInfo,
UINT32  ModID
 

The underlying function for [Tool-Module]Inform[Warning-Error].

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
04/07/94
Parameters:
Error - the type of error (e.g. ERRORTYPE_SERIOUS) [INPUTS] pInfo - pointer to the ErrorInfo object which desvribes this 'error'. ModID - module ID, if required (may be 0).
Returns:
ID of the button that was pressed (NB. NOT the index of the button - i.e. it returns a resource ID).
See also:
InformWarning; InformGeneral; ToolInformWarning; ToolInformError; ModuleInformWarning; ModuleInformError

Definition at line 754 of file errors.cpp.

00755 {
00756     if (!pInfo) return _R(IDS_OK); // Catch this early
00757     INT32 num = InformGeneral(Error,ModID, pInfo->ErrorMsg, 
00758                   pInfo->Button[0],pInfo->Button[1],pInfo->Button[2],pInfo->Button[3],
00759                   pInfo->OK,pInfo->Cancel);
00760     return num?pInfo->Button[num-1]:_R(IDS_OK);
00761     
00762 }

INT32 CCAPI InformGeneral UINT32  Error,
UINT32  modID,
UINT32  ErrorMsg,
UINT32  Butt1,
UINT32  Butt2,
UINT32  Butt3,
UINT32  Butt4,
UINT32  OK,
UINT32  Cancel
 

Definition at line 434 of file errors.cpp.

00437 {    
00438     // Make sure there is at least one valid button.
00439     if (Butt1 == 0) Butt1 = _R(IDS_OK);
00440 
00441     if (Error::ErrorBoxRecurse)
00442     {
00443         // Oh dear oh dear. Someone wants to put up an error box in the error handler. This is
00444         // **BAD** news. The most likely cause is an exception within this routine (or the other
00445         // InformGeneral).
00446         TRACE( _T("Recursive InformGeneral - Error in error handler! (1)\n"));
00447         // Don't risk putting up another error box - just return OK & hope for the best
00448         Beep(); // shouldn't cause too much trouble
00449         return(OK);
00450     }
00451 
00452     Error::ErrorBoxRecurse++;
00453     if (ErrorMsg != 0)
00454     {
00455         // It's a new error message
00456         Error::SetError(ErrorMsg, modID);
00457     }
00458 
00459     // Make sure we haven't already reported this error!
00460     ENSURE((!ErrorHasBeenReported), 
00461            "InformGeneral: This error has already been reported!");
00462 
00463     // In retail builds, we report the error anyway, just in case - it's better to have
00464     // two errors reported than none at all!
00465 
00466     // we should get our bitmap from the OS
00467     ResourceID TitleID = 0;
00468 
00469     ResourceID DebugReport = 0;
00470 
00471     wxArtID bitmap=wxART_MISSING_IMAGE;
00472 
00473     switch (Error)
00474     {
00475         case ERRORTYPE_NORMAL:
00476             // No sound for this one - it's just a message; nothing to shout about.
00477             bitmap = wxART_INFORMATION;
00478             TitleID = _R(IDS_ERRORBOX_NORMAL);
00479             break;
00480 
00481         case ERRORTYPE_QUESTION:
00482             //MessageBeep(MB_ICONQUESTION);
00483             bitmap = wxART_QUESTION;
00484             TitleID = _R(IDS_ERRORBOX_NORMAL);
00485             break;
00486 
00487         case ERRORTYPE_WARNING:
00488             //MessageBeep(MB_ICONASTERISK);
00489             bitmap = wxART_WARNING;
00490             TitleID = _R(IDS_ERRORBOX_WARNING);
00491             break;
00492 
00493         case ERRORTYPE_SERIOUS:
00494             //MessageBeep(MB_ICONHAND);
00495             bitmap = wxART_ERROR;
00496             TitleID = _R(IDS_ERRORBOX_SERIOUS);
00497             DebugReport = _R(IDS_ERRORBOX_DEBUGREPORT);
00498             break;
00499 
00500         case ERRORTYPE_ENSURE:
00501             //MessageBeep(MB_ICONHAND);
00502             bitmap = wxART_ERROR;
00503             TitleID = _R(IDS_ERRORBOX_ENSURE);
00504             DebugReport = _R(IDS_ERRORBOX_DEBUGREPORT);
00505             break;
00506 
00507         case ERRORTYPE_ERROR:
00508         default:
00509             //MessageBeep(MB_ICONEXCLAMATION);
00510             bitmap = wxART_ERROR;
00511             TitleID = _R(IDS_ERRORBOX_ERROR);
00512             break;
00513 
00514     }
00515 
00516     // We really should detect an error here, and if so use a stock wxMessageBox, but that
00517     // doesn't seem to support help (oh dear).
00518     // but in anticipation of that being fixed, we use a pointer
00519 
00520     wxDialog * pBox = new CamErrorDialog(TitleID);
00521 
00522     if (!pBox)
00523     {
00524         Beep();
00525         Error::ErrorBoxRecurse--;
00526         return OK;
00527     }
00528 
00529 #ifdef __WXMAC__
00530     pBox->SetExtraStyle(wxDIALOG_EX_METAL);
00531     pBox->SetBackgroundStyle(wxBG_STYLE_COLOUR);
00532     pBox->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
00533 #endif
00534 
00535     // Note we add these to the dialog as soon as we can. Thus delete pBox will take
00536     // care of them
00537     wxBoxSizer* pVSizer = new wxBoxSizer(wxVERTICAL);
00538     if (!pVSizer)
00539     {
00540         Beep();
00541         Error::ErrorBoxRecurse--;
00542         delete pBox;
00543         return OK;
00544     }
00545     pBox->SetSizer(pVSizer);
00546 
00547     wxBoxSizer* pMessageSizer = new wxBoxSizer(wxHORIZONTAL);
00548     if (!pMessageSizer)
00549     {
00550         Beep();
00551         Error::ErrorBoxRecurse--;
00552         delete pBox;
00553         return OK;
00554     }
00555     pVSizer->Add(pMessageSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00556 
00557 
00558     CamArtProvider * pArtProv = CamArtProvider::Get();
00559     // Art provider may not have been initialized...
00560     if (pArtProv)
00561     {
00562         wxStaticBitmap* pStaticBitmap = new wxStaticBitmap( pBox, -1,
00563                                                             wxArtProvider::GetBitmap(bitmap, wxART_MESSAGE_BOX),
00564                                                             wxDefaultPosition, wxDefaultSize, 0 );
00565         if (!pStaticBitmap)
00566         {
00567             Beep();
00568             Error::ErrorBoxRecurse--;
00569             delete pBox;
00570             return OK;
00571         }
00572         pMessageSizer->Add(pStaticBitmap, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
00573     }
00574 
00575     // Perform manual expansion of newline escape sequences...
00576     wxString temp = (TCHAR *)Error::GetErrorString();
00577     temp.Replace(_T("\\n"), _T("\n"), TRUE);
00578 
00579     //wxTextCtrl* pMessage = new wxTextCtrl( pBox, -1, (TCHAR *)Error::GetErrorString(),
00580     //                                     wxDefaultPosition, wxSize(400, -1),
00581     //                                     wxTE_MULTILINE|wxTE_READONLY|wxTE_CENTRE|wxNO_BORDER );
00582 
00583     wxStaticText* pMessage = new wxStaticText( pBox, -1, temp,
00584                                            wxDefaultPosition, wxSize(400, -1),
00585                                            wxALIGN_CENTRE|wxNO_BORDER );
00586     if (!pMessage)
00587     {
00588         Beep();
00589         Error::ErrorBoxRecurse--;
00590         delete pBox;
00591         return OK;
00592     }
00593 
00594     CamResource::DoneInit();
00595 
00596     pMessage->Wrap(400);
00597     //pMessage->Enable(false); // this annoyingly does not grey it
00598     //pMessage->SetBackgroundColour(pBox->GetBackgroundColour());
00599     pMessageSizer->Add(pMessage, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxFIXED_MINSIZE, 5);
00600 
00601     wxBoxSizer* pButtonSizer = new wxBoxSizer(wxHORIZONTAL);
00602     if (!pButtonSizer)
00603     {
00604         Beep();
00605         Error::ErrorBoxRecurse--;
00606         delete pBox;
00607         return OK;
00608     }
00609     pVSizer->Add(pButtonSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
00610 
00611 #define EB_MAXBUTS 7
00612     wxButton * pButt[EB_MAXBUTS]; // see help below, note we don't use zero, 5 is reserved for help
00613     ResourceID butres[EB_MAXBUTS];
00614     butres[0]=0;
00615     butres[1]=Butt1;
00616     butres[2]=Butt2;
00617     butres[3]=Butt3;
00618     butres[4]=Butt4;
00619     butres[5]=0; // for _R(IDS_HELP) - see below
00620     butres[6]=DebugReport;
00621 
00622 #if !defined(EXCLUDE_FROM_RALPH)
00623     // See if there is any on-line help associated with the given warning/error message.
00624     // If there is then we will add a "Help" button to the dialog.
00625     if (CanHelpUser(Error::GetErrorNumber()))
00626         butres[5]=_R(IDS_HELP);
00627 #endif
00628     
00629     INT32 butt;
00630     for (butt=0; butt<EB_MAXBUTS; butt++)
00631     {
00632         if (butres[butt])
00633         {
00634             pButt[butt] = ((CamErrorDialog *)pBox)->AddErrorButton(pButtonSizer, CamResource::GetText(butres[butt]),
00635                                                                 butres[butt]);
00636             if (!pButt[butt])
00637             {
00638                 Beep();
00639                 Error::ErrorBoxRecurse--;
00640                 delete pBox;
00641                 return OK;
00642             }
00643 
00644 #ifndef HAVE_DEBUGREPORT
00645             if (butt==6)
00646             {
00647                 pButt[butt]->Enable(FALSE);
00648             }
00649 #endif
00650 
00651         }
00652         else
00653             pButt[butt]=NULL;
00654     }
00655 
00656     // Set the default
00657     if ( ((UINT32)OK <EB_MAXBUTS) && butres[OK] && pButt[OK])
00658     {
00659         pButt[OK]->SetDefault();
00660         pBox->SetDefaultItem(pButt[OK]);
00661     }
00662 
00663     pBox->GetSizer()->Fit(pBox);
00664     pBox->GetSizer()->SetSizeHints(pBox);
00665     pBox->Centre();
00666 
00667     // Disable the system's functionality for serious errors (i.e. stop rendering etc).
00668     if (Error == ERRORTYPE_SERIOUS || Error == ERRORTYPE_ENSURE) CCamApp::DisableSystem(pBox);
00669 
00670     if ( Error::IsInRenderThread() )
00671         TRACE( _T("InformGeneral called within RenderThread => serious rendering error"));
00672 
00673     // Bodge because ReleaseCapture() sometimes doesn't send WM_CANCELMODE (e.g. to custom controls) which
00674     // appears to be a bug somewhere in the Windows API
00675     if (wxWindow::GetCapture()) wxWindow::GetCapture()->ReleaseMouse();
00676 
00677 #if !defined(EXCLUDE_FROM_RALPH)
00678 #ifndef EXCLUDE_FROM_XARALX
00679 // Keep Control Helper system informed
00680     ControlHelper::InformModalDialogOpened();
00681 #endif
00682     // Bodge so error boxes are given focus when bars/galleries are being created
00683     BaseBar::StartErrorBox();
00684 #endif
00685 
00686     // 'Do' the dialog
00687     ResourceID pressed = pBox->ShowModal();
00688     INT32 result = Cancel;
00689 
00690     for (butt=0; butt<EB_MAXBUTS; butt++)
00691     {
00692         if (butres[butt] == pressed)
00693             result = butt;
00694     }
00695 
00696     ErrStatus = ERRORSTAT_NONE;
00697 
00698     delete pBox;
00699 
00700 #if !defined(EXCLUDE_FROM_RALPH)
00701     // Make sure we forget the old help content.
00702     SetNextMsgHelpContext(0);
00703 
00704 #ifndef EXCLUDE_FROM_XARALX
00705     // Keep Control Helper system informed
00706     ControlHelper::InformModalDialogClosed();
00707 #endif
00708 
00709     // Bodge so error boxes are given focus when bars/galleries are being created
00710     BaseBar::FinishErrorBox();
00711 #endif
00712 
00713     if ( Error::IsInRenderThread() )
00714     {
00715         TRACE( _T("In RenderThread so clearing up system"));
00716         Error::RenderThreadReset();
00717         CamProfile::AtBase(CAMPROFILE_OTHER);
00718     }
00719 
00720     // Enable system if necessary.
00721     if (Error == ERRORTYPE_SERIOUS || Error == ERRORTYPE_ENSURE) CCamApp::EnableSystem();
00722 
00723     // We don't want to report this error again.
00724     ErrorHasBeenReported = TRUE;
00725     Error::ClearError();
00726         
00727     Error::ErrorBoxRecurse--;
00728 
00729     // if we were in a drag operation, cancel it (to prevent invalid drag state) fixes #11455
00730     DragManagerOp::AbortDrag();
00731 
00732     return result;
00733 }

void CCAPI InformLastError UINT32   ) 
 

Report the last error that was set with ERROR, ERRORIF, TOOLERROR et al. Always presents the user with an OK button. If there isn't an unreported error, does nothing.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/8/93
Parameters:
ErrorType is the error type (e.g. ERRORTYPE_WARNING) Defaults to ERRORTYPE_ERROR [INPUTS] THIS PARAM IS NOW IGNORED.
None [OUTPUTS]
Returns:
None
See also:
ERROR; ERRORIF; TOOLERROR

Definition at line 783 of file errors.cpp.

00784 {
00785     if (ErrStatus != ERRORSTAT_NONE)
00786     {
00787         InformError();
00788         ErrStatus = ERRORSTAT_NONE;
00789     }
00790 }

INT32 InformMessage ErrorInfo pInfo  ) 
 

Definition at line 1687 of file errors.cpp.

01688 {
01689     return InformGeneral(ERRORTYPE_NORMAL, pInfo);
01690 }

INT32 InformMessage UINT32  ErrorMsg = 0,
UINT32  Butt1 = 0,
UINT32  Butt2 = 0,
UINT32  Butt3 = 0,
UINT32  Butt4 = 0,
UINT32  OK = 1,
UINT32  Cancel = 2
 

Definition at line 1664 of file errors.cpp.

01665 {
01666     return InformGeneral(ERRORTYPE_NORMAL, 0, ErrorMsg, 
01667                          Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01668 
01669 }

INT32 InformSeriousError ErrorInfo pInfo  ) 
 

Definition at line 1571 of file errors.cpp.

01572 {
01573     return InformGeneral(ERRORTYPE_SERIOUS, pInfo);
01574 }

INT32 InformSeriousError UINT32  ErrorMsg = 0,
UINT32  Butt1 = 0,
UINT32  Butt2 = 0,
UINT32  Butt3 = 0,
UINT32  Butt4 = 0,
UINT32  OK = 1,
UINT32  Cancel = 2
 

Definition at line 1550 of file errors.cpp.

01551 {
01552     return InformGeneral(ERRORTYPE_SERIOUS, 0, ErrorMsg, 
01553                          Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01554 }

INT32 InformWarning ErrorInfo pInfo  ) 
 

Definition at line 1605 of file errors.cpp.

01606 {
01607     return InformGeneral(ERRORTYPE_WARNING, pInfo);
01608 }

INT32 InformWarning UINT32  ErrorMsg = 0,
UINT32  Butt1 = 0,
UINT32  Butt2 = 0,
UINT32  Butt3 = 0,
UINT32  Butt4 = 0,
UINT32  OK = 1,
UINT32  Cancel = 2
 

Definition at line 1586 of file errors.cpp.

01587 {
01588 
01589     return InformGeneral(ERRORTYPE_WARNING, 0, ErrorMsg, 
01590                          Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01591 }

INT32 ModuleAskQuestion UINT32  ModID,
ErrorInfo pInfo
 

Definition at line 1657 of file errors.cpp.

01658 {
01659     return InformGeneral(ERRORTYPE_QUESTION, pInfo, ModID);
01660 }

INT32 ModuleAskQuestion UINT32  ModID,
UINT32  ErrorMsg = 0,
UINT32  Butt1 = 0,
UINT32  Butt2 = 0,
UINT32  Butt3 = 0,
UINT32  Butt4 = 0,
UINT32  OK = 1,
UINT32  Cancel = 2
 

Definition at line 1638 of file errors.cpp.

01639 {
01640     return InformGeneral(ERRORTYPE_QUESTION, ModID, ErrorMsg, 
01641                          Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01642 }

INT32 ModuleInformError UINT32  ModID,
ErrorInfo pInfo
 

Definition at line 1544 of file errors.cpp.

01545 {
01546     return InformGeneral(ERRORTYPE_ERROR, pInfo, ModID);
01547 }

INT32 ModuleInformError UINT32  ModID,
UINT32  ErrorMsg = 0,
UINT32  Butt1 = 0,
UINT32  Butt2 = 0,
UINT32  Butt3 = 0,
UINT32  Butt4 = 0,
UINT32  OK = 1,
UINT32  Cancel = 2
 

Definition at line 1524 of file errors.cpp.

01525 {
01526     return InformGeneral(ERRORTYPE_ERROR, ModID, ErrorMsg, 
01527                          Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01528 
01529 }

INT32 ModuleInformMessage UINT32  ModID,
ErrorInfo pInfo
 

Definition at line 1699 of file errors.cpp.

01700 {
01701     return InformGeneral(ERRORTYPE_NORMAL, pInfo, ModID);
01702 }

INT32 ModuleInformMessage UINT32  ModID,
UINT32  ErrorMsg = 0,
UINT32  Butt1 = 0,
UINT32  Butt2 = 0,
UINT32  Butt3 = 0,
UINT32  Butt4 = 0,
UINT32  OK = 1,
UINT32  Cancel = 2
 

Definition at line 1680 of file errors.cpp.

01681 {
01682     return InformGeneral(ERRORTYPE_NORMAL, ModID, ErrorMsg, 
01683                          Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01684 }

INT32 ModuleInformSeriousError UINT32  ModID,
ErrorInfo pInfo
 

Definition at line 1581 of file errors.cpp.

01582 {
01583     return InformGeneral(ERRORTYPE_SERIOUS, pInfo, ModID);
01584 }

INT32 ModuleInformSeriousError UINT32  ModID,
UINT32  ErrorMsg = 0,
UINT32  Butt1 = 0,
UINT32  Butt2 = 0,
UINT32  Butt3 = 0,
UINT32  Butt4 = 0,
UINT32  OK = 1,
UINT32  Cancel = 2
 

Definition at line 1564 of file errors.cpp.

01565 {
01566     return InformGeneral(ERRORTYPE_SERIOUS, ModID, ErrorMsg, 
01567                          Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01568 }

INT32 ModuleInformWarning UINT32  ModID,
ErrorInfo pInfo
 

Definition at line 1617 of file errors.cpp.

01618 {
01619     return InformGeneral(ERRORTYPE_WARNING, pInfo, ModID);
01620 }

INT32 ModuleInformWarning UINT32  ModID,
UINT32  ErrorMsg = 0,
UINT32  Butt1 = 0,
UINT32  Butt2 = 0,
UINT32  Butt3 = 0,
UINT32  Butt4 = 0,
UINT32  OK = 1,
UINT32  Cancel = 2
 

Definition at line 1599 of file errors.cpp.

01600 {
01601     return InformGeneral(ERRORTYPE_WARNING, ModID, ErrorMsg, 
01602                          Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01603 }

INT32 ToolAskQuestion UINT32  ToolID,
ErrorInfo pInfo
 

Definition at line 1651 of file errors.cpp.

01652 {
01653     return InformGeneral(ERRORTYPE_QUESTION, pInfo, Tool::GetModuleID(ToolID));
01654 }

UINT32 ToolAskQuestion UINT32  ToolID,
UINT32  ErrorMsg = 0,
UINT32  Butt1 = 0,
UINT32  Butt2 = 0,
UINT32  Butt3 = 0,
UINT32  Butt4 = 0,
UINT32  OK = 1,
UINT32  Cancel = 2
 

Definition at line 1630 of file errors.cpp.

01631 {
01632     return InformGeneral(ERRORTYPE_QUESTION, Tool::GetModuleID(ToolID), ErrorMsg, 
01633                          Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01634 }

INT32 ToolInformError UINT32  ToolID,
ErrorInfo pInfo
 

Definition at line 1538 of file errors.cpp.

01539 {
01540     return InformGeneral(ERRORTYPE_ERROR, pInfo, Tool::GetModuleID(ToolID));
01541 }

INT32 ToolInformError UINT32  ToolID,
UINT32  ErrorMsg = 0,
UINT32  Butt1 = 0,
UINT32  Butt2 = 0,
UINT32  Butt3 = 0,
UINT32  Butt4 = 0,
UINT32  OK = 1,
UINT32  Cancel = 2
 

Definition at line 1516 of file errors.cpp.

01517 {
01518     return InformGeneral(ERRORTYPE_ERROR, Tool::GetModuleID(ToolID), ErrorMsg, 
01519                          Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01520 
01521 }

INT32 ToolInformMessage UINT32  ToolID,
ErrorInfo pInfo
 

Definition at line 1693 of file errors.cpp.

01694 {
01695     return InformGeneral(ERRORTYPE_NORMAL, pInfo, Tool::GetModuleID(ToolID));
01696 }

INT32 ToolInformMessage UINT32  ToolID,
UINT32  ErrorMsg = 0,
UINT32  Butt1 = 0,
UINT32  Butt2 = 0,
UINT32  Butt3 = 0,
UINT32  Butt4 = 0,
UINT32  OK = 1,
UINT32  Cancel = 2
 

Definition at line 1672 of file errors.cpp.

01673 {
01674     return InformGeneral(ERRORTYPE_NORMAL, Tool::GetModuleID(ToolID), ErrorMsg, 
01675                          Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01676 
01677 }

INT32 ToolInformSeriousError UINT32  ToolID,
ErrorInfo pInfo
 

Definition at line 1576 of file errors.cpp.

01577 {
01578     return InformGeneral(ERRORTYPE_SERIOUS, pInfo, Tool::GetModuleID(ToolID));
01579 }

INT32 ToolInformSeriousError UINT32  ToolID,
UINT32  ErrorMsg = 0,
UINT32  Butt1 = 0,
UINT32  Butt2 = 0,
UINT32  Butt3 = 0,
UINT32  Butt4 = 0,
UINT32  OK = 1,
UINT32  Cancel = 2
 

Definition at line 1557 of file errors.cpp.

01558 {
01559     return InformGeneral(ERRORTYPE_SERIOUS, Tool::GetModuleID(ToolID), ErrorMsg, 
01560                          Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01561 }

INT32 ToolInformWarning UINT32  ToolID,
ErrorInfo pInfo
 

Definition at line 1611 of file errors.cpp.

01612 {
01613     return InformGeneral(ERRORTYPE_WARNING, pInfo, Tool::GetModuleID(ToolID));
01614 }

INT32 ToolInformWarning UINT32  ToolID,
UINT32  ErrorMsg = 0,
UINT32  Butt1 = 0,
UINT32  Butt2 = 0,
UINT32  Butt3 = 0,
UINT32  Butt4 = 0,
UINT32  OK = 1,
UINT32  Cancel = 2
 

Definition at line 1593 of file errors.cpp.

01594 {
01595     return InformGeneral(ERRORTYPE_WARNING, Tool::GetModuleID(ToolID), ErrorMsg, 
01596                          Butt1, Butt2, Butt3, Butt4, OK, Cancel);
01597 }


Generated on Sat Nov 10 03:49:31 2007 for Camelot by  doxygen 1.4.4