2003-09-12 10:14:31 +00:00
|
|
|
|
/**
|
2007-04-25 03:01:35 +00:00
|
|
|
|
* \file InsetMathBoldSymbol.cpp
|
2003-09-12 10:14:31 +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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2006-09-17 09:14:18 +00:00
|
|
|
|
#include "InsetMathBoldSymbol.h"
|
2007-11-06 21:45:24 +00:00
|
|
|
|
|
2006-10-22 10:15:23 +00:00
|
|
|
|
#include "MathStream.h"
|
2007-04-26 16:05:57 +00:00
|
|
|
|
#include "MathData.h"
|
2003-09-12 10:14:31 +00:00
|
|
|
|
#include "LaTeXFeatures.h"
|
2007-11-06 21:45:24 +00:00
|
|
|
|
|
2008-05-06 10:36:32 +00:00
|
|
|
|
#include <ostream>
|
|
|
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2008-03-12 14:33:16 +00:00
|
|
|
|
InsetMathBoldSymbol::InsetMathBoldSymbol(Kind kind)
|
|
|
|
|
: InsetMathNest(1), kind_(kind)
|
2003-09-12 10:14:31 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2007-08-30 18:03:17 +00:00
|
|
|
|
Inset * InsetMathBoldSymbol::clone() const
|
2003-09-12 10:14:31 +00:00
|
|
|
|
{
|
2007-08-30 18:03:17 +00:00
|
|
|
|
return new InsetMathBoldSymbol(*this);
|
2003-09-12 10:14:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-09-21 20:39:47 +00:00
|
|
|
|
void InsetMathBoldSymbol::metrics(MetricsInfo & mi, Dimension & dim) const
|
2003-09-12 10:14:31 +00:00
|
|
|
|
{
|
|
|
|
|
//FontSetChanger dummy(mi.base, "mathbf");
|
|
|
|
|
cell(0).metrics(mi, dim);
|
2004-01-30 11:41:12 +00:00
|
|
|
|
metricsMarkers(dim);
|
2003-09-12 10:14:31 +00:00
|
|
|
|
++dim.wid; // for 'double stroke'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathBoldSymbol::draw(PainterInfo & pi, int x, int y) const
|
2003-09-12 10:14:31 +00:00
|
|
|
|
{
|
|
|
|
|
//FontSetChanger dummy(pi.base, "mathbf");
|
|
|
|
|
cell(0).draw(pi, x + 1, y);
|
|
|
|
|
cell(0).draw(pi, x + 2, y);
|
|
|
|
|
drawMarkers(pi, x, y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathBoldSymbol::metricsT(TextMetricsInfo const & mi, Dimension & /*dim*/) const
|
2003-09-12 10:14:31 +00:00
|
|
|
|
{
|
2007-09-23 22:39:49 +00:00
|
|
|
|
// FIXME: BROKEN!
|
|
|
|
|
Dimension dim;
|
|
|
|
|
cell(0).metricsT(mi, dim);
|
2003-09-12 10:14:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathBoldSymbol::drawT(TextPainter & pain, int x, int y) const
|
2003-09-12 10:14:31 +00:00
|
|
|
|
{
|
|
|
|
|
cell(0).drawT(pain, x, y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathBoldSymbol::validate(LaTeXFeatures & features) const
|
2003-09-12 10:14:31 +00:00
|
|
|
|
{
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathNest::validate(features);
|
2008-04-01 02:29:41 +00:00
|
|
|
|
if (kind_ == AMS_BOLD)
|
|
|
|
|
features.require("amsbsy");
|
|
|
|
|
else
|
|
|
|
|
features.require("bm");
|
2003-09-12 10:14:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathBoldSymbol::write(WriteStream & os) const
|
2003-09-12 10:14:31 +00:00
|
|
|
|
{
|
2008-06-16 14:32:51 +00:00
|
|
|
|
bool brace = ensureMath(os);
|
2008-03-12 14:33:16 +00:00
|
|
|
|
switch (kind_) {
|
2008-04-01 02:29:41 +00:00
|
|
|
|
case AMS_BOLD:
|
2008-03-12 14:33:16 +00:00
|
|
|
|
os << "\\boldsymbol{" << cell(0) << "}";
|
|
|
|
|
break;
|
2008-04-01 02:29:41 +00:00
|
|
|
|
case BM_BOLD:
|
|
|
|
|
os << "\\bm{" << cell(0) << "}";
|
|
|
|
|
break;
|
|
|
|
|
case BM_HEAVY:
|
|
|
|
|
os << "\\hm{" << cell(0) << "}";
|
2008-03-12 14:33:16 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2008-06-16 01:21:17 +00:00
|
|
|
|
os.pendingBrace(brace);
|
2003-09-12 10:14:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-22 10:15:23 +00:00
|
|
|
|
void InsetMathBoldSymbol::infoize(odocstream & os) const
|
2003-09-12 10:14:31 +00:00
|
|
|
|
{
|
2008-03-12 14:33:16 +00:00
|
|
|
|
switch (kind_) {
|
2008-04-01 02:29:41 +00:00
|
|
|
|
case AMS_BOLD:
|
2008-03-12 14:33:16 +00:00
|
|
|
|
os << "Boldsymbol ";
|
|
|
|
|
break;
|
2008-04-01 02:29:41 +00:00
|
|
|
|
case BM_BOLD:
|
|
|
|
|
os << "Boldsymbol (bm)";
|
|
|
|
|
break;
|
|
|
|
|
case BM_HEAVY:
|
|
|
|
|
os << "Heavysymbol (bm)";
|
2008-03-12 14:33:16 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2003-09-12 10:14:31 +00:00
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|