Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

GUIUtils.h

Go to the documentation of this file.
00001 
00002 // MathGUI = a WYSIWYG equation editor + a powerful math engine      //
00003 // Copyright (C) 2003 by Francesco Montorsi                          //
00004 //                                                                   //
00005 // This library is free software; you can redistribute it and/or     //
00006 // modify it under the terms of the GNU Lesser General Public        //
00007 // License as published by the Free Software Foundation; either      //
00008 // version 2.1 of the License, or (at your option) any later         //
00009 // version.                                                          //
00010 //                                                                   //
00011 // This library is distributed in the hope that it will be useful,   //
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of    //
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the      //
00014 // GNU Lesser General Public License for more details.               //
00015 //                                                                   //
00016 // You should have received a copy of the GNU Lesser General Public  //
00017 // License along with this program; if not, write to the Free        //
00018 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,   //
00019 // MA 02111-1307, USA.                                               //
00020 //                                                                   //
00021 // For any comment, suggestion or feature request, please contact    //
00022 // the administrator of the project at frm@users.sourceforge.net     //
00023 //                                                                   //
00032 
00033 
00034 
00035 #ifndef MATHGUI_GLOBALS_H
00036 #define MATHGUI_GLOBALS_H
00037 
00038 
00039 // for borland compiler
00040 #ifndef WX_PRECOMP
00041 #include <wx/wx.h>   // if precompilation is not supported, include wx.h
00042 #endif
00043 
00044 #include "mg/Setup.h"
00045 
00046 
00047 
00048 
00049 // -------------------
00050 // MACROS
00051 // -------------------
00052 
00057 #define mgSAFE_DELETE(x)               { if (x) delete x; x = NULL; }
00058 
00060 #define mgSAFE_DELETE_ARRAY(x)            { if (x) delete [] x; x = NULL; }
00061 
00062 #define mgSTILL_TO_IMPLEMENT()                                 \
00063    wxMessageBox(wxT("This feature still doesn't work... sorry."),    \
00064                wxT("Ops"), wxICON_INFORMATION | wxOK);
00065 
00066 
00067 
00068 
00069 // -------------------
00070 // DEFINES
00071 // -------------------
00072 
00073 // export & import dlgs
00074 #define mgEXPDLG_BASEID             11000
00075 #define mgIMPDLG_BASEID             12000
00076 
00077 // palettes
00078 #define mgGREEKDLG_BASEID           13000
00079 #define mgSYMBOLDLG_BASEID          14000
00080 #define mgSPECIALSYMDLG_BASEID         15000
00081 #define mgSOLVEDLG_BASEID           16000
00082 
00083 // miscellaneous
00084 #define mgOPTIONSDLG_BASEID            17000
00085 #define mgMATHMENU_BASEID           18000
00086 
00090 #define mgMATHBOX_BASEID            19000
00091 
00094 #define mgMATHGUI_HIGHEST_ID        20000
00095 
00096 
00097 // events ids
00098 #define mgMATHBOX_EVENTS_BASEID           wxEVT_USER_FIRST+100
00099 #define mgOPTIONSDLG_EVENTS_BASEID        wxEVT_USER_FIRST+200
00100 #define mgMATHGUI_GENERAL_EVENTS_BASEID      wxEVT_USER_FIRST+300
00101 
00102 #define mgMATHGUI_HIGHEST_EVENTS_ID       wxEVT_USER_FIRST+1000
00103 
00104 
00106 #define mgMATHGUI_GLOBAL_MSGWAIT    1000
00107 
00109 #define mgMATHGUI_GLOBAL_ERRORTMRID 256
00110 
00112 
00113 
00114 
00115 
00116 // ---------------------
00117 // MISCELLANEOUS
00118 // ---------------------
00119 
00123 bool wxViewHTMLFile(const wxString& url);
00124 
00125 
00126 
00127 enum MathCoreConfigPath {
00128    MATHCORE_BASE_CONFIGPATH = -1,
00129    MATHCORE_APPEARANCE_CONFIGPATH,
00130    MATHCORE_KEYBINDINGS_CONFIGPATH
00131 };
00132 
00133 
00146 wxString GetConfigPath(MathCoreConfigPath id = MATHCORE_BASE_CONFIGPATH, 
00147                   const wxString &toadd = wxEmptyString);
00148 
00149 
00150 
00151 
00152 // --------------------
00153 // MATHGUI LOG
00154 // --------------------
00155 
00156 #if defined(mgENABLE_LOG) && \
00157    !(defined(__GNUG__) && defined(__WXMSW__))   // actually there is an inexplicable bug when using MinGW and mcENABLE_LOG is defined...
00158 
00159    enum {
00160       mgLOG_Debug = 2048,     // MathGUI log levels start here
00161       mgLOG_Event,
00162       mgLOG_BoxEvent,
00163       mgLOG_User = 200
00164    };
00165 
00166 
00167    #define DECLARE_MATHGUI_LOG_FUNCTION(level)                         \
00168    extern void WXDLLEXPORT mgVLog##level(const wxChar *szFormat,       \
00169                                 va_list argptr);              \
00170    extern void WXDLLEXPORT mgLog##level(const wxChar *szFormat,        \
00171                                ...) ATTRIBUTE_PRINTF_1
00172 
00173 
00174    DECLARE_MATHGUI_LOG_FUNCTION(Debug);
00175    DECLARE_MATHGUI_LOG_FUNCTION(Event);
00176    DECLARE_MATHGUI_LOG_FUNCTION(BoxEvent);
00177 
00178 #else
00179 
00180    #ifdef __GNUG__
00181    
00182       // GCC accepts variadic macros and this avoids us a *lot* of
00183       // warnings about "statements with no effects" that it ouputs
00184       // if mcLOG is defined to nothing...
00185       #define mgLogDebug(...)                   {;}
00186       #define mgLogEvent(...)                   {;}
00187       #define mgLogBoxEvent(...)                {;}
00188    #else
00189 
00190       // If all compilers supported the variadic macros (macros with a variable
00191       // number of arguments, declared using ... and __VA_ARGS__), then it would
00192       // be simpler to write these macros !!
00193       #define mgLogDebug                  /* expand to nothing */
00194       #define mgLogEvent                  /* expand to nothing */
00195       #define mgLogBoxEvent               /* expand to nothing */
00196    #endif
00197 
00198 #endif      // mgENABLE_LOG
00199 
00200 #endif      // MATHGUI_GLOBALS_H
00201 
00202 


Documentation generated with Doxygen on Sun Feb 6 17:19:26 2005
Visit MathStudio home page for more info

[ Top ]