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 "Configuration.h"
38#include "MathParser.h"
39#include "MaximaIPC.h"
40#include "Dirstructure.h"
41#include <wx/socket.h>
42#include <wx/config.h>
43#include <wx/process.h>
44#include <wx/regex.h>
45#include <wx/dnd.h>
46#include <wx/txtstrm.h>
47#include <wx/sckstrm.h>
48#include <wx/buffer.h>
49#include <wx/power.h>
50#ifdef USE_QA
51#include <wx/debugrpt.h>
52#endif
53#include <memory>
54#ifdef __WXMSW__
55#include <windows.h>
56#endif
57#include <unordered_map>
58
60#define MAXIMAPOLLMSECS 2000
61
62class Maxima; // The Maxima process interface
63
64/* The top-level window and the main application logic
65
66 */
67class wxMaxima : public wxMaximaFrame
68{
69public:
70 wxMaxima(wxWindow *parent, int id, const wxString &title,
71 const wxString &filename = wxEmptyString,
72 const wxString &initialWorksheetContents = wxEmptyString,
73 const wxPoint pos = wxDefaultPosition, const wxSize size = wxDefaultSize);
74
75 virtual ~wxMaxima();
76 wxString EscapeFilenameForShell(wxString name);
78 static void ExitOnError(){m_exitOnError = true;}
80 static bool GetExitOnError(){return m_exitOnError;}
85 static void EnableIPC(){ MaximaIPC::EnableIPC(); }
87 static bool GetEnableIPC(){ return MaximaIPC::GetEnableIPC(); }
89 static void ExtraMaximaArgs(const wxString &args){m_extraMaximaArgs = args;}
91 static wxString ExtraMaximaArgs(){return m_extraMaximaArgs;}
92
95 {
102 };
103
104#ifdef wxHAS_POWER_EVENTS
105 void OnPowerEvent(wxPowerEvent &event);
106#endif
107
109 void OnTimerEvent(wxTimerEvent &event);
110
113
114 void ShowTip(bool force);
116 void EvalOnStartup(bool eval)
117 {
118 m_evalOnStartup = eval;
119 }
120
122 void ExitAfterEval(bool exitaftereval);
123
124 void StripLispComments(wxString &s);
125
127 void LaunchHelpBrowser(wxString uri);
128
129 void SendMaxima(wxString s, bool addToHistory = false, bool background = false);
130
132 bool OpenFile(const wxString &file, const wxString &command ={});
133
136 { return m_fileSaved; }
137
139 void LoadImage(const wxString &file)
140 { GetWorksheet()->OpenHCaret(file, GC_TYPE_IMAGE); }
141
143 bool QueryVariableValue();
144
147 {
148 public:
149 explicit VersionNumber(const wxString &version);
150 long Major() const {return m_major;}
151 long Minor() const {return m_minor;}
152 long Patchlevel() const {return m_patchlevel;}
153 auto operator<=>(const VersionNumber&) const = default;
154 private:
155 long m_major = -1;
156 long m_minor = -1;
157 long m_patchlevel = -1;
158 };
159
161 static void Set_Maxima_Commandline_Filename(const wxString &filename)
162 {maxima_command_line_filename = filename;}
164 static const wxString Get_Maxima_Commandline_Filename() {return maxima_command_line_filename;}
165
166 static int GetExitCode(){return m_exitCode;}
167
168private:
170 static wxString maxima_command_line_filename;
172 bool m_maximaAuthenticated = false;
174 bool m_discardAllData = false;
176 wxString m_maximaAuthString;
178 MaximaIPC m_ipc{this};
180 static bool m_exitOnError;
182 static wxString m_extraMaximaArgs;
184 std::vector<wxString> m_varNamesToQuery;
185
187 bool m_openInitialFileError = false;
189 wxString EscapeForLisp(wxString str);
191 long long m_maximaJiffies_old = 0;
193 long long m_cpuTotalJiffies_old = 0;
196 wxString m_configCommands;
198 static wxRegEx m_gnuplotErrorRegex;
200 bool AbortOnError();
202 wxString m_oldFindString;
204 int m_oldFindFlags = 0;
206 bool m_hasEvaluatedCells = false;
208 long m_outputCellsFromCurrentCommand = 0;
210 long m_maxOutputCellsPerCommand = 0;
217 int m_unsuccessfulConnectionAttempts = 11;
219 wxString m_CWD;
221 bool m_evalOnStartup = false;
223 bool m_exitAfterEval = false;
225 bool m_ready = false;
226
231 wxString GetUnmatchedParenthesisState(wxString text, std::size_t &index);
233 wxMemoryBuffer m_uncompletedChars;
234
235protected:
237 void CommandWiz(const wxString &title,
238 const wxString &description, const wxString &description_tooltip,
239 const wxString &commandRule,
240 wxString label1, wxString defaultval1, wxString tooltip1 = {},
241 wxString label2 = {}, wxString defaultval2 = {}, wxString tooltip2 = {},
242 wxString label3 = {}, wxString defaultval3 = {}, wxString tooltip3 = {},
243 wxString label4 = {}, wxString defaultval4 = {}, wxString tooltip4 = {},
244 wxString label5 = {}, wxString defaultval5 = {}, wxString tooltip5 = {},
245 wxString label6 = {}, wxString defaultval6 = {}, wxString tooltip6 = {},
246 wxString label7 = {}, wxString defaultval7 = {}, wxString tooltip7 = {},
247 wxString label8 = {}, wxString defaultval8 = {}, wxString tooltip8 = {},
248 wxString label9 = {}, wxString defaultval9 = {}, wxString tooltip9 = {},
249 wxString label10 = {}, wxString defaultval10 = {}, wxString tooltip10 = {}
250 );
252 wxString ReadPotentiallyUnclosedTag(wxStringTokenizer &lines, wxString firstLine);
253
255 static wxRegEx m_xmlOpeningTagName;
257 static wxRegEx m_xmlOpeningTag;
259 wxProcess *m_gnuplotProcess = NULL;
263 bool m_isActive = true;
265 void OnFocus(wxFocusEvent &event);
266
268 void PassKeyboardFocus();
270 void OnMinimize(wxIconizeEvent &event);
272 void ConfigChanged();
274 void OnJumpToError(wxCommandEvent &event);
276 void OnSymbolAdd(wxCommandEvent &event);
278 void OnFollow(wxCommandEvent &event);
279 void OnWizardAbort(wxCommandEvent &event);
280 void OnWizardOK(wxCommandEvent &event);
281 void OnWizardInsert(wxCommandEvent &event);
282 void OnWizardHelpButton(wxCommandEvent &event);
283
285 void ShowMaximaHelp(wxString = {});
286
289
291 void ShowWxMaximaHelp();
292
294 void ShowHelp(const wxString &keyword);
295
296 void CheckForUpdates(bool reportUpToDate = false);
297
298 void OnRecentDocument(wxCommandEvent &event);
299 void OnRecentPackage (wxCommandEvent &event);
300 void OnUnsavedDocument(wxCommandEvent &event);
301
302 void OnChar(wxKeyEvent &event);
303 void OnKeyDown(wxKeyEvent &event);
304
331 void OnIdle(wxIdleEvent &event);
332 bool m_dataFromMaximaIs = false;
333
334 void MenuCommand(const wxString &cmd);
335 void FileMenu(wxCommandEvent &event);
336 void MaximaMenu(wxCommandEvent &event);
337 void MatrixMenu(wxCommandEvent &event);
338 void PropertiesMenu(wxCommandEvent &event);
339 void EquationsMenu(wxCommandEvent &event);
340 void CalculusMenu(wxCommandEvent &event);
341 void SimplifyMenu(wxCommandEvent &event);
342 void PlotMenu(wxCommandEvent &event);
343 void ListMenu(wxCommandEvent &event);
344 void DrawMenu(wxCommandEvent &event);
345 void NumericalMenu(wxCommandEvent &event);
346 void HelpMenu(wxCommandEvent &event);
347 void EditMenu(wxCommandEvent &event);
348 void ReplaceSuggestion(wxCommandEvent &event);
349 void Interrupt(wxCommandEvent &event);
351 void UpdateMenus();
352 void UpdateToolBar();
353 void UpdateSlider();
357 void ShowPane(wxCommandEvent &event); //<! Makes a sidebar visible
358 void OnMaximaClose(wxProcessEvent &event); //
359 void OnMaximaClose(); //
360 void OnGnuplotClose(wxProcessEvent &event); //
361 void OnGnuplotQueryTerminals(wxProcessEvent &event); //
362 void PopupMenu(wxCommandEvent &event); //
363 void StatsMenu(wxCommandEvent &event); //
364
366 void ChangeCellStyle(wxCommandEvent &event);
367
369 void OnFind(wxFindDialogEvent &event);
370
372 void OnReplace(wxFindDialogEvent &event);
373
375 void OnReplaceAll(wxFindDialogEvent &event);
376
378 void OnMaximaConnect();
379
381 void MaximaEvent(wxThreadEvent &event);
382
384 void ServerEvent(wxSocketEvent &event);
385
392 void AddDrawParameter(wxString cmd, int dimensionsOfNewDrawCommand = 2);
393
394 /* Append something to the console. Might be Text or XML maths.
395
396 \return A pointer to the last line of Unicode text that was appended or
397 NULL, if there is no such line (for example if the appended object is
398 maths instead).
399 */
400 TextCell *ConsoleAppend(wxString s, CellType type);
401 void ConsoleAppend(wxXmlDocument xml, CellType type, const wxString &userLabel = {});
402
403 enum AppendOpt { NewLine = 1, BigSkip = 2, PromptToolTip = 4, DefaultOpt = NewLine|BigSkip };
404 void DoConsoleAppend(wxString s, CellType type, AppendOpt opts = AppendOpt::DefaultOpt,
405 const wxString &userLabel = {});
406
411 TextCell *DoRawConsoleAppend(wxString s, CellType type, AppendOpt opts = {});
412
417 void EditInputMenu(wxCommandEvent &event);
419 void VarReadEvent(wxCommandEvent &event);
421 void VarAddAllEvent(wxCommandEvent &event);
422 void EvaluateEvent(wxCommandEvent &event); //
423 void InsertMenu(wxCommandEvent &event); //
424 void PrintMenu(wxCommandEvent &event);
425
426 void SliderEvent(wxScrollEvent &event);
427
429 void NetworkDClick(wxCommandEvent &ev);
431 void MaximaDClick(wxCommandEvent &ev);
433 void StatusMsgDClick(wxCommandEvent &ev);
434
436 void HistoryDClick(wxCommandEvent &event);
437
439 void TableOfContentsSelection(wxListEvent &event);
440
441 void OnInspectorEvent(wxCommandEvent &ev);
442
443 void DumpProcessOutput();
444
446 void TriggerEvaluation();
447
448 void TryUpdateInspector();
449
450 bool UpdateDrawPane();
451
452 wxString ExtractFirstExpression(const wxString &entry);
453
454 wxString GetDefaultEntry();
455
457 bool StartServer();
466 bool StartMaxima(bool force = false);
467
468 void OnClose(wxCloseEvent &event);
469 wxString GetCommand(bool params = true);
470 // (uses guessConfiguration)
471
473 void ReadStdErr();
474
485 void ReadFirstPrompt(const wxString &data);
486
494 void ReadMiscText(const wxString &data);
495
500 void ReadPrompt(const wxString &data);
501
507 void ReadStatusBar(const wxXmlDocument &xmldoc);
509 void ReadManualTopicNames(const wxXmlDocument &xmldoc);
510
519 void ReadMath(const wxXmlDocument &xml);
520
526 void ReadMaximaIPC(const wxString &data){m_ipc.ReadInputData(data);}
527 void ReadLoadSymbols(const wxXmlDocument &data);
528
530 void ReadSuppressedOutput(const wxString &data);
531
534 void ReadVariables(const wxXmlDocument &xmldoc);
535
538 void ReadAddVariables(const wxXmlDocument &xmldoc);
540 void VariableActionGentranlang(const wxString &value);
542 void VariableActionNumer(const wxString &value);
544 void VariableActionDisplay2d_Unicode(const wxString &value);
546 void VariableActionHtmlHelp(const wxString &value);
548 void VariableActionOpSubst(const wxString &value);
550 void VariableActionSinnpiflag(const wxString &value);
554 void VariableActionLogexpand(const wxString &value);
556 void VariableActionUserDir(const wxString &value);
558 void VariableActionTempDir(const wxString &value);
560 void VariableActionDebugmode(const wxString &value);
562 void VariableActionAutoconfVersion(const wxString &value);
564 void VariableActionAutoconfHost(const wxString &value);
566 void VariableActionMaximaInfodir(const wxString &value);
568 void VariableActionMaximaHtmldir(const wxString &value);
570 void VariableActionGnuplotCommand(const wxString &value);
572 void VariableActionMaximaSharedir(const wxString &value);
574 void VariableActionMaximaDemodir(const wxString &value);
576 void VariableActionLispName(const wxString &value);
578 void VariableActionLispVersion(const wxString &value);
580 void VariableActionWxLoadFileName(const wxString &value);
582 void VariableActionWxSubscripts(const wxString &value);
584 void VariableActionLmxChar(const wxString &value);
586 void VariableActionDisplay2D(const wxString &value);
588 void VariableActionAltDisplay2D(const wxString &value);
590 void VariableActionAlgebraic(const wxString &value);
592 void VariableActionShowtime(const wxString &value);
594 void VariableActionDomain(const wxString &value);
596 void VariableActionAutoplay(const wxString &value);
598 void VariableActionEngineeringFormat(const wxString &value);
600 void VariableActionStringdisp(const wxString &value);
602 void VariableActionOperators(const wxString &value);
603 wxString m_maximaVariable_wxSubscripts;
604 wxString m_maximaVariable_lmxchar;
605 wxString m_maximaVariable_display2d;
606 wxString m_maximaVariable_altdisplay2d;
607 wxString m_maximaVariable_engineeringFormat;
608 bool m_readMaximaVariables = false;
609 bool m_updateAutocompletion = true;
614 long long GetTotalCpuTime();
615
621 long long GetMaximaCpuTime();
622
627 double GetMaximaCPUPercentage();
628
630 bool SaveNecessary();
631
640 void SetupVariables();
641
642 void KillMaxima(bool logMessage = true);
650 void ResetTitle(bool saved, bool force = false);
651
652 void FirstOutput();
653
656 bool OpenXML(const wxString &file, Worksheet *document);
657
659 bool CheckWXMXVersion(const wxString &docversion);
660
662 bool OpenMACFile(const wxString &file, Worksheet *document, bool clearDocument = true);
663
665 bool OpenWXMFile(const wxString &file, Worksheet *document, bool clearDocument = true);
666
668 bool OpenWXMXFile(const wxString &file, Worksheet *document, bool clearDocument = true);
669
671 std::unique_ptr<GroupCell> CreateTreeFromXMLNode(wxXmlNode *xmlcells, const wxString &wxmxfilename = {});
672
678 bool SaveFile(bool forceSave = false);
679
681 bool SaveOnClose();
686 bool AutoSave();
687
695 int SaveDocumentP();
696
698 void SetCWD(wxString file);
699
701 wxString GetCWD()
702 {
703 return m_CWD;
704 }
705
706 std::unique_ptr<Maxima> m_client;
713 void operator()(wxSocketServer* server) const {
714 server->Destroy(); // Destroy() calls Close() automatically.
715 }
716 };
723 std::unique_ptr<wxSocketServer, ServerDeleter> m_server;
724
725 wxProcess *m_maximaProcess = NULL;
727 wxInputStream *m_maximaStdout = NULL;
729 wxInputStream *m_maximaStderr = NULL;
731 int m_port = -1;
733 static wxString m_mathPrefix1;
735 static wxString m_mathPrefix2;
737 static wxString m_promptPrefix;
738public:
740 const static wxString m_promptSuffix;
741protected:
747 void QuestionAnswered(){if(GetWorksheet()) GetWorksheet()->QuestionAnswered();}
750 void OnNewDemoFiles(wxCommandEvent &event);
752 void OnDemoFileMenu(wxCommandEvent &ev);
753
755 void OnUpdateTOCEvent(wxCommandEvent &event);
756
757 void OnSize(wxSizeEvent &event);
758 void OnMove(wxMoveEvent &event);
759 void OnMaximize(wxCommandEvent &event);
760
762 void GnuplotCommandName(wxString gnuplot);
764 static wxString m_firstPrompt;
765 bool m_dispReadOut = false;
766 wxWindowIDRef m_gnuplot_process_id;
767 wxWindowIDRef m_maxima_process_id;
768 wxString m_lastPrompt;
769 wxString m_firstPromptBuffer;
770 wxString m_lastPath;
771 std::unique_ptr<wxPrintData> m_printData;
776 bool m_closing = false;
779 wxString m_maximaHtmlDir;
780 bool m_fileSaved = true;
781 static int m_exitCode;
784#ifdef __WINDOWS__
785 // For Windows, store "gnuplot.exe", even if wgnuplot.exe is preferred.
786 // We query the terminals using: gnuplot -e "print GPVAL_TERMINALS"
787 // and that does only work with gnuplot, not wgnuplot.
789 wxString m_gnuplotcommand_commandline;
790#endif
791 long m_commandIndex = -1;
793 static wxRegEx m_funRegEx;
794 static wxRegEx m_varRegEx;
795 static wxRegEx m_blankStatementRegEx;
796 static wxRegEx m_sbclCompilationRegEx;
797 MathParser m_parser;
798 bool m_maximaBusy = true;
799 bool m_maximaError = false;
800private:
801 bool m_fourierLoaded = false;
803 wxString m_logexpand;
805 typedef void (wxMaxima::*VarReadFunction)(const wxString &value);
806 typedef void (wxMaxima::*VarUndefinedFunction)();
807 typedef std::unordered_map <wxString, VarReadFunction, wxStringHash> VarReadFunctionHash;
808 typedef std::unordered_map <wxString, VarUndefinedFunction,
809 wxStringHash> VarUndefinedFunctionHash;
811 static VarReadFunctionHash m_variableReadActions;
813 static VarUndefinedFunctionHash m_variableUndefinedActions;
814
815#if wxUSE_DRAG_AND_DROP
816
817 friend class MyDropTarget;
818
819#endif
820 friend class MaximaIPC;
821
832 wxTimer m_autoSaveTimer;
833
834 /* A timer that delays redraws while maxima evaluates
835
836 If we always start a redraw when maxima has nearly finished a command that slows
837 down evaluating many simple commands in a row.
838 */
839 wxTimer m_fastResponseTimer;
840
842 void StartAutoSaveTimer();
843};
844
845#if wxUSE_DRAG_AND_DROP
846
847// cppcheck-suppress noConstructor
848class MyApp : public wxApp
849{
850public:
851 virtual bool OnInit();
852 virtual int OnRun();
853 virtual int OnExit();
854#if wxUSE_ON_FATAL_EXCEPTION && wxUSE_CRASHREPORT
855 void OnFatalException () override;
856#endif
870 static void NewWindow(const wxString &file = {}, bool evalOnStartup = false, bool exitAfterEval = false, unsigned char *wxmData = NULL, std::size_t wxmLen = 0);
871
872 void OnFileMenu(wxCommandEvent &ev);
873
874 virtual void MacNewFile();
875
876 virtual void MacOpenFile(const wxString &file);
877
878public:
879 static wxLogWindow *m_logWindow; // The wxWidgets log window, we use.
880 static int m_windowcount;
881
882 std::unique_ptr<wxLogChain> m_logChain;
883 static std::vector<wxProcess *> m_wxMaximaProcesses;
884#ifdef USE_QA
885#if wxUSE_ON_FATAL_EXCEPTION && wxUSE_CRASHREPORT
886 void GenerateDebugReport(wxDebugReport::Context ctx);
887#endif
888#endif
889 std::unique_ptr<wxLocale> m_locale;
890 std::unique_ptr<wxTranslations> m_translations;
892 wxString m_configFileName;
893 Dirstructure m_dirstruct;
894 static bool m_allWindowsInOneProcess;
895 std::unique_ptr<Configuration> m_configuration;
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:54
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:69
A Text cell.
Definition: TextCell.h:38
The canvas that contains the spreadsheet the whole program is about.
Definition: Worksheet.h:109
void OpenHCaret(const wxString &txt={})
Place the cursor into a new cell where the horizontal cursor is.
Definition: Worksheet.h:1312
void QuestionAnswered()
Mark the current question from maxima as "answered"..
Definition: Worksheet.cpp:3319
The frame containing the menu and the sidebars.
Definition: wxMaximaFrame.h:65
A version number that can be compared using "<" and ">".
Definition: wxMaxima.h:147
Definition: wxMaxima.h:68
void PlotMenu(wxCommandEvent &event)
Processes "Plot menu" cloicks.
Definition: wxMaxima.cpp:9301
void OnIdle(wxIdleEvent &event)
The idle task that refreshes the gui (worksheet, menus, title line,...)
Definition: wxMaxima.cpp:5151
void VariableActionAutoconfVersion(const wxString &value)
Called if maxima tells us the maxima version as defined by autoconf.
Definition: wxMaxima.cpp:3571
int m_port
The port the actual maxima process (not its wrapper script) runs at.
Definition: wxMaxima.h:731
bool AutoSave()
Save the project in a temp file.
Definition: wxMaxima.cpp:6155
bool m_dispReadOut
what is displayed in statusbar
Definition: wxMaxima.h:765
void FileMenu(wxCommandEvent &event)
Processes "file menu" clicks.
Definition: wxMaxima.cpp:6200
bool m_scheduleUpdateToc
True = schedule an update of the table of contents.
Definition: wxMaxima.h:746
void VariableActionGentranlang(const wxString &value)
Called if maxima tells us the value of the maxima variable gentranlang.
Definition: wxMaxima.cpp:3512
bool SaveFile(bool forceSave=false)
Saves the current file.
Definition: wxMaxima.cpp:5783
void VariableActionDisplay2d_Unicode(const wxString &value)
Called if maxima tells us the value of the maxima variable display2d_unicode.
Definition: wxMaxima.cpp:3505
void ShowTip(bool force)
Definition: wxMaxima.cpp:4972
void VariableActionUserDir(const wxString &value)
Called if maxima tells us where the user files are located.
Definition: wxMaxima.cpp:3499
void ReadMiscText(const wxString &data)
Reads text that isn't enclosed between xml tags.
Definition: wxMaxima.cpp:3227
void ReadMath(const wxXmlDocument &xml)
Reads the math cell's contents from Maxima.
Definition: wxMaxima.cpp:3373
static wxRegEx m_xmlOpeningTag
Looks if this opening tag is actually complete.
Definition: wxMaxima.h:257
void EquationsMenu(wxCommandEvent &event)
Processes "equations menu" clicks.
Definition: wxMaxima.cpp:7918
void VariableActionDomain(const wxString &value)
Called if maxima tells us the value of the maxima variable domain
Definition: wxMaxima.cpp:3906
static wxString m_promptPrefix
The marker for the start of a input prompt.
Definition: wxMaxima.h:737
void OnMinimize(wxIconizeEvent &event)
Called when this window is minimized.
Definition: wxMaxima.cpp:11553
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:164
void VariableActionAltDisplay2D(const wxString &value)
Called if maxima tells us if it currently outputs XML.
Definition: wxMaxima.cpp:3938
void ShowWxMaximaHelp()
Show the help for wxMaxima.
Definition: wxMaxima.cpp:5030
TextCell * ConsoleAppend(wxString s, CellType type)
append maxima output to console
Definition: wxMaxima.cpp:2073
void ChangeCellStyle(wxCommandEvent &event)
Is triggered when the textstyle drop-down box's value is changed.
Definition: wxMaxima.cpp:11560
static wxString ExtraMaximaArgs()
Which additional maxima arguments did we get from the command line?
Definition: wxMaxima.h:91
bool m_isActive
Is this window active?
Definition: wxMaxima.h:263
void VariableActionOpSubst(const wxString &value)
Called if maxima tells us the value of the maxima variable opsubst.
Definition: wxMaxima.cpp:3521
void MaximaEvent(wxThreadEvent &event)
Maxima sends or receives data, or disconnects.
Definition: wxMaxima.cpp:2429
wxString ReadPotentiallyUnclosedTag(wxStringTokenizer &lines, wxString firstLine)
Reads a potentially unclosed XML tag and closes it.
Definition: wxMaxima.cpp:4382
void OnReplace(wxFindDialogEvent &event)
Is triggered when the "Replace" button in the search dialog is pressed.
Definition: wxMaxima.cpp:6885
int SaveDocumentP()
Tries or offers to save the document.
Definition: wxMaxima.cpp:11499
void VariableActionDisplay2D(const wxString &value)
Called if maxima tells us the value of the maxima variable display2d
Definition: wxMaxima.cpp:3915
void ReadMaximaIPC(const wxString &data)
Reads autocompletion templates we get on definition of a function or variable.
Definition: wxMaxima.h:526
void AddDrawParameter(wxString cmd, int dimensionsOfNewDrawCommand=2)
Add a parameter to a draw command.
Definition: wxMaxima.cpp:8445
void ShowHelp(const wxString &keyword)
Try to determine if help is needed for maxima or wxMaxima and show this help.
Definition: wxMaxima.cpp:5111
void MaximaMenu(wxCommandEvent &event)
Processes "maxima menu" clicks.
Definition: wxMaxima.cpp:7075
static void ExtraMaximaArgs(const wxString &args)
Additional maxima arguments from the command line.
Definition: wxMaxima.h:89
void EvalOnStartup(bool eval)
Do we want to evaluate the document on startup?
Definition: wxMaxima.h:116
static void ExitOnError()
Exit if we encounter an error.
Definition: wxMaxima.h:78
void PrintMenu(wxCommandEvent &event)
Definition: wxMaxima.cpp:5383
void OnUpdateTOCEvent(wxCommandEvent &event)
Is called when something requests an update of the table of contents.
Definition: wxMaxima.cpp:5777
void UpdateMenus()
Enables and disables the Right menu buttons.
Definition: wxMaxima.cpp:5422
void LaunchHelpBrowser(wxString uri)
Launches the help browser on the uri passed as an argument.
Definition: wxMaxima.cpp:4988
wxInputStream * m_maximaStdout
The stdout of the maxima process.
Definition: wxMaxima.h:727
void VarReadEvent(wxCommandEvent &event)
Trigger reading all variables from Maxima that are shown in the Variables sidebar.
Definition: wxMaxima.cpp:10606
void GnuplotCommandName(wxString gnuplot)
Sets gnuplot's command name and tries to determine gnuplot's path.
Definition: wxMaxima.cpp:3602
void VariableActionAutoconfHost(const wxString &value)
Called if maxima tells us the maxima build host as defined by autoconf.
Definition: wxMaxima.cpp:3576
static bool GetEnableIPC()
Do we allow maxima to click buttons in wxMaxima?
Definition: wxMaxima.h:87
void ReadSuppressedOutput(const wxString &data)
Read (and discard) suppressed output.
Definition: wxMaxima.cpp:3389
std::unique_ptr< wxSocketServer, ServerDeleter > m_server
The server maxima connects to as client.
Definition: wxMaxima.h:723
void OnMaximaConnect()
Is called if maxima connects to wxMaxima.
Definition: wxMaxima.cpp:2556
wxTimer m_maximaStdoutPollTimer
A timer that polls for output from the maxima process.
Definition: wxMaxima.h:112
void VariableActionWxLoadFileName(const wxString &value)
Called if maxima tells us the name of a package that was loaded.
Definition: wxMaxima.cpp:3794
void OnFollow(wxCommandEvent &event)
Called when the "Scroll to currently evaluated" button is pressed.
Definition: wxMaxima.cpp:11355
void NetworkDClick(wxCommandEvent &ev)
Issued on double click on the network status.
Definition: wxMaxima.cpp:11320
bool DocumentSaved()
Does this document need saving?
Definition: wxMaxima.h:135
void EditMenu(wxCommandEvent &event)
Processes "Edit menu" clicks.
Definition: wxMaxima.cpp:6418
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:9650
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:161
TextCell * DoRawConsoleAppend(wxString s, CellType type, AppendOpt opts={})
Append one or more lines of ordinary unicode text to the console.
Definition: wxMaxima.cpp:2197
long long GetMaximaCpuTime()
How much CPU time has maxima used till now? Used by GetMaximaCPUPercentage.
Definition: wxMaxima.cpp:6028
void ReplaceSuggestion(wxCommandEvent &event)
Processes clicks on suggestions.
Definition: wxMaxima.cpp:10957
void SetCWD(wxString file)
Set the current working directory file I/O from maxima is relative to.
Definition: wxMaxima.cpp:4211
static wxRegEx m_xmlOpeningTagName
Finds the name of an opening tag.
Definition: wxMaxima.h:255
void EditInputMenu(wxCommandEvent &event)
Spawn the "configure" menu.
Definition: wxMaxima.cpp:10583
void LoadImage(const wxString &file)
Load an image from a file into the worksheet.
Definition: wxMaxima.h:139
static void EnableIPC()
Allow maxima to click buttons in wxMaxima.
Definition: wxMaxima.h:85
void UpdateToolBar()
Enables and disables the Right toolbar buttons.
Definition: wxMaxima.cpp:5490
void HistoryDClick(wxCommandEvent &event)
Issued on double click on a history item.
Definition: wxMaxima.cpp:11332
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:1810
void VariableActionTempDir(const wxString &value)
Called if maxima tells us where the temp files are located.
Definition: wxMaxima.cpp:3546
wxString GetCommand(bool params=true)
returns the command to start maxima
Definition: wxMaxima.cpp:4923
static wxString m_mathPrefix1
A marker for the start of maths.
Definition: wxMaxima.h:733
void VariableActionNumer(const wxString &value)
Called if maxima tells us the value of the maxima variable numer.
Definition: wxMaxima.cpp:3838
bool OpenFile(const wxString &file, const wxString &command={})
Open a file.
Definition: wxMaxima.cpp:5625
void OnFind(wxFindDialogEvent &event)
Is triggered when the "Find" button in the search dialog is pressed.
Definition: wxMaxima.cpp:6856
void OnSymbolAdd(wxCommandEvent &event)
Sends a new char to the symbols sidebar.
Definition: wxMaxima.cpp:6942
void VariableActionDebugmode(const wxString &value)
Called if maxima tells us the value of the maxima variable debugmode.
Definition: wxMaxima.cpp:3556
wxInputStream * m_maximaStderr
The stderr of the maxima process.
Definition: wxMaxima.h:729
void VariableActionStringdisp(const wxString &value)
Called if maxima tells us the value of the maxima variable stringdisp
Definition: wxMaxima.cpp:3828
bool OpenMACFile(const wxString &file, Worksheet *document, bool clearDocument=true)
Opens a .mac file or a .out file from Xmaxima.
Definition: wxMaxima.cpp:4257
bool OpenWXMXFile(const wxString &file, Worksheet *document, bool clearDocument=true)
Opens a wxmx file.
Definition: wxMaxima.cpp:4416
void KillMaxima(bool logMessage=true)
kills the maxima process
Definition: wxMaxima.cpp:2897
void VarAddAllEvent(wxCommandEvent &event)
Trigger adding all variables to the variables sidebar.
Definition: wxMaxima.cpp:10597
void VariableActionSinnpiflag(const wxString &value)
Called if maxima tells us the value of the maxima variable sinnpiflag.
Definition: wxMaxima.cpp:3493
void ListMenu(wxCommandEvent &event)
Processes "list menu" clicks.
Definition: wxMaxima.cpp:8638
void ReadStdErr()
Polls the stderr and stdout of maxima for input.
Definition: wxMaxima.cpp:5892
void ReadAddVariables(const wxXmlDocument &xmldoc)
Reads the "add variable to watch list" tag maxima can send us.
Definition: wxMaxima.cpp:4008
static bool GetExitOnError()
Do we exit if we encounter an error?
Definition: wxMaxima.h:80
void PropertiesMenu(wxCommandEvent &event)
Processes "Variable/Function props menu" clicks.
Definition: wxMaxima.cpp:6952
void VariableActionMaximaDemodir(const wxString &value)
Called if maxima tells us the maxima demo dir.
Definition: wxMaxima.cpp:3778
void VariableActionLogexpand(const wxString &value)
Called if maxima tells us the value of the maxima variable logexpand.
Definition: wxMaxima.cpp:3528
void VariableActionAlgebraic(const wxString &value)
Called if maxima tells us the value of the maxima variable algebraic
Definition: wxMaxima.cpp:3848
void VariableActionMaximaSharedir(const wxString &value)
Called if maxima tells us the maxima share dir.
Definition: wxMaxima.cpp:3767
void TriggerEvaluation()
Try to evaluate the next command for maxima that is in the evaluation queue.
Definition: wxMaxima.cpp:10787
void OnTimerEvent(wxTimerEvent &event)
Is triggered when a timer this class is responsible for requires.
Definition: wxMaxima.cpp:6122
void PassKeyboardFocus()
Forwards the keyboard focus to a text control that might need it.
Definition: wxMaxima.cpp:11541
void ReadPrompt(const wxString &data)
Reads the input prompt from Maxima.
Definition: wxMaxima.cpp:4079
double GetMaximaCPUPercentage()
How much CPU horsepower is maxima using currently?
Definition: wxMaxima.cpp:6094
void NumericalMenu(wxCommandEvent &event)
Processes "Numerical menu" clicks.
Definition: wxMaxima.cpp:9363
bool m_closing
Did we tell maxima to close?
Definition: wxMaxima.h:776
void SendMaxima(wxString s, bool addToHistory=false, bool background=false)
Definition: wxMaxima.cpp:2332
void ResetTitle(bool saved, bool force=false)
Update the title.
Definition: wxMaxima.cpp:11211
void ReadVariables(const wxXmlDocument &xmldoc)
Reads the variable values maxima advertises to us.
Definition: wxMaxima.cpp:3423
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:3580
wxString m_maximaTempDir
The directory with maxima's temp files.
Definition: wxMaxima.h:778
void OnReplaceAll(wxFindDialogEvent &event)
Is triggered when the "Replace All" button in the search dialog is pressed.
Definition: wxMaxima.cpp:6918
void DrawMenu(wxCommandEvent &event)
Processes "draw menu" clicks.
Definition: wxMaxima.cpp:8472
void VariableActionEngineeringFormat(const wxString &value)
Called if maxima tells us the value of the maxima variable engineering_format_floats
Definition: wxMaxima.cpp:3866
void VariableActionLispVersion(const wxString &value)
Called if maxima tells us the lisp version.
Definition: wxMaxima.cpp:3790
bool OpenXML(const wxString &file, Worksheet *document)
Opens a content.xml file that has been extracted from a broken .wxmx file.
Definition: wxMaxima.cpp:4726
void SimplifyMenu(wxCommandEvent &event)
Processes "Simplify menu" clicks.
Definition: wxMaxima.cpp:8849
void Interrupt(wxCommandEvent &event)
Interrupt button and hotkey presses Make the menu item, toolbars and panes visible that should be vis...
Definition: wxMaxima.cpp:2767
wxProcess * m_gnuplotProcess
The gnuplot process info.
Definition: wxMaxima.h:259
void OnFocus(wxFocusEvent &event)
Called when this window is focussed or defocussed.
Definition: wxMaxima.cpp:11535
void VariableActionMaximaHtmldir(const wxString &value)
Called if maxima tells us the maxima html dir.
Definition: wxMaxima.cpp:3587
void ReadManualTopicNames(const wxXmlDocument &xmldoc)
Read a manual topic name so we can jump to the right documentation page.
Definition: wxMaxima.cpp:3323
TimerIDs
An enum of individual IDs for all timers this class handles.
Definition: wxMaxima.h:95
@ KEYBOARD_INACTIVITY_TIMER_ID
The keyboard was inactive long enough that we can attempt an auto-save.
Definition: wxMaxima.h:97
@ AUTO_SAVE_TIMER_ID
The time between two auto-saves has elapsed.
Definition: wxMaxima.h:99
@ MAXIMA_STDOUT_POLL_ID
We look if we got new data from maxima's stdout.
Definition: wxMaxima.h:101
bool StartServer()
starts the server
Definition: wxMaxima.cpp:2589
void VariableActionSinnpiflagUndefined()
Called if maxima tells us that the maxima variable sinnpiflag is undefined.
Definition: wxMaxima.cpp:3497
bool CheckWXMXVersion(const wxString &docversion)
Complains if the version string from the XML file indicates too low a maxima version.
Definition: wxMaxima.cpp:4704
void OnClose(wxCloseEvent &event)
close wxMaxima window
Definition: wxMaxima.cpp:9981
void VariableActionHtmlHelp(const wxString &value)
Called if maxima tells us the value of the maxima variable output_format_for_help.
Definition: wxMaxima.cpp:3876
void VariableActionOperators(const wxString &value)
Called if maxima sends us the list of known operators.
Definition: wxMaxima.cpp:3961
void VariableActionLmxChar(const wxString &value)
Called if maxima tells us the value of the maxima variable lmxchar
Definition: wxMaxima.cpp:3812
void MaximaDClick(wxCommandEvent &ev)
Issued on double click on the Maxima status icon.
Definition: wxMaxima.cpp:11324
bool SaveNecessary()
Does this file contain anything worth saving?
Definition: wxMaxima.cpp:10568
wxProcess * m_gnuplotTerminalQueryProcess
Info about the gnuplot process we start for querying the terminals it supports.
Definition: wxMaxima.h:261
void StripLispComments(wxString &s)
Remove empty statements.
Definition: wxMaxima.cpp:2317
void MenuCommand(const wxString &cmd)
Inserts command cmd into the worksheet.
Definition: wxMaxima.cpp:5367
void ReadStatusBar(const wxXmlDocument &xmldoc)
Reads the output of wxstatusbar() commands.
Definition: wxMaxima.cpp:3302
static const wxString m_promptSuffix
The marker for the end of a input prompt.
Definition: wxMaxima.h:740
bool OpenWXMFile(const wxString &file, Worksheet *document, bool clearDocument=true)
Opens a wxm file.
Definition: wxMaxima.cpp:4318
bool QueryVariableValue()
Query the value of a new maxima variable.
Definition: wxMaxima.cpp:4040
void StatusMsgDClick(wxCommandEvent &ev)
Issued on double click on the status message in the status bar.
Definition: wxMaxima.cpp:11328
void ShowMaximaHelp(wxString={})
Show the help for Maxima.
Definition: wxMaxima.cpp:5118
void HelpMenu(wxCommandEvent &event)
Processes "Help menu" clicks.
Definition: wxMaxima.cpp:9699
wxString GetCWD()
Get the current working directory file I/O from maxima is relative to.
Definition: wxMaxima.h:701
std::unique_ptr< GroupCell > CreateTreeFromXMLNode(wxXmlNode *xmlcells, const wxString &wxmxfilename={})
Loads a wxmx description.
Definition: wxMaxima.cpp:4791
void VariableActionShowtime(const wxString &value)
Called if maxima tells us the value of the maxima variable showtime
Definition: wxMaxima.cpp:3857
void ShowPane(wxCommandEvent &event)
Toggle the visibility of a pane.
Definition: wxMaxima.cpp:11294
void ShowMaximaHelpWithoutAnchor()
Show the help for Maxima (without handling of anchors).
Definition: wxMaxima.cpp:5069
void ReadFirstPrompt(const wxString &data)
Determines the process id of maxima from its initial output.
Definition: wxMaxima.cpp:3155
long long GetTotalCpuTime()
How much CPU time has been used by the system until now? Used by GetMaximaCPUPercentage.
Definition: wxMaxima.cpp:5993
bool StartMaxima(bool force=false)
starts maxima (uses getCommand) or restarts it if needed
Definition: wxMaxima.cpp:2645
void ExitAfterEval(bool exitaftereval)
Do we want to exit the program after evaluation?
Definition: wxMaxima.cpp:4807
void VariableActionAutoplay(const wxString &value)
Called if maxima tells us the value of the maxima variable wxanimate_autoplay
Definition: wxMaxima.cpp:3897
void VariableActionWxSubscripts(const wxString &value)
Called if maxima tells us the value of the maxima variable wxsubscripts
Definition: wxMaxima.cpp:3801
wxString m_gnuplotcommand
Maxima's idea about gnuplot's location.
Definition: wxMaxima.h:783
void ServerEvent(wxSocketEvent &event)
Server event: Maxima connects.
Definition: wxMaxima.cpp:2544
static wxString m_mathPrefix2
A marker for the start of maths.
Definition: wxMaxima.h:735
void MatrixMenu(wxCommandEvent &event)
Processes "algebra menu" clicks.
Definition: wxMaxima.cpp:8144
void SetupVariables()
Setup maxima's variables.
Definition: wxMaxima.cpp:4819
void OnDemoFileMenu(wxCommandEvent &ev)
Is called when a demo file menu is clicked.
Definition: wxMaxima.cpp:1863
void UpdateSlider()
Updates the slider to show the right frame.
Definition: wxMaxima.cpp:11266
void TableOfContentsSelection(wxListEvent &event)
Issued on double click on a table of contents item.
Definition: wxMaxima.cpp:11338
void VariableActionLispName(const wxString &value)
Called if maxima tells us the lisp name.
Definition: wxMaxima.cpp:3786
void ConfigChanged()
Is called on start and whenever the configuration changes.
Definition: wxMaxima.cpp:135
void EvaluateEvent(wxCommandEvent &event)
Handle the evaluation event.
Definition: wxMaxima.cpp:10618
static wxString m_firstPrompt
The first prompt maxima will output.
Definition: wxMaxima.h:764
void CalculusMenu(wxCommandEvent &event)
event handling for menus
Definition: wxMaxima.cpp:9108
bool SaveOnClose()
Try to save the file before closing it - or return false.
Definition: wxMaxima.cpp:9938
void VariableActionGnuplotCommand(const wxString &value)
Called if maxima tells us the value of the maxima variable gnuplot
Definition: wxMaxima.cpp:3724
The Right Way to delete a wxSocketServer.
Definition: wxMaxima.h:712
This file declares the class wxMaximaFrame.