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 { Connect(wxEVT_PAINT, wxPaintEventHandler(ConfigDialogue::ExamplePanel::OnPaint)); };
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);
260
261 // begin wxGlade: ConfigDialogue::attributes
263 wxTextCtrl *m_startupCommands;
266 BinaryNameCtrl *m_maximaUserLocation;
267 BinaryNameCtrl *m_helpBrowserUserLocation;
268 wxTextCtrl *m_documentclass;
269 wxTextCtrl *m_documentclassOptions;
270 wxTextCtrl *m_texPreamble;
271 wxCheckBox *m_autoSave;
272 wxButton *m_wxMathMLBrowse;
273 wxTextCtrl *m_additionalParameters;
274 wxTextCtrl *m_mathJaxURL;
275 wxChoice *m_language;
276 wxTextCtrl *m_symbolPaneAdditionalChars;
277 wxCheckBox *m_abortOnError;
278 wxCheckBox *m_offerKnownAnswers;
279 wxCheckBox *m_restartOnReEvaluation;
280 wxCheckBox *m_wrapLatexMath;
281 wxCheckBox *m_usesvg;
282 wxCheckBox *m_antialiasLines;
283 wxSpinCtrl *m_defaultFramerate;
284 wxSpinCtrl *m_defaultPlotWidth;
285 wxSpinCtrl *m_defaultPlotHeight;
286 wxSpinCtrl *m_displayedDigits;
287 wxSpinCtrl *m_printMargin_Top;
288 wxSpinCtrl *m_printMargin_Bot;
289 wxSpinCtrl *m_printMargin_Left;
290 wxSpinCtrl *m_printMargin_Right;
291 wxRadioButton *m_displayNDigits;
292 wxRadioButton *m_displayAllDigits;
293 wxRadioButton *m_linebreaksInLongNums;
294 wxSpinCtrl *m_maxClipbrdBitmapMegabytes;
301 wxCheckBox *m_printBrackets;
302 wxChoice *m_exportWithMathJAX;
303 wxCheckBox *m_matchParens;
304 wxCheckBox *m_showMatchingParens;
305 wxChoice *m_showLength;
306 wxChoice *m_autosubscript;
307 wxRadioButton *m_enterEvaluates;
308 wxRadioButton *m_ctrlEnterEvaluates;
309 wxCheckBox *m_numpadEnterEvaluates;
310 wxCheckBox *m_saveImgFileName;
311 wxCheckBox *m_saveUntitled;
312 wxCheckBox *m_openHCaret;
313 wxCheckBox *m_insertAns;
314 wxCheckBox *m_autoIndent;
315 wxCheckBox *m_cursorJump;
316 wxCheckBox *m_hideBrackets;
317 wxCheckBox *m_indentMaths;
318 wxChoice *m_autoWrap;
319 wxSpinCtrl *m_labelWidth;
320 wxSpinCtrl *m_undoLimit;
321 wxSpinCtrl *m_recentItems;
322 wxSpinCtrl *m_bitmapScale;
323 wxSpinCtrlDouble *m_printScale;
324 wxCheckBox *m_fixReorderedIndices;
325 wxCheckBox *m_incrementalSearch;
326 wxCheckBox *m_notifyIfIdle;
327 wxChoice *m_showUserDefinedLabels;
328 wxButton *m_getStyleFont;
329 wxListBox *m_styleFor;
331 wxColourPickerCtrl *m_styleColor;
332 wxCheckBox *m_boldCB;
333 wxCheckBox *m_italicCB;
334 wxCheckBox *m_slantedCB;
335 wxCheckBox *m_strikethroughCB;
336 wxCheckBox *m_underlinedCB;
337 wxCheckBox *m_fixedFontInTC;
338 wxCheckBox *m_unixCopy;
339 wxCheckBox *m_changeAsterisk;
340 wxCheckBox *m_hidemultiplicationSign;
341 wxCheckBox *m_latin2Greek;
342 wxCheckBox *m_useUnicodeMaths;
343 wxCheckBox *m_keepPercentWithSpecials;
344 wxBookCtrlBase *m_notebook;
345 wxButton *m_saveStyle, *m_loadStyle;
346 wxSpinCtrl *m_defaultPort;
347 ExamplePanel *m_examplePanel;
348 wxSpinCtrl *m_maxGnuplotMegabytes;
349 wxSpinCtrl *m_autosaveMinutes;
350 wxTextCtrl *m_autoMathJaxURL;
351 int m_maximaEmvRightClickRow = 0;
352
354 void UsesvgChanged(wxCommandEvent &event);
355
357 void OnClose(wxCloseEvent &event);
358
359 void OnwxMathMLBrowse(wxCommandEvent &event);
360
361 void OnIdle(wxIdleEvent &event);
362
364 void OnChangeStyle(wxCommandEvent &event);
365
367 void OnChangeWarning(wxCommandEvent &event);
368
370 void OnCheckbox(wxCommandEvent &event);
371
373 void UpdateExample();
374
376 void OnChangeFontFamily(wxCommandEvent &event);
377
379 void LoadSave(wxCommandEvent &event);
380
383
388
390 std::unique_ptr<wxImageList> m_imageList;
391};
392
393#ifndef __WXMSW__
394
395#endif // __WXMSW__
396
397#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:387
void OnCheckbox(wxCommandEvent &event)
Called if one of the checkboxes for bold, italic or underlined is toggled.
Definition: ConfigDialogue.cpp:2422
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:300
std::unique_ptr< wxImageList > m_imageList
A list containing the pictograms for the tabs.
Definition: ConfigDialogue.h:390
void OnStyleToEditChanged(wxCommandEvent &event)
Called if the user changes the style that is to be edited.
Definition: ConfigDialogue.cpp:2068
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:2439
void UpdateExample()
Sets the style example's style on style changes.
Definition: ConfigDialogue.cpp:2445
int m_fontSize
The size of the text font.
Definition: ConfigDialogue.h:385
wxCheckBox * m_usePartialForDiff
A checkbox that asks if TeX should use the \partial symbol for representing diff()
Definition: ConfigDialogue.h:298
void WriteSettings()
Stores the settings from the configuration dialog.
Definition: ConfigDialogue.cpp:2085
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:331
void OnClose(wxCloseEvent &event)
Is called when the configuration dialog is closed.
Definition: ConfigDialogue.cpp:2074
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:263
void OnChangeStyle(wxCommandEvent &event)
Called if a new item type that is to be styled is selected.
Definition: ConfigDialogue.cpp:2286
TextStyle GetSelectedStyle() const
Get the style currently selected in the m_styleFor control.
Definition: ConfigDialogue.cpp:1915
void UsesvgChanged(wxCommandEvent &event)
Is called when the path to the maxima binary was changed.
Definition: ConfigDialogue.cpp:282
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:265
htmlExportFormats
The export formats we support for HTML equations.
Definition: ConfigDialogue.h:95
~ConfigDialogue()
The destructor.
Definition: ConfigDialogue.cpp:280
void OnChangeFontFamily(wxCommandEvent &event)
Called if the font family is changed.
Definition: ConfigDialogue.cpp:2260
wxCheckBox * m_TeXExponentsAfterSubscript
A checkbox that asks if TeX should put the exponents above or after the subscripts.
Definition: ConfigDialogue.h:296
void OnTabChange(wxBookCtrlEvent &event)
Called if the currently active dialogue sheet is changed.
Definition: ConfigDialogue.cpp:2465
void OnChangeColor(wxColourPickerEvent &event)
Called if the color of an item has been changed.
Definition: ConfigDialogue.cpp:2278
void LoadSave(wxCommandEvent &event)
A "export the configuration" dialog.
Definition: ConfigDialogue.cpp:2471
Text Style Definition.
Definition: TextStyle.h:63
The canvas that contains the spreadsheet the whole program is about.
Definition: Worksheet.h:95