2001-03-16 12:08:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file MathsSymbols.C
|
|
|
|
|
* Copyright 2001 the LyX Team
|
|
|
|
|
* Read the file COPYING
|
|
|
|
|
*
|
|
|
|
|
* \author Alejandro Aguilar Sierra
|
2002-03-11 17:00:41 +00:00
|
|
|
|
* \author John Levon, moz@compsoc.man.ac.uk
|
2001-03-16 12:08:14 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
#include <algorithm>
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2001-03-16 12:08:14 +00:00
|
|
|
|
#include XPM_H_LOCATION
|
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma implementation
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
#include "support/LAssert.h"
|
2001-07-29 17:39:01 +00:00
|
|
|
|
#include "support/lstrings.h"
|
2001-03-16 12:08:14 +00:00
|
|
|
|
#include "debug.h"
|
|
|
|
|
#include "MathsSymbols.h"
|
2002-03-27 12:04:55 +00:00
|
|
|
|
#include "GUIRunTime.h"
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2001-03-16 12:08:14 +00:00
|
|
|
|
using std::max;
|
|
|
|
|
using std::endl;
|
|
|
|
|
using std::ostream;
|
|
|
|
|
|
2001-06-01 10:53:24 +00:00
|
|
|
|
#ifndef CXX_GLOBAL_CSTD
|
|
|
|
|
using std::strstr;
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-03-16 12:08:14 +00:00
|
|
|
|
/* Latex code for those bitmaps */
|
|
|
|
|
|
2001-03-19 15:38:22 +00:00
|
|
|
|
#include "greek.xbm"
|
|
|
|
|
#include "arrows.xbm"
|
|
|
|
|
#include "brel.xbm"
|
|
|
|
|
#include "bop.xbm"
|
|
|
|
|
#include "misc.xbm"
|
|
|
|
|
#include "varsz.xbm"
|
|
|
|
|
#include "dots.xbm"
|
2002-01-18 12:18:20 +00:00
|
|
|
|
|
|
|
|
|
#include "ams_misc.xbm"
|
|
|
|
|
#include "ams_arrows.xbm"
|
|
|
|
|
#include "ams_rel.xbm"
|
|
|
|
|
#include "ams_nrel.xbm"
|
|
|
|
|
#include "ams_ops.xbm"
|
|
|
|
|
|
2001-03-19 15:38:22 +00:00
|
|
|
|
#include "mathed/math_parser.h"
|
|
|
|
|
#include "frac.xpm"
|
2002-01-03 16:17:16 +00:00
|
|
|
|
#include "sub.xpm"
|
|
|
|
|
#include "super.xpm"
|
2002-01-09 14:40:34 +00:00
|
|
|
|
#include "style.xpm"
|
2001-03-19 15:38:22 +00:00
|
|
|
|
#include "sqrt.xpm"
|
|
|
|
|
#include "delim.xbm"
|
|
|
|
|
#include "delim.xpm"
|
|
|
|
|
#include "deco.xbm"
|
|
|
|
|
#include "deco.xpm"
|
|
|
|
|
#include "space.xpm"
|
|
|
|
|
#include "matrix.xpm"
|
|
|
|
|
#include "equation.xpm"
|
|
|
|
|
|
|
|
|
|
char const * function_names[] = {
|
|
|
|
|
"arccos", "arcsin", "arctan", "arg", "bmod",
|
|
|
|
|
"cos", "cosh", "cot", "coth", "csc", "deg",
|
|
|
|
|
"det", "dim", "exp", "gcd", "hom", "inf", "ker",
|
|
|
|
|
"lg", "lim", "liminf", "limsup", "ln", "log",
|
|
|
|
|
"max", "min", "sec", "sin", "sinh", "sup",
|
|
|
|
|
"tan", "tanh"
|
2001-03-16 12:08:14 +00:00
|
|
|
|
};
|
|
|
|
|
|
2002-03-21 16:59:12 +00:00
|
|
|
|
int const nr_function_names = sizeof(function_names) / sizeof(char const *);
|
2001-03-19 15:38:22 +00:00
|
|
|
|
|
2001-03-16 12:08:14 +00:00
|
|
|
|
char const * latex_arrow[] = {
|
|
|
|
|
"downarrow", "leftarrow", "Downarrow", "Leftarrow",
|
|
|
|
|
"hookleftarrow", "rightarrow", "uparrow", "Rightarrow", "Uparrow",
|
|
|
|
|
"hookrightarrow", "updownarrow", "Leftrightarrow", "leftharpoonup",
|
|
|
|
|
"rightharpoonup", "rightleftharpoons", "leftrightarrow", "Updownarrow",
|
|
|
|
|
"leftharpoondown", "rightharpoondown", "mapsto",
|
|
|
|
|
"Longleftarrow", "Longrightarrow", "Longleftrightarrow",
|
|
|
|
|
"longleftrightarrow", "longleftarrow", "longrightarrow", "longmapsto",
|
|
|
|
|
"nwarrow", "nearrow", "swarrow", "searrow", "",
|
|
|
|
|
};
|
|
|
|
|
|
2001-03-19 15:38:22 +00:00
|
|
|
|
int const nr_latex_arrow = sizeof(latex_arrow) / sizeof(char const *);
|
2001-03-16 12:08:14 +00:00
|
|
|
|
|
|
|
|
|
char const * latex_bop[] = {
|
|
|
|
|
"pm", "cap", "diamond", "oplus",
|
|
|
|
|
"mp", "cup", "bigtriangleup", "ominus",
|
|
|
|
|
"times", "uplus", "bigtriangledown", "otimes",
|
|
|
|
|
"div", "sqcap", "triangleright", "oslash",
|
|
|
|
|
"cdot", "sqcup", "triangleleft", "odot",
|
|
|
|
|
"star", "vee", "amalg", "bigcirc",
|
|
|
|
|
"setminus", "wedge", "dagger", "circ",
|
|
|
|
|
"bullet", "wr", "ddagger", ""
|
|
|
|
|
};
|
|
|
|
|
|
2001-03-19 15:38:22 +00:00
|
|
|
|
int const nr_latex_bop = sizeof(latex_bop) / sizeof(char const *);
|
|
|
|
|
|
|
|
|
|
char const * latex_brel[] = {
|
|
|
|
|
"leq", "geq", "equiv", "models",
|
|
|
|
|
"prec", "succ", "sim", "perp",
|
|
|
|
|
"preceq", "succeq", "simeq", "mid",
|
|
|
|
|
"ll", "gg", "asymp", "parallel",
|
|
|
|
|
"subset", "supset", "approx", "smile",
|
|
|
|
|
"subseteq", "supseteq", "cong", "frown",
|
|
|
|
|
"sqsubseteq", "sqsupseteq", "doteq", "neq",
|
|
|
|
|
"in", "ni", "propto", "notin",
|
|
|
|
|
"vdash", "dashv", "bowtie", ""
|
2001-03-16 12:08:14 +00:00
|
|
|
|
};
|
|
|
|
|
|
2001-03-19 15:38:22 +00:00
|
|
|
|
int const nr_latex_brel = sizeof(latex_brel) / sizeof(char const *);
|
|
|
|
|
|
2001-03-16 12:08:14 +00:00
|
|
|
|
char const * latex_dots[] = {
|
|
|
|
|
"ldots", "cdots", "vdots", "ddots"
|
|
|
|
|
};
|
|
|
|
|
|
2001-03-19 15:38:22 +00:00
|
|
|
|
int const nr_latex_dots = sizeof(latex_dots) / sizeof(char const *);
|
2001-03-16 12:08:14 +00:00
|
|
|
|
|
2001-03-19 15:38:22 +00:00
|
|
|
|
char const * latex_greek[] = {
|
|
|
|
|
"Gamma", "Delta", "Theta", "Lambda", "Xi", "Pi",
|
|
|
|
|
"Sigma", "Upsilon", "Phi", "Psi", "Omega",
|
|
|
|
|
"alpha", "beta", "gamma", "delta", "epsilon", "varepsilon", "zeta",
|
|
|
|
|
"eta", "theta", "vartheta", "iota", "kappa", "lambda", "mu",
|
|
|
|
|
"nu", "xi", "pi", "varpi", "rho", "sigma", "varsigma",
|
|
|
|
|
"tau", "upsilon", "phi", "varphi", "chi", "psi", "omega", ""
|
|
|
|
|
};
|
2001-03-16 12:08:14 +00:00
|
|
|
|
|
2001-03-19 15:38:22 +00:00
|
|
|
|
int const nr_latex_greek = sizeof(latex_greek) / sizeof(char const *);
|
2001-03-16 12:08:14 +00:00
|
|
|
|
|
2001-03-19 15:38:22 +00:00
|
|
|
|
char const * latex_misc[] = {
|
|
|
|
|
"nabla", "partial", "infty", "prime", "ell",
|
|
|
|
|
"emptyset", "exists", "forall", "imath", "jmath",
|
|
|
|
|
"Re", "Im", "aleph", "wp", "hbar",
|
|
|
|
|
"angle", "top", "bot", "Vert", "neg",
|
|
|
|
|
"flat", "natural", "sharp", "surd", "triangle",
|
2002-03-21 21:21:28 +00:00
|
|
|
|
"diamondsuit", "heartsuit", "clubsuit", "spadesuit",
|
|
|
|
|
"textrm <20>", "textrm <20>", "mathcircumflex", "_",
|
2002-03-04 11:10:26 +00:00
|
|
|
|
"mathrm T",
|
2002-03-21 21:21:28 +00:00
|
|
|
|
"mathbb N", "mathbb Z", "mathbb Q",
|
2002-01-15 15:31:19 +00:00
|
|
|
|
"mathbb R", "mathbb C", "mathbb H",
|
2002-03-21 21:21:28 +00:00
|
|
|
|
"mathcal F", "mathcal L",
|
2002-03-04 11:10:26 +00:00
|
|
|
|
"mathcal H", "mathcal O", ""
|
2001-03-19 15:38:22 +00:00
|
|
|
|
};
|
2001-03-16 12:08:14 +00:00
|
|
|
|
|
2001-03-19 15:38:22 +00:00
|
|
|
|
int const nr_latex_misc = sizeof(latex_misc) / sizeof(char const *);
|
2001-03-16 12:08:14 +00:00
|
|
|
|
|
2001-03-19 15:38:22 +00:00
|
|
|
|
char const * latex_varsz[] = {
|
|
|
|
|
"sum", "int", "oint",
|
|
|
|
|
"prod", "coprod", "bigsqcup",
|
|
|
|
|
"bigotimes", "bigodot", "bigoplus",
|
|
|
|
|
"bigcap", "bigcup", "biguplus",
|
|
|
|
|
"bigvee", "bigwedge", ""
|
|
|
|
|
};
|
2001-03-16 12:08:14 +00:00
|
|
|
|
|
2001-03-19 15:38:22 +00:00
|
|
|
|
int const nr_latex_varsz = sizeof(latex_varsz) / sizeof(char const *);
|
2001-03-16 12:08:14 +00:00
|
|
|
|
|
2002-01-18 12:18:20 +00:00
|
|
|
|
char const * latex_ams_misc[] = {
|
|
|
|
|
"digamma", "varkappa", "beth", "daleth", "gimel",
|
|
|
|
|
"ulcorner", "urcorner", "llcorner", "lrcorner",
|
|
|
|
|
"hbar", "hslash", "vartriangle",
|
|
|
|
|
"triangledown", "square", "lozenge",
|
|
|
|
|
"circledS", "angle", "measuredangle",
|
|
|
|
|
"nexists", "mho", "Finv",
|
|
|
|
|
"Game", "Bbbk", "backprime",
|
|
|
|
|
"varnothing", "blacktriangle", "blacktriangledown",
|
|
|
|
|
"blacksquare", "blacklozenge", "bigstar",
|
|
|
|
|
"sphericalangle", "complement", "eth",
|
|
|
|
|
"diagup", "diagdown", ""
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int const nr_latex_ams_misc = sizeof(latex_ams_misc) / sizeof(char const *);
|
|
|
|
|
|
|
|
|
|
char const * latex_ams_arrows[] = {
|
|
|
|
|
"dashrightarrow", "dashleftarrow", "leftleftarrows",
|
|
|
|
|
"leftrightarrows", "Lleftarrow", "twoheadleftarrow",
|
|
|
|
|
"leftarrowtail", "looparrowleft", "leftrightharpoons",
|
|
|
|
|
"curvearrowleft", "circlearrowleft", "Lsh",
|
|
|
|
|
"upuparrows", "upharpoonleft", "downharpoonleft",
|
|
|
|
|
"multimap", "leftrightsquigarrow", "rightrightarrows",
|
|
|
|
|
"rightleftarrows", "rightrightarrows", "rightleftarrows",
|
|
|
|
|
"twoheadrightarrow", "rightarrowtail", "looparrowright",
|
|
|
|
|
"rightleftharpoons", "curvearrowright", "circlearrowright",
|
2002-03-21 21:21:28 +00:00
|
|
|
|
"Rsh", "downdownarrows", "upharpoonright",
|
2002-01-18 12:18:20 +00:00
|
|
|
|
"downharpoonright", "rightsquigarrow",
|
|
|
|
|
"nleftarrow", "nrightarrow", "nLeftarrow",
|
|
|
|
|
"nRightarrow", "nleftrightarrow", "nLeftrightarrow"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int const nr_latex_ams_arrows = sizeof(latex_ams_arrows) / sizeof(char const *);
|
|
|
|
|
|
|
|
|
|
char const * latex_ams_rel[] = {
|
2002-01-28 14:36:39 +00:00
|
|
|
|
"leqq", "leqslant", "eqslantless", "eqslantgtr", "gtrsim", "gtrapprox",
|
|
|
|
|
"lesssim", "lessapprox", "approxeq", "gtrdot", "ggg", "gtrless",
|
|
|
|
|
"lessdot", "lll", "lessgtr", "gtreqless", "gtreqqless", "eqcirc",
|
|
|
|
|
"lesseqgtr", "lesseqqgtr", "doteqdot", "circeq", "triangleq", "thicksim",
|
|
|
|
|
"risingdotseq", "fallingdotseq", "backsim", "thickapprox", "supseteqq", "Supset",
|
|
|
|
|
"backsimeq", "subseteqq", "Subset","sqsupset", "succcurlyeq", "curlyeqsucc",
|
|
|
|
|
"sqsubset", "preccurlyeq", "curlyeqprec", "succsim", "succapprox", "vartriangleright",
|
|
|
|
|
"precsim", "precapprox", "vartriangleleft", "trianglerighteq", "Vdash", "shortmid",
|
|
|
|
|
"trianglelefteq", "vDash", "Vvdash", "shortparallel", "between", "pitchfork",
|
|
|
|
|
"smallsmile", "smallfrown", "bumpeq", "varpropto", "blacktriangleleft", "therefore",
|
|
|
|
|
"Bumpeq", "geqq", "geqslant", "backepsilon", "blacktriangleright", "because"
|
2002-01-18 12:18:20 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int const nr_latex_ams_rel = sizeof(latex_ams_rel) / sizeof(char const *);
|
|
|
|
|
|
|
|
|
|
char const * latex_ams_nrel[] = {
|
2002-01-28 14:36:39 +00:00
|
|
|
|
"nless", "nleq", "nleqslant", "ngeqslant", "ngeqq", "gneq",
|
|
|
|
|
"nleqq", "lneq", "lneqq","gneqq", "gverteqq", "gnsim",
|
|
|
|
|
"lvertneqq", "lnsim", "lnapprox", "gnapprox", "nsucc", "nsucceq",
|
|
|
|
|
"nprec", "npreceq", "precnsim","succnsim", "succnapprox", "ncong",
|
|
|
|
|
"precnapprox", "nsim", "nshortmid", "nshortparallel", "nparallel", "nvDash",
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2002-01-28 14:36:39 +00:00
|
|
|
|
"nmid", "nvdash", "nvDash","nVDash", "ntriangleright", "ntrianglerighteq",
|
|
|
|
|
"ntriangleleft", "ntrianglelefteq", "nsubseteq", "nsupseteq", "nsupseteqq", "supsetneq",
|
|
|
|
|
"subsetneq", "varsubsetneq", "subsetneqq", "varsupsetneq", "supsetneqq", "varsupsetneqq",
|
|
|
|
|
"varsubsetneqq", "ngtr", "ngeq","", "", ""
|
2002-01-18 12:18:20 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int const nr_latex_ams_nrel = sizeof(latex_ams_nrel) / sizeof(char const *);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char const * latex_ams_ops[] = {
|
|
|
|
|
"dotplus", "smallsetminus", "Cap",
|
|
|
|
|
"Cup", "barwedge", "veebar",
|
|
|
|
|
"doublebarwedge", "boxminus", "boxtimes",
|
|
|
|
|
"boxdot", "boxplus", "divideontimes",
|
|
|
|
|
"ltimes", "rtimes", "leftthreetimes",
|
|
|
|
|
"rightthreetimes", "curlywedge", "curlyvee",
|
|
|
|
|
"circleddash", "circledast", "circledcirc",
|
|
|
|
|
"centerdot", "intercal", ""
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int const nr_latex_ams_ops = sizeof(latex_ams_ops) / sizeof(char const *);
|
|
|
|
|
|
2001-03-16 12:08:14 +00:00
|
|
|
|
static char const ** mathed_get_pixmap_from_icon(int d)
|
|
|
|
|
{
|
|
|
|
|
switch (d) {
|
2002-03-21 16:59:12 +00:00
|
|
|
|
case MM_FRAC: return frac;
|
|
|
|
|
case MM_SQRT: return sqrt_xpm;
|
|
|
|
|
case MM_SUPER: return super_xpm;
|
|
|
|
|
case MM_SUB: return sub_xpm;
|
|
|
|
|
case MM_STYLE: return style_xpm;
|
|
|
|
|
case MM_DELIM: return delim;
|
|
|
|
|
case MM_MATRIX: return matrix;
|
|
|
|
|
case MM_EQU: return equation;
|
|
|
|
|
case MM_DECO: return deco;
|
|
|
|
|
case MM_SPACE: return space_xpm;
|
|
|
|
|
default: return 0;
|
2001-03-16 12:08:14 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2001-03-16 12:08:14 +00:00
|
|
|
|
static char const ** pixmapFromBitmapData(char const * s, int wx, int hx)
|
|
|
|
|
{
|
|
|
|
|
char const ** data = 0;
|
|
|
|
|
|
|
|
|
|
int id = -1;
|
|
|
|
|
|
|
|
|
|
int i = 0;
|
2002-01-18 12:18:20 +00:00
|
|
|
|
for (; i < 11; ++i) {
|
2001-03-16 12:08:14 +00:00
|
|
|
|
char const ** latex_str = 0;
|
|
|
|
|
switch (i) {
|
|
|
|
|
case 0: latex_str = latex_greek; break;
|
|
|
|
|
case 1: latex_str = latex_bop; break;
|
|
|
|
|
case 2: latex_str = latex_brel; break;
|
|
|
|
|
case 3: latex_str = latex_arrow; break;
|
|
|
|
|
case 4: latex_str = latex_varsz; break;
|
|
|
|
|
case 5: latex_str = latex_misc; break;
|
2002-01-18 12:18:20 +00:00
|
|
|
|
case 6: latex_str = latex_ams_misc; break;
|
|
|
|
|
case 7: latex_str = latex_ams_arrows; break;
|
|
|
|
|
case 8: latex_str = latex_ams_rel; break;
|
|
|
|
|
case 9: latex_str = latex_ams_nrel; break;
|
|
|
|
|
case 10: latex_str = latex_ams_ops; break;
|
2002-03-21 16:59:12 +00:00
|
|
|
|
// Add AMS stuff here -- MV
|
2001-03-16 12:08:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int k = 0; latex_str[k][0] > ' '; ++k) {
|
|
|
|
|
if (compare(latex_str[k], s) == 0) {
|
|
|
|
|
id = k;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (id >= 0) break;
|
|
|
|
|
}
|
2002-01-18 12:18:20 +00:00
|
|
|
|
if (i < 11 && id >= 0) {
|
2001-03-16 12:08:14 +00:00
|
|
|
|
unsigned char const * bdata = 0;
|
|
|
|
|
int w = 0;
|
|
|
|
|
int h = 0;
|
|
|
|
|
int dw = 0;
|
|
|
|
|
int dh = 0;
|
|
|
|
|
|
2002-01-18 12:18:20 +00:00
|
|
|
|
lyxerr [Debug::MATHED] << "Imando " << i << ", " << id << endl;
|
2001-03-16 12:08:14 +00:00
|
|
|
|
switch (i) {
|
|
|
|
|
case 0:
|
|
|
|
|
if (id <= 10) {
|
|
|
|
|
w = Greek_width;
|
|
|
|
|
h = Greek_height;
|
|
|
|
|
bdata = Greek_bits;
|
|
|
|
|
dw = 6;
|
|
|
|
|
dh = 2;
|
|
|
|
|
} else {
|
|
|
|
|
w = greek_width;
|
|
|
|
|
h = greek_height;
|
|
|
|
|
bdata = greek_bits;
|
|
|
|
|
dw = 7;
|
|
|
|
|
dh = 4;
|
|
|
|
|
id -= 11;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
w = bop_width;
|
|
|
|
|
h = bop_height;
|
|
|
|
|
bdata = bop_bits;
|
|
|
|
|
dw = 4;
|
|
|
|
|
dh = 8;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
w = brel_width;
|
|
|
|
|
h = brel_height;
|
|
|
|
|
bdata = brel_bits;
|
|
|
|
|
dw = 4;
|
|
|
|
|
dh = 9;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
if (id < 20) {
|
|
|
|
|
w = arrow_width;
|
|
|
|
|
h = arrow_height;
|
|
|
|
|
bdata = arrow_bits;
|
|
|
|
|
dw = 5;
|
|
|
|
|
dh = 4;
|
|
|
|
|
} else if (id > 28) {
|
|
|
|
|
w = darrow_width;
|
|
|
|
|
h = darrow_height;
|
|
|
|
|
bdata = darrow_bits;
|
|
|
|
|
dw = 2;
|
|
|
|
|
dh = 2;
|
|
|
|
|
id -= 29;
|
|
|
|
|
} else {
|
|
|
|
|
w = larrow_width;
|
|
|
|
|
h = larrow_height;
|
|
|
|
|
bdata = larrow_bits;
|
|
|
|
|
dw = 2;
|
|
|
|
|
dh = 4;
|
|
|
|
|
id -= 20;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
w = varsz_width;
|
|
|
|
|
h = varsz_height;
|
|
|
|
|
bdata = varsz_bits;
|
|
|
|
|
dw = 3;
|
|
|
|
|
dh = 5;
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
2002-01-15 15:31:19 +00:00
|
|
|
|
if (id < 29) {
|
|
|
|
|
w = misc_width;
|
|
|
|
|
h = misc_height;
|
|
|
|
|
bdata = misc_bits;
|
|
|
|
|
dw = 5;
|
|
|
|
|
dh = 6;
|
|
|
|
|
} else if (id > 36) {
|
|
|
|
|
w = misc3_width;
|
|
|
|
|
h = misc3_height;
|
|
|
|
|
bdata = misc3_bits;
|
|
|
|
|
dw = 3;
|
|
|
|
|
dh = 2;
|
|
|
|
|
id -= 37;
|
|
|
|
|
} else {
|
|
|
|
|
w = misc2_width;
|
|
|
|
|
h = misc2_height;
|
|
|
|
|
bdata = misc2_bits;
|
|
|
|
|
dw = 2;
|
|
|
|
|
dh = 2;
|
|
|
|
|
id -= 29;
|
|
|
|
|
}
|
2001-03-16 12:08:14 +00:00
|
|
|
|
break;
|
2002-01-18 12:18:20 +00:00
|
|
|
|
case 7:
|
|
|
|
|
case 8:
|
|
|
|
|
case 9:
|
|
|
|
|
case 10:
|
|
|
|
|
// to be added -- MV
|
|
|
|
|
break;
|
2001-03-16 12:08:14 +00:00
|
|
|
|
}
|
|
|
|
|
int ww = w / dw;
|
|
|
|
|
int hh = h / dh;
|
2002-03-27 12:04:55 +00:00
|
|
|
|
XImage * xima = XCreateImage(GUIRunTime::x11Display(), 0, 1, XYBitmap, 0,
|
2001-03-16 12:08:14 +00:00
|
|
|
|
const_cast<char*>(reinterpret_cast<char const *>(bdata)), w, h, 8, 0);
|
|
|
|
|
xima->byte_order = LSBFirst;
|
|
|
|
|
xima->bitmap_bit_order = LSBFirst;
|
|
|
|
|
int x = (id % dw) * ww;
|
|
|
|
|
int y = (id/dw) * hh;
|
|
|
|
|
if (ww > wx) ww = wx;
|
|
|
|
|
if (hh > hx) hh = hx;
|
|
|
|
|
XImage * sbima = XSubImage(xima, x, y, ww, hh);
|
2002-03-27 12:04:55 +00:00
|
|
|
|
XpmCreateDataFromImage(GUIRunTime::x11Display(), const_cast<char***>(&data), sbima, sbima, 0);
|
2001-03-16 12:08:14 +00:00
|
|
|
|
|
|
|
|
|
// Dirty hack to get blue symbols quickly
|
2001-06-01 10:53:24 +00:00
|
|
|
|
char * sx = const_cast<char*>(strstr(data[2], "FFFFFFFF"));
|
2001-03-16 12:08:14 +00:00
|
|
|
|
if (sx) {
|
|
|
|
|
for (int k = 0; k < 8; ++k) sx[k] = '0';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// XDestroyImage(xima);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2001-03-16 12:08:14 +00:00
|
|
|
|
char const ** get_pixmap_from_symbol(char const * arg, int wx, int hx)
|
|
|
|
|
{
|
2001-04-25 15:43:57 +00:00
|
|
|
|
lyx::Assert(arg);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
|
2001-03-16 12:08:14 +00:00
|
|
|
|
char const ** data = 0;
|
2001-04-25 15:43:57 +00:00
|
|
|
|
latexkeys const * l = in_word_set(arg);
|
2001-03-16 12:08:14 +00:00
|
|
|
|
if (!l)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
switch (l->token) {
|
|
|
|
|
case LM_TK_FRAC:
|
|
|
|
|
data = mathed_get_pixmap_from_icon(MM_FRAC);
|
|
|
|
|
break;
|
|
|
|
|
case LM_TK_SQRT:
|
|
|
|
|
data = mathed_get_pixmap_from_icon(MM_SQRT);
|
|
|
|
|
break;
|
|
|
|
|
case LM_TK_SYM:
|
2001-08-31 21:15:57 +00:00
|
|
|
|
case LM_TK_CMR:
|
|
|
|
|
case LM_TK_CMSY:
|
|
|
|
|
case LM_TK_CMEX:
|
|
|
|
|
case LM_TK_CMM:
|
|
|
|
|
case LM_TK_MSA:
|
|
|
|
|
case LM_TK_MSB:
|
2001-03-16 12:08:14 +00:00
|
|
|
|
// I have to use directly the bitmap data since the
|
|
|
|
|
// bitmap tables are not yet created when this
|
|
|
|
|
// function is called.
|
|
|
|
|
data = pixmapFromBitmapData(arg, wx, hx);
|
|
|
|
|
break;
|
2002-01-13 17:50:57 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
2001-03-16 12:08:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
}
|