1999-09-27 18:44:28 +00:00
|
|
|
/*
|
|
|
|
* File: math_inset.C
|
|
|
|
* Purpose: Implementation of insets for mathed
|
|
|
|
* Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
|
|
|
* Created: January 1996
|
|
|
|
* Description:
|
|
|
|
*
|
|
|
|
* Dependencies: Xlib, XForms
|
|
|
|
*
|
|
|
|
* Copyright: (c) 1996, Alejandro Aguilar Sierra
|
|
|
|
*
|
|
|
|
* Version: 0.8beta.
|
|
|
|
*
|
|
|
|
* You are free to use and modify this code under the terms of
|
|
|
|
* the GNU General Public Licence version 2 or later.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation "math_iter.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "math_iter.h"
|
|
|
|
#include "math_inset.h"
|
|
|
|
#include "symbol_def.h"
|
1999-10-02 16:21:10 +00:00
|
|
|
#include "support/lstrings.h"
|
1999-10-07 18:44:17 +00:00
|
|
|
#include "debug.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
const int SizeInset = sizeof(char*) + 2;
|
|
|
|
const int SizeFont = 2;
|
|
|
|
|
|
|
|
extern int mathed_char_width(short type, int style, byte c);
|
|
|
|
extern int mathed_string_width(short type, int style, byte const* s, int ls);
|
|
|
|
extern int mathed_char_height(short, int, byte, int&, int&);
|
|
|
|
|
1999-12-06 16:55:06 +00:00
|
|
|
// the builtin memcpy() is broken in egcs and gcc 2.95.x on alpha
|
|
|
|
// stations. We provide a hand-made version instead.
|
1999-12-07 00:44:53 +00:00
|
|
|
inline void my_memcpy( void * ps_in, const void * pt_in, size_t n )
|
1999-12-06 16:55:06 +00:00
|
|
|
{
|
1999-12-07 00:44:53 +00:00
|
|
|
char * ps = static_cast<char *>(ps_in);
|
|
|
|
char const * pt = static_cast<char const *>(pt_in);
|
|
|
|
/*
|
|
|
|
for(size_t i = n; i--;)
|
|
|
|
*ps++ = *pt++;
|
|
|
|
*/
|
|
|
|
while (n--) *ps++ = *pt++;
|
1999-12-06 16:55:06 +00:00
|
|
|
}
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
void MathedIter::Reset()
|
|
|
|
{
|
1999-12-07 00:44:53 +00:00
|
|
|
if (array->last > 0 && MathIsFont(array->bf[0])) {
|
1999-09-27 18:44:28 +00:00
|
|
|
fcode = array->bf[0];
|
|
|
|
pos = 1;
|
|
|
|
} else {
|
|
|
|
fcode = -1;
|
|
|
|
pos = 0;
|
|
|
|
}
|
|
|
|
col = row = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
byte MathedIter::GetChar()
|
|
|
|
{
|
|
|
|
if (IsFont()) {
|
|
|
|
fcode = array->bf[pos];
|
2000-01-24 18:34:46 +00:00
|
|
|
++pos;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
return array->bf[pos];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-01-24 18:34:46 +00:00
|
|
|
byte * MathedIter::GetString(int& len)
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
|
|
|
if (IsFont()) {
|
|
|
|
fcode = array->bf[++pos];
|
2000-01-24 18:34:46 +00:00
|
|
|
++pos;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
2000-01-24 18:34:46 +00:00
|
|
|
byte * s = &array->bf[pos];
|
1999-09-27 18:44:28 +00:00
|
|
|
len = pos;
|
2000-01-24 18:34:46 +00:00
|
|
|
while (array->bf[pos] >= ' ' && pos<array->last) ++pos;
|
1999-09-27 18:44:28 +00:00
|
|
|
len = pos-len;
|
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
MathedInset* MathedIter::GetInset()
|
|
|
|
{
|
|
|
|
if (IsInset()) {
|
2000-01-24 18:34:46 +00:00
|
|
|
MathedInset * p;
|
1999-12-06 16:55:06 +00:00
|
|
|
my_memcpy(&p, &array->bf[pos+1], sizeof(p));
|
1999-09-27 18:44:28 +00:00
|
|
|
return p;
|
|
|
|
} else {
|
1999-10-07 18:44:17 +00:00
|
|
|
lyxerr << "Math Error: This is not an inset["
|
|
|
|
<< array->bf[pos] << "]" << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// An active math inset MUST be derived from MathParInset because it
|
|
|
|
// must have at least one paragraph to edit
|
1999-12-13 00:05:34 +00:00
|
|
|
MathParInset * MathedIter::GetActiveInset()
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
|
|
|
if (IsActive()) {
|
1999-12-13 00:05:34 +00:00
|
|
|
return static_cast<MathParInset*>(GetInset());
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
1999-10-07 18:44:17 +00:00
|
|
|
lyxerr << "Math Error: This is not an active inset" << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MathedIter::Next()
|
|
|
|
{
|
|
|
|
if (!OK()) return false;
|
|
|
|
|
|
|
|
if (array->bf[pos]<' ') {
|
|
|
|
fcode = -1;
|
2000-01-24 18:34:46 +00:00
|
|
|
if (IsTab()) ++col;
|
1999-09-27 18:44:28 +00:00
|
|
|
if (IsCR()) {
|
|
|
|
col = 0;
|
2000-01-24 18:34:46 +00:00
|
|
|
++row;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (IsInset())
|
|
|
|
pos += sizeof(char*) + 2;
|
|
|
|
else
|
2000-01-24 18:34:46 +00:00
|
|
|
++pos;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
if (IsFont()) {
|
|
|
|
fcode = array->bf[pos++];
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MathedIter::goNextCode(MathedTextCodes code)
|
|
|
|
{
|
|
|
|
while (Next()) {
|
1999-11-15 11:06:41 +00:00
|
|
|
if (array->bf[pos] == code)
|
1999-09-27 18:44:28 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathedIter::goPosAbs(int p)
|
|
|
|
{
|
|
|
|
Reset();
|
|
|
|
while (pos<p && Next());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathedIter::goPosRel(int dp)
|
|
|
|
{
|
|
|
|
int posx = pos+dp;
|
|
|
|
|
|
|
|
// is posx a valid position?
|
|
|
|
if (dp<0)
|
|
|
|
Reset();
|
|
|
|
while (pos<posx && Next());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathedIter::Insert(byte c, MathedTextCodes t)
|
|
|
|
{
|
|
|
|
if (c<' ') return;
|
|
|
|
|
1999-11-15 11:06:41 +00:00
|
|
|
if (t == LM_TC_TAB && col>= ncols-1)
|
1999-09-27 18:44:28 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
// Never more than one space // array->bf[pos-1] gives error from purify:
|
|
|
|
// Reading 1 byte from 0x47b857 in the heap.
|
|
|
|
// Address 0x47b857 is 1 byte before start of malloc'd block at 0x47b858 of 16 bytes.
|
1999-11-15 11:06:41 +00:00
|
|
|
if (c == ' ' && (array->bf[pos] == ' ' || array->bf[pos-1] == ' '))
|
1999-09-27 18:44:28 +00:00
|
|
|
return;
|
|
|
|
|
1999-11-15 11:06:41 +00:00
|
|
|
if (IsFont() && array->bf[pos] == t) {
|
1999-09-27 18:44:28 +00:00
|
|
|
fcode = t;
|
2000-01-24 18:34:46 +00:00
|
|
|
++pos;
|
1999-09-27 18:44:28 +00:00
|
|
|
} else
|
1999-11-15 11:06:41 +00:00
|
|
|
if (t!= fcode && pos>0 && MathIsFont(array->bf[pos-1])) {
|
2000-01-24 18:34:46 +00:00
|
|
|
--pos;
|
|
|
|
int k = pos - 1;
|
|
|
|
for (; k >= 0 && array->bf[k]>= ' '; --k);
|
1999-09-27 18:44:28 +00:00
|
|
|
fcode = (k >= 0 && MathIsFont(array->bf[k])) ? array->bf[k]: -1;
|
|
|
|
}
|
|
|
|
short f = (array->bf[pos]<' ') ? 0: fcode;
|
1999-11-15 11:06:41 +00:00
|
|
|
int shift = (t == fcode) ? 1: ((f) ? 3: 2);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-15 11:06:41 +00:00
|
|
|
if (t == LM_TC_TAB || t == LM_TC_CR) {
|
2000-01-24 18:34:46 +00:00
|
|
|
--shift;
|
1999-09-27 18:44:28 +00:00
|
|
|
c = t;
|
1999-11-15 11:06:41 +00:00
|
|
|
if (t == LM_TC_CR) {
|
2000-01-24 18:34:46 +00:00
|
|
|
++row;
|
1999-09-27 18:44:28 +00:00
|
|
|
col = 0;
|
|
|
|
} else
|
2000-01-24 18:34:46 +00:00
|
|
|
++col;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pos < array->last)
|
|
|
|
array->Move(pos, shift);
|
|
|
|
else {
|
1999-11-15 11:06:41 +00:00
|
|
|
if (array->last+shift>= array->maxsize) {
|
1999-09-27 18:44:28 +00:00
|
|
|
array->Resize(array->last+shift);
|
|
|
|
}
|
|
|
|
array->last += shift;
|
|
|
|
array->bf[array->last] = '\0';
|
|
|
|
}
|
|
|
|
if (t != fcode) {
|
|
|
|
if (f)
|
|
|
|
array->bf[pos+shift-1] = fcode;
|
1999-11-15 11:06:41 +00:00
|
|
|
if (c>= ' ') {
|
1999-09-27 18:44:28 +00:00
|
|
|
array->bf[pos++] = t;
|
|
|
|
fcode = t;
|
|
|
|
} else {
|
|
|
|
fcode = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
array->bf[pos++] = c;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Prepare to insert a non-char object
|
|
|
|
void MathedIter::split(int shift)
|
|
|
|
{
|
|
|
|
if (pos < array->last) {
|
|
|
|
bool fg = false;
|
1999-11-15 11:06:41 +00:00
|
|
|
if (array->bf[pos]>= ' ') {
|
1999-09-27 18:44:28 +00:00
|
|
|
if (pos> 0 && MathIsFont(array->bf[pos-1]))
|
2000-01-24 18:34:46 +00:00
|
|
|
--pos;
|
1999-09-27 18:44:28 +00:00
|
|
|
else {
|
|
|
|
fg = true;
|
2000-01-24 18:34:46 +00:00
|
|
|
++shift;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
array->Move(pos, shift);
|
|
|
|
if (fg) array->bf[pos+shift-1] = fcode;
|
|
|
|
} else {
|
1999-11-15 11:06:41 +00:00
|
|
|
if (array->last+shift>= array->maxsize) {
|
1999-09-27 18:44:28 +00:00
|
|
|
array->Resize(array->last+shift);
|
|
|
|
}
|
|
|
|
array->last += shift;
|
|
|
|
}
|
|
|
|
array->bf[array->last] = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// I assume that both pos and pos2 are legal positions
|
|
|
|
void MathedIter::join(int pos2)
|
|
|
|
{
|
2000-01-24 18:34:46 +00:00
|
|
|
if (!OK() || pos2 <= pos)
|
1999-09-27 18:44:28 +00:00
|
|
|
return;
|
|
|
|
|
2000-01-24 18:34:46 +00:00
|
|
|
short f = fcode;
|
|
|
|
if (pos > 0 && array->bf[pos] >= ' ' && MathIsFont(array->bf[pos-1]))
|
|
|
|
--pos;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
if (MathIsFont(array->bf[pos2-1]))
|
2000-01-24 18:34:46 +00:00
|
|
|
--pos2;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-01-24 18:34:46 +00:00
|
|
|
if (array->bf[pos2] >= ' ') {
|
|
|
|
for (int p = pos2; p > 0; --p)
|
1999-09-27 18:44:28 +00:00
|
|
|
if (MathIsFont(array->bf[p])) {
|
|
|
|
f = array->bf[p];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
array->bf[pos++] = f;
|
|
|
|
}
|
|
|
|
|
|
|
|
array->Move(pos2, pos-pos2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MathedIter::Insert(MathedInset* p, int type)
|
|
|
|
{
|
|
|
|
int shift = SizeInset;
|
|
|
|
if (!MathIsInset(type))
|
|
|
|
type = LM_TC_INSET;
|
|
|
|
split(shift);
|
1999-12-06 16:55:06 +00:00
|
|
|
array->bf[pos] = type;
|
|
|
|
my_memcpy(&array->bf[pos+1], &p, sizeof(p));
|
1999-09-27 18:44:28 +00:00
|
|
|
pos += SizeInset;
|
1999-12-06 16:55:06 +00:00
|
|
|
array->bf[pos-1] = type;
|
1999-09-27 18:44:28 +00:00
|
|
|
array->bf[array->last] = '\0';
|
|
|
|
fcode = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MathedIter::Delete()
|
|
|
|
{
|
|
|
|
if (!OK())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
int shift = 0;
|
|
|
|
byte c = GetChar();
|
1999-11-15 11:06:41 +00:00
|
|
|
if (c>= ' ') {
|
1999-09-27 18:44:28 +00:00
|
|
|
if (MathIsFont(array->bf[pos-1]) && array->bf[pos+1]<' ') {
|
|
|
|
int i;
|
|
|
|
shift = 2;
|
2000-01-24 18:34:46 +00:00
|
|
|
--pos;
|
|
|
|
for (i = pos - 1; i > 0 && !MathIsFont(array->bf[i]); --i);
|
1999-09-27 18:44:28 +00:00
|
|
|
if (i>0 && MathIsFont(array->bf[i]))
|
|
|
|
fcode = array->bf[i];
|
|
|
|
} else
|
|
|
|
shift = 1;
|
|
|
|
} else {
|
|
|
|
if (MathIsInset(array->bf[pos]))
|
|
|
|
shift = sizeof(char*) + 2;
|
|
|
|
else
|
1999-11-15 11:06:41 +00:00
|
|
|
if (c == LM_TC_TAB || c == LM_TC_CR) {
|
2000-01-24 18:34:46 +00:00
|
|
|
++shift;
|
1999-10-07 18:44:17 +00:00
|
|
|
// lyxerr <<"Es un tab.";
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
else {
|
1999-10-07 18:44:17 +00:00
|
|
|
lyxerr << "Math Warning: expected inset." << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-11-15 11:06:41 +00:00
|
|
|
if (shift!= 0) {
|
1999-09-27 18:44:28 +00:00
|
|
|
array->Move(pos+shift, -shift);
|
1999-11-15 11:06:41 +00:00
|
|
|
if (pos>= array->last)
|
1999-09-27 18:44:28 +00:00
|
|
|
pos = (array->last>0) ? array->last: 0;
|
|
|
|
return true;
|
|
|
|
} else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LyxArrayBase *MathedIter::Copy(int pos1, int pos2)
|
|
|
|
{
|
|
|
|
if (!array) {
|
1999-10-07 18:44:17 +00:00
|
|
|
// lyxerr << "Math error: Attempting to copy a void array." << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// int posx = pos;
|
|
|
|
ipush();
|
2000-01-24 18:34:46 +00:00
|
|
|
LyxArrayBase * t = array, *a;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-01-24 18:34:46 +00:00
|
|
|
if (pos1 > 0 || pos2 <= array->last) {
|
1999-11-15 11:06:41 +00:00
|
|
|
short fc= 0;
|
1999-09-27 18:44:28 +00:00
|
|
|
if (pos1>0 && array->bf[pos1]>' ') {
|
2000-01-24 18:34:46 +00:00
|
|
|
for (int p = pos1; p >= 0; --p)
|
1999-09-27 18:44:28 +00:00
|
|
|
if (MathIsFont(array->bf[p])) {
|
1999-11-15 11:06:41 +00:00
|
|
|
if (p!= pos1-1)
|
1999-09-27 18:44:28 +00:00
|
|
|
fc = array->bf[p];
|
|
|
|
else
|
2000-01-24 18:34:46 +00:00
|
|
|
--pos1;
|
1999-09-27 18:44:28 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-01-24 18:34:46 +00:00
|
|
|
if (pos2 > 0 && array->bf[pos2] >= ' '
|
|
|
|
&& MathIsFont(array->bf[pos2-1]))
|
|
|
|
--pos2;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
int dx = pos2 - pos1;
|
|
|
|
a = new LyxArrayBase(dx+LyxArrayBase::ARRAY_MIN_SIZE);
|
1999-10-07 18:44:17 +00:00
|
|
|
// lyxerr << "VA " << pos2 << " " << pos2 << " " << dx << endl;
|
1999-12-06 16:55:06 +00:00
|
|
|
my_memcpy(&a->bf[(fc) ? 1: 0], &array->bf[pos1], dx);
|
1999-09-27 18:44:28 +00:00
|
|
|
if (fc) {
|
|
|
|
a->bf[0] = fc;
|
2000-01-24 18:34:46 +00:00
|
|
|
++dx;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
a->last = dx;
|
|
|
|
a->bf[dx] = '\0';
|
|
|
|
} else
|
|
|
|
a = new LyxArrayBase(*array);
|
|
|
|
SetData(a);
|
|
|
|
while (OK()) {
|
|
|
|
if (IsInset()) {
|
|
|
|
MathedInset* inset = GetInset();
|
|
|
|
inset = inset->Clone();
|
1999-12-06 16:55:06 +00:00
|
|
|
my_memcpy(&array->bf[pos+1], &inset, sizeof(inset));
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
Next();
|
|
|
|
}
|
|
|
|
// pos = posx;
|
|
|
|
array = t;
|
|
|
|
ipop();
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathedIter::Clear()
|
|
|
|
{
|
|
|
|
if (!array) {
|
1999-10-07 18:44:17 +00:00
|
|
|
lyxerr << "Math error: Attempting to clean a void array." << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
Reset();
|
|
|
|
while (OK()) {
|
|
|
|
if (IsInset()) {
|
2000-01-25 12:35:27 +00:00
|
|
|
MathedInset * inset = GetInset();
|
1999-11-15 11:06:41 +00:00
|
|
|
if (inset->GetType()!= LM_OT_MACRO_ARG)
|
1999-09-27 18:44:28 +00:00
|
|
|
delete inset;
|
|
|
|
Delete();
|
|
|
|
} else
|
|
|
|
Next();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Check consistency of tabs and crs
|
|
|
|
void MathedIter::checkTabs()
|
|
|
|
{
|
|
|
|
ipush();
|
|
|
|
|
|
|
|
// MathedIter:Reset();
|
|
|
|
while (OK()) {
|
1999-11-15 11:06:41 +00:00
|
|
|
if ((IsTab() && col>= ncols-1) || (IsCR() && !(MthIF_CR&flags))) {
|
1999-09-27 18:44:28 +00:00
|
|
|
Delete();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (IsCR() && col<ncols-2) {
|
|
|
|
Insert(' ', LM_TC_TAB);
|
|
|
|
}
|
|
|
|
MathedIter::Next();
|
|
|
|
}
|
|
|
|
if (col<ncols-2) {
|
|
|
|
Insert(' ', LM_TC_TAB);
|
|
|
|
}
|
|
|
|
ipop();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Try to adjust tabs in the expected place, as used in eqnarrays
|
|
|
|
// Rules:
|
|
|
|
// - If there are a relation operator, put tabs around it
|
|
|
|
// - If tehre are not a relation operator, put everything in the
|
|
|
|
// 3rd column.
|
|
|
|
void MathedIter::adjustTabs()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathedXIter::Clean(int pos2)
|
|
|
|
{
|
|
|
|
if (!array) {
|
1999-10-07 18:44:17 +00:00
|
|
|
lyxerr << "Math error: Attempting to clean a void array." << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int pos1 = pos;
|
|
|
|
|
|
|
|
if (pos2<pos1) {
|
|
|
|
GoBegin();
|
|
|
|
while (pos<pos2 && OK()) { Next();
|
|
|
|
}
|
|
|
|
pos2 = pos1;
|
|
|
|
pos1 = pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
ipush();
|
|
|
|
while (OK() && pos<pos2) {
|
|
|
|
if (IsInset()) {
|
|
|
|
MathedInset* inset = GetInset();
|
|
|
|
Next();
|
1999-11-15 11:06:41 +00:00
|
|
|
if (inset->GetType()!= LM_OT_MACRO_ARG)
|
1999-09-27 18:44:28 +00:00
|
|
|
delete inset;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (IsCR()) {
|
|
|
|
if (crow) {
|
|
|
|
MathedRowSt *r = crow->next;
|
|
|
|
if (r) {
|
|
|
|
crow->next = r->next;
|
|
|
|
delete r;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Next();
|
|
|
|
}
|
|
|
|
ipop();
|
|
|
|
|
1999-11-15 11:06:41 +00:00
|
|
|
if (pos2<= array->Last()) {
|
1999-09-27 18:44:28 +00:00
|
|
|
pos = pos1;
|
|
|
|
join(pos2);
|
|
|
|
checkTabs();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathedXIter::Merge(LyxArrayBase *a0)
|
|
|
|
{
|
|
|
|
if (!a0) {
|
1999-10-07 18:44:17 +00:00
|
|
|
lyxerr[Debug::MATHED]
|
|
|
|
<< "Math error: Attempting to merge a void array." << endl;
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// All insets must be clonned
|
|
|
|
MathedIter it(a0);
|
|
|
|
LyxArrayBase *a = it.Copy();
|
|
|
|
|
|
|
|
// make rom for the data
|
|
|
|
split(a->Last());
|
|
|
|
array->MergeF(a, pos, a->Last());
|
|
|
|
|
1999-11-15 11:06:41 +00:00
|
|
|
int pos1= pos, pos2 = pos + a->Last(); // pos3= 0;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
goPosAbs(pos1);
|
|
|
|
|
|
|
|
// Complete rows
|
|
|
|
while (pos<pos2 && OK()) {
|
|
|
|
if (IsCR()) {
|
|
|
|
if (p && p->Permit(LMPF_ALLOW_CR)) {
|
|
|
|
MathedRowSt *r = new MathedRowSt(ncols+1);
|
|
|
|
if (crow) {
|
|
|
|
r->next = crow->next;
|
|
|
|
crow->next = r;
|
|
|
|
} else {
|
|
|
|
r->next = 0;
|
|
|
|
}
|
|
|
|
crow = r;
|
|
|
|
} else {
|
|
|
|
Delete();
|
2000-01-25 12:35:27 +00:00
|
|
|
--pos2;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Next();
|
|
|
|
}
|
|
|
|
pos2 = getPos();
|
|
|
|
goPosAbs(pos1);
|
|
|
|
checkTabs();
|
|
|
|
goPosAbs(pos2);
|
|
|
|
|
|
|
|
delete a;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//----------- XIter
|
|
|
|
|
|
|
|
|
|
|
|
MathedXIter::MathedXIter(MathParInset* pp): p(pp)
|
|
|
|
{
|
|
|
|
x = y = 0;
|
|
|
|
sx = sw = 0;
|
|
|
|
limits = false;
|
|
|
|
s_type = 0;
|
|
|
|
if (p)
|
|
|
|
SetData(p);
|
|
|
|
else {
|
|
|
|
crow = 0;
|
|
|
|
size = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MathedXIter::SetData(MathParInset *pp)
|
|
|
|
{
|
|
|
|
p = pp;
|
|
|
|
x = y = 0;
|
|
|
|
array = p->GetData();
|
|
|
|
ncols = p->GetColumns();
|
|
|
|
crow = p->getRowSt();
|
|
|
|
if (p->Permit(LMPF_ALLOW_CR))
|
|
|
|
flags |= MthIF_CR;
|
|
|
|
if (p->Permit(LMPF_ALLOW_TAB))
|
|
|
|
flags |= MthIF_Tabs;
|
|
|
|
|
|
|
|
if (crow) {
|
|
|
|
x = crow->getTab(0);
|
|
|
|
y = crow->getBaseline();
|
|
|
|
}
|
|
|
|
if (!array) {
|
|
|
|
array = new LyxArrayBase; // this leaks
|
|
|
|
p->SetData(array);
|
|
|
|
}
|
|
|
|
size = p->GetStyle();
|
|
|
|
Reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
byte* MathedXIter::GetString(int& ls)
|
|
|
|
{
|
|
|
|
static byte s[255];
|
1999-11-04 01:40:20 +00:00
|
|
|
byte const *sxs = MathedIter::GetString(ls);
|
1999-09-27 18:44:28 +00:00
|
|
|
if (ls>0) {
|
1999-11-04 01:40:20 +00:00
|
|
|
strncpy(reinterpret_cast<char*>(s), reinterpret_cast<const char*>(sxs), ls);
|
1999-09-27 18:44:28 +00:00
|
|
|
x += mathed_string_width(fcode, size, s, ls);
|
|
|
|
return &s[0];
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MathedXIter::Next()
|
|
|
|
{
|
1999-10-07 18:44:17 +00:00
|
|
|
// lyxerr << "Ne[" << pos << "]";
|
1999-09-27 18:44:28 +00:00
|
|
|
if (!OK()) return false;
|
1999-11-15 11:06:41 +00:00
|
|
|
int w= 0;
|
1999-10-07 18:44:17 +00:00
|
|
|
// lyxerr << "xt ";
|
1999-09-27 18:44:28 +00:00
|
|
|
if (IsInset()) {
|
|
|
|
MathedInset* px = GetInset();
|
|
|
|
w = px->Width();
|
1999-11-15 11:06:41 +00:00
|
|
|
if (px->GetType() == LM_OT_SCRIPT) {
|
1999-09-27 18:44:28 +00:00
|
|
|
if (w>sw) sw = w;
|
|
|
|
w = 0;
|
|
|
|
} else
|
|
|
|
sx = (px->GetLimits()) ? w: 0;
|
|
|
|
} else {
|
|
|
|
byte c = GetChar();
|
1999-11-15 11:06:41 +00:00
|
|
|
if (c>= ' ') {
|
1999-10-07 18:44:17 +00:00
|
|
|
// lyxerr << "WD[" << fcode << " " << size << " " << c << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
w = mathed_char_width(fcode, size, c);
|
|
|
|
} else
|
1999-11-15 11:06:41 +00:00
|
|
|
if (c == LM_TC_TAB && p) {
|
1999-09-27 18:44:28 +00:00
|
|
|
// w = p->GetTab(col+1);
|
|
|
|
w = (crow) ? crow->getTab(col+1): 0;
|
1999-10-07 18:44:17 +00:00
|
|
|
//lyxerr << "WW[" << w << "]";
|
1999-09-27 18:44:28 +00:00
|
|
|
} else
|
1999-11-15 11:06:41 +00:00
|
|
|
if (c == LM_TC_CR && p) {
|
1999-09-27 18:44:28 +00:00
|
|
|
x = 0;
|
|
|
|
if (crow && crow->next) {
|
|
|
|
crow = crow->next;
|
|
|
|
y = crow->getBaseline();
|
|
|
|
w = crow->getTab(0);
|
|
|
|
}
|
1999-10-07 18:44:17 +00:00
|
|
|
// lyxerr << "WW[" << col " " << row << "|" << w << "]";
|
1999-09-27 18:44:28 +00:00
|
|
|
} else
|
1999-10-07 18:44:17 +00:00
|
|
|
lyxerr << "No hubo w[" << c << "]!";
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
if (MathedIter::Next()) {
|
1999-10-07 18:44:17 +00:00
|
|
|
// lyxerr <<"LNX " << pos << endl;
|
1999-11-15 11:06:41 +00:00
|
|
|
// if (sw>0 && GetChar()!= LM_TC_UP && GetChar()!= LM_TC_DOWN) {
|
1999-09-27 18:44:28 +00:00
|
|
|
// w = (sx>sw) ? 0: sw-sx;
|
1999-11-15 11:06:41 +00:00
|
|
|
if ((sw>0 || sx>0) && GetChar()!= LM_TC_UP && GetChar()!= LM_TC_DOWN) {
|
1999-09-27 18:44:28 +00:00
|
|
|
if (sw>0)
|
|
|
|
w = (sx>sw) ? 0: sw-sx;
|
|
|
|
sx = sw = 0;
|
|
|
|
}
|
|
|
|
x += w;
|
|
|
|
return true;
|
|
|
|
} else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathedXIter::GoBegin()
|
|
|
|
{
|
|
|
|
Reset();
|
|
|
|
x = y = 0;
|
|
|
|
sw = sx = 0;
|
|
|
|
if (p) {
|
|
|
|
crow = p->getRowSt();
|
|
|
|
if (crow) {
|
|
|
|
x = crow->getTab(0);
|
|
|
|
y = crow->getBaseline();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MathedXIter::GoLast()
|
|
|
|
{
|
|
|
|
while (Next());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathedXIter::Adjust()
|
|
|
|
{
|
|
|
|
int posx = pos;
|
|
|
|
GoBegin();
|
|
|
|
while (posx>pos && OK()) Next();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MathedXIter::Prev()
|
|
|
|
{
|
1999-11-15 11:06:41 +00:00
|
|
|
if (pos == 0 || (pos == 1 && GetChar()>= ' '))
|
1999-09-27 18:44:28 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
int pos2 = pos; // pos1
|
|
|
|
GoBegin();
|
|
|
|
do {
|
|
|
|
ipush();
|
|
|
|
Next();
|
|
|
|
} while (pos<pos2);
|
|
|
|
ipop();
|
|
|
|
|
|
|
|
return (!IsCR());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MathedXIter::goNextColumn()
|
|
|
|
{
|
1999-11-15 11:06:41 +00:00
|
|
|
int rowp = row, colp= col;
|
|
|
|
while (Next() && col == colp);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
1999-11-15 11:06:41 +00:00
|
|
|
return (col!= colp+1 || rowp!= row);
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MathedXIter::Up()
|
|
|
|
{
|
1999-11-15 11:06:41 +00:00
|
|
|
if (row == 0) return false;
|
|
|
|
int xp = x, rowp = row, colp= col;
|
1999-09-27 18:44:28 +00:00
|
|
|
GoBegin();
|
|
|
|
while (row<rowp-1) Next();
|
|
|
|
while (x<xp && OK() && !IsCR()) {
|
|
|
|
ipush();
|
|
|
|
Next();
|
|
|
|
}
|
1999-11-15 11:06:41 +00:00
|
|
|
if (col>colp) // || (stck.col == colp && stck.x<= xp && x>xp))
|
1999-09-27 18:44:28 +00:00
|
|
|
ipop();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MathedXIter::Down()
|
|
|
|
{
|
1999-11-15 11:06:41 +00:00
|
|
|
int xp = x, colp= col; // , rowp = row
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
bool res = (IsCR()) ? true: goNextCode(LM_TC_CR);
|
|
|
|
if (res) {
|
|
|
|
Next();
|
|
|
|
ipush();
|
|
|
|
while (x<xp && OK()) {
|
|
|
|
ipush();
|
|
|
|
Next();
|
|
|
|
}
|
1999-11-15 11:06:41 +00:00
|
|
|
if (col>colp || (stck.col == colp && stck.x<= xp && x>xp))
|
1999-09-27 18:44:28 +00:00
|
|
|
ipop();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathedXIter::addRow()
|
|
|
|
{
|
|
|
|
if (!crow) {
|
1999-10-07 18:44:17 +00:00
|
|
|
lyxerr[Debug::MATHED] << "MathErr: Attempt to insert new"
|
|
|
|
" line in a subparagraph. " << this << endl;
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// Create new item for the structure
|
|
|
|
MathedRowSt *r = new MathedRowSt(ncols+1);
|
|
|
|
if (crow) {
|
|
|
|
r->next = crow->next;
|
|
|
|
crow->next = r;
|
|
|
|
} else {
|
|
|
|
crow = r;
|
|
|
|
r->next = 0;
|
|
|
|
}
|
|
|
|
// Fill missed tabs in current row
|
|
|
|
while (col<ncols-1)
|
|
|
|
Insert('T', LM_TC_TAB);
|
|
|
|
//newline
|
|
|
|
Insert('K', LM_TC_CR);
|
|
|
|
|
|
|
|
ipush();
|
|
|
|
if (!IsCR())
|
|
|
|
goNextCode(LM_TC_CR);
|
|
|
|
|
|
|
|
// Fill missed tabs in new row
|
|
|
|
while (col<ncols-1)
|
|
|
|
Insert('T', LM_TC_TAB);
|
|
|
|
ipop();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathedXIter::delRow()
|
|
|
|
{
|
|
|
|
if (!crow) {
|
1999-10-07 18:44:17 +00:00
|
|
|
lyxerr[Debug::MATHED] << "MathErr: Attempt to delete a line in a subparagraph." << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
bool line_empty = true;
|
|
|
|
ipush();
|
|
|
|
// while (Next()) {
|
|
|
|
do {
|
|
|
|
if (IsCR()){
|
|
|
|
break;
|
|
|
|
} else if (!IsTab()) {
|
|
|
|
line_empty = false;
|
|
|
|
}
|
|
|
|
} while (Next());
|
|
|
|
int p1 = getPos();
|
|
|
|
ipop();
|
|
|
|
|
|
|
|
if (line_empty) {
|
|
|
|
|
|
|
|
MathedRowSt *r = crow->next;
|
|
|
|
if (r) {
|
|
|
|
crow->next = r->next;
|
|
|
|
delete r;
|
|
|
|
}
|
|
|
|
join(p1);
|
|
|
|
Delete();
|
|
|
|
} else
|
|
|
|
Clean(p1);
|
|
|
|
|
|
|
|
checkTabs();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MathedXIter::ipush()
|
|
|
|
{
|
|
|
|
MathedIter::ipush();
|
|
|
|
stck.x = x;
|
|
|
|
stck.y = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathedXIter::ipop()
|
|
|
|
{
|
|
|
|
MathedIter::ipop();
|
|
|
|
x = stck.x;
|
|
|
|
y = stck.y;
|
|
|
|
if (p) {
|
|
|
|
crow = p->getRowSt();
|
|
|
|
if (crow)
|
2000-01-24 18:34:46 +00:00
|
|
|
for (int i = 0; i < row; ++i)
|
1999-09-27 18:44:28 +00:00
|
|
|
crow = crow->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathedXIter::fitCoord(int /*xx*/, int yy)
|
|
|
|
{
|
|
|
|
int xo = 0, yo = 0;
|
|
|
|
|
|
|
|
GoBegin();
|
|
|
|
if (p)
|
|
|
|
p->GetXY(xo, yo);
|
|
|
|
// first fit vertically
|
|
|
|
while (crow && OK()) {
|
1999-11-15 11:06:41 +00:00
|
|
|
if (yy>= yo+y-crow->asc && yy<= yo+y+crow->desc)
|
1999-09-27 18:44:28 +00:00
|
|
|
break;
|
|
|
|
goNextCode(LM_TC_CR);
|
|
|
|
Next();
|
|
|
|
}
|
|
|
|
// now horizontally
|
|
|
|
// while (x<xx && Next());
|
|
|
|
}
|
|
|
|
|
|
|
|
void MathedXIter::setTab(int tx, int tab)
|
|
|
|
{
|
1999-11-15 11:06:41 +00:00
|
|
|
if (crow && tab<= ncols) {
|
1999-09-27 18:44:28 +00:00
|
|
|
crow->w[tab] = tx;
|
|
|
|
}
|
|
|
|
else
|
1999-10-07 18:44:17 +00:00
|
|
|
lyxerr << "MathErr: No tabs allowed here" << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathedXIter::subMetrics(int a, int d)
|
|
|
|
{
|
|
|
|
if (!crow) {
|
1999-10-07 18:44:17 +00:00
|
|
|
// lyxerr << "MathErr: Attempt to submetric a subparagraph." << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
crow->asc = a;
|
|
|
|
crow->desc = d;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// This function is not recursive, as MathPar::Metrics is
|
|
|
|
void MathedXIter::IMetrics(int pos2, int& width, int& ascent, int& descent)
|
|
|
|
{
|
1999-11-15 11:06:41 +00:00
|
|
|
byte cx, cxp= 0;// *s;
|
1999-09-27 18:44:28 +00:00
|
|
|
int x1;// ls;
|
1999-11-15 11:06:41 +00:00
|
|
|
int asc= 0, des= 0;
|
1999-11-04 01:40:20 +00:00
|
|
|
bool limit = false;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
descent = ascent = width = 0;
|
|
|
|
if (!array) return;
|
1999-12-01 00:57:31 +00:00
|
|
|
if (array->empty()) return;
|
1999-09-27 18:44:28 +00:00
|
|
|
// if (pos2 > array->last) return;
|
|
|
|
x1 = x;
|
|
|
|
while (pos<pos2) {
|
|
|
|
cx = GetChar();
|
|
|
|
if (cx >= ' ') {
|
|
|
|
mathed_char_height(FCode(), size, cx, asc, des);
|
|
|
|
if (asc > ascent) ascent = asc;
|
|
|
|
if (des > descent) descent = des;
|
1999-11-04 01:40:20 +00:00
|
|
|
limit = false;
|
1999-09-27 18:44:28 +00:00
|
|
|
} else
|
|
|
|
if (MathIsInset(cx)) {
|
|
|
|
MathedInset *pp = GetInset();
|
1999-11-15 11:06:41 +00:00
|
|
|
if (cx == LM_TC_UP) {
|
1999-09-27 18:44:28 +00:00
|
|
|
if (!asc && p) {
|
|
|
|
int xx, yy;
|
|
|
|
p->GetXY(xx, yy);
|
1999-11-04 01:40:20 +00:00
|
|
|
static_cast<MathParInset*>(pp)->GetXY(xx, asc);
|
1999-09-27 18:44:28 +00:00
|
|
|
asc = yy - asc;
|
|
|
|
}
|
|
|
|
asc += ((limits) ? pp->Height()+4: pp->Ascent());
|
|
|
|
} else
|
1999-11-15 11:06:41 +00:00
|
|
|
if (cx == LM_TC_DOWN) {
|
1999-09-27 18:44:28 +00:00
|
|
|
if (!des && p) {
|
|
|
|
int xx, yy;
|
|
|
|
p->GetXY(xx, yy);
|
1999-11-04 01:40:20 +00:00
|
|
|
static_cast<MathParInset*>(pp)->GetXY(xx, des);
|
1999-09-27 18:44:28 +00:00
|
|
|
if (des-pp->Height()<yy && !asc)
|
|
|
|
asc = yy - (des-pp->Height());
|
|
|
|
des -= yy;
|
|
|
|
}
|
1999-11-04 01:40:20 +00:00
|
|
|
des += (limit ? pp->Height()+4: pp->Height()-pp->Ascent()/2);
|
1999-09-27 18:44:28 +00:00
|
|
|
} else {
|
|
|
|
asc = pp->Ascent();
|
|
|
|
des = pp->Descent();
|
|
|
|
}
|
|
|
|
if (asc > ascent) ascent = asc;
|
|
|
|
if (des > descent) descent = des;
|
1999-11-15 11:06:41 +00:00
|
|
|
if (cx!= LM_TC_UP && cx!= LM_TC_DOWN)
|
1999-11-04 01:40:20 +00:00
|
|
|
limit = pp->GetLimits();
|
1999-09-27 18:44:28 +00:00
|
|
|
} else
|
1999-11-15 11:06:41 +00:00
|
|
|
if (cx == LM_TC_TAB) {
|
1999-11-04 01:40:20 +00:00
|
|
|
limit = false;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
else {
|
1999-10-07 18:44:17 +00:00
|
|
|
lyxerr[Debug::MATHED]
|
|
|
|
<< "Mathed Sel-Error: Unrecognized code["
|
|
|
|
<< cx << ']' << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
break;
|
|
|
|
}
|
1999-11-04 01:40:20 +00:00
|
|
|
if (pos < pos2) Next();
|
1999-09-27 18:44:28 +00:00
|
|
|
cxp = cx;
|
|
|
|
}
|
|
|
|
width = x - x1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MathedXIter::setNumbered(bool numb)
|
|
|
|
{
|
|
|
|
if (crow) {
|
|
|
|
crow->setNumbered(numb);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MathedXIter::setLabel(char* label)
|
|
|
|
{
|
|
|
|
if (label && crow) {
|
|
|
|
crow->setLabel(label);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MathedRowSt *MathedXIter::adjustVerticalSt()
|
|
|
|
{
|
|
|
|
GoBegin();
|
|
|
|
if (!crow) {
|
1999-10-07 18:44:17 +00:00
|
|
|
// lyxerr << " CRW" << ncols << " ";
|
1999-09-27 18:44:28 +00:00
|
|
|
crow = new MathedRowSt(ncols+1); // this leaks
|
|
|
|
}
|
1999-10-07 18:44:17 +00:00
|
|
|
// lyxerr<< " CRW[" << crow << "] ";
|
1999-11-04 01:40:20 +00:00
|
|
|
MathedRowSt *mrow = crow;
|
1999-09-27 18:44:28 +00:00
|
|
|
while (OK()) {
|
|
|
|
if (IsCR()) {
|
1999-11-15 11:06:41 +00:00
|
|
|
if (col>= ncols) ncols = col+1;
|
1999-09-27 18:44:28 +00:00
|
|
|
MathedRowSt *r = new MathedRowSt(ncols+1); // this leaks
|
|
|
|
// r->next = crow->next;
|
|
|
|
crow->next = r;
|
|
|
|
crow = r;
|
1999-10-07 18:44:17 +00:00
|
|
|
// lyxerr << " CX[" << crow << "]";
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
Next();
|
|
|
|
}
|
1999-11-04 01:40:20 +00:00
|
|
|
return mrow;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|