wxMaxima
Loading...
Searching...
No Matches
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>
32#include "cells/TextStyle.h"
34#include "MaximaSessionInfo.h"
35#include "RenderContext.h"
36#include "Styles.h"
37#include <cstdint>
38#include <functional>
39#include <memory>
40#include <mutex>
41#include <unordered_map>
42#include <random>
43#include <list>
44#include <variant>
45#include <vector>
46#include <algorithm>
47#include <atomic>
48#include <chrono>
49#include <wx/wupdlock.h>
50#include <list>
51
52#define MC_LINE_SKIP Scale_Px(2)
53#define MC_TEXT_PADDING Scale_Px(1)
54
55#define PAREN_OPEN_TOP_UNICODE "\u239b"
56#define PAREN_OPEN_EXTEND_UNICODE "\u239c"
57#define PAREN_OPEN_BOTTOM_UNICODE "\u239d"
58#define PAREN_CLOSE_TOP_UNICODE "\u239e"
59#define PAREN_CLOSE_EXTEND_UNICODE "\u239f"
60#define PAREN_CLOSE_BOTTOM_UNICODE "\u23a0"
61#define SUM_SIGN "\u2211"
62#define PROD_SIGN "\u220F"
64#define SUM_DEC 2
65
67#define MC_HCARET_WIDTH 25
68
69#define MC_EXP_INDENT static_cast<wxCoord>(Scale_Px(2))
70static constexpr AFontSize MC_MIN_SIZE{ 6.0f };
71static constexpr AFontSize MC_MAX_SIZE{ 48.0f };
72
73// The minimal and maximal label width
74#define LABELWIDTH_MIN 3
75#define LABELWIDTH_MAX 10
76class Cell;
77class CellPointers;
78class GroupCell;
79template<class T> class wxScrolled;
81
97{
98public:
100 std::atomic<long> manualAnchorsFromBuiltin{0};
101 std::atomic<long> manualAnchorsFromCache{0};
102 std::atomic<long> manualAnchorsCompiled{0};
103 std::atomic<long> maximaProcessesSpawned{0};
104 std::atomic<long> fontCacheHits{0};
105 std::atomic<long> fontCacheMisses{0};
106 std::atomic<long> recalculationNeeded_FontInvalid{0};
107 std::atomic<long> recalculationNeeded_SizeInvalid{0};
108 std::atomic<long> recalculationNeeded_FontMismatch{0};
109 std::atomic<long> recalculationNeeded_ConfigChanged{0};
110 std::atomic<long> recalculationNeeded_CellsAppended{0};
111 std::atomic<long> recalculationNeeded_EditorDirty{0};
112 std::atomic<long> cellsConvertedToLinear{0};
113 std::atomic<long> cellsConvertedTo2D{0};
114 void Report() const;
115 };
116 static PerformanceStats g_stats;
117
118 enum maximaHelpFormat{
119 maxima = 0,
120 frontend = 1,
121 browser = 2
122 };
125 {
126 mathJaX_TeX = 0,
127 bitmap = 1,
128 mathML_mathJaX = 2,
129 svg = 3,
130 html_export_invalidChoice
131 };
132
133 enum showLabels : int8_t
134 {
135 labels_automatic = 0,
136 labels_prefer_user = 1,
137 labels_useronly = 2,
138 labels_none = 3,
139 labels_invalidSelection
140 };
141
143 {
145 handdrawn
146 };
147
149 {
150 none,
151 temporary
152 };
153
154 enum mathDisplayMode
155 {
156 display_2d,
157 display_2dASCII,
158 display_2dUNICODE,
159 display_1dASCII
160 };
161
162 typedef std::unordered_map <wxString, bool, wxStringHash> StringBoolHash;
164 bool IsOperator(wxString name) const {return m_maximaSession.IsOperator(name);}
166 void AddMaximaOperator(const wxString &name){m_maximaSession.AddOperator(name);}
167 const wxEnvVariableHashMap& MaximaEnvVars() const {return m_maximaEnvVars;}
169 void ClearMaximaEnvVars(){m_maximaEnvVars.clear();}
171 void SetMaximaEnvVar(const wxString &name, const wxString &value){m_maximaEnvVars[name] = value;}
172
174 mathDisplayMode DisplayMode() const {return m_displayMode;}
176 void DisplayMode(mathDisplayMode mode ) {m_displayMode = mode;}
177
179 void SetWorkingDirectory(wxString dir)
180 { m_maximaSession.SetWorkingDirectory(std::move(dir)); }
181
183 wxString GetWorkingDirectory() const
184 { return m_maximaSession.GetWorkingDirectory(); }
185
187 void ReadConfig();
188
193 explicit Configuration(wxDC *dc = {}, InitOpt options = none);
195
197 void ResetAllToDefaults();
198
200 void SetRecalcContext(wxDC &dc)
201 {
202 m_renderContext.SetRecalcDC(&dc);
203 }
204 void UnsetContext() {m_renderContext.SetRecalcDC(NULL);}
205
207 void SetBackgroundBrush(const wxBrush &brush);
209 bool FixedFontInTextControls() const {return m_fixedFontTC;}
211 void FixedFontInTextControls(bool fixed) {m_fixedFontTC = fixed;}
213 wxBrush GetBackgroundBrush() const {return m_renderContext.GetBackgroundBrush();}
215 wxBrush GetTooltipBrush() const {return m_tooltipBrush;}
216
217 virtual ~Configuration();
218
224
225 using EscCodeContainer = std::unordered_map<wxString, wxString, wxStringHash>;
226 using EscCodeIterator = EscCodeContainer::const_iterator;
227
229 static const wxString &GetEscCode(const wxString &key);
231 static EscCodeIterator EscCodesBegin();
233 static EscCodeIterator EscCodesEnd();
234
236 static double GetMinZoomFactor()
237 { return 0.1; }
238
240 static double GetMaxZoomFactor()
241 { return 32.0; }
242
249 double GetInterEquationSkip() const
250 {
252 return 0;
253 else
254 return GetZoomFactor() * m_styleStore[TS_MATH].GetFontSize() / 2;
255 }
256
258 wxCoord GetCellBracketWidth() const
259 {
260 return static_cast<wxCoord>(GetZoomFactor() * 16);
261 }
262
264 bool HideBrackets() const
265 { return m_hideBrackets; }
266
268 void HideBrackets(bool hide){m_hideBrackets = hide;}
269
271 double PrintScale() const
272 { return m_printScale; }
273
275 void PrintScale(double scale){m_printScale = scale;}
276
277 void PrintMargin_Top(double margin){m_printMargin_Top = margin;}
278 void PrintMargin_Bot(double margin){m_printMargin_Bot = margin;}
279 void PrintMargin_Left(double margin){m_printMargin_Left = margin;}
280 void PrintMargin_Right(double margin){m_printMargin_Right = margin;}
281 double PrintMargin_Top() const {return m_printMargin_Top;}
282 double PrintMargin_Bot() const {return m_printMargin_Bot;}
283 double PrintMargin_Left() const {return m_printMargin_Left;}
284 double PrintMargin_Right() const {return m_printMargin_Right;}
285
287 void SetZoomFactor(double newzoom);
288
290 void SetZoomFactor_temporarily(double newzoom){
291 if(m_zoomFactor != newzoom)
292 RecalculateForce();
293 m_zoomFactor = newzoom;
294 }
295
300 wxCoord Scale_Px(double px) const;
301 AFontSize Scale_Px(AFontSize size) const;
302
304 double GetZoomFactor() const
305 { return m_zoomFactor; }
306
308 wxDC *GetRecalcDC() const
309 { return m_renderContext.GetRecalcDC(); }
310
311 void SetRecalcDC(wxDC *dc)
312 { m_renderContext.SetRecalcDC(dc); }
313
314 wxString GetFontName(TextStyle ts = TS_CODE_DEFAULT) const;
315
316 // cppcheck-suppress functionStatic
317 // cppcheck-suppress functionConst
318 wxString GetSymbolFontName() const;
319
321 static const wxString CharsNeedingQuotes()
322 {
323 return wxString(wxS("°,\\'\"()[]-{}^+*/&§?:;=#<>$"));
324 }
325
326 wxFontWeight IsBold(long st) const;
327
328 wxFontStyle IsItalic(long st) const;
329
330 bool IsUnderlined(long st) const {return m_styleStore[st].IsUnderlined();}
331
336 wxCoord GetLabelWidth() const
337 { return m_labelWidth * 14; }
338
340 long LabelWidth() const
341 { return m_labelWidth; }
343 void LabelWidth(long labelWidth)
344 {
345 if(m_labelWidth != labelWidth)
346 RecalculateForce();
347 m_labelWidth = labelWidth;
348 }
349
351 wxCoord GetIndent() const
352 {
353 if (m_indent < 0)
354 return 3 * GetCellBracketWidth() / 2;
355 else
356 return m_indent;
357 }
358
364 wxSize GetPPI() const;
365 int AutosaveMinutes() const {return m_autoSaveMinutes;}
366 void AutosaveMinutes(int minutes){m_autoSaveMinutes = minutes;}
367
369 long GetCursorWidth() const
370 {
371 long ppi;
372
373 if(!GetPrinting())
374 ppi = GetPPI().x;
375 else
376 ppi = 96;
377
378 if (ppi / 45 < 1)
379 return 1;
380 else
381 return ppi / 45;
382 }
383
385 long GetBaseIndent() const
386 {
387 if (GetCursorWidth() < 12)
388 return 12;
389 else
390 return 4 + GetCursorWidth();
391 }
392
394 long GetGroupSkip() const
395 {
396 if (GetCursorWidth() < 10)
397 return 20;
398 else
399 return 10 + GetCursorWidth();
400 }
401
406 void SetIndent(long indent)
407 {
408 if(m_indent != indent)
409 RecalculateForce();
410 m_indent = indent;
411 }
412
413 bool IncrementalSearch() const {return m_incrementalSearch;}
414
415
416 void IncrementalSearch(bool incrementalSearch) { m_incrementalSearch = incrementalSearch; }
417
418 int MaxLayoutTime() const { return m_maxLayoutTime; }
419 void MaxLayoutTime(int time) { m_maxLayoutTime = time; }
420
421 enum class LayoutStrategy {
422 layout2DWheneverPossible = 0,
423 layout2DIfFits = 1,
424 layoutPrefer1D = 2
425 };
426 LayoutStrategy GetLayoutStrategy() const { return m_layoutStrategy; }
427 void SetLayoutStrategy(LayoutStrategy s) { m_layoutStrategy = s; }
428
429 void SetLayoutDeadline(int seconds) {
430 m_renderContext.SetLayoutDeadline(seconds);
431 }
432 void ClearLayoutCancelled() {
433 m_renderContext.ClearLayoutCancelled();
434 }
435 bool IsLayoutCancelled() const {
436 return m_renderContext.IsLayoutCancelled();
437 }
438
441 {
442 RecalculateForce();
443 }
444
446 double GetDefaultLineWidth() const
447 {
448 if (GetZoomFactor() < 1.0)
449 return 1.0;
450 else
451 return GetZoomFactor();
452 }
453
455 long LineWidth_em() const
456 {
457 if(!GetPrinting())
458 return m_lineWidth_em;
459 else
460 return 10000;
461 }
462
463 bool AutoSaveAsTempFile() const {return m_autoSaveAsTempFile;}
464 void AutoSaveAsTempFile(bool asTempFile){m_autoSaveAsTempFile = asTempFile;}
465
467 void LineWidth_em(long width)
468 { m_lineWidth_em = width; }
469
471 // On big 16:9 screens text tends to get \b very wide before it hits the right margin.
472 // But text blocks that are 1 meter wide and 2 cm high feel - weird.
473 long GetLineWidth() const;
474
475 bool SaveUntitled() const { return m_saveUntitled;}
476 void SaveUntitled(bool save) {m_saveUntitled = save;}
477
478 bool CursorJump() const { return m_cursorJump;}
479 void CursorJump(bool save){m_cursorJump = save;}
480
481 bool NumpadEnterEvaluates() const { return m_numpadEnterEvaluates;}
482 void NumpadEnterEvaluates(bool eval){m_numpadEnterEvaluates = eval;}
483
484 bool SaveImgFileName() const { return m_saveImgFileName;}
485 void SaveImgFileName(bool save) { m_saveImgFileName = save;}
486
488 bool GetAutoWrap() const
489 { return m_autoWrap > 0; }
490
491 // cppcheck-suppress functionStatic
493 static bool GetAutoWrapCode()
494 { return false; }
495
502 void SetAutoWrap(long autoWrap){m_autoWrap = autoWrap;}
503
505 bool GetAutoIndent() const
506 { return m_autoIndent; }
507
508 void SetAutoIndent(bool autoIndent){m_autoIndent = autoIndent;}
509
511 bool IndentMaths() const {return m_indentMaths;}
512 void IndentMaths(bool indent){
513 if(m_indentMaths != indent)
514 RecalculateForce();
515 m_indentMaths = indent;}
516 AFontSize GetFontSize(TextStyle st) const { return m_styleStore[st].GetFontSize(); }
517
518 static const wxString &GetStyleName(TextStyle textStyle);
519
525 void ReadStyles(const wxString &file = {});
526
531 void WriteStyles(const wxString &file = {});
532 void WriteStyles(wxConfigBase *config);
533 void WriteSettings(const wxString &file = {});
541 static const std::vector<std::pair<TextStyle, wxString>> &StyleConfigKeys();
542
550 const wxChar *key;
552 std::variant<bool Configuration::*, int Configuration::*,
553 long Configuration::*, double Configuration::*,
554 wxString Configuration::*>
556 };
567 static const std::vector<ScalarSetting> &ScalarConfigSettings();
568 void MakeStylesConsistent();
569 void Outdated(bool outdated)
570 { m_outdated = outdated; }
571
573 bool CheckKeepPercent() const
574 { return m_keepPercent; }
575
577 void SetKeepPercent(bool keepPercent)
578 {
579 if(m_keepPercent != keepPercent)
580 RecalculateForce();
581 m_keepPercent = keepPercent;
582 }
583
584 wxString GetTeXCMRI() const
585 { return m_fontCMRI; }
586
587 wxString GetTeXCMSY() const
588 { return m_fontCMSY; }
589
590 wxString GetTeXCMEX() const
591 { return m_fontCMEX; }
592
593 wxString GetTeXCMMI() const
594 { return m_fontCMMI; }
595
596 wxString GetTeXCMTI() const
597 { return m_fontCMTI; }
598
599 bool ShowCodeCells() const
600 { return m_showCodeCells; }
601
602 void ShowCodeCells(bool show);
603
610 void SetPrinting(bool printing);
611
618 bool GetPrinting() const
619 { return m_renderContext.Printing(); }
620
622 wxColour GetColor(TextStyle style);
623
624
625 bool UsePngCairo() const { return m_usepngCairo;}
626 void UsePngCairo(bool usepngCairo) { m_usepngCairo = usepngCairo;}
627
628 bool GetMatchParens() const { return m_matchParens; }
629 void SetMatchParens(bool matchParens) { m_matchParens = matchParens; }
630 bool ShowMatchingParens() const { return m_showMatchingParens; }
631 void ShowMatchingParens(bool show) { m_showMatchingParens = show; }
632
634 bool GetChangeAsterisk() const{ return m_changeAsterisk; }
635
637 void SetChangeAsterisk(bool changeAsterisk) {
638 if(m_changeAsterisk != changeAsterisk)
639 RecalculateForce();
640 m_changeAsterisk = changeAsterisk;
641 }
642
643 bool HidemultiplicationSign() const {return m_hidemultiplicationsign;}
644
645 void HidemultiplicationSign(bool show) {
646 if(m_hidemultiplicationsign != show)
647 RecalculateForce();
648 m_hidemultiplicationsign = show;
649 }
650
651 bool Latin2Greek() const
652 {return m_latin2greek;}
653
654 void Latin2Greek(bool latin2greek) {
655 if(m_latin2greek != latin2greek)
656 RecalculateForce();
657 m_latin2greek = latin2greek;
658 }
659
660 bool GreekSidebar_ShowLatinLookalikes() const {return m_greekSidebar_ShowLatinLookalikes;}
661 void GreekSidebar_ShowLatinLookalikes(bool show){m_greekSidebar_ShowLatinLookalikes = show;}
662
663 bool GreekSidebar_Show_mu() const {return m_greekSidebar_Show_mu;}
664 void GreekSidebar_Show_mu(bool show) {m_greekSidebar_Show_mu = show;}
665
666 wxString SymbolPaneAdditionalChars() const
667 {return m_symbolPaneAdditionalChars;}
668 void SymbolPaneAdditionalChars(wxString symbols) {m_symbolPaneAdditionalChars = std::move(symbols);}
669
671 bool NotifyIfIdle() const
672 { return m_notifyIfIdle; }
673
674 void NotifyIfIdle(bool notify) {m_notifyIfIdle = notify;}
675
681 { return m_displayedDigits; }
682
683 void SetDisplayedDigits(long displayedDigits)
684 {
685 wxASSERT_MSG(displayedDigits >= 0, _("Bug: Maximum number of digits that is to be displayed is too low!"));
686 if(m_displayedDigits != displayedDigits)
687 RecalculateForce();
688 m_displayedDigits = displayedDigits;
689 }
690
693 {
694 public:
695 FileToSave(const wxString &filename, const wxMemoryBuffer &data):
696 m_data(data),
697 m_filename(filename)
698 {
699 }
700 const wxString FileName() const{return m_filename;}
701 const wxMemoryBuffer Data() const{return m_data;}
702 private:
703 const wxMemoryBuffer m_data;
704 const wxString m_filename;
705 };
706
709 {
710 public:
711 TextsnippetToDraw(const wxPoint &pos, const wxString &text, const wxColor &color):
712 m_pos(pos),
713 m_text(text),
714 m_color(color)
715 {
716 }
717 const wxPoint Pos() const{return m_pos;}
718 const wxString Text() const{return m_text;}
719 const wxColor Color() const{return m_color;}
720 private:
721 const wxPoint m_pos;
722 const wxString m_text;
723 const wxColor m_color;
724 };
725
726 void PushFileToSave(const wxString &filename, const wxMemoryBuffer &data)
727 { m_filesToSave.emplace_front(FileToSave(filename, data)); }
728
729 wxRect GetUpdateRegion() const {return m_renderContext.GetUpdateRegion();}
730 const std::list<FileToSave> &GetFilesToSave() const {return m_filesToSave;}
731 void ClearFilesToSave () { m_filesToSave.clear();}
732 void SetUpdateRegion(wxRect rect){m_renderContext.SetUpdateRegion(rect);}
733
736 bool InUpdateRegion(wxRect rect) const;
737
738 bool GetInsertAns() const
739 { return m_insertAns; }
740
741 void SetInsertAns(bool insertAns){ m_insertAns = insertAns; }
742
743 bool GetOpenHCaret() const
744 { return m_openHCaret; }
745
746 void SetOpenHCaret(bool openHCaret){ m_openHCaret = openHCaret; }
747
748 bool RestartOnReEvaluation() const
749 { return m_restartOnReEvaluation; }
750
751 void RestartOnReEvaluation(bool arg){ m_restartOnReEvaluation = arg; }
752
754 wxSize GetCanvasSize() const
755 { return m_renderContext.GetCanvasSize(); }
756
758 void SetCanvasSize(wxSize siz)
759 {
760 if(GetCanvasSize().GetWidth() != siz.GetWidth() ||
761 GetCanvasSize().GetHeight() != siz.GetHeight())
762 RecalculateForce();
763 m_renderContext.SetCanvasSize(siz);
764 }
765
767 bool ShowBrackets() const
768 { return m_showBrackets; }
769
770 bool ShowBrackets(bool show)
771 {
772 if(m_showBrackets != show)
773 RecalculateForce();
774 return m_showBrackets = show;
775 }
776
778 bool PrintBrackets() const
779 { return m_printBrackets; }
780
781 showLabels GetLabelChoice() const
782 { return m_showLabelChoice; }
783
784 bool ShowInputLabels() const {return m_showInputLabels;}
785 void ShowInputLabels(bool show) {
786 if(m_showInputLabels != show)
787 RecalculateForce();
788 m_showInputLabels = show;
789 }
790
792 enum class Appearance { light, dark, followSystem };
793 Appearance GetAppearance() const { return m_appearance; }
796 m_appearance = a;
797 m_styleStore.SetUseDark(UseDarkMode());
799 }
803 bool UseDarkMode() const {
804 if (m_appearance == Appearance::dark) return true;
805 if (m_appearance == Appearance::light) return false;
806 return SystemIsDark();
807 }
809 static bool SystemIsDark();
810
811 long UndoLimit(){return std::max(m_undoLimit, static_cast<long>(0));}
812 void UndoLimit(long limit){ m_undoLimit = limit; }
813
814 long RecentItems(){return std::max(m_recentItems, static_cast<long>(0));}
815 void RecentItems(long items){ m_recentItems = items; }
816
819 { return (m_showLabelChoice < labels_useronly); }
820
822 bool UseUserLabels() const
823 { return m_showLabelChoice > labels_automatic; }
824
826 bool ShowLabels() const
827 { return m_showLabelChoice < labels_none; }
828
830 void SetLabelChoice(showLabels choice) {
831 if(m_showLabelChoice != choice)
832 RecalculateForce();
833 m_showLabelChoice = choice;
834 }
835
836 bool PrintBrackets(bool print)
837 {
838 m_printBrackets = print;
839 return print;
840 }
841
843 bool AutodetectMaxima() const {return m_autodetectMaxima;}
845 void AutodetectMaxima(bool autodetectmaxima){m_autodetectMaxima = autodetectmaxima;}
846
848 wxString MaximaParameters() const {return m_maximaParameters;}
850 void MaximaParameters(wxString parameters){m_maximaParameters = std::move(parameters);}
851
853 static wxString MaximaDefaultLocation();
854
856 wxString MaximaLocation() const;
857
859 wxString MaximaUserLocation() const {return m_maximaUserLocation;}
860
862 void MaximaUserLocation(wxString maxima) { m_maximaUserLocation = std::move(maxima); }
863
865 bool AutodetectHelpBrowser() const {return m_autodetectHelpBrowser;}
867 void AutodetectHelpBrowser(bool autodetect){m_autodetectHelpBrowser = autodetect;}
868
870 bool InternalHelpBrowser() const {return m_useInternalHelpBrowser && OfferInternalHelpBrowser();}
872 void InternalHelpBrowser(bool useInternalHelpBrowser)
873 {m_useInternalHelpBrowser = useInternalHelpBrowser;}
874
876 bool SinglePageManual() const {return m_singlePageManual;}
878 void SinglePageManual(bool singlePageManual)
879 {m_singlePageManual = singlePageManual;}
880
882 wxString HelpBrowserUserLocation() const {return m_helpBrowserUserLocation;}
883
885 void HelpBrowserUserLocation(wxString helpBrowser) { m_helpBrowserUserLocation = std::move(helpBrowser);}
886
893 static wxString FindProgram(const wxString &location);
894
897 { return m_fixReorderedIndices; }
898
899 void FixReorderedIndices(bool fix) { m_fixReorderedIndices = fix;}
900
902 wxString MathJaXURL() const {
903 if(m_mathJaxURL_UseUser)
904 return m_mathJaxURL;
905 else
906 return MathJaXURL_Auto();}
907 wxString MathJaXURL_User() const { return m_mathJaxURL;}
908 bool MathJaXURL_UseUser() const { return m_mathJaxURL_UseUser;}
909 void MathJaXURL_UseUser(bool useUser){m_mathJaxURL_UseUser = useUser;}
910
911 bool EnterEvaluates() const {return m_enterEvaluates;}
912 void EnterEvaluates(bool enterEvaluates) {m_enterEvaluates = enterEvaluates;}
913 static wxString MathJaXURL_Auto() { return wxS("https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js");}
915 void MathJaXURL(wxString url){m_mathJaxURL = std::move(url);}
916
917 bool CopyBitmap() const {return m_copyBitmap;}
918 void CopyBitmap(bool copyBitmap){ m_copyBitmap = copyBitmap; }
919
920 bool CopyMathML() const {return m_copyMathML;}
921 void CopyMathML(bool copyMathML){ m_copyMathML = copyMathML;}
922 bool CopyMathMLHTML() const {return m_copyMathMLHTML;}
923 void CopyMathMLHTML(bool copyMathMLHTML){ m_copyMathMLHTML = copyMathMLHTML; }
924 bool HideMarkerForThisMessage(wxString message);
925 void HideMarkerForThisMessage(const wxString &message, bool hide)
926 {m_hideMarkerForThisMessage[message] = hide;}
927 bool CopyRTF() const {return m_copyRTF;}
928 void CopyRTF(bool copyRTF) { m_copyRTF = copyRTF; }
929 bool CopySVG() const {return m_copySVG;}
930 void CopySVG(bool copySVG) { m_copySVG = copySVG; }
931 bool CopyEMF() const {return m_copyEMF;}
932 void CopyEMF(bool copyEMF) { m_copyEMF = copyEMF; }
933 bool UseSVG() const {return m_useSVG;}
934 void UseSVG(bool useSVG) { m_useSVG = useSVG ;}
936 void ShowLength(long length) {
937 m_showLength = length;
938 }
940 long ShowLength() const {return m_showLength;}
942 std::size_t ShowLength_Bytes() const;
943
946 if(m_parenthesisDrawMode != mode)
947 RecalculateForce();
948 m_parenthesisDrawMode = mode;
949 }
950
951 void TocShowsSectionNumbers(bool showSectionNumbers) { m_TOCshowsSectionNumbers = showSectionNumbers; }
952
953 bool TocShowsSectionNumbers() const {return m_TOCshowsSectionNumbers;}
954
955 void UseUnicodeMaths(bool useunicodemaths)
956 { m_useUnicodeMaths = useunicodemaths; }
957 bool UseUnicodeMaths() const {return m_useUnicodeMaths;}
958
963 const Style *GetStyle(TextStyle textStyle) const { return &m_styleStore[textStyle]; }
971 Style *GetWritableStyle(TextStyle textStyle) { return &m_styleStore[textStyle]; }
972
979 wxScrolledCanvas *GetWorkSheet() const {return m_workSheet;}
981 void SetWorkSheet(wxScrolledCanvas *workSheet);
982
989 CellPointers *GetCellPointers() const {return m_cellPointers;}
991 void SetCellPointers(CellPointers *cellPointers) {m_cellPointers = cellPointers;}
992
999 void RequestRecalculate(GroupCell *group) const
1000 {if (m_recalculateRequest) m_recalculateRequest(group);}
1002 void SetRecalculateRequestCallback(std::function<void(GroupCell *)> callback)
1003 {m_recalculateRequest = std::move(callback);}
1004
1005 long DefaultPort() const {return m_defaultPort;}
1006 void DefaultPort(long port){m_defaultPort = port;}
1007 bool GetAbortOnError() const {return m_abortOnError;}
1008 void SetAbortOnError(bool abortOnError) {m_abortOnError = abortOnError;}
1009
1010 long GetLanguage() const {return m_language;}
1011 void SetLanguage(long language) {m_language = language;}
1012
1014 long MaxGnuplotMegabytes() const {return m_maxGnuplotMegabytes;}
1015 void MaxGnuplotMegabytes(long megaBytes)
1016 {m_maxGnuplotMegabytes = megaBytes;}
1017
1018 bool OfferKnownAnswers() const {return m_offerKnownAnswers;}
1019 void OfferKnownAnswers(bool offerKnownAnswers)
1020 {m_offerKnownAnswers = offerKnownAnswers;}
1021
1022 wxString Documentclass() const {return m_documentclass;}
1023 void Documentclass(wxString clss){m_documentclass = std::move(clss);}
1024 wxString DocumentclassOptions() const {return m_documentclassOptions;}
1025 void DocumentclassOptions(wxString classOptions){m_documentclassOptions = std::move(classOptions);}
1026
1027
1028 htmlExportFormat HTMLequationFormat() const {return m_htmlEquationFormat;}
1029 void HTMLequationFormat(htmlExportFormat HTMLequationFormat)
1030 {m_htmlEquationFormat = HTMLequationFormat;}
1031
1032 AFontSize GetDefaultFontSize() const { return m_styleStore[TS_CODE_DEFAULT].GetFontSize(); }
1033 AFontSize GetMathFontSize() const { return m_styleStore[TS_MATH].GetFontSize(); }
1034
1036 long GetAutosubscript_Num() const {return m_autoSubscript;}
1037 void SetAutosubscript_Num(long autosubscriptnum) {m_autoSubscript = autosubscriptnum;}
1038 wxString GetAutosubscript_string() const;
1040 wxColor DefaultBackgroundColor();
1042 wxColor EditorBackgroundColor();
1044 bool ClipToDrawRegion() const {return m_renderContext.ClipToDrawRegion();}
1046 void ClipToDrawRegion(bool clipToDrawRegion){m_renderContext.ClipToDrawRegion(clipToDrawRegion);}
1047 void SetVisibleRegion(wxRect visibleRegion){
1048 if(m_renderContext.GetVisibleRegion().GetWidth() != visibleRegion.GetWidth())
1049 RecalculateForce();
1050 m_renderContext.SetVisibleRegion(visibleRegion);
1051 }
1052 wxRect GetVisibleRegion() const {return m_renderContext.GetVisibleRegion();}
1053 void SetWorksheetPosition(wxPoint worksheetPosition){m_renderContext.SetWorksheetPosition(worksheetPosition);}
1054 wxPoint GetWorksheetPosition() const {return m_renderContext.GetWorksheetPosition();}
1055 wxString MaximaShareDir() const {return m_maximaSession.ShareDir();}
1056 void MaximaShareDir(wxString dir){m_maximaSession.ShareDir(std::move(dir));}
1057 wxString MaximaDemoDir() const {return m_maximaSession.DemoDir();}
1058 void MaximaDemoDir(wxString dir){m_maximaSession.DemoDir(std::move(dir));}
1059 void InLispMode(bool lisp){m_maximaSession.InLispMode(lisp);}
1060 bool InLispMode() const {return m_maximaSession.InLispMode();}
1061 void BitmapScale(int factor){m_bitmapScale = factor;}
1062 int BitmapScale() const {return m_bitmapScale;}
1063 void DefaultPlotHeight(int px){m_defaultPlotHeight = px;}
1064 int DefaultPlotHeight() const {return m_defaultPlotHeight;}
1065 void DefaultPlotWidth(int px){m_defaultPlotWidth = px;}
1066 int DefaultPlotWidth() const {return m_defaultPlotWidth;}
1067 void DefaultFramerate(int fps){m_defaultFramerate = fps;}
1068 int DefaultFramerate() const {return m_defaultFramerate;}
1069 void TocDepth(int depth){m_tocDepth = depth;}
1070 int TocDepth() const {return m_tocDepth;}
1071 bool TeXExponentsAfterSubscript() const {return m_TeXExponentsAfterSubscript;}
1072 void TeXExponentsAfterSubscript(bool ExponentsAfterSubscript)
1073 {m_TeXExponentsAfterSubscript = ExponentsAfterSubscript;}
1074 bool UsePartialForDiff() const {return m_usePartialForDiff;}
1075 void UsePartialForDiff(bool usePartialForDiff)
1076 {m_usePartialForDiff = usePartialForDiff;}
1084 {if (m_adjustWorksheetSizeRequest) m_adjustWorksheetSizeRequest();}
1086 void SetAdjustWorksheetSizeRequestCallback(std::function<void()> callback)
1087 {m_adjustWorksheetSizeRequest = std::move(callback);}
1089 void NotifyOfCellRedraw(const Cell *cell);
1099 void ReportMultipleRedraws();
1101 bool OfferInternalHelpBrowser() const;
1102 bool WrapLatexMath() const {return m_wrapLatexMath;}
1103 void WrapLatexMath(bool wrapLatexMath){m_wrapLatexMath = wrapLatexMath;}
1104 bool AllowNetworkHelp() const {return m_allowNetworkHelp;}
1105 void AllowNetworkHelp(bool allowNetworkHelp){m_allowNetworkHelp = allowNetworkHelp;}
1106 bool ShowAllDigits() const {return m_showAllDigits;}
1107 void ShowAllDigits(bool shw){
1108 if(m_showAllDigits != shw)
1109 RecalculateForce();
1110 m_showAllDigits = shw;
1111 }
1112 bool LineBreaksInLongNums() const {return m_lineBreaksInLongNums;}
1113 void LineBreaksInLongNums(bool brk){
1114 if(m_lineBreaksInLongNums != brk)
1115 RecalculateForce();
1116 m_lineBreaksInLongNums = brk;
1117 }
1118 int MaxClipbrdBitmapMegabytes() const {return m_maxClipbrd_BitmapMegabytes;}
1119 void MaxClipbrdBitmapMegabytes(int maxClipbrd_BitmapMegabytes)
1120 {m_maxClipbrd_BitmapMegabytes = maxClipbrd_BitmapMegabytes;}
1121
1122 void MaximaUsesHtmlBrowser(bool maximaUsesHhtmlBrowser){m_maximaUsesHhtmlBrowser = maximaUsesHhtmlBrowser;}
1123 bool MaximaUsesHtmlBrowser() const {return m_maximaUsesHhtmlBrowser;}
1124 void MaximaUsesWxmaximaBrowser(bool maximaUsesWxmaximaBrowser){m_maximaUsesWxmaximaBrowser = maximaUsesWxmaximaBrowser;}
1125 bool MaximaUsesWxmaximaBrowser() const {return m_maximaUsesWxmaximaBrowser && OfferInternalHelpBrowser();}
1126 void ExportContainsWXMX(bool exportContainsWXMX){m_exportContainsWXMX = exportContainsWXMX;}
1127 bool ExportContainsWXMX() const {return m_exportContainsWXMX;}
1128 void WizardTab(long tab){m_wizardTab = tab;}
1129 long WizardTab() const {return m_wizardTab;}
1130
1131 void Display2d_Unicode(bool unicode){m_display2d_Unicode = unicode;}
1132 bool Display2d_Unicode() const {return m_display2d_Unicode;}
1133
1134 #ifdef __WXMSW__
1135 bool UseWGnuplot() const {return m_useWgnuplot;}
1136 void UseWGnuplot(bool usewgnuplot) {m_useWgnuplot = usewgnuplot;}
1137 #endif
1138 wxString TexPreamble() const {return m_texPreamble;}
1139 void TexPreamble(wxString texPreamble) {m_texPreamble = std::move(texPreamble);}
1140
1141 void SetMaximaVersion(const wxString &version){m_maximaSession.SetMaximaVersion(version);}
1142 wxString GetMaximaVersion() const {return m_maximaSession.GetMaximaVersion();}
1143 void SetMaximaArch(const wxString &arch){m_maximaSession.SetMaximaArch(arch);}
1144 wxString GetMaximaArch() const {return m_maximaSession.GetMaximaArch();}
1145 void SetLispVersion(const wxString &version){m_maximaSession.SetLispVersion(version);}
1146 wxString GetLispVersion() const {return m_maximaSession.GetLispVersion();}
1147 void SetLispType(const wxString &type){m_maximaSession.SetLispType(type);}
1148 wxString GetLispType() const {return m_maximaSession.GetLispType();}
1149
1151 void InitStyles();
1153 bool FontRendersChar(wxUniChar ch, const wxFont &font = *wxNORMAL_FONT)
1154 { return m_fontRenderability.FontRendersChar(ch, font); }
1155
1157 const std::vector<TextStyle> &GetCodeStylesList() const {return m_styleStore.CodeStylesList();}
1159 const std::vector<TextStyle> &GetMathStylesList() const {return m_styleStore.MathStylesList();}
1161 const std::vector<TextStyle> &GetColorOnlyStylesList() const {return m_styleStore.ColorOnlyStylesList();}
1162 bool StyleAffectsCode(TextStyle style) const;
1163 bool StyleAffectsMathOut(TextStyle style) const;
1164 bool StyleAffectsColorOnly(TextStyle style) const;
1166 bool UpdateNeeded() const;
1168 static void SetDebugmode(){m_debugMode = true;}
1170 static bool GetDebugmode(){return m_debugMode;}
1171 maximaHelpFormat MaximaHelpFormat() const;
1172 void MaximaHelpFormat(maximaHelpFormat format) {m_maximaHelpFormat = format;}
1173
1174private:
1176 MaximaSessionInfo m_maximaSession;
1178 InitOpt m_initOpts;
1184 long m_configId;
1186 std::random_device m_rd;
1188 std::default_random_engine m_eng;
1189 wxEnvVariableHashMap m_maximaEnvVars;
1190public:
1192 std::random_device::result_type RandomEntropy(){return m_rd();}
1194 std::default_random_engine &RandomEngine(){return m_eng;}
1202 std::int_fast32_t CellCfgCnt() const {return m_cellCfgCnt;}
1203 void RecalculateForce() { m_cellCfgCnt++; }
1204 static bool UseThreads(){return m_use_threads;}
1205 static void UseThreads(bool use){m_use_threads = use;}
1206 static void SetMaximaLang(const wxString &LANG){m_maxima_LANG = LANG;}
1207 static wxString GetMaximaLang(){return m_maxima_LANG;}
1208private:
1210 static wxString m_maxima_LANG;
1211 std::list<FileToSave> m_filesToSave;
1213 Styles m_styleStore;
1215 StringBoolHash m_hideMarkerForThisMessage;
1217 FontRenderabilityCache m_fontRenderability;
1218 mathDisplayMode m_displayMode = display_2d;
1219 static bool m_debugMode;
1220 bool m_showInputLabels;
1221 long m_wizardTab;
1222 bool m_display2d_Unicode;
1223 bool m_usePartialForDiff;
1224 bool m_maximaUsesHhtmlBrowser;
1225 bool m_maximaUsesWxmaximaBrowser;
1227 bool m_autoSaveAsTempFile;
1229 long m_language;
1231 bool m_autodetectMaxima;
1233 bool m_autodetectHelpBrowser;
1235 bool m_useInternalHelpBrowser;
1237 bool m_singlePageManual;
1239 bool m_incrementalSearch;
1241 long m_autoSubscript;
1243 wxScrolledCanvas *m_workSheet = NULL;
1245 CellPointers *m_cellPointers = NULL;
1247 std::function<void(GroupCell *)> m_recalculateRequest;
1249 std::function<void()> m_adjustWorksheetSizeRequest;
1251 RenderContext m_renderContext;
1252 bool m_wrapLatexMath;
1253 bool m_allowNetworkHelp;
1254 bool m_exportContainsWXMX;
1255 wxString m_texPreamble;
1256
1257 drawMode m_parenthesisDrawMode;
1258 bool m_TeXExponentsAfterSubscript;
1259 wxString m_helpBrowserUserLocation;
1260 wxString m_maximaUserLocation;
1262 bool m_hideBrackets;
1264 double m_printScale;
1265 double m_printMargin_Top;
1266 double m_printMargin_Bot;
1267 double m_printMargin_Left;
1268 double m_printMargin_Right;
1270 bool m_showBrackets;
1272 bool m_printBrackets;
1278 bool m_changeAsterisk;
1280 bool m_notifyIfIdle;
1282 long m_displayedDigits;
1284 long m_autoWrap;
1286 bool m_autoIndent;
1288 bool m_showAllDigits;
1290 bool m_lineBreaksInLongNums;
1292 bool m_matchParens;
1294 bool m_insertAns;
1296 bool m_openHCaret;
1298 long m_labelWidth;
1299 long m_indent;
1300 bool m_latin2greek;
1301 double m_zoomFactor;
1302 bool m_outdated;
1303 wxString m_maximaParameters;
1304 bool m_keepPercent;
1305 bool m_restartOnReEvaluation;
1306 wxString m_fontCMRI, m_fontCMSY, m_fontCMEX, m_fontCMMI, m_fontCMTI;
1307 long m_lineWidth_em;
1308 showLabels m_showLabelChoice;
1309 bool m_fixReorderedIndices;
1310 wxString m_mathJaxURL;
1311 bool m_mathJaxURL_UseUser;
1312 bool m_showCodeCells;
1313 bool m_copyBitmap;
1314 bool m_copyMathML;
1315 bool m_copyMathMLHTML;
1316 long m_showLength;
1317 bool m_usepngCairo;
1318 bool m_enterEvaluates;
1319 bool m_useSVG;
1320 bool m_fixedFontTC;
1321 bool m_copyRTF;
1322 bool m_copySVG;
1323 bool m_copyEMF;
1324 bool m_TOCshowsSectionNumbers;
1325 bool m_useUnicodeMaths;
1326 bool m_indentMaths;
1327 bool m_abortOnError;
1328 bool m_showMatchingParens;
1329 bool m_hidemultiplicationsign;
1330 bool m_offerKnownAnswers;
1331 long m_defaultPort;
1332 long m_maxGnuplotMegabytes;
1333 long m_defaultPlotHeight;
1334 long m_defaultPlotWidth;
1335 bool m_saveUntitled;
1336 bool m_cursorJump;
1337 bool m_numpadEnterEvaluates;
1338 bool m_saveImgFileName;
1339 wxString m_documentclass;
1340 wxString m_documentclassOptions;
1341 htmlExportFormat m_htmlEquationFormat;
1342
1343 wxColour m_defaultBackgroundColor;
1344 wxBrush m_tooltipBrush;
1345 bool m_greekSidebar_ShowLatinLookalikes;
1346 #ifdef __WXMSW__
1347 bool m_useWgnuplot = false;
1348 #endif
1349 bool m_greekSidebar_Show_mu;
1350 wxString m_symbolPaneAdditionalChars;
1351 Appearance m_appearance = Appearance::followSystem;
1352 long m_undoLimit;
1353 long m_recentItems;
1354 int m_bitmapScale;
1355 int m_defaultFramerate;
1356 int m_tocDepth;
1357 int m_maxClipbrd_BitmapMegabytes;
1358 int m_autoSaveMinutes;
1359 int m_maxLayoutTime;
1360 LayoutStrategy m_layoutStrategy = LayoutStrategy::layout2DIfFits;
1361 wxString m_wxMathML_Filename;
1362 maximaHelpFormat m_maximaHelpFormat;
1363 std::atomic<std::int_fast32_t> m_cellCfgCnt{0};
1364 static bool m_use_threads;
1365};
1366
1369{
1370public:
1371 explicit Printing(Configuration *configuration)
1372 {
1373 m_configuration = configuration;
1374 m_configuration->SetPrinting(true);
1375 }
1376 virtual ~Printing()
1377 {
1378 m_configuration->SetPrinting(false);
1379 }
1380private:
1381 Configuration * m_configuration;
1382};
1383
1386{
1387public:
1388 explicit NoClipToDrawRegion(Configuration *configuration)
1389 {
1390 m_configuration = configuration;
1391 m_configuration->ClipToDrawRegion(false);
1392 }
1393 virtual ~NoClipToDrawRegion()
1394 {
1395 m_configuration->ClipToDrawRegion(true);
1396 }
1397private:
1398 Configuration * m_configuration;
1399};
1400
1401#endif // CONFIGURATION_H
Declares FontRenderabilityCache: which chars can each font render?
This file declares a message dialog that sends its contents to the log message sink.
Declares MaximaSessionInfo: what we know about the connected Maxima.
Declares RenderContext: the per-render-pass state of a worksheet.
This file declares the class Styles.
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 Type-Safe Fixed-Point Font Size.
Definition: FontAttribs.h:97
The storage for pointers to cells.
Definition: CellPointers.h:45
The base class all cell types the worksheet can consist of are derived from.
Definition: Cell.h:141
Stores the information about a file we need to write during the save process.
Definition: Configuration.h:693
Stores the information about a file we need to write during the save process.
Definition: Configuration.h:709
The configuration storage for the current worksheet.
Definition: Configuration.h:97
wxDC * GetRecalcDC() const
Get a drawing context suitable for size calculations.
Definition: Configuration.h:308
Appearance
How wxMaxima chooses between the light and the dark style set.
Definition: Configuration.h:792
wxString HelpBrowserUserLocation() const
Returns the location of the web browser the user has selected.
Definition: Configuration.h:882
wxColor EditorBackgroundColor()
Determine the default background color of editorcells.
Definition: Configuration.cpp:873
long GetAutosubscript_Num() const
Get the worksheet this configuration storage is valid for.
Definition: Configuration.h:1036
bool ShowAutomaticLabels() const
Do we want to show maxima's automatic labels (o1, t1, i1,...)?
Definition: Configuration.h:818
void AutodetectHelpBrowser(bool autodetect)
Autodetect the web browser?
Definition: Configuration.h:867
bool FontRendersChar(wxUniChar ch, const wxFont &font= *wxNORMAL_FONT)
True if we are confident that the font renders this char.
Definition: Configuration.h:1153
void MathJaXURL(wxString url)
Returns the URL MathJaX can be found at.
Definition: Configuration.h:915
double GetInterEquationSkip() const
Extra space to leave between two equations in output cells.
Definition: Configuration.h:249
static bool GetDebugmode()
Enable costly checks?
Definition: Configuration.h:1170
bool GetChangeAsterisk() const
Use Unicode centered dots for multiplication signs?
Definition: Configuration.h:634
void SetZoomFactor_temporarily(double newzoom)
Sets the zoom factor without storing the new value in the config file/registry.
Definition: Configuration.h:290
static bool SystemIsDark()
Whether the OS reports a dark appearance (false where wx cannot tell).
Definition: Configuration.cpp:483
void SetAutoWrap(long autoWrap)
Sets the auto wrap mode.
Definition: Configuration.h:502
wxSize GetPPI() const
Get the resolution.
Definition: Configuration.cpp:210
bool GetAutoWrap() const
Do we want to have automatic line breaks for text cells?
Definition: Configuration.h:488
void ClearAndEnableRedrawTracing()
Clear the memory of ReportMultipleRedraws()
Definition: Configuration.cpp:883
void ReportMultipleRedraws()
Report if a cell has been redrawn 2 or more times during a simple Draw() command.
Definition: Configuration.cpp:889
static wxString FindProgram(const wxString &location)
Could a maxima binary be found in the path we expect it to be in?
Definition: Configuration.cpp:534
static const std::vector< ScalarSetting > & ScalarConfigSettings()
The single source of truth pairing each mechanical scalar setting's config key with the member cachin...
Definition: Configuration.cpp:1223
void FontChanged()
To be called if a font has changed.
Definition: Configuration.h:440
static double GetMaxZoomFactor()
The upper limit we allow for the zoom factor.
Definition: Configuration.h:240
wxBrush GetTooltipBrush() const
Get the brush to be used for worksheet objects that provide a mouse-over tooltip.
Definition: Configuration.h:215
static const wxString & GetEscCode(const wxString &key)
Retrieve a symbol for the escape codes that can be typed after hitting the Escape key in the workshee...
Definition: Configuration.cpp:491
bool HideBrackets() const
Hide brackets that are not under the pointer?
Definition: Configuration.h:264
bool NotifyIfIdle() const
Notify the user if maxima is idle?
Definition: Configuration.h:671
static EscCodeIterator EscCodesBegin()
Iterators over the escape code list.
Definition: Configuration.cpp:499
CellPointers * GetCellPointers() const
The registry of special cells (selection, active cell, errors, ...) of this document.
Definition: Configuration.h:989
void SetPrinting(bool printing)
Are we currently printing?
Definition: Configuration.cpp:901
static wxString MaximaDefaultLocation()
The auto-detected maxima location.
Definition: Configuration.cpp:981
void SetLabelChoice(showLabels choice)
Sets the value of the Configuration ChoiceBox that treads displaying labels.
Definition: Configuration.h:830
bool InUpdateRegion(wxRect rect) const
Whether any part of the given rectangle is within the current update region, or true if drawing is no...
Definition: Configuration.cpp:1144
void SetKeepPercent(bool keepPercent)
Do we want to display "%e" as "%e" and "%pi" as "%pi"?
Definition: Configuration.h:577
bool SinglePageManual() const
Prefer the single-page manual?
Definition: Configuration.h:876
void ClearMaximaEnvVars()
Forget all custom environment variables for the maxima process.
Definition: Configuration.h:169
void WriteStyles(const wxString &file={})
Saves the style settings.
Definition: Configuration.cpp:1287
const std::vector< TextStyle > & GetMathStylesList() const
Which styles affect how math output is displayed?
Definition: Configuration.h:1159
wxColor DefaultBackgroundColor()
Determine the default background color of the worksheet.
Definition: Configuration.cpp:869
bool UseDarkMode() const
Whether the dark style set is currently active.
Definition: Configuration.h:803
wxString MaximaUserLocation() const
Returns the location of the maxima binary the user has selected.
Definition: Configuration.h:859
Style * GetWritableStyle(TextStyle textStyle)
Get the text Style for a given text style identifier.
Definition: Configuration.h:971
wxCoord GetLabelWidth() const
Get the width of worksheet labels [in unscaled pixels].
Definition: Configuration.h:336
void WriteSettings(const wxString &file={})
Saves the settings to a file.
Definition: Configuration.cpp:1013
mathDisplayMode DisplayMode() const
Does maxima output 1D, 2D or 2D ASCII equations?
Definition: Configuration.h:174
wxCoord GetIndent() const
Get the indentation of GroupCells.
Definition: Configuration.h:351
std::int_fast32_t CellCfgCnt() const
A counter that increases every time we need to recalculate all worksheet cells.
Definition: Configuration.h:1202
bool ShowLabels() const
Do we want at all to show labels?
Definition: Configuration.h:826
wxString MaximaParameters() const
Parameters to the maxima binary.
Definition: Configuration.h:848
wxSize GetCanvasSize() const
Reads the size of the current worksheet's visible window. See SetCanvasSize.
Definition: Configuration.h:754
void InternalHelpBrowser(bool useInternalHelpBrowser)
Use the internal help browser? If not a external web browser is used.
Definition: Configuration.h:872
double GetZoomFactor() const
Determines the zoom factor the worksheet is displayed at.
Definition: Configuration.h:304
long LineWidth_em() const
The minimum sensible line width in widths of a letter.
Definition: Configuration.h:455
void SinglePageManual(bool singlePageManual)
Prefer the single-page manual?
Definition: Configuration.h:878
bool IndentMaths() const
Do we want to indent all maths?
Definition: Configuration.h:511
wxString MaximaLocation() const
Returns the location of the maxima binary.
Definition: Configuration.cpp:974
void SetBackgroundBrush(const wxBrush &brush)
Set the brush to be used for the worksheet background.
Definition: Configuration.cpp:528
void SetCellPointers(CellPointers *cellPointers)
Set the CellPointers registry cells constructed with this configuration use.
Definition: Configuration.h:991
static const std::vector< std::pair< TextStyle, wxString > > & StyleConfigKeys()
The single source of truth mapping each persisted text style to its config-key prefix.
Definition: Configuration.cpp:1280
bool FixedFontInTextControls() const
Use a typewriter font in wizard entry fields that can contain maxima commands?
Definition: Configuration.h:209
bool GetAutoIndent() const
Do we want automatic indentation?
Definition: Configuration.h:505
long LabelWidth() const
Get the width of worksheet labels [in chars].
Definition: Configuration.h:340
void SetRecalcContext(wxDC &dc)
Set the drawing context that is currently active.
Definition: Configuration.h:200
double PrintScale() const
Hide brackets that are not under the pointer?
Definition: Configuration.h:271
wxString GetWorkingDirectory() const
Get maxima's working directory.
Definition: Configuration.h:183
long GetBaseIndent() const
The y position the worksheet starts at.
Definition: Configuration.h:385
void DisplayMode(mathDisplayMode mode)
Tell the config if maxima outputs 1D, 2D or 2D ASCII equations, currently.
Definition: Configuration.h:176
static bool GetAutoWrapCode()
Do we want to have automatic line breaks for code cells?
Definition: Configuration.h:493
long MaxGnuplotMegabytes() const
The maximum number of Megabytes of gnuplot sources we should store.
Definition: Configuration.h:1014
long GetGroupSkip() const
The vertical space between GroupCells.
Definition: Configuration.h:394
void HelpBrowserUserLocation(wxString helpBrowser)
Sets the location of the web browser the user has detected.
Definition: Configuration.h:885
void SetWorkingDirectory(wxString dir)
Set maxima's working directory.
Definition: Configuration.h:179
bool CheckKeepPercent() const
Do we want to display "%e" as "%e" and "%pi" as "%pi"?
Definition: Configuration.h:573
const std::vector< TextStyle > & GetCodeStylesList() const
Which styles affect how code is displayed?
Definition: Configuration.h:1157
static const wxString CharsNeedingQuotes()
Returns a list of chars we need to escape in maxima.
Definition: Configuration.h:321
void SetAppearance(Appearance a)
Choose the appearance and update which style set is active.
Definition: Configuration.h:795
wxString MathJaXURL() const
Returns the URL MathJaX can be found at.
Definition: Configuration.h:902
void UpdateBackgroundBrush()
Refresh the cached document-background brush from the active style set.
Definition: Configuration.cpp:523
void AutodetectMaxima(bool autodetectmaxima)
Autodetect maxima's location?
Definition: Configuration.h:845
void SetChangeAsterisk(bool changeAsterisk)
Use Unicode centered dots for multiplication signs?
Definition: Configuration.h:637
std::random_device::result_type RandomEntropy()
One sample of OS entropy (std::random_device).
Definition: Configuration.h:1192
void PrintScale(double scale)
Define if we want to hide brackets that are not under the pointer.
Definition: Configuration.h:275
void InitStyles()
Initialize the text styles on construction.
Definition: Configuration.cpp:476
static void SetDebugmode()
Enable costly checks.
Definition: Configuration.h:1168
static double GetMinZoomFactor()
The lower limit we allow for the zoom factor.
Definition: Configuration.h:236
bool AutodetectMaxima() const
Autodetect maxima's location? (If false the user-specified location is used)
Definition: Configuration.h:843
wxScrolledCanvas * GetWorkSheet() const
Get the worksheet canvas this configuration storage is valid for.
Definition: Configuration.h:979
bool ClipToDrawRegion() const
Do we want to save time by only redrawing the area currently shown on the screen?
Definition: Configuration.h:1044
void SetZoomFactor(double newzoom)
Sets the zoom factor the worksheet is displayed at.
Definition: Configuration.cpp:945
bool ShowBrackets() const
Show the cell brackets [displayed left to each group cell showing its extend]?
Definition: Configuration.h:767
bool FixReorderedIndices() const
Renumber out-of-order cell labels on saving.
Definition: Configuration.h:896
void AddMaximaOperator(const wxString &name)
Register name as an operator known to maxima.
Definition: Configuration.h:166
bool GetPrinting() const
Are we currently printing?
Definition: Configuration.h:618
wxBrush GetBackgroundBrush() const
Get the brush to be used for the worksheet background.
Definition: Configuration.h:213
void SetIndent(long indent)
Set the indentation of GroupCells.
Definition: Configuration.h:406
long GetLineWidth() const
Returns the maximum sensible width for a text line [in characters]:
Definition: Configuration.cpp:910
void FixedFontInTextControls(bool fixed)
Use a typewriter font in wizard entry fields that can contain maxima commands?
Definition: Configuration.h:211
static EscCodeIterator EscCodesEnd()
Iterators over the escape code list.
Definition: Configuration.cpp:502
void RequestAdjustWorksheetSize() const
Ask the view (if any) to re-adjust its worksheet (scroll) size.
Definition: Configuration.h:1083
wxCoord GetCellBracketWidth() const
The width we allocate for our cell brackets.
Definition: Configuration.h:258
void MaximaUserLocation(wxString maxima)
Sets the location of the maxima binary.
Definition: Configuration.h:862
bool OfferInternalHelpBrowser() const
If we decide that the HTML browser in the sidebar doesn't work for every platform....
Definition: Configuration.cpp:1153
void ClipToDrawRegion(bool clipToDrawRegion)
Do we want to save time by only redrawing the area currently shown on the screen?
Definition: Configuration.h:1046
wxColour GetColor(TextStyle style)
Gets the color for a text style.
Definition: Configuration.cpp:1125
long GetCursorWidth() const
How much vertical space is to be left between two group cells?
Definition: Configuration.h:369
static wxString m_configfileLocation_override
Where to store the configuration.
Definition: Configuration.h:223
void LineWidth_em(long width)
Set the minimum sensible line width in widths of a letter.
Definition: Configuration.h:467
std::default_random_engine & RandomEngine()
The pseudo-random engine, e.g. to feed a distribution.
Definition: Configuration.h:1194
void HideBrackets(bool hide)
Define if we want to hide brackets that are not under the pointer.
Definition: Configuration.h:268
double GetDefaultLineWidth() const
Calculates the default line width for the worksheet.
Definition: Configuration.h:446
wxCoord Scale_Px(double px) const
Scales a distance [in pixels] according to the zoom factor.
Definition: Configuration.cpp:1132
void ReadConfig()
Read the config from the wxConfig object.
Definition: Configuration.cpp:581
void SetRecalculateRequestCallback(std::function< void(GroupCell *)> callback)
Set the callback RequestRecalculate() notifies the view through.
Definition: Configuration.h:1002
InitOpt
Definition: Configuration.h:149
@ temporary
This configuration is temporary and shouldn't redetect Maxima etc.
Definition: Configuration.h:151
bool InternalHelpBrowser() const
Use the internal help browser? If not a external web browser is used.
Definition: Configuration.h:870
void SetParenthesisDrawMode(drawMode mode)
Which way do we want to draw parenthesis?
Definition: Configuration.h:945
drawMode
Definition: Configuration.h:143
@ ascii
Use ascii characters only.
Definition: Configuration.h:144
@ handdrawn
A parenthesis sign that was created using draw commands.
Definition: Configuration.h:145
void SetCanvasSize(wxSize siz)
Sets the size of the current worksheet's visible window.
Definition: Configuration.h:758
void MaximaParameters(wxString parameters)
The parameters we pass to the maxima binary.
Definition: Configuration.h:850
void NotifyOfCellRedraw(const Cell *cell)
Record that this cell has been drawn to ReportMultipleRedraws()
Definition: Configuration.cpp:877
long ShowLength() const
The choice for the "maximum output length to display" setting.
Definition: Configuration.h:940
void ResetAllToDefaults()
Reset the whole configuration to its default values.
Definition: Configuration.cpp:232
void SetMaximaEnvVar(const wxString &name, const wxString &value)
Set a custom environment variable for the maxima process.
Definition: Configuration.h:171
void ReadStyles(const wxString &file={})
Reads the style settings.
Definition: Configuration.cpp:985
htmlExportFormat
The export formats we support for HTML equations.
Definition: Configuration.h:125
void SetAdjustWorksheetSizeRequestCallback(std::function< void()> callback)
Set the callback RequestAdjustWorksheetSize() notifies the view through.
Definition: Configuration.h:1086
bool UseUserLabels() const
Do we want at all to show labels?
Definition: Configuration.h:822
bool UpdateNeeded() const
true means: The system's config storage has changed since the configuration has been read
Definition: Configuration.cpp:1169
std::size_t ShowLength_Bytes() const
The "maximum output length to display" setting in cells.
Definition: Configuration.cpp:1305
long GetDisplayedDigits() const
Returns the maximum number of displayed digits.
Definition: Configuration.h:680
const Style * GetStyle(TextStyle textStyle) const
Get the text Style for a given text style identifier.
Definition: Configuration.h:963
bool AutodetectHelpBrowser() const
Autodetect the web browser? (If false the user-specified location is used)
Definition: Configuration.h:865
void SetWorkSheet(wxScrolledCanvas *workSheet)
Set the worksheet canvas this configuration storage is valid for.
Definition: Configuration.cpp:201
bool IsOperator(wxString name) const
Coincides name with a operator known to maxima?
Definition: Configuration.h:164
void ShowLength(long length)
The choice for the "maximum output length to display" setting.
Definition: Configuration.h:936
void LabelWidth(long labelWidth)
Set the width of worksheet labels [in chars].
Definition: Configuration.h:343
void RequestRecalculate(GroupCell *group) const
Ask the view (if any) to recalculate the layout starting at the given group cell.
Definition: Configuration.h:999
const std::vector< TextStyle > & GetColorOnlyStylesList() const
Which styles affect only colors?
Definition: Configuration.h:1161
bool PrintBrackets() const
Print the cell brackets [displayed left to each group cell showing its extend]?
Definition: Configuration.h:778
Caches which characters each font can actually render.
Definition: FontRenderabilityCache.h:65
bool FontRendersChar(wxUniChar ch, const wxFont &font)
True if we are confident that the font renders this char.
Definition: FontRenderabilityCache.cpp:32
A cell grouping input (and, if there is one, also the output) cell to a foldable item.
Definition: GroupCell.h:87
What we know about the Maxima instance we are talking to.
Definition: MaximaSessionInfo.h:48
wxString GetWorkingDirectory() const
Maxima's working directory.
Definition: MaximaSessionInfo.h:95
bool InLispMode() const
Is maxima currently in lisp mode (where commands need no trailing ";")?
Definition: MaximaSessionInfo.h:108
void SetLispType(const wxString &type)
Sets the type of the lisp the connected Maxima runs on.
Definition: MaximaSessionInfo.h:92
void SetMaximaArch(const wxString &arch)
Sets the processor architecture the connected Maxima runs on.
Definition: MaximaSessionInfo.h:84
wxString GetMaximaArch() const
The processor architecture the connected Maxima runs on.
Definition: MaximaSessionInfo.h:82
wxString GetLispVersion() const
The version of the lisp the connected Maxima runs on.
Definition: MaximaSessionInfo.h:86
wxString DemoDir() const
The directory maxima's demo files live in.
Definition: MaximaSessionInfo.h:103
void AddOperator(const wxString &name)
Registers name as an operator known to maxima.
Definition: MaximaSessionInfo.h:75
void SetWorkingDirectory(wxString dir)
Sets maxima's working directory.
Definition: MaximaSessionInfo.h:97
wxString ShareDir() const
The directory maxima's shared files (e.g. the manual) live in.
Definition: MaximaSessionInfo.h:99
wxString GetLispType() const
The type of the lisp the connected Maxima runs on.
Definition: MaximaSessionInfo.h:90
void SetMaximaVersion(const wxString &version)
Sets the version of the connected Maxima.
Definition: MaximaSessionInfo.h:80
void SetLispVersion(const wxString &version)
Sets the version of the lisp the connected Maxima runs on.
Definition: MaximaSessionInfo.h:88
wxString GetMaximaVersion() const
The version of the connected Maxima.
Definition: MaximaSessionInfo.h:78
bool IsOperator(const wxString &name) const
Is this name an operator known to maxima?
Definition: MaximaSessionInfo.h:72
Clears the configuration's "Clip to draw region" flag until this class is left.
Definition: Configuration.h:1386
Sets the configuration's "printing" flag until this class is left.
Definition: Configuration.h:1369
The state of the current worksheet render pass.
Definition: RenderContext.h:60
void SetRecalcDC(wxDC *dc)
Tells us which dc to measure text sizes on.
Definition: RenderContext.h:79
void SetWorksheetPosition(wxPoint worksheetPosition)
Sets where the worksheet is to be drawn.
Definition: RenderContext.h:170
void ClearLayoutCancelled()
Stops the layout deadline and clears the cancelled flag.
Definition: RenderContext.h:187
wxRect GetUpdateRegion() const
The rectangle of the worksheet that is currently being redrawn.
Definition: RenderContext.h:105
void SetVisibleRegion(wxRect visibleRegion)
Sets the rectangle of the worksheet that is currently visible.
Definition: RenderContext.h:112
bool ClipToDrawRegion() const
Do we want to omit drawing outside the current update region?
Definition: RenderContext.h:162
bool Printing() const
Are we currently rendering for the printer rather than the screen?
Definition: RenderContext.h:115
void SetLayoutDeadline(int seconds)
Starts a layout deadline this many seconds in the future.
Definition: RenderContext.h:179
wxBrush GetBackgroundBrush() const
The brush the worksheet's background is painted with.
Definition: RenderContext.h:174
void SetCanvasSize(wxSize siz)
Sets the size of the worksheet's visible window.
Definition: RenderContext.h:102
bool IsLayoutCancelled() const
Has the current layout pass exceeded its deadline?
Definition: RenderContext.h:193
wxDC * GetRecalcDC() const
The dc "recalculate" (measuring text) currently draws to.
Definition: RenderContext.h:77
wxPoint GetWorksheetPosition() const
Where is the worksheet to be drawn?
Definition: RenderContext.h:168
wxSize GetCanvasSize() const
The size of the worksheet's visible window.
Definition: RenderContext.h:100
wxRect GetVisibleRegion() const
The rectangle of the worksheet that is currently visible.
Definition: RenderContext.h:110
void SetUpdateRegion(wxRect rect)
Sets the rectangle of the worksheet that is currently being redrawn.
Definition: RenderContext.h:107
Text Style Definition.
Definition: TextStyle.h:63
Storage for the worksheet's per-TextStyle text styles.
Definition: Styles.h:42
const std::vector< TextStyle > & ColorOnlyStylesList() const
The styles where only the color is configurable.
Definition: Styles.h:107
const std::vector< TextStyle > & MathStylesList() const
The styles that share the 2d-math font.
Definition: Styles.h:105
const std::vector< TextStyle > & CodeStylesList() const
The styles that share the code-default font/attributes.
Definition: Styles.h:103
void SetUseDark(bool dark)
Select which set indexing/iteration return.
Definition: Styles.h:57
Definition: CellPointers.h:32
Definition: Configuration.h:99
One mechanically persisted scalar setting: its config key and the member variable it is stored in.
Definition: Configuration.h:548
const wxChar * key
The key the setting is stored under in the configuration store.
Definition: Configuration.h:550
std::variant< bool Configuration::*, int Configuration::*, long Configuration::*, double Configuration::*, wxString Configuration::* > member
Which member of Configuration holds the setting's cached value.
Definition: Configuration.h:555