diff --git a/src/markdownentry.cpp b/src/markdownentry.cpp index 19cd018f97506be4306de3f042febcdb4733ccd0..582db8e4dd1c7b4052f99cd82576c50f79927c8c 100644 --- a/src/markdownentry.cpp +++ b/src/markdownentry.cpp @@ -185,7 +185,7 @@ void MarkdownEntry::setContent(const QDomElement& content, const KZip& file) setRenderedMath(i+1, data.first, internal, data.second); } } - else + else if (worksheet()->embeddedMathEnabled()) renderMathExpression(i+1, mathCode); } } diff --git a/src/test/worksheet_test.cpp b/src/test/worksheet_test.cpp index b5c7ec3e37f2878a8fa4b646763fa4d2d56bdfb4..446572aca0b2c6fe287eeac5e72553a42d6b6b82 100644 --- a/src/test/worksheet_test.cpp +++ b/src/test/worksheet_test.cpp @@ -58,9 +58,8 @@ void WorksheetTest::initTestCase() Worksheet* WorksheetTest::loadWorksheet(const QString& name) { - Worksheet* w = new Worksheet(Cantor::Backend::getBackend(QLatin1String("maxima")), nullptr); + Worksheet* w = new Worksheet(Cantor::Backend::getBackend(QLatin1String("maxima")), nullptr, false); WorksheetView v(w, nullptr); - w->enableEmbeddedMath(false); w->load(dataPath + name); return w; } diff --git a/src/worksheet.cpp b/src/worksheet.cpp index 95d5c5c76cbc28b67c769724387781c34e386d8e..ebe361fc7ad0fd1da051aafc631619970d40f8c3 100644 --- a/src/worksheet.cpp +++ b/src/worksheet.cpp @@ -63,7 +63,7 @@ const double Worksheet::TopMargin = 12; const double Worksheet::EntryCursorLength = 30; const double Worksheet::EntryCursorWidth = 2; -Worksheet::Worksheet(Cantor::Backend* backend, QWidget* parent) +Worksheet::Worksheet(Cantor::Backend* backend, QWidget* parent, bool useDeafultWorksheetParameters) : QGraphicsScene(parent) { m_session = nullptr; @@ -80,6 +80,8 @@ Worksheet::Worksheet(Cantor::Backend* backend, QWidget* parent) m_choosenCursorEntry = nullptr; m_isCursorEntryAfterLastEntry = false; + m_useDefaultWorksheetParameters = useDeafultWorksheetParameters; + m_viewWidth = 0; m_maxWidth = 0; @@ -1280,11 +1282,14 @@ bool Worksheet::loadCantorWorksheet(const KZip& archive) void Worksheet::initSession(Cantor::Backend* backend) { m_session = backend->createSession(); - enableHighlighting(Settings::self()->highlightDefault()); - enableCompletion(Settings::self()->completionDefault()); - enableExpressionNumbering(Settings::self()->expressionNumberingDefault()); - enableAnimations(Settings::self()->animationDefault()); - enableEmbeddedMath(Settings::self()->embeddedMathDefault()); + if (m_useDefaultWorksheetParameters) + { + enableHighlighting(Settings::self()->highlightDefault()); + enableCompletion(Settings::self()->completionDefault()); + enableExpressionNumbering(Settings::self()->expressionNumberingDefault()); + enableAnimations(Settings::self()->animationDefault()); + enableEmbeddedMath(Settings::self()->embeddedMathDefault()); + } } bool Worksheet::loadJupyterNotebook(const QJsonDocument& doc) diff --git a/src/worksheet.h b/src/worksheet.h index a20acb9506636b5601336edc243e7ef1572e1f33..444db3efb7544a1e0cfa05e24acc0cea1361baeb 100644 --- a/src/worksheet.h +++ b/src/worksheet.h @@ -63,7 +63,7 @@ class Worksheet : public QGraphicsScene JupyterNotebook }; - Worksheet(Cantor::Backend* backend, QWidget* parent); + Worksheet(Cantor::Backend* backend, QWidget* parent, bool useDeafultWorksheetParameters = true); ~Worksheet() override; Cantor::Session* session(); @@ -318,10 +318,13 @@ class Worksheet : public QGraphicsScene KToggleAction* m_alignRightAction; KToggleAction* m_alignJustifyAction; - bool m_completionEnabled; - bool m_embeddedMathEnabled; - bool m_showExpressionIds; - bool m_animationsEnabled; + bool m_useDefaultWorksheetParameters{true}; + + bool m_completionEnabled{false}; + bool m_embeddedMathEnabled{false}; + bool m_showExpressionIds{false}; + bool m_animationsEnabled{false}; + bool m_isPrinting; bool m_isLoadingFromFile; bool m_readOnly;