2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
2006-09-17 09:14:18 +00:00
|
|
|
|
* \file InsetMathFBox.C
|
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.
|
|
|
|
|
*/
|
|
|
|
|
|
2002-06-24 15:37:14 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
|
#include "InsetMathFBox.h"
|
|
|
|
|
#include "MathData.h"
|
|
|
|
|
#include "MathMLStream.h"
|
|
|
|
|
#include "MathParser.h"
|
|
|
|
|
#include "MathStream.h"
|
2003-09-16 09:01:15 +00:00
|
|
|
|
#include "LColor.h"
|
2004-08-13 13:19:58 +00:00
|
|
|
|
|
|
|
|
|
#include "support/std_ostream.h"
|
2002-06-24 15:37:14 +00:00
|
|
|
|
#include "frontends/Painter.h"
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2003-07-25 17:11:25 +00:00
|
|
|
|
using std::auto_ptr;
|
2002-06-24 15:37:14 +00:00
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathFBox::InsetMathFBox()
|
|
|
|
|
: InsetMathNest(1)
|
2002-06-24 15:37:14 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
auto_ptr<InsetBase> InsetMathFBox::doClone() const
|
2002-06-24 15:37:14 +00:00
|
|
|
|
{
|
2006-09-16 18:11:38 +00:00
|
|
|
|
return auto_ptr<InsetBase>(new InsetMathFBox(*this));
|
2002-06-24 15:37:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMath::mode_type InsetMathFBox::currentMode() const
|
2002-07-30 16:04:41 +00:00
|
|
|
|
{
|
2004-08-13 13:19:58 +00:00
|
|
|
|
return TEXT_MODE;
|
2002-07-30 16:04:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathFBox::metrics(MetricsInfo & mi, Dimension & dim) const
|
2002-06-24 15:37:14 +00:00
|
|
|
|
{
|
2004-08-13 13:19:58 +00:00
|
|
|
|
FontSetChanger dummy(mi.base, "textnormal");
|
|
|
|
|
cell(0).metrics(mi, dim);
|
2004-08-13 15:06:46 +00:00
|
|
|
|
metricsMarkers(dim, 3); // 1 pixel space, 1 frame, 1 space
|
2004-01-30 11:41:12 +00:00
|
|
|
|
dim_ = dim;
|
2002-06-24 15:37:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathFBox::draw(PainterInfo & pi, int x, int y) const
|
2002-06-24 15:37:14 +00:00
|
|
|
|
{
|
2003-05-28 13:22:36 +00:00
|
|
|
|
pi.pain.rectangle(x + 1, y - dim_.ascent() + 1,
|
|
|
|
|
dim_.width() - 2, dim_.height() - 2, LColor::foreground);
|
2004-08-13 13:19:58 +00:00
|
|
|
|
FontSetChanger dummy(pi.base, "textnormal");
|
2004-08-13 15:06:46 +00:00
|
|
|
|
cell(0).draw(pi, x + 3, y);
|
2004-04-07 16:54:15 +00:00
|
|
|
|
setPosCache(pi, x, y);
|
2002-06-24 15:37:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathFBox::write(WriteStream & os) const
|
2002-06-24 15:37:14 +00:00
|
|
|
|
{
|
2004-08-13 13:19:58 +00:00
|
|
|
|
os << "\\fbox{" << cell(0) << '}';
|
2002-06-24 15:37:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathFBox::normalize(NormalStream & os) const
|
2002-06-24 15:37:14 +00:00
|
|
|
|
{
|
2004-08-13 13:19:58 +00:00
|
|
|
|
os << "[fbox " << cell(0) << ']';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathFBox::infoize(std::ostream & os) const
|
2004-08-13 13:19:58 +00:00
|
|
|
|
{
|
|
|
|
|
os << "FBox: ";
|
2002-06-24 15:37:14 +00:00
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|