2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
2007-04-25 03:01:35 +00:00
|
|
|
|
* \file InsetMathBox.cpp
|
2003-08-19 13:00:56 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
|
|
|
|
|
2001-12-05 08:04:20 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
|
#include "InsetMathBox.h"
|
|
|
|
|
#include "MathData.h"
|
2006-10-22 10:15:23 +00:00
|
|
|
|
#include "MathStream.h"
|
2006-09-17 09:14:18 +00:00
|
|
|
|
#include "MathStream.h"
|
2003-09-05 17:23:11 +00:00
|
|
|
|
#include "support/std_ostream.h"
|
2001-10-19 11:25:48 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
|
using std::string;
|
2003-07-25 17:11:25 +00:00
|
|
|
|
using std::auto_ptr;
|
|
|
|
|
|
2002-01-03 12:02:54 +00:00
|
|
|
|
|
2006-10-22 10:15:23 +00:00
|
|
|
|
InsetMathBox::InsetMathBox(docstring const & name)
|
2006-09-16 18:11:38 +00:00
|
|
|
|
: InsetMathNest(1), name_(name)
|
2001-10-19 16:07:10 +00:00
|
|
|
|
{}
|
2001-10-19 11:25:48 +00:00
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
auto_ptr<InsetBase> InsetMathBox::doClone() const
|
2001-10-19 11:25:48 +00:00
|
|
|
|
{
|
2006-09-16 18:11:38 +00:00
|
|
|
|
return auto_ptr<InsetBase>(new InsetMathBox(*this));
|
2001-10-19 11:25:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathBox::write(WriteStream & os) const
|
2001-10-19 11:25:48 +00:00
|
|
|
|
{
|
2002-11-27 10:30:28 +00:00
|
|
|
|
os << '\\' << name_ << '{' << cell(0) << '}';
|
2001-10-19 11:25:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathBox::normalize(NormalStream & os) const
|
2001-10-19 11:25:48 +00:00
|
|
|
|
{
|
2001-12-18 12:21:33 +00:00
|
|
|
|
os << '[' << name_ << ' ';
|
2001-10-19 11:25:48 +00:00
|
|
|
|
//text_->write(buffer(), os);
|
|
|
|
|
os << "] ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-11-28 15:15:49 +00:00
|
|
|
|
bool InsetMathBox::metrics(MetricsInfo & mi, Dimension & dim) const
|
2001-10-19 11:25:48 +00:00
|
|
|
|
{
|
2003-03-21 14:20:48 +00:00
|
|
|
|
FontSetChanger dummy(mi.base, "textnormal");
|
2004-01-30 11:41:12 +00:00
|
|
|
|
cell(0).metrics(mi, dim);
|
|
|
|
|
metricsMarkers(dim);
|
2006-11-28 15:15:49 +00:00
|
|
|
|
if (dim_ == dim)
|
|
|
|
|
return false;
|
2004-01-30 11:41:12 +00:00
|
|
|
|
dim_ = dim;
|
2006-11-28 15:15:49 +00:00
|
|
|
|
return true;
|
2002-06-04 09:06:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathBox::draw(PainterInfo & pi, int x, int y) const
|
2002-06-04 09:06:04 +00:00
|
|
|
|
{
|
2003-03-21 14:20:48 +00:00
|
|
|
|
FontSetChanger dummy(pi.base, "textnormal");
|
2002-08-02 14:29:42 +00:00
|
|
|
|
cell(0).draw(pi, x, y);
|
2003-05-28 13:22:36 +00:00
|
|
|
|
drawMarkers(pi, x, y);
|
2001-10-24 19:09:31 +00:00
|
|
|
|
}
|
2002-07-10 07:15:36 +00:00
|
|
|
|
|
|
|
|
|
|
2006-10-22 10:15:23 +00:00
|
|
|
|
void InsetMathBox::infoize(odocstream & os) const
|
2002-07-10 07:15:36 +00:00
|
|
|
|
{
|
|
|
|
|
os << "Box: " << name_;
|
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|