2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
2006-09-17 09:14:18 +00:00
|
|
|
|
* \file InsetMathDots.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 Alejandro Aguilar Sierra
|
|
|
|
|
* \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 "InsetMathDots.h"
|
|
|
|
|
#include "MathMLStream.h"
|
|
|
|
|
#include "MathSupport.h"
|
|
|
|
|
#include "MathParser.h"
|
2001-02-13 13:28:32 +00:00
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
|
|
|
|
|
|
using std::string;
|
2003-07-25 17:11:25 +00:00
|
|
|
|
using std::auto_ptr;
|
|
|
|
|
|
2001-02-13 13:28:32 +00:00
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathDots::InsetMathDots(latexkeys const * key)
|
2002-07-17 10:25:33 +00:00
|
|
|
|
: key_(key)
|
2001-06-25 00:06:33 +00:00
|
|
|
|
{}
|
2001-02-13 13:28:32 +00:00
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
auto_ptr<InsetBase> InsetMathDots::doClone() const
|
2001-02-13 13:28:32 +00:00
|
|
|
|
{
|
2006-09-16 18:11:38 +00:00
|
|
|
|
return auto_ptr<InsetBase>(new InsetMathDots(*this));
|
2002-03-21 17:42:56 +00:00
|
|
|
|
}
|
2001-02-13 13:28:32 +00:00
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathDots::metrics(MetricsInfo & mi, Dimension & dim) const
|
2002-03-19 16:55:58 +00:00
|
|
|
|
{
|
2004-04-08 15:20:05 +00:00
|
|
|
|
mathed_char_dim(mi.base.font, 'M', dim);
|
2002-12-09 09:52:43 +00:00
|
|
|
|
dh_ = 0;
|
|
|
|
|
if (key_->name == "cdots" || key_->name == "dotsb"
|
2002-07-17 10:25:33 +00:00
|
|
|
|
|| key_->name == "dotsm" || key_->name == "dotsi")
|
2004-04-08 15:20:05 +00:00
|
|
|
|
dh_ = dim.asc / 2;
|
2002-07-17 10:25:33 +00:00
|
|
|
|
else if (key_->name == "dotsc")
|
2004-04-08 15:20:05 +00:00
|
|
|
|
dh_ = dim.asc / 4;
|
2002-11-25 10:15:13 +00:00
|
|
|
|
else if (key_->name == "vdots") {
|
2004-04-08 15:20:05 +00:00
|
|
|
|
dim.wid = (dim.wid / 2) + 1;
|
|
|
|
|
dh_ = dim.asc;
|
2002-11-25 10:15:13 +00:00
|
|
|
|
}
|
2002-07-17 10:25:33 +00:00
|
|
|
|
else if (key_->name == "ddots")
|
2004-04-08 15:20:05 +00:00
|
|
|
|
dh_ = dim.asc;
|
|
|
|
|
dim_ = dim;
|
2002-03-21 17:42:56 +00:00
|
|
|
|
}
|
2002-03-19 16:55:58 +00:00
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathDots::draw(PainterInfo & pain, int x, int y) const
|
2001-02-13 13:28:32 +00:00
|
|
|
|
{
|
2003-05-28 13:22:36 +00:00
|
|
|
|
mathed_draw_deco(pain, x + 2, y - dh_, dim_.width() - 2, dim_.ascent(),
|
|
|
|
|
key_->name);
|
2002-07-17 10:25:33 +00:00
|
|
|
|
if (key_->name == "vdots" || key_->name == "ddots")
|
2001-04-25 15:43:57 +00:00
|
|
|
|
++x;
|
2002-07-17 10:25:33 +00:00
|
|
|
|
if (key_->name != "vdots")
|
2001-04-25 15:43:57 +00:00
|
|
|
|
--y;
|
2003-05-28 13:22:36 +00:00
|
|
|
|
mathed_draw_deco(pain, x + 2, y - dh_, dim_.width() - 2, dim_.ascent(),
|
|
|
|
|
key_->name);
|
2004-04-08 15:20:05 +00:00
|
|
|
|
setPosCache(pain, x, y);
|
2001-02-13 13:28:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
string InsetMathDots::name() const
|
2001-02-13 13:28:32 +00:00
|
|
|
|
{
|
2002-08-05 07:09:11 +00:00
|
|
|
|
return key_->name;
|
2001-04-25 15:43:57 +00:00
|
|
|
|
}
|