wxMaxima
Configuration.h
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 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //
20 // SPDX-License-Identifier: GPL-2.0+
21 
22 #ifndef CONFIGURATION_H
23 #define CONFIGURATION_H
24 
25 #include "precomp.h"
26 #include <wx/wx.h>
27 #include <wx/config.h>
28 #include <wx/display.h>
29 #include <wx/fontenum.h>
30 #include <wx/hashmap.h>
31 #include "LoggingMessageDialog.h"
32 #include "TextStyle.h"
33 #include <memory>
34 #include <unordered_map>
35 #include <vector>
36 
37 #define MC_LINE_SKIP Scale_Px(2)
38 #define MC_TEXT_PADDING Scale_Px(1)
39 
40 #define PAREN_OPEN_TOP_UNICODE "\u239b"
41 #define PAREN_OPEN_EXTEND_UNICODE "\u239c"
42 #define PAREN_OPEN_BOTTOM_UNICODE "\u239d"
43 #define PAREN_CLOSE_TOP_UNICODE "\u239e"
44 #define PAREN_CLOSE_EXTEND_UNICODE "\u239f"
45 #define PAREN_CLOSE_BOTTOM_UNICODE "\u23a0"
46 #define SUM_SIGN "\u2211"
47 #define PROD_SIGN "\u220F"
48 #define SUM_DEC 2
49 
51 #define MC_HCARET_WIDTH 25
52 
53 #define MC_EXP_INDENT 2
54 static constexpr AFontSize MC_MIN_SIZE{ 6.0f };
55 static constexpr AFontSize MC_MAX_SIZE{ 48.0f };
56 
57 #define LIBERTINE1 "LinLibertine_DRah.ttf"
58 #define LIBERTINE2 "LinLibertine_I.ttf"
59 #define LIBERTINE3 "LinLibertine_Mah.ttf"
60 #define LIBERTINE4 "LinLibertine_Rah.ttf"
61 #define LIBERTINE5 "LinLibertine_RBah.ttf"
62 #define LIBERTINE6 "LinLibertine_RBIah.ttf"
63 #define LIBERTINE7 "LinLibertine_RIah.ttf"
64 #define LIBERTINE8 "LinLibertine_RZah.ttf"
65 #define LIBERTINE9 "LinLibertine_RZIah.ttf"
66 
67 class Cell;
68 
84 {
85 public:
88  {
89  mathJaX_TeX = 0,
90  bitmap = 1,
91  mathML_mathJaX = 2,
92  svg = 3
93  };
94 
95  enum showLabels : int8_t
96  {
97  labels_automatic = 0,
98  labels_prefer_user = 1,
99  labels_useronly = 2,
100  labels_none = 3
101  };
102 
103  enum drawMode
104  {
110  unknown
111  };
112 
113  enum InitOpt
114  {
115  none,
117  };
118 
119  enum mathDisplayMode
120  {
121  display_2d,
122  display_2dASCII,
123  display_1dASCII
124  };
125 
126  WX_DECLARE_STRING_HASH_MAP(int, StringHash);
129  StringHash m_maximaOperators;
130 
131  const wxEnvVariableHashMap& MaximaEnvVars(){return m_maximaEnvVars;}
132  wxEnvVariableHashMap m_maximaEnvVars;
133 
134  mathDisplayMode DisplayMode(){return m_displayMode;}
135  void DisplayMode(mathDisplayMode mode ){m_displayMode = mode;}
136 
138  void SetWorkingDirectory(wxString dir)
139  { m_workingdir = dir; }
140 
141  wxString GetWorkingDirectory() const
142  { return m_workingdir; }
143 
144  void ReadConfig();
145 
150  explicit Configuration(wxDC *dc = {}, InitOpt options = {});
151 
152  void ResetAllToDefaults(InitOpt options = {});
153 
155  void SetContext(wxDC &dc)
156  {
157  m_dc = &dc;
158  m_antialiassingDC = NULL;
159  }
160  void UnsetContext() {m_dc = NULL;}
161 
162  void SetBackgroundBrush(wxBrush brush);
163  bool FixedFontInTextControls(){return m_fixedFontTC;}
164  void FixedFontInTextControls(bool fixed){m_fixedFontTC = fixed;}
165  wxBrush GetBackgroundBrush() const {return m_BackgroundBrush;}
166  wxBrush GetTooltipBrush() const {return m_tooltipBrush;}
167  void SetAntialiassingDC(wxDC &antialiassingDC)
168  {m_antialiassingDC = &antialiassingDC;}
169 
170  void UnsetAntialiassingDC()
171  {m_antialiassingDC = NULL;}
172 
173  ~Configuration();
174 
175  static wxString m_maximaLocation_override;
176  static wxString m_configfileLocation_override;
177 
178  using EscCodeContainer = std::unordered_map<wxString, wxString, wxStringHash>;
179  using EscCodeIterator = EscCodeContainer::const_iterator;
180 
182  static const wxString &GetEscCode(const wxString &key);
184  static EscCodeIterator EscCodesBegin();
185  static EscCodeIterator EscCodesEnd();
186 
187  static double GetMinZoomFactor()
188  { return 0.1; }
189 
190  static double GetMaxZoomFactor()
191  { return 32.0; }
192 
199  double GetInterEquationSkip() const
200  {
201  if (ShowAutomaticLabels())
202  return 0;
203  else
204  return GetZoomFactor() * m_styles[TS_MATH].GetFontSize() / 2;
205  }
206 
207  long GetCellBracketWidth() const
208  {
209  return (int) (GetZoomFactor() * 16);
210  }
211 
213  bool HideBrackets() const
214  { return m_hideBrackets; }
215 
217  void HideBrackets(bool hide){m_hideBrackets = hide;}
218 
220  double PrintScale() const
221  { return m_printScale; }
222 
224  void PrintScale(double scale){m_printScale = scale;}
225 
227  void SetZoomFactor(double newzoom);
228 
230  void SetZoomFactor_temporarily(double newzoom){
231  m_zoomFactor = newzoom;
232  }
233 
238  long Scale_Px(double px) const;
239  AFontSize Scale_Px(AFontSize size) const;
240 
242  double GetZoomFactor() const
243  { return m_zoomFactor; }
244 
246  wxDC *GetDC()
247  { return m_dc; }
248 
251  {
252  if ((m_antialiassingDC != NULL) && m_antiAliasLines)
253  return m_antialiassingDC;
254  else
255  return m_dc;
256  }
257 
258  AFontName GetFontName(TextStyle ts = TS_DEFAULT) const;
259 
260  // cppcheck-suppress functionStatic
261  // cppcheck-suppress functionConst
262  AFontName GetSymbolFontName() const;
263 
264  wxFontWeight IsBold(long st) const;
265 
266  wxFontStyle IsItalic(long st) const;
267 
268  bool IsUnderlined(long st) const {return m_styles[st].IsUnderlined();}
269 
270  long GetLabelWidth() const
271  { return m_labelWidth * 14; }
272 
273  long LabelWidth() const
274  { return m_labelWidth; }
275  void LabelWidth(long labelWidth)
276  { m_labelWidth = labelWidth; }
277 
279  long GetIndent() const
280  {
281  if (m_indent < 0)
282  return 3 * GetCellBracketWidth() / 2;
283  else
284  return m_indent;
285  }
286 
287  void SetPPI(wxSize ppi){m_ppi = ppi;}
293  wxSize GetPPI() const;
294  int AutosaveMinutes(){return m_autoSaveMinutes;}
295  void AutosaveMinutes(int minutes){m_autoSaveMinutes = minutes;}
296 
298  long GetCursorWidth() const
299  {
300  long ppi;
301 
302  if(!m_printing)
303  ppi = GetPPI().x;
304  else
305  ppi = 96;
306 
307  if (ppi / 45 < 1)
308  return 1;
309  else
310  return ppi / 45;
311  }
312 
314  long GetBaseIndent() const
315  {
316  if (GetCursorWidth() < 12)
317  return 12;
318  else
319  return 4 + GetCursorWidth();
320  }
321 
323  long GetGroupSkip() const
324  {
325  if (GetCursorWidth() < 10)
326  return 20;
327  else
328  return 10 + GetCursorWidth();
329  }
330 
335  void SetIndent(long indent)
336  {
337  m_indent = indent;
338  }
339 
341  void SetClientWidth(long width)
342  {
343  m_clientWidth = width;
344  }
345 
346  bool IncrementalSearch() const {return m_incrementalSearch;}
347 
348 
349  void IncrementalSearch(bool incrementalSearch) { m_incrementalSearch = incrementalSearch; }
350 
351  struct CharsExist {
352  wxString chars;
353  bool exist;
354  CharsExist(const wxString &chars, bool exist) : chars(chars), exist(exist) {}
355  };
356  std::vector<CharsExist> m_charsInFont;
357 
359  void FontChanged()
360  {
361  m_charsInFont.clear();
362  }
363 
365  void SetClientHeight(long height)
366  { m_clientHeight = height; }
367 
369  long GetClientWidth() const
370  { return m_clientWidth; }
371 
373  long GetClientHeight() const
374  { return m_clientHeight; }
375 
377  double GetDefaultLineWidth() const
378  {
379  if (GetZoomFactor() < 1.0)
380  return 1.0;
381  else
382  return GetZoomFactor();
383  }
384 
386  long LineWidth_em() const
387  {
388  if(!m_printing)
389  return m_lineWidth_em;
390  else
391  return 10000;
392  }
393 
394  bool AutoSaveAsTempFile() const {return m_autoSaveAsTempFile;}
395  void AutoSaveAsTempFile(bool asTempFile){m_autoSaveAsTempFile = asTempFile;}
396 
398  void LineWidth_em(long width)
399  { m_lineWidth_em = width; }
400 
402  // On big 16:9 screens text tends to get \b very wide before it hits the right margin.
403  // But text blocks that are 1 meter wide and 2 cm high feel - weird.
404  long GetLineWidth() const;
405 
406  bool SaveUntitled(){ return m_saveUntitled;}
407  void SaveUntitled(bool save){m_saveUntitled = save;}
408 
409  bool CursorJump(){ return m_cursorJump;}
410  void CursorJump(bool save){m_cursorJump = save;}
411 
412  bool NumpadEnterEvaluates(){ return m_numpadEnterEvaluates;}
413  void NumpadEnterEvaluates(bool eval){m_numpadEnterEvaluates = eval;}
414 
415  bool SaveImgFileName() { return m_saveImgFileName;}
416  void SaveImgFileName(bool save) { m_saveImgFileName = save;}
417 
419  bool GetAutoWrap() const
420  { return m_autoWrap > 0; }
421 
422  // cppcheck-suppress functionStatic
424  bool GetAutoWrapCode() const
425  { return false; }
426 
433  void SetAutoWrap(long autoWrap){m_autoWrap = autoWrap;}
434 
436  bool GetAutoIndent() const
437  { return m_autoIndent; }
438 
439  void SetAutoIndent(bool autoIndent){m_autoIndent = autoIndent;}
440 
442  bool IndentMaths() const {return m_indentMaths;}
443  void IndentMaths(bool indent){m_indentMaths=indent;}
444  AFontSize GetFontSize(TextStyle st) const
445  {
446  if (st == TS_TEXT || st == TS_HEADING5 || st == TS_HEADING6 || st == TS_SUBSUBSECTION || st == TS_SUBSECTION || st == TS_SECTION || st == TS_TITLE)
447  return m_styles[st].GetFontSize();
448  return {};
449  }
450 
451  const wxString &GetStyleName(TextStyle textStyle) const;
452 
458  void ReadStyles(const wxString &file = {});
459 
464  void WriteStyles(const wxString &file = {});
465  void WriteStyles(wxConfigBase *config);
466  void WriteSettings(const wxString &file = {});
467 
468  void Outdated(bool outdated)
469  { m_outdated = outdated; }
470 
471  bool CheckTeXFonts() const
472  { return m_TeXFonts; }
473 
474  void CheckTeXFonts(bool check)
475  { m_TeXFonts = check; }
476 
477  bool CheckKeepPercent() const
478  { return m_keepPercent; }
479 
480  void SetKeepPercent(bool keepPercent)
481  { m_keepPercent = keepPercent; }
482 
483  AFontName GetTeXCMRI() const
484  { return m_fontCMRI; }
485 
486  AFontName GetTeXCMSY() const
487  { return m_fontCMSY; }
488 
489  AFontName GetTeXCMEX() const
490  { return m_fontCMEX; }
491 
492  AFontName GetTeXCMMI() const
493  { return m_fontCMMI; }
494 
495  AFontName GetTeXCMTI() const
496  { return m_fontCMTI; }
497 
498  bool ShowCodeCells() const
499  { return m_showCodeCells; }
500 
501  void ShowCodeCells(bool show);
502 
509  void SetPrinting(bool printing);
510 
517  bool GetPrinting() const
518  { return m_printing; }
519 
521  wxColour GetColor(TextStyle style);
522 
524  wxColour InvertColour(wxColour col);
525 
530  wxColor MakeColorDifferFromBackground(wxColor color);
531 
532  bool UsePngCairo() const { return m_usepngCairo;}
533  void UsePngCairo(bool usepngCairo) { m_usepngCairo = usepngCairo;}
534 
535  bool GetMatchParens() const { return m_matchParens; }
536  void SetMatchParens(bool matchParens) { m_matchParens = matchParens; }
537  bool ShowMatchingParens() const { return m_showMatchingParens; }
538  void ShowMatchingParens(bool show) { m_showMatchingParens = show; }
539 
540  bool GetChangeAsterisk() const{ return m_changeAsterisk; }
541 
542  void SetChangeAsterisk(bool changeAsterisk) {m_changeAsterisk = changeAsterisk;}
543 
544  bool HidemultiplicationSign() const {return m_hidemultiplicationsign;}
545 
546  void HidemultiplicationSign(bool show) {m_hidemultiplicationsign = show;}
547 
548  bool Latin2Greek() const
549  {return m_latin2greek;}
550 
551  void Latin2Greek(bool latin2greek) {m_latin2greek = latin2greek;}
552 
553  bool GreekSidebar_ShowLatinLookalikes() const {return m_greekSidebar_ShowLatinLookalikes;}
554  void GreekSidebar_ShowLatinLookalikes(bool show){m_greekSidebar_ShowLatinLookalikes = show;}
555 
556  bool GreekSidebar_Show_mu() const {return m_greekSidebar_Show_mu;}
557  void GreekSidebar_Show_mu(bool show) {m_greekSidebar_Show_mu = show;}
558 
559  wxString SymbolPaneAdditionalChars() const
560  {return m_symbolPaneAdditionalChars;}
561  void SymbolPaneAdditionalChars(wxString symbols) {m_symbolPaneAdditionalChars = symbols;}
562 
564  bool NotifyIfIdle() const
565  { return m_notifyIfIdle; }
566 
567  void NotifyIfIdle(bool notify) {m_notifyIfIdle = notify;}
568 
573  long GetDisplayedDigits() const
574  { return m_displayedDigits; }
575 
576  void SetDisplayedDigits(long displayedDigits)
577  {
578  wxASSERT_MSG(displayedDigits >= 0, _("Bug: Maximum number of digits that is to be displayed is too low!"));
579  m_displayedDigits = displayedDigits;
580  }
581 
582  wxRect GetUpdateRegion() const {return m_updateRegion;}
583  void SetUpdateRegion(wxRect rect){m_updateRegion = rect;}
584 
587  bool InUpdateRegion(wxRect rect) const;
588 
589  bool GetInsertAns() const
590  { return m_insertAns; }
591 
592  void SetInsertAns(bool insertAns){ m_insertAns = insertAns; }
593 
594  bool GetOpenHCaret() const
595  { return m_openHCaret; }
596 
597  void SetOpenHCaret(bool openHCaret){ m_openHCaret = openHCaret; }
598 
599  bool RestartOnReEvaluation() const
600  { return m_restartOnReEvaluation; }
601 
602  void RestartOnReEvaluation(bool arg){ m_restartOnReEvaluation = arg; }
603 
605  wxSize GetCanvasSize() const
606  { return m_canvasSize; }
607 
609  void SetCanvasSize(wxSize siz)
610  { m_canvasSize = siz; }
611 
613  bool ShowBrackets() const
614  { return m_showBrackets; }
615 
616  bool ShowBrackets(bool show)
617  { return m_showBrackets = show; }
618 
620  bool PrintBrackets() const
621  { return m_printBrackets; }
622 
623  showLabels GetLabelChoice() const
624  { return m_showLabelChoice; }
625 
626  bool InvertBackground(){return m_invertBackground;}
627  void InvertBackground(bool invert){ m_invertBackground = invert; }
628 
629  long UndoLimit(){return wxMax(m_undoLimit, 0);}
630  void UndoLimit(long limit){ m_undoLimit = limit; }
631 
632  long RecentItems(){return wxMax(m_recentItems, 0);}
633  void RecentItems(long items){ m_recentItems = items; }
634 
636  bool ShowAutomaticLabels() const
637  { return (m_showLabelChoice < labels_useronly); }
638 
640  bool UseUserLabels() const
641  { return m_showLabelChoice > labels_automatic; }
642 
644  bool ShowLabels() const
645  { return m_showLabelChoice < labels_none; }
646 
648  void SetLabelChoice(showLabels choice) { m_showLabelChoice = choice; }
649 
650  bool PrintBrackets(bool print)
651  {
652  m_printBrackets = print;
653  return print;
654  }
655 
657  bool AutodetectMaxima() const {return m_autodetectMaxima;}
659  void AutodetectMaxima(bool autodetectmaxima){m_autodetectMaxima = autodetectmaxima;}
660 
662  wxString MaximaParameters() const {return m_maximaParameters;}
664  void MaximaParameters(wxString parameters){m_maximaParameters = parameters;}
665 
667  static wxString MaximaDefaultLocation();
668 
670  wxString MaximaLocation() const;
671 
673  wxString MaximaUserLocation() const {return m_maximaUserLocation;}
674 
675  void OnMpBrowse(wxCommandEvent& event);
676 
678  void MaximaUserLocation(wxString maxima) { m_maximaUserLocation = maxima; }
679 
681  bool AutodetectHelpBrowser() const {return m_autodetectHelpBrowser;}
683  void AutodetectHelpBrowser(bool autodetect){m_autodetectHelpBrowser = autodetect;}
684 
686  wxString HelpBrowserUserLocation() const {return m_helpBrowserUserLocation;}
687 
689  void HelpBrowserUserLocation(wxString helpBrowser) { m_helpBrowserUserLocation = helpBrowser;}
690 
697  static bool MaximaFound(wxString location = wxEmptyString);
698 
700  bool FixReorderedIndices() const
701  { return m_fixReorderedIndices; }
702 
703  void FixReorderedIndices(bool fix) { m_fixReorderedIndices = fix;}
704 
706  wxString MathJaXURL() const {if(m_mathJaxURL_UseUser) return m_mathJaxURL; else return MathJaXURL_Auto();}
707  wxString MathJaXURL_User() const { return m_mathJaxURL;}
708  bool MathJaXURL_UseUser() const { return m_mathJaxURL_UseUser;}
709  void MathJaXURL_UseUser(bool useUser){m_mathJaxURL_UseUser = useUser;}
710 
711  bool WxMathML_UseFile() const { return m_wxMathML_UseFile;}
712  void WxMathML_UseFile(bool useFile){m_wxMathML_UseFile = useFile;}
713  wxString WxMathML_Filename() const { return m_wxMathML_Filename;}
714  void WxMathML_Filename(wxString name) { m_wxMathML_Filename = name;}
715  bool EnterEvaluates() const {return m_enterEvaluates;}
716  void EnterEvaluates(bool enterEvaluates) {m_enterEvaluates = enterEvaluates;}
717  static wxString MathJaXURL_Auto() { return wxT("https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js");}
719  void MathJaXURL(wxString url){m_mathJaxURL = url;}
720  bool AntiAliasLines() const {return m_antiAliasLines;}
721  void AntiAliasLines(bool antiAlias){ m_antiAliasLines = antiAlias; }
722 
723  bool CopyBitmap() const {return m_copyBitmap;}
724  void CopyBitmap(bool copyBitmap){ m_copyBitmap = copyBitmap; }
725 
726  bool CopyMathML() const {return m_copyMathML;}
727  void CopyMathML(bool copyMathML){ m_copyMathML = copyMathML;}
728  bool CopyMathMLHTML() const {return m_copyMathMLHTML;}
729  void CopyMathMLHTML(bool copyMathMLHTML){ m_copyMathMLHTML = copyMathMLHTML; }
730  bool HideMarkerForThisMessage(wxString message);
731  void HideMarkerForThisMessage(wxString message, bool hide)
732  {m_hideMarkerForThisMessage[message] = hide;}
733  bool CopyRTF() const {return m_copyRTF;}
734  void CopyRTF(bool copyRTF) { m_copyRTF = copyRTF; }
735  bool CopySVG() const {return m_copySVG;}
736  void CopySVG(bool copySVG) { m_copySVG = copySVG; }
737  bool CopyEMF() const {return m_copyEMF;}
738  void CopyEMF(bool copyEMF) { m_copyEMF = copyEMF; }
739  bool UseSVG(){return m_useSVG;}
740  void UseSVG(bool useSVG) { m_useSVG = useSVG ;}
741  void ShowLength(long length) { m_showLength = length; }
742  long ShowLength() const {return m_showLength;}
743  void LispType(wxString type) { m_lispType = type; }
744  wxString LispType() const {return m_lispType;}
745 
747  void SetParenthesisDrawMode(drawMode mode) { m_parenthesisDrawMode = mode; }
748 
749  void TocShowsSectionNumbers(bool showSectionNumbers) { m_TOCshowsSectionNumbers = showSectionNumbers; }
750 
751  bool TocShowsSectionNumbers() const {return m_TOCshowsSectionNumbers;}
752 
753  void UseUnicodeMaths(bool useunicodemaths)
754  { m_useUnicodeMaths = useunicodemaths; }
755  bool UseUnicodeMaths() const {return m_useUnicodeMaths;}
756 
757  drawMode GetParenthesisDrawMode();
758 
759  WX_DECLARE_STRING_HASH_MAP(bool, StringBoolHash);
760  StringBoolHash m_hideMarkerForThisMessage;
761 
768  Style GetStyle(TextStyle textStyle, AFontSize fontSize) const;
769 
771  wxWindow *GetWorkSheet() const {return m_workSheet;}
773  inline void SetWorkSheet(wxWindow *workSheet);
774 
775  long DefaultPort() const {return m_defaultPort;}
776  void DefaultPort(long port){m_defaultPort = port;}
777  bool GetAbortOnError() const {return m_abortOnError;}
778  void SetAbortOnError(bool abortOnError) {m_abortOnError = abortOnError;}
779 
780  long GetLanguage() const {return m_language;}
781  void SetLanguage(long language) {m_language = language;}
782 
784  long MaxGnuplotMegabytes() const {return m_maxGnuplotMegabytes;}
785  void MaxGnuplotMegabytes(long megaBytes)
786  {m_maxGnuplotMegabytes = megaBytes;}
787 
788  bool OfferKnownAnswers() const {return m_offerKnownAnswers;}
789  void OfferKnownAnswers(bool offerKnownAnswers)
790  {m_offerKnownAnswers = offerKnownAnswers;}
791 
792  wxString Documentclass() const {return m_documentclass;}
793  void Documentclass(wxString clss){m_documentclass = clss;}
794 wxString DocumentclassOptions() const {return m_documentclassOptions;}
795  void DocumentclassOptions(wxString classOptions){m_documentclassOptions = classOptions;}
796 
797 
798  htmlExportFormat HTMLequationFormat() const {return m_htmlEquationFormat;}
799  void HTMLequationFormat(htmlExportFormat HTMLequationFormat)
800  {m_htmlEquationFormat = HTMLequationFormat;}
801 
802  AFontSize GetDefaultFontSize() const { return m_styles[TS_DEFAULT].GetFontSize(); }
803  AFontSize GetMathFontSize() const { return m_styles[TS_MATH].GetFontSize(); }
804 
806  long GetAutosubscript_Num() const {return m_autoSubscript;}
807  void SetAutosubscript_Num(long autosubscriptnum) {m_autoSubscript = autosubscriptnum;}
808  wxString GetAutosubscript_string() const;
810  wxColor DefaultBackgroundColor();
812  wxColor EditorBackgroundColor();
814  bool ClipToDrawRegion() const {return m_clipToDrawRegion;}
816  void ClipToDrawRegion(bool clipToDrawRegion){m_clipToDrawRegion = clipToDrawRegion; m_forceUpdate = true;}
818  void AdjustWorksheetSize(bool adjust)
819  { m_adjustWorksheetSizeNeeded = adjust; }
820  bool AdjustWorksheetSize() const
821  { return m_adjustWorksheetSizeNeeded; }
822  void SetVisibleRegion(wxRect visibleRegion){m_visibleRegion = visibleRegion;}
823  wxRect GetVisibleRegion() const {return m_visibleRegion;}
824  void SetWorksheetPosition(wxPoint worksheetPosition){m_worksheetPosition = worksheetPosition;}
825  wxPoint GetWorksheetPosition() const {return m_worksheetPosition;}
826  wxString MaximaShareDir() const {return m_maximaShareDir;}
827  void MaximaShareDir(wxString dir){m_maximaShareDir = dir;}
828  void InLispMode(bool lisp){m_inLispMode = lisp;}
829  bool InLispMode() const {return m_inLispMode;}
830  void BitmapScale(int factor){m_bitmapScale = factor;}
831  int BitmapScale() const {return m_bitmapScale;}
832  void DefaultPlotHeight(int px){m_defaultPlotHeight = px;}
833  int DefaultPlotHeight() const {return m_defaultPlotHeight;}
834  void DefaultPlotWidth(int px){m_defaultPlotWidth = px;}
835  int DefaultPlotWidth() const {return m_defaultPlotWidth;}
836  void DefaultFramerate(int fps){m_defaultFramerate = fps;}
837  int DefaultFramerate() const {return m_defaultFramerate;}
838  void TocDepth(int depth){m_tocDepth = depth;}
839  int TocDepth() const {return m_tocDepth;}
840  bool TeXExponentsAfterSubscript() const {return m_TeXExponentsAfterSubscript;}
841  void TeXExponentsAfterSubscript(bool ExponentsAfterSubscript)
842  {m_TeXExponentsAfterSubscript = ExponentsAfterSubscript;}
843  bool UsePartialForDiff() const {return m_usePartialForDiff;}
844  void UsePartialForDiff(bool usePartialForDiff)
845  {m_usePartialForDiff = usePartialForDiff;}
846  void NotifyOfCellRedraw(const Cell *cell);
847  void ClearAndEnableRedrawTracing();
848  void ReportMultipleRedraws();
849 
850  bool WrapLatexMath() const {return m_wrapLatexMath;}
851  void WrapLatexMath(bool wrapLatexMath){m_wrapLatexMath = wrapLatexMath;}
852  bool ShowAllDigits() const {return m_showAllDigits;}
853  void ShowAllDigits(bool shw){m_showAllDigits = shw;}
854  bool LineBreaksInLongNums() const {return m_lineBreaksInLongNums;}
855  void LineBreaksInLongNums(bool brk){m_lineBreaksInLongNums = brk;}
856  int MaxClipbrdBitmapMegabytes() const {return m_maxClipbrd_BitmapMegabytes;}
857  void MaxClipbrdBitmapMegabytes(int maxClipbrd_BitmapMegabytes)
858  {m_maxClipbrd_BitmapMegabytes = maxClipbrd_BitmapMegabytes;}
859 
860  void ExportContainsWXMX(bool exportContainsWXMX){m_exportContainsWXMX = exportContainsWXMX;}
861  bool ExportContainsWXMX() const {return m_exportContainsWXMX;}
862  wxString TexPreamble() const {return m_texPreamble;}
863  void TexPreamble(wxString texPreamble) {m_texPreamble = texPreamble;}
864 
865  Style m_styles[NUMBEROFSTYLES];
867  void InitStyles();
868 private:
870  wxSize m_ppi = wxSize(-1, -1);
871  mathDisplayMode m_displayMode = display_2d;
872  using CellRedrawTrace = std::vector<const Cell*>;
873  bool m_usePartialForDiff;
875  bool m_autoSaveAsTempFile;
877  long m_language;
879  bool m_autodetectMaxima;
881  bool m_autodetectHelpBrowser;
883  wxRect m_updateRegion;
885  bool m_incrementalSearch;
887  long m_autoSubscript;
889  wxWindow *m_workSheet = NULL;
902  bool CharsExistInFont(const wxFont &font, const wxString& chars);
904  bool m_wrapLatexMath;
905  bool m_exportContainsWXMX;
906  wxString m_texPreamble;
907 
908  drawMode m_parenthesisDrawMode;
909  wxString m_workingdir;
910  bool m_TeXExponentsAfterSubscript;
911  wxString m_helpBrowserUserLocation;
912  wxString m_maximaUserLocation;
914  bool m_hideBrackets;
916  double m_printScale;
918  wxSize m_canvasSize;
920  bool m_showBrackets;
922  bool m_printBrackets;
928  bool m_changeAsterisk;
930  bool m_notifyIfIdle;
932  long m_displayedDigits;
934  long m_autoWrap;
936  bool m_autoIndent;
938  bool m_showAllDigits;
940  bool m_lineBreaksInLongNums;
942  bool m_matchParens;
944  bool m_insertAns;
946  bool m_openHCaret;
948  long m_labelWidth;
949  long m_indent;
950  bool m_latin2greek;
951  bool m_antiAliasLines;
952  double m_zoomFactor;
953  wxDC *m_dc;
954  wxDC *m_antialiassingDC;
955  wxString m_maximaShareDir;
956  bool m_forceUpdate;
957  bool m_clipToDrawRegion;
958  bool m_outdated;
959  wxString m_maximaParameters;
960  bool m_TeXFonts;
961  bool m_keepPercent;
962  bool m_restartOnReEvaluation;
963  AFontName m_fontCMRI, m_fontCMSY, m_fontCMEX, m_fontCMMI, m_fontCMTI;
964  long m_clientWidth;
965  long m_clientHeight;
966  bool m_printing;
967  long m_lineWidth_em;
968  showLabels m_showLabelChoice;
969  bool m_fixReorderedIndices;
970  wxString m_mathJaxURL;
971  bool m_mathJaxURL_UseUser;
972  bool m_showCodeCells;
973  bool m_copyBitmap;
974  bool m_copyMathML;
975  bool m_copyMathMLHTML;
976  long m_showLength;
978  bool m_inLispMode;
979  bool m_usepngCairo;
980  bool m_enterEvaluates;
981  bool m_useSVG;
982  bool m_fixedFontTC;
983  bool m_copyRTF;
984  bool m_copySVG;
985  bool m_copyEMF;
986  bool m_TOCshowsSectionNumbers;
987  bool m_useUnicodeMaths;
988  bool m_indentMaths;
989  bool m_abortOnError;
990  bool m_showMatchingParens;
991  bool m_hidemultiplicationsign;
992  bool m_offerKnownAnswers;
993  long m_defaultPort;
994  long m_maxGnuplotMegabytes;
995  long m_defaultPlotHeight;
996  long m_defaultPlotWidth;
997  bool m_saveUntitled;
998  bool m_cursorJump;
999  bool m_numpadEnterEvaluates;
1000  bool m_saveImgFileName;
1001  std::unique_ptr<CellRedrawTrace> m_cellRedrawTrace;
1002  wxString m_documentclass;
1003  wxString m_documentclassOptions;
1004  htmlExportFormat m_htmlEquationFormat;
1005  bool m_adjustWorksheetSizeNeeded;
1007  wxRect m_visibleRegion;
1009  wxPoint m_worksheetPosition;
1010 
1011  wxColour m_defaultBackgroundColor;
1013  wxBrush m_BackgroundBrush;
1014  wxBrush m_tooltipBrush;
1015  bool m_greekSidebar_ShowLatinLookalikes;
1016  bool m_greekSidebar_Show_mu;
1017  wxString m_symbolPaneAdditionalChars;
1018  bool m_invertBackground;
1019  long m_undoLimit;
1020  long m_recentItems;
1021  wxString m_lispType;
1022  int m_bitmapScale;
1023  int m_defaultFramerate;
1024  int m_tocDepth;
1025  int m_maxClipbrd_BitmapMegabytes;
1026  int m_autoSaveMinutes;
1027  wxString m_wxMathML_Filename;
1028  bool m_wxMathML_UseFile;
1029 };
1030 
1033 {
1034 public:
1035  explicit Printing(Configuration *configuration)
1036  {
1037  m_configuration = configuration;
1038  m_configuration->SetPrinting(true);
1039  m_configuration->ClipToDrawRegion(false);
1040  }
1041  ~Printing()
1042  {
1043  m_configuration->SetPrinting(false);
1044  m_configuration->ClipToDrawRegion(true);
1045  }
1046 private:
1047  Configuration * m_configuration;
1048 };
1049 
1052 {
1053 public:
1054  explicit NoClipToDrawRegion(Configuration *configuration)
1055  {
1056  m_configuration = configuration;
1057  m_configuration->ClipToDrawRegion(false);
1058  }
1060  {
1061  m_configuration->ClipToDrawRegion(true);
1062  }
1063 private:
1064  Configuration * m_configuration;
1065 };
1066 
1067 #endif // CONFIGURATION_H
Configuration::IndentMaths
bool IndentMaths() const
Do we want to indent all maths?
Definition: Configuration.h:442
Configuration::ClipToDrawRegion
bool ClipToDrawRegion() const
Do we want to save time by only redrawing the area currently shown on the screen?
Definition: Configuration.h:814
Configuration::MaximaLocation
wxString MaximaLocation() const
Returns the location of the maxima binary.
Definition: Configuration.cpp:1029
Configuration::SetAutoWrap
void SetAutoWrap(long autoWrap)
Definition: Configuration.h:433
Configuration::SetZoomFactor_temporarily
void SetZoomFactor_temporarily(double newzoom)
Sets the zoom factor without storing the new value in the config file/registry.
Definition: Configuration.h:230
Configuration::GetLineWidth
long GetLineWidth() const
Returns the maximum sensible width for a text line [in characters]:
Definition: Configuration.cpp:865
NUMBEROFSTYLES
@ NUMBEROFSTYLES
This is not a style, but its value tells us how many styles are defined.
Definition: TextStyle.h:349
Configuration::GetStyle
Style GetStyle(TextStyle textStyle, AFontSize fontSize) const
Definition: Configuration.cpp:752
Configuration::GetGroupSkip
long GetGroupSkip() const
The vertical space between GroupCells.
Definition: Configuration.h:323
Configuration::Configuration
Configuration(wxDC *dc={}, InitOpt options={})
Definition: Configuration.cpp:44
Configuration::GetCanvasSize
wxSize GetCanvasSize() const
Reads the size of the current worksheet's visible window. See SetCanvasSize.
Definition: Configuration.h:605
Configuration::MaximaParameters
wxString MaximaParameters() const
Parameters to the maxima binary.
Definition: Configuration.h:662
Configuration::FontChanged
void FontChanged()
Has a font changed?
Definition: Configuration.h:359
Configuration::GetClientWidth
long GetClientWidth() const
Returns the width of the visible portion of the worksheet.
Definition: Configuration.h:369
Printing
Sets the configuration's "printing" flag until this class is left.
Definition: Configuration.h:1032
Configuration::AdjustWorksheetSize
void AdjustWorksheetSize(bool adjust)
Request adjusting the worksheet size?
Definition: Configuration.h:818
Configuration::UseUserLabels
bool UseUserLabels() const
Do we want at all to show labels?
Definition: Configuration.h:640
Configuration::HideBrackets
bool HideBrackets() const
Hide brackets that are not under the pointer?
Definition: Configuration.h:213
TextStyle
TextStyle
Definition: TextStyle.h:307
Configuration::InUpdateRegion
bool InUpdateRegion(wxRect rect) const
Definition: Configuration.cpp:1302
Configuration::GetClientHeight
long GetClientHeight() const
Returns the height of the visible portion of the worksheet.
Definition: Configuration.h:373
Configuration::MathJaXURL
void MathJaXURL(wxString url)
Returns the URL MathJaX can be found at.
Definition: Configuration.h:719
Configuration::AutodetectMaxima
bool AutodetectMaxima() const
Autodetect maxima's location? (If false the user-specified location is used)
Definition: Configuration.h:657
Configuration::PrintScale
double PrintScale() const
Hide brackets that are not under the pointer?
Definition: Configuration.h:220
Configuration::Scale_Px
long Scale_Px(double px) const
Definition: Configuration.cpp:1272
Configuration::GetAutosubscript_Num
long GetAutosubscript_Num() const
Get the worksheet this configuration storage is valid for.
Definition: Configuration.h:806
Configuration::MaximaFound
static bool MaximaFound(wxString location=wxEmptyString)
Definition: Configuration.cpp:477
Configuration::MaximaParameters
void MaximaParameters(wxString parameters)
The parameters we pass to the maxima binary.
Definition: Configuration.h:664
Configuration::PrintBrackets
bool PrintBrackets() const
Prlong the cell brackets [displayed left to each group cell showing its extend]?
Definition: Configuration.h:620
Configuration::GetZoomFactor
double GetZoomFactor() const
Determines the zoom factor the worksheet is displayed at.
Definition: Configuration.h:242
AFontName
Definition: TextStyle.h:54
TextStyle.h
Configuration::GetAutoIndent
bool GetAutoIndent() const
Do we want automatic indentation?
Definition: Configuration.h:436
Configuration::GetAntialiassingDC
wxDC * GetAntialiassingDC()
Get a drawing context suitable for size calculations.
Definition: Configuration.h:250
Configuration::DefaultBackgroundColor
wxColor DefaultBackgroundColor()
Determine the default background color of the worksheet.
Definition: Configuration.cpp:787
Configuration::SetParenthesisDrawMode
void SetParenthesisDrawMode(drawMode mode)
Which way do we want to draw parenthesis?
Definition: Configuration.h:747
Configuration::ascii
@ ascii
Use ascii characters only.
Definition: Configuration.h:105
NoClipToDrawRegion
Clears the configuration's "Clip to draw region" flag until this class is left.
Definition: Configuration.h:1051
Configuration::temporary
@ temporary
This configuration is temporary and shouldn't redetect Maxima etc.
Definition: Configuration.h:116
Configuration::PrintScale
void PrintScale(double scale)
Define if we want to hide brackets that are not under the pointer.
Definition: Configuration.h:224
Configuration::MaximaUserLocation
wxString MaximaUserLocation() const
Returns the location of the maxima binary the user has selected.
Definition: Configuration.h:673
Configuration::WriteStyles
void WriteStyles(const wxString &file={})
Saves the style settings to a file.
Definition: Configuration.cpp:1430
Configuration::FixReorderedIndices
bool FixReorderedIndices() const
Renumber out-of-order cell labels on saving.
Definition: Configuration.h:700
Configuration::SetClientHeight
void SetClientHeight(long height)
Set the height of the visible window for GetClientHeight()
Definition: Configuration.h:365
Configuration::MaximaUserLocation
void MaximaUserLocation(wxString maxima)
Sets the location of the maxima binary.
Definition: Configuration.h:678
Style::GetFontSize
AFontSize GetFontSize() const
The size of this style's font, asserted to be valid.
Definition: TextStyle.cpp:209
Configuration::handdrawn
@ handdrawn
A parenthesis sign that was created using draw commands.
Definition: Configuration.h:109
Configuration::SetCanvasSize
void SetCanvasSize(wxSize siz)
Sets the size of the current worksheet's visible window.
Definition: Configuration.h:609
Configuration::SetWorkingDirectory
void SetWorkingDirectory(wxString dir)
Set maxima's working directory.
Definition: Configuration.h:138
Configuration::LineWidth_em
long LineWidth_em() const
The minimum sensible line width in widths of a letter.
Definition: Configuration.h:386
Configuration::MaxGnuplotMegabytes
long MaxGnuplotMegabytes() const
The maximum number of Megabytes of gnuplot sources we should store.
Definition: Configuration.h:784
Style
Definition: TextStyle.h:130
Configuration::GetWorkSheet
wxWindow * GetWorkSheet() const
Get the worksheet this configuration storage is valid for.
Definition: Configuration.h:771
Configuration::ReadStyles
void ReadStyles(const wxString &file={})
Definition: Configuration.cpp:1042
Configuration::GetAutoWrap
bool GetAutoWrap() const
Do we want to have automatic line breaks for text cells?
Definition: Configuration.h:419
Configuration::GetDC
wxDC * GetDC()
Get a drawing context suitable for size calculations.
Definition: Configuration.h:246
Cell
Definition: Cell.h:139
Configuration::SetClientWidth
void SetClientWidth(long width)
Set the width of the visible window for GetClientWidth()
Definition: Configuration.h:341
Configuration::GetCursorWidth
long GetCursorWidth() const
How much vertical space is to be left between two group cells?
Definition: Configuration.h:298
Configuration::InitStyles
void InitStyles()
Initialize the text styles on construction.
Definition: Configuration.cpp:367
Configuration::NotifyIfIdle
bool NotifyIfIdle() const
Notify the user if maxima is idle?
Definition: Configuration.h:564
Configuration::m_maximaOperators
StringHash m_maximaOperators
Definition: Configuration.h:129
Configuration::GetAutoWrapCode
bool GetAutoWrapCode() const
Do we want to have automatic line breaks for code cells?
Definition: Configuration.h:424
Configuration::CharsExist
Definition: Configuration.h:351
Configuration::assembled_unicode
@ assembled_unicode
Unicode, current font.
Definition: Configuration.h:107
AFontSize
Definition: FontAttribs.h:97
Configuration::SetContext
void SetContext(wxDC &dc)
Set the drawing context that is currently active.
Definition: Configuration.h:155
Configuration::GetBaseIndent
long GetBaseIndent() const
The y position the worksheet starts at.
Definition: Configuration.h:314
LoggingMessageDialog.h
Configuration::GetIndent
long GetIndent() const
Get the indentation of GroupCells.
Definition: Configuration.h:279
Configuration::GetPrinting
bool GetPrinting() const
Definition: Configuration.h:517
Configuration::SetWorkSheet
void SetWorkSheet(wxWindow *workSheet)
Set the worksheet this configuration storage is valid for.
Definition: Worksheet.h:1677
Configuration::htmlExportFormat
htmlExportFormat
The export formats we support for HTML equations.
Definition: Configuration.h:87
Configuration
Definition: Configuration.h:83
Configuration::InitOpt
InitOpt
Definition: Configuration.h:113
Configuration::SetZoomFactor
void SetZoomFactor(double newzoom)
Sets the zoom factor the worksheet is displayed at.
Definition: Configuration.cpp:925
Configuration::ClipToDrawRegion
void ClipToDrawRegion(bool clipToDrawRegion)
Do we want to save time by only redrawing the area currently shown on the screen?
Definition: Configuration.h:816
Configuration::ShowAutomaticLabels
bool ShowAutomaticLabels() const
Do we want to show maxima's automatic labels (o1, t1, i1,...)?
Definition: Configuration.h:636
Configuration::InvertColour
wxColour InvertColour(wxColour col)
Inverts a color: In 2020 wxColor still lacks this functionality.
Definition: Configuration.cpp:856
Configuration::MakeColorDifferFromBackground
wxColor MakeColorDifferFromBackground(wxColor color)
Definition: Configuration.cpp:1284
Configuration::ShowLabels
bool ShowLabels() const
Do we want at all to show labels?
Definition: Configuration.h:644
Configuration::LineWidth_em
void LineWidth_em(long width)
Set the minimum sensible line width in widths of a letter.
Definition: Configuration.h:398
Configuration::assembled_unicode_fallbackfont2
@ assembled_unicode_fallbackfont2
Unicode, fallbackfont 2.
Definition: Configuration.h:108
Configuration::SetPrinting
void SetPrinting(bool printing)
Definition: Configuration.cpp:845
Configuration::ShowBrackets
bool ShowBrackets() const
Show the cell brackets [displayed left to each group cell showing its extend]?
Definition: Configuration.h:613
Configuration::HelpBrowserUserLocation
wxString HelpBrowserUserLocation() const
Returns the location of the help browser the user has selected.
Definition: Configuration.h:686
Configuration::GetDefaultLineWidth
double GetDefaultLineWidth() const
Calculates the default line width for the worksheet.
Definition: Configuration.h:377
Configuration::MathJaXURL
wxString MathJaXURL() const
Returns the URL MathJaX can be found at.
Definition: Configuration.h:706
Configuration::SetLabelChoice
void SetLabelChoice(showLabels choice)
Sets the value of the Configuration ChoiceBox that treads displaying labels.
Definition: Configuration.h:648
Configuration::GetEscCode
static const wxString & GetEscCode(const wxString &key)
Retrieve a symbol for the escape code typed after the Escape key.
Definition: Configuration.cpp:437
Configuration::AutodetectMaxima
void AutodetectMaxima(bool autodetectmaxima)
Autodetect maxima's location?
Definition: Configuration.h:659
Configuration::GetInterEquationSkip
double GetInterEquationSkip() const
Definition: Configuration.h:199
Configuration::HelpBrowserUserLocation
void HelpBrowserUserLocation(wxString helpBrowser)
Sets the location of the maxima binary.
Definition: Configuration.h:689
Configuration::assembled_unicode_fallbackfont
@ assembled_unicode_fallbackfont
Unicode, fallbackfont 1.
Definition: Configuration.h:106
Configuration::HideBrackets
void HideBrackets(bool hide)
Define if we want to hide brackets that are not under the pointer.
Definition: Configuration.h:217
Configuration::drawMode
drawMode
Definition: Configuration.h:103
Configuration::GetPPI
wxSize GetPPI() const
Definition: Configuration.cpp:97
Configuration::GetColor
wxColour GetColor(TextStyle style)
Gets the color for a text style.
Definition: Configuration.cpp:1259
Configuration::EscCodesBegin
static EscCodeIterator EscCodesBegin()
Iterators over the escape code list.
Definition: Configuration.cpp:446
Configuration::SetIndent
void SetIndent(long indent)
Definition: Configuration.h:335
Configuration::MaximaDefaultLocation
static wxString MaximaDefaultLocation()
The auto-detected maxima location.
Definition: Configuration.cpp:1037
Configuration::GetDisplayedDigits
long GetDisplayedDigits() const
Definition: Configuration.h:573
Configuration::AutodetectHelpBrowser
void AutodetectHelpBrowser(bool autodetect)
Autodetect maxima's location?
Definition: Configuration.h:683
Configuration::AutodetectHelpBrowser
bool AutodetectHelpBrowser() const
Autodetect maxima's location? (If false the user-specified location is used)
Definition: Configuration.h:681
Configuration::WriteSettings
void WriteSettings(const wxString &file={})
Saves the style settings to a file.
Definition: Configuration.cpp:1106
Configuration::EditorBackgroundColor
wxColor EditorBackgroundColor()
Determine the default background color of editorcells.
Definition: Configuration.cpp:795