From 102638a4781557e5dcdc8930303ad8b961237172 Mon Sep 17 00:00:00 2001 From: Stefan Schimanski Date: Mon, 7 Jan 2008 13:50:21 +0000 Subject: [PATCH] * fix broken default value logic from last cleanup: only show default value if not in edit mode and the given value is empty. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22413 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/MathMacro.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp index 21e08e329f..5e57a81f87 100644 --- a/src/mathed/MathMacro.cpp +++ b/src/mathed/MathMacro.cpp @@ -52,7 +52,8 @@ public: void metrics(MetricsInfo & mi, Dimension & dim) const { mathMacro_.macro()->unlock(); mathMacro_.cell(idx_).metrics(mi, dim); - if (!mathMacro_.editMetrics(mi.base.bv) && !def_.empty()) + if (!mathMacro_.editMetrics(mi.base.bv) + && mathMacro_.cell(idx_).empty()) def_.metrics(mi, dim); mathMacro_.macro()->lock(); } @@ -70,21 +71,19 @@ public: pi.pain.leaveMonochromeMode(); mathMacro_.cell(idx_).draw(pi, x, y); pi.pain.enterMonochromeMode(Color_mathbg, Color_mathmacroblend); - } else { - if (def_.empty()) - mathMacro_.cell(idx_).draw(pi, x, y); - else { - mathMacro_.cell(idx_).setXY(*pi.base.bv, x, y); - def_.draw(pi, x, y); - } - } + } else if (mathMacro_.cell(idx_).empty()) { + mathMacro_.cell(idx_).setXY(*pi.base.bv, x, y); + def_.draw(pi, x, y); + } else + mathMacro_.cell(idx_).draw(pi, x, y); } /// size_t idx() const { return idx_; } /// int kerning(BufferView const * bv) const { - if (mathMacro_.editMetrics(bv) || def_.empty()) + if (mathMacro_.editMetrics(bv) + || !mathMacro_.cell(idx_).empty()) return mathMacro_.cell(idx_).kerning(bv); else return def_.kerning(bv); -- 2.39.2