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 "BuildConfig.h"
35#include <vector>
36#include "wxMaximaFrame.h"
37#include "WXMXformat.h"
38#include "Configuration.h"
39#include "MathParser.h"
40#include "MaximaIPC.h"
41#include "Dirstructure.h"
42#include <wx/socket.h>
43#include <wx/config.h>
44#include <wx/process.h>
45#include <wx/regex.h>
46#include <wx/dnd.h>
47#include <wx/txtstrm.h>
48#include <wx/sckstrm.h>
49#include <wx/buffer.h>
50#include <wx/power.h>
51#ifdef USE_QA
52#include <wx/debugrpt.h>
53#endif
54#include <memory>
55#ifdef __WXMSW__
56#include <windows.h>
57#endif
58#include <unordered_map>
59
61#define MAXIMAPOLLMSECS 2000
62
63class Maxima; // The Maxima process interface
64
65/* The top-level window and the main application logic
66
67 */
68class wxMaxima : public wxMaximaFrame
69{
70public:
71 wxMaxima(wxWindow *parent, int id, const wxString &title,
72 const wxString &filename = wxEmptyString,
73 const wxString &initialWorksheetContents = wxEmptyString,
74 const wxPoint pos = wxDefaultPosition, const wxSize size = wxDefaultSize);
75
76 virtual ~wxMaxima();
77 wxString EscapeFilenameForShell(wxString name);
79 static void ExitOnError(){m_exitOnError = true;}
81 static bool GetExitOnError(){return m_exitOnError;}
92 bool ExitOnErrorArmed() const { return m_exitOnError && m_exitOnErrorArmed; }
93
101 static void SetupTerminationHandlers();
102#ifdef __WXMSW__
111 static void RepairFileAssociations();
112#endif
118 static void KillAllChildMaximas();
123 static void EnableIPC(){ MaximaIPC::EnableIPC(); }
125 static bool GetEnableIPC(){ return MaximaIPC::GetEnableIPC(); }
127 static void ExtraMaximaArgs(const wxString &args){m_extraMaximaArgs = args;}
129 static wxString ExtraMaximaArgs(){return m_extraMaximaArgs;}
130
133 {
140 };
141
142#ifdef wxHAS_POWER_EVENTS
143 void OnPowerEvent(wxPowerEvent &event);
144#endif
145
147 void OnTimerEvent(wxTimerEvent &event);
148
151
152 void ShowTip(bool force);
154 void EvalOnStartup(bool eval)
155 {
156 m_evalOnStartup = eval;
157 }
158
160 void ExitAfterEval(bool exitaftereval);
170 bool IsInteractive() const { return !m_exitAfterEval; }
171
172 void StripLispComments(wxString &s);
173
175 void LaunchHelpBrowser(wxString uri);
176
177 void SendMaxima(wxString s, bool addToHistory = false, bool background = false);
178
180 bool OpenFile(const wxString &file, const wxString &command ={});
181
184 { return m_fileSaved; }
185
187 void LoadImage(const wxString &file)
188 { GetWorksheet()->OpenHCaret(file, GC_TYPE_IMAGE); }
189
191 bool QueryVariableValue();
192
195 {
196 public:
197 explicit VersionNumber(const wxString &version);
198 long Major() const {return m_major;}
199 long Minor() const {return m_minor;}
200 long Patchlevel() const {return m_patchlevel;}
201 auto operator<=>(const VersionNumber&) const = default;
202 private:
203 long m_major = -1;
204 long m_minor = -1;
205 long m_patchlevel = -1;
206 };
207
209 static void Set_Maxima_Commandline_Filename(const wxString &filename)
210 {maxima_command_line_filename = filename;}
212 static const wxString Get_Maxima_Commandline_Filename() {return maxima_command_line_filename;}
213
214 static int GetExitCode(){return m_exitCode;}
215
216private:
218 static wxString maxima_command_line_filename;
220 bool m_maximaAuthenticated = false;
222 bool m_discardAllData = false;
224 wxString m_maximaAuthString;
226 MaximaIPC m_ipc{this};
229 static bool m_exitOnError;
233 bool m_exitOnErrorArmed = true;
235 static wxString m_extraMaximaArgs;
237 std::vector<wxString> m_varNamesToQuery;
238
240 bool m_openInitialFileError = false;
242 wxString EscapeForLisp(wxString str);
244 long long m_maximaJiffies_old = 0;
246 long long m_cpuTotalJiffies_old = 0;
249 wxString m_configCommands;
251 static wxRegEx m_gnuplotErrorRegex;
253 bool AbortOnError();
255 wxString m_oldFindString;
257 int m_oldFindFlags = 0;
259 bool m_hasEvaluatedCells = false;
261 long m_outputCellsFromCurrentCommand = 0;
263 long m_maxOutputCellsPerCommand = 0;
270 int m_unsuccessfulConnectionAttempts = 11;
272 wxString m_CWD;
274 bool m_evalOnStartup = false;
276 bool m_exitAfterEval = false;
278 bool m_ready = false;
279
284 wxString GetUnmatchedParenthesisState(wxString text, std::size_t &index);
286 wxMemoryBuffer m_uncompletedChars;
287
288protected:
290 void CommandWiz(const wxString &title,
291 const wxString &description, const wxString &description_tooltip,
292 const wxString &commandRule,
293 wxString label1, wxString defaultval1, wxString tooltip1 = {},
294 wxString label2 = {}, wxString defaultval2 = {}, wxString tooltip2 = {},
295 wxString label3 = {}, wxString defaultval3 = {}, wxString tooltip3 = {},
296 wxString label4 = {}, wxString defaultval4 = {}, wxString tooltip4 = {},
297 wxString label5 = {}, wxString defaultval5 = {}, wxString tooltip5 = {},
298 wxString label6 = {}, wxString defaultval6 = {}, wxString tooltip6 = {},
299 wxString label7 = {}, wxString defaultval7 = {}, wxString tooltip7 = {},
300 wxString label8 = {}, wxString defaultval8 = {}, wxString tooltip8 = {},
301 wxString label9 = {}, wxString defaultval9 = {}, wxString tooltip9 = {},
302 wxString label10 = {}, wxString defaultval10 = {}, wxString tooltip10 = {}
303 );
305 wxString ReadPotentiallyUnclosedTag(wxStringTokenizer &lines, wxString firstLine);
306
308 static wxRegEx m_xmlOpeningTagName;
310 static wxRegEx m_xmlOpeningTag;
312 wxProcess *m_gnuplotProcess = NULL;
316 bool m_isActive = true;
318 void OnFocus(wxFocusEvent &event);
319
321 void PassKeyboardFocus();
323 void OnMinimize(wxIconizeEvent &event);
325 void ConfigChanged();
327 void OnJumpToError(wxCommandEvent &event);
329 void OnSymbolAdd(wxCommandEvent &event);
331 void OnFollow(wxCommandEvent &event);
332 void OnWizardAbort(wxCommandEvent &event);
333 void OnWizardOK(wxCommandEvent &event);
334 void OnWizardInsert(wxCommandEvent &event);
335 void OnWizardHelpButton(wxCommandEvent &event);
336
338 void ShowMaximaHelp(wxString = {});
339
342
344 void ShowWxMaximaHelp();
345
347 void ShowHelp(const wxString &keyword);
348
349 void CheckForUpdates(bool reportUpToDate = false);
350
351 void OnRecentDocument(wxCommandEvent &event);
352 void OnRecentPackage (wxCommandEvent &event);
353 void OnUnsavedDocument(wxCommandEvent &event);
354
355 void OnChar(wxKeyEvent &event);
356 void OnKeyDown(wxKeyEvent &event);
357
384 void OnIdle(wxIdleEvent &event);
385 bool m_dataFromMaximaIs = false;
386
387 void MenuCommand(const wxString &cmd);
388 void FileMenu(wxCommandEvent &event);
389 void MaximaMenu(wxCommandEvent &event);
390 void MatrixMenu(wxCommandEvent &event);
391 void PropertiesMenu(wxCommandEvent &event);
392 void EquationsMenu(wxCommandEvent &event);
393 void CalculusMenu(wxCommandEvent &event);
394 void SimplifyMenu(wxCommandEvent &event);
395 void PlotMenu(wxCommandEvent &event);
396 void ListMenu(wxCommandEvent &event);
397 void DrawMenu(wxCommandEvent &event);
398 void NumericalMenu(wxCommandEvent &event);
399 void HelpMenu(wxCommandEvent &event);
400#ifdef __WXMSW__
402 void RegisterWxmxDiffTool();
403#endif
404 void EditMenu(wxCommandEvent &event);
405 void ReplaceSuggestion(wxCommandEvent &event);
406 void Interrupt(wxCommandEvent &event);
408 void UpdateMenus();
409 void UpdateToolBar();
410 void UpdateSlider();
414 void ShowPane(wxCommandEvent &event); //<! Makes a sidebar visible
415 void OnMaximaClose(wxProcessEvent &event); //
416 void OnMaximaClose(); //
417 void OnGnuplotClose(wxProcessEvent &event); //
418 void OnGnuplotQueryTerminals(wxProcessEvent &event); //
419 void PopupMenu(wxCommandEvent &event); //
420 void StatsMenu(wxCommandEvent &event); //
421
423 void ChangeCellStyle(wxCommandEvent &event);
424
426 void OnFind(wxFindDialogEvent &event);
427
429 void OnReplace(wxFindDialogEvent &event);
430
432 void OnReplaceAll(wxFindDialogEvent &event);
433
435 void OnMaximaConnect();
436
438 void MaximaEvent(wxThreadEvent &event);
439
441 void ServerEvent(wxSocketEvent &event);
442
449 void AddDrawParameter(wxString cmd, int dimensionsOfNewDrawCommand = 2);
450
451 /* Append something to the console. Might be Text or XML maths.
452
453 \return A pointer to the last line of Unicode text that was appended or
454 NULL, if there is no such line (for example if the appended object is
455 maths instead).
456 */
457 TextCell *ConsoleAppend(wxString s, CellType type);
458 void ConsoleAppend(wxXmlDocument xml, CellType type, const wxString &userLabel = {});
459
460 enum AppendOpt { NewLine = 1, BigSkip = 2, PromptToolTip = 4, DefaultOpt = NewLine|BigSkip };
461 void DoConsoleAppend(wxString s, CellType type, AppendOpt opts = AppendOpt::DefaultOpt,
462 const wxString &userLabel = {});
463
468 TextCell *DoRawConsoleAppend(wxString s, CellType type, AppendOpt opts = {});
469
474 void EditInputMenu(wxCommandEvent &event);
476 void VarReadEvent(wxCommandEvent &event);
478 void VarAddAllEvent(wxCommandEvent &event);
479 void EvaluateEvent(wxCommandEvent &event); //
480 void InsertMenu(wxCommandEvent &event); //
481 void PrintMenu(wxCommandEvent &event);
482
483 void SliderEvent(wxScrollEvent &event);
484
486 void NetworkDClick(wxMouseEvent &ev);
488 void MaximaDClick(wxMouseEvent &ev);
490 void StatusMsgDClick(wxMouseEvent &ev);
491
493 void HistoryDClick(wxCommandEvent &event);
494
496 void TableOfContentsSelection(wxListEvent &event);
497
498 void OnInspectorEvent(wxCommandEvent &ev);
499
500 void DumpProcessOutput();
501
503 void TriggerEvaluation();
504
505 void TryUpdateInspector();
506
507 bool UpdateDrawPane();
508
509 wxString ExtractFirstExpression(const wxString &entry);
510
511 wxString GetDefaultEntry();
512
514 bool StartServer();
523 bool StartMaxima(bool force = false);
524
525 void OnClose(wxCloseEvent &event);
526 wxString GetCommand(bool params = true);
527 // (uses guessConfiguration)
528
530 void ReadStdErr();
531
542 void ReadFirstPrompt(const wxString &data);
543
551 void ReadMiscText(const wxString &data);
552
557 void ReadPrompt(const wxString &data);
558
564 void ReadStatusBar(const wxXmlDocument &xmldoc);
566 void ReadManualTopicNames(const wxXmlDocument &xmldoc);
567
576 void ReadMath(const wxXmlDocument &xml);
577
583 void ReadMaximaIPC(const wxString &data){m_ipc.ReadInputData(data);}
584 void ReadLoadSymbols(const wxXmlDocument &data);
585
587 void ReadSuppressedOutput(const wxString &data);
588
591 void ReadVariables(const wxXmlDocument &xmldoc);
592
595 void ReadAddVariables(const wxXmlDocument &xmldoc);
597 void VariableActionDisplay2d_Unicode(const wxString &value);
599 void VariableActionHtmlHelp(const wxString &value);
601 void VariableActionSinnpiflag(const wxString &value);
605 void VariableActionUserDir(const wxString &value);
607 void VariableActionTempDir(const wxString &value);
609 void VariableActionAutoconfVersion(const wxString &value);
611 void VariableActionAutoconfHost(const wxString &value);
613 void VariableActionMaximaInfodir(const wxString &value);
615 void VariableActionMaximaHtmldir(const wxString &value);
617 void VariableActionGnuplotCommand(const wxString &value);
619 void VariableActionMaximaSharedir(const wxString &value);
621 void VariableActionMaximaDemodir(const wxString &value);
623 void VariableActionLispName(const wxString &value);
625 void VariableActionLispVersion(const wxString &value);
627 void VariableActionWxLoadFileName(const wxString &value);
629 void VariableActionDisplay2D(const wxString &value);
631 void VariableActionAltDisplay2D(const wxString &value);
633 void VariableActionEngineeringFormat(const wxString &value);
635 void VariableActionOperators(const wxString &value);
640 void UpdateDisplayMode();
641 wxString m_maximaVariable_display2d;
642 wxString m_maximaVariable_altdisplay2d;
643 wxString m_maximaVariable_engineeringFormat;
644 bool m_readMaximaVariables = false;
645 bool m_updateAutocompletion = true;
650 long long GetTotalCpuTime();
651
657 long long GetMaximaCpuTime();
658
663 double GetMaximaCPUPercentage();
664
666 bool SaveNecessary();
667
676 void SetupVariables();
677
678 void KillMaxima(bool logMessage = true);
686 void ResetTitle(bool saved, bool force = false);
687
688 void FirstOutput();
689
692 bool OpenXML(const wxString &file, Worksheet *document);
693
695 bool CheckWXMXVersion(const wxString &docversion);
696
698 bool OpenMACFile(const wxString &file, Worksheet *document, bool clearDocument = true);
699
701 bool OpenWXMFile(const wxString &file, Worksheet *document, bool clearDocument = true);
702
704 bool OpenWXMXFile(const wxString &file, Worksheet *document, bool clearDocument = true);
705
707 std::unique_ptr<GroupCell> CreateTreeFromXMLNode(wxXmlNode *xmlcells, const wxString &wxmxfilename = {});
708
714 bool SaveFile(bool forceSave = false);
715
717 bool SaveOnClose();
722 bool AutoSave();
723
731 int SaveDocumentP();
732
734 void SetCWD(wxString file);
735
737 wxString GetCWD()
738 {
739 return m_CWD;
740 }
741
742 std::unique_ptr<Maxima> m_client;
749 void operator()(wxSocketServer* server) const {
750 server->Destroy(); // Destroy() calls Close() automatically.
751 }
752 };
759 std::unique_ptr<wxSocketServer, ServerDeleter> m_server;
760
761 wxProcess *m_maximaProcess = NULL;
763 wxInputStream *m_maximaStdout = NULL;
765 wxInputStream *m_maximaStderr = NULL;
767 int m_port = -1;
769 static wxString m_mathPrefix1;
771 static wxString m_mathPrefix2;
773 static wxString m_promptPrefix;
774public:
776 const static wxString m_promptSuffix;
777protected:
783 void QuestionAnswered(){if(GetWorksheet()) GetWorksheet()->QuestionAnswered();}
786 void OnNewDemoFiles(wxCommandEvent &event);
788 void OnDemoFileMenu(wxCommandEvent &ev);
789
791 void OnUpdateTOCEvent(wxCommandEvent &event);
792
794 void GnuplotCommandName(wxString gnuplot);
796 static wxString m_firstPrompt;
797 bool m_dispReadOut = false;
798 wxWindowIDRef m_gnuplot_process_id;
799 wxWindowIDRef m_maxima_process_id;
800 wxString m_lastPrompt;
801 wxString m_firstPromptBuffer;
802 wxString m_lastPath;
803 std::unique_ptr<wxPrintData> m_printData;
808 bool m_closing = false;
811 wxString m_maximaHtmlDir;
812 bool m_fileSaved = true;
813 static int m_exitCode;
816#ifdef __WINDOWS__
817 // For Windows, store "gnuplot.exe", even if wgnuplot.exe is preferred.
818 // We query the terminals using: gnuplot -e "print GPVAL_TERMINALS"
819 // and that does only work with gnuplot, not wgnuplot.
821 wxString m_gnuplotcommand_commandline;
822#endif
823 long m_commandIndex = -1;
825 static wxRegEx m_funRegEx;
826 static wxRegEx m_varRegEx;
827 static wxRegEx m_blankStatementRegEx;
828 static wxRegEx m_sbclCompilationRegEx;
829 MathParser m_parser;
830 bool m_maximaBusy = true;
831 bool m_maximaError = false;
832private:
833 wxString m_fileToOpen;
834 bool m_fourierLoaded = false;
836 typedef void (wxMaxima::*VarReadFunction)(const wxString &value);
837 typedef void (wxMaxima::*VarUndefinedFunction)();
838 typedef std::unordered_map <wxString, VarReadFunction, wxStringHash> VarReadFunctionHash;
839 typedef std::unordered_map <wxString, VarUndefinedFunction,
840 wxStringHash> VarUndefinedFunctionHash;
842 static VarReadFunctionHash m_variableReadActions;
844 static VarUndefinedFunctionHash m_variableUndefinedActions;
845
846#if wxUSE_DRAG_AND_DROP
847
848 friend class MyDropTarget;
849
850#endif
851 friend class MaximaIPC;
852
863 wxTimer m_autoSaveTimer;
864
865 /* A timer that delays redraws while maxima evaluates
866
867 If we always start a redraw when maxima has nearly finished a command that slows
868 down evaluating many simple commands in a row.
869 */
870 wxTimer m_fastResponseTimer;
871
873 void StartAutoSaveTimer();
874};
875
876#if wxUSE_DRAG_AND_DROP
877
878// cppcheck-suppress noConstructor
879class MyApp : public wxApp
880{
881public:
882 virtual bool OnInit() override;
883 virtual int OnRun() override;
884 virtual int OnExit() override;
885#if wxUSE_ON_FATAL_EXCEPTION && wxUSE_DEBUGREPORT
886 void OnFatalException () override;
887#endif
898 void OnAssertFailure(const wxChar *file, int line, const wxChar *func,
899 const wxChar *cond, const wxChar *msg) override;
913 static void NewWindow(const wxString &file = {}, bool evalOnStartup = false, bool exitAfterEval = false, unsigned char *wxmData = NULL, std::size_t wxmLen = 0);
914
915 void OnFileMenu(wxCommandEvent &ev);
916
917#ifdef __WXMSW__
930 void DisableConsoleQuickEdit();
932 void RestoreConsoleMode();
933#endif // __WXMSW__
934
935#ifdef __WXMAC__
936 void MacNewFile() override;
937 void MacOpenFile(const wxString &file) override;
938#endif // __WXMAC__
939
940public:
941 static wxLogWindow *m_logWindow; // The wxWidgets log window, we use.
942
943 std::unique_ptr<wxLogChain> m_logChain;
944 static std::vector<wxProcess *> m_wxMaximaProcesses;
945#ifdef USE_QA
946#if wxUSE_ON_FATAL_EXCEPTION && wxUSE_DEBUGREPORT
947 void GenerateDebugReport(wxDebugReport::Context ctx);
948#endif
949#endif
950 std::unique_ptr<wxLocale> m_locale;
951 std::unique_ptr<wxTranslations> m_translations;
952#ifdef __WXMSW__
954 unsigned long m_consoleModeToRestore = 0;
956 bool m_consoleModeChanged = false;
957#endif
959 wxString m_configFileName;
960 Dirstructure m_dirstruct;
961 static bool m_allWindowsInOneProcess;
962 std::unique_ptr<Configuration> m_configuration;
963};
964
965class MyDropTarget : public wxFileDropTarget
966{
967public:
968 explicit MyDropTarget(wxMaxima *wxmax)
969 { m_wxmax = wxmax; }
970
971 bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &files);
972
973private:
974 wxMaxima *m_wxmax = NULL;
975};
976
977#endif
978
979
980// cppcheck-suppress noConstructor
981
982#endif // WXMAXIMA_H
CellType
The supported types of math cells.
Definition: Cell.h:63
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:71
A Text cell.
Definition: TextCell.h:38
The canvas that contains the spreadsheet the whole program is about.
Definition: Worksheet.h:113
void OpenHCaret(const wxString &txt={})
Place the cursor into a new cell where the horizontal cursor is.
Definition: Worksheet.h:1259
void QuestionAnswered()
Mark the current question from maxima as "answered"..
Definition: Worksheet.cpp:2477
The frame containing the menu and the sidebars.
Definition: wxMaximaFrame.h:66
A version number that can be compared using "<" and ">".
Definition: wxMaxima.h:195
Definition: wxMaxima.h:69
void PlotMenu(wxCommandEvent &event)
Processes "Plot menu" cloicks.
Definition: wxMaxima.cpp:8675
void OnIdle(wxIdleEvent &event)
The idle task that refreshes the gui (worksheet, menus, title line,...)
Definition: wxMaxima.cpp:4420
void StatusMsgDClick(wxMouseEvent &ev)
Issued on double click on the status message in the status bar.
Definition: wxMaxima.cpp:10844
void VariableActionAutoconfVersion(const wxString &value)
Called if maxima tells us the maxima version as defined by autoconf.
Definition: wxMaxima.cpp:2944
int m_port
The port the actual maxima process (not its wrapper script) runs at.
Definition: wxMaxima.h:767
bool AutoSave()
Save the project in a temp file.
Definition: wxMaxima.cpp:5468
bool m_dispReadOut
what is displayed in statusbar
Definition: wxMaxima.h:797
void FileMenu(wxCommandEvent &event)
Processes "file menu" clicks.
Definition: wxMaxima.cpp:5513
bool m_scheduleUpdateToc
True = schedule an update of the table of contents.
Definition: wxMaxima.h:782
bool SaveFile(bool forceSave=false)
Saves the current file.
Definition: wxMaxima.cpp:5089
void VariableActionDisplay2d_Unicode(const wxString &value)
Called if maxima tells us the value of the maxima variable display2d_unicode.
Definition: wxMaxima.cpp:2927
void ShowTip(bool force)
Definition: wxMaxima.cpp:4239
void VariableActionUserDir(const wxString &value)
Called if maxima tells us where the user files are located.
Definition: wxMaxima.cpp:2921
static void KillAllChildMaximas()
Async-signal-safe: SIGKILL every registered child Maxima process group.
Definition: wxMaxima.cpp:203
void ReadMiscText(const wxString &data)
Reads text that isn't enclosed between xml tags.
Definition: wxMaxima.cpp:2670
void ReadMath(const wxXmlDocument &xml)
Reads the math cell's contents from Maxima.
Definition: wxMaxima.cpp:2815
static wxRegEx m_xmlOpeningTag
Looks if this opening tag is actually complete.
Definition: wxMaxima.h:310
void EquationsMenu(wxCommandEvent &event)
Processes "equations menu" clicks.
Definition: wxMaxima.cpp:7259
bool IsInteractive() const
Is this an interactive session (as opposed to a batch run that will exit)?
Definition: wxMaxima.h:170
static wxString m_promptPrefix
The marker for the start of a input prompt.
Definition: wxMaxima.h:773
void OnMinimize(wxIconizeEvent &event)
Called when this window is minimized.
Definition: wxMaxima.cpp:11069
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:212
void VariableActionAltDisplay2D(const wxString &value)
Called if maxima tells us if it currently outputs XML.
Definition: wxMaxima.cpp:3201
void ShowWxMaximaHelp()
Show the help for wxMaxima.
Definition: wxMaxima.cpp:4299
TextCell * ConsoleAppend(wxString s, CellType type)
append maxima output to console
Definition: wxMaxima.cpp:1499
void ChangeCellStyle(wxCommandEvent &event)
Is triggered when the textstyle drop-down box's value is changed.
Definition: wxMaxima.cpp:11076
static wxString ExtraMaximaArgs()
Which additional maxima arguments did we get from the command line?
Definition: wxMaxima.h:129
bool m_isActive
Is this window active?
Definition: wxMaxima.h:316
void NetworkDClick(wxMouseEvent &ev)
Issued on double click on the network status.
Definition: wxMaxima.cpp:10836
void MaximaEvent(wxThreadEvent &event)
Maxima sends or receives data, or disconnects.
Definition: wxMaxima.cpp:1855
wxString ReadPotentiallyUnclosedTag(wxStringTokenizer &lines, wxString firstLine)
Reads a potentially unclosed XML tag and closes it.
Definition: wxMaxima.cpp:3642
void OnReplace(wxFindDialogEvent &event)
Is triggered when the "Replace" button in the search dialog is pressed.
Definition: wxMaxima.cpp:6228
int SaveDocumentP()
Tries or offers to save the document.
Definition: wxMaxima.cpp:11015
void VariableActionDisplay2D(const wxString &value)
Called if maxima tells us the value of the maxima variable display2d
Definition: wxMaxima.cpp:3195
void ReadMaximaIPC(const wxString &data)
Reads autocompletion templates we get on definition of a function or variable.
Definition: wxMaxima.h:583
void AddDrawParameter(wxString cmd, int dimensionsOfNewDrawCommand=2)
Add a parameter to a draw command.
Definition: wxMaxima.cpp:7792
void ShowHelp(const wxString &keyword)
Try to determine if help is needed for maxima or wxMaxima and show this help.
Definition: wxMaxima.cpp:4380
void MaximaMenu(wxCommandEvent &event)
Processes "maxima menu" clicks.
Definition: wxMaxima.cpp:6418
static void ExtraMaximaArgs(const wxString &args)
Additional maxima arguments from the command line.
Definition: wxMaxima.h:127
void EvalOnStartup(bool eval)
Do we want to evaluate the document on startup?
Definition: wxMaxima.h:154
static void ExitOnError()
Exit if we encounter an error.
Definition: wxMaxima.h:79
void PrintMenu(wxCommandEvent &event)
Definition: wxMaxima.cpp:4697
void OnUpdateTOCEvent(wxCommandEvent &event)
Is called when something requests an update of the table of contents.
Definition: wxMaxima.cpp:5083
void UpdateMenus()
Enables and disables the Right menu buttons.
Definition: wxMaxima.cpp:4736
void LaunchHelpBrowser(wxString uri)
Launches the help browser on the uri passed as an argument.
Definition: wxMaxima.cpp:4255
wxInputStream * m_maximaStdout
The stdout of the maxima process.
Definition: wxMaxima.h:763
void VarReadEvent(wxCommandEvent &event)
Trigger reading all variables from Maxima that are shown in the Variables sidebar.
Definition: wxMaxima.cpp:10105
void GnuplotCommandName(wxString gnuplot)
Sets gnuplot's command name and tries to determine gnuplot's path.
Definition: wxMaxima.cpp:2979
void VariableActionAutoconfHost(const wxString &value)
Called if maxima tells us the maxima build host as defined by autoconf.
Definition: wxMaxima.cpp:2949
static bool GetEnableIPC()
Do we allow maxima to click buttons in wxMaxima?
Definition: wxMaxima.h:125
void ReadSuppressedOutput(const wxString &data)
Read (and discard) suppressed output.
Definition: wxMaxima.cpp:2831
std::unique_ptr< wxSocketServer, ServerDeleter > m_server
The server maxima connects to as client.
Definition: wxMaxima.h:759
void OnMaximaConnect()
Is called if maxima connects to wxMaxima.
Definition: wxMaxima.cpp:1982
wxTimer m_maximaStdoutPollTimer
A timer that polls for output from the maxima process.
Definition: wxMaxima.h:150
void VariableActionWxLoadFileName(const wxString &value)
Called if maxima tells us the name of a package that was loaded.
Definition: wxMaxima.cpp:3162
void OnFollow(wxCommandEvent &event)
Called when the "Scroll to currently evaluated" button is pressed.
Definition: wxMaxima.cpp:10871
bool DocumentSaved()
Does this document need saving?
Definition: wxMaxima.h:183
void EditMenu(wxCommandEvent &event)
Processes "Edit menu" clicks.
Definition: wxMaxima.cpp:5730
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:9024
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:209
TextCell * DoRawConsoleAppend(wxString s, CellType type, AppendOpt opts={})
Append one or more lines of ordinary unicode text to the console.
Definition: wxMaxima.cpp:1623
long long GetMaximaCpuTime()
How much CPU time has maxima used till now? Used by GetMaximaCPUPercentage.
Definition: wxMaxima.cpp:5342
void ReplaceSuggestion(wxCommandEvent &event)
Processes clicks on suggestions.
Definition: wxMaxima.cpp:10461
void SetCWD(wxString file)
Set the current working directory file I/O from maxima is relative to.
Definition: wxMaxima.cpp:3469
static wxRegEx m_xmlOpeningTagName
Finds the name of an opening tag.
Definition: wxMaxima.h:308
void EditInputMenu(wxCommandEvent &event)
Spawn the "configure" menu.
Definition: wxMaxima.cpp:10082
void LoadImage(const wxString &file)
Load an image from a file into the worksheet.
Definition: wxMaxima.h:187
static void EnableIPC()
Allow maxima to click buttons in wxMaxima.
Definition: wxMaxima.h:123
void UpdateToolBar()
Enables and disables the Right toolbar buttons.
Definition: wxMaxima.cpp:4804
void HistoryDClick(wxCommandEvent &event)
Issued on double click on a history item.
Definition: wxMaxima.cpp:10848
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:1204
void VariableActionTempDir(const wxString &value)
Called if maxima tells us where the temp files are located.
Definition: wxMaxima.cpp:2934
wxString GetCommand(bool params=true)
returns the command to start maxima
Definition: wxMaxima.cpp:4190
static wxString m_mathPrefix1
A marker for the start of maths.
Definition: wxMaxima.h:769
bool OpenFile(const wxString &file, const wxString &command={})
Open a file.
Definition: wxMaxima.cpp:4939
void OnFind(wxFindDialogEvent &event)
Is triggered when the "Find" button in the search dialog is pressed.
Definition: wxMaxima.cpp:6199
void OnSymbolAdd(wxCommandEvent &event)
Sends a new char to the symbols sidebar.
Definition: wxMaxima.cpp:6285
wxInputStream * m_maximaStderr
The stderr of the maxima process.
Definition: wxMaxima.h:765
bool OpenMACFile(const wxString &file, Worksheet *document, bool clearDocument=true)
Opens a .mac file or a .out file from Xmaxima.
Definition: wxMaxima.cpp:3515
bool ExitOnErrorArmed() const
Is THIS worksheet still set to exit on a Maxima error?
Definition: wxMaxima.h:92
bool OpenWXMXFile(const wxString &file, Worksheet *document, bool clearDocument=true)
Opens a wxmx file.
Definition: wxMaxima.cpp:3676
void KillMaxima(bool logMessage=true)
kills the maxima process
Definition: wxMaxima.cpp:2341
void VarAddAllEvent(wxCommandEvent &event)
Trigger adding all variables to the variables sidebar.
Definition: wxMaxima.cpp:10096
void VariableActionSinnpiflag(const wxString &value)
Called if maxima tells us the value of the maxima variable sinnpiflag.
Definition: wxMaxima.cpp:2915
void ListMenu(wxCommandEvent &event)
Processes "list menu" clicks.
Definition: wxMaxima.cpp:7983
void ReadStdErr()
Polls the stderr and stdout of maxima for input.
Definition: wxMaxima.cpp:5198
void ReadAddVariables(const wxXmlDocument &xmldoc)
Reads the "add variable to watch list" tag maxima can send us.
Definition: wxMaxima.cpp:3275
static bool GetExitOnError()
Do we exit if we encounter an error?
Definition: wxMaxima.h:81
void PropertiesMenu(wxCommandEvent &event)
Processes "Variable/Function props menu" clicks.
Definition: wxMaxima.cpp:6295
void VariableActionMaximaDemodir(const wxString &value)
Called if maxima tells us the maxima demo dir.
Definition: wxMaxima.cpp:3146
void VariableActionMaximaSharedir(const wxString &value)
Called if maxima tells us the maxima share dir.
Definition: wxMaxima.cpp:3135
void TriggerEvaluation()
Try to evaluate the next command for maxima that is in the evaluation queue.
Definition: wxMaxima.cpp:10288
void OnTimerEvent(wxTimerEvent &event)
Is triggered when a timer this class is responsible for requires.
Definition: wxMaxima.cpp:5435
void UpdateDisplayMode()
Derive the display mode (1D/2D ASCII/unicode/graphical) from the display2d and alt-display2d variable...
Definition: wxMaxima.cpp:3208
void PassKeyboardFocus()
Forwards the keyboard focus to a text control that might need it.
Definition: wxMaxima.cpp:11057
void ReadPrompt(const wxString &data)
Reads the input prompt from Maxima.
Definition: wxMaxima.cpp:3332
double GetMaximaCPUPercentage()
How much CPU horsepower is maxima using currently?
Definition: wxMaxima.cpp:5407
void NumericalMenu(wxCommandEvent &event)
Processes "Numerical menu" clicks.
Definition: wxMaxima.cpp:8737
bool m_closing
Did we tell maxima to close?
Definition: wxMaxima.h:808
void SendMaxima(wxString s, bool addToHistory=false, bool background=false)
Definition: wxMaxima.cpp:1758
void ResetTitle(bool saved, bool force=false)
Update the title.
Definition: wxMaxima.cpp:10727
void ReadVariables(const wxXmlDocument &xmldoc)
Reads the variable values maxima advertises to us.
Definition: wxMaxima.cpp:2864
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:2953
wxString m_maximaTempDir
The directory with maxima's temp files.
Definition: wxMaxima.h:810
void OnReplaceAll(wxFindDialogEvent &event)
Is triggered when the "Replace All" button in the search dialog is pressed.
Definition: wxMaxima.cpp:6261
void MaximaDClick(wxMouseEvent &ev)
Issued on double click on the Maxima status icon.
Definition: wxMaxima.cpp:10840
void DrawMenu(wxCommandEvent &event)
Processes "draw menu" clicks.
Definition: wxMaxima.cpp:7819
void VariableActionEngineeringFormat(const wxString &value)
Called if maxima tells us the value of the maxima variable engineering_format_floats
Definition: wxMaxima.cpp:3169
void VariableActionLispVersion(const wxString &value)
Called if maxima tells us the lisp version.
Definition: wxMaxima.cpp:3158
bool OpenXML(const wxString &file, Worksheet *document)
Opens a content.xml file that has been extracted from a broken .wxmx file.
Definition: wxMaxima.cpp:3988
void SimplifyMenu(wxCommandEvent &event)
Processes "Simplify menu" clicks.
Definition: wxMaxima.cpp:8205
void Interrupt(wxCommandEvent &event)
Interrupt button and hotkey presses Make the menu item, toolbars and panes visible that should be vis...
Definition: wxMaxima.cpp:2211
wxProcess * m_gnuplotProcess
The gnuplot process info.
Definition: wxMaxima.h:312
void OnFocus(wxFocusEvent &event)
Called when this window is focussed or defocussed.
Definition: wxMaxima.cpp:11051
void VariableActionMaximaHtmldir(const wxString &value)
Called if maxima tells us the maxima html dir.
Definition: wxMaxima.cpp:2960
void ReadManualTopicNames(const wxXmlDocument &xmldoc)
Read a manual topic name so we can jump to the right documentation page.
Definition: wxMaxima.cpp:2766
TimerIDs
An enum of individual IDs for all timers this class handles.
Definition: wxMaxima.h:133
@ KEYBOARD_INACTIVITY_TIMER_ID
The keyboard was inactive long enough that we can attempt an auto-save.
Definition: wxMaxima.h:135
@ AUTO_SAVE_TIMER_ID
The time between two auto-saves has elapsed.
Definition: wxMaxima.h:137
@ MAXIMA_STDOUT_POLL_ID
We look if we got new data from maxima's stdout.
Definition: wxMaxima.h:139
bool StartServer()
starts the server
Definition: wxMaxima.cpp:2015
void VariableActionSinnpiflagUndefined()
Called if maxima tells us that the maxima variable sinnpiflag is undefined.
Definition: wxMaxima.cpp:2919
bool CheckWXMXVersion(const wxString &docversion)
Complains if the version string from the XML file indicates too low a maxima version.
Definition: wxMaxima.cpp:3966
void OnClose(wxCloseEvent &event)
close wxMaxima window
Definition: wxMaxima.cpp:9455
void VariableActionHtmlHelp(const wxString &value)
Called if maxima tells us the value of the maxima variable output_format_for_help.
Definition: wxMaxima.cpp:3174
void VariableActionOperators(const wxString &value)
Called if maxima sends us the list of known operators.
Definition: wxMaxima.cpp:3229
bool SaveNecessary()
Does this file contain anything worth saving?
Definition: wxMaxima.cpp:10067
wxProcess * m_gnuplotTerminalQueryProcess
Info about the gnuplot process we start for querying the terminals it supports.
Definition: wxMaxima.h:314
void StripLispComments(wxString &s)
Remove empty statements.
Definition: wxMaxima.cpp:1743
void MenuCommand(const wxString &cmd)
Inserts command cmd into the worksheet.
Definition: wxMaxima.cpp:4681
void ReadStatusBar(const wxXmlDocument &xmldoc)
Reads the output of wxstatusbar() commands.
Definition: wxMaxima.cpp:2745
static const wxString m_promptSuffix
The marker for the end of a input prompt.
Definition: wxMaxima.h:776
bool OpenWXMFile(const wxString &file, Worksheet *document, bool clearDocument=true)
Opens a wxm file.
Definition: wxMaxima.cpp:3576
bool QueryVariableValue()
Query the value of a new maxima variable.
Definition: wxMaxima.cpp:3293
void ShowMaximaHelp(wxString={})
Show the help for Maxima.
Definition: wxMaxima.cpp:4387
void HelpMenu(wxCommandEvent &event)
Processes "Help menu" clicks.
Definition: wxMaxima.cpp:9073
wxString GetCWD()
Get the current working directory file I/O from maxima is relative to.
Definition: wxMaxima.h:737
std::unique_ptr< GroupCell > CreateTreeFromXMLNode(wxXmlNode *xmlcells, const wxString &wxmxfilename={})
Loads a wxmx description.
Definition: wxMaxima.cpp:4053
void ShowPane(wxCommandEvent &event)
Toggle the visibility of a pane.
Definition: wxMaxima.cpp:10810
void ShowMaximaHelpWithoutAnchor()
Show the help for Maxima (without handling of anchors).
Definition: wxMaxima.cpp:4338
void ReadFirstPrompt(const wxString &data)
Determines the process id of maxima from its initial output.
Definition: wxMaxima.cpp:2609
long long GetTotalCpuTime()
How much CPU time has been used by the system until now? Used by GetMaximaCPUPercentage.
Definition: wxMaxima.cpp:5307
bool StartMaxima(bool force=false)
starts maxima (uses getCommand) or restarts it if needed
Definition: wxMaxima.cpp:2071
static void SetupTerminationHandlers()
Install termination-signal handlers (SIGTERM/SIGINT/SIGHUP) on Unix.
Definition: wxMaxima.cpp:218
void ExitAfterEval(bool exitaftereval)
Do we want to exit the program after evaluation?
Definition: wxMaxima.cpp:4069
wxString m_gnuplotcommand
Maxima's idea about gnuplot's location.
Definition: wxMaxima.h:815
void ServerEvent(wxSocketEvent &event)
Server event: Maxima connects.
Definition: wxMaxima.cpp:1970
static wxString m_mathPrefix2
A marker for the start of maths.
Definition: wxMaxima.h:771
void MatrixMenu(wxCommandEvent &event)
Processes "algebra menu" clicks.
Definition: wxMaxima.cpp:7485
void SetupVariables()
Setup maxima's variables.
Definition: wxMaxima.cpp:4091
void OnDemoFileMenu(wxCommandEvent &ev)
Is called when a demo file menu is clicked.
Definition: wxMaxima.cpp:1256
void UpdateSlider()
Updates the slider to show the right frame.
Definition: wxMaxima.cpp:10782
void TableOfContentsSelection(wxListEvent &event)
Issued on double click on a table of contents item.
Definition: wxMaxima.cpp:10854
void VariableActionLispName(const wxString &value)
Called if maxima tells us the lisp name.
Definition: wxMaxima.cpp:3154
void ConfigChanged()
Is called on start and whenever the configuration changes.
Definition: wxMaxima.cpp:263
void EvaluateEvent(wxCommandEvent &event)
Handle the evaluation event.
Definition: wxMaxima.cpp:10117
static wxString m_firstPrompt
The first prompt maxima will output.
Definition: wxMaxima.h:796
void CalculusMenu(wxCommandEvent &event)
event handling for menus
Definition: wxMaxima.cpp:8479
bool SaveOnClose()
Try to save the file before closing it - or return false.
Definition: wxMaxima.cpp:9412
void VariableActionGnuplotCommand(const wxString &value)
Called if maxima tells us the value of the maxima variable gnuplot
Definition: wxMaxima.cpp:3101
void func()
function in group 1
Definition: group.cpp:13
The Right Way to delete a wxSocketServer.
Definition: wxMaxima.h:748
This file declares the class wxMaximaFrame.