]> git.lyx.org Git - lyx.git/commitdiff
* Added the kerning method to a macro to inherit the kerning from the expanded form.
authorStefan Schimanski <sts@lyx.org>
Fri, 15 Jun 2007 18:26:35 +0000 (18:26 +0000)
committerStefan Schimanski <sts@lyx.org>
Fri, 15 Jun 2007 18:26:35 +0000 (18:26 +0000)
* 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
src/mathed/MathMacro.h

index e40b958c45c4bac806e5b59939d56440bfc0c0cd..f68529c8e071a635919fc9cce8e0926bcdca9a17 100644 (file)
@@ -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<Inset> 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);
 }
 
 
index 8e9f1b23d051560462e892d7340cc94058b988a7..1978df228e2efa74bffb9c60488f15217012a4ba 100644 (file)
@@ -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_;
 };