mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-14 06:57:01 +00:00
mathed58.diff
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1771 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
9c36dd0f40
commit
b5e793e7bb
@ -14,7 +14,6 @@
|
|||||||
using std::ostream;
|
using std::ostream;
|
||||||
using std::endl;
|
using std::endl;
|
||||||
|
|
||||||
// Is this still needed? (Lgb)
|
|
||||||
static inline
|
static inline
|
||||||
void * my_memcpy(void * ps_in, void const * pt_in, size_t n)
|
void * my_memcpy(void * ps_in, void const * pt_in, size_t n)
|
||||||
{
|
{
|
||||||
|
@ -424,9 +424,6 @@ void mathed_parse(MathedArray & array, unsigned flags = 0,
|
|||||||
int acc_brace = 0;
|
int acc_brace = 0;
|
||||||
int acc_braces[8];
|
int acc_braces[8];
|
||||||
MathParInset * mt = (mtx) ? *mtx : 0;
|
MathParInset * mt = (mtx) ? *mtx : 0;
|
||||||
MathedRowContainer::iterator crow;
|
|
||||||
if (mt)
|
|
||||||
crow = mt->getRowSt().begin();
|
|
||||||
|
|
||||||
++plevel;
|
++plevel;
|
||||||
MathedIter data(&array);
|
MathedIter data(&array);
|
||||||
@ -604,8 +601,7 @@ void mathed_parse(MathedArray & array, unsigned flags = 0,
|
|||||||
case LM_TK_NEWLINE:
|
case LM_TK_NEWLINE:
|
||||||
if (mt && (flags & FLAG_END)) {
|
if (mt && (flags & FLAG_END)) {
|
||||||
if (mt->Permit(LMPF_ALLOW_CR)) {
|
if (mt->Permit(LMPF_ALLOW_CR)) {
|
||||||
mt->getRowSt().insert(crow);
|
mt->getRowSt().push_back();
|
||||||
++crow;
|
|
||||||
data.insert('K', LM_TC_CR);
|
data.insert('K', LM_TC_CR);
|
||||||
} else
|
} else
|
||||||
mathPrintError("Unexpected newline");
|
mathPrintError("Unexpected newline");
|
||||||
@ -757,8 +753,11 @@ void mathed_parse(MathedArray & array, unsigned flags = 0,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LM_TK_NONUM:
|
case LM_TK_NONUM:
|
||||||
if (crow)
|
if (mt) {
|
||||||
crow->setNumbered(false);
|
if (!mt->getRowSt().data_.size())
|
||||||
|
mt->getRowSt().push_back();
|
||||||
|
mt->getRowSt().back().setNumbered(false);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LM_TK_PMOD:
|
case LM_TK_PMOD:
|
||||||
@ -869,7 +868,6 @@ void mathed_parse(MathedArray & array, unsigned flags = 0,
|
|||||||
}
|
}
|
||||||
mt->SetStyle(size);
|
mt->SetStyle(size);
|
||||||
mt->SetType(mathed_env);
|
mt->SetType(mathed_env);
|
||||||
crow = mt->getRowSt().begin();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lyxerr[Debug::MATHED] << "MATH BEGIN[" << mathed_env << "]" << endl;
|
lyxerr[Debug::MATHED] << "MATH BEGIN[" << mathed_env << "]" << endl;
|
||||||
@ -914,8 +912,8 @@ void mathed_parse(MathedArray & array, unsigned flags = 0,
|
|||||||
panic = true;
|
panic = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (crow) {
|
if (mt) {
|
||||||
crow->setLabel(yytext.data());
|
mt->getRowSt().back().setLabel(yytext.data());
|
||||||
} else {
|
} else {
|
||||||
mathed_label = yytext.data();
|
mathed_label = yytext.data();
|
||||||
}
|
}
|
||||||
|
@ -44,10 +44,8 @@ public:
|
|||||||
void setNumbered(bool nf);
|
void setNumbered(bool nf);
|
||||||
///
|
///
|
||||||
void setTab(unsigned int i, int t);
|
void setTab(unsigned int i, int t);
|
||||||
///
|
|
||||||
friend class MathedRowSt;
|
|
||||||
protected:
|
protected:
|
||||||
/// Vericals
|
/// verticals
|
||||||
int asc_;
|
int asc_;
|
||||||
///
|
///
|
||||||
int desc_;
|
int desc_;
|
||||||
@ -62,11 +60,9 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// The idea is to change this MathedRowContainer to mimic the behaviour
|
|
||||||
// of std::list<MathedRowStruct> in several small steps. In the end it
|
|
||||||
// could be replaced by such a list and MathedRowSt can go as well.
|
|
||||||
|
|
||||||
struct MathedRowContainer {
|
class MathedRowContainer {
|
||||||
|
private:
|
||||||
///
|
///
|
||||||
struct iterator {
|
struct iterator {
|
||||||
///
|
///
|
||||||
@ -79,9 +75,9 @@ struct MathedRowContainer {
|
|||||||
///
|
///
|
||||||
MathedRowStruct & operator*() { Assert(st_); return st_->data_[pos_]; }
|
MathedRowStruct & operator*() { Assert(st_); return st_->data_[pos_]; }
|
||||||
///
|
///
|
||||||
MathedRowStruct * operator->() { return &st_->data_[pos_]; }
|
MathedRowStruct * operator->() { Assert(st_); return &st_->data_[pos_]; }
|
||||||
///
|
///
|
||||||
MathedRowStruct const * operator->() const { return &st_->data_[pos_]; }
|
MathedRowStruct const * operator->() const { Assert(st_); return &st_->data_[pos_]; }
|
||||||
///
|
///
|
||||||
void operator++() { Assert(st_); ++pos_; }
|
void operator++() { Assert(st_); ++pos_; }
|
||||||
///
|
///
|
||||||
@ -92,27 +88,44 @@ struct MathedRowContainer {
|
|||||||
|
|
||||||
//private:
|
//private:
|
||||||
///
|
///
|
||||||
|
friend class MathedRowContainer;
|
||||||
|
|
||||||
|
/// pointer to the container to which we belong
|
||||||
MathedRowContainer * st_;
|
MathedRowContainer * st_;
|
||||||
///
|
/// position in this container, e.g. row number
|
||||||
unsigned int pos_;
|
unsigned int pos_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
///
|
///
|
||||||
iterator begin() { return iterator(this); }
|
iterator begin() { return iterator(this); }
|
||||||
///
|
///
|
||||||
bool empty() const { return data_.size() == 0; }
|
bool empty() const { return data_.size() == 0; }
|
||||||
|
|
||||||
/// insert 'item' before 'iterator'
|
/// insert item before 'it'
|
||||||
void insert(iterator const & it) {
|
void insert(iterator const & it) {
|
||||||
Assert(it.st_ == this);
|
Assert(it.st_ == this);
|
||||||
data_.insert(data_.begin() + it.pos_, MathedRowStruct());
|
data_.insert(data_.begin() + it.pos_, MathedRowStruct());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// erase item pointed to by 'it'
|
||||||
void erase(iterator & it) {
|
void erase(iterator & it) {
|
||||||
Assert(it.st_ == this);
|
Assert(it.st_ == this);
|
||||||
data_.erase(data_.begin() + it.pos_);
|
data_.erase(data_.begin() + it.pos_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// access to last item
|
||||||
|
MathedRowStruct & back() {
|
||||||
|
Assert(data_.size());
|
||||||
|
return data_.back();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// append empty element
|
||||||
|
void push_back() {
|
||||||
|
data_.push_back(MathedRowStruct());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
std::vector<MathedRowStruct> data_;
|
std::vector<MathedRowStruct> data_;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user