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"
35#include "MaximaSessionInfo.h"
36#include "RenderContext.h"
37#include "Styles.h"
38#include "SymbolShortcuts.h"
39#include <cstdint>
40#include <functional>
41#include <memory>
42#include <mutex>
43#include <optional>
44#include <unordered_map>
45#include <random>
46#include <list>
47#include <utility>
48#include <variant>
49#include <vector>
50#include <algorithm>
51#include <atomic>
52#include <chrono>
53#include <wx/wupdlock.h>
54#include <list>
55
56#define MC_LINE_SKIP Scale_Px(2)
57#define MC_TEXT_PADDING Scale_Px(1)
58
59#define PAREN_OPEN_TOP_UNICODE "\u239b"
60#define PAREN_OPEN_EXTEND_UNICODE "\u239c"
61#define PAREN_OPEN_BOTTOM_UNICODE "\u239d"
62#define PAREN_CLOSE_TOP_UNICODE "\u239e"
63#define PAREN_CLOSE_EXTEND_UNICODE "\u239f"
64#define PAREN_CLOSE_BOTTOM_UNICODE "\u23a0"
65#define SUM_SIGN "\u2211"
66#define PROD_SIGN "\u220F"
68#define SUM_DEC 2
69
71#define MC_HCARET_WIDTH 25
72
73#define MC_EXP_INDENT static_cast<wxCoord>(Scale_Px(2))
74static constexpr AFontSize MC_MIN_SIZE{ 6.0f };
75static constexpr AFontSize MC_MAX_SIZE{ 48.0f };
76
77// The minimal and maximal label width
78#define LABELWIDTH_MIN 3
79#define LABELWIDTH_MAX 10
80class Cell;
83class GroupCell;
85template<class T> class wxScrolled;
87
103{
104public:
106 std::atomic<long> manualAnchorsFromBuiltin{0};
107 std::atomic<long> manualAnchorsFromCache{0};
108 std::atomic<long> manualAnchorsCompiled{0};
109 std::atomic<long> maximaProcessesSpawned{0};
110 std::atomic<long> fontCacheHits{0};
111 std::atomic<long> fontCacheMisses{0};
112 std::atomic<long> recalculationNeeded_FontInvalid{0};
113 std::atomic<long> recalculationNeeded_SizeInvalid{0};
114 std::atomic<long> recalculationNeeded_FontMismatch{0};
115 std::atomic<long> recalculationNeeded_ConfigChanged{0};
116 std::atomic<long> recalculationNeeded_CellsAppended{0};
117 std::atomic<long> recalculationNeeded_EditorDirty{0};
118 std::atomic<long> cellsConvertedToLinear{0};
119 std::atomic<long> cellsConvertedTo2D{0};
128 std::atomic<long> cellsDrawnAtWrongFontSize{0};
130 std::atomic<long> worksheetRepaints{0};
138 std::atomic<long> worksheetFullRepaints{0};
139 void Report() const;
140 };
141 static PerformanceStats g_stats;
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 using StringBoolHash = std::unordered_map<wxString, bool, wxStringHash>;
192 bool IsOperator(const 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
233 void MakeTemporary() { m_initOpts = temporary; }
234
236 void ResetAllToDefaults();
237
239 void SetRecalcContext(wxDC &dc)
240 {
241 m_renderContext.SetRecalcDC(&dc);
242 }
243 void UnsetContext() {m_renderContext.SetRecalcDC(nullptr);}
244
246 void SetBackgroundBrush(const wxBrush &brush);
248 bool FixedFontInTextControls() const {return m_fixedFontTC;}
250 void FixedFontInTextControls(bool fixed) {m_fixedFontTC = fixed;}
252 wxBrush GetBackgroundBrush() const {return m_renderContext.GetBackgroundBrush();}
258 wxBrush GetTooltipBrush() const;
269 static wxColour TooltipMarkerColour(const wxColour &background);
280 static wxColour OutsidePageColour(const wxColour &background);
281
282 virtual ~Configuration();
283
291
292 using EscCodeContainer = std::unordered_map<wxString, wxString, wxStringHash>;
293 using EscCodeIterator = EscCodeContainer::const_iterator;
294
296 static const wxString &GetEscCode(const wxString &key);
298 static EscCodeIterator EscCodesBegin();
300 static EscCodeIterator EscCodesEnd();
301
303 static double GetMinZoomFactor()
304 { return 0.1; }
305
307 static double GetMaxZoomFactor()
308 { return 32.0; }
309
316 double GetInterEquationSkip() const
317 {
319 return 0;
320 else
321 return GetZoomFactor() * m_styleStore[TS_MATH].GetFontSize() / 2;
322 }
323
325 wxCoord GetCellBracketWidth() const
326 {
327 return static_cast<wxCoord>(GetZoomFactor() * 16);
328 }
329
331 bool HideBrackets() const
332 { return m_hideBrackets; }
333
335 void HideBrackets(bool hide){m_hideBrackets = hide;}
336
344 bool OverlayScrollbars() const
345 { return m_overlayScrollbars; }
346
348 void OverlayScrollbars(bool overlay){m_overlayScrollbars = overlay;}
349
351 double PrintScale() const
352 { return m_printScale; }
353
355 void PrintScale(double scale){m_printScale = scale;}
356
357 void PrintMargin_Top(double margin){m_printMargin_Top = margin;}
358 void PrintMargin_Bot(double margin){m_printMargin_Bot = margin;}
359 void PrintMargin_Left(double margin){m_printMargin_Left = margin;}
360 void PrintMargin_Right(double margin){m_printMargin_Right = margin;}
361 double PrintMargin_Top() const {return m_printMargin_Top;}
362 double PrintMargin_Bot() const {return m_printMargin_Bot;}
363 double PrintMargin_Left() const {return m_printMargin_Left;}
364 double PrintMargin_Right() const {return m_printMargin_Right;}
365
373 void DefaultPageSettings(const wxm::PageSettings &settings);
374
383 const std::optional<wxm::PageSettings> &DocumentPageSettings() const
384 { return m_documentPageSettings; }
388 void DocumentPageSettings(const std::optional<wxm::PageSettings> &settings);
391 { return m_documentPageSettings ? *m_documentPageSettings : DefaultPageSettings(); }
392
400 bool PageView() const { return m_pageView; }
402 void PageView(bool pageView);
403
412 bool PaperLayout() const { return GetPrinting() || m_pageView; }
413
435 wxSize TextExtent(wxDC *dc, const wxString &text, wxCoord *descent = nullptr) const;
437 void TextExtent(wxDC *dc, const wxString &text, wxCoord *width, wxCoord *height,
438 wxCoord *descent = nullptr) const;
452 void DrawText(wxDC *dc, const wxString &text, wxCoord x, wxCoord y) const;
466 double PaperImageScale() const
467 { return GetZoomFactor() * 96.0 / std::max(GetPPI().x, 1); }
468
473 wxSize PageSizeInWorksheet() const;
474
482 wxCoord PageViewLeftEdge() const;
483
489 wxSize WorksheetCanvasSize(wxSize clientSize) const;
490
498 wxSize GetLayoutCanvasSize() const;
499
501 void SetZoomFactor(double newzoom);
502
504 void SetZoomFactor_temporarily(double newzoom){
505 if(m_zoomFactor != newzoom)
507 m_zoomFactor = newzoom;
508 }
509
514 wxCoord Scale_Px(double px) const;
515 AFontSize Scale_Px(AFontSize size) const;
516
518 double GetZoomFactor() const
519 { return m_zoomFactor; }
520
522 wxDC *GetRecalcDC() const
523 { return m_renderContext.GetRecalcDC(); }
524
525 void SetRecalcDC(wxDC *dc)
526 { m_renderContext.SetRecalcDC(dc); }
527
528 wxString GetFontName(TextStyle ts = TS_CODE_DEFAULT) const;
529
530 // cppcheck-suppress functionStatic
531 // cppcheck-suppress functionConst
532 wxString GetSymbolFontName() const;
533
535 static const wxString CharsNeedingQuotes()
536 {
537 return wxString(wxS("°,\\'\"()[]-{}^+*/&§?:;=#<>$"));
538 }
539
540 wxFontWeight IsBold(long st) const;
541
542 wxFontStyle IsItalic(long st) const;
543
544 bool IsUnderlined(long st) const {return m_styleStore[st].IsUnderlined();}
545
550 wxCoord GetLabelWidth() const
551 { return m_labelWidth * 14; }
552
554 long LabelWidth() const
555 { return m_labelWidth; }
557 void LabelWidth(long labelWidth)
558 {
559 if(m_labelWidth != labelWidth)
561 m_labelWidth = labelWidth;
562 }
563
565 wxCoord GetIndent() const
566 {
567 if (m_indent < 0)
568 return 3 * GetCellBracketWidth() / 2;
569 else
570 return m_indent;
571 }
572
578 wxSize GetPPI() const;
579 int AutosaveMinutes() const {return m_autoSaveMinutes;}
580 void AutosaveMinutes(int minutes){m_autoSaveMinutes = minutes;}
581
583 long GetCursorWidth() const
584 {
585 long ppi;
586
587 if(!GetPrinting())
588 ppi = GetPPI().x;
589 else
590 ppi = 96;
591
592 if (ppi / 45 < 1)
593 return 1;
594 else
595 return ppi / 45;
596 }
597
607 int GetWorksheetTopOffset() const { return m_worksheetTopOffset; }
613 void SetWorksheetTopOffset(int offset) { m_worksheetTopOffset = offset; }
614
616 long GetBaseIndent() const
617 {
618 if (GetCursorWidth() < 12)
619 return 12;
620 else
621 return 4 + GetCursorWidth();
622 }
623
625 long GetGroupSkip() const
626 {
627 if (GetCursorWidth() < 10)
628 return 20;
629 else
630 return 10 + GetCursorWidth();
631 }
632
637 void SetIndent(long indent)
638 {
639 if(m_indent != indent)
641 m_indent = indent;
642 }
643
644 bool IncrementalSearch() const {return m_incrementalSearch;}
645
646
647 void IncrementalSearch(bool incrementalSearch) { m_incrementalSearch = incrementalSearch; }
648
649 int MaxLayoutTime() const { return m_maxLayoutTime; }
650 void MaxLayoutTime(int time) { m_maxLayoutTime = time; }
651
652 enum class LayoutStrategy {
653 layout2DWheneverPossible = 0,
654 layout2DIfFits = 1,
655 layoutPrefer1D = 2
656 };
657 LayoutStrategy GetLayoutStrategy() const { return m_layoutStrategy; }
658 void SetLayoutStrategy(LayoutStrategy s) {
659 if (s != m_layoutStrategy)
661 m_layoutStrategy = s;
662 }
663
670 enum class OversizedMatrices {
672 showInFull = 0,
674 elide = 1,
681 scroll = 2
682 };
683 OversizedMatrices GetOversizedMatrices() const { return m_oversizedMatrices; }
693 void SetOversizedMatrices(OversizedMatrices mode, bool perMatrixOverridable = true) {
694 if ((mode != m_oversizedMatrices) ||
695 (perMatrixOverridable != m_oversizedMatricesOverridable))
697 m_oversizedMatrices = mode;
698 m_oversizedMatricesOverridable = perMatrixOverridable;
699 }
710 OversizedMatrices OversizedMatricesFor(std::optional<OversizedMatrices> requested) const {
711 if (requested && m_oversizedMatricesOverridable)
712 return *requested;
713 return m_oversizedMatrices;
714 }
715
722 enum class ImageBackdrop {
724 none = 0,
728 always = 2
729 };
730 ImageBackdrop GetImageBackdrop() const { return m_imageBackdrop; }
731 void SetImageBackdrop(ImageBackdrop mode) { m_imageBackdrop = mode; }
737 switch (m_imageBackdrop) {
739 return true;
741 return !GetPrinting() && (DefaultBackgroundColor().GetLuminance() < 0.5);
743 break;
744 }
745 return false;
746 }
747
754 MatrixScrollHost *GetMatrixScrollHost() const { return m_matrixScrollHost; }
762 void SetMatrixScrollHost(MatrixScrollHost *host) { m_matrixScrollHost = host; }
763
764 void SetLayoutDeadline(int seconds) {
765 m_renderContext.SetLayoutDeadline(seconds);
766 }
767 void ClearLayoutCancelled() {
768 m_renderContext.ClearLayoutCancelled();
769 }
770 bool IsLayoutCancelled() const {
771 return m_renderContext.IsLayoutCancelled();
772 }
773
776 {
778 }
779
781 double GetDefaultLineWidth() const
782 {
783 if (GetZoomFactor() < 1.0)
784 return 1.0;
785 else
786 return GetZoomFactor();
787 }
788
790 long LineWidth_em() const
791 {
792 if(!PaperLayout())
793 return m_lineWidth_em;
794 else
795 return 10000;
796 }
797
798 bool AutoSaveAsTempFile() const {return m_autoSaveAsTempFile;}
799 void AutoSaveAsTempFile(bool asTempFile){m_autoSaveAsTempFile = asTempFile;}
800
802 void LineWidth_em(long width)
803 { m_lineWidth_em = width; }
804
806 // On big 16:9 screens text tends to get \b very wide before it hits the right margin.
807 // But text blocks that are 1 meter wide and 2 cm high feel - weird.
808 long GetLineWidth() const;
809
813 long GetAsciiArtColumns() const;
814
815 bool SaveUntitled() const { return m_saveUntitled;}
816 void SaveUntitled(bool save) {m_saveUntitled = save;}
817
818 bool CursorJump() const { return m_cursorJump;}
819 void CursorJump(bool save){m_cursorJump = save;}
820
828 bool ArrowKeysSkipOutput() const { return m_arrowKeysSkipOutput;}
829 void ArrowKeysSkipOutput(bool skip){m_arrowKeysSkipOutput = skip;}
830
831 bool NumpadEnterEvaluates() const { return m_numpadEnterEvaluates;}
832 void NumpadEnterEvaluates(bool eval){m_numpadEnterEvaluates = eval;}
833
834 bool SaveImgFileName() const { return m_saveImgFileName;}
835 void SaveImgFileName(bool save) { m_saveImgFileName = save;}
836
838 bool GetAutoWrap() const
839 { return m_autoWrap > 0; }
840
842 bool GetAutoWrapCode() const
843 { return m_autoWrap > 1; }
844
856 void SetAutoWrap(long autoWrap){
857 m_autoWrap = autoWrap;
858 if (m_autoWrap < 0)
859 m_autoWrap = 0;
860 if (m_autoWrap > 2)
861 m_autoWrap = 1;
862 }
863
865 bool GetAutoIndent() const
866 { return m_autoIndent; }
867
868 void SetAutoIndent(bool autoIndent){m_autoIndent = autoIndent;}
869
871 bool IndentMaths() const {return m_indentMaths;}
872 void IndentMaths(bool indent){
873 if(m_indentMaths != indent)
875 m_indentMaths = indent;}
876 AFontSize GetFontSize(TextStyle st) const { return m_styleStore[st].GetFontSize(); }
877
878 static const wxString &GetStyleName(TextStyle textStyle);
879
885 void ReadStyles(const wxString &file = {});
886
891 void WriteStyles(const wxString &file = {});
892 void WriteStyles(wxConfigBase *config);
893 void WriteSettings(const wxString &file = {});
901 static const std::vector<std::pair<TextStyle, wxString>> &StyleConfigKeys();
902
910 const wxChar *key;
912 std::variant<bool Configuration::*, int Configuration::*,
913 long Configuration::*, double Configuration::*,
914 wxString Configuration::*>
916 };
927 static const std::vector<ScalarSetting> &ScalarConfigSettings();
928 void MakeStylesConsistent();
929 void Outdated(bool outdated)
930 { m_outdated = outdated; }
931
933 bool CheckKeepPercent() const
934 { return m_keepPercent; }
935
937 void SetKeepPercent(bool keepPercent)
938 {
939 if(m_keepPercent != keepPercent)
941 m_keepPercent = keepPercent;
942 }
943
944 wxString GetTeXCMRI() const
945 { return m_fontCMRI; }
946
947 wxString GetTeXCMSY() const
948 { return m_fontCMSY; }
949
950 wxString GetTeXCMEX() const
951 { return m_fontCMEX; }
952
953 wxString GetTeXCMMI() const
954 { return m_fontCMMI; }
955
956 wxString GetTeXCMTI() const
957 { return m_fontCMTI; }
958
959 bool ShowCodeCells() const
960 { return m_showCodeCells; }
961
962 void ShowCodeCells(bool show);
963
970 void SetPrinting(bool printing);
971
978 bool GetPrinting() const
979 { return m_renderContext.Printing(); }
980
982 wxColour GetColor(TextStyle style);
983
984
985 bool UsePngCairo() const { return m_usepngCairo;}
986 void UsePngCairo(bool usepngCairo) { m_usepngCairo = usepngCairo;}
987
988 bool GetMatchParens() const { return m_matchParens; }
989 void SetMatchParens(bool matchParens) { m_matchParens = matchParens; }
990 bool ShowMatchingParens() const { return m_showMatchingParens; }
991 void ShowMatchingParens(bool show) { m_showMatchingParens = show; }
992
994 bool GetChangeAsterisk() const{ return m_changeAsterisk; }
995
997 void SetChangeAsterisk(bool changeAsterisk) {
998 if(m_changeAsterisk != changeAsterisk)
1000 m_changeAsterisk = changeAsterisk;
1001 }
1002
1003 bool HidemultiplicationSign() const {return m_hidemultiplicationsign;}
1004
1005 void HidemultiplicationSign(bool show) {
1006 if(m_hidemultiplicationsign != show)
1008 m_hidemultiplicationsign = show;
1009 }
1010
1011 bool Latin2Greek() const
1012 {return m_latin2greek;}
1013
1014 void Latin2Greek(bool latin2greek) {
1015 if(m_latin2greek != latin2greek)
1017 m_latin2greek = latin2greek;
1018 }
1019
1020 bool GreekSidebar_ShowLatinLookalikes() const {return m_greekSidebar_ShowLatinLookalikes;}
1021 void GreekSidebar_ShowLatinLookalikes(bool show){m_greekSidebar_ShowLatinLookalikes = show;}
1022
1023 bool GreekSidebar_Show_mu() const {return m_greekSidebar_Show_mu;}
1024 void GreekSidebar_Show_mu(bool show) {m_greekSidebar_Show_mu = show;}
1025
1026 wxString SymbolPaneAdditionalChars() const
1027 {return m_symbolPaneAdditionalChars;}
1028 void SymbolPaneAdditionalChars(wxString symbols) {m_symbolPaneAdditionalChars = std::move(symbols);}
1029
1036 std::vector<wxm::SymbolShortcut> SymbolShortcuts() const
1037 {return wxm::ParseSymbolShortcuts(m_symbolShortcuts);}
1038 void SymbolShortcuts(const std::vector<wxm::SymbolShortcut> &shortcuts)
1039 {m_symbolShortcuts = wxm::SerializeSymbolShortcuts(shortcuts);}
1041 wxString ShortcutForSymbol(const wxString &symbol) const;
1047 void SetShortcutForSymbol(const wxString &symbol, const wxString &shortcut);
1054 void WriteSymbolShortcuts() const;
1055
1057 bool NotifyIfIdle() const
1058 { return m_notifyIfIdle; }
1059
1060 void NotifyIfIdle(bool notify) {m_notifyIfIdle = notify;}
1061
1064 { return m_findDialogDockable; }
1065
1066 void FindDialogDockable(bool dockable) {m_findDialogDockable = dockable;}
1067
1074 bool McpServerEnabled() const { return m_mcpServerEnabled; }
1075 void McpServerEnabled(bool enabled) { m_mcpServerEnabled = enabled; }
1076
1078 int McpServerPort() const { return m_mcpServerPort; }
1079 void McpServerPort(int port) { m_mcpServerPort = port; }
1080
1085 int AiChatProvider() const { return m_aiChatProvider; }
1086 void AiChatProvider(int provider) { m_aiChatProvider = provider; }
1087
1097 wxString AiApiKeyAnthropic() const;
1098 void AiApiKeyAnthropic(const wxString &key);
1099 wxString AiApiKeyOpenAI() const;
1100 void AiApiKeyOpenAI(const wxString &key);
1101 wxString AiApiKeyGoogle() const;
1102 void AiApiKeyGoogle(const wxString &key);
1103 wxString AiApiKeyQwen() const;
1104 void AiApiKeyQwen(const wxString &key);
1108 wxString AiApiKeyGitHubModels() const;
1109 void AiApiKeyGitHubModels(const wxString &key);
1110 wxString AiApiKeyDeepSeek() const;
1111 void AiApiKeyDeepSeek(const wxString &key);
1112 wxString AiApiKeyOpenRouter() const;
1113 void AiApiKeyOpenRouter(const wxString &key);
1114
1118 wxString AiModelAnthropic() const { return m_aiModelAnthropic; }
1119 void AiModelAnthropic(const wxString &model) { m_aiModelAnthropic = model; }
1120 wxString AiModelOpenAI() const { return m_aiModelOpenAI; }
1121 void AiModelOpenAI(const wxString &model) { m_aiModelOpenAI = model; }
1122 wxString AiModelGoogle() const { return m_aiModelGoogle; }
1123 void AiModelGoogle(const wxString &model) { m_aiModelGoogle = model; }
1124 wxString AiModelQwen() const { return m_aiModelQwen; }
1125 void AiModelQwen(const wxString &model) { m_aiModelQwen = model; }
1126 wxString AiModelGitHubModels() const { return m_aiModelGitHubModels; }
1127 void AiModelGitHubModels(const wxString &model) { m_aiModelGitHubModels = model; }
1128 wxString AiModelDeepSeek() const { return m_aiModelDeepSeek; }
1129 void AiModelDeepSeek(const wxString &model) { m_aiModelDeepSeek = model; }
1130 wxString AiModelOpenRouter() const { return m_aiModelOpenRouter; }
1131 void AiModelOpenRouter(const wxString &model) { m_aiModelOpenRouter = model; }
1132
1138 wxString AiCustomProvidersJson() const { return m_aiCustomProvidersJson; }
1139 void AiCustomProvidersJson(const wxString &json) { m_aiCustomProvidersJson = json; }
1140
1144 wxString AiActiveCustomProviderId() const { return m_aiActiveCustomProviderId; }
1145 void AiActiveCustomProviderId(const wxString &id) { m_aiActiveCustomProviderId = id; }
1146
1152 { return m_displayedDigits; }
1153
1154 void SetDisplayedDigits(long displayedDigits)
1155 {
1156 wxASSERT_MSG(displayedDigits >= 0, _("Bug: Maximum number of digits that is to be displayed is too low!"));
1157 if(m_displayedDigits != displayedDigits)
1159 m_displayedDigits = displayedDigits;
1160 }
1161
1164 {
1165 public:
1166 FileToSave(const wxString &filename, const wxMemoryBuffer &data):
1167 m_data(data),
1168 m_filename(filename)
1169 {
1170 }
1171 const wxString FileName() const{return m_filename;}
1172 const wxMemoryBuffer Data() const{return m_data;}
1173 private:
1174 const wxMemoryBuffer m_data;
1175 const wxString m_filename;
1176 };
1177
1180 {
1181 public:
1182 TextsnippetToDraw(const wxPoint &pos, const wxString &text, const wxColor &color):
1183 m_pos(pos),
1184 m_text(text),
1185 m_color(color)
1186 {
1187 }
1188 const wxPoint Pos() const{return m_pos;}
1189 const wxString Text() const{return m_text;}
1190 const wxColor Color() const{return m_color;}
1191 private:
1192 const wxPoint m_pos;
1193 const wxString m_text;
1194 const wxColor m_color;
1195 };
1196
1197 void PushFileToSave(const wxString &filename, const wxMemoryBuffer &data)
1198 { m_filesToSave.emplace_front(filename, data); }
1199
1200 wxRect GetUpdateRegion() const {return m_renderContext.GetUpdateRegion();}
1201 const std::list<FileToSave> &GetFilesToSave() const {return m_filesToSave;}
1202 void ClearFilesToSave () { m_filesToSave.clear();}
1209 std::list<FileToSave> TakeFilesToSave() { return std::exchange(m_filesToSave, {}); }
1211 void SetFilesToSave(std::list<FileToSave> files) { m_filesToSave = std::move(files); }
1212 void SetUpdateRegion(wxRect rect){m_renderContext.SetUpdateRegion(rect);}
1213
1221 bool GetPrintedPage(wxCoord &top, wxCoord &bottom) const {
1222 const wxRect page = m_renderContext.GetPrintedPage();
1223 if (page.IsEmpty())
1224 return false;
1225 top = page.GetTop();
1226 bottom = page.GetTop() + page.GetHeight();
1227 return true;
1228 }
1230 void SetPrintedPage(wxCoord top, wxCoord bottom) {
1231 m_renderContext.SetPrintedPage(wxRect(0, top, 1, std::max<wxCoord>(0, bottom - top)));
1232 }
1234 void ClearPrintedPage() { m_renderContext.SetPrintedPage(wxRect()); }
1235
1238 bool InUpdateRegion(wxRect rect) const;
1239
1240 bool GetInsertAns() const
1241 { return m_insertAns; }
1242
1243 void SetInsertAns(bool insertAns){ m_insertAns = insertAns; }
1244
1245 bool GetOpenHCaret() const
1246 { return m_openHCaret; }
1247
1248 void SetOpenHCaret(bool openHCaret){ m_openHCaret = openHCaret; }
1249
1250 bool RestartOnReEvaluation() const
1251 { return m_restartOnReEvaluation; }
1252
1253 void RestartOnReEvaluation(bool arg){ m_restartOnReEvaluation = arg; }
1254
1256 wxSize GetCanvasSize() const
1257 { return m_renderContext.GetCanvasSize(); }
1258
1260 void SetCanvasSize(wxSize siz)
1261 {
1262 if(GetCanvasSize().GetWidth() != siz.GetWidth() ||
1263 GetCanvasSize().GetHeight() != siz.GetHeight())
1265 m_renderContext.SetCanvasSize(siz);
1266 }
1267
1285 { return m_rightToLeftDocument; }
1286
1287 bool RightToLeftDocument(bool rightToLeft)
1288 {
1289 if (m_rightToLeftDocument != rightToLeft)
1291 return m_rightToLeftDocument = rightToLeft;
1292 }
1293
1295 bool ShowBrackets() const
1296 { return m_showBrackets; }
1297
1298 bool ShowBrackets(bool show)
1299 {
1300 if(m_showBrackets != show)
1302 return m_showBrackets = show;
1303 }
1304
1306 bool PrintBrackets() const
1307 { return m_printBrackets; }
1308
1309 showLabels GetLabelChoice() const
1310 { return m_showLabelChoice; }
1311
1312 bool ShowInputLabels() const {return m_showInputLabels;}
1313 void ShowInputLabels(bool show) {
1314 if(m_showInputLabels != show)
1316 m_showInputLabels = show;
1317 }
1318
1320 enum class Appearance { light, dark, followSystem };
1321 Appearance GetAppearance() const { return m_appearance; }
1324 m_appearance = a;
1325 m_styleStore.SetUseDark(UseDarkMode());
1327 }
1329 void UpdateBackgroundBrush();
1331 bool UseDarkMode() const {
1332 if (m_appearance == Appearance::dark) return true;
1333 if (m_appearance == Appearance::light) return false;
1334 return SystemIsDark();
1335 }
1337 static bool SystemIsDark();
1338
1339 long RecentItems(){return std::max(m_recentItems, static_cast<long>(0));}
1340 void RecentItems(long items){ m_recentItems = items; }
1341
1344 { return (m_showLabelChoice < labels_useronly); }
1345
1347 bool UseUserLabels() const
1348 { return m_showLabelChoice > labels_automatic; }
1349
1351 bool ShowLabels() const
1352 { return m_showLabelChoice < labels_none; }
1353
1355 void SetLabelChoice(showLabels choice) {
1356 if(m_showLabelChoice != choice)
1358 m_showLabelChoice = choice;
1359 }
1360
1361 bool PrintBrackets(bool print)
1362 {
1363 m_printBrackets = print;
1364 return print;
1365 }
1366
1368 bool AutodetectMaxima() const {return m_autodetectMaxima;}
1370 void AutodetectMaxima(bool autodetectmaxima){m_autodetectMaxima = autodetectmaxima;}
1371
1373 wxString MaximaParameters() const {return m_maximaParameters;}
1375 void MaximaParameters(wxString parameters){m_maximaParameters = std::move(parameters);}
1376
1378 static wxString MaximaDefaultLocation();
1379
1381 wxString MaximaLocation() const;
1382
1384 wxString MaximaUserLocation() const {return m_maximaUserLocation;}
1385
1387 void MaximaUserLocation(wxString maxima) { m_maximaUserLocation = std::move(maxima); }
1388
1390 bool AutodetectHelpBrowser() const {return m_autodetectHelpBrowser;}
1392 void AutodetectHelpBrowser(bool autodetect){m_autodetectHelpBrowser = autodetect;}
1393
1395 bool InternalHelpBrowser() const {return m_useInternalHelpBrowser && OfferInternalHelpBrowser();}
1397 void InternalHelpBrowser(bool useInternalHelpBrowser)
1398 {m_useInternalHelpBrowser = useInternalHelpBrowser;}
1399
1401 bool SinglePageManual() const {return m_singlePageManual;}
1403 void SinglePageManual(bool singlePageManual)
1404 {m_singlePageManual = singlePageManual;}
1405
1407 wxString HelpBrowserUserLocation() const {return m_helpBrowserUserLocation;}
1408
1410 void HelpBrowserUserLocation(wxString helpBrowser) { m_helpBrowserUserLocation = std::move(helpBrowser);}
1411
1418 static wxString FindProgram(const wxString &location);
1419
1422 { return m_fixReorderedIndices; }
1423
1424 void FixReorderedIndices(bool fix) { m_fixReorderedIndices = fix;}
1425
1427 wxString MathJaXURL() const {
1428 if(m_mathJaxURL_UseUser)
1429 return m_mathJaxURL;
1430 else
1431 return MathJaXURL_Auto();}
1432 wxString MathJaXURL_User() const { return m_mathJaxURL;}
1433 bool MathJaXURL_UseUser() const { return m_mathJaxURL_UseUser;}
1434 void MathJaXURL_UseUser(bool useUser){m_mathJaxURL_UseUser = useUser;}
1435
1436 bool EnterEvaluates() const {return m_enterEvaluates;}
1437 void EnterEvaluates(bool enterEvaluates) {m_enterEvaluates = enterEvaluates;}
1438 static wxString MathJaXURL_Auto() { return wxS("https://cdn.jsdelivr.net/npm/mathjax@4/tex-mml-chtml.js");}
1440 void MathJaXURL(wxString url){m_mathJaxURL = std::move(url);}
1441
1442 bool HideMarkerForThisMessage(const wxString& message);
1443 void HideMarkerForThisMessage(const wxString &message, bool hide)
1444 {m_hideMarkerForThisMessage[message] = hide;}
1445 bool UseSVG() const {return m_useSVG;}
1446 void UseSVG(bool useSVG) { m_useSVG = useSVG ;}
1448 void ShowLength(long length) {
1449 m_showLength = length;
1450 }
1452 long ShowLength() const {return m_showLength;}
1454 std::size_t ShowLength_Bytes() const;
1455
1458 if(m_parenthesisDrawMode != mode)
1460 m_parenthesisDrawMode = mode;
1461 }
1462
1463 void TocShowsSectionNumbers(bool showSectionNumbers) { m_TOCshowsSectionNumbers = showSectionNumbers; }
1464
1465 bool TocShowsSectionNumbers() const {return m_TOCshowsSectionNumbers;}
1466
1471 const Style *GetStyle(TextStyle textStyle) const { return &m_styleStore[textStyle]; }
1479 Style *GetWritableStyle(TextStyle textStyle) { return &m_styleStore[textStyle]; }
1480
1487 wxScrolledCanvas *GetWorkSheet() const {return m_workSheet;}
1489 void SetWorkSheet(wxScrolledCanvas *workSheet);
1490
1498 DocumentCellPointers *GetDocumentCellPointers() const {return m_documentCellPointers;}
1500 void SetDocumentCellPointers(DocumentCellPointers *p) {m_documentCellPointers = p;}
1502 ViewCellPointers *GetViewCellPointers() const {return m_viewCellPointers;}
1504 void SetViewCellPointers(ViewCellPointers *p) {m_viewCellPointers = p;}
1505
1513 {if (m_recalculateRequest) m_recalculateRequest(group);}
1515 void SetRecalculateRequestCallback(std::function<void(GroupCell *)> callback)
1516 {m_recalculateRequest = std::move(callback);}
1517
1527 {if (m_recalculateAllRequest) m_recalculateAllRequest();}
1529 void SetRecalculateAllRequestCallback(std::function<void()> callback)
1530 {m_recalculateAllRequest = std::move(callback);}
1531
1532 long DefaultPort() const {return m_defaultPort;}
1533 void DefaultPort(long port){m_defaultPort = port;}
1534 bool GetAbortOnError() const {return m_abortOnError;}
1535 void SetAbortOnError(bool abortOnError) {m_abortOnError = abortOnError;}
1536
1542 long GetLanguage() const {
1543 return (m_languageOverride != wxLANGUAGE_UNKNOWN) ? m_languageOverride
1544 : m_language;
1545 }
1551 long GetConfiguredLanguage() const {return m_language;}
1552 void SetLanguage(long language) {m_language = language;}
1557 static void SetLanguageOverride(long language) {m_languageOverride = language;}
1558
1560 long MaxGnuplotMegabytes() const {return m_maxGnuplotMegabytes;}
1561 void MaxGnuplotMegabytes(long megaBytes)
1562 {m_maxGnuplotMegabytes = megaBytes;}
1563
1564 bool OfferKnownAnswers() const {return m_offerKnownAnswers;}
1565 void OfferKnownAnswers(bool offerKnownAnswers)
1566 {m_offerKnownAnswers = offerKnownAnswers;}
1567
1574 bool ScreenReaderAnnouncesMathML() const {return m_screenReaderAnnouncesMathML;}
1576 {m_screenReaderAnnouncesMathML = mathML;}
1577
1578 wxString Documentclass() const {return m_documentclass;}
1579 void Documentclass(wxString clss){m_documentclass = std::move(clss);}
1580 wxString DocumentclassOptions() const {return m_documentclassOptions;}
1581 void DocumentclassOptions(wxString classOptions){m_documentclassOptions = std::move(classOptions);}
1582
1583
1584 htmlExportFormat HTMLequationFormat() const {return m_htmlEquationFormat;}
1585 void HTMLequationFormat(htmlExportFormat HTMLequationFormat)
1586 {m_htmlEquationFormat = HTMLequationFormat;}
1587
1588 AFontSize GetDefaultFontSize() const { return m_styleStore[TS_CODE_DEFAULT].GetFontSize(); }
1589 AFontSize GetMathFontSize() const { return m_styleStore[TS_MATH].GetFontSize(); }
1590
1592 long GetAutosubscript_Num() const {return m_autoSubscript;}
1593 void SetAutosubscript_Num(long autosubscriptnum) {m_autoSubscript = autosubscriptnum;}
1594 wxString GetAutosubscript_string() const;
1596 wxColor DefaultBackgroundColor();
1598 wxColor EditorBackgroundColor();
1600 bool ClipToDrawRegion() const {return m_renderContext.ClipToDrawRegion();}
1602 void ClipToDrawRegion(bool clipToDrawRegion){m_renderContext.ClipToDrawRegion(clipToDrawRegion);}
1603 void SetVisibleRegion(wxRect visibleRegion){
1604 if(m_renderContext.GetVisibleRegion().GetWidth() != visibleRegion.GetWidth())
1606 m_renderContext.SetVisibleRegion(visibleRegion);
1607 }
1608 wxRect GetVisibleRegion() const {return m_renderContext.GetVisibleRegion();}
1609 void SetWorksheetPosition(wxPoint worksheetPosition){m_renderContext.SetWorksheetPosition(worksheetPosition);}
1610 wxPoint GetWorksheetPosition() const {return m_renderContext.GetWorksheetPosition();}
1611 wxString MaximaShareDir() const {return m_maximaSession.ShareDir();}
1612 void MaximaShareDir(wxString dir){m_maximaSession.ShareDir(std::move(dir));}
1613 wxString MaximaDemoDir() const {return m_maximaSession.DemoDir();}
1614 void MaximaDemoDir(wxString dir){m_maximaSession.DemoDir(std::move(dir));}
1615 void InLispMode(bool lisp){m_maximaSession.InLispMode(lisp);}
1616 bool InLispMode() const {return m_maximaSession.InLispMode();}
1617 void BitmapScale(int factor){m_bitmapScale = factor;}
1618 int BitmapScale() const {return m_bitmapScale;}
1619 void DefaultPlotHeight(int px){m_defaultPlotHeight = px;}
1620 int DefaultPlotHeight() const {return m_defaultPlotHeight;}
1621 void DefaultPlotWidth(int px){m_defaultPlotWidth = px;}
1622 int DefaultPlotWidth() const {return m_defaultPlotWidth;}
1623 void DefaultFramerate(double fps){m_defaultFramerate = fps;}
1624 double DefaultFramerate() const {return m_defaultFramerate;}
1625 void TocDepth(int depth){m_tocDepth = depth;}
1626 int TocDepth() const {return m_tocDepth;}
1627 bool TeXExponentsAfterSubscript() const {return m_TeXExponentsAfterSubscript;}
1628 void TeXExponentsAfterSubscript(bool ExponentsAfterSubscript)
1629 {m_TeXExponentsAfterSubscript = ExponentsAfterSubscript;}
1630 bool UsePartialForDiff() const {return m_usePartialForDiff;}
1631 void UsePartialForDiff(bool usePartialForDiff)
1632 {m_usePartialForDiff = usePartialForDiff;}
1640 {if (m_adjustWorksheetSizeRequest) m_adjustWorksheetSizeRequest();}
1642 void SetAdjustWorksheetSizeRequestCallback(std::function<void()> callback)
1643 {m_adjustWorksheetSizeRequest = std::move(callback);}
1645 void NotifyOfCellRedraw(const Cell *cell);
1655 void ReportMultipleRedraws();
1657 bool OfferInternalHelpBrowser() const;
1668 static bool ShowHelpInSidebarFromOldKey(bool stored, bool storedOnWindows,
1669 bool defaultValue);
1670 bool WrapLatexMath() const {return m_wrapLatexMath;}
1671 void WrapLatexMath(bool wrapLatexMath){m_wrapLatexMath = wrapLatexMath;}
1672 bool AllowNetworkHelp() const {return m_allowNetworkHelp;}
1673 void AllowNetworkHelp(bool allowNetworkHelp){m_allowNetworkHelp = allowNetworkHelp;}
1674 bool ShowAllDigits() const {return m_showAllDigits;}
1675 void ShowAllDigits(bool shw){
1676 if(m_showAllDigits != shw)
1678 m_showAllDigits = shw;
1679 }
1680 bool LineBreaksInLongNums() const {return m_lineBreaksInLongNums;}
1681 void LineBreaksInLongNums(bool brk){
1682 if(m_lineBreaksInLongNums != brk)
1684 m_lineBreaksInLongNums = brk;
1685 }
1690 bool DigitGrouping() const {return m_digitGrouping;}
1691 void DigitGrouping(bool group){
1692 if(m_digitGrouping != group)
1694 m_digitGrouping = group;
1695 }
1697 long DigitGroupingMinDigits() const {return m_digitGroupingMinDigits;}
1698 void DigitGroupingMinDigits(long digits){
1699 digits = std::max(digits, DigitGroupingMinDigits_Min);
1700 if(m_digitGroupingMinDigits != digits)
1702 m_digitGroupingMinDigits = digits;
1703 }
1705 static constexpr long DigitGroupingMinDigits_Min = 2;
1706
1707 void ExportContainsWXMX(bool exportContainsWXMX){m_exportContainsWXMX = exportContainsWXMX;}
1708 bool ExportContainsWXMX() const {return m_exportContainsWXMX;}
1716 bool HTMLExportSelfContained() const {return m_htmlExportSelfContained;}
1717 void HTMLExportSelfContained(bool selfContained)
1718 {m_htmlExportSelfContained = selfContained;}
1719 void WizardTab(long tab){m_wizardTab = tab;}
1720 long WizardTab() const {return m_wizardTab;}
1721
1722 void Display2d_Unicode(bool unicode){m_display2d_Unicode = unicode;}
1723 bool Display2d_Unicode() const {return m_display2d_Unicode;}
1724
1725 #ifdef __WXMSW__
1726 bool UseWGnuplot() const {return m_useWgnuplot;}
1727 void UseWGnuplot(bool usewgnuplot) {m_useWgnuplot = usewgnuplot;}
1728 #endif
1729 wxString TexPreamble() const {return m_texPreamble;}
1730 void TexPreamble(wxString texPreamble) {m_texPreamble = std::move(texPreamble);}
1731
1732 void SetMaximaVersion(const wxString &version){m_maximaSession.SetMaximaVersion(version);}
1733 wxString GetMaximaVersion() const {return m_maximaSession.GetMaximaVersion();}
1734 void SetMaximaArch(const wxString &arch){m_maximaSession.SetMaximaArch(arch);}
1735 wxString GetMaximaArch() const {return m_maximaSession.GetMaximaArch();}
1736 void SetLispVersion(const wxString &version){m_maximaSession.SetLispVersion(version);}
1737 wxString GetLispVersion() const {return m_maximaSession.GetLispVersion();}
1738 void SetLispType(const wxString &type){m_maximaSession.SetLispType(type);}
1739 wxString GetLispType() const {return m_maximaSession.GetLispType();}
1740
1742 void InitStyles();
1744 bool FontRendersChar(wxUniChar ch, const wxFont &font = *wxNORMAL_FONT)
1745 { return m_fontRenderability.FontRendersChar(ch, font); }
1746
1748 const std::vector<TextStyle> &GetCodeStylesList() const {return m_styleStore.CodeStylesList();}
1750 const std::vector<TextStyle> &GetMathStylesList() const {return m_styleStore.MathStylesList();}
1752 const std::vector<TextStyle> &GetColorOnlyStylesList() const {return m_styleStore.ColorOnlyStylesList();}
1753 bool StyleAffectsCode(TextStyle style) const;
1754 bool StyleAffectsMathOut(TextStyle style) const;
1755 bool StyleAffectsColorOnly(TextStyle style) const;
1757 bool UpdateNeeded() const;
1759 static void SetDebugmode(){m_debugMode = true;}
1761 static bool GetDebugmode(){return m_debugMode;}
1771 bool MaximaHelpInConsole() const {return m_maximaHelpInConsole;}
1772 void MaximaHelpInConsole(bool console) {m_maximaHelpInConsole = console;}
1774 wxString MaximaHelpFormatName() const;
1780 wxString MaximaHelpFormatCommand() const;
1781
1782private:
1784 MaximaSessionInfo m_maximaSession;
1786 InitOpt m_initOpts;
1792 long m_configId;
1794 std::random_device m_rd;
1796 std::default_random_engine m_eng;
1797 wxEnvVariableHashMap m_maximaEnvVars;
1798public:
1800 std::random_device::result_type RandomEntropy(){return m_rd();}
1802 std::default_random_engine &RandomEngine(){return m_eng;}
1810 std::int_fast32_t CellCfgCnt() const {return m_cellCfgCnt;}
1818 m_cellCfgCnt++;
1820 }
1821 static bool UseThreads(){return m_use_threads;}
1822 static void UseThreads(bool use){m_use_threads = use;}
1823 static void SetMaximaLang(const wxString &LANG){m_maxima_LANG = LANG;}
1824 static wxString GetMaximaLang(){return m_maxima_LANG;}
1825private:
1827 static wxString m_maxima_LANG;
1828 std::list<FileToSave> m_filesToSave;
1830 Styles m_styleStore;
1832 StringBoolHash m_hideMarkerForThisMessage;
1834 FontRenderabilityCache m_fontRenderability;
1835 mathDisplayMode m_displayMode = display_2d;
1836 static bool m_debugMode;
1837 bool m_showInputLabels;
1838 long m_wizardTab;
1839 bool m_display2d_Unicode;
1840 bool m_usePartialForDiff;
1842 bool m_autoSaveAsTempFile;
1844 long m_language;
1846 bool m_autodetectMaxima;
1848 bool m_autodetectHelpBrowser;
1850 bool m_useInternalHelpBrowser;
1852 bool m_singlePageManual;
1854 bool m_incrementalSearch;
1856 long m_autoSubscript;
1858 wxScrolledCanvas *m_workSheet = nullptr;
1860 DocumentCellPointers *m_documentCellPointers = nullptr;
1862 ViewCellPointers *m_viewCellPointers = nullptr;
1864 std::function<void(GroupCell *)> m_recalculateRequest;
1866 std::function<void()> m_recalculateAllRequest;
1868 std::function<void()> m_adjustWorksheetSizeRequest;
1870 RenderContext m_renderContext;
1871 bool m_wrapLatexMath;
1872 bool m_allowNetworkHelp;
1873 bool m_exportContainsWXMX;
1874 bool m_htmlExportSelfContained;
1875 wxString m_texPreamble;
1876
1877 drawMode m_parenthesisDrawMode;
1878 bool m_TeXExponentsAfterSubscript;
1879 wxString m_helpBrowserUserLocation;
1880 wxString m_maximaUserLocation;
1882 bool m_hideBrackets;
1884 bool m_overlayScrollbars;
1886 double m_printScale;
1887 double m_printMargin_Top;
1888 double m_printMargin_Bot;
1889 double m_printMargin_Left;
1890 double m_printMargin_Right;
1892 long m_printPaper;
1894 long m_printOrientation;
1896 long m_printLayoutDpi = wxm::PageSettings::DefaultLayoutDpi;
1898 std::optional<wxm::PageSettings> m_documentPageSettings;
1900 bool m_pageView = false;
1902 mutable wxFont m_printMetricsFontFor;
1903 mutable wxFont m_printMetricsFont;
1905 mutable double m_printMetricsSize = 0;
1907 bool m_rightToLeftDocument;
1909 bool m_showBrackets;
1911 bool m_printBrackets;
1917 bool m_changeAsterisk;
1919 bool m_notifyIfIdle;
1921 bool m_findDialogDockable;
1923 bool m_mcpServerEnabled;
1925 int m_mcpServerPort;
1927 int m_aiChatProvider = 0;
1928 wxString m_aiModelAnthropic;
1929 wxString m_aiModelOpenAI;
1930 wxString m_aiModelGoogle;
1931 wxString m_aiModelQwen;
1932 wxString m_aiModelGitHubModels;
1933 wxString m_aiModelDeepSeek;
1934 wxString m_aiModelOpenRouter;
1936 wxString m_aiCustomProvidersJson;
1938 wxString m_aiActiveCustomProviderId;
1940 long m_displayedDigits;
1942 long m_autoWrap;
1944 bool m_autoIndent;
1946 bool m_showAllDigits;
1948 bool m_lineBreaksInLongNums;
1950 bool m_digitGrouping;
1952 long m_digitGroupingMinDigits;
1954 bool m_matchParens;
1956 bool m_insertAns;
1958 bool m_openHCaret;
1960 long m_labelWidth;
1961 long m_indent;
1962 bool m_latin2greek;
1963 double m_zoomFactor;
1964 bool m_outdated;
1965 wxString m_maximaParameters;
1966 bool m_keepPercent;
1967 bool m_restartOnReEvaluation;
1968 wxString m_fontCMRI, m_fontCMSY, m_fontCMEX, m_fontCMMI, m_fontCMTI;
1969 long m_lineWidth_em;
1970 showLabels m_showLabelChoice;
1971 bool m_fixReorderedIndices;
1972 wxString m_mathJaxURL;
1973 bool m_mathJaxURL_UseUser;
1974 bool m_showCodeCells;
1975 long m_showLength;
1976 bool m_usepngCairo;
1977 bool m_enterEvaluates;
1978 bool m_useSVG;
1979 bool m_fixedFontTC;
1980 bool m_TOCshowsSectionNumbers;
1981 bool m_indentMaths;
1982 bool m_abortOnError;
1983 bool m_showMatchingParens;
1984 bool m_hidemultiplicationsign;
1985 bool m_offerKnownAnswers;
1986 bool m_screenReaderAnnouncesMathML;
1987 long m_defaultPort;
1988 long m_maxGnuplotMegabytes;
1989 long m_defaultPlotHeight;
1990 long m_defaultPlotWidth;
1991 bool m_saveUntitled;
1992 bool m_cursorJump;
1993 bool m_arrowKeysSkipOutput;
1994 bool m_numpadEnterEvaluates;
1995 bool m_saveImgFileName;
1996 wxString m_documentclass;
1997 wxString m_documentclassOptions;
1998 htmlExportFormat m_htmlEquationFormat;
1999
2000 wxColour m_defaultBackgroundColor;
2001 bool m_greekSidebar_ShowLatinLookalikes;
2002 #ifdef __WXMSW__
2003 bool m_useWgnuplot = false;
2004 #endif
2005 bool m_greekSidebar_Show_mu;
2006 wxString m_symbolPaneAdditionalChars;
2008 wxString m_symbolShortcuts;
2009 Appearance m_appearance = Appearance::followSystem;
2010 long m_recentItems;
2011 int m_bitmapScale;
2012 double m_defaultFramerate;
2013 int m_tocDepth;
2014 int m_autoSaveMinutes;
2015 int m_maxLayoutTime;
2016 LayoutStrategy m_layoutStrategy = LayoutStrategy::layout2DIfFits;
2017 OversizedMatrices m_oversizedMatrices = OversizedMatrices::elide;
2019 bool m_oversizedMatricesOverridable = true;
2022 MatrixScrollHost *m_matrixScrollHost = nullptr;
2024 int m_worksheetTopOffset = 0;
2025 wxString m_wxMathML_Filename;
2026 bool m_maximaHelpInConsole = false;
2027 std::atomic<std::int_fast32_t> m_cellCfgCnt{0};
2028 static bool m_use_threads;
2029};
2030
2033{
2034public:
2035 explicit Printing(Configuration *configuration)
2036 {
2037 m_configuration = configuration;
2038 m_configuration->SetPrinting(true);
2039 }
2040 virtual ~Printing()
2041 {
2042 m_configuration->SetPrinting(false);
2043 }
2044private:
2045 Configuration * m_configuration;
2046};
2047
2050{
2051public:
2052 explicit NoClipToDrawRegion(Configuration *configuration)
2053 {
2054 m_configuration = configuration;
2055 m_configuration->ClipToDrawRegion(false);
2056 }
2057 virtual ~NoClipToDrawRegion()
2058 {
2059 m_configuration->ClipToDrawRegion(true);
2060 }
2061private:
2062 Configuration * m_configuration;
2063};
2064
2065#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 wxm::PageSettings, the paper a worksheet is printed on.
Declares RenderContext: the per-render-pass state of a worksheet.
This file declares the class Styles.
Keyboard shortcuts that type a symbol into the worksheet (GH #2578).
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:230
int group
Neighbouring sections of the same group aren't separated.
Definition: ToolBarSections.cpp:45
const wxChar * key
The name in the config file.
Definition: ToolBarSections.cpp:37
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:1164
Stores the information about a file we need to write during the save process.
Definition: Configuration.h:1180
The configuration storage for the current worksheet.
Definition: Configuration.h:103
void SetOversizedMatrices(OversizedMatrices mode, bool perMatrixOverridable=true)
Sets how oversized matrices are shown.
Definition: Configuration.h:693
void RecalculateForce()
Force every cell to be recalculated on the next layout pass.
Definition: Configuration.h:1817
bool HTMLExportSelfContained() const
Does the HTML export produce one self-contained file?
Definition: Configuration.h:1716
wxDC * GetRecalcDC() const
Get a drawing context suitable for size calculations.
Definition: Configuration.h:522
wxString AiActiveCustomProviderId() const
Which custom provider is active, by AiCustomProviderConfig::id – meaningful only when AiChatProvider(...
Definition: Configuration.h:1144
Appearance
How wxMaxima chooses between the light and the dark style set.
Definition: Configuration.h:1320
wxString HelpBrowserUserLocation() const
Returns the location of the web browser the user has selected.
Definition: Configuration.h:1407
void SetShortcutForSymbol(const wxString &symbol, const wxString &shortcut)
Gives a symbol a shortcut, or none if shortcut is empty.
Definition: Configuration.cpp:1697
wxColor EditorBackgroundColor()
Determine the default background color of editorcells.
Definition: Configuration.cpp:1037
long GetAsciiArtColumns() const
How many columns of the ASCII-art monospace font (TS_ASCIIMATHS) fit into GetLineWidth()?...
Definition: Configuration.cpp:1097
long GetAutosubscript_Num() const
Get the worksheet this configuration storage is valid for.
Definition: Configuration.h:1592
void SetViewCellPointers(ViewCellPointers *p)
Register the transient view-state half of the cell-pointer registry.
Definition: Configuration.h:1504
bool ShowAutomaticLabels() const
Do we want to show maxima's automatic labels (o1, t1, i1,...)?
Definition: Configuration.h:1343
void AutodetectHelpBrowser(bool autodetect)
Autodetect the web browser?
Definition: Configuration.h:1392
bool FontRendersChar(wxUniChar ch, const wxFont &font= *wxNORMAL_FONT)
True if we are confident that the font renders this char.
Definition: Configuration.h:1744
void MathJaXURL(wxString url)
Returns the URL MathJaX can be found at.
Definition: Configuration.h:1440
double GetInterEquationSkip() const
Extra space to leave between two equations in output cells.
Definition: Configuration.h:316
static bool GetDebugmode()
Enable costly checks?
Definition: Configuration.h:1761
double PaperImageScale() const
The scale an image is drawn at on paper and in the page view.
Definition: Configuration.h:466
bool GetChangeAsterisk() const
Use Unicode centered dots for multiplication signs?
Definition: Configuration.h:994
std::list< FileToSave > TakeFilesToSave()
Hands out the list of files to save, leaving it empty.
Definition: Configuration.h:1209
void SetZoomFactor_temporarily(double newzoom)
Sets the zoom factor without storing the new value in the config file/registry.
Definition: Configuration.h:504
static bool SystemIsDark()
Whether the OS reports a dark appearance (false where wx cannot tell).
Definition: Configuration.cpp:531
static bool ShowHelpInSidebarFromOldKey(bool stored, bool storedOnWindows, bool defaultValue)
What the "useInternalHelpBrowser" key of an old config means now.
Definition: Configuration.cpp:1520
void SetAutoWrap(long autoWrap)
Sets the auto wrap mode.
Definition: Configuration.h:856
wxSize GetPPI() const
Get the resolution.
Definition: Configuration.cpp:230
bool GetAutoWrap() const
Do we want to have automatic line breaks for text cells?
Definition: Configuration.h:838
void ClearAndEnableRedrawTracing()
Clear the memory of ReportMultipleRedraws()
Definition: Configuration.cpp:1047
void ReportMultipleRedraws()
Report if a cell has been redrawn 2 or more times during a simple Draw() command.
Definition: Configuration.cpp:1053
static wxString FindProgram(const wxString &location)
Could a maxima binary be found in the path we expect it to be in?
Definition: Configuration.cpp:608
wxString AiModelAnthropic() const
The model id to request from each provider; defaults to AiProviderDefaultModel() but the user can ove...
Definition: Configuration.h:1118
void DrawText(wxDC *dc, const wxString &text, wxCoord x, wxCoord y) const
Draw a text whose extent TextExtent() measured.
Definition: Configuration.cpp:1242
void SetPrintedPage(wxCoord top, wxCoord bottom)
Sets the page being printed to the worksheet's y range [top, bottom)
Definition: Configuration.h:1230
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:1579
bool DrawImageBackdrop()
Whether images are to be drawn on the TS_IMAGE_BACKDROP colour right now.
Definition: Configuration.h:736
void FontChanged()
To be called if a font has changed.
Definition: Configuration.h:775
long GetLanguage() const
The UI language in effect: the –language option's, if one was given.
Definition: Configuration.h:1542
static double GetMaxZoomFactor()
The upper limit we allow for the zoom factor.
Definition: Configuration.h:307
wxBrush GetTooltipBrush() const
Get the brush to be used for worksheet objects that provide a mouse-over tooltip.
Definition: Configuration.cpp:578
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:535
void ClearPrintedPage()
Forgets the page being printed: cells draw everything again.
Definition: Configuration.h:1234
bool HideBrackets() const
Hide brackets that are not under the pointer?
Definition: Configuration.h:331
bool NotifyIfIdle() const
Notify the user if maxima is idle?
Definition: Configuration.h:1057
OversizedMatrices OversizedMatricesFor(std::optional< OversizedMatrices > requested) const
How one specific matrix that is too large for the window is shown.
Definition: Configuration.h:710
void RequestRecalculateAll() const
Ask the view to schedule a recalculation of the WHOLE worksheet.
Definition: Configuration.h:1526
wxCoord PageViewLeftEdge() const
How far right of the paper's left margin the worksheet's x = 0 is.
Definition: Configuration.cpp:1280
static EscCodeIterator EscCodesBegin()
Iterators over the escape code list.
Definition: Configuration.cpp:543
void SetPrinting(bool printing)
Are we currently printing?
Definition: Configuration.cpp:1065
static wxString MaximaDefaultLocation()
The auto-detected maxima location.
Definition: Configuration.cpp:1359
bool McpServerEnabled() const
Run the MCP (Model Context Protocol) server, exposing the current worksheet's contents (cells,...
Definition: Configuration.h:1074
static constexpr long DigitGroupingMinDigits_Min
The smallest value DigitGroupingMinDigits() accepts: 1 digit has no groups.
Definition: Configuration.h:1705
int McpServerPort() const
Which localhost TCP port the MCP server listens on, if enabled.
Definition: Configuration.h:1078
void SetLabelChoice(showLabels choice)
Sets the value of the Configuration ChoiceBox that treads displaying labels.
Definition: Configuration.h:1355
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:1511
void SetKeepPercent(bool keepPercent)
Do we want to display "%e" as "%e" and "%pi" as "%pi"?
Definition: Configuration.h:937
bool SinglePageManual() const
Prefer the single-page manual?
Definition: Configuration.h:1401
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:1723
const std::vector< TextStyle > & GetMathStylesList() const
Which styles affect how math output is displayed?
Definition: Configuration.h:1750
DocumentCellPointers * GetDocumentCellPointers() const
The registry of special cells (selection, active cell, errors, ...) of this document.
Definition: Configuration.h:1498
wxColor DefaultBackgroundColor()
Determine the default background color of the worksheet.
Definition: Configuration.cpp:1033
bool UseDarkMode() const
Whether the dark style set is currently active.
Definition: Configuration.h:1331
wxString MaximaUserLocation() const
Returns the location of the maxima binary the user has selected.
Definition: Configuration.h:1384
Style * GetWritableStyle(TextStyle textStyle)
Get the text Style for a given text style identifier.
Definition: Configuration.h:1479
wxCoord GetLabelWidth() const
Get the width of worksheet labels [in unscaled pixels].
Definition: Configuration.h:550
void WriteSettings(const wxString &file={})
Saves the settings to a file.
Definition: Configuration.cpp:1391
wxString MaximaHelpFormatCommand() const
The command that sets Maxima's output_format_for_help accordingly.
Definition: Configuration.cpp:954
mathDisplayMode DisplayMode() const
Does maxima output 1D, 2D or 2D ASCII equations?
Definition: Configuration.h:202
long DigitGroupingMinDigits() const
How many digits a number needs before DigitGrouping() groups them.
Definition: Configuration.h:1697
wxCoord GetIndent() const
Get the indentation of GroupCells.
Definition: Configuration.h:565
std::int_fast32_t CellCfgCnt() const
A counter that increases every time we need to recalculate all worksheet cells.
Definition: Configuration.h:1810
bool ShowLabels() const
Do we want at all to show labels?
Definition: Configuration.h:1351
bool FindDialogDockable() const
Show "Find and Replace" as a dockable sidebar instead of a floating dialog?
Definition: Configuration.h:1063
wxString MaximaParameters() const
Parameters to the maxima binary.
Definition: Configuration.h:1373
long GetConfiguredLanguage() const
The UI language the configuration stores, ignoring –language.
Definition: Configuration.h:1551
static void SetLanguageOverride(long language)
Use this language for this session, without saving it (–language)
Definition: Configuration.h:1557
wxSize GetCanvasSize() const
Reads the size of the current worksheet's visible window. See SetCanvasSize.
Definition: Configuration.h:1256
void InternalHelpBrowser(bool useInternalHelpBrowser)
Use the internal help browser? If not a external web browser is used.
Definition: Configuration.h:1397
double GetZoomFactor() const
Determines the zoom factor the worksheet is displayed at.
Definition: Configuration.h:518
long LineWidth_em() const
The minimum sensible line width in widths of a letter.
Definition: Configuration.h:790
void SinglePageManual(bool singlePageManual)
Prefer the single-page manual?
Definition: Configuration.h:1403
ImageBackdrop
What is drawn behind the transparent parts of an image (GH #2227)
Definition: Configuration.h:722
@ none
Nothing: the worksheet shows through.
@ always
Always the backdrop colour.
@ onDarkBackground
The backdrop colour, but only if the worksheet's background is dark (the default)
wxString AiApiKeyGitHubModels() const
A GitHub personal access token (fine-grained, "Models: read" permission) – see AiProviderKind::GitHub...
bool IndentMaths() const
Do we want to indent all maths?
Definition: Configuration.h:871
wxString MaximaLocation() const
Returns the location of the maxima binary.
Definition: Configuration.cpp:1352
void SetBackgroundBrush(const wxBrush &brush)
Set the brush to be used for the worksheet background.
Definition: Configuration.cpp:574
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:1716
bool FixedFontInTextControls() const
Use a typewriter font in wizard entry fields that can contain maxima commands?
Definition: Configuration.h:248
MatrixScrollHost * GetMatrixScrollHost() const
What gives a scrolling matrix its scrollbars, if anything.
Definition: Configuration.h:754
bool GetAutoIndent() const
Do we want automatic indentation?
Definition: Configuration.h:865
long LabelWidth() const
Get the width of worksheet labels [in chars].
Definition: Configuration.h:554
wxSize PageSizeInWorksheet() const
How wide and tall the printable part of a page is in the worksheet.
Definition: Configuration.cpp:1274
wxString ShortcutForSymbol(const wxString &symbol) const
The shortcut that types this symbol, or an empty string.
Definition: Configuration.cpp:1690
void SetRecalcContext(wxDC &dc)
Set the drawing context that is currently active.
Definition: Configuration.h:239
double PrintScale() const
Hide brackets that are not under the pointer?
Definition: Configuration.h:351
wxString GetWorkingDirectory() const
Get maxima's working directory.
Definition: Configuration.h:211
wxSize TextExtent(wxDC *dc, const wxString &text, wxCoord *descent=nullptr) const
The extent of a text in the dc's current font, as it will be on paper.
Definition: Configuration.cpp:1191
long GetBaseIndent() const
The y position the worksheet starts at.
Definition: Configuration.h:616
void SetRecalculateAllRequestCallback(std::function< void()> callback)
Set the callback RequestRecalculateAll() / RecalculateForce() notify through.
Definition: Configuration.h:1529
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:1560
long GetGroupSkip() const
The vertical space between GroupCells.
Definition: Configuration.h:625
void HelpBrowserUserLocation(wxString helpBrowser)
Sets the location of the web browser the user has detected.
Definition: Configuration.h:1410
void SetWorksheetTopOffset(int offset)
Sets the extra top margin.
Definition: Configuration.h:613
void SetWorkingDirectory(wxString dir)
Set maxima's working directory.
Definition: Configuration.h:207
wxm::PageSettings PageSettingsInUse() const
The page settings printing, the PDF export and the page view use.
Definition: Configuration.h:390
bool CheckKeepPercent() const
Do we want to display "%e" as "%e" and "%pi" as "%pi"?
Definition: Configuration.h:933
const std::vector< TextStyle > & GetCodeStylesList() const
Which styles affect how code is displayed?
Definition: Configuration.h:1748
static const wxString CharsNeedingQuotes()
Returns a list of chars we need to escape in maxima.
Definition: Configuration.h:535
void SetAppearance(Appearance a)
Choose the appearance and update which style set is active.
Definition: Configuration.h:1323
wxString MathJaXURL() const
Returns the URL MathJaX can be found at.
Definition: Configuration.h:1427
bool RightToLeftDocument() const
Does the document read right-to-left (Arabic, Hebrew, Persian, Urdu)?
Definition: Configuration.h:1284
wxSize WorksheetCanvasSize(wxSize clientSize) const
The size the worksheet window's client area gives the layout.
Definition: Configuration.cpp:1287
void UpdateBackgroundBrush()
Refresh the cached document-background brush from the active style set.
Definition: Configuration.cpp:569
void AutodetectMaxima(bool autodetectmaxima)
Autodetect maxima's location?
Definition: Configuration.h:1370
void SetChangeAsterisk(bool changeAsterisk)
Use Unicode centered dots for multiplication signs?
Definition: Configuration.h:997
std::random_device::result_type RandomEntropy()
One sample of OS entropy (std::random_device).
Definition: Configuration.h:1800
bool PaperLayout() const
Is the worksheet laid out the way it would be on paper?
Definition: Configuration.h:412
bool IsOperator(const wxString &name) const
Coincides name with a operator known to maxima?
Definition: Configuration.h:192
bool MaximaHelpInConsole() const
Does Maxima answer ?, ?? and describe() with plain text in the worksheet?
Definition: Configuration.h:1771
void PrintScale(double scale)
Define if we want to hide brackets that are not under the pointer.
Definition: Configuration.h:355
void InitStyles()
Initialize the text styles on construction.
Definition: Configuration.cpp:524
static void SetDebugmode()
Enable costly checks.
Definition: Configuration.h:1759
static double GetMinZoomFactor()
The lower limit we allow for the zoom factor.
Definition: Configuration.h:303
bool AutodetectMaxima() const
Autodetect maxima's location? (If false the user-specified location is used)
Definition: Configuration.h:1368
wxScrolledCanvas * GetWorkSheet() const
Get the worksheet canvas this configuration storage is valid for.
Definition: Configuration.h:1487
bool ClipToDrawRegion() const
Do we want to save time by only redrawing the area currently shown on the screen?
Definition: Configuration.h:1600
void SetZoomFactor(double newzoom)
Sets the zoom factor the worksheet is displayed at.
Definition: Configuration.cpp:1300
bool DigitGrouping() const
Separate the digit groups of long numbers by a small gap? (GH #192)
Definition: Configuration.h:1690
bool ShowBrackets() const
Show the cell brackets [displayed left to each group cell showing its extend]?
Definition: Configuration.h:1295
bool FixReorderedIndices() const
Renumber out-of-order cell labels on saving.
Definition: Configuration.h:1421
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:978
wxBrush GetBackgroundBrush() const
Get the brush to be used for the worksheet background.
Definition: Configuration.h:252
void SetIndent(long indent)
Set the indentation of GroupCells.
Definition: Configuration.h:637
bool GetAutoWrapCode() const
Do we want to have automatic line breaks for code cells?
Definition: Configuration.h:842
long GetLineWidth() const
Returns the maximum sensible width for a text line [in characters]:
Definition: Configuration.cpp:1074
void SetFilesToSave(std::list< FileToSave > files)
Replaces the list of files to save; see TakeFilesToSave().
Definition: Configuration.h:1211
void FixedFontInTextControls(bool fixed)
Use a typewriter font in wizard entry fields that can contain maxima commands?
Definition: Configuration.h:250
static EscCodeIterator EscCodesEnd()
Iterators over the escape code list.
Definition: Configuration.cpp:546
void RequestAdjustWorksheetSize() const
Ask the view (if any) to re-adjust its worksheet (scroll) size.
Definition: Configuration.h:1639
wxCoord GetCellBracketWidth() const
The width we allocate for our cell brackets.
Definition: Configuration.h:325
bool PageView() const
Is the worksheet shown as it would be printed? (View > Page view)
Definition: Configuration.h:400
void MaximaUserLocation(wxString maxima)
Sets the location of the maxima binary.
Definition: Configuration.h:1387
bool OfferInternalHelpBrowser() const
If we decide that the HTML browser in the sidebar doesn't work for every platform....
Definition: Configuration.cpp:1527
const std::optional< wxm::PageSettings > & DocumentPageSettings() const
The current document's own page settings, if it has any.
Definition: Configuration.h:383
bool OverlayScrollbars() const
Use GTK's overlay scrollbars on the worksheet?
Definition: Configuration.h:344
void ClipToDrawRegion(bool clipToDrawRegion)
Do we want to save time by only redrawing the area currently shown on the screen?
Definition: Configuration.h:1602
wxColour GetColor(TextStyle style)
Gets the color for a text style.
Definition: Configuration.cpp:1492
long GetCursorWidth() const
How much vertical space is to be left between two group cells?
Definition: Configuration.h:583
static wxString m_configfileLocation_override
Where to store the configuration.
Definition: Configuration.h:288
static wxColour TooltipMarkerColour(const wxColour &background)
The color the background of a cell with a mouse-over tooltip is tinted to.
Definition: Configuration.cpp:583
static long m_languageOverride
The language –language asked for, or wxLANGUAGE_UNKNOWN.
Definition: Configuration.h:290
void LineWidth_em(long width)
Set the minimum sensible line width in widths of a letter.
Definition: Configuration.h:802
void MakeTemporary()
Makes this configuration temporary.
Definition: Configuration.h:233
std::default_random_engine & RandomEngine()
The pseudo-random engine, e.g. to feed a distribution.
Definition: Configuration.h:1802
wxString MaximaHelpFormatName() const
The value of Maxima's output_format_for_help MaximaHelpInConsole() stands for.
Definition: Configuration.cpp:948
void HideBrackets(bool hide)
Define if we want to hide brackets that are not under the pointer.
Definition: Configuration.h:335
double GetDefaultLineWidth() const
Calculates the default line width for the worksheet.
Definition: Configuration.h:781
ViewCellPointers * GetViewCellPointers() const
The transient view-state half of the cell-pointer registry (null if none).
Definition: Configuration.h:1502
int GetWorksheetTopOffset() const
An extra top margin of less than one scroll unit, in px.
Definition: Configuration.h:607
wxCoord Scale_Px(double px) const
Scales a distance [in pixels] according to the zoom factor.
Definition: Configuration.cpp:1499
void ReadConfig()
Read the config from the wxConfig object.
Definition: Configuration.cpp:655
void SetRecalculateRequestCallback(std::function< void(GroupCell *)> callback)
Set the callback RequestRecalculate() notifies the view through.
Definition: Configuration.h:1515
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:1395
bool ScreenReaderAnnouncesMathML() const
Announce maxima's output to screen readers as MathML?
Definition: Configuration.h:1574
void SetParenthesisDrawMode(drawMode mode)
Which way do we want to draw parenthesis?
Definition: Configuration.h:1457
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:348
void SetCanvasSize(wxSize siz)
Sets the size of the current worksheet's visible window.
Definition: Configuration.h:1260
void MaximaParameters(wxString parameters)
The parameters we pass to the maxima binary.
Definition: Configuration.h:1375
void NotifyOfCellRedraw(const Cell *cell)
Record that this cell has been drawn to ReportMultipleRedraws()
Definition: Configuration.cpp:1041
long ShowLength() const
The choice for the "maximum output length to display" setting.
Definition: Configuration.h:1452
void ResetAllToDefaults()
Reset the whole configuration to its default values.
Definition: Configuration.cpp:250
std::vector< wxm::SymbolShortcut > SymbolShortcuts() const
The keyboard shortcuts that type a symbol into the worksheet (GH #2578).
Definition: Configuration.h:1036
static wxColour OutsidePageColour(const wxColour &background)
The color the page view fills the area right of the page with.
Definition: Configuration.cpp:598
OversizedMatrices
How to show a matrix too large for the window.
Definition: Configuration.h:670
@ scroll
Show a window-sized part of it, with native scrollbars.
@ elide
Leave out the middle rows/columns, marking the gap with ⋯ ⋮ ⋱ (the default)
@ showInFull
Draw it whole; the worksheet grows, and scrolls, to fit it.
int AiChatProvider() const
Which AI provider the AI chat sidebar talks to, as an AiProviderKind cast to int (0 = AiProviderKind:...
Definition: Configuration.h:1085
void SetMaximaEnvVar(const wxString &name, const wxString &value)
Set a custom environment variable for the maxima process.
Definition: Configuration.h:199
wxString AiCustomProvidersJson() const
User-added custom providers (beyond the four built-in ones), as a JSON array – see AiCustomProviderCo...
Definition: Configuration.h:1138
void ReadStyles(const wxString &file={})
Reads the style settings.
Definition: Configuration.cpp:1363
void SetMatrixScrollHost(MatrixScrollHost *host)
Sets the scrollbar host.
Definition: Configuration.h:762
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:1642
void SetDocumentCellPointers(DocumentCellPointers *p)
Register the document-model half of the cell-pointer registry.
Definition: Configuration.h:1500
bool UseUserLabels() const
Do we want at all to show labels?
Definition: Configuration.h:1347
bool ArrowKeysSkipOutput() const
Do the Up and Down keys skip over a cell's output?
Definition: Configuration.h:828
void WriteSymbolShortcuts() const
Writes the symbol shortcuts to the config file right away.
Definition: Configuration.cpp:1709
bool UpdateNeeded() const
true means: The system's config storage has changed since the configuration has been read
Definition: Configuration.cpp:1539
std::size_t ShowLength_Bytes() const
The "maximum output length to display" setting in cells.
Definition: Configuration.cpp:1741
long GetDisplayedDigits() const
Returns the maximum number of displayed digits.
Definition: Configuration.h:1151
const Style * GetStyle(TextStyle textStyle) const
Get the text Style for a given text style identifier.
Definition: Configuration.h:1471
bool AutodetectHelpBrowser() const
Autodetect the web browser? (If false the user-specified location is used)
Definition: Configuration.h:1390
void SetWorkSheet(wxScrolledCanvas *workSheet)
Set the worksheet canvas this configuration storage is valid for.
Definition: Configuration.cpp:221
wxString AiApiKeyAnthropic() const
The user's API key for each provider, kept separate so switching providers in Options doesn't lose th...
void ShowLength(long length)
The choice for the "maximum output length to display" setting.
Definition: Configuration.h:1448
wxSize GetLayoutCanvasSize() const
The room the layout has for one thing, as GetCanvasSize(), but in the page view as tall as a page rat...
Definition: Configuration.cpp:1293
void LabelWidth(long labelWidth)
Set the width of worksheet labels [in chars].
Definition: Configuration.h:557
void RequestRecalculate(GroupCell *group) const
Ask the view (if any) to recalculate the layout starting at the given group cell.
Definition: Configuration.h:1512
wxm::PageSettings DefaultPageSettings() const
The page settings a document without settings of its own is printed with.
Definition: Configuration.cpp:1134
const std::vector< TextStyle > & GetColorOnlyStylesList() const
Which styles affect only colors?
Definition: Configuration.h:1752
bool GetPrintedPage(wxCoord &top, wxCoord &bottom) const
The vertical range of the worksheet the page being printed shows.
Definition: Configuration.h:1221
bool PrintBrackets() const
Print the cell brackets [displayed left to each group cell showing its extend]?
Definition: Configuration.h:1306
The document-model half of the cell-pointer registry.
Definition: CellPointers.h:54
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
Whatever can give a matrix real scrollbars.
Definition: MatrixScrollHost.h:46
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:94
bool InLispMode() const
Is maxima currently in lisp mode (where commands need no trailing ";")?
Definition: MaximaSessionInfo.h:107
void SetLispType(const wxString &type)
Sets the type of the lisp the connected Maxima runs on.
Definition: MaximaSessionInfo.h:91
void SetMaximaArch(const wxString &arch)
Sets the processor architecture the connected Maxima runs on.
Definition: MaximaSessionInfo.h:83
wxString GetMaximaArch() const
The processor architecture the connected Maxima runs on.
Definition: MaximaSessionInfo.h:81
wxString GetLispVersion() const
The version of the lisp the connected Maxima runs on.
Definition: MaximaSessionInfo.h:85
wxString DemoDir() const
The directory maxima's demo files live in.
Definition: MaximaSessionInfo.h:102
void AddOperator(const wxString &name)
Registers name as an operator known to maxima.
Definition: MaximaSessionInfo.h:74
void SetWorkingDirectory(wxString dir)
Sets maxima's working directory.
Definition: MaximaSessionInfo.h:96
wxString ShareDir() const
The directory maxima's shared files (e.g. the manual) live in.
Definition: MaximaSessionInfo.h:98
wxString GetLispType() const
The type of the lisp the connected Maxima runs on.
Definition: MaximaSessionInfo.h:89
void SetMaximaVersion(const wxString &version)
Sets the version of the connected Maxima.
Definition: MaximaSessionInfo.h:79
void SetLispVersion(const wxString &version)
Sets the version of the lisp the connected Maxima runs on.
Definition: MaximaSessionInfo.h:87
wxString GetMaximaVersion() const
The version of the connected Maxima.
Definition: MaximaSessionInfo.h:77
bool IsOperator(const wxString &name) const
Is this name an operator known to maxima?
Definition: MaximaSessionInfo.h:71
Clears the configuration's "Clip to draw region" flag until this class is left.
Definition: Configuration.h:2050
Sets the configuration's "printing" flag until this class is left.
Definition: Configuration.h:2033
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:181
void ClearLayoutCancelled()
Stops the layout deadline and clears the cancelled flag.
Definition: RenderContext.h:198
wxRect GetPrintedPage() const
The part of the worksheet the page being printed shows, if any.
Definition: RenderContext.h:126
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:173
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:190
wxBrush GetBackgroundBrush() const
The brush the worksheet's background is painted with.
Definition: RenderContext.h:185
void SetPrintedPage(wxRect page)
Sets the part of the worksheet the page being printed shows.
Definition: RenderContext.h:128
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:204
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:179
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:109
const std::vector< TextStyle > & MathStylesList() const
The styles that share the 2d-math font.
Definition: Styles.h:107
const std::vector< TextStyle > & CodeStylesList() const
The styles that share the code-default font/attributes.
Definition: Styles.h:105
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:341
Definition: CellPointers.h:36
Definition: Configuration.h:105
std::atomic< long > worksheetRepaints
How often the worksheet was repainted (Worksheet::OnPaint ran)
Definition: Configuration.h:130
std::atomic< long > cellsDrawnAtWrongFontSize
How many cells were drawn at a different font size than they were laid out with.
Definition: Configuration.h:128
std::atomic< long > worksheetFullRepaints
How many of those repaints covered (nearly) the whole visible worksheet.
Definition: Configuration.h:138
One mechanically persisted scalar setting: its config key and the member variable it is stored in.
Definition: Configuration.h:908
const wxChar * key
The key the setting is stored under in the configuration store.
Definition: Configuration.h:910
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:915
The paper a worksheet is printed or exported to PDF on.
Definition: PageSettings.h:51
static constexpr long DefaultLayoutDpi
The layoutDpi a document without one gets: the commonest printer resolution.
Definition: PageSettings.h:75