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 "SymbolShortcuts.h"
38#include <cstdint>
39#include <functional>
40#include <memory>
41#include <mutex>
42#include <optional>
43#include <unordered_map>
44#include <random>
45#include <list>
46#include <utility>
47#include <variant>
48#include <vector>
49#include <algorithm>
50#include <atomic>
51#include <chrono>
52#include <wx/wupdlock.h>
53#include <list>
54
55#define MC_LINE_SKIP Scale_Px(2)
56#define MC_TEXT_PADDING Scale_Px(1)
57
58#define PAREN_OPEN_TOP_UNICODE "\u239b"
59#define PAREN_OPEN_EXTEND_UNICODE "\u239c"
60#define PAREN_OPEN_BOTTOM_UNICODE "\u239d"
61#define PAREN_CLOSE_TOP_UNICODE "\u239e"
62#define PAREN_CLOSE_EXTEND_UNICODE "\u239f"
63#define PAREN_CLOSE_BOTTOM_UNICODE "\u23a0"
64#define SUM_SIGN "\u2211"
65#define PROD_SIGN "\u220F"
67#define SUM_DEC 2
68
70#define MC_HCARET_WIDTH 25
71
72#define MC_EXP_INDENT static_cast<wxCoord>(Scale_Px(2))
73static constexpr AFontSize MC_MIN_SIZE{ 6.0f };
74static constexpr AFontSize MC_MAX_SIZE{ 48.0f };
75
76// The minimal and maximal label width
77#define LABELWIDTH_MIN 3
78#define LABELWIDTH_MAX 10
79class Cell;
82class GroupCell;
84template<class T> class wxScrolled;
86
102{
103public:
105 std::atomic<long> manualAnchorsFromBuiltin{0};
106 std::atomic<long> manualAnchorsFromCache{0};
107 std::atomic<long> manualAnchorsCompiled{0};
108 std::atomic<long> maximaProcessesSpawned{0};
109 std::atomic<long> fontCacheHits{0};
110 std::atomic<long> fontCacheMisses{0};
111 std::atomic<long> recalculationNeeded_FontInvalid{0};
112 std::atomic<long> recalculationNeeded_SizeInvalid{0};
113 std::atomic<long> recalculationNeeded_FontMismatch{0};
114 std::atomic<long> recalculationNeeded_ConfigChanged{0};
115 std::atomic<long> recalculationNeeded_CellsAppended{0};
116 std::atomic<long> recalculationNeeded_EditorDirty{0};
117 std::atomic<long> cellsConvertedToLinear{0};
118 std::atomic<long> cellsConvertedTo2D{0};
127 std::atomic<long> cellsDrawnAtWrongFontSize{0};
129 std::atomic<long> worksheetRepaints{0};
137 std::atomic<long> worksheetFullRepaints{0};
138 void Report() const;
139 };
140 static PerformanceStats g_stats;
141
144 {
149 bitmap = 1,
153 svg = 3,
157 html_export_invalidChoice
158 };
159
160 enum showLabels : int8_t
161 {
162 labels_automatic = 0,
163 labels_prefer_user = 1,
164 labels_useronly = 2,
165 labels_none = 3,
166 labels_invalidSelection
167 };
168
170 {
172 handdrawn
173 };
174
176 {
177 none,
178 temporary
179 };
180
181 enum mathDisplayMode
182 {
183 display_2d,
184 display_2dASCII,
185 display_2dUNICODE,
186 display_1dASCII
187 };
188
189 using StringBoolHash = std::unordered_map<wxString, bool, wxStringHash>;
191 bool IsOperator(const wxString& name) const {return m_maximaSession.IsOperator(name);}
193 void AddMaximaOperator(const wxString &name){m_maximaSession.AddOperator(name);}
194 const wxEnvVariableHashMap& MaximaEnvVars() const {return m_maximaEnvVars;}
196 void ClearMaximaEnvVars(){m_maximaEnvVars.clear();}
198 void SetMaximaEnvVar(const wxString &name, const wxString &value){m_maximaEnvVars[name] = value;}
199
201 mathDisplayMode DisplayMode() const {return m_displayMode;}
203 void DisplayMode(mathDisplayMode mode ) {m_displayMode = mode;}
204
206 void SetWorkingDirectory(wxString dir)
207 { m_maximaSession.SetWorkingDirectory(std::move(dir)); }
208
210 wxString GetWorkingDirectory() const
211 { return m_maximaSession.GetWorkingDirectory(); }
212
214 void ReadConfig();
215
220 explicit Configuration(wxDC *dc = {}, InitOpt options = none);
222
232 void MakeTemporary() { m_initOpts = temporary; }
233
235 void ResetAllToDefaults();
236
238 void SetRecalcContext(wxDC &dc)
239 {
240 m_renderContext.SetRecalcDC(&dc);
241 }
242 void UnsetContext() {m_renderContext.SetRecalcDC(nullptr);}
243
245 void SetBackgroundBrush(const wxBrush &brush);
247 bool FixedFontInTextControls() const {return m_fixedFontTC;}
249 void FixedFontInTextControls(bool fixed) {m_fixedFontTC = fixed;}
251 wxBrush GetBackgroundBrush() const {return m_renderContext.GetBackgroundBrush();}
257 wxBrush GetTooltipBrush() const;
268 static wxColour TooltipMarkerColour(const wxColour &background);
269
270 virtual ~Configuration();
271
279
280 using EscCodeContainer = std::unordered_map<wxString, wxString, wxStringHash>;
281 using EscCodeIterator = EscCodeContainer::const_iterator;
282
284 static const wxString &GetEscCode(const wxString &key);
286 static EscCodeIterator EscCodesBegin();
288 static EscCodeIterator EscCodesEnd();
289
291 static double GetMinZoomFactor()
292 { return 0.1; }
293
295 static double GetMaxZoomFactor()
296 { return 32.0; }
297
304 double GetInterEquationSkip() const
305 {
307 return 0;
308 else
309 return GetZoomFactor() * m_styleStore[TS_MATH].GetFontSize() / 2;
310 }
311
313 wxCoord GetCellBracketWidth() const
314 {
315 return static_cast<wxCoord>(GetZoomFactor() * 16);
316 }
317
319 bool HideBrackets() const
320 { return m_hideBrackets; }
321
323 void HideBrackets(bool hide){m_hideBrackets = hide;}
324
332 bool OverlayScrollbars() const
333 { return m_overlayScrollbars; }
334
336 void OverlayScrollbars(bool overlay){m_overlayScrollbars = overlay;}
337
339 double PrintScale() const
340 { return m_printScale; }
341
343 void PrintScale(double scale){m_printScale = scale;}
344
345 void PrintMargin_Top(double margin){m_printMargin_Top = margin;}
346 void PrintMargin_Bot(double margin){m_printMargin_Bot = margin;}
347 void PrintMargin_Left(double margin){m_printMargin_Left = margin;}
348 void PrintMargin_Right(double margin){m_printMargin_Right = margin;}
349 double PrintMargin_Top() const {return m_printMargin_Top;}
350 double PrintMargin_Bot() const {return m_printMargin_Bot;}
351 double PrintMargin_Left() const {return m_printMargin_Left;}
352 double PrintMargin_Right() const {return m_printMargin_Right;}
353
355 void SetZoomFactor(double newzoom);
356
358 void SetZoomFactor_temporarily(double newzoom){
359 if(m_zoomFactor != newzoom)
361 m_zoomFactor = newzoom;
362 }
363
368 wxCoord Scale_Px(double px) const;
369 AFontSize Scale_Px(AFontSize size) const;
370
372 double GetZoomFactor() const
373 { return m_zoomFactor; }
374
376 wxDC *GetRecalcDC() const
377 { return m_renderContext.GetRecalcDC(); }
378
379 void SetRecalcDC(wxDC *dc)
380 { m_renderContext.SetRecalcDC(dc); }
381
382 wxString GetFontName(TextStyle ts = TS_CODE_DEFAULT) const;
383
384 // cppcheck-suppress functionStatic
385 // cppcheck-suppress functionConst
386 wxString GetSymbolFontName() const;
387
389 static const wxString CharsNeedingQuotes()
390 {
391 return wxString(wxS("°,\\'\"()[]-{}^+*/&§?:;=#<>$"));
392 }
393
394 wxFontWeight IsBold(long st) const;
395
396 wxFontStyle IsItalic(long st) const;
397
398 bool IsUnderlined(long st) const {return m_styleStore[st].IsUnderlined();}
399
404 wxCoord GetLabelWidth() const
405 { return m_labelWidth * 14; }
406
408 long LabelWidth() const
409 { return m_labelWidth; }
411 void LabelWidth(long labelWidth)
412 {
413 if(m_labelWidth != labelWidth)
415 m_labelWidth = labelWidth;
416 }
417
419 wxCoord GetIndent() const
420 {
421 if (m_indent < 0)
422 return 3 * GetCellBracketWidth() / 2;
423 else
424 return m_indent;
425 }
426
432 wxSize GetPPI() const;
433 int AutosaveMinutes() const {return m_autoSaveMinutes;}
434 void AutosaveMinutes(int minutes){m_autoSaveMinutes = minutes;}
435
437 long GetCursorWidth() const
438 {
439 long ppi;
440
441 if(!GetPrinting())
442 ppi = GetPPI().x;
443 else
444 ppi = 96;
445
446 if (ppi / 45 < 1)
447 return 1;
448 else
449 return ppi / 45;
450 }
451
461 int GetWorksheetTopOffset() const { return m_worksheetTopOffset; }
467 void SetWorksheetTopOffset(int offset) { m_worksheetTopOffset = offset; }
468
470 long GetBaseIndent() const
471 {
472 if (GetCursorWidth() < 12)
473 return 12;
474 else
475 return 4 + GetCursorWidth();
476 }
477
479 long GetGroupSkip() const
480 {
481 if (GetCursorWidth() < 10)
482 return 20;
483 else
484 return 10 + GetCursorWidth();
485 }
486
491 void SetIndent(long indent)
492 {
493 if(m_indent != indent)
495 m_indent = indent;
496 }
497
498 bool IncrementalSearch() const {return m_incrementalSearch;}
499
500
501 void IncrementalSearch(bool incrementalSearch) { m_incrementalSearch = incrementalSearch; }
502
503 int MaxLayoutTime() const { return m_maxLayoutTime; }
504 void MaxLayoutTime(int time) { m_maxLayoutTime = time; }
505
506 enum class LayoutStrategy {
507 layout2DWheneverPossible = 0,
508 layout2DIfFits = 1,
509 layoutPrefer1D = 2
510 };
511 LayoutStrategy GetLayoutStrategy() const { return m_layoutStrategy; }
512 void SetLayoutStrategy(LayoutStrategy s) {
513 if (s != m_layoutStrategy)
515 m_layoutStrategy = s;
516 }
517
524 enum class OversizedMatrices {
526 showInFull = 0,
528 elide = 1,
535 scroll = 2
536 };
537 OversizedMatrices GetOversizedMatrices() const { return m_oversizedMatrices; }
547 void SetOversizedMatrices(OversizedMatrices mode, bool perMatrixOverridable = true) {
548 if ((mode != m_oversizedMatrices) ||
549 (perMatrixOverridable != m_oversizedMatricesOverridable))
551 m_oversizedMatrices = mode;
552 m_oversizedMatricesOverridable = perMatrixOverridable;
553 }
564 OversizedMatrices OversizedMatricesFor(std::optional<OversizedMatrices> requested) const {
565 if (requested && m_oversizedMatricesOverridable)
566 return *requested;
567 return m_oversizedMatrices;
568 }
569
576 enum class ImageBackdrop {
578 none = 0,
582 always = 2
583 };
584 ImageBackdrop GetImageBackdrop() const { return m_imageBackdrop; }
585 void SetImageBackdrop(ImageBackdrop mode) { m_imageBackdrop = mode; }
591 switch (m_imageBackdrop) {
593 return true;
595 return !GetPrinting() && (DefaultBackgroundColor().GetLuminance() < 0.5);
597 break;
598 }
599 return false;
600 }
601
608 MatrixScrollHost *GetMatrixScrollHost() const { return m_matrixScrollHost; }
616 void SetMatrixScrollHost(MatrixScrollHost *host) { m_matrixScrollHost = host; }
617
618 void SetLayoutDeadline(int seconds) {
619 m_renderContext.SetLayoutDeadline(seconds);
620 }
621 void ClearLayoutCancelled() {
622 m_renderContext.ClearLayoutCancelled();
623 }
624 bool IsLayoutCancelled() const {
625 return m_renderContext.IsLayoutCancelled();
626 }
627
630 {
632 }
633
635 double GetDefaultLineWidth() const
636 {
637 if (GetZoomFactor() < 1.0)
638 return 1.0;
639 else
640 return GetZoomFactor();
641 }
642
644 long LineWidth_em() const
645 {
646 if(!GetPrinting())
647 return m_lineWidth_em;
648 else
649 return 10000;
650 }
651
652 bool AutoSaveAsTempFile() const {return m_autoSaveAsTempFile;}
653 void AutoSaveAsTempFile(bool asTempFile){m_autoSaveAsTempFile = asTempFile;}
654
656 void LineWidth_em(long width)
657 { m_lineWidth_em = width; }
658
660 // On big 16:9 screens text tends to get \b very wide before it hits the right margin.
661 // But text blocks that are 1 meter wide and 2 cm high feel - weird.
662 long GetLineWidth() const;
663
667 long GetAsciiArtColumns() const;
668
669 bool SaveUntitled() const { return m_saveUntitled;}
670 void SaveUntitled(bool save) {m_saveUntitled = save;}
671
672 bool CursorJump() const { return m_cursorJump;}
673 void CursorJump(bool save){m_cursorJump = save;}
674
682 bool ArrowKeysSkipOutput() const { return m_arrowKeysSkipOutput;}
683 void ArrowKeysSkipOutput(bool skip){m_arrowKeysSkipOutput = skip;}
684
685 bool NumpadEnterEvaluates() const { return m_numpadEnterEvaluates;}
686 void NumpadEnterEvaluates(bool eval){m_numpadEnterEvaluates = eval;}
687
688 bool SaveImgFileName() const { return m_saveImgFileName;}
689 void SaveImgFileName(bool save) { m_saveImgFileName = save;}
690
692 bool GetAutoWrap() const
693 { return m_autoWrap > 0; }
694
696 bool GetAutoWrapCode() const
697 { return m_autoWrap > 1; }
698
710 void SetAutoWrap(long autoWrap){
711 m_autoWrap = autoWrap;
712 if (m_autoWrap < 0)
713 m_autoWrap = 0;
714 if (m_autoWrap > 2)
715 m_autoWrap = 1;
716 }
717
719 bool GetAutoIndent() const
720 { return m_autoIndent; }
721
722 void SetAutoIndent(bool autoIndent){m_autoIndent = autoIndent;}
723
725 bool IndentMaths() const {return m_indentMaths;}
726 void IndentMaths(bool indent){
727 if(m_indentMaths != indent)
729 m_indentMaths = indent;}
730 AFontSize GetFontSize(TextStyle st) const { return m_styleStore[st].GetFontSize(); }
731
732 static const wxString &GetStyleName(TextStyle textStyle);
733
739 void ReadStyles(const wxString &file = {});
740
745 void WriteStyles(const wxString &file = {});
746 void WriteStyles(wxConfigBase *config);
747 void WriteSettings(const wxString &file = {});
755 static const std::vector<std::pair<TextStyle, wxString>> &StyleConfigKeys();
756
764 const wxChar *key;
766 std::variant<bool Configuration::*, int Configuration::*,
767 long Configuration::*, double Configuration::*,
768 wxString Configuration::*>
770 };
781 static const std::vector<ScalarSetting> &ScalarConfigSettings();
782 void MakeStylesConsistent();
783 void Outdated(bool outdated)
784 { m_outdated = outdated; }
785
787 bool CheckKeepPercent() const
788 { return m_keepPercent; }
789
791 void SetKeepPercent(bool keepPercent)
792 {
793 if(m_keepPercent != keepPercent)
795 m_keepPercent = keepPercent;
796 }
797
798 wxString GetTeXCMRI() const
799 { return m_fontCMRI; }
800
801 wxString GetTeXCMSY() const
802 { return m_fontCMSY; }
803
804 wxString GetTeXCMEX() const
805 { return m_fontCMEX; }
806
807 wxString GetTeXCMMI() const
808 { return m_fontCMMI; }
809
810 wxString GetTeXCMTI() const
811 { return m_fontCMTI; }
812
813 bool ShowCodeCells() const
814 { return m_showCodeCells; }
815
816 void ShowCodeCells(bool show);
817
824 void SetPrinting(bool printing);
825
832 bool GetPrinting() const
833 { return m_renderContext.Printing(); }
834
836 wxColour GetColor(TextStyle style);
837
838
839 bool UsePngCairo() const { return m_usepngCairo;}
840 void UsePngCairo(bool usepngCairo) { m_usepngCairo = usepngCairo;}
841
842 bool GetMatchParens() const { return m_matchParens; }
843 void SetMatchParens(bool matchParens) { m_matchParens = matchParens; }
844 bool ShowMatchingParens() const { return m_showMatchingParens; }
845 void ShowMatchingParens(bool show) { m_showMatchingParens = show; }
846
848 bool GetChangeAsterisk() const{ return m_changeAsterisk; }
849
851 void SetChangeAsterisk(bool changeAsterisk) {
852 if(m_changeAsterisk != changeAsterisk)
854 m_changeAsterisk = changeAsterisk;
855 }
856
857 bool HidemultiplicationSign() const {return m_hidemultiplicationsign;}
858
859 void HidemultiplicationSign(bool show) {
860 if(m_hidemultiplicationsign != show)
862 m_hidemultiplicationsign = show;
863 }
864
865 bool Latin2Greek() const
866 {return m_latin2greek;}
867
868 void Latin2Greek(bool latin2greek) {
869 if(m_latin2greek != latin2greek)
871 m_latin2greek = latin2greek;
872 }
873
874 bool GreekSidebar_ShowLatinLookalikes() const {return m_greekSidebar_ShowLatinLookalikes;}
875 void GreekSidebar_ShowLatinLookalikes(bool show){m_greekSidebar_ShowLatinLookalikes = show;}
876
877 bool GreekSidebar_Show_mu() const {return m_greekSidebar_Show_mu;}
878 void GreekSidebar_Show_mu(bool show) {m_greekSidebar_Show_mu = show;}
879
880 wxString SymbolPaneAdditionalChars() const
881 {return m_symbolPaneAdditionalChars;}
882 void SymbolPaneAdditionalChars(wxString symbols) {m_symbolPaneAdditionalChars = std::move(symbols);}
883
890 std::vector<wxm::SymbolShortcut> SymbolShortcuts() const
891 {return wxm::ParseSymbolShortcuts(m_symbolShortcuts);}
892 void SymbolShortcuts(const std::vector<wxm::SymbolShortcut> &shortcuts)
893 {m_symbolShortcuts = wxm::SerializeSymbolShortcuts(shortcuts);}
895 wxString ShortcutForSymbol(const wxString &symbol) const;
901 void SetShortcutForSymbol(const wxString &symbol, const wxString &shortcut);
908 void WriteSymbolShortcuts() const;
909
911 bool NotifyIfIdle() const
912 { return m_notifyIfIdle; }
913
914 void NotifyIfIdle(bool notify) {m_notifyIfIdle = notify;}
915
918 { return m_findDialogDockable; }
919
920 void FindDialogDockable(bool dockable) {m_findDialogDockable = dockable;}
921
928 bool McpServerEnabled() const { return m_mcpServerEnabled; }
929 void McpServerEnabled(bool enabled) { m_mcpServerEnabled = enabled; }
930
932 int McpServerPort() const { return m_mcpServerPort; }
933 void McpServerPort(int port) { m_mcpServerPort = port; }
934
939 int AiChatProvider() const { return m_aiChatProvider; }
940 void AiChatProvider(int provider) { m_aiChatProvider = provider; }
941
951 wxString AiApiKeyAnthropic() const;
952 void AiApiKeyAnthropic(const wxString &key);
953 wxString AiApiKeyOpenAI() const;
954 void AiApiKeyOpenAI(const wxString &key);
955 wxString AiApiKeyGoogle() const;
956 void AiApiKeyGoogle(const wxString &key);
957 wxString AiApiKeyQwen() const;
958 void AiApiKeyQwen(const wxString &key);
962 wxString AiApiKeyGitHubModels() const;
963 void AiApiKeyGitHubModels(const wxString &key);
964 wxString AiApiKeyDeepSeek() const;
965 void AiApiKeyDeepSeek(const wxString &key);
966 wxString AiApiKeyOpenRouter() const;
967 void AiApiKeyOpenRouter(const wxString &key);
968
972 wxString AiModelAnthropic() const { return m_aiModelAnthropic; }
973 void AiModelAnthropic(const wxString &model) { m_aiModelAnthropic = model; }
974 wxString AiModelOpenAI() const { return m_aiModelOpenAI; }
975 void AiModelOpenAI(const wxString &model) { m_aiModelOpenAI = model; }
976 wxString AiModelGoogle() const { return m_aiModelGoogle; }
977 void AiModelGoogle(const wxString &model) { m_aiModelGoogle = model; }
978 wxString AiModelQwen() const { return m_aiModelQwen; }
979 void AiModelQwen(const wxString &model) { m_aiModelQwen = model; }
980 wxString AiModelGitHubModels() const { return m_aiModelGitHubModels; }
981 void AiModelGitHubModels(const wxString &model) { m_aiModelGitHubModels = model; }
982 wxString AiModelDeepSeek() const { return m_aiModelDeepSeek; }
983 void AiModelDeepSeek(const wxString &model) { m_aiModelDeepSeek = model; }
984 wxString AiModelOpenRouter() const { return m_aiModelOpenRouter; }
985 void AiModelOpenRouter(const wxString &model) { m_aiModelOpenRouter = model; }
986
992 wxString AiCustomProvidersJson() const { return m_aiCustomProvidersJson; }
993 void AiCustomProvidersJson(const wxString &json) { m_aiCustomProvidersJson = json; }
994
998 wxString AiActiveCustomProviderId() const { return m_aiActiveCustomProviderId; }
999 void AiActiveCustomProviderId(const wxString &id) { m_aiActiveCustomProviderId = id; }
1000
1006 { return m_displayedDigits; }
1007
1008 void SetDisplayedDigits(long displayedDigits)
1009 {
1010 wxASSERT_MSG(displayedDigits >= 0, _("Bug: Maximum number of digits that is to be displayed is too low!"));
1011 if(m_displayedDigits != displayedDigits)
1013 m_displayedDigits = displayedDigits;
1014 }
1015
1018 {
1019 public:
1020 FileToSave(const wxString &filename, const wxMemoryBuffer &data):
1021 m_data(data),
1022 m_filename(filename)
1023 {
1024 }
1025 const wxString FileName() const{return m_filename;}
1026 const wxMemoryBuffer Data() const{return m_data;}
1027 private:
1028 const wxMemoryBuffer m_data;
1029 const wxString m_filename;
1030 };
1031
1034 {
1035 public:
1036 TextsnippetToDraw(const wxPoint &pos, const wxString &text, const wxColor &color):
1037 m_pos(pos),
1038 m_text(text),
1039 m_color(color)
1040 {
1041 }
1042 const wxPoint Pos() const{return m_pos;}
1043 const wxString Text() const{return m_text;}
1044 const wxColor Color() const{return m_color;}
1045 private:
1046 const wxPoint m_pos;
1047 const wxString m_text;
1048 const wxColor m_color;
1049 };
1050
1051 void PushFileToSave(const wxString &filename, const wxMemoryBuffer &data)
1052 { m_filesToSave.emplace_front(filename, data); }
1053
1054 wxRect GetUpdateRegion() const {return m_renderContext.GetUpdateRegion();}
1055 const std::list<FileToSave> &GetFilesToSave() const {return m_filesToSave;}
1056 void ClearFilesToSave () { m_filesToSave.clear();}
1063 std::list<FileToSave> TakeFilesToSave() { return std::exchange(m_filesToSave, {}); }
1065 void SetFilesToSave(std::list<FileToSave> files) { m_filesToSave = std::move(files); }
1066 void SetUpdateRegion(wxRect rect){m_renderContext.SetUpdateRegion(rect);}
1067
1075 bool GetPrintedPage(wxCoord &top, wxCoord &bottom) const {
1076 const wxRect page = m_renderContext.GetPrintedPage();
1077 if (page.IsEmpty())
1078 return false;
1079 top = page.GetTop();
1080 bottom = page.GetTop() + page.GetHeight();
1081 return true;
1082 }
1084 void SetPrintedPage(wxCoord top, wxCoord bottom) {
1085 m_renderContext.SetPrintedPage(wxRect(0, top, 1, std::max<wxCoord>(0, bottom - top)));
1086 }
1088 void ClearPrintedPage() { m_renderContext.SetPrintedPage(wxRect()); }
1089
1092 bool InUpdateRegion(wxRect rect) const;
1093
1094 bool GetInsertAns() const
1095 { return m_insertAns; }
1096
1097 void SetInsertAns(bool insertAns){ m_insertAns = insertAns; }
1098
1099 bool GetOpenHCaret() const
1100 { return m_openHCaret; }
1101
1102 void SetOpenHCaret(bool openHCaret){ m_openHCaret = openHCaret; }
1103
1104 bool RestartOnReEvaluation() const
1105 { return m_restartOnReEvaluation; }
1106
1107 void RestartOnReEvaluation(bool arg){ m_restartOnReEvaluation = arg; }
1108
1110 wxSize GetCanvasSize() const
1111 { return m_renderContext.GetCanvasSize(); }
1112
1114 void SetCanvasSize(wxSize siz)
1115 {
1116 if(GetCanvasSize().GetWidth() != siz.GetWidth() ||
1117 GetCanvasSize().GetHeight() != siz.GetHeight())
1119 m_renderContext.SetCanvasSize(siz);
1120 }
1121
1139 { return m_rightToLeftDocument; }
1140
1141 bool RightToLeftDocument(bool rightToLeft)
1142 {
1143 if (m_rightToLeftDocument != rightToLeft)
1145 return m_rightToLeftDocument = rightToLeft;
1146 }
1147
1149 bool ShowBrackets() const
1150 { return m_showBrackets; }
1151
1152 bool ShowBrackets(bool show)
1153 {
1154 if(m_showBrackets != show)
1156 return m_showBrackets = show;
1157 }
1158
1160 bool PrintBrackets() const
1161 { return m_printBrackets; }
1162
1163 showLabels GetLabelChoice() const
1164 { return m_showLabelChoice; }
1165
1166 bool ShowInputLabels() const {return m_showInputLabels;}
1167 void ShowInputLabels(bool show) {
1168 if(m_showInputLabels != show)
1170 m_showInputLabels = show;
1171 }
1172
1174 enum class Appearance { light, dark, followSystem };
1175 Appearance GetAppearance() const { return m_appearance; }
1178 m_appearance = a;
1179 m_styleStore.SetUseDark(UseDarkMode());
1181 }
1183 void UpdateBackgroundBrush();
1185 bool UseDarkMode() const {
1186 if (m_appearance == Appearance::dark) return true;
1187 if (m_appearance == Appearance::light) return false;
1188 return SystemIsDark();
1189 }
1191 static bool SystemIsDark();
1192
1193 long RecentItems(){return std::max(m_recentItems, static_cast<long>(0));}
1194 void RecentItems(long items){ m_recentItems = items; }
1195
1198 { return (m_showLabelChoice < labels_useronly); }
1199
1201 bool UseUserLabels() const
1202 { return m_showLabelChoice > labels_automatic; }
1203
1205 bool ShowLabels() const
1206 { return m_showLabelChoice < labels_none; }
1207
1209 void SetLabelChoice(showLabels choice) {
1210 if(m_showLabelChoice != choice)
1212 m_showLabelChoice = choice;
1213 }
1214
1215 bool PrintBrackets(bool print)
1216 {
1217 m_printBrackets = print;
1218 return print;
1219 }
1220
1222 bool AutodetectMaxima() const {return m_autodetectMaxima;}
1224 void AutodetectMaxima(bool autodetectmaxima){m_autodetectMaxima = autodetectmaxima;}
1225
1227 wxString MaximaParameters() const {return m_maximaParameters;}
1229 void MaximaParameters(wxString parameters){m_maximaParameters = std::move(parameters);}
1230
1232 static wxString MaximaDefaultLocation();
1233
1235 wxString MaximaLocation() const;
1236
1238 wxString MaximaUserLocation() const {return m_maximaUserLocation;}
1239
1241 void MaximaUserLocation(wxString maxima) { m_maximaUserLocation = std::move(maxima); }
1242
1244 bool AutodetectHelpBrowser() const {return m_autodetectHelpBrowser;}
1246 void AutodetectHelpBrowser(bool autodetect){m_autodetectHelpBrowser = autodetect;}
1247
1249 bool InternalHelpBrowser() const {return m_useInternalHelpBrowser && OfferInternalHelpBrowser();}
1251 void InternalHelpBrowser(bool useInternalHelpBrowser)
1252 {m_useInternalHelpBrowser = useInternalHelpBrowser;}
1253
1255 bool SinglePageManual() const {return m_singlePageManual;}
1257 void SinglePageManual(bool singlePageManual)
1258 {m_singlePageManual = singlePageManual;}
1259
1261 wxString HelpBrowserUserLocation() const {return m_helpBrowserUserLocation;}
1262
1264 void HelpBrowserUserLocation(wxString helpBrowser) { m_helpBrowserUserLocation = std::move(helpBrowser);}
1265
1272 static wxString FindProgram(const wxString &location);
1273
1276 { return m_fixReorderedIndices; }
1277
1278 void FixReorderedIndices(bool fix) { m_fixReorderedIndices = fix;}
1279
1281 wxString MathJaXURL() const {
1282 if(m_mathJaxURL_UseUser)
1283 return m_mathJaxURL;
1284 else
1285 return MathJaXURL_Auto();}
1286 wxString MathJaXURL_User() const { return m_mathJaxURL;}
1287 bool MathJaXURL_UseUser() const { return m_mathJaxURL_UseUser;}
1288 void MathJaXURL_UseUser(bool useUser){m_mathJaxURL_UseUser = useUser;}
1289
1290 bool EnterEvaluates() const {return m_enterEvaluates;}
1291 void EnterEvaluates(bool enterEvaluates) {m_enterEvaluates = enterEvaluates;}
1292 static wxString MathJaXURL_Auto() { return wxS("https://cdn.jsdelivr.net/npm/mathjax@4/tex-mml-chtml.js");}
1294 void MathJaXURL(wxString url){m_mathJaxURL = std::move(url);}
1295
1296 bool HideMarkerForThisMessage(const wxString& message);
1297 void HideMarkerForThisMessage(const wxString &message, bool hide)
1298 {m_hideMarkerForThisMessage[message] = hide;}
1299 bool UseSVG() const {return m_useSVG;}
1300 void UseSVG(bool useSVG) { m_useSVG = useSVG ;}
1302 void ShowLength(long length) {
1303 m_showLength = length;
1304 }
1306 long ShowLength() const {return m_showLength;}
1308 std::size_t ShowLength_Bytes() const;
1309
1312 if(m_parenthesisDrawMode != mode)
1314 m_parenthesisDrawMode = mode;
1315 }
1316
1317 void TocShowsSectionNumbers(bool showSectionNumbers) { m_TOCshowsSectionNumbers = showSectionNumbers; }
1318
1319 bool TocShowsSectionNumbers() const {return m_TOCshowsSectionNumbers;}
1320
1325 const Style *GetStyle(TextStyle textStyle) const { return &m_styleStore[textStyle]; }
1333 Style *GetWritableStyle(TextStyle textStyle) { return &m_styleStore[textStyle]; }
1334
1341 wxScrolledCanvas *GetWorkSheet() const {return m_workSheet;}
1343 void SetWorkSheet(wxScrolledCanvas *workSheet);
1344
1352 DocumentCellPointers *GetDocumentCellPointers() const {return m_documentCellPointers;}
1354 void SetDocumentCellPointers(DocumentCellPointers *p) {m_documentCellPointers = p;}
1356 ViewCellPointers *GetViewCellPointers() const {return m_viewCellPointers;}
1358 void SetViewCellPointers(ViewCellPointers *p) {m_viewCellPointers = p;}
1359
1367 {if (m_recalculateRequest) m_recalculateRequest(group);}
1369 void SetRecalculateRequestCallback(std::function<void(GroupCell *)> callback)
1370 {m_recalculateRequest = std::move(callback);}
1371
1381 {if (m_recalculateAllRequest) m_recalculateAllRequest();}
1383 void SetRecalculateAllRequestCallback(std::function<void()> callback)
1384 {m_recalculateAllRequest = std::move(callback);}
1385
1386 long DefaultPort() const {return m_defaultPort;}
1387 void DefaultPort(long port){m_defaultPort = port;}
1388 bool GetAbortOnError() const {return m_abortOnError;}
1389 void SetAbortOnError(bool abortOnError) {m_abortOnError = abortOnError;}
1390
1396 long GetLanguage() const {
1397 return (m_languageOverride != wxLANGUAGE_UNKNOWN) ? m_languageOverride
1398 : m_language;
1399 }
1405 long GetConfiguredLanguage() const {return m_language;}
1406 void SetLanguage(long language) {m_language = language;}
1411 static void SetLanguageOverride(long language) {m_languageOverride = language;}
1412
1414 long MaxGnuplotMegabytes() const {return m_maxGnuplotMegabytes;}
1415 void MaxGnuplotMegabytes(long megaBytes)
1416 {m_maxGnuplotMegabytes = megaBytes;}
1417
1418 bool OfferKnownAnswers() const {return m_offerKnownAnswers;}
1419 void OfferKnownAnswers(bool offerKnownAnswers)
1420 {m_offerKnownAnswers = offerKnownAnswers;}
1421
1428 bool ScreenReaderAnnouncesMathML() const {return m_screenReaderAnnouncesMathML;}
1430 {m_screenReaderAnnouncesMathML = mathML;}
1431
1432 wxString Documentclass() const {return m_documentclass;}
1433 void Documentclass(wxString clss){m_documentclass = std::move(clss);}
1434 wxString DocumentclassOptions() const {return m_documentclassOptions;}
1435 void DocumentclassOptions(wxString classOptions){m_documentclassOptions = std::move(classOptions);}
1436
1437
1438 htmlExportFormat HTMLequationFormat() const {return m_htmlEquationFormat;}
1439 void HTMLequationFormat(htmlExportFormat HTMLequationFormat)
1440 {m_htmlEquationFormat = HTMLequationFormat;}
1441
1442 AFontSize GetDefaultFontSize() const { return m_styleStore[TS_CODE_DEFAULT].GetFontSize(); }
1443 AFontSize GetMathFontSize() const { return m_styleStore[TS_MATH].GetFontSize(); }
1444
1446 long GetAutosubscript_Num() const {return m_autoSubscript;}
1447 void SetAutosubscript_Num(long autosubscriptnum) {m_autoSubscript = autosubscriptnum;}
1448 wxString GetAutosubscript_string() const;
1450 wxColor DefaultBackgroundColor();
1452 wxColor EditorBackgroundColor();
1454 bool ClipToDrawRegion() const {return m_renderContext.ClipToDrawRegion();}
1456 void ClipToDrawRegion(bool clipToDrawRegion){m_renderContext.ClipToDrawRegion(clipToDrawRegion);}
1457 void SetVisibleRegion(wxRect visibleRegion){
1458 if(m_renderContext.GetVisibleRegion().GetWidth() != visibleRegion.GetWidth())
1460 m_renderContext.SetVisibleRegion(visibleRegion);
1461 }
1462 wxRect GetVisibleRegion() const {return m_renderContext.GetVisibleRegion();}
1463 void SetWorksheetPosition(wxPoint worksheetPosition){m_renderContext.SetWorksheetPosition(worksheetPosition);}
1464 wxPoint GetWorksheetPosition() const {return m_renderContext.GetWorksheetPosition();}
1465 wxString MaximaShareDir() const {return m_maximaSession.ShareDir();}
1466 void MaximaShareDir(wxString dir){m_maximaSession.ShareDir(std::move(dir));}
1467 wxString MaximaDemoDir() const {return m_maximaSession.DemoDir();}
1468 void MaximaDemoDir(wxString dir){m_maximaSession.DemoDir(std::move(dir));}
1469 void InLispMode(bool lisp){m_maximaSession.InLispMode(lisp);}
1470 bool InLispMode() const {return m_maximaSession.InLispMode();}
1471 void BitmapScale(int factor){m_bitmapScale = factor;}
1472 int BitmapScale() const {return m_bitmapScale;}
1473 void DefaultPlotHeight(int px){m_defaultPlotHeight = px;}
1474 int DefaultPlotHeight() const {return m_defaultPlotHeight;}
1475 void DefaultPlotWidth(int px){m_defaultPlotWidth = px;}
1476 int DefaultPlotWidth() const {return m_defaultPlotWidth;}
1477 void DefaultFramerate(double fps){m_defaultFramerate = fps;}
1478 double DefaultFramerate() const {return m_defaultFramerate;}
1479 void TocDepth(int depth){m_tocDepth = depth;}
1480 int TocDepth() const {return m_tocDepth;}
1481 bool TeXExponentsAfterSubscript() const {return m_TeXExponentsAfterSubscript;}
1482 void TeXExponentsAfterSubscript(bool ExponentsAfterSubscript)
1483 {m_TeXExponentsAfterSubscript = ExponentsAfterSubscript;}
1484 bool UsePartialForDiff() const {return m_usePartialForDiff;}
1485 void UsePartialForDiff(bool usePartialForDiff)
1486 {m_usePartialForDiff = usePartialForDiff;}
1494 {if (m_adjustWorksheetSizeRequest) m_adjustWorksheetSizeRequest();}
1496 void SetAdjustWorksheetSizeRequestCallback(std::function<void()> callback)
1497 {m_adjustWorksheetSizeRequest = std::move(callback);}
1499 void NotifyOfCellRedraw(const Cell *cell);
1509 void ReportMultipleRedraws();
1511 bool OfferInternalHelpBrowser() const;
1522 static bool ShowHelpInSidebarFromOldKey(bool stored, bool storedOnWindows,
1523 bool defaultValue);
1524 bool WrapLatexMath() const {return m_wrapLatexMath;}
1525 void WrapLatexMath(bool wrapLatexMath){m_wrapLatexMath = wrapLatexMath;}
1526 bool AllowNetworkHelp() const {return m_allowNetworkHelp;}
1527 void AllowNetworkHelp(bool allowNetworkHelp){m_allowNetworkHelp = allowNetworkHelp;}
1528 bool ShowAllDigits() const {return m_showAllDigits;}
1529 void ShowAllDigits(bool shw){
1530 if(m_showAllDigits != shw)
1532 m_showAllDigits = shw;
1533 }
1534 bool LineBreaksInLongNums() const {return m_lineBreaksInLongNums;}
1535 void LineBreaksInLongNums(bool brk){
1536 if(m_lineBreaksInLongNums != brk)
1538 m_lineBreaksInLongNums = brk;
1539 }
1544 bool DigitGrouping() const {return m_digitGrouping;}
1545 void DigitGrouping(bool group){
1546 if(m_digitGrouping != group)
1548 m_digitGrouping = group;
1549 }
1551 long DigitGroupingMinDigits() const {return m_digitGroupingMinDigits;}
1552 void DigitGroupingMinDigits(long digits){
1553 digits = std::max(digits, DigitGroupingMinDigits_Min);
1554 if(m_digitGroupingMinDigits != digits)
1556 m_digitGroupingMinDigits = digits;
1557 }
1559 static constexpr long DigitGroupingMinDigits_Min = 2;
1560
1561 void ExportContainsWXMX(bool exportContainsWXMX){m_exportContainsWXMX = exportContainsWXMX;}
1562 bool ExportContainsWXMX() const {return m_exportContainsWXMX;}
1570 bool HTMLExportSelfContained() const {return m_htmlExportSelfContained;}
1571 void HTMLExportSelfContained(bool selfContained)
1572 {m_htmlExportSelfContained = selfContained;}
1573 void WizardTab(long tab){m_wizardTab = tab;}
1574 long WizardTab() const {return m_wizardTab;}
1575
1576 void Display2d_Unicode(bool unicode){m_display2d_Unicode = unicode;}
1577 bool Display2d_Unicode() const {return m_display2d_Unicode;}
1578
1579 #ifdef __WXMSW__
1580 bool UseWGnuplot() const {return m_useWgnuplot;}
1581 void UseWGnuplot(bool usewgnuplot) {m_useWgnuplot = usewgnuplot;}
1582 #endif
1583 wxString TexPreamble() const {return m_texPreamble;}
1584 void TexPreamble(wxString texPreamble) {m_texPreamble = std::move(texPreamble);}
1585
1586 void SetMaximaVersion(const wxString &version){m_maximaSession.SetMaximaVersion(version);}
1587 wxString GetMaximaVersion() const {return m_maximaSession.GetMaximaVersion();}
1588 void SetMaximaArch(const wxString &arch){m_maximaSession.SetMaximaArch(arch);}
1589 wxString GetMaximaArch() const {return m_maximaSession.GetMaximaArch();}
1590 void SetLispVersion(const wxString &version){m_maximaSession.SetLispVersion(version);}
1591 wxString GetLispVersion() const {return m_maximaSession.GetLispVersion();}
1592 void SetLispType(const wxString &type){m_maximaSession.SetLispType(type);}
1593 wxString GetLispType() const {return m_maximaSession.GetLispType();}
1594
1596 void InitStyles();
1598 bool FontRendersChar(wxUniChar ch, const wxFont &font = *wxNORMAL_FONT)
1599 { return m_fontRenderability.FontRendersChar(ch, font); }
1600
1602 const std::vector<TextStyle> &GetCodeStylesList() const {return m_styleStore.CodeStylesList();}
1604 const std::vector<TextStyle> &GetMathStylesList() const {return m_styleStore.MathStylesList();}
1606 const std::vector<TextStyle> &GetColorOnlyStylesList() const {return m_styleStore.ColorOnlyStylesList();}
1607 bool StyleAffectsCode(TextStyle style) const;
1608 bool StyleAffectsMathOut(TextStyle style) const;
1609 bool StyleAffectsColorOnly(TextStyle style) const;
1611 bool UpdateNeeded() const;
1613 static void SetDebugmode(){m_debugMode = true;}
1615 static bool GetDebugmode(){return m_debugMode;}
1625 bool MaximaHelpInConsole() const {return m_maximaHelpInConsole;}
1626 void MaximaHelpInConsole(bool console) {m_maximaHelpInConsole = console;}
1628 wxString MaximaHelpFormatName() const;
1634 wxString MaximaHelpFormatCommand() const;
1635
1636private:
1638 MaximaSessionInfo m_maximaSession;
1640 InitOpt m_initOpts;
1646 long m_configId;
1648 std::random_device m_rd;
1650 std::default_random_engine m_eng;
1651 wxEnvVariableHashMap m_maximaEnvVars;
1652public:
1654 std::random_device::result_type RandomEntropy(){return m_rd();}
1656 std::default_random_engine &RandomEngine(){return m_eng;}
1664 std::int_fast32_t CellCfgCnt() const {return m_cellCfgCnt;}
1672 m_cellCfgCnt++;
1674 }
1675 static bool UseThreads(){return m_use_threads;}
1676 static void UseThreads(bool use){m_use_threads = use;}
1677 static void SetMaximaLang(const wxString &LANG){m_maxima_LANG = LANG;}
1678 static wxString GetMaximaLang(){return m_maxima_LANG;}
1679private:
1681 static wxString m_maxima_LANG;
1682 std::list<FileToSave> m_filesToSave;
1684 Styles m_styleStore;
1686 StringBoolHash m_hideMarkerForThisMessage;
1688 FontRenderabilityCache m_fontRenderability;
1689 mathDisplayMode m_displayMode = display_2d;
1690 static bool m_debugMode;
1691 bool m_showInputLabels;
1692 long m_wizardTab;
1693 bool m_display2d_Unicode;
1694 bool m_usePartialForDiff;
1696 bool m_autoSaveAsTempFile;
1698 long m_language;
1700 bool m_autodetectMaxima;
1702 bool m_autodetectHelpBrowser;
1704 bool m_useInternalHelpBrowser;
1706 bool m_singlePageManual;
1708 bool m_incrementalSearch;
1710 long m_autoSubscript;
1712 wxScrolledCanvas *m_workSheet = nullptr;
1714 DocumentCellPointers *m_documentCellPointers = nullptr;
1716 ViewCellPointers *m_viewCellPointers = nullptr;
1718 std::function<void(GroupCell *)> m_recalculateRequest;
1720 std::function<void()> m_recalculateAllRequest;
1722 std::function<void()> m_adjustWorksheetSizeRequest;
1724 RenderContext m_renderContext;
1725 bool m_wrapLatexMath;
1726 bool m_allowNetworkHelp;
1727 bool m_exportContainsWXMX;
1728 bool m_htmlExportSelfContained;
1729 wxString m_texPreamble;
1730
1731 drawMode m_parenthesisDrawMode;
1732 bool m_TeXExponentsAfterSubscript;
1733 wxString m_helpBrowserUserLocation;
1734 wxString m_maximaUserLocation;
1736 bool m_hideBrackets;
1738 bool m_overlayScrollbars;
1740 double m_printScale;
1741 double m_printMargin_Top;
1742 double m_printMargin_Bot;
1743 double m_printMargin_Left;
1744 double m_printMargin_Right;
1746 bool m_rightToLeftDocument;
1748 bool m_showBrackets;
1750 bool m_printBrackets;
1756 bool m_changeAsterisk;
1758 bool m_notifyIfIdle;
1760 bool m_findDialogDockable;
1762 bool m_mcpServerEnabled;
1764 int m_mcpServerPort;
1766 int m_aiChatProvider;
1767 wxString m_aiModelAnthropic;
1768 wxString m_aiModelOpenAI;
1769 wxString m_aiModelGoogle;
1770 wxString m_aiModelQwen;
1771 wxString m_aiModelGitHubModels;
1772 wxString m_aiModelDeepSeek;
1773 wxString m_aiModelOpenRouter;
1775 wxString m_aiCustomProvidersJson;
1777 wxString m_aiActiveCustomProviderId;
1779 long m_displayedDigits;
1781 long m_autoWrap;
1783 bool m_autoIndent;
1785 bool m_showAllDigits;
1787 bool m_lineBreaksInLongNums;
1789 bool m_digitGrouping;
1791 long m_digitGroupingMinDigits;
1793 bool m_matchParens;
1795 bool m_insertAns;
1797 bool m_openHCaret;
1799 long m_labelWidth;
1800 long m_indent;
1801 bool m_latin2greek;
1802 double m_zoomFactor;
1803 bool m_outdated;
1804 wxString m_maximaParameters;
1805 bool m_keepPercent;
1806 bool m_restartOnReEvaluation;
1807 wxString m_fontCMRI, m_fontCMSY, m_fontCMEX, m_fontCMMI, m_fontCMTI;
1808 long m_lineWidth_em;
1809 showLabels m_showLabelChoice;
1810 bool m_fixReorderedIndices;
1811 wxString m_mathJaxURL;
1812 bool m_mathJaxURL_UseUser;
1813 bool m_showCodeCells;
1814 long m_showLength;
1815 bool m_usepngCairo;
1816 bool m_enterEvaluates;
1817 bool m_useSVG;
1818 bool m_fixedFontTC;
1819 bool m_TOCshowsSectionNumbers;
1820 bool m_indentMaths;
1821 bool m_abortOnError;
1822 bool m_showMatchingParens;
1823 bool m_hidemultiplicationsign;
1824 bool m_offerKnownAnswers;
1825 bool m_screenReaderAnnouncesMathML;
1826 long m_defaultPort;
1827 long m_maxGnuplotMegabytes;
1828 long m_defaultPlotHeight;
1829 long m_defaultPlotWidth;
1830 bool m_saveUntitled;
1831 bool m_cursorJump;
1832 bool m_arrowKeysSkipOutput;
1833 bool m_numpadEnterEvaluates;
1834 bool m_saveImgFileName;
1835 wxString m_documentclass;
1836 wxString m_documentclassOptions;
1837 htmlExportFormat m_htmlEquationFormat;
1838
1839 wxColour m_defaultBackgroundColor;
1840 bool m_greekSidebar_ShowLatinLookalikes;
1841 #ifdef __WXMSW__
1842 bool m_useWgnuplot = false;
1843 #endif
1844 bool m_greekSidebar_Show_mu;
1845 wxString m_symbolPaneAdditionalChars;
1847 wxString m_symbolShortcuts;
1848 Appearance m_appearance = Appearance::followSystem;
1849 long m_recentItems;
1850 int m_bitmapScale;
1851 double m_defaultFramerate;
1852 int m_tocDepth;
1853 int m_autoSaveMinutes;
1854 int m_maxLayoutTime;
1855 LayoutStrategy m_layoutStrategy = LayoutStrategy::layout2DIfFits;
1856 OversizedMatrices m_oversizedMatrices = OversizedMatrices::elide;
1858 bool m_oversizedMatricesOverridable = true;
1861 MatrixScrollHost *m_matrixScrollHost = nullptr;
1863 int m_worksheetTopOffset = 0;
1864 wxString m_wxMathML_Filename;
1865 bool m_maximaHelpInConsole = false;
1866 std::atomic<std::int_fast32_t> m_cellCfgCnt{0};
1867 static bool m_use_threads;
1868};
1869
1872{
1873public:
1874 explicit Printing(Configuration *configuration)
1875 {
1876 m_configuration = configuration;
1877 m_configuration->SetPrinting(true);
1878 }
1879 virtual ~Printing()
1880 {
1881 m_configuration->SetPrinting(false);
1882 }
1883private:
1884 Configuration * m_configuration;
1885};
1886
1889{
1890public:
1891 explicit NoClipToDrawRegion(Configuration *configuration)
1892 {
1893 m_configuration = configuration;
1894 m_configuration->ClipToDrawRegion(false);
1895 }
1896 virtual ~NoClipToDrawRegion()
1897 {
1898 m_configuration->ClipToDrawRegion(true);
1899 }
1900private:
1901 Configuration * m_configuration;
1902};
1903
1904#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.
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:1018
Stores the information about a file we need to write during the save process.
Definition: Configuration.h:1034
The configuration storage for the current worksheet.
Definition: Configuration.h:102
void SetOversizedMatrices(OversizedMatrices mode, bool perMatrixOverridable=true)
Sets how oversized matrices are shown.
Definition: Configuration.h:547
void RecalculateForce()
Force every cell to be recalculated on the next layout pass.
Definition: Configuration.h:1671
bool HTMLExportSelfContained() const
Does the HTML export produce one self-contained file?
Definition: Configuration.h:1570
wxDC * GetRecalcDC() const
Get a drawing context suitable for size calculations.
Definition: Configuration.h:376
wxString AiActiveCustomProviderId() const
Which custom provider is active, by AiCustomProviderConfig::id – meaningful only when AiChatProvider(...
Definition: Configuration.h:998
Appearance
How wxMaxima chooses between the light and the dark style set.
Definition: Configuration.h:1174
wxString HelpBrowserUserLocation() const
Returns the location of the web browser the user has selected.
Definition: Configuration.h:1261
void SetShortcutForSymbol(const wxString &symbol, const wxString &shortcut)
Gives a symbol a shortcut, or none if shortcut is empty.
Definition: Configuration.cpp:1506
wxColor EditorBackgroundColor()
Determine the default background color of editorcells.
Definition: Configuration.cpp:1015
long GetAsciiArtColumns() const
How many columns of the ASCII-art monospace font (TS_ASCIIMATHS) fit into GetLineWidth()?...
Definition: Configuration.cpp:1075
long GetAutosubscript_Num() const
Get the worksheet this configuration storage is valid for.
Definition: Configuration.h:1446
void SetViewCellPointers(ViewCellPointers *p)
Register the transient view-state half of the cell-pointer registry.
Definition: Configuration.h:1358
bool ShowAutomaticLabels() const
Do we want to show maxima's automatic labels (o1, t1, i1,...)?
Definition: Configuration.h:1197
void AutodetectHelpBrowser(bool autodetect)
Autodetect the web browser?
Definition: Configuration.h:1246
bool FontRendersChar(wxUniChar ch, const wxFont &font= *wxNORMAL_FONT)
True if we are confident that the font renders this char.
Definition: Configuration.h:1598
void MathJaXURL(wxString url)
Returns the URL MathJaX can be found at.
Definition: Configuration.h:1294
double GetInterEquationSkip() const
Extra space to leave between two equations in output cells.
Definition: Configuration.h:304
static bool GetDebugmode()
Enable costly checks?
Definition: Configuration.h:1615
bool GetChangeAsterisk() const
Use Unicode centered dots for multiplication signs?
Definition: Configuration.h:848
std::list< FileToSave > TakeFilesToSave()
Hands out the list of files to save, leaving it empty.
Definition: Configuration.h:1063
void SetZoomFactor_temporarily(double newzoom)
Sets the zoom factor without storing the new value in the config file/registry.
Definition: Configuration.h:358
static bool SystemIsDark()
Whether the OS reports a dark appearance (false where wx cannot tell).
Definition: Configuration.cpp:519
static bool ShowHelpInSidebarFromOldKey(bool stored, bool storedOnWindows, bool defaultValue)
What the "useInternalHelpBrowser" key of an old config means now.
Definition: Configuration.cpp:1332
void SetAutoWrap(long autoWrap)
Sets the auto wrap mode.
Definition: Configuration.h:710
wxSize GetPPI() const
Get the resolution.
Definition: Configuration.cpp:225
bool GetAutoWrap() const
Do we want to have automatic line breaks for text cells?
Definition: Configuration.h:692
void ClearAndEnableRedrawTracing()
Clear the memory of ReportMultipleRedraws()
Definition: Configuration.cpp:1025
void ReportMultipleRedraws()
Report if a cell has been redrawn 2 or more times during a simple Draw() command.
Definition: Configuration.cpp:1031
static wxString FindProgram(const wxString &location)
Could a maxima binary be found in the path we expect it to be in?
Definition: Configuration.cpp:586
wxString AiModelAnthropic() const
The model id to request from each provider; defaults to AiProviderDefaultModel() but the user can ove...
Definition: Configuration.h:972
void SetPrintedPage(wxCoord top, wxCoord bottom)
Sets the page being printed to the worksheet's y range [top, bottom)
Definition: Configuration.h:1084
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:1391
bool DrawImageBackdrop()
Whether images are to be drawn on the TS_IMAGE_BACKDROP colour right now.
Definition: Configuration.h:590
void FontChanged()
To be called if a font has changed.
Definition: Configuration.h:629
long GetLanguage() const
The UI language in effect: the –language option's, if one was given.
Definition: Configuration.h:1396
static double GetMaxZoomFactor()
The upper limit we allow for the zoom factor.
Definition: Configuration.h:295
wxBrush GetTooltipBrush() const
Get the brush to be used for worksheet objects that provide a mouse-over tooltip.
Definition: Configuration.cpp:566
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:523
void ClearPrintedPage()
Forgets the page being printed: cells draw everything again.
Definition: Configuration.h:1088
bool HideBrackets() const
Hide brackets that are not under the pointer?
Definition: Configuration.h:319
bool NotifyIfIdle() const
Notify the user if maxima is idle?
Definition: Configuration.h:911
OversizedMatrices OversizedMatricesFor(std::optional< OversizedMatrices > requested) const
How one specific matrix that is too large for the window is shown.
Definition: Configuration.h:564
void RequestRecalculateAll() const
Ask the view to schedule a recalculation of the WHOLE worksheet.
Definition: Configuration.h:1380
static EscCodeIterator EscCodesBegin()
Iterators over the escape code list.
Definition: Configuration.cpp:531
void SetPrinting(bool printing)
Are we currently printing?
Definition: Configuration.cpp:1043
static wxString MaximaDefaultLocation()
The auto-detected maxima location.
Definition: Configuration.cpp:1171
bool McpServerEnabled() const
Run the MCP (Model Context Protocol) server, exposing the current worksheet's contents (cells,...
Definition: Configuration.h:928
static constexpr long DigitGroupingMinDigits_Min
The smallest value DigitGroupingMinDigits() accepts: 1 digit has no groups.
Definition: Configuration.h:1559
int McpServerPort() const
Which localhost TCP port the MCP server listens on, if enabled.
Definition: Configuration.h:932
void SetLabelChoice(showLabels choice)
Sets the value of the Configuration ChoiceBox that treads displaying labels.
Definition: Configuration.h:1209
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:1323
void SetKeepPercent(bool keepPercent)
Do we want to display "%e" as "%e" and "%pi" as "%pi"?
Definition: Configuration.h:791
bool SinglePageManual() const
Prefer the single-page manual?
Definition: Configuration.h:1255
void ClearMaximaEnvVars()
Forget all custom environment variables for the maxima process.
Definition: Configuration.h:196
void WriteStyles(const wxString &file={})
Saves the style settings.
Definition: Configuration.cpp:1532
const std::vector< TextStyle > & GetMathStylesList() const
Which styles affect how math output is displayed?
Definition: Configuration.h:1604
DocumentCellPointers * GetDocumentCellPointers() const
The registry of special cells (selection, active cell, errors, ...) of this document.
Definition: Configuration.h:1352
wxColor DefaultBackgroundColor()
Determine the default background color of the worksheet.
Definition: Configuration.cpp:1011
bool UseDarkMode() const
Whether the dark style set is currently active.
Definition: Configuration.h:1185
wxString MaximaUserLocation() const
Returns the location of the maxima binary the user has selected.
Definition: Configuration.h:1238
Style * GetWritableStyle(TextStyle textStyle)
Get the text Style for a given text style identifier.
Definition: Configuration.h:1333
wxCoord GetLabelWidth() const
Get the width of worksheet labels [in unscaled pixels].
Definition: Configuration.h:404
void WriteSettings(const wxString &file={})
Saves the settings to a file.
Definition: Configuration.cpp:1203
wxString MaximaHelpFormatCommand() const
The command that sets Maxima's output_format_for_help accordingly.
Definition: Configuration.cpp:932
mathDisplayMode DisplayMode() const
Does maxima output 1D, 2D or 2D ASCII equations?
Definition: Configuration.h:201
long DigitGroupingMinDigits() const
How many digits a number needs before DigitGrouping() groups them.
Definition: Configuration.h:1551
wxCoord GetIndent() const
Get the indentation of GroupCells.
Definition: Configuration.h:419
std::int_fast32_t CellCfgCnt() const
A counter that increases every time we need to recalculate all worksheet cells.
Definition: Configuration.h:1664
bool ShowLabels() const
Do we want at all to show labels?
Definition: Configuration.h:1205
bool FindDialogDockable() const
Show "Find and Replace" as a dockable sidebar instead of a floating dialog?
Definition: Configuration.h:917
wxString MaximaParameters() const
Parameters to the maxima binary.
Definition: Configuration.h:1227
long GetConfiguredLanguage() const
The UI language the configuration stores, ignoring –language.
Definition: Configuration.h:1405
static void SetLanguageOverride(long language)
Use this language for this session, without saving it (–language)
Definition: Configuration.h:1411
wxSize GetCanvasSize() const
Reads the size of the current worksheet's visible window. See SetCanvasSize.
Definition: Configuration.h:1110
void InternalHelpBrowser(bool useInternalHelpBrowser)
Use the internal help browser? If not a external web browser is used.
Definition: Configuration.h:1251
double GetZoomFactor() const
Determines the zoom factor the worksheet is displayed at.
Definition: Configuration.h:372
long LineWidth_em() const
The minimum sensible line width in widths of a letter.
Definition: Configuration.h:644
void SinglePageManual(bool singlePageManual)
Prefer the single-page manual?
Definition: Configuration.h:1257
ImageBackdrop
What is drawn behind the transparent parts of an image (GH #2227)
Definition: Configuration.h:576
@ 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:725
wxString MaximaLocation() const
Returns the location of the maxima binary.
Definition: Configuration.cpp:1164
void SetBackgroundBrush(const wxBrush &brush)
Set the brush to be used for the worksheet background.
Definition: Configuration.cpp:562
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:1525
bool FixedFontInTextControls() const
Use a typewriter font in wizard entry fields that can contain maxima commands?
Definition: Configuration.h:247
MatrixScrollHost * GetMatrixScrollHost() const
What gives a scrolling matrix its scrollbars, if anything.
Definition: Configuration.h:608
bool GetAutoIndent() const
Do we want automatic indentation?
Definition: Configuration.h:719
long LabelWidth() const
Get the width of worksheet labels [in chars].
Definition: Configuration.h:408
wxString ShortcutForSymbol(const wxString &symbol) const
The shortcut that types this symbol, or an empty string.
Definition: Configuration.cpp:1499
void SetRecalcContext(wxDC &dc)
Set the drawing context that is currently active.
Definition: Configuration.h:238
double PrintScale() const
Hide brackets that are not under the pointer?
Definition: Configuration.h:339
wxString GetWorkingDirectory() const
Get maxima's working directory.
Definition: Configuration.h:210
long GetBaseIndent() const
The y position the worksheet starts at.
Definition: Configuration.h:470
void SetRecalculateAllRequestCallback(std::function< void()> callback)
Set the callback RequestRecalculateAll() / RecalculateForce() notify through.
Definition: Configuration.h:1383
void DisplayMode(mathDisplayMode mode)
Tell the config if maxima outputs 1D, 2D or 2D ASCII equations, currently.
Definition: Configuration.h:203
long MaxGnuplotMegabytes() const
The maximum number of Megabytes of gnuplot sources we should store.
Definition: Configuration.h:1414
long GetGroupSkip() const
The vertical space between GroupCells.
Definition: Configuration.h:479
void HelpBrowserUserLocation(wxString helpBrowser)
Sets the location of the web browser the user has detected.
Definition: Configuration.h:1264
void SetWorksheetTopOffset(int offset)
Sets the extra top margin.
Definition: Configuration.h:467
void SetWorkingDirectory(wxString dir)
Set maxima's working directory.
Definition: Configuration.h:206
bool CheckKeepPercent() const
Do we want to display "%e" as "%e" and "%pi" as "%pi"?
Definition: Configuration.h:787
const std::vector< TextStyle > & GetCodeStylesList() const
Which styles affect how code is displayed?
Definition: Configuration.h:1602
static const wxString CharsNeedingQuotes()
Returns a list of chars we need to escape in maxima.
Definition: Configuration.h:389
void SetAppearance(Appearance a)
Choose the appearance and update which style set is active.
Definition: Configuration.h:1177
wxString MathJaXURL() const
Returns the URL MathJaX can be found at.
Definition: Configuration.h:1281
bool RightToLeftDocument() const
Does the document read right-to-left (Arabic, Hebrew, Persian, Urdu)?
Definition: Configuration.h:1138
void UpdateBackgroundBrush()
Refresh the cached document-background brush from the active style set.
Definition: Configuration.cpp:557
void AutodetectMaxima(bool autodetectmaxima)
Autodetect maxima's location?
Definition: Configuration.h:1224
void SetChangeAsterisk(bool changeAsterisk)
Use Unicode centered dots for multiplication signs?
Definition: Configuration.h:851
std::random_device::result_type RandomEntropy()
One sample of OS entropy (std::random_device).
Definition: Configuration.h:1654
bool IsOperator(const wxString &name) const
Coincides name with a operator known to maxima?
Definition: Configuration.h:191
bool MaximaHelpInConsole() const
Does Maxima answer ?, ?? and describe() with plain text in the worksheet?
Definition: Configuration.h:1625
void PrintScale(double scale)
Define if we want to hide brackets that are not under the pointer.
Definition: Configuration.h:343
void InitStyles()
Initialize the text styles on construction.
Definition: Configuration.cpp:512
static void SetDebugmode()
Enable costly checks.
Definition: Configuration.h:1613
static double GetMinZoomFactor()
The lower limit we allow for the zoom factor.
Definition: Configuration.h:291
bool AutodetectMaxima() const
Autodetect maxima's location? (If false the user-specified location is used)
Definition: Configuration.h:1222
wxScrolledCanvas * GetWorkSheet() const
Get the worksheet canvas this configuration storage is valid for.
Definition: Configuration.h:1341
bool ClipToDrawRegion() const
Do we want to save time by only redrawing the area currently shown on the screen?
Definition: Configuration.h:1454
void SetZoomFactor(double newzoom)
Sets the zoom factor the worksheet is displayed at.
Definition: Configuration.cpp:1112
bool DigitGrouping() const
Separate the digit groups of long numbers by a small gap? (GH #192)
Definition: Configuration.h:1544
bool ShowBrackets() const
Show the cell brackets [displayed left to each group cell showing its extend]?
Definition: Configuration.h:1149
bool FixReorderedIndices() const
Renumber out-of-order cell labels on saving.
Definition: Configuration.h:1275
void AddMaximaOperator(const wxString &name)
Register name as an operator known to maxima.
Definition: Configuration.h:193
bool GetPrinting() const
Are we currently printing?
Definition: Configuration.h:832
wxBrush GetBackgroundBrush() const
Get the brush to be used for the worksheet background.
Definition: Configuration.h:251
void SetIndent(long indent)
Set the indentation of GroupCells.
Definition: Configuration.h:491
bool GetAutoWrapCode() const
Do we want to have automatic line breaks for code cells?
Definition: Configuration.h:696
long GetLineWidth() const
Returns the maximum sensible width for a text line [in characters]:
Definition: Configuration.cpp:1052
void SetFilesToSave(std::list< FileToSave > files)
Replaces the list of files to save; see TakeFilesToSave().
Definition: Configuration.h:1065
void FixedFontInTextControls(bool fixed)
Use a typewriter font in wizard entry fields that can contain maxima commands?
Definition: Configuration.h:249
static EscCodeIterator EscCodesEnd()
Iterators over the escape code list.
Definition: Configuration.cpp:534
void RequestAdjustWorksheetSize() const
Ask the view (if any) to re-adjust its worksheet (scroll) size.
Definition: Configuration.h:1493
wxCoord GetCellBracketWidth() const
The width we allocate for our cell brackets.
Definition: Configuration.h:313
void MaximaUserLocation(wxString maxima)
Sets the location of the maxima binary.
Definition: Configuration.h:1241
bool OfferInternalHelpBrowser() const
If we decide that the HTML browser in the sidebar doesn't work for every platform....
Definition: Configuration.cpp:1339
bool OverlayScrollbars() const
Use GTK's overlay scrollbars on the worksheet?
Definition: Configuration.h:332
void ClipToDrawRegion(bool clipToDrawRegion)
Do we want to save time by only redrawing the area currently shown on the screen?
Definition: Configuration.h:1456
wxColour GetColor(TextStyle style)
Gets the color for a text style.
Definition: Configuration.cpp:1304
long GetCursorWidth() const
How much vertical space is to be left between two group cells?
Definition: Configuration.h:437
static wxString m_configfileLocation_override
Where to store the configuration.
Definition: Configuration.h:276
static wxColour TooltipMarkerColour(const wxColour &background)
The color the background of a cell with a mouse-over tooltip is tinted to.
Definition: Configuration.cpp:571
static long m_languageOverride
The language –language asked for, or wxLANGUAGE_UNKNOWN.
Definition: Configuration.h:278
void LineWidth_em(long width)
Set the minimum sensible line width in widths of a letter.
Definition: Configuration.h:656
void MakeTemporary()
Makes this configuration temporary.
Definition: Configuration.h:232
std::default_random_engine & RandomEngine()
The pseudo-random engine, e.g. to feed a distribution.
Definition: Configuration.h:1656
wxString MaximaHelpFormatName() const
The value of Maxima's output_format_for_help MaximaHelpInConsole() stands for.
Definition: Configuration.cpp:926
void HideBrackets(bool hide)
Define if we want to hide brackets that are not under the pointer.
Definition: Configuration.h:323
double GetDefaultLineWidth() const
Calculates the default line width for the worksheet.
Definition: Configuration.h:635
ViewCellPointers * GetViewCellPointers() const
The transient view-state half of the cell-pointer registry (null if none).
Definition: Configuration.h:1356
int GetWorksheetTopOffset() const
An extra top margin of less than one scroll unit, in px.
Definition: Configuration.h:461
wxCoord Scale_Px(double px) const
Scales a distance [in pixels] according to the zoom factor.
Definition: Configuration.cpp:1311
void ReadConfig()
Read the config from the wxConfig object.
Definition: Configuration.cpp:633
void SetRecalculateRequestCallback(std::function< void(GroupCell *)> callback)
Set the callback RequestRecalculate() notifies the view through.
Definition: Configuration.h:1369
InitOpt
Definition: Configuration.h:176
@ temporary
This configuration is temporary and shouldn't redetect Maxima etc.
Definition: Configuration.h:178
bool InternalHelpBrowser() const
Use the internal help browser? If not a external web browser is used.
Definition: Configuration.h:1249
bool ScreenReaderAnnouncesMathML() const
Announce maxima's output to screen readers as MathML?
Definition: Configuration.h:1428
void SetParenthesisDrawMode(drawMode mode)
Which way do we want to draw parenthesis?
Definition: Configuration.h:1311
drawMode
Definition: Configuration.h:170
@ ascii
Use ascii characters only.
Definition: Configuration.h:171
@ handdrawn
A parenthesis sign that was created using draw commands.
Definition: Configuration.h:172
void OverlayScrollbars(bool overlay)
Define if the worksheet should use GTK's overlay scrollbars.
Definition: Configuration.h:336
void SetCanvasSize(wxSize siz)
Sets the size of the current worksheet's visible window.
Definition: Configuration.h:1114
void MaximaParameters(wxString parameters)
The parameters we pass to the maxima binary.
Definition: Configuration.h:1229
void NotifyOfCellRedraw(const Cell *cell)
Record that this cell has been drawn to ReportMultipleRedraws()
Definition: Configuration.cpp:1019
long ShowLength() const
The choice for the "maximum output length to display" setting.
Definition: Configuration.h:1306
void ResetAllToDefaults()
Reset the whole configuration to its default values.
Definition: Configuration.cpp:245
std::vector< wxm::SymbolShortcut > SymbolShortcuts() const
The keyboard shortcuts that type a symbol into the worksheet (GH #2578).
Definition: Configuration.h:890
OversizedMatrices
How to show a matrix too large for the window.
Definition: Configuration.h:524
@ 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:939
void SetMaximaEnvVar(const wxString &name, const wxString &value)
Set a custom environment variable for the maxima process.
Definition: Configuration.h:198
wxString AiCustomProvidersJson() const
User-added custom providers (beyond the four built-in ones), as a JSON array – see AiCustomProviderCo...
Definition: Configuration.h:992
void ReadStyles(const wxString &file={})
Reads the style settings.
Definition: Configuration.cpp:1175
void SetMatrixScrollHost(MatrixScrollHost *host)
Sets the scrollbar host.
Definition: Configuration.h:616
htmlExportFormat
The export formats we support for HTML equations.
Definition: Configuration.h:144
@ mathML_mathJaX
Native MathML, plus MathJaX downloaded as a fall-back only for the few browsers that still lack MathM...
Definition: Configuration.h:152
@ mathJaX_TeX
Deprecated: the TeX-via-MathJaX HTML export was removed. The value is kept so saved configurations mi...
Definition: Configuration.h:148
@ mathML
Native MathML with no MathJaX at all: the exported page makes no external requests....
Definition: Configuration.h:156
void SetAdjustWorksheetSizeRequestCallback(std::function< void()> callback)
Set the callback RequestAdjustWorksheetSize() notifies the view through.
Definition: Configuration.h:1496
void SetDocumentCellPointers(DocumentCellPointers *p)
Register the document-model half of the cell-pointer registry.
Definition: Configuration.h:1354
bool UseUserLabels() const
Do we want at all to show labels?
Definition: Configuration.h:1201
bool ArrowKeysSkipOutput() const
Do the Up and Down keys skip over a cell's output?
Definition: Configuration.h:682
void WriteSymbolShortcuts() const
Writes the symbol shortcuts to the config file right away.
Definition: Configuration.cpp:1518
bool UpdateNeeded() const
true means: The system's config storage has changed since the configuration has been read
Definition: Configuration.cpp:1351
std::size_t ShowLength_Bytes() const
The "maximum output length to display" setting in cells.
Definition: Configuration.cpp:1550
long GetDisplayedDigits() const
Returns the maximum number of displayed digits.
Definition: Configuration.h:1005
const Style * GetStyle(TextStyle textStyle) const
Get the text Style for a given text style identifier.
Definition: Configuration.h:1325
bool AutodetectHelpBrowser() const
Autodetect the web browser? (If false the user-specified location is used)
Definition: Configuration.h:1244
void SetWorkSheet(wxScrolledCanvas *workSheet)
Set the worksheet canvas this configuration storage is valid for.
Definition: Configuration.cpp:216
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:1302
void LabelWidth(long labelWidth)
Set the width of worksheet labels [in chars].
Definition: Configuration.h:411
void RequestRecalculate(GroupCell *group) const
Ask the view (if any) to recalculate the layout starting at the given group cell.
Definition: Configuration.h:1366
const std::vector< TextStyle > & GetColorOnlyStylesList() const
Which styles affect only colors?
Definition: Configuration.h:1606
bool GetPrintedPage(wxCoord &top, wxCoord &bottom) const
The vertical range of the worksheet the page being printed shows.
Definition: Configuration.h:1075
bool PrintBrackets() const
Print the cell brackets [displayed left to each group cell showing its extend]?
Definition: Configuration.h:1160
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:1889
Sets the configuration's "printing" flag until this class is left.
Definition: Configuration.h:1872
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:104
std::atomic< long > worksheetRepaints
How often the worksheet was repainted (Worksheet::OnPaint ran)
Definition: Configuration.h:129
std::atomic< long > cellsDrawnAtWrongFontSize
How many cells were drawn at a different font size than they were laid out with.
Definition: Configuration.h:127
std::atomic< long > worksheetFullRepaints
How many of those repaints covered (nearly) the whole visible worksheet.
Definition: Configuration.h:137
One mechanically persisted scalar setting: its config key and the member variable it is stored in.
Definition: Configuration.h:762
const wxChar * key
The key the setting is stored under in the configuration store.
Definition: Configuration.h:764
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:769