2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file math_dotsinset.C
|
|
|
|
|
* 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>
|
|
|
|
|
|
2001-02-13 13:28:32 +00:00
|
|
|
|
#include "math_dotsinset.h"
|
2001-11-08 12:06:56 +00:00
|
|
|
|
#include "math_mathmlstream.h"
|
2001-11-08 12:15:12 +00:00
|
|
|
|
#include "math_support.h"
|
2002-07-17 10:25:33 +00:00
|
|
|
|
#include "math_parser.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
|
|
|
|
|
2002-07-17 10:25:33 +00:00
|
|
|
|
MathDotsInset::MathDotsInset(latexkeys const * key)
|
|
|
|
|
: key_(key)
|
2001-06-25 00:06:33 +00:00
|
|
|
|
{}
|
2001-02-13 13:28:32 +00:00
|
|
|
|
|
|
|
|
|
|
2004-11-23 23:04:52 +00:00
|
|
|
|
auto_ptr<InsetBase> MathDotsInset::doClone() const
|
2001-02-13 13:28:32 +00:00
|
|
|
|
{
|
2003-07-25 17:11:25 +00:00
|
|
|
|
return auto_ptr<InsetBase>(new MathDotsInset(*this));
|
2002-03-21 17:42:56 +00:00
|
|
|
|
}
|
2001-02-13 13:28:32 +00:00
|
|
|
|
|
|
|
|
|
|
2003-06-02 10:03:27 +00:00
|
|
|
|
void MathDotsInset::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
|
|
|
|
|
|
|
|
|
|
2003-03-21 14:20:48 +00:00
|
|
|
|
void MathDotsInset::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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-08-05 07:09:11 +00:00
|
|
|
|
string MathDotsInset::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
|
|
|
|
}
|