mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 21:40:19 +00:00
some changes to make some compilers somewhat happier
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3310 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
13daca767e
commit
faf2f08712
@ -503,7 +503,6 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action,
|
||||
|
||||
bool needEqnArray(string const & extra)
|
||||
{
|
||||
return false;
|
||||
return extra == "dsolve";
|
||||
}
|
||||
|
||||
|
@ -619,7 +619,7 @@ void MathCursor::macroModeClose()
|
||||
|
||||
int MathCursor::macroNamePos() const
|
||||
{
|
||||
for (int i = pos() - 1; i >= 0; --i) {
|
||||
for (MathInset::difference_type i = pos() - 1; i >= 0; --i) {
|
||||
MathAtom & p = array().at(i);
|
||||
if (p->code() == LM_TC_TEX && p->getChar() == '\\')
|
||||
return i;
|
||||
@ -631,7 +631,8 @@ int MathCursor::macroNamePos() const
|
||||
string MathCursor::macroName() const
|
||||
{
|
||||
string s;
|
||||
for (int i = macroNamePos(); i >= 0 && i < int(pos()); ++i)
|
||||
MathInset::difference_type i = macroNamePos();
|
||||
for ( ; i >= 0 && i < int(pos()); ++i)
|
||||
s += array().at(i)->getChar();
|
||||
return s;
|
||||
}
|
||||
|
@ -51,6 +51,8 @@ public:
|
||||
///
|
||||
typedef buffer_type::size_type size_type;
|
||||
///
|
||||
typedef buffer_type::difference_type difference_type;
|
||||
///
|
||||
typedef buffer_type::size_type idx_type;
|
||||
///
|
||||
typedef buffer_type::size_type pos_type;
|
||||
|
@ -30,7 +30,7 @@ MathAtom createMathInset(latexkeys const * l)
|
||||
case LM_TK_FUNCLIM:
|
||||
return MathAtom(new MathFuncLimInset(l->name));
|
||||
case LM_TK_SPECIAL:
|
||||
return MathAtom(new MathSpecialCharInset(l->id));
|
||||
return MathAtom(new MathSpecialCharInset(static_cast<char>(l->id)));
|
||||
case LM_TK_SYM:
|
||||
case LM_TK_CMR:
|
||||
case LM_TK_CMSY:
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
// global
|
||||
std::map<string, latexkeys> theWordList;
|
||||
|
||||
|
||||
@ -18,11 +19,12 @@ struct key_type {
|
||||
///
|
||||
char const * name;
|
||||
///
|
||||
short token;
|
||||
MathTokenEnum token;
|
||||
///
|
||||
unsigned int id;
|
||||
};
|
||||
|
||||
|
||||
key_type wordlist_array[] =
|
||||
{
|
||||
{"!", LM_TK_SPACE, 0},
|
||||
|
@ -78,15 +78,17 @@ class MathPosFinder;
|
||||
class MathInset {
|
||||
public:
|
||||
/// short of anything else reasonable
|
||||
typedef MathArray::size_type size_type;
|
||||
typedef MathArray::size_type size_type;
|
||||
/// type for cursor positions differences within a cell
|
||||
typedef MathArray::difference_type difference_type;
|
||||
/// type for cursor positions within a cell
|
||||
typedef MathArray::size_type pos_type;
|
||||
typedef MathArray::size_type pos_type;
|
||||
/// type for cell indices
|
||||
typedef size_type idx_type;
|
||||
typedef size_type idx_type;
|
||||
/// type for row numbers
|
||||
typedef size_type row_type;
|
||||
typedef size_type row_type;
|
||||
/// type for column numbers
|
||||
typedef size_type col_type;
|
||||
typedef size_type col_type;
|
||||
|
||||
/// our members behave nicely...
|
||||
MathInset() {}
|
||||
|
@ -138,10 +138,10 @@ void MathIterator::operator++()
|
||||
}
|
||||
|
||||
|
||||
void MathIterator::jump(int i)
|
||||
void MathIterator::jump(MathInset::difference_type i)
|
||||
{
|
||||
position().pos_ += i;
|
||||
lyx::Assert(position().pos_ >= 0);
|
||||
//lyx::Assert(position().pos_ >= 0);
|
||||
lyx::Assert(position().pos_ <= cell().size());
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
/// move on one step
|
||||
void operator++();
|
||||
/// move on several steps
|
||||
void jump(int n);
|
||||
void jump(MathInset::difference_type);
|
||||
/// read access to top most item
|
||||
MathCursorPos const & position() const;
|
||||
/// write access to top most item
|
||||
|
@ -26,8 +26,6 @@
|
||||
#include "LString.h"
|
||||
#include "math_defs.h"
|
||||
|
||||
class MathHullInset;
|
||||
class MathMacroTemplate;
|
||||
class MathAtom;
|
||||
class MathArray;
|
||||
class LyXLex;
|
||||
@ -36,7 +34,7 @@ class LyXLex;
|
||||
enum MathTokenEnum
|
||||
{
|
||||
///
|
||||
LM_TK_SYM = 256,
|
||||
LM_TK_SYM,
|
||||
///
|
||||
LM_TK_BOX,
|
||||
///
|
||||
@ -118,36 +116,41 @@ enum MathTokenEnum
|
||||
|
||||
///
|
||||
struct latexkeys {
|
||||
///
|
||||
/// name of the macro or primitive
|
||||
string name;
|
||||
///
|
||||
short token;
|
||||
///
|
||||
/// one of the categories above
|
||||
MathTokenEnum token;
|
||||
/// an id within a category if needed (only for spaces?)
|
||||
unsigned int id;
|
||||
///
|
||||
unsigned char latex_font_id;
|
||||
///
|
||||
/// which font to use (optional)
|
||||
unsigned int latex_font_id;
|
||||
/// operator/...
|
||||
string type;
|
||||
///
|
||||
/// how is this called as XML entity?
|
||||
string xmlname;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// check whether this is a well-known (La)TeX macro or primitive
|
||||
latexkeys const * in_word_set(string const & str);
|
||||
|
||||
///
|
||||
void ReadSymbols(string const & file);
|
||||
|
||||
/// parse formula from a string
|
||||
bool mathed_parse_normal(MathAtom &, string const &);
|
||||
/// ... a stream
|
||||
bool mathed_parse_normal(MathAtom &, std::istream &);
|
||||
/// ... the LyX lexxer
|
||||
bool mathed_parse_normal(MathAtom &, LyXLex &);
|
||||
|
||||
/// parse a macro definition from a string, enter it into the macro table
|
||||
string mathed_parse_macro(string const &);
|
||||
/// ... a stream
|
||||
string mathed_parse_macro(std::istream &);
|
||||
/// ... the LyX lexxer
|
||||
string mathed_parse_macro(LyXLex &);
|
||||
|
||||
void mathed_parse_cell(MathArray & ar, string const & str);
|
||||
void mathed_parse_cell(MathArray & ar, std::istream & is);
|
||||
/// parse a single cell from a string
|
||||
void mathed_parse_cell(MathArray & ar, string const &);
|
||||
/// ... a stream
|
||||
void mathed_parse_cell(MathArray & ar, std::istream &);
|
||||
|
||||
#endif
|
||||
|
@ -106,37 +106,37 @@ int MathScriptInset::dy1(MathInset const * nuc) const
|
||||
int MathScriptInset::dx0(MathInset const * nuc) const
|
||||
{
|
||||
lyx::Assert(hasDown());
|
||||
return hasLimits(nuc) ? (width(nuc) - down().width()) / 2 : nwid(nuc);
|
||||
return hasLimits(nuc) ? (width2(nuc) - down().width()) / 2 : nwid(nuc);
|
||||
}
|
||||
|
||||
|
||||
int MathScriptInset::dx1(MathInset const * nuc) const
|
||||
{
|
||||
lyx::Assert(hasUp());
|
||||
return hasLimits(nuc) ? (width(nuc) - up().width()) / 2 : nwid(nuc);
|
||||
return hasLimits(nuc) ? (width2(nuc) - up().width()) / 2 : nwid(nuc);
|
||||
}
|
||||
|
||||
|
||||
int MathScriptInset::dxx(MathInset const * nuc) const
|
||||
{
|
||||
//lyx::Assert(nuc());
|
||||
return hasLimits(nuc) ? (width(nuc) - nwid(nuc)) / 2 : 0;
|
||||
return hasLimits(nuc) ? (width2(nuc) - nwid(nuc)) / 2 : 0;
|
||||
}
|
||||
|
||||
|
||||
int MathScriptInset::ascent(MathInset const * nuc) const
|
||||
int MathScriptInset::ascent2(MathInset const * nuc) const
|
||||
{
|
||||
return dy1(nuc) + (hasUp() ? up().ascent() : 0);
|
||||
}
|
||||
|
||||
|
||||
int MathScriptInset::descent(MathInset const * nuc) const
|
||||
int MathScriptInset::descent2(MathInset const * nuc) const
|
||||
{
|
||||
return dy0(nuc) + (hasDown() ? down().descent() : 0);
|
||||
}
|
||||
|
||||
|
||||
int MathScriptInset::width(MathInset const * nuc) const
|
||||
int MathScriptInset::width2(MathInset const * nuc) const
|
||||
{
|
||||
int wid = 0;
|
||||
if (hasLimits(nuc)) {
|
||||
@ -190,10 +190,9 @@ void MathScriptInset::metrics(MathInset const * nuc,
|
||||
MathNestInset::metrics(mi);
|
||||
if (nuc)
|
||||
nuc->metrics(mi);
|
||||
|
||||
ascent_ = ascent(nuc);
|
||||
descent_ = descent(nuc);
|
||||
width_ = width(nuc);
|
||||
ascent_ = ascent2(nuc);
|
||||
descent_ = descent2(nuc);
|
||||
width_ = width2(nuc);
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,11 +34,11 @@ public:
|
||||
///
|
||||
void draw(MathInset const * nuc, Painter &, int x, int y) const;
|
||||
///
|
||||
int ascent(MathInset const * nuc) const;
|
||||
int ascent2(MathInset const * nuc) const;
|
||||
///
|
||||
int descent(MathInset const * nuc) const;
|
||||
int descent2(MathInset const * nuc) const;
|
||||
///
|
||||
int width(MathInset const * nuc) const;
|
||||
int width2(MathInset const * nuc) const;
|
||||
|
||||
///
|
||||
bool idxLeft(idx_type &, pos_type &) const;
|
||||
|
@ -36,9 +36,9 @@ void MathXArray::metrics(MathMetricsInfo const & mi) const
|
||||
MathScriptInset const * q = (it + 1 == end()) ? 0 : asScript(it);
|
||||
if (q) {
|
||||
q->metrics(p, mi);
|
||||
ascent_ = std::max(ascent_, q->ascent(p));
|
||||
descent_ = std::max(descent_, q->descent(p));
|
||||
width_ += q->width(p);
|
||||
ascent_ = std::max(ascent_, q->ascent2(p));
|
||||
descent_ = std::max(descent_, q->descent2(p));
|
||||
width_ += q->width2(p);
|
||||
++it;
|
||||
} else {
|
||||
p->metrics(mi);
|
||||
@ -67,7 +67,7 @@ void MathXArray::draw(Painter & pain, int x, int y) const
|
||||
MathScriptInset const * q = (it + 1 == end()) ? 0 : asScript(it);
|
||||
if (q) {
|
||||
q->draw(p, pain, x, y);
|
||||
x += q->width(p);
|
||||
x += q->width2(p);
|
||||
++it;
|
||||
} else {
|
||||
p->draw(pain, x, y);
|
||||
@ -87,7 +87,7 @@ int MathXArray::pos2x(size_type targetpos) const
|
||||
if (q) {
|
||||
++it;
|
||||
if (it < target)
|
||||
x += q->width(p);
|
||||
x += q->width2(p);
|
||||
else // "half" position
|
||||
x += q->dxx(p) + q->nwid(p);
|
||||
} else
|
||||
@ -111,7 +111,7 @@ MathArray::size_type MathXArray::x2pos(int targetx) const
|
||||
if (it + 1 != end())
|
||||
q = asScript(it);
|
||||
if (q) {
|
||||
wid = q->width(p);
|
||||
wid = q->width2(p);
|
||||
++it;
|
||||
} else
|
||||
wid = p->width();
|
||||
|
Loading…
Reference in New Issue
Block a user