]> git.lyx.org Git - features.git/commitdiff
This fixes the crash when PageDown scrolling UserGuide.lyx
authorAbdelrazak Younes <younes@lyx.org>
Sun, 3 Sep 2006 11:54:17 +0000 (11:54 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sun, 3 Sep 2006 11:54:17 +0000 (11:54 +0000)
* MathMacroTemplate::prefix(): now return docstring.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14876 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_macrotemplate.C
src/mathed/math_macrotemplate.h

index 44ad9f7f269dae47d9e2a9093edacef963be79f1..9cba8e8b93d72df4b350dd731807d940d1b17267 100644 (file)
@@ -102,9 +102,10 @@ string MathMacroTemplate::name() const
 }
 
 
-string MathMacroTemplate::prefix() const
+docstring MathMacroTemplate::prefix() const
 {
-       return bformat(_(" Macro: %1$s: "), name_);
+       // FIXME: delete the conversion when bformat() will return a docstring.
+       return lyx::from_utf8(bformat(_(" Macro: %1$s: "), name_));
 }
 
 
@@ -112,7 +113,7 @@ void MathMacroTemplate::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        cell(0).metrics(mi);
        cell(1).metrics(mi);
-       docstring dp(prefix().begin(), prefix().end());
+       docstring dp = prefix();
        dim.wid = cell(0).width() + cell(1).width() + 20
                + font_metrics::width(dp, mi.base.font);
        dim.asc = std::max(cell(0).ascent(),  cell(1).ascent())  + 7;
@@ -150,7 +151,7 @@ void MathMacroTemplate::draw(PainterInfo & p, int x, int y) const
        if (cur.isInside(this))
                cur.drawSelection(pi);
 #endif
-       docstring dp(prefix().begin(), prefix().end());
+       docstring dp = prefix();
        pi.pain.text(x + 2, y, dp, font);
        x += font_metrics::width(dp, pi.base.font) + 6;
 
index 54ff52f3174f6b04f2c211741d344c8cd99c1fbf..6b471088d9bbdb01d40746e7007a5146d6fe04c6 100644 (file)
@@ -17,6 +17,7 @@
 #include "math_macrotable.h"
 #include "math_nestinset.h"
 
+#include "support/types.h"
 
 /// This class contains the macro definition.
 class MathMacroTemplate : public MathNestInset {
@@ -62,7 +63,7 @@ public:
 private:
        virtual std::auto_ptr<InsetBase> doClone() const;
        /// prefix in inset
-       std::string prefix() const;
+       lyx::docstring prefix() const;
 
        ///
        int numargs_;