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 "Version.h"
54#include "MainMenuBar.h"
55#include "sidebars/History.h"
57#include "StatusBar.h"
58#include "sidebars/LogPane.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);
112 void TogglePaneVisibility(int id);
113
115 void AddToHistory(const wxString &cmd)
116 { m_history->AddToHistory(cmd); }
117
121 void EvaluationQueueLength(int length, int numberOfCommands = -1);
122
129 void StatusMaximaBusy(StatusBar::MaximaStatus status){m_StatusMaximaBusy_next = status;}
130 void UpdateStatusMaximaBusy();
131
132 StatusBar::MaximaStatus m_StatusMaximaBusy = StatusBar::wait_for_start;
133 StatusBar::MaximaStatus m_StatusMaximaBusy_next = StatusBar::wait_for_start;
134
136 void StatusSaveStart();
137
139 void StatusSaveFinished();
140
142 void StatusSaveFailed();
143
145 void StatusExportStart();
146
149
151 void StatusExportFailed();
152
153 Configuration &GetConfiguration() {return m_configuration;}
154protected:
159 Configuration m_configuration;
161 std::size_t m_bytesFromMaxima = 0;
163 long m_pid = -1;
167 void OnNotificationClose(wxCommandEvent WXUNUSED(&event));
173 wxMenu *m_demo_sub = NULL;
175 std::vector<wxMenu *> m_demoSubs;
177 wxMenu *m_viewMenu = NULL;
179 wxMenu *m_gentranMenu = NULL;
181 wxMenu *m_subst_Sub = NULL;
183 wxMenu * m_logexpand_Sub = NULL;
185 wxMenu *m_FileMenu = NULL;
187 wxMenu *m_EditMenu = NULL;
189 wxMenu *m_CellMenu = NULL;
191 wxMenu *m_Edit_Zoom_Sub = NULL;
193 wxMenu *m_Maxima_Panes_Sub = NULL;
195 wxMenu *m_EquationsMenu = NULL;
197 wxMenu *m_MaximaMenu = NULL;
199 wxMenu *m_matrix_menu = NULL;
201 wxMenu *m_SimplifyMenu = NULL;
203 wxMenu *m_Simplify_Gamma_Sub = NULL;
205 wxMenu *m_debugTypeMenu = NULL;
207 wxMenu *m_Simplify_Trig_Sub = NULL;
211 wxMenu *m_CalculusMenu = NULL;
212
214 wxMenu *m_PlotMenu = NULL;
216 wxMenu *m_listMenu = NULL;
218 wxMenu *m_NumericMenu = NULL;
220 wxMenu *m_HelpMenu = NULL;
224 void ReReadConfig();
226 void ReadConfig();
234 void DockAllSidebars(wxCommandEvent &ev);
235
236 wxString wxMaximaManualLocation();
237public:
238
243 void BecomeLogTarget();
244
246 const std::unordered_map<int, wxString> &GetSidebarNames() const {return m_sidebarNames;}
247protected:
248 Worksheet *GetWorksheet() const {return m_worksheet;}
249private:
251 std::unordered_map<int, wxString> m_sidebarNames;
253 std::unordered_map<int, wxString> m_sidebarCaption;
255 std::size_t m_bytesFromMaxima_last = 0;
256 wxTimer m_bytesReadDisplayTimer;
258 bool m_StatusSaving = false;
259
260 void SetupToolBar();
261
265 void SetupMenu();
266 void SetupFileMenu();
267 void SetupEditMenu();
268 void SetupViewMenu();
269 void SetupCellMenu();
270 void SetupMaximaMenu();
271 void SetupEquationsMenu();
272 void SetupMatrixMenu();
273 void SetupCalculusMenu();
274 void SetupSimplifyMenu();
275 void SetupListMenu();
276 void SetupPlotMenu();
277 void SetupNumericMenu();
278 void SetupHelpMenu();
279
280public:
281 void StatusText(const wxString &text, bool saveInLog = true);
282protected:
283 ScrollingGenWizPanel *m_wizard = NULL;
293 virtual wxSize DoGetBestClientSize() const;
296#ifdef USE_WEBVIEW
297 HelpBrowser *m_helpPane = NULL;
298#endif
299
301 wxString GetDemoFile(wxWindowID id) const;
302protected:
303 std::array<wxString,10> m_statusTextHistory;
304 void OnMenuStatusText(wxMenuEvent &event);
305 std::unordered_map<wxWindowID, wxString> m_demoFilesIDs;
306
307 SymbolsSidebar *m_symbolsSidebar = NULL;
314
316 bool m_first = true;
317
318 bool ToolbarIsShown();
320 std::unique_ptr<wxAuiManager> m_manager;
321private:
323protected:
325 Worksheet * const m_worksheet = NULL;
327 History * const m_history = NULL;
334 RecentDocuments m_recentDocuments;
335 RecentDocuments m_recentPackages;
336 wxMenu *m_recentDocumentsMenu = NULL;
337 wxMenu *m_unsavedDocumentsMenu = NULL;
338 wxMenu *m_recentPackagesMenu = NULL;
339 wxMenu *m_autoSubscriptMenu = NULL;
340 wxMenu *m_equationTypeMenuMenu = NULL;
341 wxMenu *m_roundedMatrixParensMenu = NULL;
342};
343
344#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:85
The class for the sidebar with the draw commands.
Definition: DrawSidebar.h:39
Definition: HelpBrowser.h:48
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:264
A "debug messages" sidepane.
Definition: LogPane.h:36
A menu bar that flickers less on MS windows.
Definition: MainMenuBar.h:37
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:95
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:185
void UpdateRecentDocuments()
Update the recent documents list.
Definition: wxMaximaFrame.cpp:2116
void StatusSaveFailed()
Set the status to "Saving has failed".
Definition: wxMaximaFrame.cpp:583
void BecomeLogTarget()
Makes this window the debug log target of all windows from this maxima process.
Definition: wxMaximaFrame.cpp:2271
void RegisterAutoSaveFile()
Remember a temporary autosave file name.
Definition: wxMaximaFrame.cpp:2171
const std::unordered_map< int, wxString > & GetSidebarNames() const
Get the list of human-readable sidebarnames and IDs.
Definition: wxMaximaFrame.h:246
bool m_first
Do we expect the 1st prompt from maxima to appear?
Definition: wxMaximaFrame.h:316
virtual ~wxMaximaFrame()
The destructor.
Definition: wxMaximaFrame.cpp:595
wxMenu * m_EditMenu
The edit menu.
Definition: wxMaximaFrame.h:187
TableOfContents * m_tableOfContents
The table of contents pane.
Definition: wxMaximaFrame.h:158
void StatusSaveFinished()
Set the status to "Maxima has finished saving".
Definition: wxMaximaFrame.cpp:567
int m_commandsLeftInCurrentCell
The number of commands left in the current of the evaluation queue item.
Definition: wxMaximaFrame.h:313
void ReReadConfig()
Re-read the configuration.
Definition: wxMaximaFrame.cpp:2141
wxMenu * m_Simplify_Complex_Sub
The complex submenu.
Definition: wxMaximaFrame.h:209
wxString m_leftStatusText
The text for the Left half of the Status Bar.
Definition: wxMaximaFrame.h:291
void StatusExportStart()
Set the status to "Maxima is exporting".
Definition: wxMaximaFrame.cpp:571
virtual wxSize DoGetBestClientSize() const
The default size for the window.
Definition: wxMaximaFrame.cpp:470
wxMenu * m_PlotMenu
The plot menu.
Definition: wxMaximaFrame.h:214
wxMenu * m_Maxima_Panes_Sub
The panes submenu.
Definition: wxMaximaFrame.h:193
wxMenu * m_EquationsMenu
The equations menu.
Definition: wxMaximaFrame.h:195
bool m_updateEvaluationQueueLengthDisplay
Do we need to update the display showing the evaluation queue length?
Definition: wxMaximaFrame.h:311
wxMenu * m_gentranMenu
The gentran menu.
Definition: wxMaximaFrame.h:179
long m_drawDimensions_last
Are we inside a 2d or 3d draw command?
Definition: wxMaximaFrame.h:285
wxString m_tempfileName
The last name GetTempAutosavefileName() has returned.
Definition: wxMaximaFrame.h:165
wxString m_rightStatusText
The text for the Right half of the Status Bar.
Definition: wxMaximaFrame.h:289
wxMenu * m_Simplify_Trig_Sub
The trigonometric submenu.
Definition: wxMaximaFrame.h:207
void PopulateRecentPackagesMenu(wxMenu *menu, int firstEntry, const std::list< wxString > &items)
Used by UpdateRecentPackages for populating a menu.
Definition: wxMaximaFrame.cpp:2100
void ShowPane(int id, bool show=true)
Show or hide a sidebar.
Definition: wxMaximaFrame.cpp:2242
StatusBar * m_statusBar
The status bar.
Definition: wxMaximaFrame.h:169
XmlInspector * m_xmlInspector
A XmlInspector-like xml monitor.
Definition: wxMaximaFrame.h:329
void EvaluationQueueLength(int length, int numberOfCommands=-1)
Inform the user about the length of the evaluation queue.
Definition: wxMaximaFrame.cpp:480
bool m_forceStatusbarUpdate
true=force an update of the status bar at the next call of StatusMaximaBusy()
Definition: wxMaximaFrame.h:331
wxMenu * m_demo_sub
The "demo" sub-menu.
Definition: wxMaximaFrame.h:173
wxMenu * m_listMenu
The list menu.
Definition: wxMaximaFrame.h:216
wxMenu * m_debugTypeMenu
Contains the menu for the debugger trigger settingxc.
Definition: wxMaximaFrame.h:205
void PopulateRecentDocumentsMenu(wxMenu *menu, int firstEntry, const std::list< wxString > &items)
Used by UpdateRecentDocuments for populating a menu.
Definition: wxMaximaFrame.cpp:2077
MainMenuBar * m_MenuBar
The menu bar.
Definition: wxMaximaFrame.h:171
void OnNotificationClose(wxCommandEvent WXUNUSED(&event))
Issued if a notification is closed.
History *const m_history
The history pane.
Definition: wxMaximaFrame.h:327
wxMenu * m_Simplify_Gamma_Sub
The factorials and gamma submenu.
Definition: wxMaximaFrame.h:203
int m_EvaluationQueueLength
The current length of the evaluation queue of commands we still need to send to maxima.
Definition: wxMaximaFrame.h:309
void RemoveTempAutosavefile()
Remove an eventual temporary autosave file.
Definition: wxMaximaFrame.cpp:2181
wxMenu * m_CalculusMenu
The calculus menu.
Definition: wxMaximaFrame.h:211
void DockAllSidebars(wxCommandEvent &ev)
An instant single-window mode.
Definition: wxMaximaFrame.cpp:2214
void StatusSaveStart()
Set the status to "Maxima is saving".
Definition: wxMaximaFrame.cpp:562
wxMenu * m_viewMenu
The "view" menu.
Definition: wxMaximaFrame.h:177
void ReadConfig()
Read the configuration from the OS's configuration storage.
Definition: wxMaximaFrame.cpp:2136
wxMenu * m_SimplifyMenu
The simplify menu.
Definition: wxMaximaFrame.h:201
long m_pid
The process id of maxima. Is determined by ReadFirstPrompt.
Definition: wxMaximaFrame.h:163
void StatusExportFailed()
Set the status to "Exporting has failed".
Definition: wxMaximaFrame.cpp:589
std::size_t m_bytesFromMaxima
How many bytes did maxima send us until now?
Definition: wxMaximaFrame.h:161
wxMenu * m_matrix_menu
The matrix menu.
Definition: wxMaximaFrame.h:199
wxMenu * m_MaximaMenu
The maxima menu.
Definition: wxMaximaFrame.h:197
wxMenu * m_subst_Sub
The subst submenu.
Definition: wxMaximaFrame.h:181
void ShowToolBar(bool show)
Shows or hides the toolbar.
Definition: wxMaximaFrame.cpp:2266
void StatusMaximaBusy(StatusBar::MaximaStatus status)
Set the status according to if maxima is calculating.
Definition: wxMaximaFrame.h:129
bool IsPaneDisplayed(int id)
true, if a Pane is currently enabled
Definition: wxMaximaFrame.cpp:2194
wxMenu * m_HelpMenu
The help menu.
Definition: wxMaximaFrame.h:220
DrawSidebar * m_drawPane
The sidebar with the draw commands.
Definition: wxMaximaFrame.h:295
void StatusExportFinished()
Set the status to "Maxima has finished exporting".
Definition: wxMaximaFrame.cpp:577
wxMenu * m_Edit_Zoom_Sub
The zoom submenu.
Definition: wxMaximaFrame.h:191
LogPane * m_logPane
The panel the log and debug messages will appear on.
Definition: wxMaximaFrame.h:333
wxMenu * m_NumericMenu
The numeric menu.
Definition: wxMaximaFrame.h:218
wxMenu * m_CellMenu
The cell menu.
Definition: wxMaximaFrame.h:189
Variablespane * m_variablesPane
The panel the user can display variable contents in.
Definition: wxMaximaFrame.h:156
std::unique_ptr< wxAuiManager > m_manager
The manager for dynamic screen layouts.
Definition: wxMaximaFrame.h:320
bool m_newStatusText
Do we have new text to output in the Status Bar?
Definition: wxMaximaFrame.h:287
std::vector< wxMenu * > m_demoSubs
The submenus for the various "demo" sub-submenus.
Definition: wxMaximaFrame.h:175
Worksheet *const m_worksheet
The worksheet itself.
Definition: wxMaximaFrame.h:325
wxMenu * m_logexpand_Sub
The logexpand submenu.
Definition: wxMaximaFrame.h:183
wxString GetDemoFile(wxWindowID id) const
Looks up which demo file belongs to a wxWindowID.
Definition: wxMaximaFrame.cpp:2036
void AddToHistory(const wxString &cmd)
Adds a command to the list of recently used maxima commands.
Definition: wxMaximaFrame.h:115