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/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#if wxUSE_ACCESSIBILITY
194 wxWindow *CreateAccessibilityPanel();
195
197 wxCheckBox *m_screenReaderMathML;
198#endif
199
200 wxCheckBox *m_copyBitmap, *m_copyMathML, *m_copyMathMLHTML, *m_copyRTF, *m_copySVG;
201#if wxUSE_ENH_METAFILE
202 wxCheckBox *m_copyEMF;
203#endif
204
206 wxWindow *CreateWorksheetPanel();
207
209 wxWindow *CreateOptionsPanel();
210
212 wxWindow *CreateExportPanel();
213
215 wxWindow *CreateStylePanel();
216
218 wxWindow *CreateMaximaPanel();
219
221 wxWindow *CreateStartupPanel();
222
223protected:
224 wxGrid *m_maximaEnvVariables;
225 void OnImport(wxCommandEvent& event);
226 static void CopyConfig(wxConfigBase *src, wxConfigBase *dst, wxString dir = wxS("/"));
227 void OnReloadAll(wxCommandEvent& event);
228 void OnReloadStyles(wxCommandEvent& event);
229 void OnResetAllToDefaults(wxCommandEvent& event);
230 void OnExportAll(wxCommandEvent& event);
231 void OnResetStyles(wxCommandEvent& event);
232 void OnChangeMaximaEnvVar(wxGridEvent& event);
233 void OnMaximaEnvRightClick(wxGridEvent& event);
234 void OnMouseMotion_MaximaEnv(wxMouseEvent &event);
235 void OnNewEnvMenu(wxCommandEvent &event);
236 void OnClickMaximaEnvVal(int row);
237 void OnChangeMaximaCellClick(wxGridEvent& event);
238
244 wxStaticText *m_mp;
245 StringHash m_maximaEnvDoc;
247 wxRadioButton *m_autodetectMaxima;
249 wxRadioButton *m_noAutodetectMaxima;
250 wxRadioButton *m_autodetectHelpBrowser;
251 wxRadioButton *m_noAutodetectHelpBrowser;
252 wxRadioButton *m_internalHelpBrowser;
253 wxCheckBox *m_singlePageManual;
254 wxRadioButton *m_maximaUsesInternalHelp;
255 wxRadioButton *m_maximaUsesHtmlHelp;
256 wxRadioButton *m_maximaUsesWxmaximaHelp;
258 wxRadioButton *m_autodetectMathJaX;
260 wxRadioButton *m_noAutodetectMathJaX;
261 wxRadioButton *m_useGnuplot;
262 wxRadioButton *m_useWgnuplot;
264 void OnTabChange(wxBookCtrlEvent &event);
265
267 void OnStyleToEditChanged(wxCommandEvent &event);
269 void OnAppearanceChanged(wxCommandEvent &event);
270
271 // begin wxGlade: ConfigDialogue::attributes
273 wxTextCtrl *m_startupCommands;
276 BinaryNameCtrl *m_maximaUserLocation;
277 BinaryNameCtrl *m_helpBrowserUserLocation;
278 wxTextCtrl *m_documentclass;
279 wxTextCtrl *m_documentclassOptions;
280 wxTextCtrl *m_texPreamble;
281 wxCheckBox *m_autoSave;
282 wxButton *m_wxMathMLBrowse;
283 wxTextCtrl *m_additionalParameters;
284 wxTextCtrl *m_mathJaxURL;
285 wxChoice *m_language;
286 wxTextCtrl *m_symbolPaneAdditionalChars;
287 wxCheckBox *m_abortOnError;
288 wxCheckBox *m_offerKnownAnswers;
289 wxCheckBox *m_restartOnReEvaluation;
290 wxCheckBox *m_wrapLatexMath;
291 wxCheckBox *m_usesvg;
292 wxCheckBox *m_antialiasLines;
293 wxSpinCtrlDouble *m_defaultFramerate;
294 wxSpinCtrl *m_defaultPlotWidth;
295 wxSpinCtrl *m_defaultPlotHeight;
296 wxSpinCtrl *m_displayedDigits;
297 wxSpinCtrl *m_printMargin_Top;
298 wxSpinCtrl *m_printMargin_Bot;
299 wxSpinCtrl *m_printMargin_Left;
300 wxSpinCtrl *m_printMargin_Right;
301 wxRadioButton *m_displayNDigits;
302 wxRadioButton *m_displayAllDigits;
303 wxRadioButton *m_linebreaksInLongNums;
304 wxSpinCtrl *m_maxClipbrdBitmapMegabytes;
311 wxCheckBox *m_printBrackets;
312 wxChoice *m_exportWithMathJAX;
313 wxCheckBox *m_matchParens;
314 wxCheckBox *m_showMatchingParens;
315 wxChoice *m_showLength;
316 wxChoice *m_autosubscript;
317 wxRadioBox *m_layoutStrategy;
318 wxRadioButton *m_enterEvaluates;
319 wxRadioButton *m_ctrlEnterEvaluates;
320 wxCheckBox *m_numpadEnterEvaluates;
321 wxCheckBox *m_saveImgFileName;
322 wxCheckBox *m_saveUntitled;
323 wxCheckBox *m_openHCaret;
324 wxCheckBox *m_insertAns;
325 wxCheckBox *m_autoIndent;
326 wxCheckBox *m_cursorJump;
327 wxCheckBox *m_hideBrackets;
328#ifdef __WXGTK__
331 wxCheckBox *m_overlayScrollbars;
332#endif
333 wxCheckBox *m_indentMaths;
334 wxChoice *m_autoWrap;
335 wxSpinCtrl *m_labelWidth;
336 wxSpinCtrl *m_recentItems;
337 wxSpinCtrl *m_bitmapScale;
338 wxSpinCtrlDouble *m_printScale;
339 wxCheckBox *m_fixReorderedIndices;
340 wxCheckBox *m_incrementalSearch;
341 wxCheckBox *m_notifyIfIdle;
342 wxChoice *m_showUserDefinedLabels;
343 wxButton *m_getStyleFont;
346 wxListBox *m_styleFor;
348 wxColourPickerCtrl *m_styleColor;
349 wxCheckBox *m_boldCB;
350 wxCheckBox *m_italicCB;
351 wxCheckBox *m_slantedCB;
352 wxCheckBox *m_strikethroughCB;
353 wxCheckBox *m_underlinedCB;
354 wxCheckBox *m_fixedFontInTC;
355 wxCheckBox *m_unixCopy;
356 wxCheckBox *m_changeAsterisk;
357 wxCheckBox *m_hidemultiplicationSign;
358 wxCheckBox *m_latin2Greek;
359 wxCheckBox *m_useUnicodeMaths;
360 wxCheckBox *m_keepPercentWithSpecials;
361 wxBookCtrlBase *m_notebook;
362 wxButton *m_saveStyle, *m_loadStyle;
363 wxSpinCtrl *m_defaultPort;
364 ExamplePanel *m_examplePanel;
365 wxSpinCtrl *m_maxGnuplotMegabytes;
366 wxSpinCtrl *m_autosaveMinutes;
367 wxSpinCtrl *m_maxLayoutTime;
368 wxTextCtrl *m_autoMathJaxURL;
369 int m_maximaEmvRightClickRow = 0;
370
372 void UsesvgChanged(wxCommandEvent &event);
373
375 void OnClose(wxCloseEvent &event);
376
377 void OnwxMathMLBrowse(wxCommandEvent &event);
378
379 void OnIdle(wxIdleEvent &event);
380
382 void OnChangeStyle(wxCommandEvent &event);
383
385 void OnChangeWarning(wxCommandEvent &event);
386
388 void OnCheckbox(wxCommandEvent &event);
389
391 void UpdateExample();
392
394 void OnChangeFontFamily(wxCommandEvent &event);
395
397 void LoadSave(wxCommandEvent &event);
398
401
406
408#if wxCHECK_VERSION(3, 1, 6)
409 wxVector<wxBitmapBundle> m_imageList;
410#else
411 std::unique_ptr<wxImageList> m_imageList;
412#endif
413};
414
415#ifndef __WXMSW__
416
417#endif // __WXMSW__
418
419#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
This file defines the class Worksheet.
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:405
void OnCheckbox(wxCommandEvent &event)
Called if one of the checkboxes for bold, italic or underlined is toggled.
Definition: ConfigDialogue.cpp:2563
wxRadioButton * m_noAutodetectMathJaX
The radio button that is set if m_autodetectMathJaX is unset.
Definition: ConfigDialogue.h:260
wxCheckBox * m_exportContainsWXMX
A checkbox that asks if all newlines in text cells have to be passed to HTML.
Definition: ConfigDialogue.h:310
std::unique_ptr< wxImageList > m_imageList
A list containing the pictograms for the tabs.
Definition: ConfigDialogue.h:411
void OnStyleToEditChanged(wxCommandEvent &event)
Called if the user changes the style that is to be edited.
Definition: ConfigDialogue.cpp:2177
wxRadioButton * m_autodetectMathJaX
Autodetect the mathJaX location?
Definition: ConfigDialogue.h:258
wxRadioButton * m_autodetectMaxima
Autodetect the maxima location?
Definition: ConfigDialogue.h:247
void OnChangeWarning(wxCommandEvent &event)
A message dialog that appears if a change cannot be applied now.
Definition: ConfigDialogue.cpp:2580
void UpdateExample()
Sets the style example's style on style changes.
Definition: ConfigDialogue.cpp:2586
int m_fontSize
The size of the text font.
Definition: ConfigDialogue.h:403
wxCheckBox * m_usePartialForDiff
A checkbox that asks if TeX should use the \partial symbol for representing diff()
Definition: ConfigDialogue.h:308
void WriteSettings()
Stores the settings from the configuration dialog.
Definition: ConfigDialogue.cpp:2205
wxStaticText * m_mp
The text "Maxima Program" that can change color.
Definition: ConfigDialogue.h:244
wxColourPickerCtrl * m_styleColor
An example rectangle with the font color.
Definition: ConfigDialogue.h:348
wxChoice * m_appearanceChoice
Light / Dark / Follow-system selector (also picks which set the editor edits).
Definition: ConfigDialogue.h:345
void OnClose(wxCloseEvent &event)
Is called when the configuration dialog is closed.
Definition: ConfigDialogue.cpp:2194
wxString m_wxStartupFileName
The name of wxMaxima's startup file.
Definition: ConfigDialogue.h:242
wxTextCtrl * m_startupCommands
A textbox containing maxima's startup commands.
Definition: ConfigDialogue.h:273
void OnChangeStyle(wxCommandEvent &event)
Called if a new item type that is to be styled is selected.
Definition: ConfigDialogue.cpp:2427
TextStyle GetSelectedStyle() const
Get the style currently selected in the m_styleFor control.
Definition: ConfigDialogue.cpp:2006
void UsesvgChanged(wxCommandEvent &event)
Is called when the path to the maxima binary was changed.
Definition: ConfigDialogue.cpp:316
wxString m_startupFileName
The name of maxima's startup file.
Definition: ConfigDialogue.h:240
wxRadioButton * m_noAutodetectMaxima
The radio button that is set if m_autodetectMaxima is unset.
Definition: ConfigDialogue.h:249
wxTextCtrl * m_wxStartupCommands
A textbox containing wxMaxima's startup commands.
Definition: ConfigDialogue.h:275
htmlExportFormats
The export formats we support for HTML equations.
Definition: ConfigDialogue.h:95
~ConfigDialogue()
The destructor.
Definition: ConfigDialogue.cpp:304
void OnChangeFontFamily(wxCommandEvent &event)
Called if the font family is changed.
Definition: ConfigDialogue.cpp:2401
wxCheckBox * m_TeXExponentsAfterSubscript
A checkbox that asks if TeX should put the exponents above or after the subscripts.
Definition: ConfigDialogue.h:306
void OnAppearanceChanged(wxCommandEvent &event)
Light / Dark / Follow-system appearance changed: re-point the style editor.
Definition: ConfigDialogue.cpp:2183
void OnTabChange(wxBookCtrlEvent &event)
Called if the currently active dialogue sheet is changed.
Definition: ConfigDialogue.cpp:2606
void OnChangeColor(wxColourPickerEvent &event)
Called if the color of an item has been changed.
Definition: ConfigDialogue.cpp:2419
void LoadSave(wxCommandEvent &event)
A "export the configuration" dialog.
Definition: ConfigDialogue.cpp:2612
Text Style Definition.
Definition: TextStyle.h:63
The canvas that contains the spreadsheet the whole program is about.
Definition: Worksheet.h:116