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
516 bool SaveUntitled() const { return m_saveUntitled;}
517 void SaveUntitled(bool save) {m_saveUntitled = save;}
518
519 bool CursorJump() const { return m_cursorJump;}
520 void CursorJump(bool save){m_cursorJump = save;}
521
522 bool NumpadEnterEvaluates() const { return m_numpadEnterEvaluates;}
523 void NumpadEnterEvaluates(bool eval){m_numpadEnterEvaluates = eval;}
524
525 bool SaveImgFileName() const { return m_saveImgFileName;}
526 void SaveImgFileName(bool save) { m_saveImgFileName = save;}
527
529 bool GetAutoWrap() const
530 { return m_autoWrap > 0; }
531
533 bool GetAutoWrapCode() const
534 { return m_autoWrap > 1; }
535
547 void SetAutoWrap(long autoWrap){
548 m_autoWrap = autoWrap;
549 if (m_autoWrap < 0)
550 m_autoWrap = 0;
551 if (m_autoWrap > 2)
552 m_autoWrap = 1;
553 }
554
556 bool GetAutoIndent() const
557 { return m_autoIndent; }
558
559 void SetAutoIndent(bool autoIndent){m_autoIndent = autoIndent;}
560
562 bool IndentMaths() const {return m_indentMaths;}
563 void IndentMaths(bool indent){
564 if(m_indentMaths != indent)
566 m_indentMaths = indent;}
567 AFontSize GetFontSize(TextStyle st) const { return m_styleStore[st].GetFontSize(); }
568
569 static const wxString &GetStyleName(TextStyle textStyle);
570
576 void ReadStyles(const wxString &file = {});
577
582 void WriteStyles(const wxString &file = {});
583 void WriteStyles(wxConfigBase *config);
584 void WriteSettings(const wxString &file = {});
592 static const std::vector<std::pair<TextStyle, wxString>> &StyleConfigKeys();
593
601 const wxChar *key;
603 std::variant<bool Configuration::*, int Configuration::*,
604 long Configuration::*, double Configuration::*,
605 wxString Configuration::*>
607 };
618 static const std::vector<ScalarSetting> &ScalarConfigSettings();
619 void MakeStylesConsistent();
620 void Outdated(bool outdated)
621 { m_outdated = outdated; }
622
624 bool CheckKeepPercent() const
625 { return m_keepPercent; }
626
628 void SetKeepPercent(bool keepPercent)
629 {
630 if(m_keepPercent != keepPercent)
632 m_keepPercent = keepPercent;
633 }
634
635 wxString GetTeXCMRI() const
636 { return m_fontCMRI; }
637
638 wxString GetTeXCMSY() const
639 { return m_fontCMSY; }
640
641 wxString GetTeXCMEX() const
642 { return m_fontCMEX; }
643
644 wxString GetTeXCMMI() const
645 { return m_fontCMMI; }
646
647 wxString GetTeXCMTI() const
648 { return m_fontCMTI; }
649
650 bool ShowCodeCells() const
651 { return m_showCodeCells; }
652
653 void ShowCodeCells(bool show);
654
661 void SetPrinting(bool printing);
662
669 bool GetPrinting() const
670 { return m_renderContext.Printing(); }
671
673 wxColour GetColor(TextStyle style);
674
675
676 bool UsePngCairo() const { return m_usepngCairo;}
677 void UsePngCairo(bool usepngCairo) { m_usepngCairo = usepngCairo;}
678
679 bool GetMatchParens() const { return m_matchParens; }
680 void SetMatchParens(bool matchParens) { m_matchParens = matchParens; }
681 bool ShowMatchingParens() const { return m_showMatchingParens; }
682 void ShowMatchingParens(bool show) { m_showMatchingParens = show; }
683
685 bool GetChangeAsterisk() const{ return m_changeAsterisk; }
686
688 void SetChangeAsterisk(bool changeAsterisk) {
689 if(m_changeAsterisk != changeAsterisk)
691 m_changeAsterisk = changeAsterisk;
692 }
693
694 bool HidemultiplicationSign() const {return m_hidemultiplicationsign;}
695
696 void HidemultiplicationSign(bool show) {
697 if(m_hidemultiplicationsign != show)
699 m_hidemultiplicationsign = show;
700 }
701
702 bool Latin2Greek() const
703 {return m_latin2greek;}
704
705 void Latin2Greek(bool latin2greek) {
706 if(m_latin2greek != latin2greek)
708 m_latin2greek = latin2greek;
709 }
710
711 bool GreekSidebar_ShowLatinLookalikes() const {return m_greekSidebar_ShowLatinLookalikes;}
712 void GreekSidebar_ShowLatinLookalikes(bool show){m_greekSidebar_ShowLatinLookalikes = show;}
713
714 bool GreekSidebar_Show_mu() const {return m_greekSidebar_Show_mu;}
715 void GreekSidebar_Show_mu(bool show) {m_greekSidebar_Show_mu = show;}
716
717 wxString SymbolPaneAdditionalChars() const
718 {return m_symbolPaneAdditionalChars;}
719 void SymbolPaneAdditionalChars(wxString symbols) {m_symbolPaneAdditionalChars = std::move(symbols);}
720
722 bool NotifyIfIdle() const
723 { return m_notifyIfIdle; }
724
725 void NotifyIfIdle(bool notify) {m_notifyIfIdle = notify;}
726
732 { return m_displayedDigits; }
733
734 void SetDisplayedDigits(long displayedDigits)
735 {
736 wxASSERT_MSG(displayedDigits >= 0, _("Bug: Maximum number of digits that is to be displayed is too low!"));
737 if(m_displayedDigits != displayedDigits)
739 m_displayedDigits = displayedDigits;
740 }
741
744 {
745 public:
746 FileToSave(const wxString &filename, const wxMemoryBuffer &data):
747 m_data(data),
748 m_filename(filename)
749 {
750 }
751 const wxString FileName() const{return m_filename;}
752 const wxMemoryBuffer Data() const{return m_data;}
753 private:
754 const wxMemoryBuffer m_data;
755 const wxString m_filename;
756 };
757
760 {
761 public:
762 TextsnippetToDraw(const wxPoint &pos, const wxString &text, const wxColor &color):
763 m_pos(pos),
764 m_text(text),
765 m_color(color)
766 {
767 }
768 const wxPoint Pos() const{return m_pos;}
769 const wxString Text() const{return m_text;}
770 const wxColor Color() const{return m_color;}
771 private:
772 const wxPoint m_pos;
773 const wxString m_text;
774 const wxColor m_color;
775 };
776
777 void PushFileToSave(const wxString &filename, const wxMemoryBuffer &data)
778 { m_filesToSave.emplace_front(FileToSave(filename, data)); }
779
780 wxRect GetUpdateRegion() const {return m_renderContext.GetUpdateRegion();}
781 const std::list<FileToSave> &GetFilesToSave() const {return m_filesToSave;}
782 void ClearFilesToSave () { m_filesToSave.clear();}
783 void SetUpdateRegion(wxRect rect){m_renderContext.SetUpdateRegion(rect);}
784
787 bool InUpdateRegion(wxRect rect) const;
788
789 bool GetInsertAns() const
790 { return m_insertAns; }
791
792 void SetInsertAns(bool insertAns){ m_insertAns = insertAns; }
793
794 bool GetOpenHCaret() const
795 { return m_openHCaret; }
796
797 void SetOpenHCaret(bool openHCaret){ m_openHCaret = openHCaret; }
798
799 bool RestartOnReEvaluation() const
800 { return m_restartOnReEvaluation; }
801
802 void RestartOnReEvaluation(bool arg){ m_restartOnReEvaluation = arg; }
803
805 wxSize GetCanvasSize() const
806 { return m_renderContext.GetCanvasSize(); }
807
809 void SetCanvasSize(wxSize siz)
810 {
811 if(GetCanvasSize().GetWidth() != siz.GetWidth() ||
812 GetCanvasSize().GetHeight() != siz.GetHeight())
814 m_renderContext.SetCanvasSize(siz);
815 }
816
834 { return m_rightToLeftDocument; }
835
836 bool RightToLeftDocument(bool rightToLeft)
837 {
838 if (m_rightToLeftDocument != rightToLeft)
840 return m_rightToLeftDocument = rightToLeft;
841 }
842
844 bool ShowBrackets() const
845 { return m_showBrackets; }
846
847 bool ShowBrackets(bool show)
848 {
849 if(m_showBrackets != show)
851 return m_showBrackets = show;
852 }
853
855 bool PrintBrackets() const
856 { return m_printBrackets; }
857
858 showLabels GetLabelChoice() const
859 { return m_showLabelChoice; }
860
861 bool ShowInputLabels() const {return m_showInputLabels;}
862 void ShowInputLabels(bool show) {
863 if(m_showInputLabels != show)
865 m_showInputLabels = show;
866 }
867
869 enum class Appearance { light, dark, followSystem };
870 Appearance GetAppearance() const { return m_appearance; }
873 m_appearance = a;
874 m_styleStore.SetUseDark(UseDarkMode());
876 }
880 bool UseDarkMode() const {
881 if (m_appearance == Appearance::dark) return true;
882 if (m_appearance == Appearance::light) return false;
883 return SystemIsDark();
884 }
886 static bool SystemIsDark();
887
888 long RecentItems(){return std::max(m_recentItems, static_cast<long>(0));}
889 void RecentItems(long items){ m_recentItems = items; }
890
893 { return (m_showLabelChoice < labels_useronly); }
894
896 bool UseUserLabels() const
897 { return m_showLabelChoice > labels_automatic; }
898
900 bool ShowLabels() const
901 { return m_showLabelChoice < labels_none; }
902
904 void SetLabelChoice(showLabels choice) {
905 if(m_showLabelChoice != choice)
907 m_showLabelChoice = choice;
908 }
909
910 bool PrintBrackets(bool print)
911 {
912 m_printBrackets = print;
913 return print;
914 }
915
917 bool AutodetectMaxima() const {return m_autodetectMaxima;}
919 void AutodetectMaxima(bool autodetectmaxima){m_autodetectMaxima = autodetectmaxima;}
920
922 wxString MaximaParameters() const {return m_maximaParameters;}
924 void MaximaParameters(wxString parameters){m_maximaParameters = std::move(parameters);}
925
927 static wxString MaximaDefaultLocation();
928
930 wxString MaximaLocation() const;
931
933 wxString MaximaUserLocation() const {return m_maximaUserLocation;}
934
936 void MaximaUserLocation(wxString maxima) { m_maximaUserLocation = std::move(maxima); }
937
939 bool AutodetectHelpBrowser() const {return m_autodetectHelpBrowser;}
941 void AutodetectHelpBrowser(bool autodetect){m_autodetectHelpBrowser = autodetect;}
942
944 bool InternalHelpBrowser() const {return m_useInternalHelpBrowser && OfferInternalHelpBrowser();}
946 void InternalHelpBrowser(bool useInternalHelpBrowser)
947 {m_useInternalHelpBrowser = useInternalHelpBrowser;}
948
950 bool SinglePageManual() const {return m_singlePageManual;}
952 void SinglePageManual(bool singlePageManual)
953 {m_singlePageManual = singlePageManual;}
954
956 wxString HelpBrowserUserLocation() const {return m_helpBrowserUserLocation;}
957
959 void HelpBrowserUserLocation(wxString helpBrowser) { m_helpBrowserUserLocation = std::move(helpBrowser);}
960
967 static wxString FindProgram(const wxString &location);
968
971 { return m_fixReorderedIndices; }
972
973 void FixReorderedIndices(bool fix) { m_fixReorderedIndices = fix;}
974
976 wxString MathJaXURL() const {
977 if(m_mathJaxURL_UseUser)
978 return m_mathJaxURL;
979 else
980 return MathJaXURL_Auto();}
981 wxString MathJaXURL_User() const { return m_mathJaxURL;}
982 bool MathJaXURL_UseUser() const { return m_mathJaxURL_UseUser;}
983 void MathJaXURL_UseUser(bool useUser){m_mathJaxURL_UseUser = useUser;}
984
985 bool EnterEvaluates() const {return m_enterEvaluates;}
986 void EnterEvaluates(bool enterEvaluates) {m_enterEvaluates = enterEvaluates;}
987 static wxString MathJaXURL_Auto() { return wxS("https://cdn.jsdelivr.net/npm/mathjax@4/tex-mml-chtml.js");}
989 void MathJaXURL(wxString url){m_mathJaxURL = std::move(url);}
990
991 bool CopyBitmap() const {return m_copyBitmap;}
992 void CopyBitmap(bool copyBitmap){ m_copyBitmap = copyBitmap; }
993
994 bool CopyMathML() const {return m_copyMathML;}
995 void CopyMathML(bool copyMathML){ m_copyMathML = copyMathML;}
996 bool CopyMathMLHTML() const {return m_copyMathMLHTML;}
997 void CopyMathMLHTML(bool copyMathMLHTML){ m_copyMathMLHTML = copyMathMLHTML; }
998 bool HideMarkerForThisMessage(wxString message);
999 void HideMarkerForThisMessage(const wxString &message, bool hide)
1000 {m_hideMarkerForThisMessage[message] = hide;}
1001 bool CopyRTF() const {return m_copyRTF;}
1002 void CopyRTF(bool copyRTF) { m_copyRTF = copyRTF; }
1003 bool CopySVG() const {return m_copySVG;}
1004 void CopySVG(bool copySVG) { m_copySVG = copySVG; }
1005 bool CopyEMF() const {return m_copyEMF;}
1006 void CopyEMF(bool copyEMF) { m_copyEMF = copyEMF; }
1007 bool UseSVG() const {return m_useSVG;}
1008 void UseSVG(bool useSVG) { m_useSVG = useSVG ;}
1010 void ShowLength(long length) {
1011 m_showLength = length;
1012 }
1014 long ShowLength() const {return m_showLength;}
1016 std::size_t ShowLength_Bytes() const;
1017
1020 if(m_parenthesisDrawMode != mode)
1022 m_parenthesisDrawMode = mode;
1023 }
1024
1025 void TocShowsSectionNumbers(bool showSectionNumbers) { m_TOCshowsSectionNumbers = showSectionNumbers; }
1026
1027 bool TocShowsSectionNumbers() const {return m_TOCshowsSectionNumbers;}
1028
1029 void UseUnicodeMaths(bool useunicodemaths)
1030 { m_useUnicodeMaths = useunicodemaths; }
1031 bool UseUnicodeMaths() const {return m_useUnicodeMaths;}
1032
1037 const Style *GetStyle(TextStyle textStyle) const { return &m_styleStore[textStyle]; }
1045 Style *GetWritableStyle(TextStyle textStyle) { return &m_styleStore[textStyle]; }
1046
1053 wxScrolledCanvas *GetWorkSheet() const {return m_workSheet;}
1055 void SetWorkSheet(wxScrolledCanvas *workSheet);
1056
1064 DocumentCellPointers *GetDocumentCellPointers() const {return m_documentCellPointers;}
1066 void SetDocumentCellPointers(DocumentCellPointers *p) {m_documentCellPointers = p;}
1068 ViewCellPointers *GetViewCellPointers() const {return m_viewCellPointers;}
1070 void SetViewCellPointers(ViewCellPointers *p) {m_viewCellPointers = p;}
1071
1079 {if (m_recalculateRequest) m_recalculateRequest(group);}
1081 void SetRecalculateRequestCallback(std::function<void(GroupCell *)> callback)
1082 {m_recalculateRequest = std::move(callback);}
1083
1093 {if (m_recalculateAllRequest) m_recalculateAllRequest();}
1095 void SetRecalculateAllRequestCallback(std::function<void()> callback)
1096 {m_recalculateAllRequest = std::move(callback);}
1097
1098 long DefaultPort() const {return m_defaultPort;}
1099 void DefaultPort(long port){m_defaultPort = port;}
1100 bool GetAbortOnError() const {return m_abortOnError;}
1101 void SetAbortOnError(bool abortOnError) {m_abortOnError = abortOnError;}
1102
1103 long GetLanguage() const {return m_language;}
1104 void SetLanguage(long language) {m_language = language;}
1105
1107 long MaxGnuplotMegabytes() const {return m_maxGnuplotMegabytes;}
1108 void MaxGnuplotMegabytes(long megaBytes)
1109 {m_maxGnuplotMegabytes = megaBytes;}
1110
1111 bool OfferKnownAnswers() const {return m_offerKnownAnswers;}
1112 void OfferKnownAnswers(bool offerKnownAnswers)
1113 {m_offerKnownAnswers = offerKnownAnswers;}
1114
1121 bool ScreenReaderAnnouncesMathML() const {return m_screenReaderAnnouncesMathML;}
1123 {m_screenReaderAnnouncesMathML = mathML;}
1124
1125 wxString Documentclass() const {return m_documentclass;}
1126 void Documentclass(wxString clss){m_documentclass = std::move(clss);}
1127 wxString DocumentclassOptions() const {return m_documentclassOptions;}
1128 void DocumentclassOptions(wxString classOptions){m_documentclassOptions = std::move(classOptions);}
1129
1130
1131 htmlExportFormat HTMLequationFormat() const {return m_htmlEquationFormat;}
1132 void HTMLequationFormat(htmlExportFormat HTMLequationFormat)
1133 {m_htmlEquationFormat = HTMLequationFormat;}
1134
1135 AFontSize GetDefaultFontSize() const { return m_styleStore[TS_CODE_DEFAULT].GetFontSize(); }
1136 AFontSize GetMathFontSize() const { return m_styleStore[TS_MATH].GetFontSize(); }
1137
1139 long GetAutosubscript_Num() const {return m_autoSubscript;}
1140 void SetAutosubscript_Num(long autosubscriptnum) {m_autoSubscript = autosubscriptnum;}
1141 wxString GetAutosubscript_string() const;
1143 wxColor DefaultBackgroundColor();
1145 wxColor EditorBackgroundColor();
1147 bool ClipToDrawRegion() const {return m_renderContext.ClipToDrawRegion();}
1149 void ClipToDrawRegion(bool clipToDrawRegion){m_renderContext.ClipToDrawRegion(clipToDrawRegion);}
1150 void SetVisibleRegion(wxRect visibleRegion){
1151 if(m_renderContext.GetVisibleRegion().GetWidth() != visibleRegion.GetWidth())
1153 m_renderContext.SetVisibleRegion(visibleRegion);
1154 }
1155 wxRect GetVisibleRegion() const {return m_renderContext.GetVisibleRegion();}
1156 void SetWorksheetPosition(wxPoint worksheetPosition){m_renderContext.SetWorksheetPosition(worksheetPosition);}
1157 wxPoint GetWorksheetPosition() const {return m_renderContext.GetWorksheetPosition();}
1158 wxString MaximaShareDir() const {return m_maximaSession.ShareDir();}
1159 void MaximaShareDir(wxString dir){m_maximaSession.ShareDir(std::move(dir));}
1160 wxString MaximaDemoDir() const {return m_maximaSession.DemoDir();}
1161 void MaximaDemoDir(wxString dir){m_maximaSession.DemoDir(std::move(dir));}
1162 void InLispMode(bool lisp){m_maximaSession.InLispMode(lisp);}
1163 bool InLispMode() const {return m_maximaSession.InLispMode();}
1164 void BitmapScale(int factor){m_bitmapScale = factor;}
1165 int BitmapScale() const {return m_bitmapScale;}
1166 void DefaultPlotHeight(int px){m_defaultPlotHeight = px;}
1167 int DefaultPlotHeight() const {return m_defaultPlotHeight;}
1168 void DefaultPlotWidth(int px){m_defaultPlotWidth = px;}
1169 int DefaultPlotWidth() const {return m_defaultPlotWidth;}
1170 void DefaultFramerate(double fps){m_defaultFramerate = fps;}
1171 double DefaultFramerate() const {return m_defaultFramerate;}
1172 void TocDepth(int depth){m_tocDepth = depth;}
1173 int TocDepth() const {return m_tocDepth;}
1174 bool TeXExponentsAfterSubscript() const {return m_TeXExponentsAfterSubscript;}
1175 void TeXExponentsAfterSubscript(bool ExponentsAfterSubscript)
1176 {m_TeXExponentsAfterSubscript = ExponentsAfterSubscript;}
1177 bool UsePartialForDiff() const {return m_usePartialForDiff;}
1178 void UsePartialForDiff(bool usePartialForDiff)
1179 {m_usePartialForDiff = usePartialForDiff;}
1187 {if (m_adjustWorksheetSizeRequest) m_adjustWorksheetSizeRequest();}
1189 void SetAdjustWorksheetSizeRequestCallback(std::function<void()> callback)
1190 {m_adjustWorksheetSizeRequest = std::move(callback);}
1192 void NotifyOfCellRedraw(const Cell *cell);
1202 void ReportMultipleRedraws();
1204 bool OfferInternalHelpBrowser() const;
1205 bool WrapLatexMath() const {return m_wrapLatexMath;}
1206 void WrapLatexMath(bool wrapLatexMath){m_wrapLatexMath = wrapLatexMath;}
1207 bool AllowNetworkHelp() const {return m_allowNetworkHelp;}
1208 void AllowNetworkHelp(bool allowNetworkHelp){m_allowNetworkHelp = allowNetworkHelp;}
1209 bool ShowAllDigits() const {return m_showAllDigits;}
1210 void ShowAllDigits(bool shw){
1211 if(m_showAllDigits != shw)
1213 m_showAllDigits = shw;
1214 }
1215 bool LineBreaksInLongNums() const {return m_lineBreaksInLongNums;}
1216 void LineBreaksInLongNums(bool brk){
1217 if(m_lineBreaksInLongNums != brk)
1219 m_lineBreaksInLongNums = brk;
1220 }
1221 int MaxClipbrdBitmapMegabytes() const {return m_maxClipbrd_BitmapMegabytes;}
1222 void MaxClipbrdBitmapMegabytes(int maxClipbrd_BitmapMegabytes)
1223 {m_maxClipbrd_BitmapMegabytes = maxClipbrd_BitmapMegabytes;}
1224
1225 void MaximaUsesHtmlBrowser(bool maximaUsesHhtmlBrowser){m_maximaUsesHhtmlBrowser = maximaUsesHhtmlBrowser;}
1226 bool MaximaUsesHtmlBrowser() const {return m_maximaUsesHhtmlBrowser;}
1227 void MaximaUsesWxmaximaBrowser(bool maximaUsesWxmaximaBrowser){m_maximaUsesWxmaximaBrowser = maximaUsesWxmaximaBrowser;}
1228 bool MaximaUsesWxmaximaBrowser() const {return m_maximaUsesWxmaximaBrowser && OfferInternalHelpBrowser();}
1229 void ExportContainsWXMX(bool exportContainsWXMX){m_exportContainsWXMX = exportContainsWXMX;}
1230 bool ExportContainsWXMX() const {return m_exportContainsWXMX;}
1231 void WizardTab(long tab){m_wizardTab = tab;}
1232 long WizardTab() const {return m_wizardTab;}
1233
1234 void Display2d_Unicode(bool unicode){m_display2d_Unicode = unicode;}
1235 bool Display2d_Unicode() const {return m_display2d_Unicode;}
1236
1237 #ifdef __WXMSW__
1238 bool UseWGnuplot() const {return m_useWgnuplot;}
1239 void UseWGnuplot(bool usewgnuplot) {m_useWgnuplot = usewgnuplot;}
1240 #endif
1241 wxString TexPreamble() const {return m_texPreamble;}
1242 void TexPreamble(wxString texPreamble) {m_texPreamble = std::move(texPreamble);}
1243
1244 void SetMaximaVersion(const wxString &version){m_maximaSession.SetMaximaVersion(version);}
1245 wxString GetMaximaVersion() const {return m_maximaSession.GetMaximaVersion();}
1246 void SetMaximaArch(const wxString &arch){m_maximaSession.SetMaximaArch(arch);}
1247 wxString GetMaximaArch() const {return m_maximaSession.GetMaximaArch();}
1248 void SetLispVersion(const wxString &version){m_maximaSession.SetLispVersion(version);}
1249 wxString GetLispVersion() const {return m_maximaSession.GetLispVersion();}
1250 void SetLispType(const wxString &type){m_maximaSession.SetLispType(type);}
1251 wxString GetLispType() const {return m_maximaSession.GetLispType();}
1252
1254 void InitStyles();
1256 bool FontRendersChar(wxUniChar ch, const wxFont &font = *wxNORMAL_FONT)
1257 { return m_fontRenderability.FontRendersChar(ch, font); }
1258
1260 const std::vector<TextStyle> &GetCodeStylesList() const {return m_styleStore.CodeStylesList();}
1262 const std::vector<TextStyle> &GetMathStylesList() const {return m_styleStore.MathStylesList();}
1264 const std::vector<TextStyle> &GetColorOnlyStylesList() const {return m_styleStore.ColorOnlyStylesList();}
1265 bool StyleAffectsCode(TextStyle style) const;
1266 bool StyleAffectsMathOut(TextStyle style) const;
1267 bool StyleAffectsColorOnly(TextStyle style) const;
1269 bool UpdateNeeded() const;
1271 static void SetDebugmode(){m_debugMode = true;}
1273 static bool GetDebugmode(){return m_debugMode;}
1274 maximaHelpFormat MaximaHelpFormat() const;
1275 void MaximaHelpFormat(maximaHelpFormat format) {m_maximaHelpFormat = format;}
1276
1277private:
1279 MaximaSessionInfo m_maximaSession;
1281 InitOpt m_initOpts;
1287 long m_configId;
1289 std::random_device m_rd;
1291 std::default_random_engine m_eng;
1292 wxEnvVariableHashMap m_maximaEnvVars;
1293public:
1295 std::random_device::result_type RandomEntropy(){return m_rd();}
1297 std::default_random_engine &RandomEngine(){return m_eng;}
1305 std::int_fast32_t CellCfgCnt() const {return m_cellCfgCnt;}
1313 m_cellCfgCnt++;
1315 }
1316 static bool UseThreads(){return m_use_threads;}
1317 static void UseThreads(bool use){m_use_threads = use;}
1318 static void SetMaximaLang(const wxString &LANG){m_maxima_LANG = LANG;}
1319 static wxString GetMaximaLang(){return m_maxima_LANG;}
1320private:
1322 static wxString m_maxima_LANG;
1323 std::list<FileToSave> m_filesToSave;
1325 Styles m_styleStore;
1327 StringBoolHash m_hideMarkerForThisMessage;
1329 FontRenderabilityCache m_fontRenderability;
1330 mathDisplayMode m_displayMode = display_2d;
1331 static bool m_debugMode;
1332 bool m_showInputLabels;
1333 long m_wizardTab;
1334 bool m_display2d_Unicode;
1335 bool m_usePartialForDiff;
1336 bool m_maximaUsesHhtmlBrowser;
1337 bool m_maximaUsesWxmaximaBrowser;
1339 bool m_autoSaveAsTempFile;
1341 long m_language;
1343 bool m_autodetectMaxima;
1345 bool m_autodetectHelpBrowser;
1347 bool m_useInternalHelpBrowser;
1349 bool m_singlePageManual;
1351 bool m_incrementalSearch;
1353 long m_autoSubscript;
1355 wxScrolledCanvas *m_workSheet = NULL;
1357 DocumentCellPointers *m_documentCellPointers = NULL;
1359 ViewCellPointers *m_viewCellPointers = NULL;
1361 std::function<void(GroupCell *)> m_recalculateRequest;
1363 std::function<void()> m_recalculateAllRequest;
1365 std::function<void()> m_adjustWorksheetSizeRequest;
1367 RenderContext m_renderContext;
1368 bool m_wrapLatexMath;
1369 bool m_allowNetworkHelp;
1370 bool m_exportContainsWXMX;
1371 wxString m_texPreamble;
1372
1373 drawMode m_parenthesisDrawMode;
1374 bool m_TeXExponentsAfterSubscript;
1375 wxString m_helpBrowserUserLocation;
1376 wxString m_maximaUserLocation;
1378 bool m_hideBrackets;
1380 bool m_overlayScrollbars;
1382 double m_printScale;
1383 double m_printMargin_Top;
1384 double m_printMargin_Bot;
1385 double m_printMargin_Left;
1386 double m_printMargin_Right;
1388 bool m_rightToLeftDocument;
1390 bool m_showBrackets;
1392 bool m_printBrackets;
1398 bool m_changeAsterisk;
1400 bool m_notifyIfIdle;
1402 long m_displayedDigits;
1404 long m_autoWrap;
1406 bool m_autoIndent;
1408 bool m_showAllDigits;
1410 bool m_lineBreaksInLongNums;
1412 bool m_matchParens;
1414 bool m_insertAns;
1416 bool m_openHCaret;
1418 long m_labelWidth;
1419 long m_indent;
1420 bool m_latin2greek;
1421 double m_zoomFactor;
1422 bool m_outdated;
1423 wxString m_maximaParameters;
1424 bool m_keepPercent;
1425 bool m_restartOnReEvaluation;
1426 wxString m_fontCMRI, m_fontCMSY, m_fontCMEX, m_fontCMMI, m_fontCMTI;
1427 long m_lineWidth_em;
1428 showLabels m_showLabelChoice;
1429 bool m_fixReorderedIndices;
1430 wxString m_mathJaxURL;
1431 bool m_mathJaxURL_UseUser;
1432 bool m_showCodeCells;
1433 bool m_copyBitmap;
1434 bool m_copyMathML;
1435 bool m_copyMathMLHTML;
1436 long m_showLength;
1437 bool m_usepngCairo;
1438 bool m_enterEvaluates;
1439 bool m_useSVG;
1440 bool m_fixedFontTC;
1441 bool m_copyRTF;
1442 bool m_copySVG;
1443 bool m_copyEMF;
1444 bool m_TOCshowsSectionNumbers;
1445 bool m_useUnicodeMaths;
1446 bool m_indentMaths;
1447 bool m_abortOnError;
1448 bool m_showMatchingParens;
1449 bool m_hidemultiplicationsign;
1450 bool m_offerKnownAnswers;
1451 bool m_screenReaderAnnouncesMathML;
1452 long m_defaultPort;
1453 long m_maxGnuplotMegabytes;
1454 long m_defaultPlotHeight;
1455 long m_defaultPlotWidth;
1456 bool m_saveUntitled;
1457 bool m_cursorJump;
1458 bool m_numpadEnterEvaluates;
1459 bool m_saveImgFileName;
1460 wxString m_documentclass;
1461 wxString m_documentclassOptions;
1462 htmlExportFormat m_htmlEquationFormat;
1463
1464 wxColour m_defaultBackgroundColor;
1465 wxBrush m_tooltipBrush;
1466 bool m_greekSidebar_ShowLatinLookalikes;
1467 #ifdef __WXMSW__
1468 bool m_useWgnuplot = false;
1469 #endif
1470 bool m_greekSidebar_Show_mu;
1471 wxString m_symbolPaneAdditionalChars;
1472 Appearance m_appearance = Appearance::followSystem;
1473 long m_recentItems;
1474 int m_bitmapScale;
1475 double m_defaultFramerate;
1476 int m_tocDepth;
1477 int m_maxClipbrd_BitmapMegabytes;
1478 int m_autoSaveMinutes;
1479 int m_maxLayoutTime;
1480 LayoutStrategy m_layoutStrategy = LayoutStrategy::layout2DIfFits;
1481 wxString m_wxMathML_Filename;
1482 maximaHelpFormat m_maximaHelpFormat;
1483 std::atomic<std::int_fast32_t> m_cellCfgCnt{0};
1484 static bool m_use_threads;
1485};
1486
1489{
1490public:
1491 explicit Printing(Configuration *configuration)
1492 {
1493 m_configuration = configuration;
1494 m_configuration->SetPrinting(true);
1495 }
1496 virtual ~Printing()
1497 {
1498 m_configuration->SetPrinting(false);
1499 }
1500private:
1501 Configuration * m_configuration;
1502};
1503
1506{
1507public:
1508 explicit NoClipToDrawRegion(Configuration *configuration)
1509 {
1510 m_configuration = configuration;
1511 m_configuration->ClipToDrawRegion(false);
1512 }
1513 virtual ~NoClipToDrawRegion()
1514 {
1515 m_configuration->ClipToDrawRegion(true);
1516 }
1517private:
1518 Configuration * m_configuration;
1519};
1520
1521#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 base class all cell types the worksheet can consist of are derived from.
Definition: Cell.h:142
Stores the information about a file we need to write during the save process.
Definition: Configuration.h:744
Stores the information about a file we need to write during the save process.
Definition: Configuration.h:760
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:1312
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:869
wxString HelpBrowserUserLocation() const
Returns the location of the web browser the user has selected.
Definition: Configuration.h:956
wxColor EditorBackgroundColor()
Determine the default background color of editorcells.
Definition: Configuration.cpp:858
long GetAutosubscript_Num() const
Get the worksheet this configuration storage is valid for.
Definition: Configuration.h:1139
void SetViewCellPointers(ViewCellPointers *p)
Register the transient view-state half of the cell-pointer registry.
Definition: Configuration.h:1070
bool ShowAutomaticLabels() const
Do we want to show maxima's automatic labels (o1, t1, i1,...)?
Definition: Configuration.h:892
void AutodetectHelpBrowser(bool autodetect)
Autodetect the web browser?
Definition: Configuration.h:941
bool FontRendersChar(wxUniChar ch, const wxFont &font= *wxNORMAL_FONT)
True if we are confident that the font renders this char.
Definition: Configuration.h:1256
void MathJaXURL(wxString url)
Returns the URL MathJaX can be found at.
Definition: Configuration.h:989
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:1273
bool GetChangeAsterisk() const
Use Unicode centered dots for multiplication signs?
Definition: Configuration.h:685
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:491
void SetAutoWrap(long autoWrap)
Sets the auto wrap mode.
Definition: Configuration.h:547
wxSize GetPPI() const
Get the resolution.
Definition: Configuration.cpp:212
bool GetAutoWrap() const
Do we want to have automatic line breaks for text cells?
Definition: Configuration.h:529
void ClearAndEnableRedrawTracing()
Clear the memory of ReportMultipleRedraws()
Definition: Configuration.cpp:868
void ReportMultipleRedraws()
Report if a cell has been redrawn 2 or more times during a simple Draw() command.
Definition: Configuration.cpp:874
static wxString FindProgram(const wxString &location)
Could a maxima binary be found in the path we expect it to be in?
Definition: Configuration.cpp:542
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:1198
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:499
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:722
void RequestRecalculateAll() const
Ask the view to schedule a recalculation of the WHOLE worksheet.
Definition: Configuration.h:1092
static EscCodeIterator EscCodesBegin()
Iterators over the escape code list.
Definition: Configuration.cpp:507
void SetPrinting(bool printing)
Are we currently printing?
Definition: Configuration.cpp:886
static wxString MaximaDefaultLocation()
The auto-detected maxima location.
Definition: Configuration.cpp:983
void SetLabelChoice(showLabels choice)
Sets the value of the Configuration ChoiceBox that treads displaying labels.
Definition: Configuration.h:904
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:1136
void SetKeepPercent(bool keepPercent)
Do we want to display "%e" as "%e" and "%pi" as "%pi"?
Definition: Configuration.h:628
bool SinglePageManual() const
Prefer the single-page manual?
Definition: Configuration.h:950
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:1303
const std::vector< TextStyle > & GetMathStylesList() const
Which styles affect how math output is displayed?
Definition: Configuration.h:1262
DocumentCellPointers * GetDocumentCellPointers() const
The registry of special cells (selection, active cell, errors, ...) of this document.
Definition: Configuration.h:1064
wxColor DefaultBackgroundColor()
Determine the default background color of the worksheet.
Definition: Configuration.cpp:854
bool UseDarkMode() const
Whether the dark style set is currently active.
Definition: Configuration.h:880
wxString MaximaUserLocation() const
Returns the location of the maxima binary the user has selected.
Definition: Configuration.h:933
Style * GetWritableStyle(TextStyle textStyle)
Get the text Style for a given text style identifier.
Definition: Configuration.h:1045
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:1015
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:1305
bool ShowLabels() const
Do we want at all to show labels?
Definition: Configuration.h:900
wxString MaximaParameters() const
Parameters to the maxima binary.
Definition: Configuration.h:922
wxSize GetCanvasSize() const
Reads the size of the current worksheet's visible window. See SetCanvasSize.
Definition: Configuration.h:805
void InternalHelpBrowser(bool useInternalHelpBrowser)
Use the internal help browser? If not a external web browser is used.
Definition: Configuration.h:946
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:952
bool IndentMaths() const
Do we want to indent all maths?
Definition: Configuration.h:562
wxString MaximaLocation() const
Returns the location of the maxima binary.
Definition: Configuration.cpp:976
void SetBackgroundBrush(const wxBrush &brush)
Set the brush to be used for the worksheet background.
Definition: Configuration.cpp:536
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:1296
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:556
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:1095
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:1107
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:959
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:624
const std::vector< TextStyle > & GetCodeStylesList() const
Which styles affect how code is displayed?
Definition: Configuration.h:1260
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:872
wxString MathJaXURL() const
Returns the URL MathJaX can be found at.
Definition: Configuration.h:976
bool RightToLeftDocument() const
Does the document read right-to-left (Arabic, Hebrew, Persian, Urdu)?
Definition: Configuration.h:833
void UpdateBackgroundBrush()
Refresh the cached document-background brush from the active style set.
Definition: Configuration.cpp:531
void AutodetectMaxima(bool autodetectmaxima)
Autodetect maxima's location?
Definition: Configuration.h:919
void SetChangeAsterisk(bool changeAsterisk)
Use Unicode centered dots for multiplication signs?
Definition: Configuration.h:688
std::random_device::result_type RandomEntropy()
One sample of OS entropy (std::random_device).
Definition: Configuration.h:1295
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:484
static void SetDebugmode()
Enable costly checks.
Definition: Configuration.h:1271
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:917
wxScrolledCanvas * GetWorkSheet() const
Get the worksheet canvas this configuration storage is valid for.
Definition: Configuration.h:1053
bool ClipToDrawRegion() const
Do we want to save time by only redrawing the area currently shown on the screen?
Definition: Configuration.h:1147
void SetZoomFactor(double newzoom)
Sets the zoom factor the worksheet is displayed at.
Definition: Configuration.cpp:930
bool ShowBrackets() const
Show the cell brackets [displayed left to each group cell showing its extend]?
Definition: Configuration.h:844
bool FixReorderedIndices() const
Renumber out-of-order cell labels on saving.
Definition: Configuration.h:970
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:669
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:533
long GetLineWidth() const
Returns the maximum sensible width for a text line [in characters]:
Definition: Configuration.cpp:895
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:510
void RequestAdjustWorksheetSize() const
Ask the view (if any) to re-adjust its worksheet (scroll) size.
Definition: Configuration.h:1186
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:936
bool OfferInternalHelpBrowser() const
If we decide that the HTML browser in the sidebar doesn't work for every platform....
Definition: Configuration.cpp:1145
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:1149
wxColour GetColor(TextStyle style)
Gets the color for a text style.
Definition: Configuration.cpp:1117
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:1297
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:1068
wxCoord Scale_Px(double px) const
Scales a distance [in pixels] according to the zoom factor.
Definition: Configuration.cpp:1124
void ReadConfig()
Read the config from the wxConfig object.
Definition: Configuration.cpp:589
void SetRecalculateRequestCallback(std::function< void(GroupCell *)> callback)
Set the callback RequestRecalculate() notifies the view through.
Definition: Configuration.h:1081
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:944
bool ScreenReaderAnnouncesMathML() const
Announce maxima's output to screen readers as MathML?
Definition: Configuration.h:1121
void SetParenthesisDrawMode(drawMode mode)
Which way do we want to draw parenthesis?
Definition: Configuration.h:1019
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:809
void MaximaParameters(wxString parameters)
The parameters we pass to the maxima binary.
Definition: Configuration.h:924
void NotifyOfCellRedraw(const Cell *cell)
Record that this cell has been drawn to ReportMultipleRedraws()
Definition: Configuration.cpp:862
long ShowLength() const
The choice for the "maximum output length to display" setting.
Definition: Configuration.h:1014
void ResetAllToDefaults()
Reset the whole configuration to its default values.
Definition: Configuration.cpp:234
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:987
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:1189
void SetDocumentCellPointers(DocumentCellPointers *p)
Register the document-model half of the cell-pointer registry.
Definition: Configuration.h:1066
bool UseUserLabels() const
Do we want at all to show labels?
Definition: Configuration.h:896
bool UpdateNeeded() const
true means: The system's config storage has changed since the configuration has been read
Definition: Configuration.cpp:1161
std::size_t ShowLength_Bytes() const
The "maximum output length to display" setting in cells.
Definition: Configuration.cpp:1321
long GetDisplayedDigits() const
Returns the maximum number of displayed digits.
Definition: Configuration.h:731
const Style * GetStyle(TextStyle textStyle) const
Get the text Style for a given text style identifier.
Definition: Configuration.h:1037
bool AutodetectHelpBrowser() const
Autodetect the web browser? (If false the user-specified location is used)
Definition: Configuration.h:939
void SetWorkSheet(wxScrolledCanvas *workSheet)
Set the worksheet canvas this configuration storage is valid for.
Definition: Configuration.cpp:203
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:1010
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:1078
const std::vector< TextStyle > & GetColorOnlyStylesList() const
Which styles affect only colors?
Definition: Configuration.h:1264
bool PrintBrackets() const
Print the cell brackets [displayed left to each group cell showing its extend]?
Definition: Configuration.h:855
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:1506
Sets the configuration's "printing" flag until this class is left.
Definition: Configuration.h:1489
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
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:599
const wxChar * key
The key the setting is stored under in the configuration store.
Definition: Configuration.h:601
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:606