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

MathMenu.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 //                                                                   //
00030 
00031 
00032 #ifndef MATHMENU_H
00033 #define MATHMENU_H
00034 
00035 // with this little class (mgMathBoxWndUser), we can create a 
00036 // mgMathMenu able to send commands both to a single, fixed mgMathBox 
00037 // or the mgMathBox which is the active one in a mgMathWnd
00038 #include "mg/MathBoxWndUser.h"
00039 #include "mg/GreekDlg.h"
00040 #include "mg/SpecialSymDlg.h"
00041 #include "mg/SymbolDlg.h"
00042 
00043 // this class uses mgOptKeyBindingsPanel
00044 #include "mg/OptKeyBindings.h"
00045 
00046 // wxFileName is required
00047 #include <wx/filename.h>
00048 
00049 // optimization for GCC compiler
00050 #ifdef __GNUG__
00051 #pragma interface "MathMenu.h"
00052 #endif
00053 
00054 
00055 // IDs used in this dialog
00056 #define MATHMENU_FILE_BASEID                 mgMATHMENU_BASEID
00057 #define MATHMENU_EDIT_BASEID                 mgMATHMENU_BASEID+20
00058 #define MATHMENU_MATH_BASEID                 mgMATHMENU_BASEID+40
00059 #define MATHMENU_VIEW_BASEID                 mgMATHMENU_BASEID+60
00060 #define MATHMENU_HELP_BASEID                 mgMATHMENU_BASEID+80
00061 
00062 // file commands
00063 #define IDM_MATHMENU_FILE_IMPORT             MATHMENU_FILE_BASEID+1
00064 #define IDM_MATHMENU_FILE_EXPORT_ASXHTML        MATHMENU_FILE_BASEID+2
00065 #define IDM_MATHMENU_FILE_EXPORT_ASIMAGE        MATHMENU_FILE_BASEID+3
00066 
00067 // edit commands
00068 #define IDM_MATHMENU_EDIT_CUT                MATHMENU_EDIT_BASEID+1
00069 #define IDM_MATHMENU_EDIT_COPY                  MATHMENU_EDIT_BASEID+2
00070 #define IDM_MATHMENU_EDIT_PASTE                 MATHMENU_EDIT_BASEID+3
00071 
00072 #define IDM_MATHMENU_EDIT_EDIT_EXP              MATHMENU_EDIT_BASEID+4
00073 #define IDM_MATHMENU_EDIT_EDIT_SUBSCRIPT        MATHMENU_EDIT_BASEID+5
00074 #define IDM_MATHMENU_EDIT_INSERT_FRACTION          MATHMENU_EDIT_BASEID+6
00075 #define IDM_MATHMENU_EDIT_INSERT_RADICAL        MATHMENU_EDIT_BASEID+7
00076 #define IDM_MATHMENU_EDIT_INSERT_FUNCTION       MATHMENU_EDIT_BASEID+8
00077 #define IDM_MATHMENU_EDIT_INSERT_SPECIAL        MATHMENU_EDIT_BASEID+9
00078 #define IDM_MATHMENU_EDIT_BOXES                 MATHMENU_EDIT_BASEID+10
00079 #define IDM_MATHMENU_EDIT_SYSTEM             MATHMENU_EDIT_BASEID+11
00080 
00081 #define IDM_MATHMENU_EDIT_NEWBOX             MATHMENU_EDIT_BASEID+12
00082 #define IDM_MATHMENU_EDIT_NEWTEXTBOX            MATHMENU_EDIT_BASEID+13
00083 #define IDM_MATHMENU_EDIT_NEWBOX_LIKELAST       MATHMENU_EDIT_BASEID+14
00084 #define IDM_MATHMENU_EDIT_DELETEBOX             MATHMENU_EDIT_BASEID+15
00085 #define IDM_MATHMENU_EDIT_NEWMATHLINE           MATHMENU_EDIT_BASEID+16
00086 #define IDM_MATHMENU_EDIT_NEWMATHLINE_LIKELAST     MATHMENU_EDIT_BASEID+17
00087 #define IDM_MATHMENU_EDIT_DELETEMATHLINE        MATHMENU_EDIT_BASEID+18
00088 
00089 #define IDM_MATHMENU_EDIT_OPTIONS               MATHMENU_EDIT_BASEID+19
00090 
00091 // math commands
00092 #define IDM_MATHMENU_MATH                    MATHMENU_MATH_BASEID+1
00093 #define IDM_MATHMENU_MATH_MULTIPLY              MATHMENU_MATH_BASEID+2
00094 #define IDM_MATHMENU_MATH_DIVIDE             MATHMENU_MATH_BASEID+3
00095 #define IDM_MATHMENU_MATH_MOVE                  MATHMENU_MATH_BASEID+4
00096 #define IDM_MATHMENU_MATH_RAISE                 MATHMENU_MATH_BASEID+5
00097 #define IDM_MATHMENU_MATH_EXPAND             MATHMENU_MATH_BASEID+6
00098 #define IDM_MATHMENU_MATH_SIMPLIFY              MATHMENU_MATH_BASEID+7
00099 #define IDM_MATHMENU_MATH_EVALUATE              MATHMENU_MATH_BASEID+8
00100 #define IDM_MATHMENU_MATH_SOLVE                 MATHMENU_MATH_BASEID+9
00101 
00102 
00103 // view commands
00104 #define IDM_MATHMENU_VIEW                    MATHMENU_VIEW_BASEID+1
00105 #define IDM_MATHMENU_VIEW_PALETTES              MATHMENU_VIEW_BASEID+2
00106 #define IDM_MATHMENU_VIEW_PALETTE_GREEK_ALPHABET   MATHMENU_VIEW_BASEID+3
00107 #define IDM_MATHMENU_VIEW_PALETTE_SPECIAL_SYMBOLS  MATHMENU_VIEW_BASEID+4
00108 #define IDM_MATHMENU_VIEW_PALETTE_SYMBOLS       MATHMENU_VIEW_BASEID+5
00109 #define IDM_MATHMENU_VIEW_DESCRIPTION           MATHMENU_VIEW_BASEID+7
00110 #define IDM_MATHMENU_VIEW_ALIGN_LEFT            MATHMENU_VIEW_BASEID+8
00111 #define IDM_MATHMENU_VIEW_ALIGN_CENTER          MATHMENU_VIEW_BASEID+9
00112 #define IDM_MATHMENU_VIEW_ALIGN_RIGHT           MATHMENU_VIEW_BASEID+10
00113 
00114 // help commands
00115 #define IDM_MATHMENU_HELP                    MATHMENU_HELP_BASEID+1
00116 #define IDM_MATHMENU_HELP_MAIN                  MATHMENU_HELP_BASEID+2
00117 #define IDM_MATHMENU_HELP_HOME_PAGE             MATHMENU_HELP_BASEID+3
00118 #define IDM_MATHMENU_HELP_PROJECT_PAGE          MATHMENU_HELP_BASEID+4
00119 #define IDM_MATHMENU_HELP_WISH_LIST             MATHMENU_HELP_BASEID+5
00120 #define IDM_MATHMENU_HELP_BUG_LIST              MATHMENU_HELP_BASEID+6
00121 #define IDM_MATHMENU_HELP_ABOUT                 MATHMENU_HELP_BASEID+7
00122 
00123 
00124 
00188 class mgMathMenu : public wxEvtHandler,         // wxEvtHandler MUST be the first (see wxWidget's wxEvtHandler docs)
00189                public mgMathBoxWndUser
00190 {
00192    wxFrame *m_pFrame;
00193 
00197    wxApp *m_pTheApp;
00198 
00200    wxLog *m_pLogger;
00201 
00203    wxPaletteFrame *m_pGreekAlphabet, *m_pSpecialSym, *m_pSym;
00204 
00207    wxString m_strHelpPath;
00208 
00209 public:
00210 
00217    mgMathMenu(mgMathWnd *pwnd, mgMathBox *pbox = NULL, 
00218       wxFrame *pframe = NULL, wxApp *app = NULL, 
00219       wxLog *plogger = NULL);
00220    virtual ~mgMathMenu();
00221 
00222 
00223    // Setters
00224    void SetPalettes(mgGreekPalette *p1 = NULL, 
00225                mgSpecialSymPalette *p2 = NULL, 
00226                mgSymbolPalette *p3 = NULL) {
00227       m_pGreekAlphabet = p1;
00228       m_pSpecialSym = p2;
00229       m_pSym = p3;
00230    }
00231 
00232    void Attach(wxFrame *p);
00233    void Detach();
00234 
00238    void SetHelpMainFile(const wxString &str);
00239 
00240 
00241 
00242    // ----------------------------------------------
00243    // Append functions
00244    //
00245    // They are static, so you can use them even 
00246    // without actually allocating a mgMathMenu,
00247    // even if an instance of this is required for
00248    // event handling
00249    // ----------------------------------------------
00250 
00251    static void AppendFileCommands(wxMenu *file);
00252    static void AppendEditCommands(wxMenu *edit, bool bUsingMathWnd = FALSE);
00253    static void AppendMathCommands(wxMenu *math);
00254    static void AppendViewCommands(wxMenu *view);
00255    static void AppendHelpCommands(wxMenu *help);
00256 
00257 
00258 
00263 
00264    // file menu handlers
00265    void OnFileExportAsXHTML( wxCommandEvent &event );
00266    void OnFileExportAsImage( wxCommandEvent &event );
00267    void OnFileImport( wxCommandEvent &event );
00268 
00269    // edit menu handlers
00270    void OnEditCut( wxCommandEvent &event );
00271    void OnEditCopy( wxCommandEvent &event );
00272    void OnEditPaste( wxCommandEvent &event );
00273    void OnEditNewBox( wxCommandEvent &event );
00274    void OnEditNewTextBox( wxCommandEvent &event );
00275    void OnEditNewBoxLikeLast( wxCommandEvent &event );
00276    void OnEditDeleteBox( wxCommandEvent &event );
00277    void OnEditNewMathLine( wxCommandEvent &event );
00278    void OnEditNewMathLineLikeLast( wxCommandEvent &event );
00279    void OnEditDeleteMathLine( wxCommandEvent &event );
00280    void OnEditInsertSpecial( wxCommandEvent &event );
00281    void OnEditInsertRadical( wxCommandEvent &event );
00282    void OnEditInsertFraction( wxCommandEvent &event );
00283    void OnEditInsertFunction( wxCommandEvent &event );
00284    void OnEditEditExp( wxCommandEvent &event );
00285    void OnEditEditSubscript( wxCommandEvent &event );
00286    void OnEditOptions( wxCommandEvent &event );
00287 
00288    // math menu handlers
00289    void OnMathEvaluate( wxCommandEvent &event );
00290    void OnMathMove( wxCommandEvent &event );
00291    void OnMathExpand( wxCommandEvent &event );
00292    void OnMathSimplify( wxCommandEvent &event );
00293    void OnMathDivideBy( wxCommandEvent &event );
00294    void OnMathMultiplyBy( wxCommandEvent &event );
00295    void OnMathSolve( wxCommandEvent &event );
00296 
00297    // view menu handlers
00298    void OnViewPaletteGreekAlphabet( wxCommandEvent &event );
00299    void OnViewPaletteSpecialSym( wxCommandEvent &event );
00300    void OnViewPaletteSym( wxCommandEvent &event );
00301 
00302    // help menu handlers
00303    void OnHelpWishList( wxCommandEvent &event );
00304    void OnHelpBugList( wxCommandEvent &event );
00305    void OnHelpAbout( wxCommandEvent &event );
00306    void OnHelpProjectPage( wxCommandEvent &event );
00307    void OnHelpHomePage( wxCommandEvent &event );
00308    void OnHelpMain( wxCommandEvent &event );
00309 
00311 
00312 private:
00313    // used by wxWindow framework
00314    DECLARE_CLASS(mgMathMenu)
00315    DECLARE_EVENT_TABLE()
00316 };
00317 
00318 #endif      // MATHMENU_H
00319 


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

[ Top ]