]> git.lyx.org Git - features.git/commitdiff
* kerning may depend on the BufferView because the metrics of some insets (e.g. math...
authorStefan Schimanski <sts@lyx.org>
Sat, 22 Dec 2007 14:39:22 +0000 (14:39 +0000)
committerStefan Schimanski <sts@lyx.org>
Sat, 22 Dec 2007 14:39:22 +0000 (14:39 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22259 a592a061-630c-0410-9148-cb99ea01b6c8

12 files changed:
src/mathed/InsetMath.h
src/mathed/InsetMathChar.h
src/mathed/InsetMathFont.h
src/mathed/InsetMathFontOld.h
src/mathed/InsetMathScript.cpp
src/mathed/InsetMathScript.h
src/mathed/InsetMathSymbol.h
src/mathed/InsetMathUnknown.h
src/mathed/MathData.cpp
src/mathed/MathData.h
src/mathed/MathMacro.cpp
src/mathed/MathMacro.h

index af6f35a62979b8e0333c5e6bd0fe7e05c0062e6d..d805fd36e3c4fb51df686ca2c8dedbb92c5e990c 100644 (file)
@@ -199,7 +199,7 @@ public:
        virtual bool allowedIn(mode_type mode) const { return mode == MATH_MODE; }
 
        /// superscript kerning
-       virtual int kerning() const { return 0; }
+       virtual int kerning(BufferView const * bv) const { return 0; }
 };
 
 ///
index dc0bc379b182a0bffd05791cf396489ff41ca828..1ff946bfd6c2fb430c10849c8eb04be08e84340b 100644 (file)
@@ -30,7 +30,7 @@ public:
        ///
        void drawT(TextPainter &, int x, int y) const;
        ///
-       int kerning() const { return kerning_; }
+       int kerning(BufferView const * bv) const { return kerning_; }
 
        ///
        void write(WriteStream & os) const;
index 98b36e6bd9f40cd246a1bd12b49d1a9913acab5f..a55c1f77b16ca7910ef503ea18c45e2529d62ee0 100644 (file)
@@ -46,7 +46,7 @@ public:
        ///
        void infoize(odocstream & os) const;
        ///
-       int kerning() const { return cell(0).kerning(); }
+       int kerning(BufferView const * bv) const { return cell(0).kerning(bv); }
 
 private:
        virtual Inset * clone() const;
index 22da1ea208e83929d24dbdddc76294c5489012da..10ef8305e09fbdae44c5383ecb2f27adab4ef6ca 100644 (file)
@@ -44,7 +44,7 @@ public:
        ///
        void infoize(odocstream & os) const;
        ///
-       int kerning() const { return cell(0).kerning(); }
+       int kerning(BufferView const * bv) const { return cell(0).kerning(bv); }
 
 private:
        virtual Inset * clone() const;
index a6d81617d7e64a4e011d557653ed5dfc0353ec95..a8142612cd31c96f9d0ae578f076e0ddae26820e 100644 (file)
@@ -253,7 +253,7 @@ int InsetMathScript::dx1(BufferView const & bv) const
 {
        BOOST_ASSERT(hasUp());
        Dimension const dim = dimension(bv);
-       return hasLimits() ? (dim.wid - up().dimension(bv).width()) / 2 : nwid(bv) + nker();
+       return hasLimits() ? (dim.wid - up().dimension(bv).width()) / 2 : nwid(bv) + nker(&bv);
 }
 
 
@@ -282,10 +282,10 @@ int InsetMathScript::ndes(BufferView const & bv) const
 }
 
 
