* array.[Ch]: factor out deep_copy,
remove third argument from raw_pointer_insert
- * mathiter.[Ch]: remove unused function Clear()
+ * math_iter.[Ch]: remove unused function Clear()
- * mathcursor.C: change signature of MathStackXIter:push()
+ * math_cursor.C: change signature of MathStackXIter:push()
whitespace changes
+ * math_rowst.h: introduction of MathRowContainer
+ several files: corresponding changes
+
2001-03-04 André Pönitz <poenitz@htwm.de>
* math_macrotemplate.[Ch]:
math_macro.C: move update() functionality to the macro
v_align_(mt.v_align_), h_align_(mt.h_align_)
{
array = mt.GetData();
- if (mt.row_ != 0) {
+ if (mt.row_.data_ != 0) {
MathedRowSt * ro = 0;
- MathedRowSt * mrow = mt.row_;
+ MathedRowSt * mrow = mt.row_.data_;
while (mrow) {
MathedRowSt * r = new MathedRowSt(nc_ + 1);
MathMatrixInset::~MathMatrixInset()
{
- MathedRowSt * r = row_;
+ MathedRowSt * r = row_.data_;
while (r) {
MathedRowSt * q = r->getNext();
delete r;
void MathMatrixInset::Metrics()
{
- if (!row_) {
+ if (!row_.data_) {
// lyxerr << " MIDA ";
MathedXIter it(this);
row_ = it.adjustVerticalSt();
}
// Clean the arrays
- MathedRowSt * cxrow = row_;
+ MathedRowSt * cxrow = row_.data_;
while (cxrow) {
for (int i = 0; i <= nc_; ++i)
cxrow->setTab(i, 0);
// Basic metrics
MathParInset::Metrics();
- if (nc_ <= 1 && !row_->getNext()) {
- row_->ascent(ascent);
- row_->descent(descent);
+ if (nc_ <= 1 && !row_.data_->getNext()) {
+ row_.data_->ascent(ascent);
+ row_.data_->descent(descent);
}
// Vertical positions of each row
- cxrow = row_;
+ cxrow = row_.data_;
MathedRowSt * cprow = 0;
int h = 0;
while (cxrow) {
for (int i = 0; i < nc_; ++i) {
- if (cxrow == row_ || ws_[i] < cxrow->getTab(i))
+ if (cxrow == row_.data_ || ws_[i] < cxrow->getTab(i))
ws_[i] = cxrow->getTab(i);
if (cxrow->getNext() == 0 && ws_[i] == 0)
ws_[i] = df_width;
}
- cxrow->setBaseline((cxrow == row_) ?
+ cxrow->setBaseline((cxrow == row_.data_) ?
cxrow->ascent() :
cxrow->ascent() + cprow->descent()
+ MATH_ROWSEP + cprow->getBaseline());
// Compute vertical align
switch (v_align_) {
case 't':
- ascent = row_->getBaseline();
+ ascent = row_.data_->getBaseline();
break;
case 'b':
ascent = h - hl;
break;
default:
- ascent = (row_->getNext()) ? h / 2 : h - hl;
+ ascent = (row_.data_->getNext()) ? h / 2 : h - hl;
break;
}
descent = h - ascent + 2;
ws_[0] = 7 * workWidth / 8;
// Adjust local tabs
- cxrow = row_;
+ cxrow = row_.data_;
width = MATH_COLSEP;
while (cxrow) {
int rg = MATH_COLSEP;
lf = ws_[i] - cxrow->getTab(i);
break;
case 'C':
- if (cxrow == row_)
+ if (cxrow == row_.data_)
lf = 0;
else if (!cxrow->getNext())
lf = ws_[i] - cxrow->getTab(i);
int const ww = (isvoid) ? lf : lf + cxrow->getTab(i);
cxrow->setTab(i, lf + rg);
rg = ws_[i] - ww + MATH_COLSEP;
- if (cxrow == row_)
+ if (cxrow == row_.data_)
width += ws_[i] + MATH_COLSEP;
}
cxrow->setBaseline(cxrow->getBaseline() - ascent);
MathedRowSt * getNext() const;
/// ...we couldn't use this.
void setNext(MathedRowSt * n);
-private:
+//private:
///
MathedRowSt * next_;
};
+// 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 {
+ ///
+ struct iterator {
+ ///
+ iterator(MathedRowContainer * m) : st_(m->data_) {}
+ /// "better" conversion to bool
+ operator void *() const { return st_; }
+ ///
+ MathedRowStruct & operator*() { return *st_; }
+ ///
+ MathedRowStruct * operator->() { return st_; }
+ ///
+ void operator++() { st_ = st_->next_; }
+ ///
+ bool is_last() const { return st_->next_ == 0; }
+ ///
+ bool operator==(const iterator & it) const { return st_ == it.st_; }
+
+ private:
+ ///
+ MathedRowSt * st_;
+ };
+
+ ///
+ MathedRowContainer() : data_(0) {}
+ ///
+ MathedRowContainer(MathedRowSt * data) : data_(data) {}
+
+ ///
+ iterator begin() { return iterator(this); }
+ ///
+ bool empty() const { return data_ == 0; }
+
+ ///
+ MathedRowSt * data_;
+};
+
+
+
inline
MathedRowSt * MathedRowSt::getNext() const
{