mathed35.diff

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1580 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-02-20 18:32:18 +00:00
parent 351c0e0e59
commit ff1cc2223d
5 changed files with 11 additions and 22 deletions

View File

@ -219,9 +219,9 @@ void MathedArray::insert(MathedArray::iterator pos,
last_ = bf_.size() - 1; last_ = bf_.size() - 1;
} }
#else #else
void MathedArray::mergeF(MathedArray * a, int p, int dx) void MathedArray::merge(MathedArray const & a, int p)
{ {
my_memcpy(&bf_[p], &a->bf_[0], dx); my_memcpy(&bf_[p], &a.bf_[0], a.last());
} }
#endif #endif

View File

@ -84,7 +84,7 @@ public:
#else #else
/// Merge \a dx elements from array \a a at \apos. /// Merge \a dx elements from array \a a at \apos.
/// This doesn't changes the size (dangerous) /// This doesn't changes the size (dangerous)
void mergeF(MathedArray * a, int pos, int dx); void merge(MathedArray const & a, int pos);
#endif #endif
/// ///
void raw_pointer_copy(MathedInset ** p, int pos) const; void raw_pointer_copy(MathedInset ** p, int pos) const;

View File

@ -844,7 +844,7 @@ bool MathedCursor::pullArg()
p->clear(); p->clear();
Delete(); Delete();
if (!a.empty()) { if (!a.empty()) {
cursor->Merge(&a); cursor->Merge(a);
cursor->Adjust(); cursor->Adjust();
} }
@ -947,7 +947,7 @@ void MathedCursor::SelPaste()
SelDel(); SelDel();
if (!selarray.empty()) { if (!selarray.empty()) {
cursor->Merge(&selarray); cursor->Merge(selarray);
cursor->Adjust(); cursor->Adjust();
} }
} }

View File

@ -139,27 +139,18 @@ void MathedXIter::Clean(int pos2)
} }
void MathedXIter::Merge(MathedArray * a0) void MathedXIter::Merge(MathedArray const & a)
{ {
if (!a0) {
lyxerr[Debug::MATHED]
<< "Math error: Attempting to merge a void array." << endl;
return;
}
// All insets must be clonned
MathedArray * a = new MathedArray(*a0);
#if 0 #if 0
array->insert(array->begin() + pos, array->insert(array->begin() + pos,
a->begin(), a->end()); a.begin(), a.end());
#else #else
// make room for the data // make room for the data
split(a->last()); split(a.last());
array->mergeF(a, pos, a->last()); array->merge(a, pos);
#endif #endif
int pos1 = pos; int pos1 = pos;
int pos2 = pos + a->last(); int pos2 = pos + a.last();
goPosAbs(pos1); goPosAbs(pos1);
@ -186,8 +177,6 @@ void MathedXIter::Merge(MathedArray * a0)
goPosAbs(pos1); goPosAbs(pos1);
checkTabs(); checkTabs();
goPosAbs(pos2); goPosAbs(pos2);
delete a;
} }

View File

@ -71,7 +71,7 @@ public:
/// ///
void setTab(int, int); void setTab(int, int);
/// Merge the array at current position /// Merge the array at current position
void Merge(MathedArray *); void Merge(MathedArray const &);
/// Delete every object from current position to pos2 /// Delete every object from current position to pos2
void Clean(int pos2); void Clean(int pos2);
/// ///