mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
mathed41.diff
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1679 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f88cee29f6
commit
cb25ec231e
@ -1,5 +1,11 @@
|
||||
|
||||
2001-02-14 André Pönitz <poenitz@htwm.de>
|
||||
2001-03-06 André Pönitz <poenitz@htwm.de>
|
||||
* array.[Ch]: factor out deep_copy,
|
||||
remove third argument from raw_pointer_insert
|
||||
|
||||
* mathiter.[Ch]: remove unused function Clear()
|
||||
|
||||
2001-03-04 André Pönitz <poenitz@htwm.de>
|
||||
* math_macrotemplate.[Ch]:
|
||||
math_macro.C: move update() functionality to the macro
|
||||
|
||||
|
@ -60,13 +60,17 @@ MathedArray::MathedArray(MathedArray const & array)
|
||||
last_ = array.last_;
|
||||
|
||||
// deep copy
|
||||
// we'll not yet get exeption safety
|
||||
deep_copy();
|
||||
}
|
||||
|
||||
void MathedArray::deep_copy()
|
||||
{
|
||||
MathedIter it(this);
|
||||
while (it.OK()) {
|
||||
if (it.IsInset()) {
|
||||
MathedInset * inset = it.GetInset();
|
||||
inset = inset->Clone();
|
||||
raw_pointer_insert(inset, it.getPos() + 1, sizeof(inset));
|
||||
raw_pointer_insert(inset, it.getPos() + 1);
|
||||
}
|
||||
it.Next();
|
||||
}
|
||||
@ -200,18 +204,8 @@ void MathedArray::shrink(int pos1, int pos2)
|
||||
a.last(dx);
|
||||
a[dx] = '\0';
|
||||
|
||||
MathedIter it(&a);
|
||||
it.Reset();
|
||||
|
||||
while (it.OK()) {
|
||||
if (it.IsInset()) {
|
||||
MathedInset * inset = it.GetInset();
|
||||
inset = inset->Clone();
|
||||
a.raw_pointer_insert(inset, it.getPos() + 1, sizeof(inset));
|
||||
}
|
||||
it.Next();
|
||||
}
|
||||
swap(a);
|
||||
deep_copy();
|
||||
}
|
||||
|
||||
|
||||
@ -261,9 +255,9 @@ MathedInset * MathedArray::getInset(int pos)
|
||||
}
|
||||
|
||||
#else
|
||||
void MathedArray::raw_pointer_insert(void * p, int pos, int len)
|
||||
void MathedArray::raw_pointer_insert(void * p, int pos)
|
||||
{
|
||||
my_memcpy(&bf_[pos], &p, len);
|
||||
my_memcpy(&bf_[pos], &p, sizeof(p));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
MathedInset * getInset(int pos);
|
||||
#else
|
||||
///
|
||||
void raw_pointer_insert(void * p, int pos, int len);
|
||||
void raw_pointer_insert(void * p, int pos);
|
||||
#endif
|
||||
///
|
||||
void strange_copy(MathedArray * dest, int dpos, int spos, int len);
|
||||
@ -113,6 +113,8 @@ public:
|
||||
void need_size(int needed);
|
||||
///
|
||||
void dump(std::ostream &) const;
|
||||
/// creates copies of all embedded insets
|
||||
void deep_copy();
|
||||
private:
|
||||
/// Buffer
|
||||
buffer_type bf_;
|
||||
|
@ -325,7 +325,7 @@ void MathedIter::insertInset(MathedInset * p, int type)
|
||||
split(shift);
|
||||
|
||||
(*array)[pos] = type;
|
||||
array->raw_pointer_insert(p, pos + 1, sizeof(p));
|
||||
array->raw_pointer_insert(p, pos + 1);
|
||||
pos += SizeInset;
|
||||
(*array)[pos - 1] = type;
|
||||
(*array)[array->last()] = '\0';
|
||||
@ -376,27 +376,6 @@ bool MathedIter::Delete()
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void MathedIter::Clear()
|
||||
{
|
||||
if (!array) {
|
||||
lyxerr << "Math error: Attempting to clean a void array." << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
Reset();
|
||||
while (OK()) {
|
||||
if (IsInset()) {
|
||||
MathedInset * inset = GetInset();
|
||||
if (inset->GetType()!= LM_OT_MACRO_ARG)
|
||||
delete inset;
|
||||
Delete();
|
||||
} else
|
||||
Next();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check consistency of tabs and crs
|
||||
void MathedIter::checkTabs()
|
||||
{
|
||||
|
@ -110,8 +110,6 @@ public:
|
||||
void setNumCols(int n) { ncols = n; }
|
||||
///
|
||||
MathedArray * GetData() const;
|
||||
/// Copy every object from position p1 to p2
|
||||
void Clear();
|
||||
protected:
|
||||
///
|
||||
void split(int);
|
||||
|
Loading…
Reference in New Issue
Block a user