]> git.lyx.org Git - lyx.git/commitdiff
remove symbol_def.h
authorAndré Pönitz <poenitz@gmx.net>
Mon, 3 Sep 2001 15:22:55 +0000 (15:22 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Mon, 3 Sep 2001 15:22:55 +0000 (15:22 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2666 a592a061-630c-0410-9148-cb99ea01b6c8

16 files changed:
src/mathed/ChangeLog
src/mathed/math_binominset.C
src/mathed/math_decorationinset.C
src/mathed/math_decorationinset.h
src/mathed/math_deliminset.C
src/mathed/math_dotsinset.C
src/mathed/math_dotsinset.h
src/mathed/math_factory.C
src/mathed/math_hash.C
src/mathed/math_inset.h
src/mathed/math_notinset.h
src/mathed/math_parser.h
src/mathed/math_rootinset.h
src/mathed/support.C
src/mathed/support.h
src/mathed/symbol_def.h [deleted file]

index 197da34ce189afc9adc5b8439e17b693195b4959..cf59a573ba9a74682a6054c99dcdce8d01a31023 100644 (file)
@@ -2,7 +2,9 @@
 
        * math_hash.C: Use std::map instead of faking it
        
-       * symbol_def.C: remove unneded symbol definitions
+       * symbol_def.h: remove unneeded symbol definitions
+
+       *       support.C: use the decorations' name for drawing
 
 2001-09-02  Dekel Tsur  <dekelts@tau.ac.il>
 
index c9d0edd7355525526c3ddd640ed46364d3c3c387..57857776159cd0af9fa5e101b65e9cff19c38996 100644 (file)
@@ -3,7 +3,6 @@
 #endif
 
 #include "math_binominset.h"
-#include "math_parser.h"
 #include "support.h"
 #include "support/LOstream.h"
 
@@ -47,10 +46,8 @@ void MathBinomInset::draw(Painter & pain, int x, int y) const
        int m = x + width() / 2;
        xcell(0).draw(pain, m - xcell(0).width() / 2, y - xcell(0).descent() - 3 - 5);
        xcell(1).draw(pain, m - xcell(1).width() / 2, y + xcell(1).ascent()  + 3 - 5);
-       mathed_draw_deco(pain, x, y - ascent_,
-               dw(), height(), in_word_set("("));
-       mathed_draw_deco(pain, x + width() - dw(), y - ascent_, 
-               dw(), height(), in_word_set(")"));
+       mathed_draw_deco(pain, x, y - ascent_, dw(), height(), "(");
+       mathed_draw_deco(pain, x + width() - dw(), y - ascent_, dw(), height(), ")");
 }
 
 
index 11d5ff0f344e24c792bb36475ae275bc7ec78ad5..8d3d3501e8b70a631a0a9157d855174771f0e2d4 100644 (file)
 using std::ostream;
 
 
-MathDecorationInset::MathDecorationInset(latexkeys const * key)
-       : MathNestInset(1), key_(key)
-{
-}
+MathDecorationInset::MathDecorationInset(string const & name)
+       : MathNestInset(1), name_(name)
+{}
 
 
 MathInset * MathDecorationInset::clone() const
@@ -25,17 +24,17 @@ MathInset * MathDecorationInset::clone() const
 
 bool MathDecorationInset::upper() const
 {
-       return key_->id != LM_underline && key_->id != LM_underbrace;
+       return name_ != "underline" && name_ != "underbrace";
 }
 
 
 bool MathDecorationInset::protect() const
 {
        return
-                       key_->name == "overbrace" ||
-                       key_->name == "underbrace" ||
-                       key_->name == "overleftarrow" ||
-                       key_->name == "overrightarrow";
+                       name_ == "overbrace" ||
+                       name_ == "underbrace" ||
+                       name_ == "overleftarrow" ||
+                       name_ == "overrightarrow";
 }
 
 
@@ -56,21 +55,15 @@ void MathDecorationInset::metrics(MathStyles st) const
                dy_ = descent_ + 1;
                descent_ += dh_ + 2;
        }
-
-       if (key_->id == LM_not) {
-               ascent_  += dh_;
-               descent_ += dh_;
-               dh_ = height();
-               dy_ = - ascent_;
-       }
 }
 
