From 35ec954df8a561186aa8b21a5f7c5f83f5b27c9a Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Sun, 3 Sep 2006 11:54:17 +0000 Subject: [PATCH] This fixes the crash when PageDown scrolling UserGuide.lyx * 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 | 9 +++++---- src/mathed/math_macrotemplate.h | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mathed/math_macrotemplate.C b/src/mathed/math_macrotemplate.C index 44ad9f7f26..9cba8e8b93 100644 --- a/src/mathed/math_macrotemplate.C +++ b/src/mathed/math_macrotemplate.C @@ -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; diff --git a/src/mathed/math_macrotemplate.h b/src/mathed/math_macrotemplate.h index 54ff52f317..6b471088d9 100644 --- a/src/mathed/math_macrotemplate.h +++ b/src/mathed/math_macrotemplate.h @@ -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 doClone() const; /// prefix in inset - std::string prefix() const; + lyx::docstring prefix() const; /// int numargs_; -- 2.39.2