wxMaxima
Loading...
Searching...
No Matches
ConfigDialogue.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//
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
32extern unsigned int view_refresh_svg_gz_len;
33extern unsigned char view_refresh_svg_gz[];
34
35#include "precomp.h"
36#include <wx/wx.h>
37#include "BinaryNameCtrl.h"
38#include <wx/image.h>
39#include <wx/grid.h>
40#include <wx/hashmap.h>
41#include <wx/clrpicker.h>
42#include <memory>
43#include <wx/propdlg.h>
44#include <wx/generic/propdlg.h>
45#include <wx/spinctrl.h>
46#include <wx/notebook.h>
47
48#include <wx/imaglist.h>
49#include <wx/bookctrl.h>
50#include <wx/artprov.h>
51#include <unordered_map>
52
53#ifndef CONFIGDIALOGUE_H
54#define CONFIGDIALOGUE_H
55
56#include "cells/TextStyle.h"
57#include "../Worksheet.h"
58#include "../Configuration.h"
59
60enum
61{
62 color_id,
63 listbox_styleFor,
64 checkbox_bold,
65 checkbox_italic,
66 checkbox_underlined,
67 checkbox_slanted,
68 checkbox_strikethrough,
69 button_defaultFont,
70 button_mathFont,
71 style_font_family,
72 language_id,
73 save_id,
74 load_id
75};
76
84class ConfigDialogue : public wxPropertySheetDialog
85{
86public:
88 explicit ConfigDialogue(wxWindow *parent);
89
92
95 {
96 mathJaX_TeX = 0,
97 bitmap = 1,
98 mathML_mathJaX = 2,
99 svg = 3
100 };
101
103 void OnChangeColor(wxColourPickerEvent& event);
104
110 void WriteSettings();
111
112private:
113 const int mMinPanelWidth = 500;
114 const int mMinPanelHeight = 500;
115
116private:
117 enum newVariables
118 {
119 MAXIMA_DEFAULT_LISP,
120 MAXIMA_IMAGESDIR,
121 MAXIMA_USERDIR,
122 MAXIMA_DIRECTORY,
123 MAXIMA_TEMPDIR,
124 MAXIMA_OBJDIR,
125 MAXIMA_DOC_PREFIX,
126 GCL_GC_PAGE_THRESH,
127 GCL_GC_ALLOC_MIN,
128 GCL_GC_PAGE_MAX,
129 GCL_MEM_MULTIPLE,
130 GCL_MULTIPROCESS_MEMORY_POOL,
131 LANG,
132 HOME,
133 VAR_DELETE
134 };
135 std::unique_ptr<struct wxm_NSVGrasterizer, decltype(std::free)*> m_svgRast{nullptr, std::free};
137 std::unique_ptr<Configuration> m_configuration;
138 Worksheet *m_sampleWorksheet = NULL;
139
140 typedef std::unordered_map <wxString, wxString, wxStringHash> StringHash;
141 typedef std::unordered_map <wxString, long, wxStringHash> Languages;
142
143 Languages m_languages;
148 class ExamplePanel : public wxPanel
149 {
150 public:
152 ExamplePanel(wxWindow *parent, int id, wxPoint pos, wxSize size) : wxPanel(parent, id, pos, size)
153 { Bind(wxEVT_PAINT, &ConfigDialogue::ExamplePanel::OnPaint, this); };
154
156 void SetStyle(const Style &style)
157 {
158 m_style = style;
159 Refresh();
160 }
161
162 private:
167 void OnPaint(wxPaintEvent &event);
168
170 Style m_style;
171 };
172
173
178 void SetCheckboxValues();
179
181 int GetImageSize();
182
184 wxWindow *CreateClipboardPanel();
185
187 wxWindow *CreatePrintPanel();
188
190 wxWindow *CreateRevertToDefaultsPanel();
191
192 wxCheckBox *m_copyBitmap, *m_copyMathML, *m_copyMathMLHTML, *m_copyRTF, *m_copySVG;
193#if wxUSE_ENH_METAFILE
194 wxCheckBox *m_copyEMF;
195#endif
196
198 wxWindow *CreateWorksheetPanel();
199
201 wxWindow *CreateOptionsPanel();
202
204 wxWindow *CreateExportPanel();
205
207 wxWindow *CreateStylePanel();
208
210 wxWindow *CreateMaximaPanel();
211
213 wxWindow *CreateStartupPanel();
214
215protected:
216 wxGrid *m_maximaEnvVariables;
217 void OnImport(wxCommandEvent& event);
218 static void CopyConfig(wxConfigBase *src, wxConfigBase *dst, wxString dir = wxS("/"));
219 void OnReloadAll(wxCommandEvent& event);
220 void OnReloadStyles(wxCommandEvent& event);
221 void OnResetAllToDefaults(wxCommandEvent& event);
222 void OnExportAll(wxCommandEvent& event);
223 void OnResetStyles(wxCommandEvent& event);
224 void OnChangeMaximaEnvVar(wxGridEvent& event);
225 void OnMaximaEnvRightClick(wxGridEvent& event);
226 void OnMouseMotion_MaximaEnv(wxMouseEvent &event);
227 void OnNewEnvMenu(wxCommandEvent &event);
228 void OnClickMaximaEnvVal(int row);
229 void OnChangeMaximaCellClick(wxGridEvent& event);
230
236 wxStaticText *m_mp;
237 StringHash m_maximaEnvDoc;
239 wxRadioButton *m_autodetectMaxima;
241 wxRadioButton *m_noAutodetectMaxima;
242 wxRadioButton *m_autodetectHelpBrowser;
243 wxRadioButton *m_noAutodetectHelpBrowser;
244 wxRadioButton *m_internalHelpBrowser;
245 wxCheckBox *m_singlePageManual;
246 wxRadioButton *m_maximaUsesInternalHelp;
247 wxRadioButton *m_maximaUsesHtmlHelp;
248 wxRadioButton *m_maximaUsesWxmaximaHelp;
250 wxRadioButton *m_autodetectMathJaX;
252 wxRadioButton *m_noAutodetectMathJaX;
253 wxRadioButton *m_useGnuplot;
254 wxRadioButton *m_useWgnuplot;
256 void OnTabChange(wxBookCtrlEvent &event);
257
259 void OnStyleToEditChanged(wxCommandEvent &event);
261 void OnAppearanceChanged(wxCommandEvent &event);
262
263 // begin wxGlade: ConfigDialogue::attributes
265 wxTextCtrl *m_startupCommands;
268 BinaryNameCtrl *m_maximaUserLocation;
269 BinaryNameCtrl *m_helpBrowserUserLocation;
270 wxTextCtrl *m_documentclass;
271 wxTextCtrl *m_documentclassOptions;
272 wxTextCtrl *m_texPreamble;
273 wxCheckBox *m_autoSave;
274 wxButton *m_wxMathMLBrowse;
275 wxTextCtrl *m_additionalParameters;
276 wxTextCtrl *m_mathJaxURL;
277 wxChoice *m_language;
278 wxTextCtrl *m_symbolPaneAdditionalChars;
279 wxCheckBox *m_abortOnError;
280 wxCheckBox *m_offerKnownAnswers;
281 wxCheckBox *m_restartOnReEvaluation;
282 wxCheckBox *m_wrapLatexMath;
283 wxCheckBox *m_usesvg;
284 wxCheckBox *m_antialiasLines;
285 wxSpinCtrl *m_defaultFramerate;
286 wxSpinCtrl *m_defaultPlotWidth;
287 wxSpinCtrl *m_defaultPlotHeight;
288 wxSpinCtrl *m_displayedDigits;
289 wxSpinCtrl *m_printMargin_Top;
290 wxSpinCtrl *m_printMargin_Bot;
291 wxSpinCtrl *m_printMargin_Left;
292 wxSpinCtrl *m_printMargin_Right;
293 wxRadioButton *m_displayNDigits;
294 wxRadioButton *m_displayAllDigits;
295 wxRadioButton *m_linebreaksInLongNums;
296 wxSpinCtrl *m_maxClipbrdBitmapMegabytes;
303 wxCheckBox *m_printBrackets;
304 wxChoice *m_exportWithMathJAX;
305 wxCheckBox *m_matchParens;
306 wxCheckBox *m_showMatchingParens;
307 wxChoice *m_showLength;
308 wxChoice *m_autosubscript;
309 wxRadioBox *m_layoutStrategy;
310 wxRadioButton *m_enterEvaluates;
311 wxRadioButton *m_ctrlEnterEvaluates;
312 wxCheckBox *m_numpadEnterEvaluates;
313 wxCheckBox *m_saveImgFileName;
314 wxCheckBox *m_saveUntitled;
315 wxCheckBox *m_openHCaret;
316 wxCheckBox *m_insertAns;
317 wxCheckBox *m_autoIndent;
318 wxCheckBox *m_cursorJump;
319 wxCheckBox *m_hideBrackets;
320 wxCheckBox *m_indentMaths;
321 wxChoice *m_autoWrap;
322 wxSpinCtrl *m_labelWidth;
323 wxSpinCtrl *m_undoLimit;
324 wxSpinCtrl *m_recentItems;
325 wxSpinCtrl *m_bitmapScale;
326 wxSpinCtrlDouble *m_printScale;
327 wxCheckBox *m_fixReorderedIndices;
328 wxCheckBox *m_incrementalSearch;
329 wxCheckBox *m_notifyIfIdle;
330 wxChoice *m_showUserDefinedLabels;
331 wxButton *m_getStyleFont;
334 wxListBox *m_styleFor;
336 wxColourPickerCtrl *m_styleColor;
337 wxCheckBox *m_boldCB;
338 wxCheckBox *m_italicCB;
339 wxCheckBox *m_slantedCB;
340 wxCheckBox *m_strikethroughCB;
341 wxCheckBox *m_underlinedCB;
342 wxCheckBox *m_fixedFontInTC;
343 wxCheckBox *m_unixCopy;
344 wxCheckBox *m_changeAsterisk;
345 wxCheckBox *m_hidemultiplicationSign;
346 wxCheckBox *m_latin2Greek;
347 wxCheckBox *m_useUnicodeMaths;
348 wxCheckBox *m_keepPercentWithSpecials;
349 wxBookCtrlBase *m_notebook;
350 wxButton *m_saveStyle, *m_loadStyle;
351 wxSpinCtrl *m_defaultPort;
352 ExamplePanel *m_examplePanel;
353 wxSpinCtrl *m_maxGnuplotMegabytes;
354 wxSpinCtrl *m_autosaveMinutes;
355 wxSpinCtrl *m_maxLayoutTime;
356 wxTextCtrl *m_autoMathJaxURL;
357 int m_maximaEmvRightClickRow = 0;
358
360 void UsesvgChanged(wxCommandEvent &event);
361
363 void OnClose(wxCloseEvent &event);
364
365 void OnwxMathMLBrowse(wxCommandEvent &event);
366
367 void OnIdle(wxIdleEvent &event);
368
370 void OnChangeStyle(wxCommandEvent &event);
371
373 void OnChangeWarning(wxCommandEvent &event);
374
376 void OnCheckbox(wxCommandEvent &event);
377
379 void UpdateExample();
380
382 void OnChangeFontFamily(wxCommandEvent &event);
383
385 void LoadSave(wxCommandEvent &event);
386
389
394
396#if wxCHECK_VERSION(3, 1, 6)
397 wxVector<wxBitmapBundle> m_imageList;
398#else
399 std::unique_ptr<wxImageList> m_imageList;
400#endif
401};
402
403#ifndef __WXMSW__
404
405#endif // __WXMSW__
406
407#endif // CONFIG_H
This file declares all the wizards the draw sidepane needs.
This file declares everything needed for the text style system used to style all the elements on the ...
TextStyle
All text styles known to wxMaxima.
Definition: TextStyle.h:231
A dialog that shows the program's license.
Definition: BinaryNameCtrl.h:40
The configuration dialog.
Definition: ConfigDialogue.h:85
int m_mathFontSize
The size of the maths font.
Definition: ConfigDialogue.h:393
void OnCheckbox(wxCommandEvent &event)
Called if one of the checkboxes for bold, italic or underlined is toggled.
Definition: ConfigDialogue.cpp:2463
wxRadioButton * m_noAutodetectMathJaX
The radio button that is set if m_autodetectMathJaX is unset.
Definition: ConfigDialogue.h:252
wxCheckBox * m_exportContainsWXMX
A checkbox that asks if all newlines in text cells have to be passed to HTML.
Definition: ConfigDialogue.h:302
std::unique_ptr< wxImageList > m_imageList
A list containing the pictograms for the tabs.
Definition: ConfigDialogue.h:399
void OnStyleToEditChanged(wxCommandEvent &event)
Called if the user changes the style that is to be edited.
Definition: ConfigDialogue.cpp:2096
wxRadioButton * m_autodetectMathJaX
Autodetect the mathJaX location?
Definition: ConfigDialogue.h:250
wxRadioButton * m_autodetectMaxima
Autodetect the maxima location?
Definition: ConfigDialogue.h:239
void OnChangeWarning(wxCommandEvent &event)
A message dialog that appears if a change cannot be applied now.
Definition: ConfigDialogue.cpp:2480
void UpdateExample()
Sets the style example's style on style changes.
Definition: ConfigDialogue.cpp:2486
int m_fontSize
The size of the text font.
Definition: ConfigDialogue.h:391
wxCheckBox * m_usePartialForDiff
A checkbox that asks if TeX should use the \partial symbol for representing diff()
Definition: ConfigDialogue.h:300
void WriteSettings()
Stores the settings from the configuration dialog.
Definition: ConfigDialogue.cpp:2124
wxStaticText * m_mp
The text "Maxima Program" that can change color.
Definition: ConfigDialogue.h:236
wxColourPickerCtrl * m_styleColor
An example rectangle with the font color.
Definition: ConfigDialogue.h:336
wxChoice * m_appearanceChoice
Light / Dark / Follow-system selector (also picks which set the editor edits).
Definition: ConfigDialogue.h:333
void OnClose(wxCloseEvent &event)
Is called when the configuration dialog is closed.
Definition: ConfigDialogue.cpp:2113
wxString m_wxStartupFileName
The name of wxMaxima's startup file.
Definition: ConfigDialogue.h:234
wxTextCtrl * m_startupCommands
A textbox containing maxima's startup commands.
Definition: ConfigDialogue.h:265
void OnChangeStyle(wxCommandEvent &event)
Called if a new item type that is to be styled is selected.
Definition: ConfigDialogue.cpp:2327
TextStyle GetSelectedStyle() const
Get the style currently selected in the m_styleFor control.
Definition: ConfigDialogue.cpp:1925
void UsesvgChanged(wxCommandEvent &event)
Is called when the path to the maxima binary was changed.
Definition: ConfigDialogue.cpp:285
wxString m_startupFileName
The name of maxima's startup file.
Definition: ConfigDialogue.h:232
wxRadioButton * m_noAutodetectMaxima
The radio button that is set if m_autodetectMaxima is unset.
Definition: ConfigDialogue.h:241
wxTextCtrl * m_wxStartupCommands
A textbox containing wxMaxima's startup commands.
Definition: ConfigDialogue.h:267
htmlExportFormats
The export formats we support for HTML equations.
Definition: ConfigDialogue.h:95
~ConfigDialogue()
The destructor.
Definition: ConfigDialogue.cpp:283
void OnChangeFontFamily(wxCommandEvent &event)
Called if the font family is changed.
Definition: ConfigDialogue.cpp:2301
wxCheckBox * m_TeXExponentsAfterSubscript
A checkbox that asks if TeX should put the exponents above or after the subscripts.
Definition: ConfigDialogue.h:298
void OnAppearanceChanged(wxCommandEvent &event)
Light / Dark / Follow-system appearance changed: re-point the style editor.
Definition: ConfigDialogue.cpp:2102
void OnTabChange(wxBookCtrlEvent &event)
Called if the currently active dialogue sheet is changed.
Definition: ConfigDialogue.cpp:2506
void OnChangeColor(wxColourPickerEvent &event)
Called if the color of an item has been changed.
Definition: ConfigDialogue.cpp:2319
void LoadSave(wxCommandEvent &event)
A "export the configuration" dialog.
Definition: ConfigDialogue.cpp:2512
Text Style Definition.
Definition: TextStyle.h:63
The canvas that contains the spreadsheet the whole program is about.
Definition: Worksheet.h:113