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
This commit is contained in:
Abdelrazak Younes 2006-09-03 11:54:17 +00:00
parent 6611e3843b
commit 35ec954df8
2 changed files with 7 additions and 5 deletions

View 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;

View 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_;