+
 void MathDecorationInset::draw(Painter & pain, int x, int y) const
 { 
        xo(x);
        yo(x);
        xcell(0).draw(pain, x, y);
-       mathed_draw_deco(pain, x, y + dy_, width_, dh_, key_);
+       mathed_draw_deco(pain, x, y + dy_, width_, dh_, name_);
 }
 
 
@@ -78,23 +71,15 @@ void MathDecorationInset::write(ostream & os, bool fragile) const
 {
        if (fragile && protect())
                os << "\\protect";
-       os << '\\' << key_->name;
-
-       if (key_->id == LM_not)
-               os << ' ';
-       else
-               os << '{';
-
+       os << '\\' << name_ << '{';
        cell(0).write(os, fragile);  
-
-       if (key_->id != LM_not)
-               os << '}';
+       os << '}';
 }
 
 
 void MathDecorationInset::writeNormal(ostream & os) const
 {
-       os << "[" << key_->name << " ";
+       os << "[" << name_ << " ";
        cell(0).writeNormal(os);
        os << "] ";
 }
index 54024c14d8a20f7ba488804da587cdb1d5c248a2..58f74cca21a1e6721c02466496778ebfac5f4fcd 100644 (file)
@@ -3,6 +3,7 @@
 #define MATH_DECORATIONINSET_H
 
 #include "math_nestinset.h"
+#include "LString.h"
 
 #ifdef __GNUG__
 #pragma interface
     \author Alejandro Aguilar Sierra
  */
 
-struct latexkeys;
-
 class MathDecorationInset : public MathNestInset {
 public:
        ///
-       explicit MathDecorationInset(latexkeys const *);
+       explicit MathDecorationInset(string const & name);
        ///
        MathInset * clone() const;
        ///
@@ -36,7 +35,7 @@ private:
        bool protect() const;
 
        ///
-       latexkeys const * key_;
+       string const name_;
        /// height cache of deco
        mutable int dh_;
        /// vertical offset cache of deco
index 9fc14cad7842b779a0d9c0747f9b27b1df2a1d8d..d42bbf79d393d86fe7ff3cd1a197873fbba46039 100644 (file)
@@ -86,6 +86,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_);
-       mathed_draw_deco(pain, x + width() - w - 1, b, w, height() + 4, right_);
+       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);
 }
index 04478bd0edb83e487534c7e20461a5bf33e607a5..f7b6238dc0f704bc9daa0bba8219e0a595812fd8 100644 (file)
@@ -4,14 +4,13 @@
 
 #include "math_dotsinset.h"
 #include "mathed/support.h"
-#include "mathed/math_parser.h"
 #include "support/LOstream.h"
 
 using std::ostream;
 
 
-MathDotsInset::MathDotsInset(latexkeys const * key)
-       : key_(key)
+MathDotsInset::MathDotsInset(string const & name)
+       : name_(name)
 {}
 
 
@@ -23,12 +22,13 @@ MathInset * MathDotsInset::clone() const
 
 void MathDotsInset::draw(Painter & pain, int x, int y) const
 {
-       mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, key_);
-       if (key_->id == LM_vdots || key_->id == LM_ddots)
+       mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, name_);
+       char const c = name_[0];
+       if (c == 'v' || c == 'd')
                ++x;
-       if (key_->id != LM_vdots)
+       if (c != 'v')
                --y;
-       mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, key_);
+       mathed_draw_deco(pain, x + 2, y - dh_, width_ - 2, ascent_, name_);
 }
 
 
