+2001-02-14 André Pönitz <poenitz@htwm.de>
+
+ * math_parinset.[Ch]: make array a real MathArray, not just a
+ pointer to one.
+
+ * several files: subsequent changes
+
+
2001-02-19 Dekel Tsur <dekelts@tau.ac.il>
* array.C (MathedArray): Fix compilation problem.
MathedInset * MathDecorationInset::Clone()
{
- MathDecorationInset * p = new MathDecorationInset(deco_, GetStyle());
- MathedIter it(array);
- p->setData(it.Copy());
- return p;
+ return new MathDecorationInset(*this);
}
MathedInset * MathDelimInset::Clone()
{
- MathDelimInset * p = new MathDelimInset(left_, right_, GetStyle());
- MathedIter it(array);
- p->setData(it.Copy());
- return p;
+ return new MathDelimInset(*this);
}
MathedInset * MathFracInset::Clone()
{
- MathFracInset * p = new MathFracInset(GetType());
- MathedIter itn(array);
- MathedIter itd(den_->GetData());
- p->SetData(itn.Copy(), itd.Copy());
- p->idx_ = idx_;
- p->dh_ = dh_;
+ MathFracInset * p = new MathFracInset(*this);
+ // this cast will go again...
+ p->den_ = (MathParInset*) (p->den_->Clone());
return p;
}
MathedArray * MathFracInset::GetData()
{
if (idx_ == 0)
- return array;
+ return &array;
else
return den_->GetData();
}
SetName(tmplate_->GetName());
for (int i = 0; i < tmplate_->getNoArgs(); ++i) {
m->setArgumentIdx(i);
- MathedIter it(m->GetData());
args_[i].row = m->args_[i].row;
- args_[i].array = it.Copy();
+ args_[i].array = *(m->GetData());
}
}
MathMacro::~MathMacro()
{
- for (idx_ = 0; idx_ < nargs_; ++idx_) {
- MathedIter it(args_[idx_].array);
- it.Clear();
- delete args_[idx_].row;
- }
}
MathedArray * MathMacro::GetData()
{
- return args_[idx_].array;
+ return &args_[idx_].array;
}
void MathMacro::setData(MathedArray * a)
{
- args_[idx_].array = a;
+ args_[idx_].array = *a;
}
///
MathedRowSt * row;
///
- MathedArray * array;
+ MathedArray array;
///
MacroArgumentBase()
- : x(0), y(0), row(0), array(0)
+ : x(0), y(0), row(0)
{}
};
std::vector<MacroArgumentBase> args_;
nc_(mt->nc_), nr_(0), ws_(mt->nc_),
v_align_(mt->v_align_), h_align_(mt->h_align_)
{
- MathedIter it(mt->GetData());
- array = it.Copy();
+ array = *(mt->GetData());
if (mt->row_ != 0) {
MathedRowSt * ro = 0;
MathedRowSt * mrow = mt->row_;
// Automatically inserts tabs around bops
// DISABLED because it's very easy to insert tabs
- array = a;
+ array = *a;
}
MathParInset::MathParInset(short st, string const & nm, short ot)
: MathedInset(nm, ot, st)
{
- array = 0;
ascent = 8;
width = 4;
descent = 0;
MathParInset::~MathParInset()
{
- if (array) {
- MathedIter it(array);
- it.Clear();
- delete array;
- }
}
void MathParInset::setData(MathedArray * a)
{
- array = a;
+ array = *a;
// A standard paragraph shouldn't have any tabs nor CRs.
- if (array) {
- MathedIter it(array);
- while (it.OK()) {
- char c = it.GetChar();
- if (c == LM_TC_TAB || c == LM_TC_CR)
- it.Delete();
- else
- it.Next();
- }
+ MathedIter it(&array);
+ while (it.OK()) {
+ char c = it.GetChar();
+ if (c == LM_TC_TAB || c == LM_TC_CR)
+ it.Delete();
+ else
+ it.Next();
}
}
xo_ = x;
yo_ = y;
- if (!array || array->empty()) {
- if (array) {
- MathedXIter data(this);
- data.GetPos(x, y);
- }
+ if (array.empty()) {
+ MathedXIter data(this);
+ data.GetPos(x, y);
pain.rectangle(x, y - df_asc, df_width, df_asc, LColor::mathline);
return;
}
ascent = df_asc;//mathed_char_height(LM_TC_VAR, size, 'I', asc, des);
width = df_width;
descent = 0;
- if (!array) return;
- if (array->empty()) return;
+ if (array.empty()) return;
ascent = 0;
MathedXIter data(this);
void MathParInset::Write(ostream & os, bool fragile)
{
- if (!array) return;
+ if (array.empty()) return;
int brace = 0;
latexkeys const * l;
- MathedIter data(array);
+ MathedIter data(&array);
// hack
MathedRowSt const * crow = getRowSt();
data.Reset();
MathedArray * MathParInset::GetData()
{
- return array;
+ return &array;
}
#ifndef MATH_PARINSET_H
#define MATH_PARINSET_H
+#include "array.h"
#include "math_inset.h"
#include "math_defs.h"
}
protected:
/// Paragraph data is stored here
- MathedArray * array;
+ MathedArray array;
///
short flag;
///
MathedInset * MathRootInset::Clone()
{
- MathRootInset * p = new MathRootInset(GetStyle());
- MathedIter it(array);
- MathedIter itr(uroot_->GetData());
- p->setData(it.Copy());
+ MathRootInset * p = new MathRootInset(*this);
+ p->uroot_ = (MathParInset *) p->uroot_->Clone();
p->setArgumentIdx(0);
- p->setData(itr.Copy());
-
return p;
}
MathedArray * MathRootInset::GetData()
{
if (idx_ == 1)
- return array;
+ return &array;
else
return uroot_->GetData();
}
MathedInset * MathSqrtInset::Clone()
{
- MathSqrtInset * p = new MathSqrtInset(GetStyle());
- MathedIter it(array);
- p->setData(it.Copy());
- return p;
+ return new MathSqrtInset(*this);
}