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

MathCore.h

Go to the documentation of this file.
00001 
00002 // MathCore = 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 //                                                                   //
00030 
00031 
00032 
00033 #ifndef MATHCORE_H
00034 #define MATHCORE_H
00035 
00036 // optimization for GCC compiler
00037 #ifdef __GNUG__
00038 #pragma interface "MathCore.h"
00039 #endif
00040 
00041 // required includes
00042 #include "mc/MathHelpers.h"
00043 #include <wx/xml2.h>    // a wxWidgets extension
00044 
00045 
00046 
00047 // the following classes will be defined later; we need to define
00048 // them here to let the compiler know about their existence
00049 class mcElement;
00050 class mcElementHelpers;
00051 class mcOperator;
00052 class mcFunction;
00053 class mcPolynomial;
00054 class mcMonomial;
00055 class mcNumber;
00056 class mcFraction;
00057 class mcBracket;
00058 class mcSymbol;
00059 class mcText;
00060 class mcElementArray;
00061 class mcExpContainer;
00062 class mcSymbolArray;
00063 class mcKey;
00064 class mcStyle;
00065 class mcSolverArray;
00066 
00067 
00069 #define mcDEFAULT_STEP_THRESHOLD       1.0
00070 
00071 
00082 class mcMathCore
00083 {
00084 protected:  // member variables
00085 
00088  static mcMathCore *g_pTheInstance;
00089 
00090  bool m_bGUIEnabled;  
00091  bool m_bIOEnabled;  
00092  bool m_bMathEnabled; 
00093 
00103  mcRealValue m_fStepThreshold;
00104 
00105 protected:  // functions
00106 
00107  void Init(bool bIO = TRUE, bool bMath = TRUE, bool bGUI = TRUE);
00108  void SetupGUI(void (*OnError)(const wxString &) = NULL);
00109  void SetupIO();
00110  void SetupMath();
00111 
00112  void CleanupGUI();
00113  void CleanupIO();
00114  void CleanupMath();
00115 
00116 
00117 public:
00118 
00120  mcMathCore();
00121 
00123  virtual ~mcMathCore();
00124 
00135  static mcMathCore *Get();
00136 
00141  static void Set(mcMathCore *);
00142 
00144  static bool isOk()  { return g_pTheInstance != NULL; }
00145 
00146 
00147 
00148 
00152 
00158  void SyntaxError(wxString str);
00159 
00171  //void SetUpMathCore(wxConfig *cfg, void (*OnError)(const wxString &) = NULL);
00172 
00176  static void Setup(bool bIO = TRUE, bool bMath = TRUE, bool bGUI = TRUE);
00177 
00179  static void Cleanup();
00180 
00183  bool isGUIEnabled() const;
00184 
00186  bool isMathEnabled() const;
00187 
00189  bool isIOEnabled() const;
00190 
00192 
00193 
00194 
00195 
00199 
00201  static mcSolverArray arrSolvers;
00202 
00204  static void LoadDefaultSolvers();
00205 
00207  mcRealValue GetStepThreshold() const   { return m_fStepThreshold; }
00208 
00210  void SetStepThreshold(const mcRealValue &n)  { m_fStepThreshold = n; }
00211 
00213 
00214 
00215 
00216 
00221 
00226  mcKey *m_pEditExpKey;
00227 
00231  mcKey *m_pEditSubscriptKey;
00232 
00233  mcKey *m_pDeleteKey;   
00234  mcKey *m_pCancelKey;    
00235  mcKey *m_pNewLineKey;   
00236 
00241  //bool MatchKeyEntry(wxKeyEvent &ke, mcKey &keyentry);
00242 
00246  bool MatchEditKeys(const mcKey &ke);
00247 
00249 
00250 
00251 
00252 
00253 
00257 
00260  int m_nMaxSharing;
00261 
00263  int m_nIndentationStep;
00264 
00267  static void (*OnError)(const wxString &);
00268 
00270 };
00271 
00272 
00273 #endif // MATHCORE_H
00274 


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

[ Top ]