2001-09-11 10:58:17 +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: 1996, 1997 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "math_atom.h"
|
2001-10-12 12:02:49 +00:00
|
|
|
#include "math_inset.h"
|
2001-09-11 10:58:17 +00:00
|
|
|
#include "support/LAssert.h"
|
|
|
|
|
|
|
|
|
|
|
|
MathAtom::MathAtom()
|
2001-10-12 12:02:49 +00:00
|
|
|
: nucleus_(0)
|
|
|
|
{}
|
2001-09-11 10:58:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
MathAtom::MathAtom(MathInset * p)
|
2001-10-12 12:02:49 +00:00
|
|
|
: nucleus_(p)
|
|
|
|
{}
|
2001-09-24 16:25:06 +00:00
|
|
|
|
2001-09-11 10:58:17 +00:00
|
|
|
|
|
|
|
MathAtom::MathAtom(MathAtom const & p)
|
|
|
|
{
|
|
|
|
copy(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathAtom::operator=(MathAtom const & p)
|
|
|
|
{
|
2001-11-15 09:51:57 +00:00
|
|
|
if (this == &p)
|
|
|
|
return;
|
|
|
|
done();
|
|
|
|
copy(p);
|
2001-09-11 10:58:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MathAtom::~MathAtom()
|
|
|
|
{
|
|
|
|
done();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
void MathAtom::reset(MathInset * p)
|
|
|
|
{
|
|
|
|
done();
|
|
|
|
nucleus_ = p;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-09-11 10:58:17 +00:00
|
|
|
void MathAtom::done()
|
|
|
|
{
|
|
|
|
delete nucleus_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathAtom::copy(MathAtom const & p)
|
|
|
|
{
|
|
|
|
//cerr << "calling MathAtom::copy\n";
|
|
|
|
nucleus_ = p.nucleus_;
|
|
|
|
if (nucleus_)
|
|
|
|
nucleus_ = nucleus_->clone();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-10-12 12:02:49 +00:00
|
|
|
MathInset * MathAtom::nucleus() const
|
2001-09-11 10:58:17 +00:00
|
|
|
{
|
2001-10-12 12:02:49 +00:00
|
|
|
lyx::Assert(nucleus_);
|
|
|
|
return nucleus_;
|
2001-09-11 10:58:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-10-12 12:02:49 +00:00
|
|
|
MathInset * MathAtom::operator->() const
|
2001-09-11 10:58:17 +00:00
|
|
|
{
|
2001-10-12 12:02:49 +00:00
|
|
|
return nucleus();
|
2001-09-11 10:58:17 +00:00
|
|
|
}
|