diff --git a/src/mathed/Makefile.am b/src/mathed/Makefile.am index ead7112d35..9c2c89f6f0 100644 --- a/src/mathed/Makefile.am +++ b/src/mathed/Makefile.am @@ -62,8 +62,6 @@ libmathed_la_SOURCES = \ math_spaceinset.h \ math_sqrtinset.C \ math_sqrtinset.h \ - math_utils.C \ - math_utils.h \ support.C \ support.h \ symbol_def.h diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index b0811d3b57..73095ef42f 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -669,7 +669,7 @@ void MathCursor::interpret(string const & s) case LM_TK_SYM: { MathTextCodes code = static_cast(l->id); if (code < 255) - insert(l->id, MathIsBOPS(code) ? LM_TC_BOPS : LM_TC_SYMB); + insert(l->id, l->bin != LMB_NONE ? LM_TC_BOPS : LM_TC_SYMB); else p = new MathFuncInset(l->name); break; @@ -733,7 +733,9 @@ void MathCursor::macroModeOpen() { if (!imacro_) { imacro_ = new MathFuncInset(""); - insert(imacro_); + array().insert(cursor().pos_, imacro_); + array().next(cursor().pos_); + //insert(imacro_); } else lyxerr << "Math Warning: Already in macro mode" << endl; } diff --git a/src/mathed/math_cursor.h b/src/mathed/math_cursor.h index 8b796cc82a..1d03668863 100644 --- a/src/mathed/math_cursor.h +++ b/src/mathed/math_cursor.h @@ -100,6 +100,8 @@ public: /// void plainErase(); /// + void plainInsert(MathInset * p); + /// void delLine(); /// This is in pixels from (maybe?) the top of inset void setPos(int, int); diff --git a/src/mathed/math_hash.C b/src/mathed/math_hash.C index a83d8a937d..2ae68b1e6d 100644 --- a/src/mathed/math_hash.C +++ b/src/mathed/math_hash.C @@ -10,275 +10,275 @@ namespace { latexkeys const wordlist[] = { - //{"displaystyle", LM_TK_STY, LM_ST_DISPLAY}, - //{"scriptscriptstyle", LM_TK_STY, LM_ST_SCRIPTSCRIPT}, - //{"scriptstyle", LM_TK_STY, LM_ST_SCRIPT}, - //{"textstyle", LM_TK_STY, LM_ST_TEXT}, - {"Delta", LM_TK_SYM, LM_Delta}, - {"Downarrow", LM_TK_SYM, LM_Downarrow}, - {"Gamma", LM_TK_SYM, LM_Gamma}, - {"Im", LM_TK_SYM, LM_Im}, - {"Lambda", LM_TK_SYM, LM_Lambda}, - {"Leftarrow", LM_TK_SYM, LM_Leftarrow}, - {"Leftrightarrow", LM_TK_SYM, LM_Leftrightarrow}, - {"Longleftarrow", LM_TK_SYM, LM_Longleftarrow}, - {"Longleftrightarrow", LM_TK_SYM, LM_Longleftrightarrow}, - {"Longrightarrow", LM_TK_SYM, LM_Longrightarrow}, - {"Omega", LM_TK_SYM, LM_Omega}, - {"Phi", LM_TK_SYM, LM_Phi}, - {"Pi", LM_TK_SYM, LM_Pi}, - {"Pr", LM_TK_FUNCLIM, 0}, - {"Psi", LM_TK_SYM, LM_Psi}, - {"Re", LM_TK_SYM, LM_Re}, - {"Rightarrow", LM_TK_SYM, LM_Rightarrow}, - {"Sigma", LM_TK_SYM, LM_Sigma}, - {"Theta", LM_TK_SYM, LM_Theta}, - {"Uparrow", LM_TK_SYM, LM_Uparrow}, - {"Updownarrow", LM_TK_SYM, LM_Updownarrow}, - {"Upsilon", LM_TK_SYM, LM_Upsilon}, - {"Vert", LM_TK_SYM, LM_Vert}, - {"Xi", LM_TK_SYM, LM_Xi}, - {"acute", LM_TK_DECORATION, LM_acute}, - {"aleph", LM_TK_SYM, LM_aleph}, - {"alpha", LM_TK_SYM, LM_alpha}, - {"amalg", LM_TK_SYM, LM_amalg}, - {"angle", LM_TK_SYM, LM_angle}, - {"approx", LM_TK_SYM, LM_approx}, - {"arccos", LM_TK_FUNC, 0}, - {"arcsin", LM_TK_FUNC, 0}, - {"arctan", LM_TK_FUNC, 0}, - {"arg", LM_TK_FUNC, 0}, - {"asymp", LM_TK_SYM, LM_asymp}, - {"backslash", LM_TK_SYM, LM_backslash}, - {"bar", LM_TK_DECORATION, LM_bar}, - {"begin", LM_TK_BEGIN, 0}, - {"beta", LM_TK_SYM, LM_beta}, - {"bigcap", LM_TK_BIGSYM, LM_cap}, - {"bigcirc", LM_TK_SYM, LM_bigcirc}, - {"bigcup", LM_TK_BIGSYM, LM_cup}, - {"bigodot", LM_TK_BIGSYM, LM_bigodot}, - {"bigoplus", LM_TK_BIGSYM, LM_oplus}, - {"bigotimes", LM_TK_BIGSYM, LM_otimes}, - {"bigsqcup", LM_TK_BIGSYM, LM_bigsqcup}, - {"bigtriangledown", LM_TK_SYM, LM_bigtriangledown}, - {"bigtriangleup", LM_TK_SYM, LM_bigtriangleup}, - {"biguplus", LM_TK_BIGSYM, LM_biguplus}, - {"bigvee", LM_TK_BIGSYM, LM_vee}, - {"bigwedge", LM_TK_BIGSYM, LM_wedge}, - {"bmod", LM_TK_FUNC, 0}, - {"bot", LM_TK_SYM, LM_bot}, - {"bowtie", LM_TK_SYM, LM_bowtie}, - {"breve", LM_TK_DECORATION, LM_breve}, - {"bullet", LM_TK_SYM, LM_bullet}, - {"cap", LM_TK_SYM, LM_cap}, - {"cdot", LM_TK_SYM, LM_cdot}, - {"cdots", LM_TK_DOTS, LM_cdots}, - {"check", LM_TK_DECORATION, LM_check}, - {"chi", LM_TK_SYM, LM_chi}, - {"circ", LM_TK_SYM, LM_circ}, - {"clubsuit", LM_TK_SYM, LM_clubsuit}, - {"cong", LM_TK_SYM, LM_cong}, - {"coprod", LM_TK_BIGSYM, LM_coprod}, - {"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}, - {"cup", LM_TK_SYM, LM_cup}, - {"dagger", LM_TK_SYM, LM_dagger}, - {"dashv", LM_TK_SYM, LM_dashv}, - {"ddagger", LM_TK_SYM, LM_ddagger}, - {"ddot", LM_TK_DECORATION, LM_ddot}, - {"ddots", LM_TK_DOTS, LM_ddots}, - {"deg", LM_TK_FUNC, 0}, - {"delta", LM_TK_SYM, LM_delta}, - {"det", LM_TK_FUNCLIM, 0}, - {"diamond", LM_TK_SYM, LM_diamond}, - {"diamondsuit", LM_TK_SYM, LM_diamondsuit}, - {"dim", LM_TK_FUNC, 0}, - {"div", LM_TK_SYM, LM_div}, - {"dot", LM_TK_DECORATION, LM_dot}, - {"doteq", LM_TK_SYM, LM_doteq}, - {"downarrow", LM_TK_SYM, LM_downarrow}, - {"ell", LM_TK_SYM, LM_ell}, - {"emptyset", LM_TK_MACRO, LM_emptyset}, - {"end", LM_TK_END, 0}, - {"epsilon", LM_TK_SYM, LM_epsilon}, - {"equiv", LM_TK_SYM, LM_equiv}, - {"eta", LM_TK_SYM, LM_eta}, - {"exists", LM_TK_SYM, LM_exists}, - {"exp", LM_TK_FUNC, 0}, - {"flat", LM_TK_SYM, LM_flat}, - {"forall", LM_TK_SYM, LM_forall}, - {"frac", LM_TK_FRAC, 0}, - {"frown", LM_TK_SYM, LM_frown}, - {"gamma", LM_TK_SYM, LM_gamma}, - {"gcd", LM_TK_FUNCLIM, 0}, - {"geq", LM_TK_SYM, LM_geq}, - {"gg", LM_TK_SYM, LM_gg}, - {"grave", LM_TK_DECORATION, LM_grave}, - {"hat", LM_TK_DECORATION, LM_hat}, - {"hbar", LM_TK_SYM, LM_hbar}, - {"heartsuit", LM_TK_SYM, LM_heartsuit}, - {"hom", LM_TK_FUNC, 0}, - {"hookleftarrow", LM_TK_SYM, LM_hookleftarrow}, - {"hookrightarrow", LM_TK_SYM, LM_hookrightarrow}, - {"imath", LM_TK_SYM, LM_imath}, - {"in", LM_TK_SYM, LM_in}, - {"inf", LM_TK_FUNCLIM, 0}, - {"infty", LM_TK_SYM, LM_infty}, - {"int", LM_TK_BIGSYM, LM_int}, - {"iota", LM_TK_SYM, LM_iota}, - {"jmath", LM_TK_SYM, LM_jmath}, - {"kappa", LM_TK_SYM, LM_kappa}, - {"ker", LM_TK_FUNC, 0}, - {"label", LM_TK_LABEL, 0}, - {"lambda", LM_TK_SYM, LM_lambda}, - {"langle", LM_TK_SYM, LM_langle}, - {"lceil", LM_TK_SYM, LM_lceil}, - {"ldots", LM_TK_DOTS, LM_ldots}, - {"left", LM_TK_LEFT, 0}, - {"leftarrow", LM_TK_SYM, LM_leftarrow}, - {"leftharpoondown", LM_TK_SYM, LM_leftharpoondown}, - {"leftharpoonup", LM_TK_SYM, LM_leftharpoonup}, - {"leftrightarrow", LM_TK_SYM, LM_leftrightarrow}, - {"leq", LM_TK_SYM, LM_leq}, - {"lfloor", LM_TK_SYM, LM_lfloor}, - {"lg", LM_TK_FUNC, 0}, - {"lim", LM_TK_FUNCLIM, 0}, - {"liminf", LM_TK_FUNCLIM, 0}, - {"limits", LM_TK_LIMIT, 1 }, - {"limsup", LM_TK_FUNCLIM, 0}, - {"ll", LM_TK_SYM, LM_ll}, - {"ln", LM_TK_FUNC, 0}, - {"log", LM_TK_FUNC, 0}, - {"longleftarrow", LM_TK_SYM, LM_longleftarrow}, - {"longleftrightarrow", LM_TK_SYM, LM_longleftrightarrow}, - {"longmapsto", LM_TK_SYM, LM_longmapsto}, - {"longrightarrow", LM_TK_SYM, LM_longrightarrow}, - {"mapsto", LM_TK_SYM, LM_mapsto}, - {"mathbf", LM_TK_FONT, LM_TC_BF}, - {"mathcal", LM_TK_FONT, LM_TC_CAL}, - {"mathit", LM_TK_FONT, LM_TC_IT}, - {"mathnormal", LM_TK_FONT, LM_TC_VAR}, - {"mathrm", LM_TK_FONT, LM_TC_RM}, - {"mathsf", LM_TK_FONT, LM_TC_SF}, - {"mathtt", LM_TK_FONT, LM_TC_TT}, - {"max", LM_TK_FUNCLIM, 0}, - {"mid", LM_TK_SYM, LM_mid}, - {"min", LM_TK_FUNCLIM, 0}, - {"models", LM_TK_SYM, LM_models}, - {"mp", LM_TK_SYM, LM_mp}, - {"mu", LM_TK_SYM, LM_mu}, - {"nabla", LM_TK_SYM, LM_nabla}, - {"natural", LM_TK_SYM, LM_natural}, - {"nearrow", LM_TK_SYM, LM_nearrow}, - {"neg", LM_TK_SYM, LM_neg}, - {"neq", LM_TK_SYM, LM_neq}, - {"newcommand", LM_TK_NEWCOMMAND, 0 }, - {"ni", LM_TK_SYM, LM_ni}, - {"nolimits", LM_TK_LIMIT, -1}, - {"nonumber", LM_TK_NONUM, 0}, - {"not", LM_TK_DECORATION, LM_not}, - {"notin", LM_TK_MACRO, LM_notin}, - {"nu", LM_TK_SYM, LM_nu}, - {"nwarrow", LM_TK_SYM, LM_nwarrow}, - {"odot", LM_TK_SYM, LM_odot}, - {"oint", LM_TK_BIGSYM, LM_oint}, - {"omega", LM_TK_SYM, LM_omega}, - {"ominus", LM_TK_SYM, LM_ominus}, - {"oplus", LM_TK_SYM, LM_oplus}, - {"oslash", LM_TK_SYM, LM_oslash}, - {"otimes", LM_TK_SYM, LM_otimes}, - {"overbrace", LM_TK_DECORATION, LM_overbrace}, - {"overleftarrow", LM_TK_DECORATION, LM_overleftarrow}, - {"overline", LM_TK_DECORATION, LM_overline}, - {"overrightarrow", LM_TK_DECORATION, LM_overightarrow}, - {"parallel", LM_TK_SYM, LM_parallel}, - {"partial", LM_TK_SYM, LM_partial}, - {"perp", LM_TK_MACRO, LM_perp}, - {"phi", LM_TK_SYM, LM_phi}, - {"pi", LM_TK_SYM, LM_pi}, - {"pm", LM_TK_SYM, LM_pm}, - {"pmod", LM_TK_PMOD, 0}, - {"prec", LM_TK_SYM, LM_prec}, - {"preceq", LM_TK_SYM, LM_preceq}, - {"prime", LM_TK_SYM, LM_prime}, - {"prod", LM_TK_BIGSYM, LM_prod}, - {"propto", LM_TK_SYM, LM_propto}, - {"psi", LM_TK_SYM, LM_psi}, - {"qquad", LM_TK_SPACE, LM_qquad}, - {"quad", LM_TK_SPACE, LM_quad}, - {"rangle", LM_TK_SYM, LM_rangle}, - {"rceil", LM_TK_SYM, LM_rceil}, - {"rfloor", LM_TK_SYM, LM_rfloor}, - {"rho", LM_TK_SYM, LM_rho}, - {"right", LM_TK_RIGHT, 0}, - {"rightarrow", LM_TK_SYM, LM_rightarrow}, - {"rightharpoondown", LM_TK_SYM, LM_rightharpoondown}, - {"rightharpoonup", LM_TK_SYM, LM_rightharpoonup}, - {"rightleftharpoons", LM_TK_SYM, LM_rightleftharpoons}, - {"searrow", LM_TK_SYM, LM_searrow}, - {"sec", LM_TK_FUNC, 0}, - {"setminus", LM_TK_SYM, LM_setminus}, - {"sharp", LM_TK_SYM, LM_sharp}, - {"sigma", LM_TK_SYM, LM_sigma}, - {"sim", LM_TK_SYM, LM_sim}, - {"simeq", LM_TK_SYM, LM_simeq}, - {"sin", LM_TK_FUNC, 0}, - {"sinh", LM_TK_FUNC, 0}, - {"smile", LM_TK_SYM, LM_smile}, - {"spadesuit", LM_TK_SYM, LM_spadesuit}, - {"sqcap", LM_TK_SYM, LM_sqcap}, - {"sqcup", LM_TK_SYM, LM_sqcup}, - {"sqrt", LM_TK_SQRT, 0}, - {"sqsubseteq", LM_TK_SYM, LM_sqsubseteq}, - {"sqsupseteq", LM_TK_SYM, LM_sqsupseteq}, - {"stackrel", LM_TK_STACK, 0}, - {"star", LM_TK_SYM, LM_star}, - {"subset", LM_TK_SYM, LM_subset}, - {"subseteq", LM_TK_SYM, LM_subseteq}, - {"succ", LM_TK_SYM, LM_succ}, - {"succeq", LM_TK_SYM, LM_succeq}, - {"sum", LM_TK_BIGSYM, LM_sum}, - {"sup", LM_TK_FUNCLIM, 0}, - {"supset", LM_TK_SYM, LM_supset}, - {"supseteq", LM_TK_SYM, LM_supseteq}, - {"surd", LM_TK_SYM, LM_surd}, - {"swarrow", LM_TK_SYM, LM_swarrow}, - {"tan", LM_TK_FUNC, 0}, - {"tanh", LM_TK_FUNC, 0}, - {"tau", LM_TK_SYM, LM_tau}, - {"textrm", LM_TK_FONT, LM_TC_TEXTRM}, - {"theta", LM_TK_SYM, LM_theta}, - {"tilde", LM_TK_DECORATION, LM_tilde}, - {"times", LM_TK_SYM, LM_times}, - {"top", LM_TK_SYM, LM_top}, - {"triangle", LM_TK_SYM, LM_triangle}, - {"triangleleft", LM_TK_SYM, LM_triangleleft}, - {"triangleright", LM_TK_SYM, LM_triangleright}, - {"underbrace", LM_TK_DECORATION, LM_underbrace}, - {"underline", LM_TK_DECORATION, LM_underline}, - {"uparrow", LM_TK_SYM, LM_uparrow}, - {"updownarrow", LM_TK_SYM, LM_updownarrow}, - {"uplus", LM_TK_SYM, LM_uplus}, - {"upsilon", LM_TK_SYM, LM_upsilon}, - {"varepsilon", LM_TK_SYM, LM_varepsilon}, - {"varphi", LM_TK_SYM, LM_varphi}, - {"varpi", LM_TK_SYM, LM_varpi}, - {"varsigma", LM_TK_SYM, LM_varsigma}, - {"vartheta", LM_TK_SYM, LM_vartheta}, - {"vdash", LM_TK_SYM, LM_vdash}, - {"vdots", LM_TK_DOTS, LM_vdots}, - {"vec", LM_TK_DECORATION, LM_vec}, - {"vee", LM_TK_SYM, LM_vee}, - {"wedge", LM_TK_SYM, LM_wedge}, - {"widehat", LM_TK_DECORATION, LM_widehat}, - {"widetilde", LM_TK_DECORATION, LM_widetilde}, - {"wp", LM_TK_SYM, LM_wp}, - {"wr", LM_TK_SYM, LM_wr}, - {"xi", LM_TK_SYM, LM_xi}, - {"zeta", LM_TK_SYM, LM_zeta}, + //{"displaystyle", LM_TK_STY, LM_ST_DISPLAY, LMB_NONE}, + //{"scriptscriptstyle", LM_TK_STY, LM_ST_SCRIPTSCRIPT, LMB_NONE}, + //{"scriptstyle", LM_TK_STY, LM_ST_SCRIPT, LMB_NONE}, + //{"textstyle", LM_TK_STY, LM_ST_TEXT, LMB_NONE}, + {"Delta", LM_TK_SYM, LM_Delta, LMB_NONE}, + {"Downarrow", LM_TK_SYM, LM_Downarrow, LMB_NONE}, + {"Gamma", LM_TK_SYM, LM_Gamma, LMB_NONE}, + {"Im", LM_TK_SYM, LM_Im, LMB_NONE}, + {"Lambda", LM_TK_SYM, LM_Lambda, LMB_NONE}, + {"Leftarrow", LM_TK_SYM, LM_Leftarrow, LMB_NONE}, + {"Leftrightarrow", LM_TK_SYM, LM_Leftrightarrow, LMB_NONE}, + {"Longleftarrow", LM_TK_SYM, LM_Longleftarrow, LMB_NONE}, + {"Longleftrightarrow", LM_TK_SYM, LM_Longleftrightarrow, LMB_NONE}, + {"Longrightarrow", LM_TK_SYM, LM_Longrightarrow, LMB_NONE}, + {"Omega", LM_TK_SYM, LM_Omega, LMB_NONE}, + {"Phi", LM_TK_SYM, LM_Phi, LMB_NONE}, + {"Pi", LM_TK_SYM, LM_Pi, LMB_NONE}, + {"Pr", LM_TK_FUNCLIM, 0, LMB_NONE}, + {"Psi", LM_TK_SYM, LM_Psi, LMB_NONE}, + {"Re", LM_TK_SYM, LM_Re, LMB_NONE}, + {"Rightarrow", LM_TK_SYM, LM_Rightarrow, LMB_NONE}, + {"Sigma", LM_TK_SYM, LM_Sigma, LMB_NONE}, + {"Theta", LM_TK_SYM, LM_Theta, LMB_NONE}, + {"Uparrow", LM_TK_SYM, LM_Uparrow, LMB_NONE}, + {"Updownarrow", LM_TK_SYM, LM_Updownarrow, LMB_NONE}, + {"Upsilon", LM_TK_SYM, LM_Upsilon, LMB_NONE}, + {"Vert", LM_TK_SYM, LM_Vert, LMB_NONE}, + {"Xi", LM_TK_SYM, LM_Xi, LMB_NONE}, + {"acute", LM_TK_DECORATION, LM_acute, LMB_NONE}, + {"aleph", LM_TK_SYM, LM_aleph, LMB_NONE}, + {"alpha", LM_TK_SYM, LM_alpha, LMB_NONE}, + {"amalg", LM_TK_SYM, LM_amalg, LMB_OPERATOR}, + {"angle", LM_TK_SYM, LM_angle, LMB_NONE}, + {"approx", LM_TK_SYM, LM_approx, LMB_RELATION}, + {"arccos", LM_TK_FUNC, 0, LMB_NONE}, + {"arcsin", LM_TK_FUNC, 0, LMB_NONE}, + {"arctan", LM_TK_FUNC, 0, LMB_NONE}, + {"arg", LM_TK_FUNC, 0, LMB_NONE}, + {"asymp", LM_TK_SYM, LM_asymp, LMB_RELATION}, + {"backslash", LM_TK_SYM, LM_backslash, LMB_NONE}, + {"bar", LM_TK_DECORATION, LM_bar, LMB_NONE}, + {"begin", LM_TK_BEGIN, 0, LMB_NONE}, + {"beta", LM_TK_SYM, LM_beta, LMB_NONE}, + {"bigcap", LM_TK_BIGSYM, LM_cap, LMB_NONE}, + {"bigcirc", LM_TK_SYM, LM_bigcirc, LMB_OPERATOR}, + {"bigcup", LM_TK_BIGSYM, LM_cup, LMB_NONE}, + {"bigodot", LM_TK_BIGSYM, LM_bigodot, LMB_NONE}, + {"bigoplus", LM_TK_BIGSYM, LM_oplus, LMB_NONE}, + {"bigotimes", LM_TK_BIGSYM, LM_otimes, LMB_NONE}, + {"bigsqcup", LM_TK_BIGSYM, LM_bigsqcup, LMB_NONE}, + {"bigtriangledown", LM_TK_SYM, LM_bigtriangledown, LMB_OPERATOR}, + {"bigtriangleup", LM_TK_SYM, LM_bigtriangleup, LMB_OPERATOR}, + {"biguplus", LM_TK_BIGSYM, LM_biguplus, LMB_NONE}, + {"bigvee", LM_TK_BIGSYM, LM_vee, LMB_NONE}, + {"bigwedge", LM_TK_BIGSYM, LM_wedge, LMB_NONE}, + {"bmod", LM_TK_FUNC, 0, LMB_NONE}, + {"bot", LM_TK_SYM, LM_bot, LMB_NONE}, + {"bowtie", LM_TK_SYM, LM_bowtie, LMB_RELATION}, + {"breve", LM_TK_DECORATION, LM_breve, LMB_NONE}, + {"bullet", LM_TK_SYM, LM_bullet, LMB_OPERATOR}, + {"cap", LM_TK_SYM, LM_cap, LMB_OPERATOR}, + {"cdot", LM_TK_SYM, LM_cdot, LMB_OPERATOR}, + {"cdots", LM_TK_DOTS, LM_cdots, LMB_NONE}, + {"check", LM_TK_DECORATION, LM_check, LMB_NONE}, + {"chi", LM_TK_SYM, LM_chi, LMB_NONE}, + {"circ", LM_TK_SYM, LM_circ, LMB_OPERATOR}, + {"clubsuit", LM_TK_SYM, LM_clubsuit, LMB_NONE}, + {"cong", LM_TK_SYM, LM_cong, LMB_RELATION}, + {"coprod", LM_TK_BIGSYM, LM_coprod, LMB_NONE}, + {"cos", LM_TK_FUNC, 0, LMB_NONE}, + {"cosh", LM_TK_FUNC, 0, LMB_NONE}, + {"cot", LM_TK_FUNC, 0, LMB_NONE}, + {"coth", LM_TK_FUNC, 0, LMB_NONE}, + {"csc", LM_TK_FUNC, 0, LMB_NONE}, + {"cup", LM_TK_SYM, LM_cup, LMB_OPERATOR}, + {"dagger", LM_TK_SYM, LM_dagger, LMB_OPERATOR}, + {"dashv", LM_TK_SYM, LM_dashv, LMB_RELATION}, + {"ddagger", LM_TK_SYM, LM_ddagger, LMB_OPERATOR}, + {"ddot", LM_TK_DECORATION, LM_ddot, LMB_NONE}, + {"ddots", LM_TK_DOTS, LM_ddots, LMB_NONE}, + {"deg", LM_TK_FUNC, 0, LMB_NONE}, + {"delta", LM_TK_SYM, LM_delta, LMB_NONE}, + {"det", LM_TK_FUNCLIM, 0, LMB_NONE}, + {"diamond", LM_TK_SYM, LM_diamond, LMB_OPERATOR}, + {"diamondsuit", LM_TK_SYM, LM_diamondsuit, LMB_NONE}, + {"dim", LM_TK_FUNC, 0, LMB_NONE}, + {"div", LM_TK_SYM, LM_div, LMB_OPERATOR}, + {"dot", LM_TK_DECORATION, LM_dot, LMB_NONE}, + {"doteq", LM_TK_SYM, LM_doteq, LMB_RELATION}, + {"downarrow", LM_TK_SYM, LM_downarrow, LMB_NONE}, + {"ell", LM_TK_SYM, LM_ell, LMB_NONE}, + {"emptyset", LM_TK_MACRO, LM_emptyset, LMB_NONE}, + {"end", LM_TK_END, 0, LMB_NONE}, + {"epsilon", LM_TK_SYM, LM_epsilon, LMB_NONE}, + {"equiv", LM_TK_SYM, LM_equiv, LMB_RELATION}, + {"eta", LM_TK_SYM, LM_eta, LMB_NONE}, + {"exists", LM_TK_SYM, LM_exists, LMB_NONE}, + {"exp", LM_TK_FUNC, 0, LMB_NONE}, + {"flat", LM_TK_SYM, LM_flat, LMB_NONE}, + {"forall", LM_TK_SYM, LM_forall, LMB_NONE}, + {"frac", LM_TK_FRAC, 0, LMB_NONE}, + {"frown", LM_TK_SYM, LM_frown, LMB_RELATION}, + {"gamma", LM_TK_SYM, LM_gamma, LMB_NONE}, + {"gcd", LM_TK_FUNCLIM, 0, LMB_NONE}, + {"geq", LM_TK_SYM, LM_geq, LMB_RELATION}, + {"gg", LM_TK_SYM, LM_gg, LMB_RELATION}, + {"grave", LM_TK_DECORATION, LM_grave, LMB_NONE}, + {"hat", LM_TK_DECORATION, LM_hat, LMB_NONE}, + {"hbar", LM_TK_SYM, LM_hbar, LMB_NONE}, + {"heartsuit", LM_TK_SYM, LM_heartsuit, LMB_NONE}, + {"hom", LM_TK_FUNC, 0, LMB_NONE}, + {"hookleftarrow", LM_TK_SYM, LM_hookleftarrow, LMB_NONE}, + {"hookrightarrow", LM_TK_SYM, LM_hookrightarrow, LMB_NONE}, + {"imath", LM_TK_SYM, LM_imath, LMB_NONE}, + {"in", LM_TK_SYM, LM_in, LMB_RELATION}, + {"inf", LM_TK_FUNCLIM, 0, LMB_NONE}, + {"infty", LM_TK_SYM, LM_infty, LMB_NONE}, + {"int", LM_TK_BIGSYM, LM_int, LMB_NONE}, + {"iota", LM_TK_SYM, LM_iota, LMB_NONE}, + {"jmath", LM_TK_SYM, LM_jmath, LMB_NONE}, + {"kappa", LM_TK_SYM, LM_kappa, LMB_NONE}, + {"ker", LM_TK_FUNC, 0, LMB_NONE}, + {"label", LM_TK_LABEL, 0, LMB_NONE}, + {"lambda", LM_TK_SYM, LM_lambda, LMB_NONE}, + {"langle", LM_TK_SYM, LM_langle, LMB_NONE}, + {"lceil", LM_TK_SYM, LM_lceil, LMB_NONE}, + {"ldots", LM_TK_DOTS, LM_ldots, LMB_NONE}, + {"left", LM_TK_LEFT, 0, LMB_NONE}, + {"leftarrow", LM_TK_SYM, LM_leftarrow, LMB_NONE}, + {"leftharpoondown", LM_TK_SYM, LM_leftharpoondown, LMB_NONE}, + {"leftharpoonup", LM_TK_SYM, LM_leftharpoonup, LMB_NONE}, + {"leftrightarrow", LM_TK_SYM, LM_leftrightarrow, LMB_NONE}, + {"leq", LM_TK_SYM, LM_leq, LMB_RELATION}, + {"lfloor", LM_TK_SYM, LM_lfloor, LMB_NONE}, + {"lg", LM_TK_FUNC, 0, LMB_NONE}, + {"lim", LM_TK_FUNCLIM, 0, LMB_NONE}, + {"liminf", LM_TK_FUNCLIM, 0, LMB_NONE}, + {"limits", LM_TK_LIMIT, 1 , LMB_NONE}, + {"limsup", LM_TK_FUNCLIM, 0, LMB_NONE}, + {"ll", LM_TK_SYM, LM_ll, LMB_RELATION}, + {"ln", LM_TK_FUNC, 0, LMB_NONE}, + {"log", LM_TK_FUNC, 0, LMB_NONE}, + {"longleftarrow", LM_TK_SYM, LM_longleftarrow, LMB_NONE}, + {"longleftrightarrow", LM_TK_SYM, LM_longleftrightarrow, LMB_NONE}, + {"longmapsto", LM_TK_SYM, LM_longmapsto, LMB_NONE}, + {"longrightarrow", LM_TK_SYM, LM_longrightarrow, LMB_NONE}, + {"mapsto", LM_TK_SYM, LM_mapsto, LMB_NONE}, + {"mathbf", LM_TK_FONT, LM_TC_BF, LMB_NONE}, + {"mathcal", LM_TK_FONT, LM_TC_CAL, LMB_NONE}, + {"mathit", LM_TK_FONT, LM_TC_IT, LMB_NONE}, + {"mathnormal", LM_TK_FONT, LM_TC_VAR, LMB_NONE}, + {"mathrm", LM_TK_FONT, LM_TC_RM, LMB_NONE}, + {"mathsf", LM_TK_FONT, LM_TC_SF, LMB_NONE}, + {"mathtt", LM_TK_FONT, LM_TC_TT, LMB_NONE}, + {"max", LM_TK_FUNCLIM, 0, LMB_NONE}, + {"mid", LM_TK_SYM, LM_mid, LMB_RELATION}, + {"min", LM_TK_FUNCLIM, 0, LMB_NONE}, + {"models", LM_TK_SYM, LM_models, LMB_RELATION}, + {"mp", LM_TK_SYM, LM_mp, LMB_OPERATOR}, + {"mu", LM_TK_SYM, LM_mu, LMB_NONE}, + {"nabla", LM_TK_SYM, LM_nabla, LMB_NONE}, + {"natural", LM_TK_SYM, LM_natural, LMB_NONE}, + {"nearrow", LM_TK_SYM, LM_nearrow, LMB_NONE}, + {"neg", LM_TK_SYM, LM_neg, LMB_NONE}, + {"neq", LM_TK_SYM, LM_neq, LMB_RELATION}, + {"newcommand", LM_TK_NEWCOMMAND, 0 , LMB_NONE}, + {"ni", LM_TK_SYM, LM_ni, LMB_RELATION}, + {"nolimits", LM_TK_LIMIT, -1, LMB_NONE}, + {"nonumber", LM_TK_NONUM, 0, LMB_NONE}, + {"not", LM_TK_DECORATION, LM_not, LMB_NONE}, + {"notin", LM_TK_MACRO, LM_notin, LMB_RELATION}, + {"nu", LM_TK_SYM, LM_nu, LMB_NONE}, + {"nwarrow", LM_TK_SYM, LM_nwarrow, LMB_NONE}, + {"odot", LM_TK_SYM, LM_odot, LMB_OPERATOR}, + {"oint", LM_TK_BIGSYM, LM_oint, LMB_NONE}, + {"omega", LM_TK_SYM, LM_omega, LMB_NONE}, + {"ominus", LM_TK_SYM, LM_ominus, LMB_OPERATOR}, + {"oplus", LM_TK_SYM, LM_oplus, LMB_OPERATOR}, + {"oslash", LM_TK_SYM, LM_oslash, LMB_OPERATOR}, + {"otimes", LM_TK_SYM, LM_otimes, LMB_OPERATOR}, + {"overbrace", LM_TK_DECORATION, LM_overbrace, LMB_NONE}, + {"overleftarrow", LM_TK_DECORATION, LM_overleftarrow, LMB_NONE}, + {"overline", LM_TK_DECORATION, LM_overline, LMB_NONE}, + {"overrightarrow", LM_TK_DECORATION, LM_overightarrow, LMB_NONE}, + {"parallel", LM_TK_SYM, LM_parallel, LMB_RELATION}, + {"partial", LM_TK_SYM, LM_partial, LMB_NONE}, + {"perp", LM_TK_MACRO, LM_perp, LMB_RELATION}, + {"phi", LM_TK_SYM, LM_phi, LMB_NONE}, + {"pi", LM_TK_SYM, LM_pi, LMB_NONE}, + {"pm", LM_TK_SYM, LM_pm, LMB_OPERATOR}, + {"pmod", LM_TK_PMOD, 0, LMB_NONE}, + {"prec", LM_TK_SYM, LM_prec, LMB_RELATION}, + {"preceq", LM_TK_SYM, LM_preceq, LMB_RELATION}, + {"prime", LM_TK_SYM, LM_prime, LMB_NONE}, + {"prod", LM_TK_BIGSYM, LM_prod, LMB_NONE}, + {"propto", LM_TK_SYM, LM_propto, LMB_RELATION}, + {"psi", LM_TK_SYM, LM_psi, LMB_NONE}, + {"qquad", LM_TK_SPACE, LM_qquad, LMB_NONE}, + {"quad", LM_TK_SPACE, LM_quad, LMB_NONE}, + {"rangle", LM_TK_SYM, LM_rangle, LMB_NONE}, + {"rceil", LM_TK_SYM, LM_rceil, LMB_NONE}, + {"rfloor", LM_TK_SYM, LM_rfloor, LMB_NONE}, + {"rho", LM_TK_SYM, LM_rho, LMB_NONE}, + {"right", LM_TK_RIGHT, 0, LMB_NONE}, + {"rightarrow", LM_TK_SYM, LM_rightarrow, LMB_NONE}, + {"rightharpoondown", LM_TK_SYM, LM_rightharpoondown, LMB_NONE}, + {"rightharpoonup", LM_TK_SYM, LM_rightharpoonup, LMB_NONE}, + {"rightleftharpoons", LM_TK_SYM, LM_rightleftharpoons, LMB_NONE}, + {"searrow", LM_TK_SYM, LM_searrow, LMB_NONE}, + {"sec", LM_TK_FUNC, 0, LMB_NONE}, + {"setminus", LM_TK_SYM, LM_setminus, LMB_OPERATOR}, + {"sharp", LM_TK_SYM, LM_sharp, LMB_NONE}, + {"sigma", LM_TK_SYM, LM_sigma, LMB_NONE}, + {"sim", LM_TK_SYM, LM_sim, LMB_RELATION}, + {"simeq", LM_TK_SYM, LM_simeq, LMB_RELATION}, + {"sin", LM_TK_FUNC, 0, LMB_NONE}, + {"sinh", LM_TK_FUNC, 0, LMB_NONE}, + {"smile", LM_TK_SYM, LM_smile, LMB_RELATION}, + {"spadesuit", LM_TK_SYM, LM_spadesuit, LMB_NONE}, + {"sqcap", LM_TK_SYM, LM_sqcap, LMB_OPERATOR}, + {"sqcup", LM_TK_SYM, LM_sqcup, LMB_OPERATOR}, + {"sqrt", LM_TK_SQRT, 0, LMB_NONE}, + {"sqsubseteq", LM_TK_SYM, LM_sqsubseteq, LMB_RELATION}, + {"sqsupseteq", LM_TK_SYM, LM_sqsupseteq, LMB_RELATION}, + {"stackrel", LM_TK_STACK, 0, LMB_NONE}, + {"star", LM_TK_SYM, LM_star, LMB_OPERATOR}, + {"subset", LM_TK_SYM, LM_subset, LMB_RELATION}, + {"subseteq", LM_TK_SYM, LM_subseteq, LMB_RELATION}, + {"succ", LM_TK_SYM, LM_succ, LMB_RELATION}, + {"succeq", LM_TK_SYM, LM_succeq, LMB_RELATION}, + {"sum", LM_TK_BIGSYM, LM_sum, LMB_NONE}, + {"sup", LM_TK_FUNCLIM, 0, LMB_NONE}, + {"supset", LM_TK_SYM, LM_supset, LMB_RELATION}, + {"supseteq", LM_TK_SYM, LM_supseteq, LMB_RELATION}, + {"surd", LM_TK_SYM, LM_surd, LMB_NONE}, + {"swarrow", LM_TK_SYM, LM_swarrow, LMB_NONE}, + {"tan", LM_TK_FUNC, 0, LMB_NONE}, + {"tanh", LM_TK_FUNC, 0, LMB_NONE}, + {"tau", LM_TK_SYM, LM_tau, LMB_NONE}, + {"textrm", LM_TK_FONT, LM_TC_TEXTRM, LMB_NONE}, + {"theta", LM_TK_SYM, LM_theta, LMB_NONE}, + {"tilde", LM_TK_DECORATION, LM_tilde, LMB_NONE}, + {"times", LM_TK_SYM, LM_times, LMB_OPERATOR}, + {"top", LM_TK_SYM, LM_top, LMB_NONE}, + {"triangle", LM_TK_SYM, LM_triangle, LMB_NONE}, + {"triangleleft", LM_TK_SYM, LM_triangleleft, LMB_OPERATOR}, + {"triangleright", LM_TK_SYM, LM_triangleright, LMB_OPERATOR}, + {"underbrace", LM_TK_DECORATION, LM_underbrace, LMB_NONE}, + {"underline", LM_TK_DECORATION, LM_underline, LMB_NONE}, + {"uparrow", LM_TK_SYM, LM_uparrow, LMB_NONE}, + {"updownarrow", LM_TK_SYM, LM_updownarrow, LMB_NONE}, + {"uplus", LM_TK_SYM, LM_uplus, LMB_OPERATOR}, + {"upsilon", LM_TK_SYM, LM_upsilon, LMB_NONE}, + {"varepsilon", LM_TK_SYM, LM_varepsilon, LMB_NONE}, + {"varphi", LM_TK_SYM, LM_varphi, LMB_NONE}, + {"varpi", LM_TK_SYM, LM_varpi, LMB_NONE}, + {"varsigma", LM_TK_SYM, LM_varsigma, LMB_NONE}, + {"vartheta", LM_TK_SYM, LM_vartheta, LMB_NONE}, + {"vdash", LM_TK_SYM, LM_vdash, LMB_RELATION}, + {"vdots", LM_TK_DOTS, LM_vdots, LMB_NONE}, + {"vec", LM_TK_DECORATION, LM_vec, LMB_NONE}, + {"vee", LM_TK_SYM, LM_vee, LMB_OPERATOR}, + {"wedge", LM_TK_SYM, LM_wedge, LMB_OPERATOR}, + {"widehat", LM_TK_DECORATION, LM_widehat, LMB_NONE}, + {"widetilde", LM_TK_DECORATION, LM_widetilde, LMB_NONE}, + {"wp", LM_TK_SYM, LM_wp, LMB_NONE}, + {"wr", LM_TK_SYM, LM_wr, LMB_OPERATOR}, + {"xi", LM_TK_SYM, LM_xi, LMB_NONE}, + {"zeta", LM_TK_SYM, LM_zeta, LMB_NONE}, }; diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 71536cf2d5..be27ce54a5 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -639,8 +639,7 @@ void mathed_parse(MathArray & array, unsigned flags) case LM_TK_SYM: if (yylval.l->id < 256) { - MathTextCodes c = static_cast(yylval.l->id); - MathTextCodes tc = MathIsBOPS(c) ? LM_TC_BOPS : LM_TC_SYMB; + MathTextCodes tc = yylval.l->bin == LMB_NONE ? LM_TC_SYMB : LM_TC_BOPS; array.push_back(yylval.l->id, tc); } else array.push_back(new MathFuncInset(yylval.l->name)); diff --git a/src/mathed/math_parser.h b/src/mathed/math_parser.h index b46757f97c..64629e5e05 100644 --- a/src/mathed/math_parser.h +++ b/src/mathed/math_parser.h @@ -25,6 +25,7 @@ #include "LString.h" +#include "math_defs.h" #include "symbol_def.h" class MathArray; @@ -107,6 +108,8 @@ struct latexkeys { short token; /// unsigned int id; + /// + MathBinaryTypes bin; }; diff --git a/src/mathed/math_utils.C b/src/mathed/math_utils.C deleted file mode 100644 index 0773885ed0..0000000000 --- a/src/mathed/math_utils.C +++ /dev/null @@ -1,99 +0,0 @@ -/* - * File: math_utils.C - * Purpose: X independent general mathed routines - * Author: Alejandro Aguilar Sierra - * Created: August 1996 - * - * Copyright: 1996, 1997 Alejandro Aguilar Sierra - * - * License: GNU GPL version 2 or later - */ - -#include - -#include "math_defs.h" -#include "symbol_def.h" - -using std::sort; -using std::lower_bound; - -namespace { - -// This table includes all binary operators and relations -struct binary_op_pair { - short id; - short isrel; -}; - - -binary_op_pair binary_op_table[] = { - { LM_leq, LMB_RELATION }, { LM_geq, LMB_RELATION }, - { LM_equiv, LMB_RELATION }, { LM_models, LMB_RELATION }, - { LM_prec, LMB_RELATION }, { LM_succ, LMB_RELATION }, - { LM_sim, LMB_RELATION }, { LM_perp, LMB_RELATION }, - { LM_preceq, LMB_RELATION }, { LM_succeq, LMB_RELATION }, - { LM_simeq, LMB_RELATION }, { LM_mid, LMB_RELATION }, - { LM_ll, LMB_RELATION }, { LM_gg, LMB_RELATION }, - { LM_asymp, LMB_RELATION }, { LM_parallel, LMB_RELATION }, - { LM_subset, LMB_RELATION }, { LM_supset, LMB_RELATION }, - { LM_approx, LMB_RELATION }, { LM_smile, LMB_RELATION }, - { LM_subseteq, LMB_RELATION }, { LM_supseteq, LMB_RELATION }, - { LM_cong, LMB_RELATION }, { LM_frown, LMB_RELATION }, - { LM_sqsubseteq, LMB_RELATION }, { LM_sqsupseteq, LMB_RELATION }, - { LM_doteq, LMB_RELATION }, { LM_neq, LMB_RELATION }, - { LM_in, LMB_RELATION }, { LM_ni, LMB_RELATION }, - { LM_propto, LMB_RELATION }, { LM_notin, LMB_RELATION }, - { LM_vdash, LMB_RELATION }, { LM_dashv, LMB_RELATION }, - { LM_bowtie, LMB_RELATION }, - { LM_pm, LMB_OPERATOR }, { LM_cap, LMB_OPERATOR }, - { LM_diamond, LMB_OPERATOR }, { LM_oplus, LMB_OPERATOR }, - { LM_mp, LMB_OPERATOR }, { LM_cup, LMB_OPERATOR }, - { LM_bigtriangleup, LMB_OPERATOR }, { LM_ominus, LMB_OPERATOR }, - { LM_times, LMB_OPERATOR }, { LM_uplus, LMB_OPERATOR }, - { LM_bigtriangledown, LMB_OPERATOR }, { LM_otimes, LMB_OPERATOR }, - { LM_div, LMB_OPERATOR }, { LM_sqcap, LMB_OPERATOR }, - { LM_triangleright, LMB_OPERATOR }, { LM_oslash, LMB_OPERATOR }, - { LM_cdot, LMB_OPERATOR }, { LM_sqcup, LMB_OPERATOR }, - { LM_triangleleft, LMB_OPERATOR }, { LM_odot, LMB_OPERATOR }, - { LM_star, LMB_OPERATOR }, { LM_vee, LMB_OPERATOR }, - { LM_amalg, LMB_OPERATOR }, { LM_bigcirc, LMB_OPERATOR }, - { LM_setminus, LMB_OPERATOR }, { LM_wedge, LMB_OPERATOR }, - { LM_dagger, LMB_OPERATOR }, { LM_circ, LMB_OPERATOR }, - { LM_bullet, LMB_OPERATOR }, { LM_wr, LMB_OPERATOR }, - { LM_ddagger, LMB_OPERATOR } -}; - - -struct comparator { - // used by sort and lower_bound - inline - int operator()(binary_op_pair const & a, binary_op_pair const & b) const - { - return a.id < b.id; - } -}; - -} // namespace anon - - -int MathLookupBOP(short id) -{ - static int const bopCount = - sizeof(binary_op_table) / sizeof(binary_op_pair); - static bool issorted = false; - - if (!issorted) { - sort(binary_op_table, binary_op_table + bopCount, comparator()); - issorted = true; - } - - binary_op_pair search_elem = { id, 0 }; - - binary_op_pair * res = lower_bound(binary_op_table, - binary_op_table + bopCount, - search_elem, comparator()); - if (res != binary_op_table + bopCount && res->id == id) - return res->isrel; - else - return LMB_NONE; -} diff --git a/src/mathed/math_utils.h b/src/mathed/math_utils.h deleted file mode 100644 index 2895ce17fc..0000000000 --- a/src/mathed/math_utils.h +++ /dev/null @@ -1,8 +0,0 @@ -// -*- C++ -*- - -#ifndef MATHUTILS_H -#define MATHUTILS_H - -int MathLookupBOP(short id); - -#endif diff --git a/src/mathed/support.C b/src/mathed/support.C index 360ccf6211..18c4f41161 100644 --- a/src/mathed/support.C +++ b/src/mathed/support.C @@ -9,7 +9,6 @@ #include "math_parser.h" #include "Painter.h" #include "debug.h" -#include "math_utils.h" using std::sort; using std::lower_bound; @@ -29,12 +28,6 @@ bool MathIsAlphaFont(MathTextCodes x) } -bool MathIsBOPS(MathTextCodes x) -{ - return MathLookupBOP(x) != LMB_NONE; -} - - bool MathIsBinary(MathTextCodes x) { return x == LM_TC_BOP || x == LM_TC_BOPS; diff --git a/src/mathed/support.h b/src/mathed/support.h index 73282c194f..75963dd38f 100644 --- a/src/mathed/support.h +++ b/src/mathed/support.h @@ -29,7 +29,6 @@ int mathed_string_width(MathTextCodes type, MathStyles size, string const & s); bool MathIsInset(MathTextCodes x); bool MathIsAlphaFont(MathTextCodes x); -bool MathIsBOPS(MathTextCodes x); bool MathIsSymbol(MathTextCodes x); bool MathIsRelOp(unsigned char c, MathTextCodes f);