- remove some unused code

- put some more stuff in anaon namespaces
- cosmetics


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2915 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2001-10-23 09:03:07 +00:00
parent 13fbbbdc44
commit c0ef23bc2a
9 changed files with 33 additions and 57 deletions

View File

@ -26,7 +26,6 @@
#include "formulamacro.h" #include "formulamacro.h"
#include "commandtags.h" #include "commandtags.h"
#include "math_cursor.h" #include "math_cursor.h"
#include "math_parser.h"
#include "BufferView.h" #include "BufferView.h"
#include "lyxtext.h" #include "lyxtext.h"
#include "lyxfunc.h" #include "lyxfunc.h"
@ -503,12 +502,13 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
break; break;
case LFUN_MATH_SIZE: case LFUN_MATH_SIZE:
#if 0
if (!arg.empty()) { if (!arg.empty()) {
bv->lockedInsetStoreUndo(Undo::INSERT); bv->lockedInsetStoreUndo(Undo::INSERT);
latexkeys const * l = in_word_set(arg); mathcursor->setSize(arg);
mathcursor->setSize(MathStyles(l ? l->id : static_cast<unsigned int>(-1)));
updateLocal(bv, true); updateLocal(bv, true);
} }
#endif
break; break;
case LFUN_INSERT_MATRIX: case LFUN_INSERT_MATRIX:

View File

@ -81,13 +81,3 @@ MathInset * MathAtom::operator->() const
{ {
return nucleus(); return nucleus();
} }
/*
void MathAtom::userSetSize(MathStyles sz)
{
if (sz >= 0) {
size_ = sz;
flag = flag & ~LMPF_FIXED_SIZE;
}
}
*/

View File

@ -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. size, and type, of the nucleus they are attached to.
Jules 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; class MathInset;

View File

@ -39,7 +39,6 @@
#include "math_scriptinset.h" #include "math_scriptinset.h"
#include "math_spaceinset.h" #include "math_spaceinset.h"
#include "math_specialcharinset.h" #include "math_specialcharinset.h"
#include "math_parser.h"
#define FILEDEBUG 0 #define FILEDEBUG 0
@ -640,12 +639,6 @@ bool MathCursor::toggleLimits()
} }
void MathCursor::setSize(MathStyles size)
{
par()->userSetSize(size);
}
void MathCursor::macroModeClose() void MathCursor::macroModeClose()
{ {
string s = macroName(); string s = macroName();
@ -1234,8 +1227,6 @@ bool MathCursor::idxRight()
void MathCursor::interpret(string const & s) void MathCursor::interpret(string const & s)
{ {
//lyxerr << "interpret 1: '" << s << "'\n"; //lyxerr << "interpret 1: '" << s << "'\n";
//lyxerr << "in: " << in_word_set(s) << " \n";
if (s.empty()) if (s.empty())
return; return;

View File

@ -140,8 +140,6 @@ public:
/// ///
void interpret(char); void interpret(char);
/// ///
void setSize(MathStyles);
///
bool toggleLimits(); bool toggleLimits();
/// ///
// Macro mode methods // Macro mode methods

View File

@ -76,7 +76,8 @@ MathAtom createMathInset(string const & s)
if (s.size() == 2 && s[0] == '#' && s[1] >= '1' && s[1] <= '9') if (s.size() == 2 && s[0] == '#' && s[1] >= '1' && s[1] <= '9')
return MathAtom(new MathMacroArgument(s[1] - '0')); 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')); return MathAtom(new MathMacroArgument(s[2] - '0'));
latexkeys const * l = in_word_set(s); latexkeys const * l = in_word_set(s);
@ -86,5 +87,6 @@ MathAtom createMathInset(string const & s)
if (MathMacroTable::has(s)) if (MathMacroTable::has(s))
return MathAtom(new MathMacro(s)); return MathAtom(new MathMacro(s));
//cerr << "creating inset 2 with name: '" << s << "'\n";
return MathAtom(new MathFuncInset(s)); return MathAtom(new MathFuncInset(s));
} }

View File

@ -10,7 +10,10 @@
namespace { namespace {
struct latexkeys_a { std::map<string, latexkeys> theWordList;
struct key_type {
/// ///
char const * name; char const * name;
/// ///
@ -19,7 +22,7 @@ struct latexkeys_a {
unsigned int id; unsigned int id;
}; };
latexkeys_a wordlist_array[] = key_type wordlist_array[] =
{ {
{"!", LM_TK_SPACE, 0}, {"!", LM_TK_SPACE, 0},
{"#", LM_TK_SPECIAL, '#'}, {"#", LM_TK_SPECIAL, '#'},
@ -134,9 +137,6 @@ latexkeys_a wordlist_array[] =
}; };
std::map<string, latexkeys> wordlist;
MathTokenEnum tokenEnum(const string & font) 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); LyXLex lex(0, 0);
lex.setFile(filename); lex.setFile(filename);
@ -184,37 +181,39 @@ void ReadSymbols(string const & filename)
tmp.id = lex.getInteger(); tmp.id = lex.getInteger();
if (lex.next()) if (lex.next())
tmp.type = symbolType(lex.getString()); tmp.type = symbolType(lex.getString());
if (wordlist.find(tmp.name) != wordlist.end()) if (theWordList.find(tmp.name) != theWordList.end())
lyxerr << "ReadSymbols: token " << tmp.name lyxerr << "readSymbols: token " << tmp.name
<< " already exists.\n"; << " already exists.\n";
else else
wordlist[tmp.name] = tmp; theWordList[tmp.name] = tmp;
} }
} }
void initSymbols() void initSymbols()
{ {
unsigned const n = sizeof(wordlist_array) / sizeof(wordlist_array[0]); 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; latexkeys tmp;
tmp.name = p->name; tmp.name = p->name;
tmp.token = p->token; tmp.token = p->token;
tmp.id = p->id; tmp.id = p->id;
tmp.type = LMB_NONE; tmp.type = LMB_NONE;
tmp.latex_font_id = 0; 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"); string const file = LibFileSearch(string(), "symbols");
if (file.empty()) if (file.empty())
lyxerr << "Could not find symbols file\n"; lyxerr << "Could not find symbols file\n";
else else
ReadSymbols(file); readSymbols(file);
} }
} // namespace anon
latexkeys const * in_word_set(string const & str) latexkeys const * in_word_set(string const & str)
{ {
static bool initialized = false; static bool initialized = false;
@ -224,6 +223,6 @@ latexkeys const * in_word_set(string const & str)
initialized = true; initialized = true;
} }
std::map<string, latexkeys>::iterator it = wordlist.find(str); std::map<string, latexkeys>::iterator it = theWordList.find(str);
return (it != wordlist.end()) ? &(it->second) : 0; return (it != theWordList.end()) ? &(it->second) : 0;
} }

View File

@ -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 void MathInset::writeNormal(std::ostream & os) const
{ {
os << "[unknown "; os << "[unknown ";

View File

@ -202,9 +202,6 @@ public:
/// ///
virtual void delCol(col_type) {} virtual void delCol(col_type) {}
///
virtual void userSetSize(MathStyles &) {}
/// ///
virtual void getXY(int & x, int & y) const; virtual void getXY(int & x, int & y) const;
/// ///