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 // // 00025 // \file MathMenu.cpp 00026 // \brief Implements the mgMathMenu class. 00027 // \author Francesco Montorsi, Luciano Cattani 00028 // \date 17-9-2003 00030 00031 00032 00033 // optimization for GCC compiler 00034 #ifdef __GNUG__ 00035 #pragma implementation "MathMenu.h" 00036 #endif 00037 00038 00039 // includes 00040 #include "mg/mgprec.h" 00041 #include <wx/filename.h> // not included by wxprec.h 00042 #include <wx/image.h> 00043 #include <wx/statline.h> 00044 #include <wx/html/htmlwin.h> 00045 00046 #ifndef mgPRECOMP 00047 #include "mg/MathMenu.h" 00048 #include "mg/ExportDlg.h" 00049 #include "mg/ImportDlg.h" 00050 #include "mg/OptDlg.h" 00051 #include "mg/SolveDlg.h" 00052 #include "mg/GUIUtils.h" 00053 #endif 00054 00055 00056 00057 00058 // event table for mgMathMenu 00059 IMPLEMENT_CLASS(mgMathMenu, wxEvtHandler) 00060 BEGIN_EVENT_TABLE(mgMathMenu, wxEvtHandler) 00061 00062 // file menu 00063 EVT_MENU( IDM_MATHMENU_FILE_IMPORT, mgMathMenu::OnFileImport ) 00064 EVT_MENU( IDM_MATHMENU_FILE_EXPORT_ASXHTML, mgMathMenu::OnFileExportAsXHTML ) 00065 EVT_MENU( IDM_MATHMENU_FILE_EXPORT_ASIMAGE, mgMathMenu::OnFileExportAsImage ) 00066 00067 // edit menu 00068 EVT_MENU( IDM_MATHMENU_EDIT_CUT, mgMathMenu::OnEditCut ) 00069 EVT_MENU( IDM_MATHMENU_EDIT_COPY, mgMathMenu::OnEditCopy ) 00070 EVT_MENU( IDM_MATHMENU_EDIT_PASTE, mgMathMenu::OnEditPaste ) 00071 00072 EVT_MENU( IDM_MATHMENU_EDIT_EDIT_EXP, mgMathMenu::OnEditEditExp ) 00073 EVT_MENU( IDM_MATHMENU_EDIT_EDIT_SUBSCRIPT, mgMathMenu::OnEditEditSubscript ) 00074 00075 EVT_MENU( IDM_MATHMENU_EDIT_INSERT_FRACTION, mgMathMenu::OnEditInsertFraction ) 00076 EVT_MENU( IDM_MATHMENU_EDIT_INSERT_RADICAL, mgMathMenu::OnEditInsertRadical ) 00077 EVT_MENU( IDM_MATHMENU_EDIT_INSERT_FUNCTION, mgMathMenu::OnEditInsertFunction ) 00078 EVT_MENU( IDM_MATHMENU_EDIT_INSERT_SPECIAL, mgMathMenu::OnEditInsertSpecial ) 00079 00080 EVT_MENU( IDM_MATHMENU_EDIT_NEWBOX, mgMathMenu::OnEditNewBox ) 00081 EVT_MENU( IDM_MATHMENU_EDIT_NEWTEXTBOX, mgMathMenu::OnEditNewTextBox ) 00082 EVT_MENU( IDM_MATHMENU_EDIT_NEWBOX_LIKELAST, mgMathMenu::OnEditNewBoxLikeLast ) 00083 EVT_MENU( IDM_MATHMENU_EDIT_DELETEBOX, mgMathMenu::OnEditDeleteBox ) 00084 EVT_MENU( IDM_MATHMENU_EDIT_NEWMATHLINE, mgMathMenu::OnEditNewMathLine ) 00085 EVT_MENU( IDM_MATHMENU_EDIT_NEWMATHLINE_LIKELAST, mgMathMenu::OnEditNewMathLineLikeLast ) 00086 EVT_MENU( IDM_MATHMENU_EDIT_DELETEMATHLINE, mgMathMenu::OnEditDeleteMathLine ) 00087 00088 EVT_MENU( IDM_MATHMENU_EDIT_OPTIONS, mgMathMenu::OnEditOptions ) 00089 00090 // math menu 00091 EVT_MENU( IDM_MATHMENU_MATH_MULTIPLY, mgMathMenu::OnMathMultiplyBy ) 00092 EVT_MENU( IDM_MATHMENU_MATH_DIVIDE, mgMathMenu::OnMathDivideBy ) 00093 EVT_MENU( IDM_MATHMENU_MATH_SIMPLIFY, mgMathMenu::OnMathSimplify ) 00094 EVT_MENU( IDM_MATHMENU_MATH_EXPAND, mgMathMenu::OnMathExpand ) 00095 EVT_MENU( IDM_MATHMENU_MATH_EVALUATE, mgMathMenu::OnMathEvaluate ) 00096 EVT_MENU( IDM_MATHMENU_MATH_MOVE, mgMathMenu::OnMathMove ) 00097 EVT_MENU( IDM_MATHMENU_MATH_SOLVE, mgMathMenu::OnMathSolve ) 00098 00099 // view menu 00100 EVT_MENU( IDM_MATHMENU_VIEW_PALETTE_GREEK_ALPHABET, mgMathMenu::OnViewPaletteGreekAlphabet ) 00101 EVT_MENU( IDM_MATHMENU_VIEW_PALETTE_SPECIAL_SYMBOLS, mgMathMenu::OnViewPaletteSpecialSym ) 00102 EVT_MENU( IDM_MATHMENU_VIEW_PALETTE_SYMBOLS, mgMathMenu::OnViewPaletteSym ) 00103 00104 // help menu 00105 EVT_MENU( IDM_MATHMENU_HELP_MAIN, mgMathMenu::OnHelpMain ) 00106 EVT_MENU( IDM_MATHMENU_HELP_HOME_PAGE, mgMathMenu::OnHelpHomePage ) 00107 EVT_MENU( IDM_MATHMENU_HELP_PROJECT_PAGE, mgMathMenu::OnHelpProjectPage ) 00108 EVT_MENU( IDM_MATHMENU_HELP_ABOUT, mgMathMenu::OnHelpAbout ) 00109 EVT_MENU( IDM_MATHMENU_HELP_WISH_LIST, mgMathMenu::OnHelpWishList ) 00110 EVT_MENU( IDM_MATHMENU_HELP_BUG_LIST, mgMathMenu::OnHelpBugList ) 00111 00112 END_EVENT_TABLE() 00113 00114 00115 00116 00117 00118 // ------------------------------ 00119 // mcMATHMENU 00120 // ------------------------------ 00121 00122 mgMathMenu::mgMathMenu(mgMathWnd *pwnd, mgMathBox *pbox, wxFrame *pframe, 00123 wxApp *papp, wxLog *plogger) 00124 : wxEvtHandler(), mgMathBoxWndUser(pwnd, pbox) 00125 { 00126 // these are used by some special event handler 00127 m_pTheApp = papp; 00128 m_pLogger = plogger; 00129 00130 Attach(pframe); 00131 } 00132 00133 mgMathMenu::~mgMathMenu() 00134 { 00135 Detach(); 00136 } 00137 00138 00139 void mgMathMenu::Attach(wxFrame *p) 00140 { 00141 m_pFrame = p; 00142 00143 // hook this class as the top event handler for the given frame: 00144 // in this way we can intercept all the menu commands sent to 00145 // the frame and handle those regarding the menu entries with IDs 00146 // belonging to mgMathMenu... 00147 if (m_pFrame) 00148 m_pFrame->PushEventHandler(this); 00149 } 00150 00151 void mgMathMenu::Detach() 00152 { 00153 // remove this event handler from the hooked frame; 00154 // BE CAREFUL: if you call this function and *this is not 00155 // an event handler chained to given frame, a wxASSERT 00156 // will fail... 00157 if (m_pFrame) m_pFrame->RemoveEventHandler(this); 00158 00159 // now, reset the frame pointer to allow this class to 00160 // understand it is not chained anymore 00161 m_pFrame = NULL; 00162 } 00163 00164 void mgMathMenu::SetHelpMainFile(const wxString &str) 00165 { 00166 // convert the given path into a valid one 00167 wxFileName mainfile(str); 00168 mcASSERT(mainfile.DirExists(str), wxT("Invalid main help file !")); 00169 m_strHelpPath = mainfile.GetFullPath(); 00170 00171 // and set it to UNIX format: this variable will be used 00172 // with the ViewHTMLPage and thus requires to be a 00173 // valid URL 00174 m_strHelpPath.Replace(wxT("\\"), wxT("/")); 00175 if (m_strHelpPath.Last() != wxT('/')) 00176 m_strHelpPath += wxT("/"); 00177 } 00178 00179 00180 00181 00182 // ------------------------------ 00183 // mcMATHMENU - append functions 00184 // ------------------------------ 00185 00186 void mgMathMenu::AppendFileCommands(wxMenu *file) 00187 { 00188 // just add two commands: IMPORT & EXPORT 00189 file->Append( IDM_MATHMENU_FILE_IMPORT, wxT("&Import...\tCtrl+I"), wxT("Export the mathematical data as a pure XML file.") ); 00190 file->Append( IDM_MATHMENU_FILE_EXPORT_ASXHTML, wxT("&Export as XHTML...\tCtrl+E"), wxT("Export the mathematical data as an XHTML file.") ); 00191 file->Append( IDM_MATHMENU_FILE_EXPORT_ASIMAGE, wxT("Export as image..."), wxT("Export the mathematical data as an image.") ); 00192 } 00193 00194 void mgMathMenu::AppendEditCommands(wxMenu *edit, bool bUsingMathWnd) 00195 { 00196 wxMenu *system = new wxMenu; // this alloc will be handled by the edit menu 00197 00198 edit->Append( IDM_MATHMENU_EDIT_CUT, wxT("Cut\tCtrl+X"), wxT("Copies in the notes") ); 00199 edit->Append( IDM_MATHMENU_EDIT_COPY, wxT("Copy\tCtrl+C"), wxT("Copies in the notes") ); 00200 edit->Append( IDM_MATHMENU_EDIT_PASTE, wxT("Paste\tCtrl+V"), wxT("Copies in the notes") ); 00201 edit->AppendSeparator(); 00202 00203 edit->Append( IDM_MATHMENU_EDIT_EDIT_EXP, wxT("Edit e&xponent\tENTER"), wxT("Edits/create the exponent of the current element.") ); 00204 edit->Append( IDM_MATHMENU_EDIT_EDIT_SUBSCRIPT, wxT("Edit &subscript\tCtrl+ENTER"), wxT("Edits/create the subscript of the current element.") ); 00205 edit->AppendSeparator(); 00206 00207 edit->Append( IDM_MATHMENU_EDIT_INSERT_FRACTION, wxT("Insert &fraction\tCtrl+F1"), wxT("Insert a new fraction") ); 00208 edit->Append( IDM_MATHMENU_EDIT_INSERT_RADICAL, wxT("Insert &radical\tCtrl+F2"), wxT("Insert a new radical") ); 00209 edit->Append( IDM_MATHMENU_EDIT_INSERT_FUNCTION, wxT("Insert f&unction\tCtrl+F3"), wxT("Insert a new function") ); 00210 edit->Append( IDM_MATHMENU_EDIT_INSERT_SPECIAL, wxT("Insert &special...\tCtrl+F4"), wxT("") ); 00211 edit->AppendSeparator(); 00212 00213 if (bUsingMathWnd) { 00214 00215 // alloc only if needed 00216 wxMenu *box = new wxMenu; 00217 00218 box->Append( IDM_MATHMENU_EDIT_NEWBOX, wxT("Add &new box"), wxT("") ); 00219 box->Append( IDM_MATHMENU_EDIT_NEWTEXTBOX, wxT("Add new &text box"), wxT("") ); 00220 box->Append( IDM_MATHMENU_EDIT_NEWBOX_LIKELAST, wxT("Add new box copying last"), wxT("") ); 00221 box->Append( IDM_MATHMENU_EDIT_DELETEBOX, wxT("Delete current box"), wxT("") ); 00222 00223 // pass the ownership to the edit menu 00224 edit->Append( IDM_MATHMENU_EDIT_BOXES, wxT("Boxes"), box, wxT("")); 00225 } 00226 00227 system->Append( IDM_MATHMENU_EDIT_NEWMATHLINE, wxT("Add new &equation/inequality"), wxT("") ); 00228 system->Append( IDM_MATHMENU_EDIT_NEWMATHLINE_LIKELAST, wxT("Add new equation/inequality copying last"), wxT("") ); 00229 system->Append( IDM_MATHMENU_EDIT_DELETEMATHLINE, wxT("&Delete current equation/inequality"), wxT("") ); 00230 edit->Append( IDM_MATHMENU_EDIT_SYSTEM, wxT("System"), system, wxT("")); 00231 00232 edit->AppendSeparator(); 00233 edit->Append( IDM_MATHMENU_EDIT_OPTIONS, wxT("Options\tF9"), wxT("&Edit the options of the program") ); 00234 } 00235 00236 void mgMathMenu::AppendMathCommands(wxMenu *math) 00237 { 00238 math->Append( IDM_MATHMENU_MATH_MULTIPLY, wxT("&Multiply by..."), wxT("") ); 00239 math->Append( IDM_MATHMENU_MATH_DIVIDE, wxT("&Divide by..."), wxT("") ); 00240 math->AppendSeparator(); 00241 math->Append( IDM_MATHMENU_MATH_MOVE, wxT("&Move selection"), wxT("") ); 00242 math->Append( IDM_MATHMENU_MATH_RAISE, wxT("&Raise to..."), wxT("") ); 00243 math->AppendSeparator(); 00244 math->Append( IDM_MATHMENU_MATH_EXPAND, wxT("&Expand"), wxT("") ); 00245 math->Append( IDM_MATHMENU_MATH_SIMPLIFY, wxT("&Simplify"), wxT("") ); 00246 math->Append( IDM_MATHMENU_MATH_EVALUATE, wxT("Evaluate"), wxT("") ); 00247 math->AppendSeparator(); 00248 math->Append( IDM_MATHMENU_MATH_SOLVE, wxT("So&lve...\tF10"), wxT("") ); 00249 } 00250 00251 void mgMathMenu::AppendViewCommands(wxMenu *view) 00252 { 00253 // this alloc will be handled by the view menu 00254 wxMenu* toolbars = new wxMenu( wxMENU_TEAROFF ); 00255 00256 toolbars->AppendCheckItem( IDM_MATHMENU_VIEW_PALETTE_GREEK_ALPHABET, wxT("&Greek alphabet"), wxT("") ); 00257 toolbars->AppendCheckItem( IDM_MATHMENU_VIEW_PALETTE_SPECIAL_SYMBOLS, wxT("&Special symbols"), wxT("") ); 00258 toolbars->AppendCheckItem( IDM_MATHMENU_VIEW_PALETTE_SYMBOLS, wxT("&Symbols"), wxT("") ); 00259 00260 view->Append( IDM_MATHMENU_VIEW_PALETTES, wxT("Palettes"), toolbars ); 00261 } 00262 00263 void mgMathMenu::AppendHelpCommands(wxMenu *help) 00264 { 00265 help->Append( IDM_MATHMENU_HELP_MAIN, wxT("&MathStudio help\tF1"), wxT("") ); 00266 help->AppendSeparator(); 00267 help->Append( IDM_MATHMENU_HELP_HOME_PAGE, wxT("&Home page of MathStudio"), wxT("") ); 00268 help->Append( IDM_MATHMENU_HELP_PROJECT_PAGE, wxT("MathStudio &project page"), wxT("") ); 00269 help->AppendSeparator(); 00270 help->Append( IDM_MATHMENU_HELP_WISH_LIST, wxT("I &wish..."), wxT("Opens the wish list of MathStudio; use this to suggest new features you would like MathStudio has") ); 00271 help->Append( IDM_MATHMENU_HELP_BUG_LIST, wxT("I've found a &bug..."), wxT("") ); 00272 help->AppendSeparator(); 00273 help->Append( IDM_MATHMENU_HELP_ABOUT, wxT("&About MathStudio"), wxT("") ); 00274 } 00275 00276 00277 00278 00280 // FILE menu event handlers 00281 00282 void mgMathMenu::OnFileExportAsXHTML( wxCommandEvent &event ) 00283 { 00284 //if (!CheckIfComplete()) return; 00285 00286 // get the correct path to XSL files 00287 wxFileName fn(wxGetCwd() + wxT("\\XSL\\mathml.xsl"), wxPATH_WIN); 00288 wxString str = fn.GetFullPath(); 00289 00290 // the native path, in Win32, contains \ as separator character, while 00291 // all XML, HTML & XHTML files should use / as separator character in 00292 // hreferences... so change it 00293 str.Replace(wxT("\\"), wxT("/"), TRUE); 00294 00295 // create export dialog 00296 mgExportDlg dlg(m_pFrame, m_pMathWnd, m_pMathBox, str); 00297 00298 // and show it to the user 00299 dlg.ShowModal(); 00300 } 00301 00302 void mgMathMenu::OnFileExportAsImage( wxCommandEvent &event ) 00303 { 00304 wxFileDialog fd(m_pFrame, wxT("Save as"), wxT(""), wxT(""), 00305 wxT("BMP files (*.bmp)|*.bmp|PNG files (*.png)|*.png|") 00306 wxT("JPEG files (*.jpeg,*.jpg)|*.jpg,*.jpeg|XPM files (*.xpm)|*.xpm"), 00307 wxSAVE | wxOVERWRITE_PROMPT); 00308 00309 if (fd.ShowModal() == wxID_CANCEL) 00310 return; 00311 00312 // save the file 00313 int idx = fd.GetFilterIndex(); 00314 wxBitmap bmp = GetBox()->GetMathObj().gui_GetBmp(); 00315 wxImage img = bmp.ConvertToImage(); 00316 00317 int type = -1; 00318 switch (idx) { 00319 case 0: 00320 type = wxBITMAP_TYPE_BMP; 00321 break; 00322 case 1: 00323 type = wxBITMAP_TYPE_PNG; 00324 break; 00325 case 2: 00326 type = wxBITMAP_TYPE_JPEG; 00327 break; 00328 case 3: 00329 type = wxBITMAP_TYPE_XPM; 00330 break; 00331 } 00332 00333 if (type == -1 || 00334 !img.SaveFile(fd.GetPath(), type)) { 00335 00336 // let the user know things went wrong 00337 wxMessageBox(wxT("Could not export in that format... sorry."), wxT("Error"), wxOK | wxICON_ERROR); 00338 00339 } else { 00340 00341 // success 00342 wxMessageBox(wxT("File correctly exported."), wxT("Success"), wxOK); 00343 } 00344 } 00345 00346 void mgMathMenu::OnFileImport( wxCommandEvent &event ) 00347 { 00348 //OnFileClose(event); 00349 00350 // create import dialog 00351 mgImportDlg dlg(m_pFrame, m_pMathWnd, m_pMathBox); 00352 00353 // and show it to the user 00354 dlg.ShowModal(); 00355 } 00356 00357 00358 00359 00361 // MATH menu event handlers 00362 00363 void mgMathMenu::OnMathMove( wxCommandEvent &event ) 00364 { 00365 // GetBox()->GetMathObj().gui_MoveSel(); 00366 GetBox()->ResetGUI(); 00367 } 00368 00369 void mgMathMenu::OnMathEvaluate( wxCommandEvent &) 00370 { 00371 mcRealValue val = GetBox()->GetMathObj().math_Evaluate(); 00372 00373 if (val == *mcRealValue::pNAN) { 00374 00375 wxMessageBox(wxT("Sorry; this data cannot be evaluated.\n") 00376 wxT("This is probably due to the presence of unknowns/parameters.\n"), 00377 wxT("Evaluation result")); 00378 00379 } else { 00380 00381 wxMessageBox(wxT("Current data evaluates to ") + val.GetSmartStr(), 00382 wxT("Evaluation result")); 00383 } 00384 } 00385 00386 //#include "wx/keybinder.h" 00387 00388 void mgMathMenu::OnMathExpand( wxCommandEvent &event ) 00389 { 00390 if (!GetBox()->GetMathObj().math_isValidMath()) return; 00391 GetBox()->GetMathObj().math_Expand(0, NULL); 00392 GetBox()->ResetGUI(); 00393 } 00394 00395 void mgMathMenu::OnMathSimplify( wxCommandEvent &event ) 00396 { 00397 //if (!CheckIfComplete()) return; 00398 if (!GetBox()->GetMathObj().math_isValidMath()) return; 00399 GetBox()->GetMathObj().math_Simplify(0, NULL); 00400 GetBox()->ResetGUI(); 00401 } 00402 00403 void mgMathMenu::OnMathDivideBy( wxCommandEvent &event ) 00404 { 00405 mgSTILL_TO_IMPLEMENT(); 00406 } 00407 00408 void mgMathMenu::OnMathMultiplyBy( wxCommandEvent &event ) 00409 { 00410 mgSTILL_TO_IMPLEMENT(); 00411 } 00412 00413 void mgMathMenu::OnMathSolve( wxCommandEvent &event ) 00414 { 00415 mgSolveDlg dlg(m_pFrame, m_pMathWnd, m_pMathBox); 00416 dlg.CentreOnScreen(); 00417 dlg.ShowModal(); 00418 } 00419 00420 00421 00422 00423 00425 // EDIT menu event handlers 00426 00427 #define DO_CHECK mcASSERT(isUsingMathWnd(), wxT("If this command has been called, ") \ 00428 wxT("this menu MUST be linked with a mgMathWnd")); 00429 00430 void mgMathMenu::OnEditDeleteBox( wxCommandEvent &event ) 00431 { DO_CHECK; m_pMathWnd->DeleteBox(m_pMathWnd->GetSelBoxId()); } 00432 void mgMathMenu::OnEditNewBox( wxCommandEvent &event ) 00433 { DO_CHECK; m_pMathWnd->AddBox(TRUE, FALSE); } 00434 void mgMathMenu::OnEditNewTextBox( wxCommandEvent &event ) 00435 { DO_CHECK; m_pMathWnd->AddBox(FALSE, FALSE); } 00436 void mgMathMenu::OnEditNewBoxLikeLast( wxCommandEvent &event ) 00437 { DO_CHECK; m_pMathWnd->AddBox(TRUE, TRUE); } 00438 00439 void mgMathMenu::OnEditDeleteMathLine( wxCommandEvent &event ) 00440 { GetBox()->GetMathObj().data_RemoveAt(GetBox()->GetMathObj().gui_GetFocusIdx(), 1); GetBox()->Refresh(); } 00441 void mgMathMenu::OnEditNewMathLine( wxCommandEvent &event ) 00442 {/* GetBox()->GetMathObj().data_AddLine(FALSE); GetBox()->Refresh(); */} 00443 void mgMathMenu::OnEditNewMathLineLikeLast( wxCommandEvent &event ) 00444 { /*GetBox()->GetMathObj().AddLine(TRUE); GetBox()->Refresh(); */} 00445 00446 00447 00448 void mgMathMenu::OnEditCut( wxCommandEvent &event ) 00449 { GetBox()->Cut(); } 00450 00451 void mgMathMenu::OnEditCopy( wxCommandEvent &event ) 00452 { GetBox()->CopyAsPlainText(); } 00453 00454 void mgMathMenu::OnEditPaste( wxCommandEvent &event ) 00455 { GetBox()->Paste(); } 00456 00457 void mgMathMenu::OnEditEditExp( wxCommandEvent &event ) 00458 { mgLogDebug(wxT("mgMathMenu::OnEditEditExp")); GetBox()->EditExponent(); } 00459 00460 void mgMathMenu::OnEditEditSubscript( wxCommandEvent &event ) 00461 { GetBox()->EditSubscript(); } 00462 00463 void mgMathMenu::OnEditInsertSpecial( wxCommandEvent &event ) 00464 { 00465 mgSTILL_TO_IMPLEMENT(); 00466 } 00467 00468 void mgMathMenu::OnEditInsertRadical( wxCommandEvent &event ) 00469 { GetBox()->InsertRadical(); } 00470 00471 void mgMathMenu::OnEditInsertFraction( wxCommandEvent &event ) 00472 { GetBox()->InsertFraction(); } 00473 00474 void mgMathMenu::OnEditInsertFunction( wxCommandEvent &event ) 00475 { GetBox()->InsertFunction(); } 00476 00477 void mgMathMenu::OnEditOptions( wxCommandEvent &event ) 00478 { 00479 mgOptDlg dlg(m_pFrame, -1); 00480 00481 // we cannot handle notification events sent by mgOptDlg: 00482 // redirect them to the application associated with this 00483 // class... 00484 dlg.SetClientEvtHandler(m_pTheApp); 00485 dlg.CentreOnScreen(); 00486 dlg.ShowModal(); 00487 } 00488 00489 00490 00491 00493 // HELP menu event handlers 00494 00495 void mgMathMenu::OnHelpWishList( wxCommandEvent &event ) 00496 { 00497 wxViewHTMLFile(wxT("https://sourceforge.net/tracker/?func=add&group_id=61901&atid=498777")); 00498 } 00499 00500 void mgMathMenu::OnHelpAbout( wxCommandEvent &event ) 00501 { 00502 // called when help - about is picked from the menu or toolbar 00503 #ifdef mgMATHMENU_USE_OLDABOUT 00504 00505 wxString msg; 00506 msg.Printf( 00507 wxT("MathStudio is a powerful and flexible mathematical instrument\n") 00508 wxT("conceived to make math operations easier. MathStudio is not\n") 00509 wxT("complete yet; when it will be finished it will have complete\n") 00510 wxT("support for MathML and LaTex; it will be able to solve every\n") 00511 wxT("type of equation, inequality and expression.\n\n") 00512 wxT("MathStudio is an open source program released under GPL.\n") 00513 wxT("To get more info about it, go to:\n\n") 00514 wxT("http://mathstudio.sourceforge.net\n\n") 00515 wxT("Thanks.\n\n\n") 00516 wxT("NOTE: if you are a programmer, you are keen on math and you\n") 00517 wxT("want to join, you will be the welcome: send an email to\n") 00518 wxT("the administrator at frm@users.sourceforge.net.\n") 00519 wxT("MathStudio is composed by two libraries, MathCore and MathGUI\n") 00520 wxT("which can be easily integrated in any C++ program: if you want\n") 00521 wxT("to use them, don't hesitate to drop an email to the admin...")); 00522 wxMessageBox(msg, wxT("About MathStudio"), wxOK | wxICON_INFORMATION, m_pFrame); 00523 00524 #else 00525 00526 wxBoxSizer *topsizer; 00527 wxHtmlWindow *html; 00528 wxDialog dlg(m_pFrame, wxID_ANY, wxString(wxT("About MathStudio"))); 00529 00530 topsizer = new wxBoxSizer(wxVERTICAL); 00531 html = new wxHtmlWindow(&dlg, wxID_ANY, wxDefaultPosition, 00532 wxSize(380, 160), wxHW_SCROLLBAR_NEVER | wxSUNKEN_BORDER); 00533 html->SetBorders(0); 00534 00535 wxFileName url(m_strHelpPath + wxT("about.htm")); 00536 mcASSERT(html->LoadFile(url), wxT("Invalid about page...")); 00537 html->SetSize(html->GetInternalRepresentation()->GetWidth(), 00538 html->GetInternalRepresentation()->GetHeight()); 00539 00540 topsizer->Add(html, 1, wxALL, 10); 00541 topsizer->Add(new wxStaticLine(&dlg, wxID_ANY), 0, wxEXPAND | wxLEFT | wxRIGHT, 10); 00542 wxButton *bu1 = new wxButton(&dlg, wxID_OK, wxT("OK")); 00543 bu1->SetDefault(); 00544 topsizer->Add(bu1, 0, wxALL | wxALIGN_RIGHT, 15); 00545 00546 dlg.SetSizer(topsizer); 00547 topsizer->Fit(&dlg); 00548 00549 dlg.ShowModal(); 00550 00551 #endif 00552 } 00553 00554 void mgMathMenu::OnHelpProjectPage( wxCommandEvent &event ) 00555 { 00556 wxViewHTMLFile(wxT("https://sourceforge.net/projects/mathstudio/")); 00557 } 00558 00559 void mgMathMenu::OnHelpHomePage( wxCommandEvent &event ) 00560 { 00561 wxViewHTMLFile(wxT("http://mathstudio.sourceforge.net/")); 00562 } 00563 00564 void mgMathMenu::OnHelpMain( wxCommandEvent &event ) 00565 { 00566 wxViewHTMLFile(wxT("file://") + m_strHelpPath + wxT("index.shtml")); 00567 } 00568 00569 void mgMathMenu::OnHelpBugList( wxCommandEvent &event ) 00570 { 00571 wxViewHTMLFile(wxT("https://sourceforge.net/tracker/?func=add&group_id=61901&atid=498774")); 00572 } 00573 00574 00575 00576 00578 // VIEW menu event handlers 00579 00580 void mgMathMenu::OnViewPaletteGreekAlphabet( wxCommandEvent &event ) 00581 { m_pGreekAlphabet->Show(!m_pGreekAlphabet->IsShown()); } 00582 00583 void mgMathMenu::OnViewPaletteSpecialSym( wxCommandEvent &event ) 00584 { m_pSpecialSym->Show(!m_pSpecialSym->IsShown()); } 00585 00586 void mgMathMenu::OnViewPaletteSym( wxCommandEvent &event ) 00587 { m_pSym->Show(!m_pSym->IsShown()); } 00588 00589 00590
[ Top ] |