diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index f683cf88c5..d5605bfc3b 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -26,7 +26,6 @@ #include "formulamacro.h" #include "commandtags.h" #include "math_cursor.h" -#include "math_parser.h" #include "BufferView.h" #include "lyxtext.h" #include "lyxfunc.h" @@ -503,12 +502,13 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, 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(-1))); + mathcursor->setSize(arg); updateLocal(bv, true); } +#endif break; case LFUN_INSERT_MATRIX: diff --git a/src/mathed/math_atom.C b/src/mathed/math_atom.C index 8c1c6ed85c..57acb4a0a7 100644 --- a/src/mathed/math_atom.C +++ b/src/mathed/math_atom.C @@ -81,13 +81,3 @@ MathInset * MathAtom::operator->() const { return nucleus(); } - -/* -void MathAtom::userSetSize(MathStyles sz) -{ - if (sz >= 0) { - size_ = sz; - flag = flag & ~LMPF_FIXED_SIZE; - } -} -*/ diff --git a/src/mathed/math_atom.h b/src/mathed/math_atom.h index 38c40469b0..938d1170ec 100644 --- a/src/mathed/math_atom.h +++ b/src/mathed/math_atom.h @@ -15,6 +15,15 @@ Exactly where the subscript and superscript are drawn depends on the 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; diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index c4027c2a30..754a65aed3 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -39,7 +39,6 @@ #include "math_scriptinset.h" #include "math_spaceinset.h" #include "math_specialcharinset.h" -#include "math_parser.h" #define FILEDEBUG 0 @@ -640,12 +639,6 @@ bool MathCursor::toggleLimits() } -void MathCursor::setSize(MathStyles size) -{ - par()->userSetSize(size); -} - - void MathCursor::macroModeClose() { string s = macroName(); @@ -1234,8 +1227,6 @@ bool MathCursor::idxRight() void MathCursor::interpret(string const & s) { //lyxerr << "interpret 1: '" << s << "'\n"; - //lyxerr << "in: " << in_word_set(s) << " \n"; - if (s.empty()) return; diff --git a/src/mathed/math_cursor.h b/src/mathed/math_cursor.h index 615d3cb7b9..93b7fc0297 100644 --- a/src/mathed/math_cursor.h +++ b/src/mathed/math_cursor.h @@ -140,8 +140,6 @@ public: /// void interpret(char); /// - void setSize(MathStyles); - /// bool toggleLimits(); /// // Macro mode methods diff --git a/src/mathed/math_factory.C b/src/mathed/math_factory.C index 88b8472848..49201ac994 100644 --- a/src/mathed/math_factory.C +++ b/src/mathed/math_factory.C @@ -76,7 +76,8 @@ MathAtom createMathInset(string const & s) 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); @@ -86,5 +87,6 @@ MathAtom createMathInset(string const & s) if (MathMacroTable::has(s)) return MathAtom(new MathMacro(s)); + //cerr << "creating inset 2 with name: '" << s << "'\n"; return MathAtom(new MathFuncInset(s)); } diff --git a/src/mathed/math_hash.C b/src/mathed/math_hash.C index 888ff8748a..cf729e2332 100644 --- a/src/mathed/math_hash.C +++ b/src/mathed/math_hash.C @@ -10,7 +10,10 @@ namespace { -struct latexkeys_a { +std::map theWordList; + + +struct key_type { /// char const * name; /// @@ -19,7 +22,7 @@ struct latexkeys_a { unsigned int id; }; -latexkeys_a wordlist_array[] = +key_type wordlist_array[] = { {"!", LM_TK_SPACE, 0}, {"#", LM_TK_SPECIAL, '#'}, @@ -134,9 +137,6 @@ latexkeys_a wordlist_array[] = }; -std::map wordlist; - - MathTokenEnum tokenEnum(const string & font) { @@ -166,10 +166,7 @@ MathSymbolTypes symbolType(const string & type) } -} // namespace anon - - -void ReadSymbols(string const & filename) +void readSymbols(string const & filename) { LyXLex lex(0, 0); lex.setFile(filename); @@ -184,37 +181,39 @@ void ReadSymbols(string const & 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; @@ -224,6 +223,6 @@ latexkeys const * in_word_set(string const & str) initialized = true; } - std::map::iterator it = wordlist.find(str); - return (it != wordlist.end()) ? &(it->second) : 0; + std::map::iterator it = theWordList.find(str); + return (it != theWordList.end()) ? &(it->second) : 0; } diff --git a/src/mathed/math_inset.C b/src/mathed/math_inset.C index 1656ac28ec..f8e4575974 100644 --- a/src/mathed/math_inset.C +++ b/src/mathed/math_inset.C @@ -189,16 +189,6 @@ void MathInset::getXY(int & x, int & y) const } -/* -void MathInset::userSetSize(MathStyles sz) -{ - if (sz >= 0) { - size_ = sz; - flag = flag & ~LMPF_FIXED_SIZE; - } -} -*/ - void MathInset::writeNormal(std::ostream & os) const { os << "[unknown "; diff --git a/src/mathed/math_inset.h b/src/mathed/math_inset.h index b70260e692..665db40f4d 100644 --- a/src/mathed/math_inset.h +++ b/src/mathed/math_inset.h @@ -202,9 +202,6 @@ public: /// virtual void delCol(col_type) {} - /// - virtual void userSetSize(MathStyles &) {} - /// virtual void getXY(int & x, int & y) const; ///