-int InsetMathScript::nker() const
+int InsetMathScript::nker(BufferView const * bv) const
 {
        if (nuc().size()) {
-               int kerning = nuc().kerning();
+               int kerning = nuc().kerning(bv);
                return kerning > 0 ? kerning : 0;
        }
        return 0;
@@ -322,7 +322,7 @@ void InsetMathScript::metrics(MetricsInfo & mi, Dimension & dim) const
                        dim.wid = max(dim.wid, dimdown.width());
        } else {
                if (hasUp())
-                       dim.wid = max(dim.wid, nker() + dimup.width());
+                       dim.wid = max(dim.wid, nker(mi.base.bv) + dimup.width());
                if (hasDown())
                        dim.wid = max(dim.wid, dimdown.width());
                dim.wid += nwid(bv);
index e26e73824a1c3b82c2c3a60606baccc0dcc127d0..e851e2b371e4ae02e2c49450bf068494852dc20e 100644 (file)
@@ -125,7 +125,7 @@ private:
        /// returns descent of nucleus if any
        int ndes(BufferView const &) const;
        /// returns superscript kerning of nucleus if any
-       int nker() const;
+       int nker(BufferView const * bv) const;
        /// where do we have to draw the scripts?
        bool hasLimits() const;
        /// clean up empty cells and return true if a cell has been deleted.
index 5d5d7f3c371260b3a7419ce91f88fa2143498a0c..d9b26edcfe759627744696f89a37949719bb0d56 100644 (file)
@@ -35,7 +35,7 @@ public:
        ///
        void draw(PainterInfo &, int x, int y) const;
        ///
-       int kerning() const { return kerning_; }
+       int kerning(BufferView const * bv) const { return kerning_; }
 
        ///
        bool isRelOp() const;
index eddc808c63c369f3c4f22a1ee3feffe88dbfe29e..00eb81f0e69599858a149300965b041ebe5a4495 100644 (file)
@@ -52,7 +52,7 @@ public:
        ///
        bool final() const;
        ///
-       int kerning() const { return kerning_; }
+       int kerning(BufferView const * bv) const { return kerning_; }
 private:
        virtual Inset * clone() const;
        ///
index 1d40598dff076c3b7bb120b3712d16cf80cb413f..e579ece41ea812c856266a3eeb4d382c8a4e5546 100644 (file)
@@ -260,7 +260,7 @@ void MathData::metrics(MetricsInfo & mi, Dimension & dim) const
                atom_dims_.push_back(d);
                dim += d;
                if (i == n - 1)
-                       kerning_ = at->kerning();
+                       kerning_ = at->kerning(mi.base.bv);
        }
        // Cache the dimension.
        mi.base.bv->coordCache().arrays().add(this, dim);
index 1ddf623685218ff3e0dc5b0a849d12b34fdc9b4b..c0388aa6710389e13ea6c543e56e54b2e0fcae95 100644 (file)
@@ -152,7 +152,7 @@ public:
        /// additional super/subscript shift
        int sshift() const { return sshift_; }
        /// superscript kerning
-       int kerning() const { return kerning_; }
+       int kerning(BufferView const * bv) const { return kerning_; }
        ///
        void swap(MathData & ar) { base_type::swap(ar); }
 
index 5ad9366aedfc8624293c5050006a50e8731ef5d3..9468bc10a933f73e07913ae3569d119947efbc83 100644 (file)
@@ -82,7 +82,7 @@ public:
        ///
        size_t idx() const { return idx_; }
        ///
-       int kerning() const { return mathMacro_.cell(idx_).kerning(); }
+       int kerning(BufferView const * bv) const { return mathMacro_.cell(idx_).kerning(bv); }
 
 private:
        ///
@@ -204,9 +204,9 @@ void MathMacro::metrics(MetricsInfo & mi, Dimension & dim) const
 }
 
 
-int MathMacro::kerning() const {
-       if (displayMode_ == DISPLAY_NORMAL)
-               return expanded_.kerning();
+int MathMacro::kerning(BufferView const * bv) const {
+       if (displayMode_ == DISPLAY_NORMAL && !editing(bv))
+               return expanded_.kerning(bv);
        else
                return 0;
 }
index b8c91f4d0afc0192b01b7e5e25bc201739bd89b2..54ca2de8c634b706418ed733c3436153a90cf551 100644 (file)
@@ -41,7 +41,7 @@ public:
        ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
-       int kerning() const;
+       int kerning(BufferView const * bv) const;
        /// get cursor position
        void cursorPos(BufferView const & bv, CursorSlice const & sl,
                bool boundary, int & x, int & y) const;