From 370d7890a333ca002af41884cde93ca62231debb Mon Sep 17 00:00:00 2001 From: Stefan Schimanski Date: Fri, 15 Jun 2007 18:26:35 +0000 Subject: [PATCH] * Added the kerning method to a macro to inherit the kerning from the expanded form. * Moreover the marker metrics calls are removed as they are not drawn anyway. (fixes #3705) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18792 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/MathMacro.cpp | 7 ++++--- src/mathed/MathMacro.h | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp index e40b958c45..f68529c8e0 100644 --- a/src/mathed/MathMacro.cpp +++ b/src/mathed/MathMacro.cpp @@ -44,6 +44,8 @@ public: bool metrics(MetricsInfo & mi, Dimension & dim) const; /// void draw(PainterInfo &, int x, int y) const; + /// + int kerning() const { return mathMacro_.cell(idx_).kerning(); } private: std::auto_ptr doClone() const; @@ -65,7 +67,6 @@ bool MathMacroArgumentValue::metrics(MetricsInfo & mi, Dimension & dim) const macro.unlock(); mathMacro_.cell(idx_).metrics(mi, dim); macro.lock(); - metricsMarkers2(dim); if (dim_ == dim) return false; dim_ = dim; @@ -114,6 +115,7 @@ void MathMacro::cursorPos(BufferView const & bv, bool MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const { + kerning_ = 0; if (!MacroTable::globalMacros().has(name())) { mathed_string_dim(mi.base.font, "Unknown: " + name(), dim); } else { @@ -143,10 +145,10 @@ bool MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const macro.lock(); expanded_.metrics(mi, dim); macro.unlock(); + kerning_ = expanded_.kerning(); editing_ = false; } } - metricsMarkers2(dim); if (dim_ == dim) return false; dim_ = dim; @@ -199,7 +201,6 @@ void MathMacro::draw(PainterInfo & pi, int x, int y) const if (editing_ != editing(pi.base.bv) || macroBackup_ != macro) pi.base.bv->cursor().updateFlags(Update::Force); } - drawMarkers2(pi, x, y); } diff --git a/src/mathed/MathMacro.h b/src/mathed/MathMacro.h index 8e9f1b23d0..1978df228e 100644 --- a/src/mathed/MathMacro.h +++ b/src/mathed/MathMacro.h @@ -54,6 +54,8 @@ public: /// docstring name() const; /// + int kerning() const { return kerning_; } + /// void setExpansion(MathData const & exp, MathData const & args) const; /// @@ -85,6 +87,8 @@ private: mutable MacroData macroBackup_; /// mutable bool editing_; + /// + mutable int kerning_; };