#include "formulamacro.h"
#include "commandtags.h"
#include "math_cursor.h"
-#include "math_parser.h"
#include "BufferView.h"
#include "lyxtext.h"
#include "lyxfunc.h"
break;
case LFUN_MATH_SIZE:
+#if 0
if (!arg.empty()) {
bv->lockedInsetStoreUndo(Undo::INSERT);
- latexkeys const * l = in_word_set(arg);
- mathcursor->setSize(MathStyles(l ? l->id : static_cast<unsigned int>(-1)));
+ mathcursor->setSize(arg);
updateLocal(bv, true);
}
+#endif
break;
case LFUN_INSERT_MATRIX:
{
return nucleus();
}
-
-/*
-void MathAtom::userSetSize(MathStyles sz)
-{
- if (sz >= 0) {
- size_ = sz;
- flag = flag & ~LMPF_FIXED_SIZE;
- }
-}
-*/
size, and type, of the nucleus they are attached to.
Jules
+
+--
+
+Ok: Implementing it thusly is not feasible since cursor movement gets
+hackish. We use MathAtom only as a wrapper around MathInset * with value
+semantics.
+
+Andre'
+
*/
class MathInset;
#include "math_scriptinset.h"
#include "math_spaceinset.h"
#include "math_specialcharinset.h"
-#include "math_parser.h"
#define FILEDEBUG 0
}
-void MathCursor::setSize(MathStyles size)
-{
- par()->userSetSize(size);
-}
-
-
void MathCursor::macroModeClose()
{
string s = macroName();
void MathCursor::interpret(string const & s)
{
//lyxerr << "interpret 1: '" << s << "'\n";
- //lyxerr << "in: " << in_word_set(s) << " \n";
-
if (s.empty())
return;
///
void interpret(char);
///
- void setSize(MathStyles);
- ///
bool toggleLimits();
///
// Macro mode methods
if (s.size() == 2 && s[0] == '#' && s[1] >= '1' && s[1] <= '9')
return MathAtom(new MathMacroArgument(s[1] - '0'));
- if (s.size() == 3 && s[0] == '\\' && s[1] == '#' && s[2] >= '1' && s[2] <= '9')
+ if (s.size() == 3 && s[0] == '\\' && s[1] == '#'
+ && s[2] >= '1' && s[2] <= '9')
return MathAtom(new MathMacroArgument(s[2] - '0'));
latexkeys const * l = in_word_set(s);
if (MathMacroTable::has(s))
return MathAtom(new MathMacro(s));
+ //cerr << "creating inset 2 with name: '" << s << "'\n";
return MathAtom(new MathFuncInset(s));
}
namespace {
-struct latexkeys_a {
+std::map<string, latexkeys> theWordList;
+
+
+struct key_type {
///
char const * name;
///
unsigned int id;
};
-latexkeys_a wordlist_array[] =
+key_type wordlist_array[] =
{
{"!", LM_TK_SPACE, 0},
{"#", LM_TK_SPECIAL, '#'},
};
-std::map<string, latexkeys> wordlist;
-
-
MathTokenEnum tokenEnum(const string & font)
{
}
-} // namespace anon
-
-
-void ReadSymbols(string const & filename)
+void readSymbols(string const & filename)
{
LyXLex lex(0, 0);
lex.setFile(filename);
tmp.id = lex.getInteger();
if (lex.next())
tmp.type = symbolType(lex.getString());
- if (wordlist.find(tmp.name) != wordlist.end())
- lyxerr << "ReadSymbols: token " << tmp.name
+ if (theWordList.find(tmp.name) != theWordList.end())
+ lyxerr << "readSymbols: token " << tmp.name
<< " already exists.\n";
else
- wordlist[tmp.name] = tmp;
+ theWordList[tmp.name] = tmp;
}
}
-
void initSymbols()
{
unsigned const n = sizeof(wordlist_array) / sizeof(wordlist_array[0]);
- for (latexkeys_a * p = wordlist_array; p != wordlist_array + n; ++p) {
+ for (key_type * p = wordlist_array; p != wordlist_array + n; ++p) {
latexkeys tmp;
tmp.name = p->name;
tmp.token = p->token;
tmp.id = p->id;
tmp.type = LMB_NONE;
tmp.latex_font_id = 0;
- wordlist[p->name] = tmp;
+ theWordList[p->name] = tmp;
}
- lyxerr[Debug::MATHED] << "Reading symbols file\n";
+ lyxerr[Debug::MATHED] << "reading symbols file\n";
string const file = LibFileSearch(string(), "symbols");
if (file.empty())
lyxerr << "Could not find symbols file\n";
else
- ReadSymbols(file);
+ readSymbols(file);
}
+} // namespace anon
+
+
latexkeys const * in_word_set(string const & str)
{
static bool initialized = false;
initialized = true;
}
- std::map<string, latexkeys>::iterator it = wordlist.find(str);
- return (it != wordlist.end()) ? &(it->second) : 0;
+ std::map<string, latexkeys>::iterator it = theWordList.find(str);
+ return (it != theWordList.end()) ? &(it->second) : 0;
}
}
-/*
-void MathInset::userSetSize(MathStyles sz)
-{
- if (sz >= 0) {
- size_ = sz;
- flag = flag & ~LMPF_FIXED_SIZE;
- }
-}
-*/
-
void MathInset::writeNormal(std::ostream & os) const
{
os << "[unknown ";
///
virtual void delCol(col_type) {}
- ///
- virtual void userSetSize(MathStyles &) {}
-
///
virtual void getXY(int & x, int & y) const;
///