mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
mathed47.diff
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1697 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7abb55666c
commit
d61590ccde
@ -709,7 +709,7 @@ void MathedCursor::setLabel(string const & label)
|
|||||||
void MathedCursor::setNumbered()
|
void MathedCursor::setNumbered()
|
||||||
{
|
{
|
||||||
// another ugly hack
|
// another ugly hack
|
||||||
MathedRowSt * crow = cursor->currentRow();
|
MathedRowContainer::iterator crow = cursor->currentRow();
|
||||||
if (crow)
|
if (crow)
|
||||||
crow->setNumbered(!crow->isNumbered());
|
crow->setNumbered(!crow->isNumbered());
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#define MATH_ROWST_H
|
#define MATH_ROWST_H
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include "support/LAssert.h"
|
||||||
|
|
||||||
/** The physical structure of a row and aditional information is stored here.
|
/** The physical structure of a row and aditional information is stored here.
|
||||||
It allows to manage the extra info independently of the paragraph data.
|
It allows to manage the extra info independently of the paragraph data.
|
||||||
@ -86,21 +87,27 @@ struct MathedRowContainer {
|
|||||||
///
|
///
|
||||||
struct iterator {
|
struct iterator {
|
||||||
///
|
///
|
||||||
iterator(MathedRowContainer * m) : st_(m->data_) {}
|
iterator() : st_(0) {}
|
||||||
|
///
|
||||||
|
explicit iterator(MathedRowSt * st) : st_(st) {}
|
||||||
|
/// "better" conversion to bool
|
||||||
|
explicit iterator(MathedRowContainer * m) : st_(m->data_) {}
|
||||||
/// "better" conversion to bool
|
/// "better" conversion to bool
|
||||||
operator void *() const { return st_; }
|
operator void *() const { return st_; }
|
||||||
///
|
///
|
||||||
MathedRowStruct & operator*() { return *st_; }
|
MathedRowStruct & operator*() { Assert(st_); return *st_; }
|
||||||
///
|
///
|
||||||
MathedRowStruct * operator->() { return st_; }
|
MathedRowStruct * operator->() { return st_; }
|
||||||
///
|
///
|
||||||
void operator++() { st_ = st_->next_; }
|
MathedRowStruct const * operator->() const { return st_; }
|
||||||
///
|
///
|
||||||
bool is_last() const { return st_->next_ == 0; }
|
void operator++() { Assert(st_); st_ = st_->next_; }
|
||||||
|
///
|
||||||
|
bool is_last() const { Assert(st_); return st_->next_ == 0; }
|
||||||
///
|
///
|
||||||
bool operator==(const iterator & it) const { return st_ == it.st_; }
|
bool operator==(const iterator & it) const { return st_ == it.st_; }
|
||||||
|
|
||||||
private:
|
//private:
|
||||||
///
|
///
|
||||||
MathedRowSt * st_;
|
MathedRowSt * st_;
|
||||||
};
|
};
|
||||||
|
@ -13,19 +13,18 @@ string MathedXIter::error_label = "$mathed-error$";
|
|||||||
|
|
||||||
MathedXIter::MathedXIter()
|
MathedXIter::MathedXIter()
|
||||||
: MathedIter(), size_(0), x_(0), y_(0), p_(0), sx_(0), sw_(0),
|
: MathedIter(), size_(0), x_(0), y_(0), p_(0), sx_(0), sw_(0),
|
||||||
crow_(0)
|
crow_()
|
||||||
{
|
{
|
||||||
// should limits_ be initialized?
|
// should limits_ be initialized?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MathedXIter::MathedXIter(MathParInset * pp)
|
MathedXIter::MathedXIter(MathParInset * pp)
|
||||||
: x_(0), y_(0), p_(pp), sx_(0), sw_(0), limits_(false)
|
: x_(0), y_(0), p_(pp), sx_(0), sw_(0), limits_(false), crow_()
|
||||||
{
|
{
|
||||||
if (p_)
|
if (p_)
|
||||||
SetData(p_);
|
SetData(p_);
|
||||||
else {
|
else {
|
||||||
crow_ = 0;
|
|
||||||
size_ = 0;
|
size_ = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,10 +119,11 @@ void MathedXIter::Clean(int pos2)
|
|||||||
}
|
}
|
||||||
if (IsCR()) {
|
if (IsCR()) {
|
||||||
if (crow_) {
|
if (crow_) {
|
||||||
MathedRowSt * r = crow_->getNext();
|
MathedRowContainer::iterator r = crow_;
|
||||||
|
++r;
|
||||||
if (r) {
|
if (r) {
|
||||||
crow_->setNext(r->getNext());
|
crow_.st_->setNext(r.st_->getNext());
|
||||||
delete r;
|
delete r.st_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,12 +158,12 @@ void MathedXIter::Merge(MathedArray const & a)
|
|||||||
while (pos < pos2 && OK()) {
|
while (pos < pos2 && OK()) {
|
||||||
if (IsCR()) {
|
if (IsCR()) {
|
||||||
if (p_ && p_->Permit(LMPF_ALLOW_CR)) {
|
if (p_ && p_->Permit(LMPF_ALLOW_CR)) {
|
||||||
MathedRowSt * r = new MathedRowSt(ncols + 1);
|
MathedRowContainer::iterator r( new MathedRowSt(ncols + 1) );
|
||||||
if (crow_) {
|
if (crow_) {
|
||||||
r->setNext(crow_->getNext());
|
r.st_->setNext(crow_.st_->getNext());
|
||||||
crow_->setNext(r);
|
crow_.st_->setNext(r.st_);
|
||||||
} else {
|
} else {
|
||||||
r->setNext(0);
|
r.st_->setNext(0);
|
||||||
}
|
}
|
||||||
crow_ = r;
|
crow_ = r;
|
||||||
} else {
|
} else {
|
||||||
@ -186,7 +186,7 @@ void MathedXIter::SetData(MathParInset * pp)
|
|||||||
x_ = y_ = 0;
|
x_ = y_ = 0;
|
||||||
array = &p_->GetData();
|
array = &p_->GetData();
|
||||||
ncols = p_->GetColumns();
|
ncols = p_->GetColumns();
|
||||||
crow_ = p_->getRowSt().data_;
|
crow_ = p_->getRowSt().begin();
|
||||||
if (p_->Permit(LMPF_ALLOW_CR))
|
if (p_->Permit(LMPF_ALLOW_CR))
|
||||||
flags |= MthIF_CR;
|
flags |= MthIF_CR;
|
||||||
if (p_->Permit(LMPF_ALLOW_TAB))
|
if (p_->Permit(LMPF_ALLOW_TAB))
|
||||||
@ -240,8 +240,8 @@ bool MathedXIter::Next()
|
|||||||
} else
|
} else
|
||||||
if (c == LM_TC_CR && p_) {
|
if (c == LM_TC_CR && p_) {
|
||||||
x_ = 0;
|
x_ = 0;
|
||||||
if (crow_ && crow_->getNext()) {
|
if (crow_ && crow_.st_->getNext()) {
|
||||||
crow_ = crow_->getNext();
|
++crow_;
|
||||||
y_ = crow_->getBaseline();
|
y_ = crow_->getBaseline();
|
||||||
w = crow_->getTab(0);
|
w = crow_->getTab(0);
|
||||||
}
|
}
|
||||||
@ -272,7 +272,7 @@ void MathedXIter::GoBegin()
|
|||||||
x_ = y_ = 0;
|
x_ = y_ = 0;
|
||||||
sw_ = sx_ = 0;
|
sw_ = sx_ = 0;
|
||||||
if (p_) {
|
if (p_) {
|
||||||
crow_ = p_->getRowSt().data_;
|
crow_ = p_->getRowSt().begin();
|
||||||
if (crow_) {
|
if (crow_) {
|
||||||
x_ = crow_->getTab(0);
|
x_ = crow_->getTab(0);
|
||||||
y_ = crow_->getBaseline();
|
y_ = crow_->getBaseline();
|
||||||
@ -373,13 +373,13 @@ void MathedXIter::addRow()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Create new item for the structure
|
// Create new item for the structure
|
||||||
MathedRowSt * r = new MathedRowSt(ncols + 1);
|
MathedRowContainer::iterator r( new MathedRowSt(ncols + 1) );
|
||||||
if (crow_) {
|
if (crow_) {
|
||||||
r->setNext(crow_->getNext());
|
r.st_->setNext(crow_.st_->getNext());
|
||||||
crow_->setNext(r);
|
crow_.st_->setNext(r.st_);
|
||||||
} else {
|
} else {
|
||||||
crow_ = r;
|
crow_ = r;
|
||||||
r->setNext(0);
|
r.st_->setNext(0);
|
||||||
}
|
}
|
||||||
// Fill missed tabs in current row
|
// Fill missed tabs in current row
|
||||||
while (col < ncols - 1)
|
while (col < ncols - 1)
|
||||||
@ -419,10 +419,10 @@ void MathedXIter::delRow()
|
|||||||
|
|
||||||
if (line_empty) {
|
if (line_empty) {
|
||||||
|
|
||||||
MathedRowSt * r = crow_->getNext();
|
MathedRowContainer::iterator r( crow_.st_->getNext() );
|
||||||
if (r) {
|
if (r) {
|
||||||
crow_->setNext(r->getNext());
|
crow_.st_->setNext(r.st_->getNext());
|
||||||
delete r;
|
delete r.st_;
|
||||||
}
|
}
|
||||||
join(p1);
|
join(p1);
|
||||||
Delete();
|
Delete();
|
||||||
@ -447,10 +447,10 @@ void MathedXIter::ipop()
|
|||||||
x_ = stck.x;
|
x_ = stck.x;
|
||||||
y_ = stck.y;
|
y_ = stck.y;
|
||||||
if (p_) {
|
if (p_) {
|
||||||
crow_ = p_->getRowSt().data_;
|
crow_ = p_->getRowSt().begin();
|
||||||
if (crow_)
|
if (crow_)
|
||||||
for (int i = 0; i < row; ++i)
|
for (int i = 0; i < row; ++i)
|
||||||
crow_ = crow_->getNext();
|
++crow_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -590,17 +590,17 @@ MathedRowSt * MathedXIter::adjustVerticalSt()
|
|||||||
GoBegin();
|
GoBegin();
|
||||||
if (!crow_) {
|
if (!crow_) {
|
||||||
// lyxerr << " CRW" << ncols << " ";
|
// lyxerr << " CRW" << ncols << " ";
|
||||||
crow_ = new MathedRowSt(ncols + 1); // this leaks
|
crow_.st_ = new MathedRowSt(ncols + 1); // this leaks
|
||||||
}
|
}
|
||||||
// lyxerr<< " CRW[" << crow_ << "] ";
|
// lyxerr<< " CRW[" << crow_ << "] ";
|
||||||
MathedRowSt * mrow = crow_;
|
MathedRowSt * mrow = crow_.st_;
|
||||||
while (OK()) {
|
while (OK()) {
|
||||||
if (IsCR()) {
|
if (IsCR()) {
|
||||||
if (col >= ncols) ncols = col + 1;
|
if (col >= ncols) ncols = col + 1;
|
||||||
MathedRowSt * r = new MathedRowSt(ncols + 1); // this leaks
|
MathedRowSt * r = new MathedRowSt(ncols + 1); // this leaks
|
||||||
// r->next = crow_->next;
|
// r->next = crow_->next;
|
||||||
crow_->setNext(r);
|
crow_.st_->setNext(r);
|
||||||
crow_ = r;
|
crow_.st_ = r;
|
||||||
// lyxerr << " CX[" << crow_ << "]";
|
// lyxerr << " CX[" << crow_ << "]";
|
||||||
}
|
}
|
||||||
Next();
|
Next();
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
#define MATH_XITER_H
|
#define MATH_XITER_H
|
||||||
|
|
||||||
#include "math_iter.h"
|
#include "math_iter.h"
|
||||||
|
#include "math_rowst.h"
|
||||||
|
|
||||||
class MathedRowSt;
|
|
||||||
class MathParInset;
|
class MathParInset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,7 +81,7 @@ public:
|
|||||||
///
|
///
|
||||||
virtual void ipop();
|
virtual void ipop();
|
||||||
///
|
///
|
||||||
MathedRowSt * currentRow() {
|
MathedRowContainer::iterator currentRow() {
|
||||||
return crow_;
|
return crow_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ private:
|
|||||||
/// true= center, false= left align (default)
|
/// true= center, false= left align (default)
|
||||||
bool limits_;
|
bool limits_;
|
||||||
///
|
///
|
||||||
MathedRowSt * crow_;
|
MathedRowContainer::iterator crow_;
|
||||||
|
|
||||||
///
|
///
|
||||||
//friend class MathedCursor;
|
//friend class MathedCursor;
|
||||||
|
Loading…
Reference in New Issue
Block a user