Commit da0ff323 authored by Nikita Sirgienko's avatar Nikita Sirgienko

Fix bug with unchangeable (from defaults settings) worksheet parameters...

Fix bug with unchangeable (from defaults settings) worksheet parameters (completion, embedded math, etc)
parent 040ab7ab
......@@ -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);
}
}
......
......@@ -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;
}
......
......@@ -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)
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment