mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-14 06:57:01 +00:00
mathed29.diff
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1560 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
71794f7d81
commit
8d7fe83bf5
@ -8,6 +8,9 @@
|
|||||||
|
|
||||||
* math_iter.[Ch]: seperate Copy() from Copy(int, int)
|
* math_iter.[Ch]: seperate Copy() from Copy(int, int)
|
||||||
|
|
||||||
|
* math_iter.[Ch]: remove SetData
|
||||||
|
several files: subsequent changes
|
||||||
|
|
||||||
2001-02-14 André Pönitz <poenitz@htwm.de>
|
2001-02-14 André Pönitz <poenitz@htwm.de>
|
||||||
|
|
||||||
* array.[Ch]: remove constructor and enums ARRAY_MIN_SIZE and ARRAY_STEP
|
* array.[Ch]: remove constructor and enums ARRAY_MIN_SIZE and ARRAY_STEP
|
||||||
|
@ -24,6 +24,7 @@ MathedArray::MathedArray()
|
|||||||
: bf_(1, '\0'), last_(0)
|
: bf_(1, '\0'), last_(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
MathedArray::~MathedArray()
|
MathedArray::~MathedArray()
|
||||||
{
|
{
|
||||||
// deep destruction
|
// deep destruction
|
||||||
@ -55,8 +56,7 @@ MathedArray::MathedArray(MathedArray const & array)
|
|||||||
|
|
||||||
// deep copy
|
// deep copy
|
||||||
// we'll not yet get exeption safety
|
// we'll not yet get exeption safety
|
||||||
MathedIter it;
|
MathedIter it(this);
|
||||||
it.SetData(this);
|
|
||||||
while (it.OK()) {
|
while (it.OK()) {
|
||||||
if (it.IsInset()) {
|
if (it.IsInset()) {
|
||||||
MathedInset * inset = it.GetInset();
|
MathedInset * inset = it.GetInset();
|
||||||
|
@ -43,11 +43,6 @@ MathedIter::MathedIter()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
void MathedIter::SetData(MathedArray * a)
|
|
||||||
{
|
|
||||||
array = a; Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MathedArray * MathedIter::GetData() const
|
MathedArray * MathedIter::GetData() const
|
||||||
{
|
{
|
||||||
@ -403,11 +398,11 @@ MathedArray * MathedIter::Copy(int pos1, int pos2)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pos1 > 0 || pos2 <= array->last()) {
|
||||||
ipush();
|
ipush();
|
||||||
MathedArray * t = array;
|
MathedArray * t = array;
|
||||||
MathedArray * a;
|
MathedArray * a;
|
||||||
|
|
||||||
if (pos1 > 0 || pos2 <= array->last()) {
|
|
||||||
short fc = 0;
|
short fc = 0;
|
||||||
if (pos1 > 0 && (*array)[pos1] > ' ') {
|
if (pos1 > 0 && (*array)[pos1] > ' ') {
|
||||||
for (int p = pos1; p >= 0; --p) {
|
for (int p = pos1; p >= 0; --p) {
|
||||||
@ -436,14 +431,10 @@ MathedArray * MathedIter::Copy(int pos1, int pos2)
|
|||||||
}
|
}
|
||||||
a->last(dx);
|
a->last(dx);
|
||||||
(*a)[dx] = '\0';
|
(*a)[dx] = '\0';
|
||||||
} else
|
|
||||||
a = new MathedArray(*array);
|
|
||||||
|
|
||||||
// this should be unnecessary and leak in some (most?) cases since
|
array = a;
|
||||||
// a = new MathedArray(*array); makes already a deep copy...
|
Reset();
|
||||||
// I guess it'll go soon... (Andre')
|
|
||||||
|
|
||||||
SetData(a);
|
|
||||||
while (OK()) {
|
while (OK()) {
|
||||||
if (IsInset()) {
|
if (IsInset()) {
|
||||||
MathedInset * inset = GetInset();
|
MathedInset * inset = GetInset();
|
||||||
@ -454,7 +445,12 @@ MathedArray * MathedIter::Copy(int pos1, int pos2)
|
|||||||
}
|
}
|
||||||
array = t;
|
array = t;
|
||||||
ipop();
|
ipop();
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
// otherwise: full copy
|
||||||
|
return new MathedArray(*array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,8 +109,6 @@ public:
|
|||||||
///
|
///
|
||||||
void setNumCols(int n) { ncols = n; }
|
void setNumCols(int n) { ncols = n; }
|
||||||
///
|
///
|
||||||
void SetData(MathedArray * a);
|
|
||||||
///
|
|
||||||
MathedArray * GetData() const;
|
MathedArray * GetData() const;
|
||||||
/// Copy every object
|
/// Copy every object
|
||||||
MathedArray * Copy();
|
MathedArray * Copy();
|
||||||
|
@ -49,9 +49,7 @@ void MathMacroTable::addTemplate(MathMacroTemplate * m)
|
|||||||
|
|
||||||
void MathMacroTable::builtinMacros()
|
void MathMacroTable::builtinMacros()
|
||||||
{
|
{
|
||||||
MathedIter iter;
|
|
||||||
MathParInset * inset;// *arg;
|
MathParInset * inset;// *arg;
|
||||||
MathedArray * array2;
|
|
||||||
|
|
||||||
built = true;
|
built = true;
|
||||||
|
|
||||||
@ -60,48 +58,56 @@ void MathMacroTable::builtinMacros()
|
|||||||
// This macro doesn't have arguments
|
// This macro doesn't have arguments
|
||||||
MathMacroTemplate * m = new MathMacroTemplate("notin"); // this leaks
|
MathMacroTemplate * m = new MathMacroTemplate("notin"); // this leaks
|
||||||
addTemplate(m);
|
addTemplate(m);
|
||||||
|
{
|
||||||
MathedArray * array = new MathedArray; // this leaks
|
MathedArray * array = new MathedArray; // this leaks
|
||||||
iter.SetData(array);
|
MathedIter iter(array);
|
||||||
iter.insertInset(new MathAccentInset(LM_in, LM_TC_BOPS, LM_not),
|
iter.insertInset(new MathAccentInset(LM_in, LM_TC_BOPS, LM_not),
|
||||||
LM_TC_INSET); // this leaks
|
LM_TC_INSET); // this leaks
|
||||||
m->setData(array);
|
m->setData(array);
|
||||||
|
}
|
||||||
|
|
||||||
// These two are only while we are still with LyX 2.x
|
// These two are only while we are still with LyX 2.x
|
||||||
m = new MathMacroTemplate("emptyset"); // this leaks
|
m = new MathMacroTemplate("emptyset"); // this leaks
|
||||||
addTemplate(m);
|
addTemplate(m);
|
||||||
array = new MathedArray; // this leaks
|
{
|
||||||
iter.SetData(array);
|
MathedArray * array = new MathedArray; // this leaks
|
||||||
|
MathedIter iter(array);
|
||||||
iter.insertInset(new MathAccentInset('O', LM_TC_RM, LM_not),
|
iter.insertInset(new MathAccentInset('O', LM_TC_RM, LM_not),
|
||||||
LM_TC_INSET); // this leaks
|
LM_TC_INSET); // this leaks
|
||||||
m->setData(array);
|
m->setData(array);
|
||||||
|
}
|
||||||
|
|
||||||
m = new MathMacroTemplate("perp"); // this leaks
|
m = new MathMacroTemplate("perp"); // this leaks
|
||||||
addTemplate(m);
|
addTemplate(m);
|
||||||
array = new MathedArray; // this leaks
|
{
|
||||||
iter.SetData(array);
|
MathedArray * array = new MathedArray; // this leaks
|
||||||
|
MathedIter iter(array);
|
||||||
iter.insert(LM_bot, LM_TC_BOP);
|
iter.insert(LM_bot, LM_TC_BOP);
|
||||||
m->setData(array);
|
m->setData(array);
|
||||||
|
}
|
||||||
|
|
||||||
// binom has two arguments
|
// binom has two arguments
|
||||||
m = new MathMacroTemplate("binom", 2);
|
m = new MathMacroTemplate("binom", 2);
|
||||||
addTemplate(m);
|
addTemplate(m);
|
||||||
array = new MathedArray;
|
{
|
||||||
|
MathedArray * array = new MathedArray;
|
||||||
m->setData(array);
|
m->setData(array);
|
||||||
iter.SetData(array);
|
MathedIter iter(array);
|
||||||
inset = new MathDelimInset('(', ')');
|
inset = new MathDelimInset('(', ')');
|
||||||
iter.insertInset(inset, LM_TC_ACTIVE_INSET);
|
iter.insertInset(inset, LM_TC_ACTIVE_INSET);
|
||||||
array = new MathedArray;
|
array = new MathedArray;
|
||||||
iter.SetData(array);
|
MathedIter iter2(array);
|
||||||
MathFracInset * frac = new MathFracInset(LM_OT_ATOP);
|
MathFracInset * frac = new MathFracInset(LM_OT_ATOP);
|
||||||
iter.insertInset(frac, LM_TC_ACTIVE_INSET);
|
iter2.insertInset(frac, LM_TC_ACTIVE_INSET);
|
||||||
inset->setData(array);
|
inset->setData(array);
|
||||||
array = new MathedArray;
|
array = new MathedArray;
|
||||||
array2 = new MathedArray;
|
MathedArray * array2 = new MathedArray;
|
||||||
iter.SetData(array);
|
MathedIter iter3(array);
|
||||||
iter.insertInset(m->getMacroPar(0), LM_TC_INSET);
|
iter3.insertInset(m->getMacroPar(0), LM_TC_INSET);
|
||||||
iter.SetData(array2);
|
MathedIter iter4(array2);
|
||||||
iter.insertInset(m->getMacroPar(1), LM_TC_INSET);
|
iter4.insertInset(m->getMacroPar(1), LM_TC_INSET);
|
||||||
frac->SetData(array, array2);
|
frac->SetData(array, array2);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Cases has 1 argument
|
// Cases has 1 argument
|
||||||
|
@ -35,8 +35,7 @@ MathMatrixInset::MathMatrixInset(MathMatrixInset * mt)
|
|||||||
nc_(mt->nc_), nr_(0), ws_(mt->nc_),
|
nc_(mt->nc_), nr_(0), ws_(mt->nc_),
|
||||||
v_align_(mt->v_align_), h_align_(mt->h_align_)
|
v_align_(mt->v_align_), h_align_(mt->h_align_)
|
||||||
{
|
{
|
||||||
MathedIter it;
|
MathedIter it(mt->GetData());
|
||||||
it.SetData(mt->GetData());
|
|
||||||
array = it.Copy();
|
array = it.Copy();
|
||||||
if (mt->row_ != 0) {
|
if (mt->row_ != 0) {
|
||||||
MathedRowSt * ro = 0;
|
MathedRowSt * ro = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user