wxMaxima
Loading...
Searching...
No Matches
wxMaximaFrame.h
Go to the documentation of this file.
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2004-2015 Andrej Vodopivec <andrej.vodopivec@gmail.com>
4// (C) 2012 Doug Ilijev <doug.ilijev@gmail.com>
5// (C) 2014-2015 Gunter Königsmann <wxMaxima@physikbuch.de>
6//
7// This program is free software; you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation; either version 2 of the License, or
10// (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17//
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21//
22// SPDX-License-Identifier: GPL-2.0+
23
30#ifndef WXMAXIMAFRAME_H
31#define WXMAXIMAFRAME_H
32
33#include "precomp.h"
34#include <array>
35#include <wx/wx.h>
36#include "EventIDs.h"
37#include <wx/dirctrl.h>
38#include <wx/filehistory.h>
39#include <wx/listbox.h>
40#include <wx/bmpbuttn.h>
41#include <wx/arrstr.h>
42#include <wx/aui/aui.h>
43#include <wx/notifmsg.h>
44#include <wx/wrapsizer.h>
47
48#include "wizards/ScrollingGenWizPanel.h"
49#include "Worksheet.h"
52#include "RecentDocuments.h"
53#include "BuildConfig.h"
54#include "MainMenuBar.h"
55#include "sidebars/History.h"
57#include "sidebars/PerformanceSidebar.h"
58#include "StatusBar.h"
60#include <list>
61
62
65class wxMaximaFrame : public wxFrame
66{
67public:
68 wxMaximaFrame(wxWindow *parent, int id, const wxString &title,
69 const wxPoint &pos = wxDefaultPosition,
70 const wxSize &size = wxDefaultSize,
71 long style = wxDEFAULT_FRAME_STYLE | wxSYSTEM_MENU | wxCAPTION);
72
75 virtual ~wxMaximaFrame();
76
82 void ShowToolBar(bool show);
83 static std::size_t CountWindows();
84
91
93 void PopulateRecentDocumentsMenu(wxMenu *menu, int firstEntry, const std::list<wxString> &items);
95 void PopulateRecentPackagesMenu(wxMenu *menu, int firstEntry, const std::list<wxString> &items);
96
102 bool IsPaneDisplayed(int id);
103
111 void ShowPane(int id, bool show = true);
113 bool IsXMLInspectorShown(){return m_manager.GetPane(wxS("XmlInspector")).IsShown();}
115 bool IsPerformanceMonitorShown(){return m_manager.GetPane(wxS("performance")).IsShown();}
118 {
119 m_manager.GetPane(wxS("XmlInspector")).Show(!IsXMLInspectorShown());
121 }
124 {
125 m_manager.GetPane(wxS("log"))
126 .Show(!m_manager.GetPane(wxS("log")).IsShown());
128 }
130 void ShowWizardPane(wxString title)
131 {
132 m_manager.GetPane("wizard").Show(true).Caption(title);
134 }
135 void HideWizardPane()
136 {
137 m_manager.GetPane("wizard").Show(false);
139 }
141 void TogglePaneVisibility(int id);
142
144 void AddToHistory(const wxString &cmd)
145 { m_history->AddToHistory(cmd); }
146
150 void EvaluationQueueLength(int length, int numberOfCommands = -1);
151
153 void AuiManagerUpdate();
154
161 void StatusMaximaBusy(StatusBar::MaximaStatus status){m_StatusMaximaBusy_next = status;}
163 StatusBar::MaximaStatus StatusMaximaBusy() const {return m_StatusMaximaBusy;}
164 void UpdateStatusMaximaBusy();
165
167 bool HasPendingStatusText() const {return m_newStatusText;}
169 void ClearPendingStatusText() {m_newStatusText = false;}
171 const wxString &GetLeftStatusText() const {return m_leftStatusText;}
172
174 void StatusSaveStart();
175
177 void StatusSaveFinished();
178
180 void StatusSaveFailed();
181
183 void StatusExportStart();
184
187
189 void StatusExportFailed();
190
191 Configuration &GetConfiguration() {return m_configuration;}
192protected:
197 Configuration m_configuration;
199 std::size_t m_bytesFromMaxima = 0;
201 long m_pid = -1;
203 long m_maximaPid = -1;
207 void OnNotificationClose(wxCommandEvent WXUNUSED(&event));
213 wxMenu *m_demo_sub = NULL;
215 std::vector<wxMenu *> m_demoSubs;
217 wxMenu *m_viewMenu = NULL;
219 wxMenu *m_gentranMenu = NULL;
221 wxMenu *m_subst_Sub = NULL;
223 wxMenu * m_logexpand_Sub = NULL;
225 wxMenu *m_FileMenu = NULL;
227 wxMenu *m_EditMenu = NULL;
229 wxMenu *m_CellMenu = NULL;
231 wxMenu *m_Edit_Zoom_Sub = NULL;
233 wxMenu *m_Maxima_Panes_Sub = NULL;
235 wxMenu *m_EquationsMenu = NULL;
237 wxMenu *m_MaximaMenu = NULL;
239 wxMenu *m_matrix_menu = NULL;
241 wxMenu *m_SimplifyMenu = NULL;
243 wxMenu *m_Simplify_Gamma_Sub = NULL;
245 wxMenu *m_debugTypeMenu = NULL;
247 wxMenu *m_Simplify_Trig_Sub = NULL;
251 wxMenu *m_CalculusMenu = NULL;
252
254 wxMenu *m_PlotMenu = NULL;
256 wxMenu *m_listMenu = NULL;
258 wxMenu *m_NumericMenu = NULL;
260 wxMenu *m_HelpMenu = NULL;
264 void ReReadConfig();
266 void ReadConfig();
274 void DockAllSidebars(wxCommandEvent &ev);
275 void HideAllSidebars(wxCommandEvent &ev);
276
277 wxString wxMaximaManualLocation();
278public:
280 const std::unordered_map<int, wxString> &GetSidebarNames() const {return m_sidebarNames;}
281protected:
282 Worksheet *GetWorksheet() const {return m_worksheet;}
283private:
285 std::unordered_map<int, wxString> m_sidebarNames;
287 std::unordered_map<int, wxString> m_sidebarCaption;
289 std::size_t m_bytesFromMaxima_last = 0;
290 wxTimer m_bytesReadDisplayTimer;
292 bool m_StatusSaving = false;
295 StatusBar::MaximaStatus m_StatusMaximaBusy = StatusBar::wait_for_start;
296 StatusBar::MaximaStatus m_StatusMaximaBusy_next = StatusBar::wait_for_start;
299 bool m_newStatusText = false;
301 wxString m_leftStatusText;
303 bool m_forceStatusbarUpdate = false;
304
305 void SetupToolBar();
306
310 void SetupMenu();
311 void SetupFileMenu();
312 void SetupEditMenu();
313 void SetupViewMenu();
314 void SetupCellMenu();
315 void SetupMaximaMenu();
316 void SetupEquationsMenu();
317 void SetupMatrixMenu();
318 void SetupCalculusMenu();
319 void SetupSimplifyMenu();
320 void SetupListMenu();
321 void SetupPlotMenu();
322 void SetupNumericMenu();
323 void SetupHelpMenu();
324
325public:
326 void StatusText(const wxString &text, bool saveInLog = true);
327protected:
328 ScrollingGenWizPanel *m_wizard = NULL;
332 virtual wxSize DoGetBestClientSize() const;
335#ifdef USE_WEBVIEW
336 HelpBrowser *m_helpPane = NULL;
337#endif
338
340 wxString GetDemoFile(wxWindowID id) const;
341protected:
342 std::array<wxString, 10> m_statusTextHistory;
343 void OnMenuStatusText(wxMenuEvent &event);
344 std::unordered_map<wxWindowID, wxString> m_demoFilesIDs;
345
346 SymbolsSidebar *m_symbolsSidebar = NULL;
353
355 bool m_first = true;
356
357 bool ToolbarIsShown();
358protected:
360 wxAuiManager m_manager;
362 Worksheet * const m_worksheet = NULL;
364 History * const m_history = NULL;
371 RecentDocuments m_recentPackages;
372 wxMenu *m_recentDocumentsMenu = NULL;
373 wxMenu *m_unsavedDocumentsMenu = NULL;
374 wxMenu *m_recentPackagesMenu = NULL;
375 wxMenu *m_autoSubscriptMenu = NULL;
376 wxMenu *m_equationTypeMenuMenu = NULL;
377 wxMenu *m_roundedMatrixParensMenu = NULL;
378};
379
380#endif // WXMAXIMAFRAME_H
This file contains the definition of the class Buttonwrapsizer that allows to select arbitrary unicod...
This file declares the class StatSidebar, that provides some statistics buttons.
This file declares the class EventIDs that contains unique IDs for many events wxMaxima needs.
This file declares the class HelpBrowser.
This file contains the definition of the class History that handles the recently issued commands for ...
This file declares a (hopefully) flicker-free main menu bar.
The definition of the class RecentDocuments that provides a recent files mechanism that is extensible...
This file contains the definition of the class History that handles the recently issued commands for ...
This file declares the class wxMaximaFrame.
This file contains the definition of the class TableOfContents that handles the table of contents pan...
This file defines the class Worksheet.
This file contains the definition of the class XmlInspector that handles the table of contents pane.
The configuration storage for the current worksheet.
Definition: Configuration.h:97
The class for the sidebar with the draw commands.
Definition: DrawSidebar.h:39
Definition: HelpBrowser.h:49
This class generates a pane containing the last commands that were issued.
Definition: History.h:56
void AddToHistory(const wxString &cmd)
Add a file to the recently opened files list.
Definition: History.cpp:263
A menu bar that flickers less on MS windows.
Definition: MainMenuBar.h:37
Definition: PerformanceSidebar.h:31
A class that maintains a list of recent documents.
Definition: RecentDocuments.h:42
Definition: ScrollingGenWizPanel.h:32
The class that draws the status bar.
Definition: StatusBar.h:47
Definition: SymbolsSidebar.h:46
This class generates a pane containing the table of contents.
Definition: TableOfContents.h:52
A "variables" sidepane.
Definition: VariablesPane.h:44
The canvas that contains the spreadsheet the whole program is about.
Definition: Worksheet.h:113
This class generates a pane displaying the communication between maxima and wxMaxima.
Definition: XmlInspector.h:40
The frame containing the menu and the sidebars.
Definition: wxMaximaFrame.h:66
wxMenu * m_FileMenu
The file menu.
Definition: wxMaximaFrame.h:225
void UpdateRecentDocuments()
Update the recent documents list.
Definition: wxMaximaFrame.cpp:2096
void StatusSaveFailed()
Set the status to "Saving has failed".
Definition: wxMaximaFrame.cpp:578
void RegisterAutoSaveFile()
Remember a temporary autosave file name.
Definition: wxMaximaFrame.cpp:2151
const std::unordered_map< int, wxString > & GetSidebarNames() const
Get the list of human-readable sidebarnames and IDs.
Definition: wxMaximaFrame.h:280
bool m_first
Do we expect the 1st prompt from maxima to appear?
Definition: wxMaximaFrame.h:355
virtual ~wxMaximaFrame()
The destructor.
Definition: wxMaximaFrame.cpp:590
wxMenu * m_EditMenu
The edit menu.
Definition: wxMaximaFrame.h:227
TableOfContents * m_tableOfContents
The table of contents pane.
Definition: wxMaximaFrame.h:196
void StatusSaveFinished()
Set the status to "Maxima has finished saving".
Definition: wxMaximaFrame.cpp:562
int m_commandsLeftInCurrentCell
The number of commands left in the current of the evaluation queue item.
Definition: wxMaximaFrame.h:352
void TogglePaneVisibility(int id)
Hides or unhides the pane with the given ID.
Definition: wxMaximaFrame.cpp:2229
void ReReadConfig()
Re-read the configuration.
Definition: wxMaximaFrame.cpp:2121
wxMenu * m_Simplify_Complex_Sub
The complex submenu.
Definition: wxMaximaFrame.h:249
bool IsXMLInspectorShown()
Is the XML inspector shown?
Definition: wxMaximaFrame.h:113
StatusBar::MaximaStatus StatusMaximaBusy() const
The status Maxima is currently displayed as being in.
Definition: wxMaximaFrame.h:163
void StatusExportStart()
Set the status to "Maxima is exporting".
Definition: wxMaximaFrame.cpp:566
void ClearPendingStatusText()
Mark the pending left-half status text as having been displayed.
Definition: wxMaximaFrame.h:169
virtual wxSize DoGetBestClientSize() const
The default size for the window.
Definition: wxMaximaFrame.cpp:474
wxMenu * m_PlotMenu
The plot menu.
Definition: wxMaximaFrame.h:254
PerformanceSidebar * m_performanceSidebar
The panel showing performance statistics.
Definition: wxMaximaFrame.h:368
wxMenu * m_Maxima_Panes_Sub
The panes submenu.
Definition: wxMaximaFrame.h:233
wxMenu * m_EquationsMenu
The equations menu.
Definition: wxMaximaFrame.h:235
bool m_updateEvaluationQueueLengthDisplay
Do we need to update the display showing the evaluation queue length?
Definition: wxMaximaFrame.h:350
wxMenu * m_gentranMenu
The gentran menu.
Definition: wxMaximaFrame.h:219
void ToggleXMLInspector()
Hide or unhide the XML inspector.
Definition: wxMaximaFrame.h:117
long m_drawDimensions_last
Are we inside a 2d or 3d draw command?
Definition: wxMaximaFrame.h:330
wxString m_tempfileName
The last name GetTempAutosavefileName() has returned.
Definition: wxMaximaFrame.h:205
wxMenu * m_Simplify_Trig_Sub
The trigonometric submenu.
Definition: wxMaximaFrame.h:247
void PopulateRecentPackagesMenu(wxMenu *menu, int firstEntry, const std::list< wxString > &items)
Used by UpdateRecentPackages for populating a menu.
Definition: wxMaximaFrame.cpp:2080
void ShowPane(int id, bool show=true)
Show or hide a sidebar.
Definition: wxMaximaFrame.cpp:2238
StatusBar * m_statusBar
The status bar.
Definition: wxMaximaFrame.h:209
XmlInspector * m_xmlInspector
A XmlInspector-like xml monitor.
Definition: wxMaximaFrame.h:366
void EvaluationQueueLength(int length, int numberOfCommands=-1)
Inform the user about the length of the evaluation queue.
Definition: wxMaximaFrame.cpp:484
wxMenu * m_demo_sub
The "demo" sub-menu.
Definition: wxMaximaFrame.h:213
wxMenu * m_listMenu
The list menu.
Definition: wxMaximaFrame.h:256
wxMenu * m_debugTypeMenu
Contains the menu for the debugger trigger settingxc.
Definition: wxMaximaFrame.h:245
void PopulateRecentDocumentsMenu(wxMenu *menu, int firstEntry, const std::list< wxString > &items)
Used by UpdateRecentDocuments for populating a menu.
Definition: wxMaximaFrame.cpp:2057
MainMenuBar * m_MenuBar
The menu bar.
Definition: wxMaximaFrame.h:211
bool IsPerformanceMonitorShown()
Is the performance monitor shown?
Definition: wxMaximaFrame.h:115
void OnNotificationClose(wxCommandEvent WXUNUSED(&event))
Issued if a notification is closed.
History *const m_history
The history pane.
Definition: wxMaximaFrame.h:364
wxMenu * m_Simplify_Gamma_Sub
The factorials and gamma submenu.
Definition: wxMaximaFrame.h:243
int m_EvaluationQueueLength
The current length of the evaluation queue of commands we still need to send to maxima.
Definition: wxMaximaFrame.h:348
void AuiManagerUpdate()
Updates the AUI manager and re-asserts the menu bar on GTK to prevent it from disappearing.
Definition: wxMaximaFrame.cpp:2208
void RemoveTempAutosavefile()
Remove an eventual temporary autosave file.
Definition: wxMaximaFrame.cpp:2158
wxMenu * m_CalculusMenu
The calculus menu.
Definition: wxMaximaFrame.h:251
void DockAllSidebars(wxCommandEvent &ev)
An instant single-window mode.
Definition: wxMaximaFrame.cpp:2187
void StatusSaveStart()
Set the status to "Maxima is saving".
Definition: wxMaximaFrame.cpp:557
wxMenu * m_viewMenu
The "view" menu.
Definition: wxMaximaFrame.h:217
void ReadConfig()
Read the configuration from the OS's configuration storage.
Definition: wxMaximaFrame.cpp:2116
wxMenu * m_SimplifyMenu
The simplify menu.
Definition: wxMaximaFrame.h:241
void ShowWizardPane(wxString title)
Show the pane the wizards are in.
Definition: wxMaximaFrame.h:130
long m_pid
The process id of maxima. Is determined by ReadFirstPrompt.
Definition: wxMaximaFrame.h:201
void StatusExportFailed()
Set the status to "Exporting has failed".
Definition: wxMaximaFrame.cpp:584
std::size_t m_bytesFromMaxima
How many bytes did maxima send us until now?
Definition: wxMaximaFrame.h:199
wxMenu * m_matrix_menu
The matrix menu.
Definition: wxMaximaFrame.h:239
const wxString & GetLeftStatusText() const
The pending text for the left half of the status bar.
Definition: wxMaximaFrame.h:171
wxMenu * m_MaximaMenu
The maxima menu.
Definition: wxMaximaFrame.h:237
wxMenu * m_subst_Sub
The subst submenu.
Definition: wxMaximaFrame.h:221
void ShowToolBar(bool show)
Shows or hides the toolbar.
Definition: wxMaximaFrame.cpp:2262
void StatusMaximaBusy(StatusBar::MaximaStatus status)
Set the status according to if maxima is calculating.
Definition: wxMaximaFrame.h:161
bool IsPaneDisplayed(int id)
true, if a Pane is currently enabled
Definition: wxMaximaFrame.cpp:2170
wxMenu * m_HelpMenu
The help menu.
Definition: wxMaximaFrame.h:260
void ToggleLogPane()
Toggle the visibility of the log pane.
Definition: wxMaximaFrame.h:123
wxAuiManager m_manager
The manager for dynamic screen layouts.
Definition: wxMaximaFrame.h:360
DrawSidebar * m_drawPane
The sidebar with the draw commands.
Definition: wxMaximaFrame.h:334
void StatusExportFinished()
Set the status to "Maxima has finished exporting".
Definition: wxMaximaFrame.cpp:572
wxMenu * m_Edit_Zoom_Sub
The zoom submenu.
Definition: wxMaximaFrame.h:231
wxMenu * m_NumericMenu
The numeric menu.
Definition: wxMaximaFrame.h:258
wxMenu * m_CellMenu
The cell menu.
Definition: wxMaximaFrame.h:229
Variablespane * m_variablesPane
The panel the user can display variable contents in.
Definition: wxMaximaFrame.h:194
std::vector< wxMenu * > m_demoSubs
The submenus for the various "demo" sub-submenus.
Definition: wxMaximaFrame.h:215
long m_maximaPid
The real process id of maxima (might be a child of m_pid).
Definition: wxMaximaFrame.h:203
Worksheet *const m_worksheet
The worksheet itself.
Definition: wxMaximaFrame.h:362
RecentDocuments m_recentDocuments
The panel the log and debug messages will appear on.
Definition: wxMaximaFrame.h:370
wxMenu * m_logexpand_Sub
The logexpand submenu.
Definition: wxMaximaFrame.h:223
bool HasPendingStatusText() const
True if StatusText() recorded a left-half status text not yet shown.
Definition: wxMaximaFrame.h:167
wxString GetDemoFile(wxWindowID id) const
Looks up which demo file belongs to a wxWindowID.
Definition: wxMaximaFrame.cpp:2016
void AddToHistory(const wxString &cmd)
Adds a command to the list of recently used maxima commands.
Definition: wxMaximaFrame.h:144