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;
79class GroupCell;
80template<class T> class wxScrolled;
82
98{
99public:
101 std::atomic<long> manualAnchorsFromBuiltin{0};
102 std::atomic<long> manualAnchorsFromCache{0};
103 std::atomic<long> manualAnchorsCompiled{0};
104 std::atomic<long> maximaProcessesSpawned{0};
105 std::atomic<long> fontCacheHits{0};
106 std::atomic<long> fontCacheMisses{0};
107 std::atomic<long> recalculationNeeded_FontInvalid{0};
108 std::atomic<long> recalculationNeeded_SizeInvalid{0};
109 std::atomic<long> recalculationNeeded_FontMismatch{0};
110 std::atomic<long> recalculationNeeded_ConfigChanged{0};
111 std::atomic<long> recalculationNeeded_CellsAppended{0};
112 std::atomic<long> recalculationNeeded_EditorDirty{0};
113 std::atomic<long> cellsConvertedToLinear{0};
114 std::atomic<long> cellsConvertedTo2D{0};
123 std::atomic<long> cellsDrawnAtWrongFontSize{0};
125 std::atomic<long> worksheetRepaints{0};
133 std::atomic<long> worksheetFullRepaints{0};
134 void Report() const;
135 };
136 static PerformanceStats g_stats;
137
138 enum maximaHelpFormat{
139 maxima = 0,
140 frontend = 1,
141 browser = 2
142 };
145 {
150 bitmap = 1,
154 svg = 3,
158 html_export_invalidChoice
159 };
160
161 enum showLabels : int8_t
162 {
163 labels_automatic = 0,
164 labels_prefer_user = 1,
165 labels_useronly = 2,
166 labels_none = 3,
167 labels_invalidSelection
168 };
169
171 {
173 handdrawn
174 };
175
177 {
178 none,
179 temporary
180 };
181
182 enum mathDisplayMode
183 {
184 display_2d,
185 display_2dASCII,
186 display_2dUNICODE,
187 display_1dASCII
188 };
189
190 typedef std::unordered_map <wxString, bool, wxStringHash> StringBoolHash;
192 bool IsOperator(wxString name) const {return m_maximaSession.IsOperator(name);}
194 void AddMaximaOperator(const wxString &name){m_maximaSession.AddOperator(name);}
195 const wxEnvVariableHashMap& MaximaEnvVars() const {return m_maximaEnvVars;}
197 void ClearMaximaEnvVars(){m_maximaEnvVars.clear();}
199 void SetMaximaEnvVar(const wxString &name, const wxString &value){m_maximaEnvVars[name] = value;}
200
202 mathDisplayMode DisplayMode() const {return m_displayMode;}
204 void DisplayMode(mathDisplayMode mode ) {m_displayMode = mode;}
205
207 void SetWorkingDirectory(wxString dir)
208 { m_maximaSession.SetWorkingDirectory(std::move(dir)); }
209
211 wxString GetWorkingDirectory() const
212 { return m_maximaSession.GetWorkingDirectory(); }
213
215 void ReadConfig();
216
221 explicit Configuration(wxDC *dc = {}, InitOpt options = none);
223
225 void ResetAllToDefaults();
226
228 void SetRecalcContext(wxDC &dc)
229 {
230 m_renderContext.SetRecalcDC(&dc);
231 }
232 void UnsetContext() {m_renderContext.SetRecalcDC(NULL);}
233
235 void SetBackgroundBrush(const wxBrush &brush);
237 bool FixedFontInTextControls() const {return m_fixedFontTC;}
239 void FixedFontInTextControls(bool fixed) {m_fixedFontTC = fixed;}
241 wxBrush GetBackgroundBrush() const {return m_renderContext.GetBackgroundBrush();}
243 wxBrush GetTooltipBrush() const {return m_tooltipBrush;}
244
245 virtual ~Configuration();
246
252
253 using EscCodeContainer = std::unordered_map<wxString, wxString, wxStringHash>;
254 using EscCodeIterator = EscCodeContainer::const_iterator;
255
257 static const wxString &GetEscCode(const wxString &key);
259 static EscCodeIterator EscCodesBegin();
261 static EscCodeIterator EscCodesEnd();
262
264 static double GetMinZoomFactor()
265 { return 0.1; }
266
268 static double GetMaxZoomFactor()
269 { return 32.0; }
270
277 double GetInterEquationSkip() const
278 {
280 return 0;
281 else
282 return GetZoomFactor() * m_styleStore[TS_MATH].GetFontSize() / 2;
283 }
284
286 wxCoord GetCellBracketWidth() const
287 {
288 return static_cast<wxCoord>(GetZoomFactor() * 16);
289 }
290
292 bool HideBrackets() const
293 { return m_hideBrackets; }
294
296 void HideBrackets(bool hide){m_hideBrackets = hide;}
297
305 bool OverlayScrollbars() const
306 { return m_overlayScrollbars; }
307
309 void OverlayScrollbars(bool overlay){m_overlayScrollbars = overlay;}
310
312 double PrintScale() const
313 { return m_printScale; }
314
316 void PrintScale(double scale){m_printScale = scale;}
317
318 void PrintMargin_Top(double margin){m_printMargin_Top = margin;}
319 void PrintMargin_Bot(double margin){m_printMargin_Bot = margin;}
320 void PrintMargin_Left(double margin){m_printMargin_Left = margin;}
321 void PrintMargin_Right(double margin){m_printMargin_Right = margin;}
322 double PrintMargin_Top() const {return m_printMargin_Top;}
323 double PrintMargin_Bot() const {return m_printMargin_Bot;}
324 double PrintMargin_Left() const {return m_printMargin_Left;}
325 double PrintMargin_Right() const {return m_printMargin_Right;}
326
328 void SetZoomFactor(double newzoom);
329
331 void SetZoomFactor_temporarily(double newzoom){
332 if(m_zoomFactor != newzoom)
334 m_zoomFactor = newzoom;
335 }
336
341 wxCoord Scale_Px(double px) const;
342 AFontSize Scale_Px(AFontSize size) const;
343
345 double GetZoomFactor() const
346 { return m_zoomFactor; }
347
349 wxDC *GetRecalcDC() const
350 { return m_renderContext.GetRecalcDC(); }
351
352 void SetRecalcDC(wxDC *dc)
353 { m_renderContext.SetRecalcDC(dc); }
354
355 wxString GetFontName(TextStyle ts = TS_CODE_DEFAULT) const;
356
357 // cppcheck-suppress functionStatic
358 // cppcheck-suppress functionConst
359 wxString GetSymbolFontName() const;
360
362 static const wxString CharsNeedingQuotes()
363 {
364 return wxString(wxS("°,\\'\"()[]-{}^+*/&§?:;=#<>$"));
365 }
366
367 wxFontWeight IsBold(long st) const;
368
369 wxFontStyle IsItalic(long st) const;
370
371 bool IsUnderlined(long st) const {return m_styleStore[st].IsUnderlined();}
372
377 wxCoord GetLabelWidth() const
378 { return m_labelWidth * 14; }
379
381 long LabelWidth() const
382 { return m_labelWidth; }
384 void LabelWidth(long labelWidth)
385 {
386 if(m_labelWidth != labelWidth)
388 m_labelWidth = labelWidth;
389 }
390
392 wxCoord GetIndent() const
393 {
394 if (m_indent < 0)
395 return 3 * GetCellBracketWidth() / 2;
396 else
397 return m_indent;
398 }
399
405 wxSize GetPPI() const;
406 int AutosaveMinutes() const {return m_autoSaveMinutes;}
407 void AutosaveMinutes(int minutes){m_autoSaveMinutes = minutes;}
408
410 long GetCursorWidth() const
411 {
412 long ppi;
413
414 if(!GetPrinting())
415 ppi = GetPPI().x;
416 else
417 ppi = 96;
418
419 if (ppi / 45 < 1)
420 return 1;
421 else
422 return ppi / 45;
423 }
424
426 long GetBaseIndent() const
427 {
428 if (GetCursorWidth() < 12)
429 return 12;
430 else
431 return 4 + GetCursorWidth();
432 }
433
435 long GetGroupSkip() const
436 {
437 if (GetCursorWidth() < 10)
438 return 20;
439 else
440 return 10 + GetCursorWidth();
441 }
442
447 void SetIndent(long indent)
448 {
449 if(m_indent != indent)
451 m_indent = indent;
452 }
453
454 bool IncrementalSearch() const {return m_incrementalSearch;}
455
456
457 void IncrementalSearch(bool incrementalSearch) { m_incrementalSearch = incrementalSearch; }
458
459 int MaxLayoutTime() const { return m_maxLayoutTime; }
460 void MaxLayoutTime(int time) { m_maxLayoutTime = time; }
461
462 enum class LayoutStrategy {
463 layout2DWheneverPossible = 0,
464 layout2DIfFits = 1,
465 layoutPrefer1D = 2
466 };
467 LayoutStrategy GetLayoutStrategy() const { return m_layoutStrategy; }
468 void SetLayoutStrategy(LayoutStrategy s) { m_layoutStrategy = s; }
469
470 void SetLayoutDeadline(int seconds) {
471 m_renderContext.SetLayoutDeadline(seconds);
472 }
473 void ClearLayoutCancelled() {
474 m_renderContext.ClearLayoutCancelled();
475 }
476 bool IsLayoutCancelled() const {
477 return m_renderContext.IsLayoutCancelled();
478 }
479
482 {
484 }
485
487 double GetDefaultLineWidth() const
488 {
489 if (GetZoomFactor() < 1.0)
490 return 1.0;
491 else
492 return GetZoomFactor();
493 }
494
496 long LineWidth_em() const
497 {
498 if(!GetPrinting())
499 return m_lineWidth_em;
500 else
501 return 10000;
502 }
503
504 bool AutoSaveAsTempFile() const {return m_autoSaveAsTempFile;}
505 void AutoSaveAsTempFile(bool asTempFile){m_autoSaveAsTempFile = asTempFile;}
506
508 void LineWidth_em(long width)
509 { m_lineWidth_em = width; }
510
512 // On big 16:9 screens text tends to get \b very wide before it hits the right margin.
513 // But text blocks that are 1 meter wide and 2 cm high feel - weird.
514 long GetLineWidth() const;
515
519 long GetAsciiArtColumns() const;
520
521 bool SaveUntitled() const { return m_saveUntitled;}
522 void SaveUntitled(bool save) {m_saveUntitled = save;}
523
524 bool CursorJump() const { return m_cursorJump;}
525 void CursorJump(bool save){m_cursorJump = save;}
526
527 bool NumpadEnterEvaluates() const { return m_numpadEnterEvaluates;}
528 void NumpadEnterEvaluates(bool eval){m_numpadEnterEvaluates = eval;}
529
530 bool SaveImgFileName() const { return m_saveImgFileName;}
531 void SaveImgFileName(bool save) { m_saveImgFileName = save;}
532
534 bool GetAutoWrap() const
535 { return m_autoWrap > 0; }
536
538 bool GetAutoWrapCode() const
539 { return m_autoWrap > 1; }
540
552 void SetAutoWrap(long autoWrap){
553 m_autoWrap = autoWrap;
554 if (m_autoWrap < 0)
555 m_autoWrap = 0;
556 if (m_autoWrap > 2)
557 m_autoWrap = 1;
558 }
559
561 bool GetAutoIndent() const
562 { return m_autoIndent; }
563
564 void SetAutoIndent(bool autoIndent){m_autoIndent = autoIndent;}
565
567 bool IndentMaths() const {return m_indentMaths;}
568 void IndentMaths(bool indent){
569 if(m_indentMaths != indent)
571 m_indentMaths = indent;}
572 AFontSize GetFontSize(TextStyle st) const { return m_styleStore[st].GetFontSize(); }
573
574 static const wxString &GetStyleName(TextStyle textStyle);
575
581 void ReadStyles(const wxString &file = {});
582
587 void WriteStyles(const wxString &file = {});
588 void WriteStyles(wxConfigBase *config);
589 void WriteSettings(const wxString &file = {});
597 static const std::vector<std::pair<TextStyle, wxString>> &StyleConfigKeys();
598
606 const wxChar *key;
608 std::variant<bool Configuration::*, int Configuration::*,
609 long Configuration::*, double Configuration::*,
610 wxString Configuration::*>
612 };
623 static const std::vector<ScalarSetting> &ScalarConfigSettings();
624 void MakeStylesConsistent();
625 void Outdated(bool outdated)
626 { m_outdated = outdated; }
627
629 bool CheckKeepPercent() const
630 { return m_keepPercent; }
631
633 void SetKeepPercent(bool keepPercent)
634 {
635 if(m_keepPercent != keepPercent)
637 m_keepPercent = keepPercent;
638 }
639
640 wxString GetTeXCMRI() const
641 { return m_fontCMRI; }
642
643 wxString GetTeXCMSY() const
644 { return m_fontCMSY; }
645
646 wxString GetTeXCMEX() const
647 { return m_fontCMEX; }
648
649 wxString GetTeXCMMI() const
650 { return m_fontCMMI; }
651
652 wxString GetTeXCMTI() const
653 { return m_fontCMTI; }
654
655 bool ShowCodeCells() const
656 { return m_showCodeCells; }
657
658 void ShowCodeCells(bool show);
659
666 void SetPrinting(bool printing);
667
674 bool GetPrinting() const
675 { return m_renderContext.Printing(); }
676
678 wxColour GetColor(TextStyle style);
679
680
681 bool UsePngCairo() const { return m_usepngCairo;}
682 void UsePngCairo(bool usepngCairo) { m_usepngCairo = usepngCairo;}
683
684 bool GetMatchParens() const { return m_matchParens; }
685 void SetMatchParens(bool matchParens) { m_matchParens = matchParens; }
686 bool ShowMatchingParens() const { return m_showMatchingParens; }
687 void ShowMatchingParens(bool show) { m_showMatchingParens = show; }
688
690 bool GetChangeAsterisk() const{ return m_changeAsterisk; }
691
693 void SetChangeAsterisk(bool changeAsterisk) {
694 if(m_changeAsterisk != changeAsterisk)
696 m_changeAsterisk = changeAsterisk;
697 }
698
699 bool HidemultiplicationSign() const {return m_hidemultiplicationsign;}
700
701 void HidemultiplicationSign(bool show) {
702 if(m_hidemultiplicationsign != show)
704 m_hidemultiplicationsign = show;
705 }
706
707 bool Latin2Greek() const
708 {return m_latin2greek;}
709
710 void Latin2Greek(bool latin2greek) {
711 if(m_latin2greek != latin2greek)
713 m_latin2greek = latin2greek;
714 }
715
716 bool GreekSidebar_ShowLatinLookalikes() const {return m_greekSidebar_ShowLatinLookalikes;}
717 void GreekSidebar_ShowLatinLookalikes(bool show){m_greekSidebar_ShowLatinLookalikes = show;}
718
719 bool GreekSidebar_Show_mu() const {return m_greekSidebar_Show_mu;}
720 void GreekSidebar_Show_mu(bool show) {m_greekSidebar_Show_mu = show;}
721
722 wxString SymbolPaneAdditionalChars() const
723 {return m_symbolPaneAdditionalChars;}
724 void SymbolPaneAdditionalChars(wxString symbols) {m_symbolPaneAdditionalChars = std::move(symbols);}
725
727 bool NotifyIfIdle() const
728 { return m_notifyIfIdle; }
729
730 void NotifyIfIdle(bool notify) {m_notifyIfIdle = notify;}
731
734 { return m_findDialogDockable; }
735
736 void FindDialogDockable(bool dockable) {m_findDialogDockable = dockable;}
737
743 { return m_displayedDigits; }
744
745 void SetDisplayedDigits(long displayedDigits)
746 {
747 wxASSERT_MSG(displayedDigits >= 0, _("Bug: Maximum number of digits that is to be displayed is too low!"));
748 if(m_displayedDigits != displayedDigits)
750 m_displayedDigits = displayedDigits;
751 }
752
755 {
756 public:
757 FileToSave(const wxString &filename, const wxMemoryBuffer &data):
758 m_data(data),
759 m_filename(filename)
760 {
761 }
762 const wxString FileName() const{return m_filename;}
763 const wxMemoryBuffer Data() const{return m_data;}
764 private:
765 const wxMemoryBuffer m_data;
766 const wxString m_filename;
767 };
768
771 {
772 public:
773 TextsnippetToDraw(const wxPoint &pos, const wxString &text, const wxColor &color):
774 m_pos(pos),
775 m_text(text),
776 m_color(color)
777 {
778 }
779 const wxPoint Pos() const{return m_pos;}
780 const wxString Text() const{return m_text;}
781 const wxColor Color() const{return m_color;}
782 private:
783 const wxPoint m_pos;
784 const wxString m_text;
785 const wxColor m_color;
786 };
787
788 void PushFileToSave(const wxString &filename, const wxMemoryBuffer &data)
789 { m_filesToSave.emplace_front(FileToSave(filename, data)); }
790
791 wxRect GetUpdateRegion() const {return m_renderContext.GetUpdateRegion();}
792 const std::list<FileToSave> &GetFilesToSave() const {return m_filesToSave;}
793 void ClearFilesToSave () { m_filesToSave.clear();}
794 void SetUpdateRegion(wxRect rect){m_renderContext.SetUpdateRegion(rect);}
795
798 bool InUpdateRegion(wxRect rect) const;
799
800 bool GetInsertAns() const
801 { return m_insertAns; }
802
803 void SetInsertAns(bool insertAns){ m_insertAns = insertAns; }
804
805 bool GetOpenHCaret() const
806 { return m_openHCaret; }
807
808 void SetOpenHCaret(bool openHCaret){ m_openHCaret = openHCaret; }
809
810 bool RestartOnReEvaluation() const
811 { return m_restartOnReEvaluation; }
812
813 void RestartOnReEvaluation(bool arg){ m_restartOnReEvaluation = arg; }
814
816 wxSize GetCanvasSize() const
817 { return m_renderContext.GetCanvasSize(); }
818
820 void SetCanvasSize(wxSize siz)
821 {
822 if(GetCanvasSize().GetWidth() != siz.GetWidth() ||
823 GetCanvasSize().GetHeight() != siz.GetHeight())
825 m_renderContext.SetCanvasSize(siz);
826 }
827
845 { return m_rightToLeftDocument; }
846
847 bool RightToLeftDocument(bool rightToLeft)
848 {
849 if (m_rightToLeftDocument != rightToLeft)
851 return m_rightToLeftDocument = rightToLeft;
852 }
853
855 bool ShowBrackets() const
856 { return m_showBrackets; }
857
858 bool ShowBrackets(bool show)
859 {
860 if(m_showBrackets != show)
862 return m_showBrackets = show;
863 }
864
866 bool PrintBrackets() const
867 { return m_printBrackets; }
868
869 showLabels GetLabelChoice() const
870 { return m_showLabelChoice; }
871
872 bool ShowInputLabels() const {return m_showInputLabels;}
873 void ShowInputLabels(bool show) {
874 if(m_showInputLabels != show)
876 m_showInputLabels = show;
877 }
878
880 enum class Appearance { light, dark, followSystem };
881 Appearance GetAppearance() const { return m_appearance; }
884 m_appearance = a;
885 m_styleStore.SetUseDark(UseDarkMode());
887 }
891 bool UseDarkMode() const {
892 if (m_appearance == Appearance::dark) return true;
893 if (m_appearance == Appearance::light) return false;
894 return SystemIsDark();
895 }
897 static bool SystemIsDark();
898
899 long RecentItems(){return std::max(m_recentItems, static_cast<long>(0));}
900 void RecentItems(long items){ m_recentItems = items; }
901
904 { return (m_showLabelChoice < labels_useronly); }
905
907 bool UseUserLabels() const
908 { return m_showLabelChoice > labels_automatic; }
909
911 bool ShowLabels() const
912 { return m_showLabelChoice < labels_none; }
913
915 void SetLabelChoice(showLabels choice) {
916 if(m_showLabelChoice != choice)
918 m_showLabelChoice = choice;
919 }
920
921 bool PrintBrackets(bool print)
922 {
923 m_printBrackets = print;
924 return print;
925 }
926
928 bool AutodetectMaxima() const {return m_autodetectMaxima;}
930 void AutodetectMaxima(bool autodetectmaxima){m_autodetectMaxima = autodetectmaxima;}
931
933 wxString MaximaParameters() const {return m_maximaParameters;}
935 void MaximaParameters(wxString parameters){m_maximaParameters = std::move(parameters);}
936
938 static wxString MaximaDefaultLocation();
939
941 wxString MaximaLocation() const;
942
944 wxString MaximaUserLocation() const {return m_maximaUserLocation;}
945
947 void MaximaUserLocation(wxString maxima) { m_maximaUserLocation = std::move(maxima); }
948
950 bool AutodetectHelpBrowser() const {return m_autodetectHelpBrowser;}
952 void AutodetectHelpBrowser(bool autodetect){m_autodetectHelpBrowser = autodetect;}
953
955 bool InternalHelpBrowser() const {return m_useInternalHelpBrowser && OfferInternalHelpBrowser();}
957 void InternalHelpBrowser(bool useInternalHelpBrowser)
958 {m_useInternalHelpBrowser = useInternalHelpBrowser;}
959
961 bool SinglePageManual() const {return m_singlePageManual;}
963 void SinglePageManual(bool singlePageManual)
964 {m_singlePageManual = singlePageManual;}
965
967 wxString HelpBrowserUserLocation() const {return m_helpBrowserUserLocation;}
968
970 void HelpBrowserUserLocation(wxString helpBrowser) { m_helpBrowserUserLocation = std::move(helpBrowser);}
971
978 static wxString FindProgram(const wxString &location);
979
982 { return m_fixReorderedIndices; }
983
984 void FixReorderedIndices(bool fix) { m_fixReorderedIndices = fix;}
985
987 wxString MathJaXURL() const {
988 if(m_mathJaxURL_UseUser)
989 return m_mathJaxURL;
990 else
991 return MathJaXURL_Auto();}
992 wxString MathJaXURL_User() const { return m_mathJaxURL;}
993 bool MathJaXURL_UseUser() const { return m_mathJaxURL_UseUser;}
994 void MathJaXURL_UseUser(bool useUser){m_mathJaxURL_UseUser = useUser;}
995
996 bool EnterEvaluates() const {return m_enterEvaluates;}
997 void EnterEvaluates(bool enterEvaluates) {m_enterEvaluates = enterEvaluates;}
998 static wxString MathJaXURL_Auto() { return wxS("https://cdn.jsdelivr.net/npm/mathjax@4/tex-mml-chtml.js");}
1000 void MathJaXURL(wxString url){m_mathJaxURL = std::move(url);}
1001
1002 bool CopyBitmap() const {return m_copyBitmap;}
1003 void CopyBitmap(bool copyBitmap){ m_copyBitmap = copyBitmap; }
1004
1005 bool CopyMathML() const {return m_copyMathML;}
1006 void CopyMathML(bool copyMathML){ m_copyMathML = copyMathML;}
1007 bool CopyMathMLHTML() const {return m_copyMathMLHTML;}
1008 void CopyMathMLHTML(bool copyMathMLHTML){ m_copyMathMLHTML = copyMathMLHTML; }
1009 bool HideMarkerForThisMessage(wxString message);
1010 void HideMarkerForThisMessage(const wxString &message, bool hide)
1011 {m_hideMarkerForThisMessage[message] = hide;}
1012 bool CopyRTF() const {return m_copyRTF;}
1013 void CopyRTF(bool copyRTF) { m_copyRTF = copyRTF; }
1014 bool CopySVG() const {return m_copySVG;}
1015 void CopySVG(bool copySVG) { m_copySVG = copySVG; }
1016 bool CopyEMF() const {return m_copyEMF;}
1017 void CopyEMF(bool copyEMF) { m_copyEMF = copyEMF; }
1018 bool UseSVG() const {return m_useSVG;}
1019 void UseSVG(bool useSVG) { m_useSVG = useSVG ;}
1021 void ShowLength(long length) {
1022 m_showLength = length;
1023 }
1025 long ShowLength() const {return m_showLength;}
1027 std::size_t ShowLength_Bytes() const;
1028
1031 if(m_parenthesisDrawMode != mode)
1033 m_parenthesisDrawMode = mode;
1034 }
1035
1036 void TocShowsSectionNumbers(bool showSectionNumbers) { m_TOCshowsSectionNumbers = showSectionNumbers; }
1037
1038 bool TocShowsSectionNumbers() const {return m_TOCshowsSectionNumbers;}
1039
1040 void UseUnicodeMaths(bool useunicodemaths)
1041 { m_useUnicodeMaths = useunicodemaths; }
1042 bool UseUnicodeMaths() const {return m_useUnicodeMaths;}
1043
1048 const Style *GetStyle(TextStyle textStyle) const { return &m_styleStore[textStyle]; }
1056 Style *GetWritableStyle(TextStyle textStyle) { return &m_styleStore[textStyle]; }
1057
1064 wxScrolledCanvas *GetWorkSheet() const {return m_workSheet;}
1066 void SetWorkSheet(wxScrolledCanvas *workSheet);
1067
1075 DocumentCellPointers *GetDocumentCellPointers() const {return m_documentCellPointers;}
1077 void SetDocumentCellPointers(DocumentCellPointers *p) {m_documentCellPointers = p;}
1079 ViewCellPointers *GetViewCellPointers() const {return m_viewCellPointers;}
1081 void SetViewCellPointers(ViewCellPointers *p) {m_viewCellPointers = p;}
1082
1090 {if (m_recalculateRequest) m_recalculateRequest(group);}
1092 void SetRecalculateRequestCallback(std::function<void(GroupCell *)> callback)
1093 {m_recalculateRequest = std::move(callback);}
1094
1104 {if (m_recalculateAllRequest) m_recalculateAllRequest();}
1106 void SetRecalculateAllRequestCallback(std::function<void()> callback)
1107 {m_recalculateAllRequest = std::move(callback);}
1108
1109 long DefaultPort() const {return m_defaultPort;}
1110 void DefaultPort(long port){m_defaultPort = port;}
1111 bool GetAbortOnError() const {return m_abortOnError;}
1112 void SetAbortOnError(bool abortOnError) {m_abortOnError = abortOnError;}
1113
1114 long GetLanguage() const {return m_language;}
1115 void SetLanguage(long language) {m_language = language;}
1116
1118 long MaxGnuplotMegabytes() const {return m_maxGnuplotMegabytes;}
1119 void MaxGnuplotMegabytes(long megaBytes)
1120 {m_maxGnuplotMegabytes = megaBytes;}
1121
1122 bool OfferKnownAnswers() const {return m_offerKnownAnswers;}
1123 void OfferKnownAnswers(bool offerKnownAnswers)
1124 {m_offerKnownAnswers = offerKnownAnswers;}
1125
1132 bool ScreenReaderAnnouncesMathML() const {return m_screenReaderAnnouncesMathML;}
1134 {m_screenReaderAnnouncesMathML = mathML;}
1135
1136 wxString Documentclass() const {return m_documentclass;}
1137 void Documentclass(wxString clss){m_documentclass = std::move(clss);}
1138 wxString DocumentclassOptions() const {return m_documentclassOptions;}
1139 void DocumentclassOptions(wxString classOptions){m_documentclassOptions = std::move(classOptions);}
1140
1141
1142 htmlExportFormat HTMLequationFormat() const {return m_htmlEquationFormat;}
1143 void HTMLequationFormat(htmlExportFormat HTMLequationFormat)
1144 {m_htmlEquationFormat = HTMLequationFormat;}
1145
1146 AFontSize GetDefaultFontSize() const { return m_styleStore[TS_CODE_DEFAULT].GetFontSize(); }
1147 AFontSize GetMathFontSize() const { return m_styleStore[TS_MATH].GetFontSize(); }
1148
1150 long GetAutosubscript_Num() const {return m_autoSubscript;}
1151 void SetAutosubscript_Num(long autosubscriptnum) {m_autoSubscript = autosubscriptnum;}
1152 wxString GetAutosubscript_string() const;
1154 wxColor DefaultBackgroundColor();
1156 wxColor EditorBackgroundColor();
1158 bool ClipToDrawRegion() const {return m_renderContext.ClipToDrawRegion();}
1160 void ClipToDrawRegion(bool clipToDrawRegion){m_renderContext.ClipToDrawRegion(clipToDrawRegion);}
1161 void SetVisibleRegion(wxRect visibleRegion){
1162 if(m_renderContext.GetVisibleRegion().GetWidth() != visibleRegion.GetWidth())
1164 m_renderContext.SetVisibleRegion(visibleRegion);
1165 }
1166 wxRect GetVisibleRegion() const {return m_renderContext.GetVisibleRegion();}
1167 void SetWorksheetPosition(wxPoint worksheetPosition){m_renderContext.SetWorksheetPosition(worksheetPosition);}
1168 wxPoint GetWorksheetPosition() const {return m_renderContext.GetWorksheetPosition();}
1169 wxString MaximaShareDir() const {return m_maximaSession.ShareDir();}
1170 void MaximaShareDir(wxString dir){m_maximaSession.ShareDir(std::move(dir));}
1171 wxString MaximaDemoDir() const {return m_maximaSession.DemoDir();}
1172 void MaximaDemoDir(wxString dir){m_maximaSession.DemoDir(std::move(dir));}
1173 void InLispMode(bool lisp){m_maximaSession.InLispMode(lisp);}
1174 bool InLispMode() const {return m_maximaSession.InLispMode();}
1175 void BitmapScale(int factor){m_bitmapScale = factor;}
1176 int BitmapScale() const {return m_bitmapScale;}
1177 void DefaultPlotHeight(int px){m_defaultPlotHeight = px;}
1178 int DefaultPlotHeight() const {return m_defaultPlotHeight;}
1179 void DefaultPlotWidth(int px){m_defaultPlotWidth = px;}
1180 int DefaultPlotWidth() const {return m_defaultPlotWidth;}
1181 void DefaultFramerate(double fps){m_defaultFramerate = fps;}
1182 double DefaultFramerate() const {return m_defaultFramerate;}
1183 void TocDepth(int depth){m_tocDepth = depth;}
1184 int TocDepth() const {return m_tocDepth;}
1185 bool TeXExponentsAfterSubscript() const {return m_TeXExponentsAfterSubscript;}
1186 void TeXExponentsAfterSubscript(bool ExponentsAfterSubscript)
1187 {m_TeXExponentsAfterSubscript = ExponentsAfterSubscript;}
1188 bool UsePartialForDiff() const {return m_usePartialForDiff;}
1189 void UsePartialForDiff(bool usePartialForDiff)
1190 {m_usePartialForDiff = usePartialForDiff;}
1198 {if (m_adjustWorksheetSizeRequest) m_adjustWorksheetSizeRequest();}
1200 void SetAdjustWorksheetSizeRequestCallback(std::function<void()> callback)
1201 {m_adjustWorksheetSizeRequest = std::move(callback);}
1203 void NotifyOfCellRedraw(const Cell *cell);
1213 void ReportMultipleRedraws();
1215 bool OfferInternalHelpBrowser() const;
1216 bool WrapLatexMath() const {return m_wrapLatexMath;}
1217 void WrapLatexMath(bool wrapLatexMath){m_wrapLatexMath = wrapLatexMath;}
1218 bool AllowNetworkHelp() const {return m_allowNetworkHelp;}
1219 void AllowNetworkHelp(bool allowNetworkHelp){m_allowNetworkHelp = allowNetworkHelp;}
1220 bool ShowAllDigits() const {return m_showAllDigits;}
1221 void ShowAllDigits(bool shw){
1222 if(m_showAllDigits != shw)
1224 m_showAllDigits = shw;
1225 }
1226 bool LineBreaksInLongNums() const {return m_lineBreaksInLongNums;}
1227 void LineBreaksInLongNums(bool brk){
1228 if(m_lineBreaksInLongNums != brk)
1230 m_lineBreaksInLongNums = brk;
1231 }
1232 int MaxClipbrdBitmapMegabytes() const {return m_maxClipbrd_BitmapMegabytes;}
1233 void MaxClipbrdBitmapMegabytes(int maxClipbrd_BitmapMegabytes)
1234 {m_maxClipbrd_BitmapMegabytes = maxClipbrd_BitmapMegabytes;}
1235
1236 void MaximaUsesHtmlBrowser(bool maximaUsesHhtmlBrowser){m_maximaUsesHhtmlBrowser = maximaUsesHhtmlBrowser;}
1237 bool MaximaUsesHtmlBrowser() const {return m_maximaUsesHhtmlBrowser;}
1238 void MaximaUsesWxmaximaBrowser(bool maximaUsesWxmaximaBrowser){m_maximaUsesWxmaximaBrowser = maximaUsesWxmaximaBrowser;}
1239 bool MaximaUsesWxmaximaBrowser() const {return m_maximaUsesWxmaximaBrowser && OfferInternalHelpBrowser();}
1240 void ExportContainsWXMX(bool exportContainsWXMX){m_exportContainsWXMX = exportContainsWXMX;}
1241 bool ExportContainsWXMX() const {return m_exportContainsWXMX;}
1242 void WizardTab(long tab){m_wizardTab = tab;}
1243 long WizardTab() const {return m_wizardTab;}
1244
1245 void Display2d_Unicode(bool unicode){m_display2d_Unicode = unicode;}
1246 bool Display2d_Unicode() const {return m_display2d_Unicode;}
1247
1248 #ifdef __WXMSW__
1249 bool UseWGnuplot() const {return m_useWgnuplot;}
1250 void UseWGnuplot(bool usewgnuplot) {m_useWgnuplot = usewgnuplot;}
1251 #endif
1252 wxString TexPreamble() const {return m_texPreamble;}
1253 void TexPreamble(wxString texPreamble) {m_texPreamble = std::move(texPreamble);}
1254
1255 void SetMaximaVersion(const wxString &version){m_maximaSession.SetMaximaVersion(version);}
1256 wxString GetMaximaVersion() const {return m_maximaSession.GetMaximaVersion();}
1257 void SetMaximaArch(const wxString &arch){m_maximaSession.SetMaximaArch(arch);}
1258 wxString GetMaximaArch() const {return m_maximaSession.GetMaximaArch();}
1259 void SetLispVersion(const wxString &version){m_maximaSession.SetLispVersion(version);}
1260 wxString GetLispVersion() const {return m_maximaSession.GetLispVersion();}
1261 void SetLispType(const wxString &type){m_maximaSession.SetLispType(type);}
1262 wxString GetLispType() const {return m_maximaSession.GetLispType();}
1263
1265 void InitStyles();
1267 bool FontRendersChar(wxUniChar ch, const wxFont &font = *wxNORMAL_FONT)
1268 { return m_fontRenderability.FontRendersChar(ch, font); }
1269
1271 const std::vector<TextStyle> &GetCodeStylesList() const {return m_styleStore.CodeStylesList();}
1273 const std::vector<TextStyle> &GetMathStylesList() const {return m_styleStore.MathStylesList();}
1275 const std::vector<TextStyle> &GetColorOnlyStylesList() const {return m_styleStore.ColorOnlyStylesList();}
1276 bool StyleAffectsCode(TextStyle style) const;
1277 bool StyleAffectsMathOut(TextStyle style) const;
1278 bool StyleAffectsColorOnly(TextStyle style) const;
1280 bool UpdateNeeded() const;
1282 static void SetDebugmode(){m_debugMode = true;}
1284 static bool GetDebugmode(){return m_debugMode;}
1285 maximaHelpFormat MaximaHelpFormat() const;
1286 void MaximaHelpFormat(maximaHelpFormat format) {m_maximaHelpFormat = format;}
1287
1288private:
1290 MaximaSessionInfo m_maximaSession;
1292 InitOpt m_initOpts;
1298 long m_configId;
1300 std::random_device m_rd;
1302 std::default_random_engine m_eng;
1303 wxEnvVariableHashMap m_maximaEnvVars;
1304public:
1306 std::random_device::result_type RandomEntropy(){return m_rd();}
1308 std::default_random_engine &RandomEngine(){return m_eng;}
1316 std::int_fast32_t CellCfgCnt() const {return m_cellCfgCnt;}
1324 m_cellCfgCnt++;
1326 }
1327 static bool UseThreads(){return m_use_threads;}
1328 static void UseThreads(bool use){m_use_threads = use;}
1329 static void SetMaximaLang(const wxString &LANG){m_maxima_LANG = LANG;}
1330 static wxString GetMaximaLang(){return m_maxima_LANG;}
1331private:
1333 static wxString m_maxima_LANG;
1334 std::list<FileToSave> m_filesToSave;
1336 Styles m_styleStore;
1338 StringBoolHash m_hideMarkerForThisMessage;
1340 FontRenderabilityCache m_fontRenderability;
1341 mathDisplayMode m_displayMode = display_2d;
1342 static bool m_debugMode;
1343 bool m_showInputLabels;
1344 long m_wizardTab;
1345 bool m_display2d_Unicode;
1346 bool m_usePartialForDiff;
1347 bool m_maximaUsesHhtmlBrowser;
1348 bool m_maximaUsesWxmaximaBrowser;
1350 bool m_autoSaveAsTempFile;
1352 long m_language;
1354 bool m_autodetectMaxima;
1356 bool m_autodetectHelpBrowser;
1358 bool m_useInternalHelpBrowser;
1360 bool m_singlePageManual;
1362 bool m_incrementalSearch;
1364 long m_autoSubscript;
1366 wxScrolledCanvas *m_workSheet = NULL;
1368 DocumentCellPointers *m_documentCellPointers = NULL;
1370 ViewCellPointers *m_viewCellPointers = NULL;
1372 std::function<void(GroupCell *)> m_recalculateRequest;
1374 std::function<void()> m_recalculateAllRequest;
1376 std::function<void()> m_adjustWorksheetSizeRequest;
1378 RenderContext m_renderContext;
1379 bool m_wrapLatexMath;
1380 bool m_allowNetworkHelp;
1381 bool m_exportContainsWXMX;
1382 wxString m_texPreamble;
1383
1384 drawMode m_parenthesisDrawMode;
1385 bool m_TeXExponentsAfterSubscript;
1386 wxString m_helpBrowserUserLocation;
1387 wxString m_maximaUserLocation;
1389 bool m_hideBrackets;
1391 bool m_overlayScrollbars;
1393 double m_printScale;
1394 double m_printMargin_Top;
1395 double m_printMargin_Bot;
1396 double m_printMargin_Left;
1397 double m_printMargin_Right;
1399 bool m_rightToLeftDocument;
1401 bool m_showBrackets;
1403 bool m_printBrackets;
1409 bool m_changeAsterisk;
1411 bool m_notifyIfIdle;
1413 bool m_findDialogDockable;
1415 long m_displayedDigits;
1417 long m_autoWrap;
1419 bool m_autoIndent;
1421 bool m_showAllDigits;
1423 bool m_lineBreaksInLongNums;
1425 bool m_matchParens;
1427 bool m_insertAns;
1429 bool m_openHCaret;
1431 long m_labelWidth;
1432 long m_indent;
1433 bool m_latin2greek;
1434 double m_zoomFactor;
1435 bool m_outdated;
1436 wxString m_maximaParameters;
1437 bool m_keepPercent;
1438 bool m_restartOnReEvaluation;
1439 wxString m_fontCMRI, m_fontCMSY, m_fontCMEX, m_fontCMMI, m_fontCMTI;
1440 long m_lineWidth_em;
1441 showLabels m_showLabelChoice;
1442 bool m_fixReorderedIndices;
1443 wxString m_mathJaxURL;
1444 bool m_mathJaxURL_UseUser;
1445 bool m_showCodeCells;
1446 bool m_copyBitmap;
1447 bool m_copyMathML;
1448 bool m_copyMathMLHTML;
1449 long m_showLength;
1450 bool m_usepngCairo;
1451 bool m_enterEvaluates;
1452 bool m_useSVG;
1453 bool m_fixedFontTC;
1454 bool m_copyRTF;
1455 bool m_copySVG;
1456 bool m_copyEMF;
1457 bool m_TOCshowsSectionNumbers;
1458 bool m_useUnicodeMaths;
1459 bool m_indentMaths;
1460 bool m_abortOnError;
1461 bool m_showMatchingParens;
1462 bool m_hidemultiplicationsign;
1463 bool m_offerKnownAnswers;
1464 bool m_screenReaderAnnouncesMathML;
1465 long m_defaultPort;
1466 long m_maxGnuplotMegabytes;
1467 long m_defaultPlotHeight;
1468 long m_defaultPlotWidth;
1469 bool m_saveUntitled;
1470 bool m_cursorJump;
1471 bool m_numpadEnterEvaluates;
1472 bool m_saveImgFileName;
1473 wxString m_documentclass;
1474 wxString m_documentclassOptions;
1475 htmlExportFormat m_htmlEquationFormat;
1476
1477 wxColour m_defaultBackgroundColor;
1478 wxBrush m_tooltipBrush;
1479 bool m_greekSidebar_ShowLatinLookalikes;
1480 #ifdef __WXMSW__
1481 bool m_useWgnuplot = false;
1482 #endif
1483 bool m_greekSidebar_Show_mu;
1484 wxString m_symbolPaneAdditionalChars;
1485 Appearance m_appearance = Appearance::followSystem;
1486 long m_recentItems;
1487 int m_bitmapScale;
1488 double m_defaultFramerate;
1489 int m_tocDepth;
1490 int m_maxClipbrd_BitmapMegabytes;
1491 int m_autoSaveMinutes;
1492 int m_maxLayoutTime;
1493 LayoutStrategy m_layoutStrategy = LayoutStrategy::layout2DIfFits;
1494 wxString m_wxMathML_Filename;
1495 maximaHelpFormat m_maximaHelpFormat;
1496 std::atomic<std::int_fast32_t> m_cellCfgCnt{0};
1497 static bool m_use_threads;
1498};
1499
1502{
1503public:
1504 explicit Printing(Configuration *configuration)
1505 {
1506 m_configuration = configuration;
1507 m_configuration->SetPrinting(true);
1508 }
1509 virtual ~Printing()
1510 {
1511 m_configuration->SetPrinting(false);
1512 }
1513private:
1514 Configuration * m_configuration;
1515};
1516
1519{
1520public:
1521 explicit NoClipToDrawRegion(Configuration *configuration)
1522 {
1523 m_configuration = configuration;
1524 m_configuration->ClipToDrawRegion(false);
1525 }
1526 virtual ~NoClipToDrawRegion()
1527 {
1528 m_configuration->ClipToDrawRegion(true);
1529 }
1530private:
1531 Configuration * m_configuration;
1532};
1533
1534#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:235
A Type-Safe Fixed-Point Font Size.
Definition: FontAttribs.h:99
The base class all cell types the worksheet can consist of are derived from.
Definition: Cell.h:148
Stores the information about a file we need to write during the save process.
Definition: Configuration.h:755
Stores the information about a file we need to write during the save process.
Definition: Configuration.h:771
The configuration storage for the current worksheet.
Definition: Configuration.h:98
void RecalculateForce()
Force every cell to be recalculated on the next layout pass.
Definition: Configuration.h:1323
wxDC * GetRecalcDC() const
Get a drawing context suitable for size calculations.
Definition: Configuration.h:349
Appearance
How wxMaxima chooses between the light and the dark style set.
Definition: Configuration.h:880
wxString HelpBrowserUserLocation() const
Returns the location of the web browser the user has selected.
Definition: Configuration.h:967
wxColor EditorBackgroundColor()
Determine the default background color of editorcells.
Definition: Configuration.cpp:860
long GetAsciiArtColumns() const
How many columns of the ASCII-art monospace font (TS_ASCIIMATHS) fit into GetLineWidth()?...
Definition: Configuration.cpp:920
long GetAutosubscript_Num() const
Get the worksheet this configuration storage is valid for.
Definition: Configuration.h:1150
void SetViewCellPointers(ViewCellPointers *p)
Register the transient view-state half of the cell-pointer registry.
Definition: Configuration.h:1081
bool ShowAutomaticLabels() const
Do we want to show maxima's automatic labels (o1, t1, i1,...)?
Definition: Configuration.h:903
void AutodetectHelpBrowser(bool autodetect)
Autodetect the web browser?
Definition: Configuration.h:952
bool FontRendersChar(wxUniChar ch, const wxFont &font= *wxNORMAL_FONT)
True if we are confident that the font renders this char.
Definition: Configuration.h:1267
void MathJaXURL(wxString url)
Returns the URL MathJaX can be found at.
Definition: Configuration.h:1000
double GetInterEquationSkip() const
Extra space to leave between two equations in output cells.
Definition: Configuration.h:277
static bool GetDebugmode()
Enable costly checks?
Definition: Configuration.h:1284
bool GetChangeAsterisk() const
Use Unicode centered dots for multiplication signs?
Definition: Configuration.h:690
void SetZoomFactor_temporarily(double newzoom)
Sets the zoom factor without storing the new value in the config file/registry.
Definition: Configuration.h:331
static bool SystemIsDark()
Whether the OS reports a dark appearance (false where wx cannot tell).
Definition: Configuration.cpp:493
void SetAutoWrap(long autoWrap)
Sets the auto wrap mode.
Definition: Configuration.h:552
wxSize GetPPI() const
Get the resolution.
Definition: Configuration.cpp:213
bool GetAutoWrap() const
Do we want to have automatic line breaks for text cells?
Definition: Configuration.h:534
void ClearAndEnableRedrawTracing()
Clear the memory of ReportMultipleRedraws()
Definition: Configuration.cpp:870
void ReportMultipleRedraws()
Report if a cell has been redrawn 2 or more times during a simple Draw() command.
Definition: Configuration.cpp:876
static wxString FindProgram(const wxString &location)
Could a maxima binary be found in the path we expect it to be in?
Definition: Configuration.cpp:544
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:1225
void FontChanged()
To be called if a font has changed.
Definition: Configuration.h:481
static double GetMaxZoomFactor()
The upper limit we allow for the zoom factor.
Definition: Configuration.h:268
wxBrush GetTooltipBrush() const
Get the brush to be used for worksheet objects that provide a mouse-over tooltip.
Definition: Configuration.h:243
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:501
bool HideBrackets() const
Hide brackets that are not under the pointer?
Definition: Configuration.h:292
bool NotifyIfIdle() const
Notify the user if maxima is idle?
Definition: Configuration.h:727
void RequestRecalculateAll() const
Ask the view to schedule a recalculation of the WHOLE worksheet.
Definition: Configuration.h:1103
static EscCodeIterator EscCodesBegin()
Iterators over the escape code list.
Definition: Configuration.cpp:509
void SetPrinting(bool printing)
Are we currently printing?
Definition: Configuration.cpp:888
static wxString MaximaDefaultLocation()
The auto-detected maxima location.
Definition: Configuration.cpp:1010
void SetLabelChoice(showLabels choice)
Sets the value of the Configuration ChoiceBox that treads displaying labels.
Definition: Configuration.h:915
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:1163
void SetKeepPercent(bool keepPercent)
Do we want to display "%e" as "%e" and "%pi" as "%pi"?
Definition: Configuration.h:633
bool SinglePageManual() const
Prefer the single-page manual?
Definition: Configuration.h:961
void ClearMaximaEnvVars()
Forget all custom environment variables for the maxima process.
Definition: Configuration.h:197
void WriteStyles(const wxString &file={})
Saves the style settings.
Definition: Configuration.cpp:1331
const std::vector< TextStyle > & GetMathStylesList() const
Which styles affect how math output is displayed?
Definition: Configuration.h:1273
DocumentCellPointers * GetDocumentCellPointers() const
The registry of special cells (selection, active cell, errors, ...) of this document.
Definition: Configuration.h:1075
wxColor DefaultBackgroundColor()
Determine the default background color of the worksheet.
Definition: Configuration.cpp:856
bool UseDarkMode() const
Whether the dark style set is currently active.
Definition: Configuration.h:891
wxString MaximaUserLocation() const
Returns the location of the maxima binary the user has selected.
Definition: Configuration.h:944
Style * GetWritableStyle(TextStyle textStyle)
Get the text Style for a given text style identifier.
Definition: Configuration.h:1056
wxCoord GetLabelWidth() const
Get the width of worksheet labels [in unscaled pixels].
Definition: Configuration.h:377
void WriteSettings(const wxString &file={})
Saves the settings to a file.
Definition: Configuration.cpp:1042
mathDisplayMode DisplayMode() const
Does maxima output 1D, 2D or 2D ASCII equations?
Definition: Configuration.h:202
wxCoord GetIndent() const
Get the indentation of GroupCells.
Definition: Configuration.h:392
std::int_fast32_t CellCfgCnt() const
A counter that increases every time we need to recalculate all worksheet cells.
Definition: Configuration.h:1316
bool ShowLabels() const
Do we want at all to show labels?
Definition: Configuration.h:911
bool FindDialogDockable() const
Show "Find and Replace" as a dockable sidebar instead of a floating dialog?
Definition: Configuration.h:733
wxString MaximaParameters() const
Parameters to the maxima binary.
Definition: Configuration.h:933
wxSize GetCanvasSize() const
Reads the size of the current worksheet's visible window. See SetCanvasSize.
Definition: Configuration.h:816
void InternalHelpBrowser(bool useInternalHelpBrowser)
Use the internal help browser? If not a external web browser is used.
Definition: Configuration.h:957
double GetZoomFactor() const
Determines the zoom factor the worksheet is displayed at.
Definition: Configuration.h:345
long LineWidth_em() const
The minimum sensible line width in widths of a letter.
Definition: Configuration.h:496
void SinglePageManual(bool singlePageManual)
Prefer the single-page manual?
Definition: Configuration.h:963
bool IndentMaths() const
Do we want to indent all maths?
Definition: Configuration.h:567
wxString MaximaLocation() const
Returns the location of the maxima binary.
Definition: Configuration.cpp:1003
void SetBackgroundBrush(const wxBrush &brush)
Set the brush to be used for the worksheet background.
Definition: Configuration.cpp:538
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:1324
bool FixedFontInTextControls() const
Use a typewriter font in wizard entry fields that can contain maxima commands?
Definition: Configuration.h:237
bool GetAutoIndent() const
Do we want automatic indentation?
Definition: Configuration.h:561
long LabelWidth() const
Get the width of worksheet labels [in chars].
Definition: Configuration.h:381
void SetRecalcContext(wxDC &dc)
Set the drawing context that is currently active.
Definition: Configuration.h:228
double PrintScale() const
Hide brackets that are not under the pointer?
Definition: Configuration.h:312
wxString GetWorkingDirectory() const
Get maxima's working directory.
Definition: Configuration.h:211
long GetBaseIndent() const
The y position the worksheet starts at.
Definition: Configuration.h:426
void SetRecalculateAllRequestCallback(std::function< void()> callback)
Set the callback RequestRecalculateAll() / RecalculateForce() notify through.
Definition: Configuration.h:1106
void DisplayMode(mathDisplayMode mode)
Tell the config if maxima outputs 1D, 2D or 2D ASCII equations, currently.
Definition: Configuration.h:204
long MaxGnuplotMegabytes() const
The maximum number of Megabytes of gnuplot sources we should store.
Definition: Configuration.h:1118
long GetGroupSkip() const
The vertical space between GroupCells.
Definition: Configuration.h:435
void HelpBrowserUserLocation(wxString helpBrowser)
Sets the location of the web browser the user has detected.
Definition: Configuration.h:970
void SetWorkingDirectory(wxString dir)
Set maxima's working directory.
Definition: Configuration.h:207
bool CheckKeepPercent() const
Do we want to display "%e" as "%e" and "%pi" as "%pi"?
Definition: Configuration.h:629
const std::vector< TextStyle > & GetCodeStylesList() const
Which styles affect how code is displayed?
Definition: Configuration.h:1271
static const wxString CharsNeedingQuotes()
Returns a list of chars we need to escape in maxima.
Definition: Configuration.h:362
void SetAppearance(Appearance a)
Choose the appearance and update which style set is active.
Definition: Configuration.h:883
wxString MathJaXURL() const
Returns the URL MathJaX can be found at.
Definition: Configuration.h:987
bool RightToLeftDocument() const
Does the document read right-to-left (Arabic, Hebrew, Persian, Urdu)?
Definition: Configuration.h:844
void UpdateBackgroundBrush()
Refresh the cached document-background brush from the active style set.
Definition: Configuration.cpp:533
void AutodetectMaxima(bool autodetectmaxima)
Autodetect maxima's location?
Definition: Configuration.h:930
void SetChangeAsterisk(bool changeAsterisk)
Use Unicode centered dots for multiplication signs?
Definition: Configuration.h:693
std::random_device::result_type RandomEntropy()
One sample of OS entropy (std::random_device).
Definition: Configuration.h:1306
void PrintScale(double scale)
Define if we want to hide brackets that are not under the pointer.
Definition: Configuration.h:316
void InitStyles()
Initialize the text styles on construction.
Definition: Configuration.cpp:486
static void SetDebugmode()
Enable costly checks.
Definition: Configuration.h:1282
static double GetMinZoomFactor()
The lower limit we allow for the zoom factor.
Definition: Configuration.h:264
bool AutodetectMaxima() const
Autodetect maxima's location? (If false the user-specified location is used)
Definition: Configuration.h:928
wxScrolledCanvas * GetWorkSheet() const
Get the worksheet canvas this configuration storage is valid for.
Definition: Configuration.h:1064
bool ClipToDrawRegion() const
Do we want to save time by only redrawing the area currently shown on the screen?
Definition: Configuration.h:1158
void SetZoomFactor(double newzoom)
Sets the zoom factor the worksheet is displayed at.
Definition: Configuration.cpp:957
bool ShowBrackets() const
Show the cell brackets [displayed left to each group cell showing its extend]?
Definition: Configuration.h:855
bool FixReorderedIndices() const
Renumber out-of-order cell labels on saving.
Definition: Configuration.h:981
void AddMaximaOperator(const wxString &name)
Register name as an operator known to maxima.
Definition: Configuration.h:194
bool GetPrinting() const
Are we currently printing?
Definition: Configuration.h:674
wxBrush GetBackgroundBrush() const
Get the brush to be used for the worksheet background.
Definition: Configuration.h:241
void SetIndent(long indent)
Set the indentation of GroupCells.
Definition: Configuration.h:447
bool GetAutoWrapCode() const
Do we want to have automatic line breaks for code cells?
Definition: Configuration.h:538
long GetLineWidth() const
Returns the maximum sensible width for a text line [in characters]:
Definition: Configuration.cpp:897
void FixedFontInTextControls(bool fixed)
Use a typewriter font in wizard entry fields that can contain maxima commands?
Definition: Configuration.h:239
static EscCodeIterator EscCodesEnd()
Iterators over the escape code list.
Definition: Configuration.cpp:512
void RequestAdjustWorksheetSize() const
Ask the view (if any) to re-adjust its worksheet (scroll) size.
Definition: Configuration.h:1197
wxCoord GetCellBracketWidth() const
The width we allocate for our cell brackets.
Definition: Configuration.h:286
void MaximaUserLocation(wxString maxima)
Sets the location of the maxima binary.
Definition: Configuration.h:947
bool OfferInternalHelpBrowser() const
If we decide that the HTML browser in the sidebar doesn't work for every platform....
Definition: Configuration.cpp:1172
bool OverlayScrollbars() const
Use GTK's overlay scrollbars on the worksheet?
Definition: Configuration.h:305
void ClipToDrawRegion(bool clipToDrawRegion)
Do we want to save time by only redrawing the area currently shown on the screen?
Definition: Configuration.h:1160
wxColour GetColor(TextStyle style)
Gets the color for a text style.
Definition: Configuration.cpp:1144
long GetCursorWidth() const
How much vertical space is to be left between two group cells?
Definition: Configuration.h:410
static wxString m_configfileLocation_override
Where to store the configuration.
Definition: Configuration.h:251
void LineWidth_em(long width)
Set the minimum sensible line width in widths of a letter.
Definition: Configuration.h:508
std::default_random_engine & RandomEngine()
The pseudo-random engine, e.g. to feed a distribution.
Definition: Configuration.h:1308
void HideBrackets(bool hide)
Define if we want to hide brackets that are not under the pointer.
Definition: Configuration.h:296
double GetDefaultLineWidth() const
Calculates the default line width for the worksheet.
Definition: Configuration.h:487
ViewCellPointers * GetViewCellPointers() const
The transient view-state half of the cell-pointer registry (null if none).
Definition: Configuration.h:1079
wxCoord Scale_Px(double px) const
Scales a distance [in pixels] according to the zoom factor.
Definition: Configuration.cpp:1151
void ReadConfig()
Read the config from the wxConfig object.
Definition: Configuration.cpp:591
void SetRecalculateRequestCallback(std::function< void(GroupCell *)> callback)
Set the callback RequestRecalculate() notifies the view through.
Definition: Configuration.h:1092
InitOpt
Definition: Configuration.h:177
@ temporary
This configuration is temporary and shouldn't redetect Maxima etc.
Definition: Configuration.h:179
bool InternalHelpBrowser() const
Use the internal help browser? If not a external web browser is used.
Definition: Configuration.h:955
bool ScreenReaderAnnouncesMathML() const
Announce maxima's output to screen readers as MathML?
Definition: Configuration.h:1132
void SetParenthesisDrawMode(drawMode mode)
Which way do we want to draw parenthesis?
Definition: Configuration.h:1030
drawMode
Definition: Configuration.h:171
@ ascii
Use ascii characters only.
Definition: Configuration.h:172
@ handdrawn
A parenthesis sign that was created using draw commands.
Definition: Configuration.h:173
void OverlayScrollbars(bool overlay)
Define if the worksheet should use GTK's overlay scrollbars.
Definition: Configuration.h:309
void SetCanvasSize(wxSize siz)
Sets the size of the current worksheet's visible window.
Definition: Configuration.h:820
void MaximaParameters(wxString parameters)
The parameters we pass to the maxima binary.
Definition: Configuration.h:935
void NotifyOfCellRedraw(const Cell *cell)
Record that this cell has been drawn to ReportMultipleRedraws()
Definition: Configuration.cpp:864
long ShowLength() const
The choice for the "maximum output length to display" setting.
Definition: Configuration.h:1025
void ResetAllToDefaults()
Reset the whole configuration to its default values.
Definition: Configuration.cpp:235
void SetMaximaEnvVar(const wxString &name, const wxString &value)
Set a custom environment variable for the maxima process.
Definition: Configuration.h:199
void ReadStyles(const wxString &file={})
Reads the style settings.
Definition: Configuration.cpp:1014
htmlExportFormat
The export formats we support for HTML equations.
Definition: Configuration.h:145
@ mathML_mathJaX
Native MathML, plus MathJaX downloaded as a fall-back only for the few browsers that still lack MathM...
Definition: Configuration.h:153
@ mathJaX_TeX
Deprecated: the TeX-via-MathJaX HTML export was removed. The value is kept so saved configurations mi...
Definition: Configuration.h:149
@ mathML
Native MathML with no MathJaX at all: the exported page makes no external requests....
Definition: Configuration.h:157
void SetAdjustWorksheetSizeRequestCallback(std::function< void()> callback)
Set the callback RequestAdjustWorksheetSize() notifies the view through.
Definition: Configuration.h:1200
void SetDocumentCellPointers(DocumentCellPointers *p)
Register the document-model half of the cell-pointer registry.
Definition: Configuration.h:1077
bool UseUserLabels() const
Do we want at all to show labels?
Definition: Configuration.h:907
bool UpdateNeeded() const
true means: The system's config storage has changed since the configuration has been read
Definition: Configuration.cpp:1188
std::size_t ShowLength_Bytes() const
The "maximum output length to display" setting in cells.
Definition: Configuration.cpp:1349
long GetDisplayedDigits() const
Returns the maximum number of displayed digits.
Definition: Configuration.h:742
const Style * GetStyle(TextStyle textStyle) const
Get the text Style for a given text style identifier.
Definition: Configuration.h:1048
bool AutodetectHelpBrowser() const
Autodetect the web browser? (If false the user-specified location is used)
Definition: Configuration.h:950
void SetWorkSheet(wxScrolledCanvas *workSheet)
Set the worksheet canvas this configuration storage is valid for.
Definition: Configuration.cpp:204
bool IsOperator(wxString name) const
Coincides name with a operator known to maxima?
Definition: Configuration.h:192
void ShowLength(long length)
The choice for the "maximum output length to display" setting.
Definition: Configuration.h:1021
void LabelWidth(long labelWidth)
Set the width of worksheet labels [in chars].
Definition: Configuration.h:384
void RequestRecalculate(GroupCell *group) const
Ask the view (if any) to recalculate the layout starting at the given group cell.
Definition: Configuration.h:1089
const std::vector< TextStyle > & GetColorOnlyStylesList() const
Which styles affect only colors?
Definition: Configuration.h:1275
bool PrintBrackets() const
Print the cell brackets [displayed left to each group cell showing its extend]?
Definition: Configuration.h:866
The document-model half of the cell-pointer registry.
Definition: CellPointers.h:50
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:88
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:1519
Sets the configuration's "printing" flag until this class is left.
Definition: Configuration.h:1502
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:67
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
The view/interaction half of the cell-pointer registry.
Definition: CellPointers.h:187
Definition: CellPointers.h:32
Definition: Configuration.h:100
std::atomic< long > worksheetRepaints
How often the worksheet was repainted (Worksheet::OnPaint ran)
Definition: Configuration.h:125
std::atomic< long > cellsDrawnAtWrongFontSize
How many cells were drawn at a different font size than they were laid out with.
Definition: Configuration.h:123
std::atomic< long > worksheetFullRepaints
How many of those repaints covered (nearly) the whole visible worksheet.
Definition: Configuration.h:133
One mechanically persisted scalar setting: its config key and the member variable it is stored in.
Definition: Configuration.h:604
const wxChar * key
The key the setting is stored under in the configuration store.
Definition: Configuration.h:606
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:611