wxMaxima
Loading...
Searching...
No Matches
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#ifdef USE_QA
50#include <wx/debugrpt.h>
51#endif
52#include <memory>
53#ifdef __WXMSW__
54#include <windows.h>
55#endif
56#include <unordered_map>
57
59#define MAXIMAPOLLMSECS 2000
60
61class Maxima; // The Maxima process interface
62
63/* The top-level window and the main application logic
64
65 */
66class wxMaxima : public wxMaximaFrame
67{
68public:
69 wxMaxima(wxWindow *parent, int id, const wxString &title,
70 const wxString &filename = wxEmptyString,
71 const wxString &initialWorksheetContents = wxEmptyString,
72 const wxPoint pos = wxDefaultPosition, const wxSize size = wxDefaultSize);
73
74 virtual ~wxMaxima();
75 wxString EscapeFilenameForShell(wxString name);
77 static void ExitOnError(){m_exitOnError = true;}
79 static bool GetExitOnError(){return m_exitOnError;}
84 static void EnableIPC(){ MaximaIPC::EnableIPC(); }
86 static bool GetEnableIPC(){ return MaximaIPC::GetEnableIPC(); }
88 static void ExtraMaximaArgs(const wxString &args){m_extraMaximaArgs = args;}
90 static wxString ExtraMaximaArgs(){return m_extraMaximaArgs;}
91
94 {
101 };
102
103#ifdef wxHAS_POWER_EVENTS
104 void OnPowerEvent(wxPowerEvent &event);
105#endif
106
108 void OnTimerEvent(wxTimerEvent &event);
109
112
113 void ShowTip(bool force);
115 void EvalOnStartup(bool eval)
116 {
117 m_evalOnStartup = eval;
118 }
119
121 void ExitAfterEval(bool exitaftereval)
122 {
123 m_exitAfterEval = exitaftereval;
124 }
125
126 void StripLispComments(wxString &s);
127
129 void LaunchHelpBrowser(wxString uri);
130
131 void SendMaxima(wxString s, bool addToHistory = false);
132
134 bool OpenFile(const wxString &file, const wxString &command ={});
135
138 { return m_fileSaved; }
139
141 void LoadImage(const wxString &file)
142 { GetWorksheet()->OpenHCaret(file, GC_TYPE_IMAGE); }
143
145 bool QueryVariableValue();
146
149 {
150 public:
151 explicit VersionNumber(const wxString &version);
152 long Major() const {return m_major;}
153 long Minor() const {return m_minor;}
154 long Patchlevel() const {return m_patchlevel;}
155 friend bool operator<(const VersionNumber& v1, const VersionNumber& v2);
156 friend bool operator>(const VersionNumber& v1, const VersionNumber& v2);
157 private:
158 long m_major = -1;
159 long m_minor = -1;
160 long m_patchlevel = -1;
161 };
162
164 static void Set_Maxima_Commandline_Filename(const wxString &filename)
165 {maxima_command_line_filename = filename;}
167 static const wxString Get_Maxima_Commandline_Filename() {return maxima_command_line_filename;}
168
169 static int GetExitCode(){return m_exitCode;}
170
171private:
173 static wxString maxima_command_line_filename;
175 bool m_maximaAuthenticated = false;
177 bool m_discardAllData = false;
179 wxString m_maximaAuthString;
181 MaximaIPC m_ipc{this};
183 static bool m_exitOnError;
185 static wxString m_extraMaximaArgs;
187 std::vector<wxString> m_varNamesToQuery;
188
190 bool m_openInitialFileError = false;
192 wxString EscapeForLisp(wxString str);
194 long long m_maximaJiffies_old = 0;
196 long long m_cpuTotalJiffies_old = 0;
199 wxString m_configCommands;
201 static wxRegEx m_gnuplotErrorRegex;
203 bool AbortOnError();
205 wxString m_oldFindString;
207 int m_oldFindFlags = 0;
209 bool m_hasEvaluatedCells = false;
211 long m_outputCellsFromCurrentCommand = 0;
213 long m_maxOutputCellsPerCommand = 0;
220 int m_unsuccessfulConnectionAttempts = 11;
222 wxString m_CWD;
224 bool m_evalOnStartup = false;
226 bool m_exitAfterEval = false;
228 bool m_ready = false;
229
234 wxString GetUnmatchedParenthesisState(wxString text, std::size_t &index);
236 wxMemoryBuffer m_uncompletedChars;
237
238protected:
240 void CommandWiz(const wxString &title,
241 const wxString &description, const wxString &description_tooltip,
242 const wxString &commandRule,
243 wxString label1, wxString defaultval1, wxString tooltip1 = {},
244 wxString label2 = {}, wxString defaultval2 = {}, wxString tooltip2 = {},
245 wxString label3 = {}, wxString defaultval3 = {}, wxString tooltip3 = {},
246 wxString label4 = {}, wxString defaultval4 = {}, wxString tooltip4 = {},
247 wxString label5 = {}, wxString defaultval5 = {}, wxString tooltip5 = {},
248 wxString label6 = {}, wxString defaultval6 = {}, wxString tooltip6 = {},
249 wxString label7 = {}, wxString defaultval7 = {}, wxString tooltip7 = {},
250 wxString label8 = {}, wxString defaultval8 = {}, wxString tooltip8 = {},
251 wxString label9 = {}, wxString defaultval9 = {}, wxString tooltip9 = {},
252 wxString label10 = {}, wxString defaultval10 = {}, wxString tooltip10 = {}
253 );
255 wxString ReadPotentiallyUnclosedTag(wxStringTokenizer &lines, wxString firstLine);
256
258 static wxRegEx m_xmlOpeningTagName;
260 static wxRegEx m_xmlOpeningTag;
262 wxProcess *m_gnuplotProcess = NULL;
266 bool m_isActive = true;
268 void OnFocus(wxFocusEvent &event);
269
271 void PassKeyboardFocus();
273 void OnMinimize(wxIconizeEvent &event);
275 void ConfigChanged();
277 void OnJumpToError(wxCommandEvent &event);
279 void OnSymbolAdd(wxCommandEvent &event);
281 void OnFollow(wxCommandEvent &event);
282 void OnWizardAbort(wxCommandEvent &event);
283 void OnWizardOK(wxCommandEvent &event);
284 void OnWizardInsert(wxCommandEvent &event);
285 void OnWizardHelpButton(wxCommandEvent &event);
286
288 void ShowMaximaHelp(wxString = {});
289
292
294 void ShowWxMaximaHelp();
295
297 void ShowHelp(const wxString &keyword);
298
299 void CheckForUpdates(bool reportUpToDate = false);
300
301 void OnRecentDocument(wxCommandEvent &event);
302 void OnRecentPackage (wxCommandEvent &event);
303 void OnUnsavedDocument(wxCommandEvent &event);
304
305 void OnChar(wxKeyEvent &event);
306 void OnKeyDown(wxKeyEvent &event);
307
334 void OnIdle(wxIdleEvent &event);
335 bool m_dataFromMaximaIs = false;
336
337 void MenuCommand(const wxString &cmd);
338 void FileMenu(wxCommandEvent &event);
339 void MaximaMenu(wxCommandEvent &event);
340 void MatrixMenu(wxCommandEvent &event);
341 void PropertiesMenu(wxCommandEvent &event);
342 void EquationsMenu(wxCommandEvent &event);
343 void CalculusMenu(wxCommandEvent &event);
344 void SimplifyMenu(wxCommandEvent &event);
345 void PlotMenu(wxCommandEvent &event);
346 void ListMenu(wxCommandEvent &event);
347 void DrawMenu(wxCommandEvent &event);
348 void NumericalMenu(wxCommandEvent &event);
349 void HelpMenu(wxCommandEvent &event);
350 void EditMenu(wxCommandEvent &event);
351 void ReplaceSuggestion(wxCommandEvent &event);
352 void Interrupt(wxCommandEvent &event);
354 void UpdateMenus();
355 void UpdateToolBar();
356 void UpdateSlider();
360 void ShowPane(wxCommandEvent &event); //<! Makes a sidebar visible
361 void OnMaximaClose(wxProcessEvent &event); //
362 void OnMaximaClose(); //
363 void OnGnuplotClose(wxProcessEvent &event); //
364 void OnGnuplotQueryTerminals(wxProcessEvent &event); //
365 void PopupMenu(wxCommandEvent &event); //
366 void StatsMenu(wxCommandEvent &event); //
367
369 void ChangeCellStyle(wxCommandEvent &event);
370
372 void OnFind(wxFindDialogEvent &event);
373
375 void OnReplace(wxFindDialogEvent &event);
376
378 void OnReplaceAll(wxFindDialogEvent &event);
379
381 void OnMaximaConnect();
382
384 void MaximaEvent(wxThreadEvent &event);
385
387 void ServerEvent(wxSocketEvent &event);
388
395 void AddDrawParameter(wxString cmd, int dimensionsOfNewDrawCommand = 2);
396
397 /* Append something to the console. Might be Text or XML maths.
398
399 \return A pointer to the last line of Unicode text that was appended or
400 NULL, if there is no such line (for example if the appended object is
401 maths instead).
402 */
403 TextCell *ConsoleAppend(wxString s, CellType type);
404 void ConsoleAppend(wxXmlDocument xml, CellType type, const wxString &userLabel = {});
405
406 enum AppendOpt { NewLine = 1, BigSkip = 2, PromptToolTip = 4, DefaultOpt = NewLine|BigSkip };
407 void DoConsoleAppend(wxString s, CellType type, AppendOpt opts = AppendOpt::DefaultOpt,
408 const wxString &userLabel = {});
409
414 TextCell *DoRawConsoleAppend(wxString s, CellType type, AppendOpt opts = {});
415
420 void EditInputMenu(wxCommandEvent &event);
422 void VarReadEvent(wxCommandEvent &event);
424 void VarAddAllEvent(wxCommandEvent &event);
425 void EvaluateEvent(wxCommandEvent &event); //
426 void InsertMenu(wxCommandEvent &event); //
427 void PrintMenu(wxCommandEvent &event);
428
429 void SliderEvent(wxScrollEvent &event);
430
432 void NetworkDClick(wxCommandEvent &ev);
434 void MaximaDClick(wxCommandEvent &ev);
436 void StatusMsgDClick(wxCommandEvent &ev);
437
439 void HistoryDClick(wxCommandEvent &event);
440
442 void TableOfContentsSelection(wxListEvent &event);
443
444 void OnInspectorEvent(wxCommandEvent &ev);
445
446 void DumpProcessOutput();
447
449 void TriggerEvaluation();
450
451 void TryUpdateInspector();
452
453 bool UpdateDrawPane();
454
455 wxString ExtractFirstExpression(const wxString &entry);
456
457 wxString GetDefaultEntry();
458
460 bool StartServer();
469 bool StartMaxima(bool force = false);
470
471 void OnClose(wxCloseEvent &event);
472 wxString GetCommand(bool params = true);
473 // (uses guessConfiguration)
474
476 void ReadStdErr();
477
488 void ReadFirstPrompt(const wxString &data);
489
497 void ReadMiscText(const wxString &data);
498
503 void ReadPrompt(const wxString &data);
504
510 void ReadStatusBar(const wxXmlDocument &xmldoc);
512 void ReadManualTopicNames(const wxXmlDocument &xmldoc);
513
522 void ReadMath(const wxXmlDocument &xml);
523
529 void ReadMaximaIPC(const wxString &data){m_ipc.ReadInputData(data);}
530 void ReadLoadSymbols(const wxXmlDocument &data);
531
533 void ReadSuppressedOutput(const wxString &data);
534
537 void ReadVariables(const wxXmlDocument &xmldoc);
538
541 void ReadAddVariables(const wxXmlDocument &xmldoc);
543 void VariableActionGentranlang(const wxString &value);
545 void VariableActionNumer(const wxString &value);
547 void VariableActionDisplay2d_Unicode(const wxString &value);
549 void VariableActionHtmlHelp(const wxString &value);
551 void VariableActionOpSubst(const wxString &value);
553 void VariableActionSinnpiflag(const wxString &value);
557 void VariableActionLogexpand(const wxString &value);
559 void VariableActionUserDir(const wxString &value);
561 void VariableActionTempDir(const wxString &value);
563 void VariableActionDebugmode(const wxString &value);
565 void VariableActionAutoconfVersion(const wxString &value);
567 void VariableActionAutoconfHost(const wxString &value);
569 void VariableActionMaximaInfodir(const wxString &value);
571 void VariableActionMaximaHtmldir(const wxString &value);
573 void VariableActionGnuplotCommand(const wxString &value);
575 void VariableActionMaximaSharedir(const wxString &value);
577 void VariableActionMaximaDemodir(const wxString &value);
579 void VariableActionLispName(const wxString &value);
581 void VariableActionLispVersion(const wxString &value);
583 void VariableActionWxLoadFileName(const wxString &value);
585 void VariableActionWxSubscripts(const wxString &value);
587 void VariableActionLmxChar(const wxString &value);
589 void VariableActionDisplay2D(const wxString &value);
591 void VariableActionAltDisplay2D(const wxString &value);
593 void VariableActionAlgebraic(const wxString &value);
595 void VariableActionShowtime(const wxString &value);
597 void VariableActionDomain(const wxString &value);
599 void VariableActionAutoplay(const wxString &value);
601 void VariableActionEngineeringFormat(const wxString &value);
603 void VariableActionStringdisp(const wxString &value);
605 void VariableActionOperators(const wxString &value);
606 wxString m_maximaVariable_wxSubscripts;
607 wxString m_maximaVariable_lmxchar;
608 wxString m_maximaVariable_display2d;
609 wxString m_maximaVariable_altdisplay2d;
610 wxString m_maximaVariable_engineeringFormat;
611 bool m_readMaximaVariables = false;
612 bool m_updateAutocompletion = true;
617 long long GetTotalCpuTime();
618
624 long long GetMaximaCpuTime();
625
630 double GetMaximaCPUPercentage();
631
633 bool SaveNecessary();
634
643 void SetupVariables();
644
645 void KillMaxima(bool logMessage = true);
653 void ResetTitle(bool saved, bool force = false);
654
655 void FirstOutput();
656
659 bool OpenXML(const wxString &file, Worksheet *document);
660
662 bool CheckWXMXVersion(const wxString &docversion);
663
665 bool OpenMACFile(const wxString &file, Worksheet *document, bool clearDocument = true);
666
668 bool OpenWXMFile(const wxString &file, Worksheet *document, bool clearDocument = true);
669
671 bool OpenWXMXFile(const wxString &file, Worksheet *document, bool clearDocument = true);
672
674 std::unique_ptr<GroupCell> CreateTreeFromXMLNode(wxXmlNode *xmlcells, const wxString &wxmxfilename = {});
675
681 bool SaveFile(bool forceSave = false);
682
684 bool SaveOnClose();
689 bool AutoSave();
690
698 int SaveDocumentP();
699
701 void SetCWD(wxString file);
702
704 wxString GetCWD()
705 {
706 return m_CWD;
707 }
708
709 std::unique_ptr<Maxima> m_client;
716 void operator()(wxSocketServer* server) const {
717 server->Destroy(); // Destroy() calls Close() automatically.
718 }
719 };
726 std::unique_ptr<wxSocketServer, ServerDeleter> m_server;
727
728 wxProcess *m_maximaProcess = NULL;
730 wxInputStream *m_maximaStdout = NULL;
732 wxInputStream *m_maximaStderr = NULL;
734 int m_port = -1;
736 static wxString m_mathPrefix1;
738 static wxString m_mathPrefix2;
740 static wxString m_promptPrefix;
741public:
743 const static wxString m_promptSuffix;
744protected:
750 void QuestionAnswered(){if(GetWorksheet()) GetWorksheet()->QuestionAnswered();}
753 void OnNewDemoFiles(wxCommandEvent &event);
755 void OnDemoFileMenu(wxCommandEvent &ev);
756
758 void OnUpdateTOCEvent(wxCommandEvent &event);
759
760 void OnSize(wxSizeEvent &event);
761 void OnMove(wxMoveEvent &event);
762 void OnMaximize(wxCommandEvent &event);
763
765 void GnuplotCommandName(wxString gnuplot);
767 static wxString m_firstPrompt;
768 bool m_dispReadOut = false;
769 wxWindowIDRef m_gnuplot_process_id;
770 wxWindowIDRef m_maxima_process_id;
771 wxString m_lastPrompt;
772 wxString m_lastPath;
773 std::unique_ptr<wxPrintData> m_printData;
778 bool m_closing = false;
781 wxString m_maximaHtmlDir;
782 bool m_fileSaved = true;
783 static int m_exitCode;
786#ifdef __WINDOWS__
787 // For Windows, store "gnuplot.exe", even if wgnuplot.exe is preferred.
788 // We query the terminals using: gnuplot -e "print GPVAL_TERMINALS"
789 // and that does only work with gnuplot, not wgnuplot.
791 wxString m_gnuplotcommand_commandline;
792#endif
793 long m_commandIndex = -1;
795 static wxRegEx m_funRegEx;
796 static wxRegEx m_varRegEx;
797 static wxRegEx m_blankStatementRegEx;
798 static wxRegEx m_sbclCompilationRegEx;
799 MathParser m_parser;
800 bool m_maximaBusy = true;
801private:
802 bool m_fourierLoaded = false;
804 wxString m_logexpand;
806 typedef void (wxMaxima::*VarReadFunction)(const wxString &value);
807 typedef void (wxMaxima::*VarUndefinedFunction)();
808 typedef std::unordered_map <wxString, VarReadFunction, wxStringHash> VarReadFunctionHash;
809 typedef std::unordered_map <wxString, VarUndefinedFunction,
810 wxStringHash> VarUndefinedFunctionHash;
812 static VarReadFunctionHash m_variableReadActions;
814 static VarUndefinedFunctionHash m_variableUndefinedActions;
815
816#if wxUSE_DRAG_AND_DROP
817
818 friend class MyDropTarget;
819
820#endif
821 friend class MaximaIPC;
822
833 wxTimer m_autoSaveTimer;
834
835 /* A timer that delays redraws while maxima evaluates
836
837 If we always start a redraw when maxima has nearly finished a command that slows
838 down evaluating many simple commands in a row.
839 */
840 wxTimer m_fastResponseTimer;
841
843 void StartAutoSaveTimer();
844};
845
846#if wxUSE_DRAG_AND_DROP
847
848// cppcheck-suppress noConstructor
849class MyApp : public wxApp
850{
851public:
852 virtual bool OnInit();
853 virtual int OnRun();
854 virtual int OnExit();
855#if wxUSE_ON_FATAL_EXCEPTION && wxUSE_CRASHREPORT
856 void OnFatalException () override;
857#endif
871 static void NewWindow(const wxString &file = {}, bool evalOnStartup = false, bool exitAfterEval = false, unsigned char *wxmData = NULL, std::size_t wxmLen = 0);
872
873 void OnFileMenu(wxCommandEvent &ev);
874
875 virtual void MacNewFile();
876
877 virtual void MacOpenFile(const wxString &file);
878
879public:
880 static wxLogWindow *m_logWindow; // The wxWidgets log window, we use.
881 static int m_windowcount;
882
883 std::unique_ptr<wxLogChain> m_logChain;
884 static std::vector<wxProcess *> m_wxMaximaProcesses;
885#ifdef USE_QA
886#if wxUSE_ON_FATAL_EXCEPTION && wxUSE_CRASHREPORT
887 void GenerateDebugReport(wxDebugReport::Context ctx);
888#endif
889#endif
890 std::unique_ptr<wxLocale> m_locale;
891 std::unique_ptr<wxTranslations> m_translations;
893 wxString m_configFileName;
894 Dirstructure m_dirstruct;
895 static bool m_allWindowsInOneProcess;
896};
897
898class MyDropTarget : public wxFileDropTarget
899{
900public:
901 explicit MyDropTarget(wxMaxima *wxmax)
902 { m_wxmax = wxmax; }
903
904 bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &files);
905
906private:
907 wxMaxima *m_wxmax = NULL;
908};
909
910#endif
911
912
913// cppcheck-suppress noConstructor
914
915#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
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:1289
void QuestionAnswered()
Mark the current question from maxima as "answered"..
Definition: Worksheet.cpp:3354
The frame containing the menu and the sidebars.
Definition: wxMaximaFrame.h:65
A version number that can be compared using "<" and ">".
Definition: wxMaxima.h:149
Definition: wxMaxima.h:67
void PlotMenu(wxCommandEvent &event)
Processes "Plot menu" cloicks.
Definition: wxMaxima.cpp:9095
void OnIdle(wxIdleEvent &event)
The idle task that refreshes the gui (worksheet, menus, title line,...)
Definition: wxMaxima.cpp:5062
void VariableActionAutoconfVersion(const wxString &value)
Called if maxima tells us the maxima version as defined by autoconf.
Definition: wxMaxima.cpp:3474
int m_port
The port the actual maxima process (not its wrapper script) runs at.
Definition: wxMaxima.h:734
bool AutoSave()
Save the project in a temp file.
Definition: wxMaxima.cpp:6020
bool m_dispReadOut
what is displayed in statusbar
Definition: wxMaxima.h:768
void FileMenu(wxCommandEvent &event)
Processes "file menu" clicks.
Definition: wxMaxima.cpp:6065
bool m_scheduleUpdateToc
True = schedule an update of the table of contents.
Definition: wxMaxima.h:749
void VariableActionGentranlang(const wxString &value)
Called if maxima tells us the value of the maxima variable gentranlang.
Definition: wxMaxima.cpp:3415
bool SaveFile(bool forceSave=false)
Saves the current file.
Definition: wxMaxima.cpp:5671
void VariableActionDisplay2d_Unicode(const wxString &value)
Called if maxima tells us the value of the maxima variable display2d_unicode.
Definition: wxMaxima.cpp:3408
void ShowTip(bool force)
Definition: wxMaxima.cpp:4883
void VariableActionUserDir(const wxString &value)
Called if maxima tells us where the user files are located.
Definition: wxMaxima.cpp:3402
void ReadMiscText(const wxString &data)
Reads text that isn't enclosed between xml tags.
Definition: wxMaxima.cpp:3130
void ReadMath(const wxXmlDocument &xml)
Reads the math cell's contents from Maxima.
Definition: wxMaxima.cpp:3276
static wxRegEx m_xmlOpeningTag
Looks if this opening tag is actually complete.
Definition: wxMaxima.h:260
void EquationsMenu(wxCommandEvent &event)
Processes "equations menu" clicks.
Definition: wxMaxima.cpp:7727
void VariableActionDomain(const wxString &value)
Called if maxima tells us the value of the maxima variable domain
Definition: wxMaxima.cpp:3813
static wxString m_promptPrefix
The marker for the start of a input prompt.
Definition: wxMaxima.h:740
void OnMinimize(wxIconizeEvent &event)
Called when this window is minimized.
Definition: wxMaxima.cpp:11373
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:167
void VariableActionAltDisplay2D(const wxString &value)
Called if maxima tells us if it currently outputs XML.
Definition: wxMaxima.cpp:3845
void ShowWxMaximaHelp()
Show the help for wxMaxima.
Definition: wxMaxima.cpp:4941
TextCell * ConsoleAppend(wxString s, CellType type)
append maxima output to console
Definition: wxMaxima.cpp:2047
void ChangeCellStyle(wxCommandEvent &event)
Is triggered when the textstyle drop-down box's value is changed.
Definition: wxMaxima.cpp:11380
static wxString ExtraMaximaArgs()
Which additional maxima arguments did we get from the command line?
Definition: wxMaxima.h:90
bool m_isActive
Is this window active?
Definition: wxMaxima.h:266
void VariableActionOpSubst(const wxString &value)
Called if maxima tells us the value of the maxima variable opsubst.
Definition: wxMaxima.cpp:3424
void MaximaEvent(wxThreadEvent &event)
Maxima sends or receives data, or disconnects.
Definition: wxMaxima.cpp:2392
wxString ReadPotentiallyUnclosedTag(wxStringTokenizer &lines, wxString firstLine)
Reads a potentially unclosed XML tag and closes it.
Definition: wxMaxima.cpp:4281
void OnReplace(wxFindDialogEvent &event)
Is triggered when the "Replace" button in the search dialog is pressed.
Definition: wxMaxima.cpp:6702
int SaveDocumentP()
Tries or offers to save the document.
Definition: wxMaxima.cpp:11319
void VariableActionDisplay2D(const wxString &value)
Called if maxima tells us the value of the maxima variable display2d
Definition: wxMaxima.cpp:3822
void ReadMaximaIPC(const wxString &data)
Reads autocompletion templates we get on definition of a function or variable.
Definition: wxMaxima.h:529
void AddDrawParameter(wxString cmd, int dimensionsOfNewDrawCommand=2)
Add a parameter to a draw command.
Definition: wxMaxima.cpp:8250
void ShowHelp(const wxString &keyword)
Try to determine if help is needed for maxima or wxMaxima and show this help.
Definition: wxMaxima.cpp:5022
void MaximaMenu(wxCommandEvent &event)
Processes "maxima menu" clicks.
Definition: wxMaxima.cpp:6884
static void ExtraMaximaArgs(const wxString &args)
Additional maxima arguments from the command line.
Definition: wxMaxima.h:88
void EvalOnStartup(bool eval)
Do we want to evaluate the document on startup?
Definition: wxMaxima.h:115
static void ExitOnError()
Exit if we encounter an error.
Definition: wxMaxima.h:77
void PrintMenu(wxCommandEvent &event)
Definition: wxMaxima.cpp:5290
void OnUpdateTOCEvent(wxCommandEvent &event)
Is called when something requests an update of the table of contents.
Definition: wxMaxima.cpp:5665
void UpdateMenus()
Enables and disables the Right menu buttons.
Definition: wxMaxima.cpp:5329
void LaunchHelpBrowser(wxString uri)
Launches the help browser on the uri passed as an argument.
Definition: wxMaxima.cpp:4899
wxInputStream * m_maximaStdout
The stdout of the maxima process.
Definition: wxMaxima.h:730
void VarReadEvent(wxCommandEvent &event)
Trigger reading all variables from Maxima that are shown in the Variables sidebar.
Definition: wxMaxima.cpp:10396
void GnuplotCommandName(wxString gnuplot)
Sets gnuplot's command name and tries to determine gnuplot's path.
Definition: wxMaxima.cpp:3504
void VariableActionAutoconfHost(const wxString &value)
Called if maxima tells us the maxima build host as defined by autoconf.
Definition: wxMaxima.cpp:3479
static bool GetEnableIPC()
Do we allow maxima to click buttons in wxMaxima?
Definition: wxMaxima.h:86
void ReadSuppressedOutput(const wxString &data)
Read (and discard) suppressed output.
Definition: wxMaxima.cpp:3292
std::unique_ptr< wxSocketServer, ServerDeleter > m_server
The server maxima connects to as client.
Definition: wxMaxima.h:726
void OnMaximaConnect()
Is called if maxima connects to wxMaxima.
Definition: wxMaxima.cpp:2489
wxTimer m_maximaStdoutPollTimer
A timer that polls for output from the maxima process.
Definition: wxMaxima.h:111
void VariableActionWxLoadFileName(const wxString &value)
Called if maxima tells us the name of a package that was loaded.
Definition: wxMaxima.cpp:3701
void OnFollow(wxCommandEvent &event)
Called when the "Scroll to currently evaluated" button is pressed.
Definition: wxMaxima.cpp:11147
void NetworkDClick(wxCommandEvent &ev)
Issued on double click on the network status.
Definition: wxMaxima.cpp:11115
bool DocumentSaved()
Does this document need saving?
Definition: wxMaxima.h:137
void EditMenu(wxCommandEvent &event)
Processes "Edit menu" clicks.
Definition: wxMaxima.cpp:6255
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={}, wxString label10={}, wxString defaultval10={}, wxString tooltip10={})
Invoke our standard wizard that generates maxima commands.
Definition: wxMaxima.cpp:9444
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:164
TextCell * DoRawConsoleAppend(wxString s, CellType type, AppendOpt opts={})
Append one or more lines of ordinary unicode text to the console.
Definition: wxMaxima.cpp:2171
long long GetMaximaCpuTime()
How much CPU time has maxima used till now? Used by GetMaximaCPUPercentage.
Definition: wxMaxima.cpp:5907
void ReplaceSuggestion(wxCommandEvent &event)
Processes clicks on suggestions.
Definition: wxMaxima.cpp:10747
void SetCWD(wxString file)
Set the current working directory file I/O from maxima is relative to.
Definition: wxMaxima.cpp:4110
static wxRegEx m_xmlOpeningTagName
Finds the name of an opening tag.
Definition: wxMaxima.h:258
void EditInputMenu(wxCommandEvent &event)
Spawn the "configure" menu.
Definition: wxMaxima.cpp:10373
void LoadImage(const wxString &file)
Load an image from a file into the worksheet.
Definition: wxMaxima.h:141
static void EnableIPC()
Allow maxima to click buttons in wxMaxima.
Definition: wxMaxima.h:84
void UpdateToolBar()
Enables and disables the Right toolbar buttons.
Definition: wxMaxima.cpp:5397
void HistoryDClick(wxCommandEvent &event)
Issued on double click on a history item.
Definition: wxMaxima.cpp:11127
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:1788
void VariableActionTempDir(const wxString &value)
Called if maxima tells us where the temp files are located.
Definition: wxMaxima.cpp:3449
wxString GetCommand(bool params=true)
returns the command to start maxima
Definition: wxMaxima.cpp:4834
static wxString m_mathPrefix1
A marker for the start of maths.
Definition: wxMaxima.h:736
void VariableActionNumer(const wxString &value)
Called if maxima tells us the value of the maxima variable numer.
Definition: wxMaxima.cpp:3745
bool OpenFile(const wxString &file, const wxString &command={})
Open a file.
Definition: wxMaxima.cpp:5532
void OnFind(wxFindDialogEvent &event)
Is triggered when the "Find" button in the search dialog is pressed.
Definition: wxMaxima.cpp:6677
void OnSymbolAdd(wxCommandEvent &event)
Sends a new char to the symbols sidebar.
Definition: wxMaxima.cpp:6751
void VariableActionDebugmode(const wxString &value)
Called if maxima tells us the value of the maxima variable debugmode.
Definition: wxMaxima.cpp:3459
wxInputStream * m_maximaStderr
The stderr of the maxima process.
Definition: wxMaxima.h:732
void VariableActionStringdisp(const wxString &value)
Called if maxima tells us the value of the maxima variable stringdisp
Definition: wxMaxima.cpp:3735
bool OpenMACFile(const wxString &file, Worksheet *document, bool clearDocument=true)
Opens a .mac file or a .out file from Xmaxima.
Definition: wxMaxima.cpp:4156
bool OpenWXMXFile(const wxString &file, Worksheet *document, bool clearDocument=true)
Opens a wxmx file.
Definition: wxMaxima.cpp:4315
void KillMaxima(bool logMessage=true)
kills the maxima process
Definition: wxMaxima.cpp:2826
void VarAddAllEvent(wxCommandEvent &event)
Trigger adding all variables to the variables sidebar.
Definition: wxMaxima.cpp:10387
void VariableActionSinnpiflag(const wxString &value)
Called if maxima tells us the value of the maxima variable sinnpiflag.
Definition: wxMaxima.cpp:3396
void ListMenu(wxCommandEvent &event)
Processes "list menu" clicks.
Definition: wxMaxima.cpp:8443
void ReadStdErr()
Polls the stderr and stdout of maxima for input.
Definition: wxMaxima.cpp:5772
void ReadAddVariables(const wxXmlDocument &xmldoc)
Reads the "add variable to watch list" tag maxima can send us.
Definition: wxMaxima.cpp:3915
static bool GetExitOnError()
Do we exit if we encounter an error?
Definition: wxMaxima.h:79
void PropertiesMenu(wxCommandEvent &event)
Processes "Variable/Function props menu" clicks.
Definition: wxMaxima.cpp:6761
void VariableActionMaximaDemodir(const wxString &value)
Called if maxima tells us the maxima demo dir.
Definition: wxMaxima.cpp:3685
void VariableActionLogexpand(const wxString &value)
Called if maxima tells us the value of the maxima variable logexpand.
Definition: wxMaxima.cpp:3431
void VariableActionAlgebraic(const wxString &value)
Called if maxima tells us the value of the maxima variable algebraic
Definition: wxMaxima.cpp:3755
void VariableActionMaximaSharedir(const wxString &value)
Called if maxima tells us the maxima share dir.
Definition: wxMaxima.cpp:3674
void TriggerEvaluation()
Try to evaluate the next command for maxima that is in the evaluation queue.
Definition: wxMaxima.cpp:10577
void OnTimerEvent(wxTimerEvent &event)
Is triggered when a timer this class is responsible for requires.
Definition: wxMaxima.cpp:5987
void PassKeyboardFocus()
Forwards the keyboard focus to a text control that might need it.
Definition: wxMaxima.cpp:11361
void ReadPrompt(const wxString &data)
Reads the input prompt from Maxima.
Definition: wxMaxima.cpp:3986
double GetMaximaCPUPercentage()
How much CPU horsepower is maxima using currently?
Definition: wxMaxima.cpp:5959
void NumericalMenu(wxCommandEvent &event)
Processes "Numerical menu" clicks.
Definition: wxMaxima.cpp:9157
bool m_closing
Did we tell maxima to close?
Definition: wxMaxima.h:778
void SendMaxima(wxString s, bool addToHistory=false)
Definition: wxMaxima.cpp:2301
void ResetTitle(bool saved, bool force=false)
Update the title.
Definition: wxMaxima.cpp:11001
void ReadVariables(const wxXmlDocument &xmldoc)
Reads the variable values maxima advertises to us.
Definition: wxMaxima.cpp:3326
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:3483
wxString m_maximaTempDir
The directory with maxima's temp files.
Definition: wxMaxima.h:780
void OnReplaceAll(wxFindDialogEvent &event)
Is triggered when the "Replace All" button in the search dialog is pressed.
Definition: wxMaxima.cpp:6731
void DrawMenu(wxCommandEvent &event)
Processes "draw menu" clicks.
Definition: wxMaxima.cpp:8277
void VariableActionEngineeringFormat(const wxString &value)
Called if maxima tells us the value of the maxima variable engineering_format_floats
Definition: wxMaxima.cpp:3773
void VariableActionLispVersion(const wxString &value)
Called if maxima tells us the lisp version.
Definition: wxMaxima.cpp:3697
bool OpenXML(const wxString &file, Worksheet *document)
Opens a content.xml file that has been extracted from a broken .wxmx file.
Definition: wxMaxima.cpp:4625
void SimplifyMenu(wxCommandEvent &event)
Processes "Simplify menu" clicks.
Definition: wxMaxima.cpp:8643
void Interrupt(wxCommandEvent &event)
Interrupt button and hotkey presses Make the menu item, toolbars and panes visible that should be vis...
Definition: wxMaxima.cpp:2698
wxProcess * m_gnuplotProcess
The gnuplot process info.
Definition: wxMaxima.h:262
void OnFocus(wxFocusEvent &event)
Called when this window is focussed or defocussed.
Definition: wxMaxima.cpp:11355
void VariableActionMaximaHtmldir(const wxString &value)
Called if maxima tells us the maxima html dir.
Definition: wxMaxima.cpp:3490
void ReadManualTopicNames(const wxXmlDocument &xmldoc)
Read a manual topic name so we can jump to the right documentation page.
Definition: wxMaxima.cpp:3226
TimerIDs
An enum of individual IDs for all timers this class handles.
Definition: wxMaxima.h:94
@ KEYBOARD_INACTIVITY_TIMER_ID
The keyboard was inactive long enough that we can attempt an auto-save.
Definition: wxMaxima.h:96
@ AUTO_SAVE_TIMER_ID
The time between two auto-saves has elapsed.
Definition: wxMaxima.h:98
@ MAXIMA_STDOUT_POLL_ID
We look if we got new data from maxima's stdout.
Definition: wxMaxima.h:100
bool StartServer()
starts the server
Definition: wxMaxima.cpp:2522
void VariableActionSinnpiflagUndefined()
Called if maxima tells us that the maxima variable sinnpiflag is undefined.
Definition: wxMaxima.cpp:3400
bool CheckWXMXVersion(const wxString &docversion)
Complains if the version string from the XML file indicates too low a maxima version.
Definition: wxMaxima.cpp:4603
void OnClose(wxCloseEvent &event)
close wxMaxima window
Definition: wxMaxima.cpp:9775
void VariableActionHtmlHelp(const wxString &value)
Called if maxima tells us the value of the maxima variable output_format_for_help.
Definition: wxMaxima.cpp:3783
void VariableActionOperators(const wxString &value)
Called if maxima sends us the list of known operators.
Definition: wxMaxima.cpp:3868
void VariableActionLmxChar(const wxString &value)
Called if maxima tells us the value of the maxima variable lmxchar
Definition: wxMaxima.cpp:3719
void MaximaDClick(wxCommandEvent &ev)
Issued on double click on the Maxima status icon.
Definition: wxMaxima.cpp:11119
bool SaveNecessary()
Does this file contain anything worth saving?
Definition: wxMaxima.cpp:10358
wxProcess * m_gnuplotTerminalQueryProcess
Info about the gnuplot process we start for querying the terminals it supports.
Definition: wxMaxima.h:264
void StripLispComments(wxString &s)
Remove empty statements.
Definition: wxMaxima.cpp:2286
void MenuCommand(const wxString &cmd)
Inserts command cmd into the worksheet.
Definition: wxMaxima.cpp:5274
void ReadStatusBar(const wxXmlDocument &xmldoc)
Reads the output of wxstatusbar() commands.
Definition: wxMaxima.cpp:3205
static const wxString m_promptSuffix
The marker for the end of a input prompt.
Definition: wxMaxima.h:743
bool OpenWXMFile(const wxString &file, Worksheet *document, bool clearDocument=true)
Opens a wxm file.
Definition: wxMaxima.cpp:4217
bool QueryVariableValue()
Query the value of a new maxima variable.
Definition: wxMaxima.cpp:3947
void StatusMsgDClick(wxCommandEvent &ev)
Issued on double click on the status message in the status bar.
Definition: wxMaxima.cpp:11123
void ShowMaximaHelp(wxString={})
Show the help for Maxima.
Definition: wxMaxima.cpp:5029
void HelpMenu(wxCommandEvent &event)
Processes "Help menu" clicks.
Definition: wxMaxima.cpp:9493
wxString GetCWD()
Get the current working directory file I/O from maxima is relative to.
Definition: wxMaxima.h:704
std::unique_ptr< GroupCell > CreateTreeFromXMLNode(wxXmlNode *xmlcells, const wxString &wxmxfilename={})
Loads a wxmx description.
Definition: wxMaxima.cpp:4690
void VariableActionShowtime(const wxString &value)
Called if maxima tells us the value of the maxima variable showtime
Definition: wxMaxima.cpp:3764
void ShowPane(wxCommandEvent &event)
Toggle the visibility of a pane.
Definition: wxMaxima.cpp:11089
void ShowMaximaHelpWithoutAnchor()
Show the help for Maxima (without handling of anchors).
Definition: wxMaxima.cpp:4980
void ReadFirstPrompt(const wxString &data)
Determines the process id of maxima from its initial output.
Definition: wxMaxima.cpp:3068
long long GetTotalCpuTime()
How much CPU time has been used by the system until now? Used by GetMaximaCPUPercentage.
Definition: wxMaxima.cpp:5872
bool StartMaxima(bool force=false)
starts maxima (uses getCommand) or restarts it if needed
Definition: wxMaxima.cpp:2578
void ExitAfterEval(bool exitaftereval)
Do we want to exit the program after evaluation?
Definition: wxMaxima.h:121
void VariableActionAutoplay(const wxString &value)
Called if maxima tells us the value of the maxima variable wxanimate_autoplay
Definition: wxMaxima.cpp:3804
void VariableActionWxSubscripts(const wxString &value)
Called if maxima tells us the value of the maxima variable wxsubscripts
Definition: wxMaxima.cpp:3708
wxString m_gnuplotcommand
Maxima's idea about gnuplot's location.
Definition: wxMaxima.h:785
void ServerEvent(wxSocketEvent &event)
Server event: Maxima connects.
Definition: wxMaxima.cpp:2477
static wxString m_mathPrefix2
A marker for the start of maths.
Definition: wxMaxima.h:738
void MatrixMenu(wxCommandEvent &event)
Processes "algebra menu" clicks.
Definition: wxMaxima.cpp:7953
void SetupVariables()
Setup maxima's variables.
Definition: wxMaxima.cpp:4733
void OnDemoFileMenu(wxCommandEvent &ev)
Is called when a demo file menu is clicked.
Definition: wxMaxima.cpp:1841
void UpdateSlider()
Updates the slider to show the right frame.
Definition: wxMaxima.cpp:11061
void TableOfContentsSelection(wxListEvent &event)
Issued on double click on a table of contents item.
Definition: wxMaxima.cpp:11133
void VariableActionLispName(const wxString &value)
Called if maxima tells us the lisp name.
Definition: wxMaxima.cpp:3693
void ConfigChanged()
Is called on start and whenever the configuration changes.
Definition: wxMaxima.cpp:138
void EvaluateEvent(wxCommandEvent &event)
Handle the evaluation event.
Definition: wxMaxima.cpp:10408
static wxString m_firstPrompt
The first prompt maxima will output.
Definition: wxMaxima.h:767
void CalculusMenu(wxCommandEvent &event)
event handling for menus
Definition: wxMaxima.cpp:8902
bool SaveOnClose()
Try to save the file before closing it - or return false.
Definition: wxMaxima.cpp:9732
void VariableActionGnuplotCommand(const wxString &value)
Called if maxima tells us the value of the maxima variable gnuplot
Definition: wxMaxima.cpp:3626
The Right Way to delete a wxSocketServer.
Definition: wxMaxima.h:715
This file declares the class wxMaximaFrame.