@@ -36,22 +36,22 @@ void MathDotsInset::metrics(MathStyles st) const
 {
        size(st);
        mathed_char_dim(LM_TC_VAR, size(), 'M', ascent_, descent_, width_);
-       switch (key_->id) {
-               case LM_ldots: dh_ = 0; break;
-               case LM_cdots: dh_ = ascent_ / 2; break;
-               case LM_vdots: width_ /= 2;
-               case LM_ddots: dh_ = ascent_; break;
+       switch (name_[0]) {
+               case 'l': dh_ = 0; break;
+               case 'c': dh_ = ascent_ / 2; break;
+               case 'v': width_ /= 2;
+               case 'd': dh_ = ascent_; break;
        }
 } 
 
 
 void MathDotsInset::write(ostream & os, bool /* fragile */) const
 {
-       os << '\\' << key_->name << ' ';
+       os << '\\' << name_ << ' ';
 }
 
 
 void MathDotsInset::writeNormal(ostream & os) const
 {
-       os << "[" << key_->name << "] ";
+       os << "[" << name_ << "] ";
 }
index c2d87c7f6ded2e61848734f60e3284302e9f60ca..cda4a77f7a335c6fe2b030d4724b9c1c65bfbb14 100644 (file)
@@ -3,19 +3,17 @@
 #define MATH_DOTSINSET_H
 
 #include "math_diminset.h"
-#include "math_defs.h"
+#include "LString.h"
 
 #ifdef __GNUG__
 #pragma interface
 #endif
 
-struct latexkeys;
-
 /// The different kinds of ellipsis
 class MathDotsInset : public MathDimInset {
 public:
        ///
-       explicit MathDotsInset(latexkeys const *);
+       explicit MathDotsInset(string const &);
        ///
        MathInset * clone() const;
        ///
@@ -30,6 +28,6 @@ protected:
        /// cache for the thing's heigth
        mutable int dh_;
        ///
-       latexkeys const * key_;
+       string const name_;
 };   
 #endif
index 01df5f283837628055634c885b90543d0b3d06e7..975cd1f89b7f6f9af14a8178378ec1d7a07cd85f 100644 (file)
@@ -53,11 +53,11 @@ MathInset * createMathInset(latexkeys const * l)
        case LM_TK_ROOT:
                return new MathRootInset;
        case LM_TK_DECORATION:
-               return new MathDecorationInset(l);
+               return new MathDecorationInset(l->name);
        case LM_TK_SPACE:
                return new MathSpaceInset(l->id);
        case LM_TK_DOTS:
-               return new MathDotsInset(l);
+               return new MathDotsInset(l->name);
        }
        return new MathFuncInset(l->name);
 }
index 8004a2680e6b3190c933ec49a59489d146ad4cc7..9c24fd243fda25ea6ef45507c994ea7bbfa8456e 100644 (file)
@@ -7,7 +7,6 @@
 #include "support/lyxfunctional.h"
 
 #include <map>
