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;}
81
89 static void SetupTerminationHandlers();
95 static void KillAllChildMaximas();
100 static void EnableIPC(){ MaximaIPC::EnableIPC(); }
102 static bool GetEnableIPC(){ return MaximaIPC::GetEnableIPC(); }
104 static void ExtraMaximaArgs(const wxString &args){m_extraMaximaArgs = args;}
106 static wxString ExtraMaximaArgs(){return m_extraMaximaArgs;}
107
109 static int GetWxExecuteFlags(int flags);
110
113 {
120 };
121
122#ifdef wxHAS_POWER_EVENTS
123 void OnPowerEvent(wxPowerEvent &event);
124#endif
125
127 void OnTimerEvent(wxTimerEvent &event);
128
131
132 void ShowTip(bool force);
134 void EvalOnStartup(bool eval)
135 {
136 m_evalOnStartup = eval;
137 }
138
140 void ExitAfterEval(bool exitaftereval);
141
142 void StripLispComments(wxString &s);
143
145 void LaunchHelpBrowser(wxString uri);
146
147 void SendMaxima(wxString s, bool addToHistory = false, bool background = false);
148
150 bool OpenFile(const wxString &file, const wxString &command ={});
151
154 { return m_fileSaved; }
155
157 void LoadImage(const wxString &file)
158 { GetWorksheet()->OpenHCaret(file, GC_TYPE_IMAGE); }
159
161 bool QueryVariableValue();
162
165 {
166 public:
167 explicit VersionNumber(const wxString &version);
168 long Major() const {return m_major;}
169 long Minor() const {return m_minor;}
170 long Patchlevel() const {return m_patchlevel;}
171 auto operator<=>(const VersionNumber&) const = default;
172 private:
173 long m_major = -1;
174 long m_minor = -1;
175 long m_patchlevel = -1;
176 };
177
179 static void Set_Maxima_Commandline_Filename(const wxString &filename)
180 {maxima_command_line_filename = filename;}
182 static const wxString Get_Maxima_Commandline_Filename() {return maxima_command_line_filename;}
183
184 static int GetExitCode(){return m_exitCode;}
185
186private:
188 static wxString maxima_command_line_filename;
190 bool m_maximaAuthenticated = false;
192 bool m_discardAllData = false;
194 wxString m_maximaAuthString;
196 MaximaIPC m_ipc{this};
198 static bool m_exitOnError;
200 static wxString m_extraMaximaArgs;
202 std::vector<wxString> m_varNamesToQuery;
203
205 bool m_openInitialFileError = false;
207 wxString EscapeForLisp(wxString str);
209 long long m_maximaJiffies_old = 0;
211 long long m_cpuTotalJiffies_old = 0;
214 wxString m_configCommands;
216 static wxRegEx m_gnuplotErrorRegex;
218 bool AbortOnError();
220 wxString m_oldFindString;
222 int m_oldFindFlags = 0;
224 bool m_hasEvaluatedCells = false;
226 long m_outputCellsFromCurrentCommand = 0;
228 long m_maxOutputCellsPerCommand = 0;
235 int m_unsuccessfulConnectionAttempts = 11;
237 wxString m_CWD;
239 bool m_evalOnStartup = false;
241 bool m_exitAfterEval = false;
243 bool m_ready = false;
244
249 wxString GetUnmatchedParenthesisState(wxString text, std::size_t &index);
251 wxMemoryBuffer m_uncompletedChars;
252
253protected:
255 void CommandWiz(const wxString &title,
256 const wxString &description, const wxString &description_tooltip,
257 const wxString &commandRule,
258 wxString label1, wxString defaultval1, wxString tooltip1 = {},
259 wxString label2 = {}, wxString defaultval2 = {}, wxString tooltip2 = {},
260 wxString label3 = {}, wxString defaultval3 = {}, wxString tooltip3 = {},
261 wxString label4 = {}, wxString defaultval4 = {}, wxString tooltip4 = {},
262 wxString label5 = {}, wxString defaultval5 = {}, wxString tooltip5 = {},
263 wxString label6 = {}, wxString defaultval6 = {}, wxString tooltip6 = {},
264 wxString label7 = {}, wxString defaultval7 = {}, wxString tooltip7 = {},
265 wxString label8 = {}, wxString defaultval8 = {}, wxString tooltip8 = {},
266 wxString label9 = {}, wxString defaultval9 = {}, wxString tooltip9 = {},
267 wxString label10 = {}, wxString defaultval10 = {}, wxString tooltip10 = {}
268 );
270 wxString ReadPotentiallyUnclosedTag(wxStringTokenizer &lines, wxString firstLine);
271
273 static wxRegEx m_xmlOpeningTagName;
275 static wxRegEx m_xmlOpeningTag;
277 wxProcess *m_gnuplotProcess = NULL;
281 bool m_isActive = true;
283 void OnFocus(wxFocusEvent &event);
284
286 void PassKeyboardFocus();
288 void OnMinimize(wxIconizeEvent &event);
290 void ConfigChanged();
292 void OnJumpToError(wxCommandEvent &event);
294 void OnSymbolAdd(wxCommandEvent &event);
296 void OnFollow(wxCommandEvent &event);
297 void OnWizardAbort(wxCommandEvent &event);
298 void OnWizardOK(wxCommandEvent &event);
299 void OnWizardInsert(wxCommandEvent &event);
300 void OnWizardHelpButton(wxCommandEvent &event);
301
303 void ShowMaximaHelp(wxString = {});
304
307
309 void ShowWxMaximaHelp();
310
312 void ShowHelp(const wxString &keyword);
313
314 void CheckForUpdates(bool reportUpToDate = false);
315
316 void OnRecentDocument(wxCommandEvent &event);
317 void OnRecentPackage (wxCommandEvent &event);
318 void OnUnsavedDocument(wxCommandEvent &event);
319
320 void OnChar(wxKeyEvent &event);
321 void OnKeyDown(wxKeyEvent &event);
322
349 void OnIdle(wxIdleEvent &event);
350 bool m_dataFromMaximaIs = false;
351
352 void MenuCommand(const wxString &cmd);
353 void FileMenu(wxCommandEvent &event);
354 void MaximaMenu(wxCommandEvent &event);
355 void MatrixMenu(wxCommandEvent &event);
356 void PropertiesMenu(wxCommandEvent &event);
357 void EquationsMenu(wxCommandEvent &event);
358 void CalculusMenu(wxCommandEvent &event);
359 void SimplifyMenu(wxCommandEvent &event);
360 void PlotMenu(wxCommandEvent &event);
361 void ListMenu(wxCommandEvent &event);
362 void DrawMenu(wxCommandEvent &event);
363 void NumericalMenu(wxCommandEvent &event);
364 void HelpMenu(wxCommandEvent &event);
365 void EditMenu(wxCommandEvent &event);
366 void ReplaceSuggestion(wxCommandEvent &event);
367 void Interrupt(wxCommandEvent &event);
369 void UpdateMenus();
370 void UpdateToolBar();
371 void UpdateSlider();
375 void ShowPane(wxCommandEvent &event); //<! Makes a sidebar visible
376 void OnMaximaClose(wxProcessEvent &event); //
377 void OnMaximaClose(); //
378 void OnGnuplotClose(wxProcessEvent &event); //
379 void OnGnuplotQueryTerminals(wxProcessEvent &event); //
380 void PopupMenu(wxCommandEvent &event); //
381 void StatsMenu(wxCommandEvent &event); //
382
384 void ChangeCellStyle(wxCommandEvent &event);
385
387 void OnFind(wxFindDialogEvent &event);
388
390 void OnReplace(wxFindDialogEvent &event);
391
393 void OnReplaceAll(wxFindDialogEvent &event);
394
396 void OnMaximaConnect();
397
399 void MaximaEvent(wxThreadEvent &event);
400
402 void ServerEvent(wxSocketEvent &event);
403
410 void AddDrawParameter(wxString cmd, int dimensionsOfNewDrawCommand = 2);
411
412 /* Append something to the console. Might be Text or XML maths.
413
414 \return A pointer to the last line of Unicode text that was appended or
415 NULL, if there is no such line (for example if the appended object is
416 maths instead).
417 */
418 TextCell *ConsoleAppend(wxString s, CellType type);
419 void ConsoleAppend(wxXmlDocument xml, CellType type, const wxString &userLabel = {});
420
421 enum AppendOpt { NewLine = 1, BigSkip = 2, PromptToolTip = 4, DefaultOpt = NewLine|BigSkip };
422 void DoConsoleAppend(wxString s, CellType type, AppendOpt opts = AppendOpt::DefaultOpt,
423 const wxString &userLabel = {});
424
429 TextCell *DoRawConsoleAppend(wxString s, CellType type, AppendOpt opts = {});
430
435 void EditInputMenu(wxCommandEvent &event);
437 void VarReadEvent(wxCommandEvent &event);
439 void VarAddAllEvent(wxCommandEvent &event);
440 void EvaluateEvent(wxCommandEvent &event); //
441 void InsertMenu(wxCommandEvent &event); //
442 void PrintMenu(wxCommandEvent &event);
443
444 void SliderEvent(wxScrollEvent &event);
445
447 void NetworkDClick(wxCommandEvent &ev);
449 void MaximaDClick(wxCommandEvent &ev);
451 void StatusMsgDClick(wxCommandEvent &ev);
452
454 void HistoryDClick(wxCommandEvent &event);
455
457 void TableOfContentsSelection(wxListEvent &event);
458
459 void OnInspectorEvent(wxCommandEvent &ev);
460
461 void DumpProcessOutput();
462
464 void TriggerEvaluation();
465
466 void TryUpdateInspector();
467
468 bool UpdateDrawPane();
469
470 wxString ExtractFirstExpression(const wxString &entry);
471
472 wxString GetDefaultEntry();
473
475 bool StartServer();
484 bool StartMaxima(bool force = false);
485
486 void OnClose(wxCloseEvent &event);
487 wxString GetCommand(bool params = true);
488 // (uses guessConfiguration)
489
491 void ReadStdErr();
492
503 void ReadFirstPrompt(const wxString &data);
504
512 void ReadMiscText(const wxString &data);
513
518 void ReadPrompt(const wxString &data);
519
525 void ReadStatusBar(const wxXmlDocument &xmldoc);
527 void ReadManualTopicNames(const wxXmlDocument &xmldoc);
528
537 void ReadMath(const wxXmlDocument &xml);
538
544 void ReadMaximaIPC(const wxString &data){m_ipc.ReadInputData(data);}
545 void ReadLoadSymbols(const wxXmlDocument &data);
546
548 void ReadSuppressedOutput(const wxString &data);
549
552 void ReadVariables(const wxXmlDocument &xmldoc);
553
556 void ReadAddVariables(const wxXmlDocument &xmldoc);
558 void VariableActionGentranlang(const wxString &value);
560 void VariableActionNumer(const wxString &value);
562 void VariableActionDisplay2d_Unicode(const wxString &value);
564 void VariableActionHtmlHelp(const wxString &value);
566 void VariableActionOpSubst(const wxString &value);
568 void VariableActionSinnpiflag(const wxString &value);
572 void VariableActionLogexpand(const wxString &value);
574 void VariableActionUserDir(const wxString &value);
576 void VariableActionTempDir(const wxString &value);
578 void VariableActionDebugmode(const wxString &value);
580 void VariableActionAutoconfVersion(const wxString &value);
582 void VariableActionAutoconfHost(const wxString &value);
584 void VariableActionMaximaInfodir(const wxString &value);
586 void VariableActionMaximaHtmldir(const wxString &value);
588 void VariableActionGnuplotCommand(const wxString &value);
590 void VariableActionMaximaSharedir(const wxString &value);
592 void VariableActionMaximaDemodir(const wxString &value);
594 void VariableActionLispName(const wxString &value);
596 void VariableActionLispVersion(const wxString &value);
598 void VariableActionWxLoadFileName(const wxString &value);
600 void VariableActionWxSubscripts(const wxString &value);
602 void VariableActionLmxChar(const wxString &value);
604 void VariableActionDisplay2D(const wxString &value);
606 void VariableActionAltDisplay2D(const wxString &value);
608 void VariableActionAlgebraic(const wxString &value);
610 void VariableActionShowtime(const wxString &value);
612 void VariableActionDomain(const wxString &value);
614 void VariableActionAutoplay(const wxString &value);
616 void VariableActionEngineeringFormat(const wxString &value);
618 void VariableActionStringdisp(const wxString &value);
620 void VariableActionOperators(const wxString &value);
621 wxString m_maximaVariable_wxSubscripts;
622 wxString m_maximaVariable_lmxchar;
623 wxString m_maximaVariable_display2d;
624 wxString m_maximaVariable_altdisplay2d;
625 wxString m_maximaVariable_engineeringFormat;
626 bool m_readMaximaVariables = false;
627 bool m_updateAutocompletion = true;
632 long long GetTotalCpuTime();
633
639 long long GetMaximaCpuTime();
640
645 double GetMaximaCPUPercentage();
646
648 bool SaveNecessary();
649
658 void SetupVariables();
659
660 void KillMaxima(bool logMessage = true);
668 void ResetTitle(bool saved, bool force = false);
669
670 void FirstOutput();
671
674 bool OpenXML(const wxString &file, Worksheet *document);
675
677 bool CheckWXMXVersion(const wxString &docversion);
678
680 bool OpenMACFile(const wxString &file, Worksheet *document, bool clearDocument = true);
681
683 bool OpenWXMFile(const wxString &file, Worksheet *document, bool clearDocument = true);
684
686 bool OpenWXMXFile(const wxString &file, Worksheet *document, bool clearDocument = true);
687
689 std::unique_ptr<GroupCell> CreateTreeFromXMLNode(wxXmlNode *xmlcells, const wxString &wxmxfilename = {});
690
696 bool SaveFile(bool forceSave = false);
697
699 bool SaveOnClose();
704 bool AutoSave();
705
713 int SaveDocumentP();
714
716 void SetCWD(wxString file);
717
719 wxString GetCWD()
720 {
721 return m_CWD;
722 }
723
724 std::unique_ptr<Maxima> m_client;
731 void operator()(wxSocketServer* server) const {
732 server->Destroy(); // Destroy() calls Close() automatically.
733 }
734 };
741 std::unique_ptr<wxSocketServer, ServerDeleter> m_server;
742
743 wxProcess *m_maximaProcess = NULL;
745 wxInputStream *m_maximaStdout = NULL;
747 wxInputStream *m_maximaStderr = NULL;
749 int m_port = -1;
751 static wxString m_mathPrefix1;
753 static wxString m_mathPrefix2;
755 static wxString m_promptPrefix;
756public:
758 const static wxString m_promptSuffix;
759protected:
765 void QuestionAnswered(){if(GetWorksheet()) GetWorksheet()->QuestionAnswered();}
768 void OnNewDemoFiles(wxCommandEvent &event);
770 void OnDemoFileMenu(wxCommandEvent &ev);
771
773 void OnUpdateTOCEvent(wxCommandEvent &event);
774
775 void OnSize(wxSizeEvent &event);
776 void OnMove(wxMoveEvent &event);
777 void OnMaximize(wxCommandEvent &event);
778
780 void GnuplotCommandName(wxString gnuplot);
782 static wxString m_firstPrompt;
783 bool m_dispReadOut = false;
784 wxWindowIDRef m_gnuplot_process_id;
785 wxWindowIDRef m_maxima_process_id;
786 wxString m_lastPrompt;
787 wxString m_firstPromptBuffer;
788 wxString m_lastPath;
789 std::unique_ptr<wxPrintData> m_printData;
794 bool m_closing = false;
797 wxString m_maximaHtmlDir;
798 bool m_fileSaved = true;
799 static int m_exitCode;
802#ifdef __WINDOWS__
803 // For Windows, store "gnuplot.exe", even if wgnuplot.exe is preferred.
804 // We query the terminals using: gnuplot -e "print GPVAL_TERMINALS"
805 // and that does only work with gnuplot, not wgnuplot.
807 wxString m_gnuplotcommand_commandline;
808#endif
809 long m_commandIndex = -1;
811 static wxRegEx m_funRegEx;
812 static wxRegEx m_varRegEx;
813 static wxRegEx m_blankStatementRegEx;
814 static wxRegEx m_sbclCompilationRegEx;
815 MathParser m_parser;
816 bool m_maximaBusy = true;
817 bool m_maximaError = false;
818private:
819 wxString m_fileToOpen;
820 bool m_fourierLoaded = false;
822 wxString m_logexpand;
824 typedef void (wxMaxima::*VarReadFunction)(const wxString &value);
825 typedef void (wxMaxima::*VarUndefinedFunction)();
826 typedef std::unordered_map <wxString, VarReadFunction, wxStringHash> VarReadFunctionHash;
827 typedef std::unordered_map <wxString, VarUndefinedFunction,
828 wxStringHash> VarUndefinedFunctionHash;
830 static VarReadFunctionHash m_variableReadActions;
832 static VarUndefinedFunctionHash m_variableUndefinedActions;
833
834#if wxUSE_DRAG_AND_DROP
835
836 friend class MyDropTarget;
837
838#endif
839 friend class MaximaIPC;
840
851 wxTimer m_autoSaveTimer;
852
853 /* A timer that delays redraws while maxima evaluates
854
855 If we always start a redraw when maxima has nearly finished a command that slows
856 down evaluating many simple commands in a row.
857 */
858 wxTimer m_fastResponseTimer;
859
861 void StartAutoSaveTimer();
862};
863
864#if wxUSE_DRAG_AND_DROP
865
866// cppcheck-suppress noConstructor
867class MyApp : public wxApp
868{
869public:
870 virtual bool OnInit() override;
871 virtual int OnRun() override;
872 virtual int OnExit() override;
873#if wxUSE_ON_FATAL_EXCEPTION && wxUSE_DEBUGREPORT
874 void OnFatalException () override;
875#endif
889 static void NewWindow(const wxString &file = {}, bool evalOnStartup = false, bool exitAfterEval = false, unsigned char *wxmData = NULL, std::size_t wxmLen = 0);
890
891 void OnFileMenu(wxCommandEvent &ev);
892
893#ifdef __WXMAC__
894 void MacNewFile() override;
895 void MacOpenFile(const wxString &file) override;
896#endif // __WXMAC__
897
898public:
899 static wxLogWindow *m_logWindow; // The wxWidgets log window, we use.
900
901 std::unique_ptr<wxLogChain> m_logChain;
902 static std::vector<wxProcess *> m_wxMaximaProcesses;
903#ifdef USE_QA
904#if wxUSE_ON_FATAL_EXCEPTION && wxUSE_DEBUGREPORT
905 void GenerateDebugReport(wxDebugReport::Context ctx);
906#endif
907#endif
908 std::unique_ptr<wxLocale> m_locale;
909 std::unique_ptr<wxTranslations> m_translations;
911 wxString m_configFileName;
912 Dirstructure m_dirstruct;
913 static bool m_allWindowsInOneProcess;
914 std::unique_ptr<Configuration> m_configuration;
915};
916
917class MyDropTarget : public wxFileDropTarget
918{
919public:
920 explicit MyDropTarget(wxMaxima *wxmax)
921 { m_wxmax = wxmax; }
922
923 bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &files);
924
925private:
926 wxMaxima *m_wxmax = NULL;
927};
928
929#endif
930
931
932// cppcheck-suppress noConstructor
933
934#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:50
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:1334
void QuestionAnswered()
Mark the current question from maxima as "answered"..
Definition: Worksheet.cpp:3431
The frame containing the menu and the sidebars.
Definition: wxMaximaFrame.h:66
A version number that can be compared using "<" and ">".
Definition: wxMaxima.h:165
Definition: wxMaxima.h:68
void PlotMenu(wxCommandEvent &event)
Processes "Plot menu" cloicks.
Definition: wxMaxima.cpp:9483
void OnIdle(wxIdleEvent &event)
The idle task that refreshes the gui (worksheet, menus, title line,...)
Definition: wxMaxima.cpp:5254
void VariableActionAutoconfVersion(const wxString &value)
Called if maxima tells us the maxima version as defined by autoconf.
Definition: wxMaxima.cpp:3668
int m_port
The port the actual maxima process (not its wrapper script) runs at.
Definition: wxMaxima.h:749
bool AutoSave()
Save the project in a temp file.
Definition: wxMaxima.cpp:6295
bool m_dispReadOut
what is displayed in statusbar
Definition: wxMaxima.h:783
void FileMenu(wxCommandEvent &event)
Processes "file menu" clicks.
Definition: wxMaxima.cpp:6340
bool m_scheduleUpdateToc
True = schedule an update of the table of contents.
Definition: wxMaxima.h:764
void VariableActionGentranlang(const wxString &value)
Called if maxima tells us the value of the maxima variable gentranlang.
Definition: wxMaxima.cpp:3609
bool SaveFile(bool forceSave=false)
Saves the current file.
Definition: wxMaxima.cpp:5923
void VariableActionDisplay2d_Unicode(const wxString &value)
Called if maxima tells us the value of the maxima variable display2d_unicode.
Definition: wxMaxima.cpp:3602
void ShowTip(bool force)
Definition: wxMaxima.cpp:5070
void VariableActionUserDir(const wxString &value)
Called if maxima tells us where the user files are located.
Definition: wxMaxima.cpp:3596
static void KillAllChildMaximas()
Async-signal-safe: SIGKILL every registered child Maxima process group.
Definition: wxMaxima.cpp:195
void ReadMiscText(const wxString &data)
Reads text that isn't enclosed between xml tags.
Definition: wxMaxima.cpp:3325
void ReadMath(const wxXmlDocument &xml)
Reads the math cell's contents from Maxima.
Definition: wxMaxima.cpp:3471
static wxRegEx m_xmlOpeningTag
Looks if this opening tag is actually complete.
Definition: wxMaxima.h:275
void EquationsMenu(wxCommandEvent &event)
Processes "equations menu" clicks.
Definition: wxMaxima.cpp:8067
void VariableActionDomain(const wxString &value)
Called if maxima tells us the value of the maxima variable domain
Definition: wxMaxima.cpp:4003
static wxString m_promptPrefix
The marker for the start of a input prompt.
Definition: wxMaxima.h:755
void OnMinimize(wxIconizeEvent &event)
Called when this window is minimized.
Definition: wxMaxima.cpp:11742
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:182
void VariableActionAltDisplay2D(const wxString &value)
Called if maxima tells us if it currently outputs XML.
Definition: wxMaxima.cpp:4035
void ShowWxMaximaHelp()
Show the help for wxMaxima.
Definition: wxMaxima.cpp:5133
TextCell * ConsoleAppend(wxString s, CellType type)
append maxima output to console
Definition: wxMaxima.cpp:2161
void ChangeCellStyle(wxCommandEvent &event)
Is triggered when the textstyle drop-down box's value is changed.
Definition: wxMaxima.cpp:11749
static wxString ExtraMaximaArgs()
Which additional maxima arguments did we get from the command line?
Definition: wxMaxima.h:106
bool m_isActive
Is this window active?
Definition: wxMaxima.h:281
void VariableActionOpSubst(const wxString &value)
Called if maxima tells us the value of the maxima variable opsubst.
Definition: wxMaxima.cpp:3618
void MaximaEvent(wxThreadEvent &event)
Maxima sends or receives data, or disconnects.
Definition: wxMaxima.cpp:2517
wxString ReadPotentiallyUnclosedTag(wxStringTokenizer &lines, wxString firstLine)
Reads a potentially unclosed XML tag and closes it.
Definition: wxMaxima.cpp:4481
void OnReplace(wxFindDialogEvent &event)
Is triggered when the "Replace" button in the search dialog is pressed.
Definition: wxMaxima.cpp:7034
int SaveDocumentP()
Tries or offers to save the document.
Definition: wxMaxima.cpp:11688
void VariableActionDisplay2D(const wxString &value)
Called if maxima tells us the value of the maxima variable display2d
Definition: wxMaxima.cpp:4012
void ReadMaximaIPC(const wxString &data)
Reads autocompletion templates we get on definition of a function or variable.
Definition: wxMaxima.h:544
void AddDrawParameter(wxString cmd, int dimensionsOfNewDrawCommand=2)
Add a parameter to a draw command.
Definition: wxMaxima.cpp:8600
void ShowHelp(const wxString &keyword)
Try to determine if help is needed for maxima or wxMaxima and show this help.
Definition: wxMaxima.cpp:5214
void MaximaMenu(wxCommandEvent &event)
Processes "maxima menu" clicks.
Definition: wxMaxima.cpp:7224
static void ExtraMaximaArgs(const wxString &args)
Additional maxima arguments from the command line.
Definition: wxMaxima.h:104
void EvalOnStartup(bool eval)
Do we want to evaluate the document on startup?
Definition: wxMaxima.h:134
static void ExitOnError()
Exit if we encounter an error.
Definition: wxMaxima.h:78
void PrintMenu(wxCommandEvent &event)
Definition: wxMaxima.cpp:5531
void OnUpdateTOCEvent(wxCommandEvent &event)
Is called when something requests an update of the table of contents.
Definition: wxMaxima.cpp:5917
void UpdateMenus()
Enables and disables the Right menu buttons.
Definition: wxMaxima.cpp:5570
void LaunchHelpBrowser(wxString uri)
Launches the help browser on the uri passed as an argument.
Definition: wxMaxima.cpp:5086
wxInputStream * m_maximaStdout
The stdout of the maxima process.
Definition: wxMaxima.h:745
void VarReadEvent(wxCommandEvent &event)
Trigger reading all variables from Maxima that are shown in the Variables sidebar.
Definition: wxMaxima.cpp:10790
void GnuplotCommandName(wxString gnuplot)
Sets gnuplot's command name and tries to determine gnuplot's path.
Definition: wxMaxima.cpp:3698
void VariableActionAutoconfHost(const wxString &value)
Called if maxima tells us the maxima build host as defined by autoconf.
Definition: wxMaxima.cpp:3673
static bool GetEnableIPC()
Do we allow maxima to click buttons in wxMaxima?
Definition: wxMaxima.h:102
void ReadSuppressedOutput(const wxString &data)
Read (and discard) suppressed output.
Definition: wxMaxima.cpp:3487
std::unique_ptr< wxSocketServer, ServerDeleter > m_server
The server maxima connects to as client.
Definition: wxMaxima.h:741
void OnMaximaConnect()
Is called if maxima connects to wxMaxima.
Definition: wxMaxima.cpp:2644
wxTimer m_maximaStdoutPollTimer
A timer that polls for output from the maxima process.
Definition: wxMaxima.h:130
void VariableActionWxLoadFileName(const wxString &value)
Called if maxima tells us the name of a package that was loaded.
Definition: wxMaxima.cpp:3891
void OnFollow(wxCommandEvent &event)
Called when the "Scroll to currently evaluated" button is pressed.
Definition: wxMaxima.cpp:11544
void NetworkDClick(wxCommandEvent &ev)
Issued on double click on the network status.
Definition: wxMaxima.cpp:11509
bool DocumentSaved()
Does this document need saving?
Definition: wxMaxima.h:153
void EditMenu(wxCommandEvent &event)
Processes "Edit menu" clicks.
Definition: wxMaxima.cpp:6558
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:9832
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:179
TextCell * DoRawConsoleAppend(wxString s, CellType type, AppendOpt opts={})
Append one or more lines of ordinary unicode text to the console.
Definition: wxMaxima.cpp:2285
long long GetMaximaCpuTime()
How much CPU time has maxima used till now? Used by GetMaximaCPUPercentage.
Definition: wxMaxima.cpp:6168
void ReplaceSuggestion(wxCommandEvent &event)
Processes clicks on suggestions.
Definition: wxMaxima.cpp:11146
void SetCWD(wxString file)
Set the current working directory file I/O from maxima is relative to.
Definition: wxMaxima.cpp:4308
static wxRegEx m_xmlOpeningTagName
Finds the name of an opening tag.
Definition: wxMaxima.h:273
void EditInputMenu(wxCommandEvent &event)
Spawn the "configure" menu.
Definition: wxMaxima.cpp:10767
void LoadImage(const wxString &file)
Load an image from a file into the worksheet.
Definition: wxMaxima.h:157
static void EnableIPC()
Allow maxima to click buttons in wxMaxima.
Definition: wxMaxima.h:100
static int GetWxExecuteFlags(int flags)
Return the flags for wxExecute, correctly handling process groups for tests.
Definition: wxMaxima.cpp:11787
void UpdateToolBar()
Enables and disables the Right toolbar buttons.
Definition: wxMaxima.cpp:5638
void HistoryDClick(wxCommandEvent &event)
Issued on double click on a history item.
Definition: wxMaxima.cpp:11521
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:1898
void VariableActionTempDir(const wxString &value)
Called if maxima tells us where the temp files are located.
Definition: wxMaxima.cpp:3643
wxString GetCommand(bool params=true)
returns the command to start maxima
Definition: wxMaxima.cpp:5021
static wxString m_mathPrefix1
A marker for the start of maths.
Definition: wxMaxima.h:751
void VariableActionNumer(const wxString &value)
Called if maxima tells us the value of the maxima variable numer.
Definition: wxMaxima.cpp:3935
bool OpenFile(const wxString &file, const wxString &command={})
Open a file.
Definition: wxMaxima.cpp:5773
void OnFind(wxFindDialogEvent &event)
Is triggered when the "Find" button in the search dialog is pressed.
Definition: wxMaxima.cpp:7005
void OnSymbolAdd(wxCommandEvent &event)
Sends a new char to the symbols sidebar.
Definition: wxMaxima.cpp:7091
void VariableActionDebugmode(const wxString &value)
Called if maxima tells us the value of the maxima variable debugmode.
Definition: wxMaxima.cpp:3653
wxInputStream * m_maximaStderr
The stderr of the maxima process.
Definition: wxMaxima.h:747
void VariableActionStringdisp(const wxString &value)
Called if maxima tells us the value of the maxima variable stringdisp
Definition: wxMaxima.cpp:3925
bool OpenMACFile(const wxString &file, Worksheet *document, bool clearDocument=true)
Opens a .mac file or a .out file from Xmaxima.
Definition: wxMaxima.cpp:4354
bool OpenWXMXFile(const wxString &file, Worksheet *document, bool clearDocument=true)
Opens a wxmx file.
Definition: wxMaxima.cpp:4515
void KillMaxima(bool logMessage=true)
kills the maxima process
Definition: wxMaxima.cpp:3004
void VarAddAllEvent(wxCommandEvent &event)
Trigger adding all variables to the variables sidebar.
Definition: wxMaxima.cpp:10781
void VariableActionSinnpiflag(const wxString &value)
Called if maxima tells us the value of the maxima variable sinnpiflag.
Definition: wxMaxima.cpp:3590
void ListMenu(wxCommandEvent &event)
Processes "list menu" clicks.
Definition: wxMaxima.cpp:8791
void ReadStdErr()
Polls the stderr and stdout of maxima for input.
Definition: wxMaxima.cpp:6032
void ReadAddVariables(const wxXmlDocument &xmldoc)
Reads the "add variable to watch list" tag maxima can send us.
Definition: wxMaxima.cpp:4105
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:7101
void VariableActionMaximaDemodir(const wxString &value)
Called if maxima tells us the maxima demo dir.
Definition: wxMaxima.cpp:3875
void VariableActionLogexpand(const wxString &value)
Called if maxima tells us the value of the maxima variable logexpand.
Definition: wxMaxima.cpp:3625
void VariableActionAlgebraic(const wxString &value)
Called if maxima tells us the value of the maxima variable algebraic
Definition: wxMaxima.cpp:3945
void VariableActionMaximaSharedir(const wxString &value)
Called if maxima tells us the maxima share dir.
Definition: wxMaxima.cpp:3864
void TriggerEvaluation()
Try to evaluate the next command for maxima that is in the evaluation queue.
Definition: wxMaxima.cpp:10973
void OnTimerEvent(wxTimerEvent &event)
Is triggered when a timer this class is responsible for requires.
Definition: wxMaxima.cpp:6262
void PassKeyboardFocus()
Forwards the keyboard focus to a text control that might need it.
Definition: wxMaxima.cpp:11730
void ReadPrompt(const wxString &data)
Reads the input prompt from Maxima.
Definition: wxMaxima.cpp:4176
double GetMaximaCPUPercentage()
How much CPU horsepower is maxima using currently?
Definition: wxMaxima.cpp:6234
void NumericalMenu(wxCommandEvent &event)
Processes "Numerical menu" clicks.
Definition: wxMaxima.cpp:9545
bool m_closing
Did we tell maxima to close?
Definition: wxMaxima.h:794
void SendMaxima(wxString s, bool addToHistory=false, bool background=false)
Definition: wxMaxima.cpp:2420
void ResetTitle(bool saved, bool force=false)
Update the title.
Definition: wxMaxima.cpp:11400
void ReadVariables(const wxXmlDocument &xmldoc)
Reads the variable values maxima advertises to us.
Definition: wxMaxima.cpp:3520
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:3677
wxString m_maximaTempDir
The directory with maxima's temp files.
Definition: wxMaxima.h:796
void OnReplaceAll(wxFindDialogEvent &event)
Is triggered when the "Replace All" button in the search dialog is pressed.
Definition: wxMaxima.cpp:7067
void DrawMenu(wxCommandEvent &event)
Processes "draw menu" clicks.
Definition: wxMaxima.cpp:8627
void VariableActionEngineeringFormat(const wxString &value)
Called if maxima tells us the value of the maxima variable engineering_format_floats
Definition: wxMaxima.cpp:3963
void VariableActionLispVersion(const wxString &value)
Called if maxima tells us the lisp version.
Definition: wxMaxima.cpp:3887
bool OpenXML(const wxString &file, Worksheet *document)
Opens a content.xml file that has been extracted from a broken .wxmx file.
Definition: wxMaxima.cpp:4824
void SimplifyMenu(wxCommandEvent &event)
Processes "Simplify menu" clicks.
Definition: wxMaxima.cpp:9013
void Interrupt(wxCommandEvent &event)
Interrupt button and hotkey presses Make the menu item, toolbars and panes visible that should be vis...
Definition: wxMaxima.cpp:2874
wxProcess * m_gnuplotProcess
The gnuplot process info.
Definition: wxMaxima.h:277
void OnFocus(wxFocusEvent &event)
Called when this window is focussed or defocussed.
Definition: wxMaxima.cpp:11724
void VariableActionMaximaHtmldir(const wxString &value)
Called if maxima tells us the maxima html dir.
Definition: wxMaxima.cpp:3684
void ReadManualTopicNames(const wxXmlDocument &xmldoc)
Read a manual topic name so we can jump to the right documentation page.
Definition: wxMaxima.cpp:3421
TimerIDs
An enum of individual IDs for all timers this class handles.
Definition: wxMaxima.h:113
@ KEYBOARD_INACTIVITY_TIMER_ID
The keyboard was inactive long enough that we can attempt an auto-save.
Definition: wxMaxima.h:115
@ AUTO_SAVE_TIMER_ID
The time between two auto-saves has elapsed.
Definition: wxMaxima.h:117
@ MAXIMA_STDOUT_POLL_ID
We look if we got new data from maxima's stdout.
Definition: wxMaxima.h:119
bool StartServer()
starts the server
Definition: wxMaxima.cpp:2677
void VariableActionSinnpiflagUndefined()
Called if maxima tells us that the maxima variable sinnpiflag is undefined.
Definition: wxMaxima.cpp:3594
bool CheckWXMXVersion(const wxString &docversion)
Complains if the version string from the XML file indicates too low a maxima version.
Definition: wxMaxima.cpp:4802
void OnClose(wxCloseEvent &event)
close wxMaxima window
Definition: wxMaxima.cpp:10165
void VariableActionHtmlHelp(const wxString &value)
Called if maxima tells us the value of the maxima variable output_format_for_help.
Definition: wxMaxima.cpp:3973
void VariableActionOperators(const wxString &value)
Called if maxima sends us the list of known operators.
Definition: wxMaxima.cpp:4058
void VariableActionLmxChar(const wxString &value)
Called if maxima tells us the value of the maxima variable lmxchar
Definition: wxMaxima.cpp:3909
void MaximaDClick(wxCommandEvent &ev)
Issued on double click on the Maxima status icon.
Definition: wxMaxima.cpp:11513
bool SaveNecessary()
Does this file contain anything worth saving?
Definition: wxMaxima.cpp:10752
wxProcess * m_gnuplotTerminalQueryProcess
Info about the gnuplot process we start for querying the terminals it supports.
Definition: wxMaxima.h:279
void StripLispComments(wxString &s)
Remove empty statements.
Definition: wxMaxima.cpp:2405
void MenuCommand(const wxString &cmd)
Inserts command cmd into the worksheet.
Definition: wxMaxima.cpp:5515
void ReadStatusBar(const wxXmlDocument &xmldoc)
Reads the output of wxstatusbar() commands.
Definition: wxMaxima.cpp:3400
static const wxString m_promptSuffix
The marker for the end of a input prompt.
Definition: wxMaxima.h:758
bool OpenWXMFile(const wxString &file, Worksheet *document, bool clearDocument=true)
Opens a wxm file.
Definition: wxMaxima.cpp:4415
bool QueryVariableValue()
Query the value of a new maxima variable.
Definition: wxMaxima.cpp:4137
void StatusMsgDClick(wxCommandEvent &ev)
Issued on double click on the status message in the status bar.
Definition: wxMaxima.cpp:11517
void ShowMaximaHelp(wxString={})
Show the help for Maxima.
Definition: wxMaxima.cpp:5221
void HelpMenu(wxCommandEvent &event)
Processes "Help menu" clicks.
Definition: wxMaxima.cpp:9881
wxString GetCWD()
Get the current working directory file I/O from maxima is relative to.
Definition: wxMaxima.h:719
std::unique_ptr< GroupCell > CreateTreeFromXMLNode(wxXmlNode *xmlcells, const wxString &wxmxfilename={})
Loads a wxmx description.
Definition: wxMaxima.cpp:4889
void VariableActionShowtime(const wxString &value)
Called if maxima tells us the value of the maxima variable showtime
Definition: wxMaxima.cpp:3954
void ShowPane(wxCommandEvent &event)
Toggle the visibility of a pane.
Definition: wxMaxima.cpp:11483
void ShowMaximaHelpWithoutAnchor()
Show the help for Maxima (without handling of anchors).
Definition: wxMaxima.cpp:5172
void ReadFirstPrompt(const wxString &data)
Determines the process id of maxima from its initial output.
Definition: wxMaxima.cpp:3264
long long GetTotalCpuTime()
How much CPU time has been used by the system until now? Used by GetMaximaCPUPercentage.
Definition: wxMaxima.cpp:6133
bool StartMaxima(bool force=false)
starts maxima (uses getCommand) or restarts it if needed
Definition: wxMaxima.cpp:2733
static void SetupTerminationHandlers()
Install termination-signal handlers (SIGTERM/SIGINT/SIGHUP) on Unix.
Definition: wxMaxima.cpp:210
void ExitAfterEval(bool exitaftereval)
Do we want to exit the program after evaluation?
Definition: wxMaxima.cpp:4905
void VariableActionAutoplay(const wxString &value)
Called if maxima tells us the value of the maxima variable wxanimate_autoplay
Definition: wxMaxima.cpp:3994
void VariableActionWxSubscripts(const wxString &value)
Called if maxima tells us the value of the maxima variable wxsubscripts
Definition: wxMaxima.cpp:3898
wxString m_gnuplotcommand
Maxima's idea about gnuplot's location.
Definition: wxMaxima.h:801
void ServerEvent(wxSocketEvent &event)
Server event: Maxima connects.
Definition: wxMaxima.cpp:2632
static wxString m_mathPrefix2
A marker for the start of maths.
Definition: wxMaxima.h:753
void MatrixMenu(wxCommandEvent &event)
Processes "algebra menu" clicks.
Definition: wxMaxima.cpp:8293
void SetupVariables()
Setup maxima's variables.
Definition: wxMaxima.cpp:4917
void OnDemoFileMenu(wxCommandEvent &ev)
Is called when a demo file menu is clicked.
Definition: wxMaxima.cpp:1951
void UpdateSlider()
Updates the slider to show the right frame.
Definition: wxMaxima.cpp:11455
void TableOfContentsSelection(wxListEvent &event)
Issued on double click on a table of contents item.
Definition: wxMaxima.cpp:11527
void VariableActionLispName(const wxString &value)
Called if maxima tells us the lisp name.
Definition: wxMaxima.cpp:3883
void ConfigChanged()
Is called on start and whenever the configuration changes.
Definition: wxMaxima.cpp:229
void EvaluateEvent(wxCommandEvent &event)
Handle the evaluation event.
Definition: wxMaxima.cpp:10802
static wxString m_firstPrompt
The first prompt maxima will output.
Definition: wxMaxima.h:782
void CalculusMenu(wxCommandEvent &event)
event handling for menus
Definition: wxMaxima.cpp:9287
bool SaveOnClose()
Try to save the file before closing it - or return false.
Definition: wxMaxima.cpp:10122
void VariableActionGnuplotCommand(const wxString &value)
Called if maxima tells us the value of the maxima variable gnuplot
Definition: wxMaxima.cpp:3820
The Right Way to delete a wxSocketServer.
Definition: wxMaxima.h:730
This file declares the class wxMaximaFrame.