]> git.lyx.org Git - features.git/commitdiff
fix bug #560
authorAndré Pönitz <poenitz@gmx.net>
Fri, 13 Aug 2004 13:19:58 +0000 (13:19 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 13 Aug 2004 13:19:58 +0000 (13:19 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8900 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_boxinset.h
src/mathed/math_factory.C
src/mathed/math_fboxinset.C
src/mathed/math_fboxinset.h
src/mathed/math_parser.C

index c155a76301cd3d4a0294dd8af8d69777cb133c44..eef210737b4197dda787f48f67e676b32c7fa365 100644 (file)
@@ -26,7 +26,7 @@ public:
        ///
        explicit MathBoxInset(std::string const & name);
        ///
-       virtual std::auto_ptr<InsetBase> clone() const;
+       std::auto_ptr<InsetBase> clone() const;
        ///
        mode_type currentMode() const { return TEXT_MODE; }
        ///
index 7ec8c19dec015d315b10cb9b73613ca92b0b60de..a6d8503f1e0d92013d73e5cc22597093d3dd3250 100644 (file)
@@ -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")
index 54532bf8a39d02fafdb73cc012c9db1750f48eb9..a54e64370ecc2d0a7b87b2557de4bbe33d54f3d7 100644 (file)
 #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<InsetBase> 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: ";
 }
+
index b8a4e0947deeb208027b0eafac47132e98d8f191..5527b1cfa6cfddd5228830112bdd7ac458fff039 100644 (file)
@@ -21,9 +21,9 @@ class latexkeys;
 class MathFboxInset : public MathNestInset {
 public:
        ///
-       MathFboxInset(latexkeys const * key);
+       MathFboxInset();
        ///
-       virtual std::auto_ptr<InsetBase> clone() const;
+       std::auto_ptr<InsetBase> 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
index b5746affca97f1285dce6769683d0d6a1c257f86..3c58bfeb0571a6a35f6423653feb2f528c4c6ea2 100644 (file)
@@ -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);
                        }