-#include <algorithm>
 
 
 namespace {
@@ -39,46 +38,46 @@ latexkeys_a wordlist_array[] =
        {"\\",  LM_TK_NEWLINE, static_cast<unsigned>(-1)}, // -1 needed in mathed_parse_lines!
        {"]",  LM_TK_END, LM_OT_EQUATION},
        {"_",  LM_TK_SPECIAL, '_'},
-       {"acute",  LM_TK_DECORATION, LM_acute},
+       {"acute",  LM_TK_DECORATION, 0},
        {"arccos",  LM_TK_FUNC, 0},
        {"arcsin",  LM_TK_FUNC, 0},
        {"arctan",  LM_TK_FUNC, 0},
        {"arg",  LM_TK_FUNC, 0},
        {"atop",  LM_TK_ATOP, 0},
        {"backslash",  LM_TK_SPECIAL, '\\'},
-       {"bar",  LM_TK_DECORATION, LM_bar},
+       {"bar",  LM_TK_DECORATION, 0},
        {"begin",  LM_TK_BEGIN, 0},
        {"binom",  LM_TK_BINOM, 0},
        {"bmod",  LM_TK_FUNC, 0},
-       {"breve",  LM_TK_DECORATION, LM_breve},
+       {"breve",  LM_TK_DECORATION, 0},
        {"cal",  LM_TK_OLDFONT, LM_TC_CAL},
-       {"cdots",  LM_TK_DOTS, LM_cdots},
-       {"check",  LM_TK_DECORATION, LM_check},
+       {"cdots",  LM_TK_DOTS, 0},
+       {"check",  LM_TK_DECORATION, 0},
        {"choose",  LM_TK_CHOOSE, 0},
        {"cos",  LM_TK_FUNC, 0},
        {"cosh",  LM_TK_FUNC, 0},
        {"cot",  LM_TK_FUNC, 0},
        {"coth",  LM_TK_FUNC, 0},
        {"csc",  LM_TK_FUNC, 0},
-       {"ddot",  LM_TK_DECORATION, LM_ddot},
-       {"ddots",  LM_TK_DOTS, LM_ddots},
+       {"ddot",  LM_TK_DECORATION, 0},
+       {"ddots",  LM_TK_DOTS, 0},
        {"deg",  LM_TK_FUNC, 0},
        {"det",  LM_TK_FUNCLIM, 0},
        {"dim",  LM_TK_FUNC, 0},
        //{"displaystyle",  LM_TK_STY, LM_ST_DISPLAY},
-       {"dot",  LM_TK_DECORATION, LM_dot},
+       {"dot",  LM_TK_DECORATION, 0},
        {"end",  LM_TK_END, 0},
        {"exp",  LM_TK_FUNC, 0},
        {"frac",  LM_TK_FRAC, 0},
        {"gcd",  LM_TK_FUNCLIM, 0},
-       {"grave",  LM_TK_DECORATION, LM_grave},
-       {"hat",  LM_TK_DECORATION, LM_hat},
+       {"grave",  LM_TK_DECORATION, 0},
+       {"hat",  LM_TK_DECORATION, 0},
        {"hom",  LM_TK_FUNC, 0},
        {"inf",  LM_TK_FUNCLIM, 0},
        {"ker",  LM_TK_FUNC, 0},
        {"kern",  LM_TK_KERN, 0},
        {"label",  LM_TK_LABEL, 0},
-       {"ldots",  LM_TK_DOTS, LM_ldots},
+       {"ldots",  LM_TK_DOTS, 0},
        {"left",  LM_TK_LEFT, 0},
        {"lg",  LM_TK_FUNC, 0},
        {"lim",  LM_TK_FUNCLIM, 0},
@@ -100,12 +99,12 @@ latexkeys_a wordlist_array[] =
        {"newcommand",  LM_TK_NEWCOMMAND, 0 },
        {"nolimits",  LM_TK_LIMIT, static_cast<unsigned>(-1)},
        {"nonumber",  LM_TK_NONUM, 0},
-       {"not",  LM_TK_NOT, LM_not},
+       {"not",  LM_TK_NOT, 0},
        {"over",  LM_TK_OVER, 0},
-       {"overbrace",  LM_TK_DECORATION, LM_overbrace},
-       {"overleftarrow",  LM_TK_DECORATION, LM_overleftarrow},
-       {"overline",  LM_TK_DECORATION, LM_overline},
-       {"overrightarrow",  LM_TK_DECORATION, LM_overightarrow},
+       {"overbrace",  LM_TK_DECORATION, 0},
+       {"overleftarrow",  LM_TK_DECORATION, 0},
+       {"overline",  LM_TK_DECORATION, 0},
+       {"overrightarrow",  LM_TK_DECORATION, 0},
        {"protect",  LM_TK_PROTECT, 0},
        {"qquad",  LM_TK_SPACE, 5},
        {"quad",  LM_TK_SPACE, 4},
@@ -123,13 +122,13 @@ latexkeys_a wordlist_array[] =
        {"tanh",  LM_TK_FUNC, 0},
        {"textrm",  LM_TK_FONT, LM_TC_TEXTRM},
        //{"textstyle",  LM_TK_STY, LM_ST_TEXT},
-       {"tilde",  LM_TK_DECORATION, LM_tilde},
-       {"underbrace",  LM_TK_DECORATION, LM_underbrace},
-       {"underline",  LM_TK_DECORATION, LM_underline},
-       {"vdots",  LM_TK_DOTS, LM_vdots},
-       {"vec",  LM_TK_DECORATION, LM_vec},
-       {"widehat",  LM_TK_DECORATION, LM_widehat},
-       {"widetilde",  LM_TK_DECORATION, LM_widetilde},
+       {"tilde",  LM_TK_DECORATION, 0},
+       {"underbrace",  LM_TK_DECORATION, 0},
+       {"underline",  LM_TK_DECORATION, 0},
+       {"vdots",  LM_TK_DOTS, 0},
+       {"vec",  LM_TK_DECORATION, 0},
+       {"widehat",  LM_TK_DECORATION, 0},
+       {"widetilde",  LM_TK_DECORATION, 0},
        {"{",  LM_TK_SPECIAL, '{'},
        {"|",  LM_TK_UNDEF, '|'},
        {"}",  LM_TK_SPECIAL, '}'},
index ca8a5638c887554f8a30bee1fc074ea79e15aa2e..668be974140dc002b605b22897cc5e5e9d843240 100644 (file)
@@ -28,7 +28,6 @@
 #pragma interface
 #endif
 
-#include "symbol_def.h"
 #include "xarray.h"
 
 /** Abstract base class for all math objects.
index 917e5bb7ff2b0e452c34699c7ef2eb5b7f19c489..b97d565ffcb9541a25ec525d5cce853359c2f191 100644 (file)
@@ -4,8 +4,6 @@
 
 #include "math_diminset.h"
 
-struct latexkeys;
-
 // \\not
 
 class MathNotInset : public MathDimInset {
index 45c89dddab19b76b2533fcf155c6bdebc3c37025..68ef43cce915ff519575b7ddc74a2acf6bf37754 100644 (file)
@@ -24,9 +24,7 @@
 #endif
 
 #include "LString.h"
-
 #include "math_defs.h"
-#include "symbol_def.h"
 
 class MathMatrixInset;
 class MathMacroTemplate;
index 97e56ea6259a5e975ed59b8310e7a151d4dadaee..5649d0a8f72e76fabe3ad2f51546f9b291bde0ae 100644 (file)
@@ -16,7 +16,6 @@
 #define MATH_ROOT_H
 
 #include "math_nestinset.h"
-#include "symbol_def.h"
 
 #ifdef __GNUG__
 #pragma interface
index 1e40d6abd4775a33d49088eba3506ea35d7b02d8..94e2751a9207e90fd61fb803d04bdb276365d1a1 100644 (file)
@@ -1,6 +1,6 @@
 #include <config.h>
 
-#include <algorithm>
+#include <map>
 
 #include "mathed/support.h"
 #include "lyxfont.h"
@@ -11,8 +11,6 @@
 #include "Painter.h"
 #include "debug.h"
 
-using std::sort;
-using std::lower_bound;
 using std::endl;
 using std::max;
 
@@ -454,102 +452,94 @@ float const tilde[] = {
 
 
 struct deco_struct {
-       int code;
        float const * data;
        int angle;
 };
 
-deco_struct deco_table[] = {   
-       // Decorations
-       { LM_widehat,       &angle[0],      3 },
-       { LM_widetilde,     &tilde[0],      0 },
-       { LM_underline,     &hline[0],      0 },
-       { LM_overline,      &hline[0],      0 },
-       { LM_underbrace,    &brace[0],      1 },
-       { LM_overbrace,     &brace[0],      3 },
-       { LM_overleftarrow, &arrow[0],      1 },
-       { LM_overightarrow, &arrow[0],      3 },
-                                           
-       // Delimiters                       
-       { '(',              &parenth[0],    0 },
-       { ')',              &parenth[0],    2 },
-       { '{',              &brace[0],      0 },
-       { '}',              &brace[0],      2 },
-       { '[',              &brack[0],      0 },
-       { ']',              &brack[0],      2 },
-       { '|',              &vert[0],       0 },
-       { '/',              &slash[0],      0 },
-       { LM_Vert,          &Vert[0],       0 },
-       { '\\',             &slash[0],      1 },
-       { LM_langle,        &angle[0],      0 },
-       { LM_lceil,         &corner[0],     0 }, 
-       { LM_lfloor,        &corner[0],     1 },  
-       { LM_rangle,        &angle[0],      2 }, 
-       { LM_rceil,         &corner[0],     3 }, 
-       { LM_rfloor,        &corner[0],     2 },
-       { LM_downarrow,     &arrow[0],      2 },
-       { LM_Downarrow,     &Arrow[0],      2 }, 
-       { LM_uparrow,       &arrow[0],      0 },
-       { LM_Uparrow,       &Arrow[0],      0 },
-       { LM_updownarrow,   &udarrow[0],    0 },
-       { LM_Updownarrow,   &Udarrow[0],    0 },         
-                                           
-       // Accents                          
-       { LM_ddot,          &hline2[0],     0 },
-       { LM_hat,           &angle[0],      3 },
-       { LM_grave,         &slash[0],      1 },
-       { LM_acute,         &slash[0],      0 },
-       { LM_tilde,         &tilde[0],      0 },
-       { LM_bar,           &hline[0],      0 },
-       { LM_dot,           &hlinesmall[0], 0 },
-       { LM_check,         &angle[0],      1 },
-       { LM_breve,         &parenth[0],    1 },
-       { LM_vec,           &arrow[0],      3 },
-       { LM_not,           &slash[0],      0 },  
-                                           
-       // Dots                             
-       { LM_ldots,         &hline3[0],     0 }, 
-       { LM_cdots,         &hline3[0],     0 },
-       { LM_vdots,         &hline3[0],     1 },
-       { LM_ddots,         &dline3[0],     0 }
+struct named_deco_struct {
+       char const * name;
+       float const * data;
+       int angle;
 };
 
-
-struct deco_compare {
-       /// for use by sort and lower_bound
-       int operator()(deco_struct const & a, deco_struct const & b) const
-       {
-               return a.code < b.code;
-       }
+named_deco_struct deco_table[] = {   
+       // Decorations
+       {"widehat",       angle,      3 },
+       {"widetilde",     tilde,      0 },
+       {"underline",     hline,      0 },
+       {"overline",      hline,      0 },
+       {"underbrace",    brace,      1 },
+       {"overbrace",     brace,      3 },
+       {"overleftarrow", arrow,      1 },
+       {"overightarrow", arrow,      3 },
+                                                         
+       // Delimiters 
+       {"(",            parenth,    0 },
+       {")",            parenth,    2 },
+       {"{",            brace,      0 },
+       {"}",            brace,      2 },
+       {"[",            brack,      0 },
+       {"]",            brack,      2 },
+       {"|",            vert,       0 },
+       {"/",            slash,      0 },
+       {"Vert",         Vert,       0 },
+       {"'",            slash,      1 },
+       {"langle",       angle,      0 },
+       {"lceil",        corner,     0 }, 
+       {"lfloor",       corner,     1 },  
+       {"rangle",       angle,      2 }, 
+       {"rceil",        corner,     3 }, 
+       {"rfloor",       corner,     2 },
+       {"downarrow",    arrow,      2 },
+       {"Downarrow",    Arrow,      2 }, 
+       {"uparrow",      arrow,      0 },
+       {"Uparrow",      Arrow,      0 },
+       {"updownarrow",  udarrow,    0 },
+       {"Updownarrow",  Udarrow,    0 },        
+                                                         
+       // Accents
+       {"ddot",         hline2,     0 },
+       {"hat",          angle,      3 },
+       {"grave",        slash,      1 },
+       {"acute",        slash,      0 },
+       {"tilde",        tilde,      0 },
+       {"bar",          hline,      0 },
+       {"dot",          hlinesmall, 0 },
+       {"check",        angle,      1 },
+       {"breve",        parenth,    1 },
+       {"vec",          arrow,      3 },
+       {"not",          slash,      0 },  
+                                                         
+       // Dots
+       {"ldots",        hline3,     0 }, 
+       {"cdots",        hline3,     0 },
+       {"vdots",        hline3,     1 },
+       {"ddots",        dline3,     0 }
 };
 
 
-int const deco_table_size = sizeof(deco_table) / sizeof(deco_struct);
-
+std::map<string, deco_struct> deco_list;
 
 // sort the table on startup
 struct init_deco_table {
        init_deco_table() {
-                       std::sort(deco_table,
-                            deco_table + deco_table_size,
-                            deco_compare());
+               unsigned const n = sizeof(deco_table) / sizeof(deco_table[0]);
+               for (named_deco_struct * p = deco_table; p != deco_table + n; ++p) {
+                       deco_struct d;
+                       d.data  = p->data;
+                       d.angle = p->angle;
+                       deco_list[p->name]= d;
+               }
        }
 };
 
 static init_deco_table dummy;
 
 
-deco_struct const * search_deco(int code)
+deco_struct const * search_deco(string const & name)
 {
-       const deco_struct search_elem = { code, 0, 0 };
-       
-       deco_struct const * res =
-               lower_bound(deco_table, deco_table + deco_table_size, search_elem,
-                       deco_compare());
-       if (res != deco_table + deco_table_size &&
-           res->code == code)
-               return res;
-       return 0;
+       map<string, deco_struct>::const_iterator p = deco_list.find(name);
+       return (p == deco_list.end()) ? 0 : &(p->second); 
 }
 
 
@@ -638,13 +628,11 @@ int mathed_string_width(MathTextCodes type, MathStyles size, string const & s)
 
 
 void mathed_draw_deco(Painter & pain, int x, int y, int w, int h,
-       latexkeys const * l)
+       const string & name)
 {
        Matrix mt;
        Matrix sqmt;
        int i = 0;
-       string const & name = l->name;
-       int code = (name.size() > 1) ? l->id : name[0];
 
        if (name == ".") {
                pain.line(x + w/2, y, x + w/2, y + h,
@@ -652,17 +640,17 @@ void mathed_draw_deco(Painter & pain, int x, int y, int w, int h,
                return;
        }       
        
-       deco_struct const * mds = search_deco(code);
+       deco_struct const * mds = search_deco(name);
        if (!mds) {
                lyxerr << "Deco was not found. Programming error?\n";
-               lyxerr << "name: '" << name << "', code: " << code << "\n";
+               lyxerr << "name: '" << name << "\n";
                return;
        }
        
        int const r = mds->angle;
        float const * d = mds->data;
        
-       if (h > 70 && (mds->code == int('(') || mds->code == int(')')))
+       if (h > 70 && (name == "(" || name == ")"))
                d = parenthHigh;
        
        mt.rotate(r);
@@ -679,6 +667,7 @@ void mathed_draw_deco(Painter & pain, int x, int y, int w, int h,
        if (r >= 2)
                x += w;   
 
+       int code;
        do {
                float xx;
                float yy;
index 046f285c9c862f0ecabe0bd57d5fffce7d5902bd..e6b90a2762c281eced6e92ac3636e004e51129ad 100644 (file)
@@ -20,7 +20,7 @@ int mathed_char_ascent(MathTextCodes type, MathStyles size, unsigned char c);
 int mathed_char_descent(MathTextCodes type, MathStyles size, unsigned char c);
 
 void mathed_draw_deco
-       (Painter & pain, int x, int y, int w, int h, latexkeys const * l);
+       (Painter & pain, int x, int y, int w, int h, string const & name);
 
 void mathed_string_dim(MathTextCodes type, MathStyles size, string const & s,
   int & asc, int & des, int & wid);
diff --git a/src/mathed/symbol_def.h b/src/mathed/symbol_def.h
deleted file mode 100644 (file)
index 9581237..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-// This -*- C++ -*- file was created automatically.
-// Don't change it!  [asierra18jan96]
-// Why? [andre]
-
-#ifndef SYMBOL_DEF
-#define SYMBOL_DEF 
-
-enum Math_Symbols_enum {
-// Accents
-       LM_acute          = '\'',
-       LM_grave          = '`',
-       LM_hat            = '^',
-       LM_tilde          = '~',
-       LM_dot            = '.',
-       LM_bar            = '-',
-
-/// Symbols that don't exist in X11 symbol font but that we fake
-       LM_not            = 10,
-
-// Symbols that do exist in X11 symbol font
-       LM_uparrow        = 0xad,
-       LM_downarrow      = 0xaf,
-       LM_Leftrightarrow = 0xdb,
-       LM_Leftarrow      = 0xdc,
-       LM_Uparrow        = 0xdd,
-       LM_Rightarrow     = 0xde,
-       LM_Downarrow      = 0xdf,
-       LM_langle         = 0xe1,
-       LM_lceil          = 0xe9,
-       LM_lfloor         = 0xeb,
-       LM_rangle         = 0xf1,
-       LM_int            = 0xf2,
-       LM_rceil          = 0xf9,
-       LM_rfloor         = 0xfb,
-               
-/// Symbols that don't exist in X11 symbol font
-       LM_NoFont          = 256,
-
-/// needed as decoration
-       LM_Vert,
-       LM_updownarrow,
-       LM_Updownarrow,
-
-/// decorations
-       LM_widehat,
-       LM_widetilde,
-       LM_underline,
-       LM_overline,
-       LM_underbrace, 
-       LM_overbrace,
-       LM_overleftarrow,
-       LM_overightarrow, 
-
-/// dots
-       LM_ldots,
-       LM_cdots,
-       LM_vdots,
-       LM_ddots,            
-       LM_emptyset,
-
-/// Accents that don't exist in X11 symbol font
-       LM_ddot,
-       LM_check,
-       LM_vec,
-       LM_breve
-};
-
-#endif