]> git.lyx.org Git - features.git/commitdiff
fix delimiter handling for \, |, and /
authorAndré Pönitz <poenitz@gmx.net>
Wed, 12 Sep 2001 12:51:55 +0000 (12:51 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 12 Sep 2001 12:51:55 +0000 (12:51 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2740 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/formulabase.C
src/mathed/math_cursor.C
src/mathed/math_cursor.h
src/mathed/math_deliminset.C
src/mathed/math_deliminset.h
src/mathed/math_parser.C
src/mathed/support.C

index ab62ccb72cd4fbf57868e49ea7108e00695a3214..2436eda6a7fdf20e708c6f78f0b8f3f0cff2a40c 100644 (file)
@@ -575,14 +575,12 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
                string rs;
                istringstream is(arg.c_str());
                is >> ls >> rs;
-               latexkeys const * l = in_word_set(ls);
-               latexkeys const * r = in_word_set(rs);
-               if (!is || !l || !r) {
+               if (!is) {
                        lyxerr << "can't parse delimeters from '" << arg << "'\n";
                        break;
                }
                bv->lockedInsetStoreUndo(Undo::EDIT);
-               mathcursor->handleDelim(l, r);
+               mathcursor->handleDelim(ls, rs);
                updateLocal(bv, true);
                break;
        }
index e334f75eba2dd20a74891dc8a966868b16c4faf2..f33924586cd8276ad4c517aba22712a2fcb34fe9 100644 (file)
@@ -752,7 +752,7 @@ void MathCursor::handleFont(MathTextCodes t)
 }
 
 
-void MathCursor::handleDelim(latexkeys const * l, latexkeys const * r)
+void MathCursor::handleDelim(string const & l, string const & r)
 {
        handleNest(new MathDelimInset(l, r));
 }
index 34f93337891f9851ef2ed385b9fc0977e621b927..09b98ec2fd1d0271e984b927bbaa08f44f8bfaf6 100644 (file)
@@ -163,7 +163,7 @@ public:
        ///
        void handleFont(MathTextCodes t);
        ///
-       void handleDelim(latexkeys const * l, latexkeys const * r);
+       void handleDelim(string const & l, string const & r);
        ///
        void handleNest(MathInset * p);
        /// Splits cells and shifts right part to the next cell
index d42bbf79d393d86fe7ff3cd1a197873fbba46039..6bb3abb1a7eeac307bfe139aece557d358f76cdc 100644 (file)
@@ -11,7 +11,7 @@
 
 using std::max;
 
-MathDelimInset::MathDelimInset(latexkeys const * l, latexkeys const * r)
+MathDelimInset::MathDelimInset(string const & l, string const & r)
        : MathNestInset(1), left_(l), right_(r)
 {}
 
@@ -22,10 +22,8 @@ MathInset * MathDelimInset::clone() const
 }
 
 
-string MathDelimInset::latexName(latexkeys const * l)
+string MathDelimInset::latexName(string const & name)
 {
-       //static const string vdelim("(){}[]./|");
-       string name = l->name;
        if (name == "(")
                return name;
        if (name == "[")
@@ -46,7 +44,7 @@ string MathDelimInset::latexName(latexkeys const * l)
 
 void MathDelimInset::write(std::ostream & os, bool fragile) const
 {
-       os << "\\left" << latexName(left_);
+       os << "\\left"  << latexName(left_);
        cell(0).write(os, fragile);
        os << "\\right" << latexName(right_);
 }
@@ -86,6 +84,6 @@ void MathDelimInset::draw(Painter & pain, int x, int y) const
        int const w = dw();
        int const b = y - ascent_ - 2;
        xcell(0).draw(pain, x + w + 2, y);
-       mathed_draw_deco(pain, x + 1, b, w, height() + 4, left_->name);
-       mathed_draw_deco(pain, x + width() - w - 1, b, w, height() + 4, right_->name);
+       mathed_draw_deco(pain, x + 1, b, w, height() + 4, left_);
+       mathed_draw_deco(pain, x + width() - w - 1, b, w, height() + 4, right_);
 }
index 81b9432d43c48dbd7b3b55efbc55b712798868b5..23cf45e376b2d985afaece5e3d6999cadac89544 100644 (file)
     \author Alejandro Aguilar Sierra
 */
 
-class latexkeys;
-
 class MathDelimInset : public MathNestInset {
 public:
        ///
-       MathDelimInset(latexkeys const *, latexkeys const *);
+       MathDelimInset(string const &, string const &);
        ///
        MathInset * clone() const;
        ///
@@ -28,13 +26,13 @@ public:
        ///
        void metrics(MathStyles st) const;
 private:
-       ///
-       static string latexName(latexkeys const *);
        ///
        int dw() const;
        ///
-       latexkeys const * left_;
+       string left_;
+       ///
+       string right_;
        ///
-       latexkeys const * right_;
+       static string latexName(string const & name);
 };
 #endif
index 185120b5d7d21290dff9dfc5c3ae7a8295e72e41..10f2c46b1ad2380565c1394870f9f4744abc2c39 100644 (file)
@@ -218,8 +218,6 @@ private:
        void error(string const & msg);
        ///
        void parse_lines(MathGridInset * p, bool numbered, bool outmost);
-       ///
-       latexkeys const * read_delim();
 
 private:
        ///
@@ -607,14 +605,6 @@ MathMatrixInset * Parser::parse_normal()
 }
 
 
-latexkeys const * Parser::read_delim()
-{
-       Token const & t = getToken();
-       latexkeys const * l = in_word_set(t.asString());
-       return l ? l : in_word_set(".");
-}
-
-
 void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
 {
        MathTextCodes yyvarcode = LM_TC_MIN;
@@ -758,10 +748,10 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
                }
                
                else if (t.cs() == "left") {
-                       latexkeys const * l = read_delim();
+                       string l = getToken().asString();
                        MathArray ar;
                        parse_into(ar, FLAG_RIGHT);
-                       latexkeys const * r = read_delim();
+                       string r = getToken().asString();
                        MathDelimInset * dl = new MathDelimInset(l, r);
                        dl->cell(0) = ar;
                        array.push_back(dl);
index db4ab147ec6155505188ad42f5bb2372f6f2620e..e568e925ca9ebf028f6a96391c053f3e85957197 100644 (file)
@@ -485,6 +485,7 @@ named_deco_struct deco_table[] = {
        {"/",              slash,      0 },
        {"Vert",           Vert,       0 },
        {"'",              slash,      1 },
+       {"backslash",      slash,      1 },
        {"langle",         angle,      0 },
        {"lceil",          corner,     0 }, 
        {"lfloor",         corner,     1 },  
@@ -644,7 +645,7 @@ void mathed_draw_deco(Painter & pain, int x, int y, int w, int h,
        deco_struct const * mds = search_deco(name);
        if (!mds) {
                lyxerr << "Deco was not found. Programming error?\n";
-               lyxerr << "name: '" << name << "\n";
+               lyxerr << "name: '" << name << "'\n";
                return;
        }