2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
2006-09-17 09:14:18 +00:00
|
|
|
|
* \file InsetMathSize.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.
|
|
|
|
|
*/
|
|
|
|
|
|
2001-12-05 08:04:20 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
|
#include "InsetMathSize.h"
|
|
|
|
|
#include "MathData.h"
|
|
|
|
|
#include "MathParser.h"
|
|
|
|
|
#include "MathStream.h"
|
2004-11-07 13:27:20 +00:00
|
|
|
|
|
2005-01-27 21:05:44 +00:00
|
|
|
|
#include "support/convert.h"
|
2003-09-05 17:23:11 +00:00
|
|
|
|
#include "support/std_ostream.h"
|
2003-09-08 00:33:41 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2003-07-25 17:11:25 +00:00
|
|
|
|
using std::auto_ptr;
|
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathSize::InsetMathSize(latexkeys const * l)
|
|
|
|
|
: InsetMathNest(1), key_(l), style_(Styles(convert<int>(l->extra)))
|
2001-08-08 17:26:30 +00:00
|
|
|
|
{}
|
2001-06-25 00:06:33 +00:00
|
|
|
|
|
2001-06-27 15:33:55 +00:00
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
auto_ptr<InsetBase> InsetMathSize::doClone() const
|
2001-06-25 00:06:33 +00:00
|
|
|
|
{
|
2006-09-16 18:11:38 +00:00
|
|
|
|
return auto_ptr<InsetBase>(new InsetMathSize(*this));
|
2001-06-25 00:06:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-11-28 15:15:49 +00:00
|
|
|
|
bool InsetMathSize::metrics(MetricsInfo & mi, Dimension & dim) const
|
2001-06-25 00:06:33 +00:00
|
|
|
|
{
|
2003-03-21 14:20:48 +00:00
|
|
|
|
StyleChanger dummy(mi.base, style_);
|
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;
|
2001-06-25 00:06:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathSize::draw(PainterInfo & pi, int x, int y) const
|
2001-06-25 00:06:33 +00:00
|
|
|
|
{
|
2003-03-21 14:20:48 +00:00
|
|
|
|
StyleChanger dummy(pi.base, style_);
|
2002-08-02 14:29:42 +00:00
|
|
|
|
cell(0).draw(pi, x + 1, y);
|
2003-05-28 13:22:36 +00:00
|
|
|
|
drawMarkers(pi, x, y);
|
2001-06-25 00:06:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathSize::write(WriteStream & os) const
|
2001-06-25 00:06:33 +00:00
|
|
|
|
{
|
2001-12-05 08:04:20 +00:00
|
|
|
|
os << "{\\" << key_->name << ' ' << cell(0) << '}';
|
2001-06-25 00:06:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathSize::normalize(NormalStream & os) const
|
2001-06-25 00:06:33 +00:00
|
|
|
|
{
|
2002-11-27 10:30:28 +00:00
|
|
|
|
os << '[' << key_->name << ' ' << cell(0) << ']';
|
2001-06-25 00:06:33 +00:00
|
|
|
|
}
|
2002-07-10 06:52:05 +00:00
|
|
|
|
|
|
|
|
|
|
2006-10-22 10:15:23 +00:00
|
|
|
|
void InsetMathSize::infoize(odocstream & os) const
|
2002-07-10 06:52:05 +00:00
|
|
|
|
{
|
|
|
|
|
os << "Size: " << key_->name;
|
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|