From: André Pönitz Date: Fri, 13 Aug 2004 13:19:58 +0000 (+0000) Subject: fix bug #560 X-Git-Tag: 1.6.10~15096 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=5fc3d2b0af7790e3b1e0c6531faf5bc1303a5898;p=features.git fix bug #560 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8900 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/math_boxinset.h b/src/mathed/math_boxinset.h index c155a76301..eef210737b 100644 --- a/src/mathed/math_boxinset.h +++ b/src/mathed/math_boxinset.h @@ -26,7 +26,7 @@ public: /// explicit MathBoxInset(std::string const & name); /// - virtual std::auto_ptr clone() const; + std::auto_ptr clone() const; /// mode_type currentMode() const { return TEXT_MODE; } /// diff --git a/src/mathed/math_factory.C b/src/mathed/math_factory.C index 7ec8c19dec..a6d8503f1e 100644 --- a/src/mathed/math_factory.C +++ b/src/mathed/math_factory.C @@ -253,12 +253,12 @@ MathAtom createMathInset(string const & s) return MathAtom(new MathSpaceInset(l->name)); if (inset == "dots") return MathAtom(new MathDotsInset(l)); - if (inset == "mbox") - return MathAtom(new MathBoxInset(l->name)); +// if (inset == "mbox") +// return MathAtom(new MathBoxInset(l->name)); // if (inset == "parbox") // return MathAtom(new MathParboxInset); - if (inset == "fbox") - return MathAtom(new MathFboxInset(l)); +// if (inset == "fbox") +// return MathAtom(new MathFboxInset(l)); if (inset == "style") return MathAtom(new MathSizeInset(l)); if (inset == "font") @@ -275,6 +275,10 @@ MathAtom createMathInset(string const & s) if (s.size() == 3 && s[0] == '\\' && s[1] == '#' && s[2] >= '1' && s[2] <= '9') return MathAtom(new MathMacroArgument(s[2] - '0')); + if (s == "mbox") + return MathAtom(new MathBoxInset("mbox")); + if (s == "fbox") + return MathAtom(new MathFboxInset()); if (s == "framebox") return MathAtom(new MathFrameboxInset); if (s == "makebox") diff --git a/src/mathed/math_fboxinset.C b/src/mathed/math_fboxinset.C index 54532bf8a3..a54e64370e 100644 --- a/src/mathed/math_fboxinset.C +++ b/src/mathed/math_fboxinset.C @@ -16,13 +16,15 @@ #include "math_parser.h" #include "math_streamstr.h" #include "LColor.h" + +#include "support/std_ostream.h" #include "frontends/Painter.h" using std::auto_ptr; -MathFboxInset::MathFboxInset(latexkeys const * key) - : MathNestInset(1), key_(key) +MathFboxInset::MathFboxInset() + : MathNestInset(1) {} @@ -34,20 +36,14 @@ auto_ptr MathFboxInset::clone() const MathInset::mode_type MathFboxInset::currentMode() const { - if (key_->name == "fbox") - return TEXT_MODE; - return MATH_MODE; + return TEXT_MODE; } void MathFboxInset::metrics(MetricsInfo & mi, Dimension & dim) const { - if (key_->name == "fbox") { - FontSetChanger dummy(mi.base, "textnormal"); - cell(0).metrics(mi, dim); - } else { - cell(0).metrics(mi, dim); - } + FontSetChanger dummy(mi.base, "textnormal"); + cell(0).metrics(mi, dim); metricsMarkers(dim, 5); // 5 pixels margin dim_ = dim; } @@ -57,23 +53,26 @@ void MathFboxInset::draw(PainterInfo & pi, int x, int y) const { pi.pain.rectangle(x + 1, y - dim_.ascent() + 1, dim_.width() - 2, dim_.height() - 2, LColor::foreground); - if (key_->name == "fbox") { - FontSetChanger dummy(pi.base, "textnormal"); - cell(0).draw(pi, x + 5, y); - } else { - cell(0).draw(pi, x + 5, y); - } + FontSetChanger dummy(pi.base, "textnormal"); + cell(0).draw(pi, x + 5, y); setPosCache(pi, x, y); } void MathFboxInset::write(WriteStream & os) const { - os << '\\' << key_->name << '{' << cell(0) << '}'; + os << "\\fbox{" << cell(0) << '}'; } void MathFboxInset::normalize(NormalStream & os) const { - os << '[' << key_->name << ' ' << cell(0) << ']'; + os << "[fbox " << cell(0) << ']'; +} + + +void MathFboxInset::infoize(std::ostream & os) const +{ + os << "FBox: "; } + diff --git a/src/mathed/math_fboxinset.h b/src/mathed/math_fboxinset.h index b8a4e0947d..5527b1cfa6 100644 --- a/src/mathed/math_fboxinset.h +++ b/src/mathed/math_fboxinset.h @@ -21,9 +21,9 @@ class latexkeys; class MathFboxInset : public MathNestInset { public: /// - MathFboxInset(latexkeys const * key); + MathFboxInset(); /// - virtual std::auto_ptr clone() const; + std::auto_ptr clone() const; /// mode_type currentMode() const; /// @@ -34,9 +34,8 @@ public: void write(WriteStream & os) const; /// write normalized content void normalize(NormalStream & ns) const; -private: /// - latexkeys const * key_; + void infoize(std::ostream & os) const; }; #endif diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index b5746affca..3c58bfeb05 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -1178,6 +1178,7 @@ void Parser::parse1(MathGridInset & grid, unsigned flags, return; } +#if 0 else if (l->inset == "parbox") { // read optional positioning and width string pos = parse_verbatim_option(); @@ -1187,6 +1188,7 @@ void Parser::parse1(MathGridInset & grid, unsigned flags, cell->back().nucleus()->asParboxInset()->setPosition(pos); cell->back().nucleus()->asParboxInset()->setWidth(width); } +#endif else { MathAtom at = createMathInset(t.cs()); @@ -1214,7 +1216,7 @@ void Parser::parse1(MathGridInset & grid, unsigned flags, //} for (MathInset::idx_type i = start; i < at->nargs(); ++i) { parse(at.nucleus()->cell(i), FLAG_ITEM, m); - parse1(grid, FLAG_SKIPSPACE, mode, numbered); + skipSpaces(); } cell->push_back(at); }