wxMaxima
wxMaxima.h
Go to the documentation of this file.
1 // -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2 // Copyright (C) 2004-2015 Andrej Vodopivec <andrej.vodopivec@gmail.com>
3 // (C) 2013 Doug Ilijev <doug.ilijev@gmail.com>
4 // (C) 2014-2018 Gunter Königsmann <wxMaxima@physikbuch.de>
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 //
21 // SPDX-License-Identifier: GPL-2.0+
22 
31 #ifndef WXMAXIMA_H
32 #define WXMAXIMA_H
33 
34 #include <vector>
35 #include "wxMaximaFrame.h"
36 #include "WXMXformat.h"
37 #include "MathParser.h"
38 #include "MaximaIPC.h"
39 #include "Dirstructure.h"
40 #include <wx/socket.h>
41 #include <wx/config.h>
42 #include <wx/process.h>
43 #include <wx/regex.h>
44 #include <wx/dnd.h>
45 #include <wx/txtstrm.h>
46 #include <wx/sckstrm.h>
47 #include <wx/buffer.h>
48 #include <wx/power.h>
49 #include <wx/debugrpt.h>
50 #include <memory>
51 #ifdef __WXMSW__
52 #include <windows.h>
53 #endif
54 #include <unordered_map>
55 
57 #define MAXIMAPOLLMSECS 2000
58 
59 class Maxima; // The Maxima process interface
60 
61 /* The top-level window and the main application logic
62 
63  */
64 class wxMaxima : public wxMaximaFrame
65 {
66 public:
67  wxMaxima(wxWindow *parent, int id, const wxString &title,
68  const wxString &filename = wxEmptyString,
69  const wxString &initialWorksheetContents = wxEmptyString,
70  const wxPoint pos = wxDefaultPosition, const wxSize size = wxDefaultSize);
71 
72  virtual ~wxMaxima();
73  wxString EscapeFilenameForShell(wxString name);
75  static void ExitOnError(){m_exitOnError = true;}
77  static bool GetExitOnError(){return m_exitOnError;}
82  static void EnableIPC(){ MaximaIPC::EnableIPC(); }
84  static bool GetEnableIPC(){ return MaximaIPC::GetEnableIPC(); }
86  static void ExtraMaximaArgs(const wxString &args){m_extraMaximaArgs = args;}
88  static wxString ExtraMaximaArgs(){return m_extraMaximaArgs;}
89 
91  enum TimerIDs
92  {
99  };
100 
101 #ifdef wxHAS_POWER_EVENTS
102  void OnPowerEvent(wxPowerEvent &event);
103 #endif
104 
106  void OnTimerEvent(wxTimerEvent &event);
107 
110 
111  void ShowTip(bool force);
113  void EvalOnStartup(bool eval)
114  {
115  m_evalOnStartup = eval;
116  }
117 
119  void ExitAfterEval(bool exitaftereval)
120  {
121  m_exitAfterEval = exitaftereval;
122  if(exitaftereval)
123  {
125  }
126  }
127 
128  void StripLispComments(wxString &s);
129 
131  void LaunchHelpBrowser(wxString uri);
132 
133  void SendMaxima(wxString s, bool addToHistory = false);
134 
136  bool OpenFile(const wxString &file, const wxString &command ={});
137 
140  { return m_fileSaved; }
141 
143  void LoadImage(const wxString &file)
144  { GetWorksheet()->OpenHCaret(file, GC_TYPE_IMAGE); }
145 
147  bool QueryVariableValue();
148 
151  {
152  public:
153  explicit VersionNumber(const wxString &version);
154  long Major() const {return m_major;}
155  long Minor() const {return m_minor;}
156  long Patchlevel() const {return m_patchlevel;}
157  friend bool operator<(const VersionNumber& v1, const VersionNumber& v2);
158  friend bool operator>(const VersionNumber& v1, const VersionNumber& v2);
159  private:
160  long m_major = -1;
161  long m_minor = -1;
162  long m_patchlevel = -1;
163  };
164 
166  static void Set_Maxima_Commandline_Filename(const wxString &filename)
167  {maxima_command_line_filename = filename;}
169  static const wxString Get_Maxima_Commandline_Filename() {return maxima_command_line_filename;}
170 
171  static int GetExitCode(){return m_exitCode;}
172 
173 private:
175  static wxString maxima_command_line_filename;
177  bool m_maximaAuthenticated = false;
179  bool m_discardAllData = false;
181  wxString m_maximaAuthString;
183  MaximaIPC m_ipc{this};
185  static bool m_exitOnError;
187  static wxString m_extraMaximaArgs;
189  std::vector<wxString> m_varNamesToQuery;
190 
192  bool m_openInitialFileError = false;
194  wxString EscapeForLisp(wxString str);
196  long long m_maximaJiffies_old = 0;
198  long long m_cpuTotalJiffies_old = 0;
201  wxString m_configCommands;
203  static wxRegEx m_gnuplotErrorRegex;
205  bool AbortOnError();
207  wxString m_oldFindString;
209  int m_oldFindFlags = 0;
211  bool m_hasEvaluatedCells = false;
213  long m_outputCellsFromCurrentCommand = 0;
215  long m_maxOutputCellsPerCommand = 0;
222  int m_unsuccessfulConnectionAttempts = 11;
224  wxString m_CWD;
226  bool m_evalOnStartup = false;
228  bool m_exitAfterEval = false;
230  bool m_ready = false;
231 
236  wxString GetUnmatchedParenthesisState(wxString text, std::size_t &index);
238  wxMemoryBuffer m_uncompletedChars;
239 
240 protected:
242  void CommandWiz(const wxString &title,
243  const wxString &description, const wxString &description_tooltip,
244  const wxString &commandRule,
245  wxString label1, wxString defaultval1, wxString tooltip1 = {},
246  wxString label2 = {}, wxString defaultval2 = {}, wxString tooltip2 = {},
247  wxString label3 = {}, wxString defaultval3 = {}, wxString tooltip3 = {},
248  wxString label4 = {}, wxString defaultval4 = {}, wxString tooltip4 = {},
249  wxString label5 = {}, wxString defaultval5 = {}, wxString tooltip5 = {},
250  wxString label6 = {}, wxString defaultval6 = {}, wxString tooltip6 = {},
251  wxString label7 = {}, wxString defaultval7 = {}, wxString tooltip7 = {},
252  wxString label8 = {}, wxString defaultval8 = {}, wxString tooltip8 = {},
253  wxString label9 = {}, wxString defaultval9 = {}, wxString tooltip9 = {}
254  );
256  wxString ReadPotentiallyUnclosedTag(wxStringTokenizer &lines, wxString firstLine);
257 
259  static wxRegEx m_xmlOpeningTagName;
261  static wxRegEx m_xmlOpeningTag;
263  wxProcess *m_gnuplotProcess = NULL;
265  wxProcess *m_gnuplotTerminalQueryProcess = NULL;
267  bool m_isActive = true;
269  void OnFocus(wxFocusEvent &event);
270 
272  void PassKeyboardFocus();
274  void OnMinimize(wxIconizeEvent &event);
276  void ConfigChanged();
278  void OnJumpToError(wxCommandEvent &event);
280  void OnSymbolAdd(wxCommandEvent &event);
282  void OnFollow(wxCommandEvent &event);
283  void OnWizardAbort(wxCommandEvent &event);
284  void OnWizardOK(wxCommandEvent &event);
285  void OnWizardInsert(wxCommandEvent &event);
286  void OnWizardHelpButton(wxCommandEvent &event);
287 
289  void ShowMaximaHelp(wxString = {});
290 
293 
295  void ShowWxMaximaHelp();
296 
298  void ShowHelp(const wxString &keyword);
299 
300  void CheckForUpdates(bool reportUpToDate = false);
301 
302  void OnRecentDocument(wxCommandEvent &event);
303  void OnRecentPackage (wxCommandEvent &event);
304  void OnUnsavedDocument(wxCommandEvent &event);
305 
306  void OnChar(wxKeyEvent &event);
307  void OnKeyDown(wxKeyEvent &event);
308 
327  void OnIdle(wxIdleEvent &event);
328  bool m_dataFromMaximaIs = false;
329 
330  void MenuCommand(const wxString &cmd);
331  void FileMenu(wxCommandEvent &event);
332  void MaximaMenu(wxCommandEvent &event);
333  void MatrixMenu(wxCommandEvent &event);
334  void PropertiesMenu(wxCommandEvent &event);
335  void EquationsMenu(wxCommandEvent &event);
336  void CalculusMenu(wxCommandEvent &event);
337  void SimplifyMenu(wxCommandEvent &event);
338  void PlotMenu(wxCommandEvent &event);
339  void ListMenu(wxCommandEvent &event);
340  void DrawMenu(wxCommandEvent &event);
341  void NumericalMenu(wxCommandEvent &event);
342  void HelpMenu(wxCommandEvent &event);
343  void EditMenu(wxCommandEvent &event);
344  void ReplaceSuggestion(wxCommandEvent &event);
345  void Interrupt(wxCommandEvent &event);
347  void UpdateMenus();
348  void UpdateToolBar();
349  void UpdateSlider();
353  void ShowPane(wxCommandEvent &event); //<! Makes a sidebar visible
354  void OnMaximaClose(wxProcessEvent &event); //
355  void OnMaximaClose(); //
356  void OnGnuplotClose(wxProcessEvent &event); //
357  void OnGnuplotQueryTerminals(wxProcessEvent &event); //
358  void PopupMenu(wxCommandEvent &event); //
359  void StatsMenu(wxCommandEvent &event); //
360 
362  void ChangeCellStyle(wxCommandEvent &event);
363 
365  void OnFind(wxFindDialogEvent &event);
366 
368  void OnReplace(wxFindDialogEvent &event);
369 
371  void OnReplaceAll(wxFindDialogEvent &event);
372 
374  void OnMaximaConnect();
375 
377  void MaximaEvent(wxThreadEvent &event);
378 
380  void ServerEvent(wxSocketEvent &event);
381 
388  void AddDrawParameter(wxString cmd, int dimensionsOfNewDrawCommand = 2);
389 
390  /* Append something to the console. Might be Text or XML maths.
391 
392  \return A pointer to the last line of Unicode text that was appended or
393  NULL, if there is no such line (for example if the appended object is
394  maths instead).
395  */
396  TextCell *ConsoleAppend(wxString s, CellType type);
397  void ConsoleAppend(wxXmlDocument xml, CellType type, const wxString &userLabel = {});
398 
399  enum AppendOpt { NewLine = 1, BigSkip = 2, PromptToolTip = 4, DefaultOpt = NewLine|BigSkip };
400  void DoConsoleAppend(wxString s, CellType type, AppendOpt opts = AppendOpt::DefaultOpt,
401  const wxString &userLabel = {});
402 
407  TextCell *DoRawConsoleAppend(wxString s, CellType type, AppendOpt opts = {});
408 
413  void EditInputMenu(wxCommandEvent &event);
415  void VarReadEvent(wxCommandEvent &event);
417  void VarAddAllEvent(wxCommandEvent &event);
418  void EvaluateEvent(wxCommandEvent &event); //
419  void InsertMenu(wxCommandEvent &event); //
420  void PrintMenu(wxCommandEvent &event);
421 
422  void SliderEvent(wxScrollEvent &event);
423 
425  void NetworkDClick(wxCommandEvent &ev);
427  void MaximaDClick(wxCommandEvent &ev);
429  void StatusMsgDClick(wxCommandEvent &ev);
430 
432  void HistoryDClick(wxCommandEvent &event);
433 
435  void TableOfContentsSelection(wxListEvent &event);
436 
437  void OnInspectorEvent(wxCommandEvent &ev);
438 
439  void DumpProcessOutput();
440 
442  void TriggerEvaluation();
443 
444  void TryUpdateInspector();
445 
446  bool UpdateDrawPane();
447 
448  wxString ExtractFirstExpression(const wxString &entry);
449 
450  wxString GetDefaultEntry();
451 
453  bool StartServer();
462  bool StartMaxima(bool force = false);
463 
464  void OnClose(wxCloseEvent &event);
465  wxString GetCommand(bool params = true);
466  // (uses guessConfiguration)
467 
469  void ReadStdErr();
470 
481  void ReadFirstPrompt(const wxString &data);
482 
490  void ReadMiscText(const wxString &data);
491 
496  void ReadPrompt(const wxString &data);
497 
503  void ReadStatusBar(const wxXmlDocument &xmldoc);
505  void ReadManualTopicNames(const wxXmlDocument &xmldoc);
506 
515  void ReadMath(const wxXmlDocument &xml);
516 
522  void ReadMaximaIPC(const wxString &data){m_ipc.ReadInputData(data);}
523  void ReadLoadSymbols(const wxXmlDocument &data);
524 
526  void ReadSuppressedOutput(const wxString &data);
527 
530  void ReadVariables(const wxXmlDocument &xmldoc);
531 
534  void ReadAddVariables(const wxXmlDocument &xmldoc);
536  void VariableActionGentranlang(const wxString &value);
538  void VariableActionNumer(const wxString &value);
540  void VariableActionDisplay2d_Unicode(const wxString &value);
542  void VariableActionHtmlHelp(const wxString &value);
544  void VariableActionOpSubst(const wxString &value);
546  void VariableActionSinnpiflag(const wxString &value);
550  void VariableActionLogexpand(const wxString &value);
552  void VariableActionUserDir(const wxString &value);
554  void VariableActionTempDir(const wxString &value);
556  void VariableActionDebugmode(const wxString &value);
558  void VariableActionAutoconfVersion(const wxString &value);
560  void VariableActionAutoconfHost(const wxString &value);
562  void VariableActionMaximaInfodir(const wxString &value);
564  void VariableActionMaximaHtmldir(const wxString &value);
566  void VariableActionGnuplotCommand(const wxString &value);
568  void VariableActionMaximaSharedir(const wxString &value);
570  void VariableActionLispName(const wxString &value);
572  void VariableActionLispVersion(const wxString &value);
574  void VariableActionWxLoadFileName(const wxString &value);
576  void VariableActionWxSubscripts(const wxString &value);
578  void VariableActionLmxChar(const wxString &value);
580  void VariableActionDisplay2D(const wxString &value);
582  void VariableActionAltDisplay2D(const wxString &value);
584  void VariableActionAlgebraic(const wxString &value);
586  void VariableActionShowtime(const wxString &value);
588  void VariableActionDomain(const wxString &value);
590  void VariableActionAutoplay(const wxString &value);
592  void VariableActionEngineeringFormat(const wxString &value);
594  void VariableActionStringdisp(const wxString &value);
596  void VariableActionOperators(const wxString &value);
597  wxString m_maximaVariable_wxSubscripts;
598  wxString m_maximaVariable_lmxchar;
599  wxString m_maximaVariable_display2d;
600  wxString m_maximaVariable_altdisplay2d;
601  wxString m_maximaVariable_engineeringFormat;
602  bool m_readMaximaVariables = false;
603  bool m_updateAutocompletion = true;
608  long long GetTotalCpuTime();
609 
615  long long GetMaximaCpuTime();
616 
621  double GetMaximaCPUPercentage();
622 
624  bool SaveNecessary();
625 
634  void SetupVariables();
635 
636  void KillMaxima(bool logMessage = true);
644  void ResetTitle(bool saved, bool force = false);
645 
646  void FirstOutput();
647 
650  bool OpenXML(const wxString &file, Worksheet *document);
651 
653  bool CheckWXMXVersion(const wxString &docversion);
654 
656  bool OpenMACFile(const wxString &file, Worksheet *document, bool clearDocument = true);
657 
659  bool OpenWXMFile(const wxString &file, Worksheet *document, bool clearDocument = true);
660 
662  bool OpenWXMXFile(const wxString &file, Worksheet *document, bool clearDocument = true);
663 
665  std::unique_ptr<GroupCell> CreateTreeFromXMLNode(wxXmlNode *xmlcells, const wxString &wxmxfilename = {});
666 
672  bool SaveFile(bool forceSave = false);
673 
675  bool SaveOnClose();
680  bool AutoSave();
681 
689  int SaveDocumentP();
690 
692  void SetCWD(wxString file);
693 
695  wxString GetCWD()
696  {
697  return m_CWD;
698  }
699 
700  std::unique_ptr<Maxima> m_client;
706  struct ServerDeleter {
707  void operator()(wxSocketServer* server) const {
708  server->Destroy(); // Destroy() calls Close() automatically.
709  }
710  };
717  std::unique_ptr<wxSocketServer, ServerDeleter> m_server;
718 
719  wxProcess *m_maximaProcess = NULL;
721  wxInputStream *m_maximaStdout = NULL;
723  wxInputStream *m_maximaStderr = NULL;
725  int m_port = -1;
727  static wxString m_mathPrefix1;
729  static wxString m_mathPrefix2;
731  static wxString m_promptPrefix;
732 public:
734  const static wxString m_promptSuffix;
735 protected:
740  bool m_scheduleUpdateToc = false;
741  void QuestionAnswered(){if(GetWorksheet()) GetWorksheet()->QuestionAnswered();}
744  void OnNewDemoFiles(wxCommandEvent &event);
746  void OnDemoFileMenu(wxCommandEvent &ev);
747 
749  void OnUpdateTOCEvent(wxCommandEvent &event);
750 
751  void OnSize(wxSizeEvent &event);
752  void OnMove(wxMoveEvent &event);
753  void OnMaximize(wxCommandEvent &event);
754 
756  void GnuplotCommandName(wxString gnuplot);
758  static wxString m_firstPrompt;
759  bool m_dispReadOut = false;
760  wxWindowIDRef m_gnuplot_process_id;
761  wxWindowIDRef m_maxima_process_id;
762  wxString m_lastPrompt;
763  wxString m_lastPath;
764  std::unique_ptr<wxPrintData> m_printData;
769  bool m_closing = false;
771  wxString m_maximaTempDir;
772  wxString m_maximaHtmlDir;
773  bool m_fileSaved = true;
774  static int m_exitCode;
778  long m_commandIndex = -1;
780  static wxRegEx m_funRegEx;
781  static wxRegEx m_varRegEx;
782  static wxRegEx m_blankStatementRegEx;
783  static wxRegEx m_sbclCompilationRegEx;
784  MathParser m_parser;
785  bool m_maximaBusy = true;
786 private:
787  bool m_fourierLoaded = false;
789  wxString m_logexpand;
791  typedef void (wxMaxima::*VarReadFunction)(const wxString &value);
792  typedef void (wxMaxima::*VarUndefinedFunction)();
793  typedef std::unordered_map <wxString, VarReadFunction, wxStringHash> VarReadFunctionHash;
794  typedef std::unordered_map <wxString, VarUndefinedFunction,
795  wxStringHash> VarUndefinedFunctionHash;
797  static VarReadFunctionHash m_variableReadActions;
799  static VarUndefinedFunctionHash m_variableUndefinedActions;
800 
801 #if wxUSE_DRAG_AND_DROP
802 
803  friend class MyDropTarget;
804 
805 #endif
806  friend class MaximaIPC;
807 
818  wxTimer m_autoSaveTimer;
819 
820  /* A timer that delays redraws while maxima evaluates
821 
822  If we always start a redraw when maxima has nearly finished a command that slows
823  down evaluating many simple commands in a row.
824  */
825  wxTimer m_fastResponseTimer;
826 
828  void StartAutoSaveTimer();
829 };
830 
831 #if wxUSE_DRAG_AND_DROP
832 
833 // cppcheck-suppress noConstructor
834 class MyApp : public wxApp
835 {
836 public:
837  virtual bool OnInit();
838  virtual int OnRun();
839  virtual int OnExit();
840 #if wxUSE_ON_FATAL_EXCEPTION && wxUSE_CRASHREPORT
841  void OnFatalException () override;
842 #endif
856  static void NewWindow(const wxString &file = {}, bool evalOnStartup = false, bool exitAfterEval = false, unsigned char *wxmData = NULL, std::size_t wxmLen = 0);
857 
858  void OnFileMenu(wxCommandEvent &ev);
859 
860  virtual void MacNewFile();
861  void BecomeLogTarget();
862 
863  virtual void MacOpenFile(const wxString &file);
864 
865 private:
866 #if wxUSE_ON_FATAL_EXCEPTION && wxUSE_CRASHREPORT
867  void GenerateDebugReport(wxDebugReport::Context ctx);
868 #endif
869  std::unique_ptr<wxLocale> m_locale;
870  std::unique_ptr<wxTranslations> m_translations;
872  wxString m_configFileName;
873  Dirstructure m_dirstruct;
874 #if defined __WXOSX__
875  bool m_allWindowsInOneProcess = true;
876 #else
877  bool m_allWindowsInOneProcess = false;
878 #endif
879 };
880 
881 class MyDropTarget : public wxFileDropTarget
882 {
883 public:
884  explicit MyDropTarget(wxMaxima *wxmax)
885  { m_wxmax = wxmax; }
886 
887  bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &files);
888 
889 private:
890  wxMaxima *m_wxmax = NULL;
891 };
892 
893 #endif
894 
895 
896 // cppcheck-suppress noConstructor
897 
898 #endif // WXMAXIMA_H
CellType
The supported types of math cells.
Definition: Cell.h:64
This file declares the class DirStructure.
The header file for the xml cell parser.
An object that represents the directory structure wxMaxima is installed in.
Definition: Dirstructure.h:58
Definition: FindReplacePane.h:48
void SetBatchMode()
Causes log messages to be output to stderr, as well.
Definition: LogPane.h:47
This class handles parsing the xml representation of a cell tree.
Definition: MathParser.h:53
Handles the "<ipc>" tag from Maxima.
Definition: MaximaIPC.h:41
void ReadInputData(const wxString &data)
Reads the interprocess communications tag, used in test scripts, etc.
Definition: MaximaIPC.cpp:90
Interface to the Maxima process.
Definition: Maxima.h:63
Definition: test_ImgCell.cpp:70
A Text cell.
Definition: TextCell.h:38
The canvas that contains the spreadsheet the whole program is about.
Definition: Worksheet.h:95
void OpenHCaret(const wxString &txt={})
Place the cursor into a new cell where the horizontal cursor is.
Definition: Worksheet.h:1279
void QuestionAnswered()
Mark the current question from maxima as "answered"..
Definition: Worksheet.cpp:3322
The frame containing the menu and the sidebars.
Definition: wxMaximaFrame.h:66
LogPane * m_logPane
The panel the log and debug messages will appear on.
Definition: wxMaximaFrame.h:332
A version number that can be compared using "<" and ">".
Definition: wxMaxima.h:151
Definition: wxMaxima.h:65
void PlotMenu(wxCommandEvent &event)
Processes "Plot menu" cloicks.
Definition: wxMaxima.cpp:8990
void OnIdle(wxIdleEvent &event)
The idle task that refreshes the gui (worksheet, menus, title line,...)
Definition: wxMaxima.cpp:4967
void VariableActionAutoconfVersion(const wxString &value)
Called if maxima tells us the maxima version as defined by autoconf.
Definition: wxMaxima.cpp:3456
int m_port
The port the actual maxima process (not its wrapper script) runs at.
Definition: wxMaxima.h:725
bool AutoSave()
Save the project in a temp file.
Definition: wxMaxima.cpp:5926
bool m_dispReadOut
what is displayed in statusbar
Definition: wxMaxima.h:759
void FileMenu(wxCommandEvent &event)
Processes "file menu" clicks.
Definition: wxMaxima.cpp:5972
bool m_scheduleUpdateToc
True = schedule an update of the table of contents.
Definition: wxMaxima.h:740
void VariableActionGentranlang(const wxString &value)
Called if maxima tells us the value of the maxima variable gentranlang.
Definition: wxMaxima.cpp:3396
bool SaveFile(bool forceSave=false)
Saves the current file.
Definition: wxMaxima.cpp:5579
void VariableActionDisplay2d_Unicode(const wxString &value)
Called if maxima tells us the value of the maxima variable display2d_unicode.
Definition: wxMaxima.cpp:3389
void ShowTip(bool force)
Definition: wxMaxima.cpp:4787
void VariableActionUserDir(const wxString &value)
Called if maxima tells us where the user files lie.
Definition: wxMaxima.cpp:3383
void ReadMiscText(const wxString &data)
Reads text that isn't enclosed between xml tags.
Definition: wxMaxima.cpp:3111
void ReadMath(const wxXmlDocument &xml)
Reads the math cell's contents from Maxima.
Definition: wxMaxima.cpp:3257
static wxRegEx m_xmlOpeningTag
Looks if this opening tag is actually complete.
Definition: wxMaxima.h:261
void EquationsMenu(wxCommandEvent &event)
Processes "equations menu" clicks.
Definition: wxMaxima.cpp:7627
void VariableActionDomain(const wxString &value)
Called if maxima tells us the value of the maxima variable domain
Definition: wxMaxima.cpp:3723
static wxString m_promptPrefix
The marker for the start of a input prompt.
Definition: wxMaxima.h:731
void OnMinimize(wxIconizeEvent &event)
Called when this window is minimized.
Definition: wxMaxima.cpp:11137
static const wxString Get_Maxima_Commandline_Filename()
The maxima command, if we use the –maxima=<str> command. If empty we use the configured path,...
Definition: wxMaxima.h:169
void VariableActionAltDisplay2D(const wxString &value)
Called if maxima tells us if it currently outputs XML.
Definition: wxMaxima.cpp:3755
void ShowWxMaximaHelp()
Show the help for wxMaxima.
Definition: wxMaxima.cpp:4846
TextCell * ConsoleAppend(wxString s, CellType type)
append maxima output to console
Definition: wxMaxima.cpp:2050
void ChangeCellStyle(wxCommandEvent &event)
Is triggered when the textstyle drop-down box's value is changed.
Definition: wxMaxima.cpp:11144
static wxString ExtraMaximaArgs()
Which additional maxima arguments did we get from the command line?
Definition: wxMaxima.h:88
bool m_isActive
Is this window active?
Definition: wxMaxima.h:267
void VariableActionOpSubst(const wxString &value)
Called if maxima tells us the value of the maxima variable opsubst.
Definition: wxMaxima.cpp:3405
void MaximaEvent(wxThreadEvent &event)
Maxima sends or receives data, or disconnects.
Definition: wxMaxima.cpp:2400
wxString ReadPotentiallyUnclosedTag(wxStringTokenizer &lines, wxString firstLine)
Reads a potentially unclosed XML tag and closes it.
Definition: wxMaxima.cpp:4193
void OnReplace(wxFindDialogEvent &event)
Is triggered when the "Replace" button in the search dialog is pressed.
Definition: wxMaxima.cpp:6602
int SaveDocumentP()
Tries or offers to save the document.
Definition: wxMaxima.cpp:11083
void VariableActionDisplay2D(const wxString &value)
Called if maxima tells us the value of the maxima variable display2d
Definition: wxMaxima.cpp:3732
void ReadMaximaIPC(const wxString &data)
Reads autocompletion templates we get on definition of a function or variable.
Definition: wxMaxima.h:522
void AddDrawParameter(wxString cmd, int dimensionsOfNewDrawCommand=2)
Add a parameter to a draw command.
Definition: wxMaxima.cpp:8145
void ShowHelp(const wxString &keyword)
Try to determine if help is needed for maxima or wxMaxima and show this help.
Definition: wxMaxima.cpp:4927
void CommandWiz(const wxString &title, const wxString &description, const wxString &description_tooltip, const wxString &commandRule, wxString label1, wxString defaultval1, wxString tooltip1={}, wxString label2={}, wxString defaultval2={}, wxString tooltip2={}, wxString label3={}, wxString defaultval3={}, wxString tooltip3={}, wxString label4={}, wxString defaultval4={}, wxString tooltip4={}, wxString label5={}, wxString defaultval5={}, wxString tooltip5={}, wxString label6={}, wxString defaultval6={}, wxString tooltip6={}, wxString label7={}, wxString defaultval7={}, wxString tooltip7={}, wxString label8={}, wxString defaultval8={}, wxString tooltip8={}, wxString label9={}, wxString defaultval9={}, wxString tooltip9={})
Invoke our standard wizard that generates maxima commands.
Definition: wxMaxima.cpp:9292
void MaximaMenu(wxCommandEvent &event)
Processes "maxima menu" clicks.
Definition: wxMaxima.cpp:6784
static void ExtraMaximaArgs(const wxString &args)
Additional maxima arguments from the command line.
Definition: wxMaxima.h:86
void EvalOnStartup(bool eval)
Do we want to evaluate the document on startup?
Definition: wxMaxima.h:113
static void ExitOnError()
Exit if we encounter an error.
Definition: wxMaxima.h:75
void PrintMenu(wxCommandEvent &event)
Definition: wxMaxima.cpp:5199
void OnUpdateTOCEvent(wxCommandEvent &event)
Is called when something requests an update of the table of contents.
Definition: wxMaxima.cpp:5573
void UpdateMenus()
Enables and disables the Right menu buttons.
Definition: wxMaxima.cpp:5238
void LaunchHelpBrowser(wxString uri)
Launches the help browser on the uri passed as an argument.
Definition: wxMaxima.cpp:4803
wxInputStream * m_maximaStdout
The stdout of the maxima process.
Definition: wxMaxima.h:721
void VarReadEvent(wxCommandEvent &event)
Trigger reading all variables from Maxima that are shown in the Variables sidebar.
Definition: wxMaxima.cpp:10231
void GnuplotCommandName(wxString gnuplot)
Sets gnuplot's command name and tries to determine gnuplot's path.
Definition: wxMaxima.cpp:3486
void VariableActionAutoconfHost(const wxString &value)
Called if maxima tells us the maxima build host as defined by autoconf.
Definition: wxMaxima.cpp:3461
static bool GetEnableIPC()
Do we allow maxima to click buttons in wxMaxima?
Definition: wxMaxima.h:84
void ReadSuppressedOutput(const wxString &data)
Read (and discard) suppressed output.
Definition: wxMaxima.cpp:3273
std::unique_ptr< wxSocketServer, ServerDeleter > m_server
The server maxima connects to as client.
Definition: wxMaxima.h:717
void OnMaximaConnect()
Is called if maxima connects to wxMaxima.
Definition: wxMaxima.cpp:2497
wxTimer m_maximaStdoutPollTimer
A timer that polls for output from the maxima process.
Definition: wxMaxima.h:109
void VariableActionWxLoadFileName(const wxString &value)
Called if maxima tells us the name of a package that was loaded.
Definition: wxMaxima.cpp:3611
void OnFollow(wxCommandEvent &event)
Called when the "Scroll to currently evaluated" button is pressed.
Definition: wxMaxima.cpp:10964
void NetworkDClick(wxCommandEvent &ev)
Issued on double click on the network status.
Definition: wxMaxima.cpp:10928
bool DocumentSaved()
Does this document need saving?
Definition: wxMaxima.h:139
void EditMenu(wxCommandEvent &event)
Processes "Edit menu" clicks.
Definition: wxMaxima.cpp:6162
static void Set_Maxima_Commandline_Filename(const wxString &filename)
Use this maxima command (from a command line option) instead of the configured path.
Definition: wxMaxima.h:166
TextCell * DoRawConsoleAppend(wxString s, CellType type, AppendOpt opts={})
Append one or more lines of ordinary unicode text to the console.
Definition: wxMaxima.cpp:2174
long long GetMaximaCpuTime()
How much CPU time has maxima used till now? Used by GetMaximaCPUPercentage.
Definition: wxMaxima.cpp:5813
void ReplaceSuggestion(wxCommandEvent &event)
Processes clicks on suggestions.
Definition: wxMaxima.cpp:10569
void SetCWD(wxString file)
Set the current working directory file I/O from maxima is relative to.
Definition: wxMaxima.cpp:4022
static wxRegEx m_xmlOpeningTagName
Finds the name of an opening tag.
Definition: wxMaxima.h:259
void EditInputMenu(wxCommandEvent &event)
Spawn the "configure" menu.
Definition: wxMaxima.cpp:10208
void LoadImage(const wxString &file)
Load an image from a file into the worksheet.
Definition: wxMaxima.h:143
static void EnableIPC()
Allow maxima to click buttons in wxMaxima.
Definition: wxMaxima.h:82
void UpdateToolBar()
Enables and disables the Right toolbar buttons.
Definition: wxMaxima.cpp:5306
void HistoryDClick(wxCommandEvent &event)
Issued on double click on a history item.
Definition: wxMaxima.cpp:10944
void OnNewDemoFiles(wxCommandEvent &event)
Is called when we get a new list of demo files Is called when we get a new list of demo files.
Definition: wxMaxima.cpp:1775
void VariableActionTempDir(const wxString &value)
Called if maxima tells us where the temp files lie.
Definition: wxMaxima.cpp:3430
wxString GetCommand(bool params=true)
returns the command to start maxima
Definition: wxMaxima.cpp:4738
static wxString m_mathPrefix1
A marker for the start of maths.
Definition: wxMaxima.h:727
void VariableActionNumer(const wxString &value)
Called if maxima tells us the value of the maxima variable numer.
Definition: wxMaxima.cpp:3655
bool OpenFile(const wxString &file, const wxString &command={})
Open a file.
Definition: wxMaxima.cpp:5440
void OnFind(wxFindDialogEvent &event)
Is triggered when the "Find" button in the search dialog is pressed.
Definition: wxMaxima.cpp:6577
void OnSymbolAdd(wxCommandEvent &event)
Sends a new char to the symbols sidebar.
Definition: wxMaxima.cpp:6651
void VariableActionDebugmode(const wxString &value)
Called if maxima tells us the value of the maxima variable debugmode.
Definition: wxMaxima.cpp:3441
wxInputStream * m_maximaStderr
The stderr of the maxima process.
Definition: wxMaxima.h:723
void VariableActionStringdisp(const wxString &value)
Called if maxima tells us the value of the maxima variable stringdisp
Definition: wxMaxima.cpp:3645
bool OpenMACFile(const wxString &file, Worksheet *document, bool clearDocument=true)
Opens a .mac file or a .out file from Xmaxima.
Definition: wxMaxima.cpp:4068
bool OpenWXMXFile(const wxString &file, Worksheet *document, bool clearDocument=true)
Opens a wxmx file.
Definition: wxMaxima.cpp:4227
void KillMaxima(bool logMessage=true)
kills the maxima process
Definition: wxMaxima.cpp:2842
void VarAddAllEvent(wxCommandEvent &event)
Trigger adding all variables to the variables sidebar.
Definition: wxMaxima.cpp:10222
void VariableActionSinnpiflag(const wxString &value)
Called if maxima tells us the value of the maxima variable sinnpiflag.
Definition: wxMaxima.cpp:3377
void ListMenu(wxCommandEvent &event)
Processes "list menu" clicks.
Definition: wxMaxima.cpp:8338
void ReadStdErr()
Polls the stderr and stdout of maxima for input.
Definition: wxMaxima.cpp:5678
void ReadAddVariables(const wxXmlDocument &xmldoc)
Reads the "add variable to watch list" tag maxima can send us.
Definition: wxMaxima.cpp:3827
static bool GetExitOnError()
Do we exit if we encounter an error?
Definition: wxMaxima.h:77
void PropertiesMenu(wxCommandEvent &event)
Processes "Variable/Function props menu" clicks.
Definition: wxMaxima.cpp:6661
void VariableActionLogexpand(const wxString &value)
Called if maxima tells us the value of the maxima variable logexpand.
Definition: wxMaxima.cpp:3412
void VariableActionAlgebraic(const wxString &value)
Called if maxima tells us the value of the maxima variable algebraic
Definition: wxMaxima.cpp:3665
void VariableActionMaximaSharedir(const wxString &value)
Called if maxima tells us the maxima share dir.
Definition: wxMaxima.cpp:3592
void TriggerEvaluation()
Try to evaluate the next command for maxima that is in the evaluation queue.
Definition: wxMaxima.cpp:10401
void OnTimerEvent(wxTimerEvent &event)
Is triggered when a timer this class is responsible for requires.
Definition: wxMaxima.cpp:5893
void PassKeyboardFocus()
Forwards the keyboard focus to a text control that might need it.
Definition: wxMaxima.cpp:11125
void ReadPrompt(const wxString &data)
Reads the input prompt from Maxima.
Definition: wxMaxima.cpp:3898
double GetMaximaCPUPercentage()
How much CPU horsepower is maxima using currently?
Definition: wxMaxima.cpp:5865
void NumericalMenu(wxCommandEvent &event)
Processes "Numerical menu" clicks.
Definition: wxMaxima.cpp:9052
bool m_closing
Did we tell maxima to close?
Definition: wxMaxima.h:769
void SendMaxima(wxString s, bool addToHistory=false)
Definition: wxMaxima.cpp:2306
void ResetTitle(bool saved, bool force=false)
Update the title.
Definition: wxMaxima.cpp:10814
void ReadVariables(const wxXmlDocument &xmldoc)
Reads the variable values maxima advertises to us.
Definition: wxMaxima.cpp:3307
void OnJumpToError(wxCommandEvent &event)
Called when the "Scroll to last error" button is pressed.
void VariableActionMaximaInfodir(const wxString &value)
Called if maxima tells us the maxima info dir.
Definition: wxMaxima.cpp:3465
wxString m_maximaTempDir
The directory with maxima's temp files.
Definition: wxMaxima.h:771
void OnReplaceAll(wxFindDialogEvent &event)
Is triggered when the "Replace All" button in the search dialog is pressed.
Definition: wxMaxima.cpp:6631
void DrawMenu(wxCommandEvent &event)
Processes "draw menu" clicks.
Definition: wxMaxima.cpp:8172
void VariableActionEngineeringFormat(const wxString &value)
Called if maxima tells us the value of the maxima variable engineering_format_floats
Definition: wxMaxima.cpp:3683
void VariableActionLispVersion(const wxString &value)
Called if maxima tells us the lisp version.
Definition: wxMaxima.cpp:3607
bool OpenXML(const wxString &file, Worksheet *document)
Opens a content.xml file that has been extracted from a broken .wxmx file.
Definition: wxMaxima.cpp:4538
void SimplifyMenu(wxCommandEvent &event)
Processes "Simplify menu" clicks.
Definition: wxMaxima.cpp:8538
void Interrupt(wxCommandEvent &event)
Interrupt button and hotkey presses Make the menu item, toolbars and panes visible that should be vis...
Definition: wxMaxima.cpp:2714
wxProcess * m_gnuplotProcess
The gnuplot process info.
Definition: wxMaxima.h:263
void OnFocus(wxFocusEvent &event)
Called when this window is focussed or defocussed.
Definition: wxMaxima.cpp:11119
void VariableActionMaximaHtmldir(const wxString &value)
Called if maxima tells us the maxima html dir.
Definition: wxMaxima.cpp:3472
void ReadManualTopicNames(const wxXmlDocument &xmldoc)
Read a manual topic name so we can jump to the right documentation page.
Definition: wxMaxima.cpp:3207
TimerIDs
An enum of individual IDs for all timers this class handles.
Definition: wxMaxima.h:92
@ KEYBOARD_INACTIVITY_TIMER_ID
The keyboard was inactive long enough that we can attempt an auto-save.
Definition: wxMaxima.h:94
@ AUTO_SAVE_TIMER_ID
The time between two auto-saves has elapsed.
Definition: wxMaxima.h:96
@ MAXIMA_STDOUT_POLL_ID
We look if we got new data from maxima's stdout.
Definition: wxMaxima.h:98
bool StartServer()
starts the server
Definition: wxMaxima.cpp:2530
long m_commandIndex
The Char the current command starts at in the current WorkingGroup.
Definition: wxMaxima.h:778
void VariableActionSinnpiflagUndefined()
Called if maxima tells us that the maxima variable sinnpiflag is undefined.
Definition: wxMaxima.cpp:3381
bool CheckWXMXVersion(const wxString &docversion)
Complains if the version string from the XML file indicates too low a maxima version.
Definition: wxMaxima.cpp:4516
void OnClose(wxCloseEvent &event)
close wxMaxima window
Definition: wxMaxima.cpp:9624
void VariableActionHtmlHelp(const wxString &value)
Called if maxima tells us the value of the maxima variable output_format_for_help.
Definition: wxMaxima.cpp:3693
wxMaxima(wxWindow *parent, int id, const wxString &title, const wxString &filename=wxEmptyString, const wxString &initialWorksheetContents=wxEmptyString, const wxPoint pos=wxDefaultPosition, const wxSize size=wxDefaultSize)
Definition: wxMaxima.cpp:197
void VariableActionOperators(const wxString &value)
Called if maxima sends us the list of known operators.
Definition: wxMaxima.cpp:3778
void VariableActionLmxChar(const wxString &value)
Called if maxima tells us the value of the maxima variable lmxchar
Definition: wxMaxima.cpp:3629
void MaximaDClick(wxCommandEvent &ev)
Issued on double click on the Maxima status icon.
Definition: wxMaxima.cpp:10934
bool SaveNecessary()
Does this file contain anything worth saving?
Definition: wxMaxima.cpp:10193
wxProcess * m_gnuplotTerminalQueryProcess
Info about the gnuplot process we start for querying the terminals it supports.
Definition: wxMaxima.h:265
void StripLispComments(wxString &s)
Remove empty statements.
Definition: wxMaxima.cpp:2291
void MenuCommand(const wxString &cmd)
Inserts command cmd into the worksheet.
Definition: wxMaxima.cpp:5183
void ReadStatusBar(const wxXmlDocument &xmldoc)
Reads the output of wxstatusbar() commands.
Definition: wxMaxima.cpp:3186
static const wxString m_promptSuffix
The marker for the end of a input prompt.
Definition: wxMaxima.h:734
bool OpenWXMFile(const wxString &file, Worksheet *document, bool clearDocument=true)
Opens a wxm file.
Definition: wxMaxima.cpp:4129
bool QueryVariableValue()
Query the value of a new maxima variable.
Definition: wxMaxima.cpp:3859
void StatusMsgDClick(wxCommandEvent &ev)
Issued on double click on the status message in the status bar.
Definition: wxMaxima.cpp:10938
void ShowMaximaHelp(wxString={})
Show the help for Maxima.
Definition: wxMaxima.cpp:4934
void HelpMenu(wxCommandEvent &event)
Processes "Help menu" clicks.
Definition: wxMaxima.cpp:9341
wxString GetCWD()
Get the current working directory file I/O from maxima is relative to.
Definition: wxMaxima.h:695
std::unique_ptr< GroupCell > CreateTreeFromXMLNode(wxXmlNode *xmlcells, const wxString &wxmxfilename={})
Loads a wxmx description.
Definition: wxMaxima.cpp:4603
void VariableActionShowtime(const wxString &value)
Called if maxima tells us the value of the maxima variable showtime
Definition: wxMaxima.cpp:3674
void ShowPane(wxCommandEvent &event)
Toggle the visibility of a pane.
Definition: wxMaxima.cpp:10902
void ShowMaximaHelpWithoutAnchor()
Show the help for Maxima (without handling of anchors).
Definition: wxMaxima.cpp:4885
void ReadFirstPrompt(const wxString &data)
Determines the process id of maxima from its initial output.
Definition: wxMaxima.cpp:3049
long long GetTotalCpuTime()
How much CPU time has been used by the system until now? Used by GetMaximaCPUPercentage.
Definition: wxMaxima.cpp:5778
bool StartMaxima(bool force=false)
starts maxima (uses getCommand) or restarts it if needed
Definition: wxMaxima.cpp:2587
void ExitAfterEval(bool exitaftereval)
Do we want to exit the program after evaluation?
Definition: wxMaxima.h:119
void VariableActionAutoplay(const wxString &value)
Called if maxima tells us the value of the maxima variable wxanimate_autoplay
Definition: wxMaxima.cpp:3714
void VariableActionWxSubscripts(const wxString &value)
Called if maxima tells us the value of the maxima variable wxsubscripts
Definition: wxMaxima.cpp:3618
wxString m_gnuplotcommand
Maxima's idea about gnuplot's location.
Definition: wxMaxima.h:776
void ServerEvent(wxSocketEvent &event)
Server event: Maxima connects.
Definition: wxMaxima.cpp:2485
static wxString m_mathPrefix2
A marker for the start of maths.
Definition: wxMaxima.h:729
void MatrixMenu(wxCommandEvent &event)
Processes "algebra menu" clicks.
Definition: wxMaxima.cpp:7847
void SetupVariables()
Setup maxima's variables.
Definition: wxMaxima.cpp:4637
void OnDemoFileMenu(wxCommandEvent &ev)
Is called when a demo file menu is clicked.
Definition: wxMaxima.cpp:1828
void UpdateSlider()
Updates the slider to show the right frame.
Definition: wxMaxima.cpp:10874
void TableOfContentsSelection(wxListEvent &event)
Issued on double click on a table of contents item.
Definition: wxMaxima.cpp:10950
void VariableActionLispName(const wxString &value)
Called if maxima tells us the lisp name.
Definition: wxMaxima.cpp:3603
void ConfigChanged()
Is called on start and whenever the configuration changes.
Definition: wxMaxima.cpp:137
void EvaluateEvent(wxCommandEvent &event)
Handle the evaluation event.
Definition: wxMaxima.cpp:10243
static wxString m_firstPrompt
The first prompt maxima will output.
Definition: wxMaxima.h:758
void CalculusMenu(wxCommandEvent &event)
event handling for menus
Definition: wxMaxima.cpp:8797
bool SaveOnClose()
Try to save the file before closing it - or return false.
Definition: wxMaxima.cpp:9580
void VariableActionGnuplotCommand(const wxString &value)
Called if maxima tells us the value of the maxima variable gnuplot
Definition: wxMaxima.cpp:3558
The Right Way to delete a wxSocketServer.
Definition: wxMaxima.h:706
This file declares the class wxMaximaFrame.