mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 05:33:33 +00:00
15dc5fa5d6
Change the LyXFont setXYZ member functions to return void, not LyXFont &. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7765 a592a061-630c-0410-9148-cb99ea01b6c8
105 lines
1.8 KiB
C
105 lines
1.8 KiB
C
/**
|
|
* \file math_braceinset.C
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author André Pönitz
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#include "math_braceinset.h"
|
|
#include "math_data.h"
|
|
#include "math_mathmlstream.h"
|
|
#include "math_support.h"
|
|
#include "LColor.h"
|
|
#include "support/std_ostream.h"
|
|
|
|
using std::max;
|
|
using std::auto_ptr;
|
|
|
|
|
|
MathBraceInset::MathBraceInset()
|
|
: MathNestInset(1)
|
|
{}
|
|
|
|
|
|
MathBraceInset::MathBraceInset(MathArray const & ar)
|
|
: MathNestInset(1)
|
|
{
|
|
cell(0) = ar;
|
|
}
|
|
|
|
|
|
auto_ptr<InsetBase> MathBraceInset::clone() const
|
|
{
|
|
return auto_ptr<InsetBase>(new MathBraceInset(*this));
|
|
}
|
|
|
|
|
|
void MathBraceInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
|
{
|
|
cell(0).metrics(mi);
|
|
Dimension t;
|
|
mathed_char_dim(mi.base.font, '{', t);
|
|
wid_ = t.wid;
|
|
dim_.asc = max(cell(0).ascent(), t.asc);
|
|
dim_.des = max(cell(0).descent(), t.des);
|
|
dim_.wid = cell(0).width() + 2 * wid_;
|
|
dim = dim_;
|
|
}
|
|
|
|
|
|
void MathBraceInset::draw(PainterInfo & pi, int x, int y) const
|
|
{
|
|
LyXFont font = pi.base.font;
|
|
font.setColor(LColor::latex);
|
|
drawChar(pi, font, x, y, '{');
|
|
cell(0).draw(pi, x + wid_, y);
|
|
drawChar(pi, font, x + dim_.width() - wid_, y, '}');
|
|
}
|
|
|
|
|
|
void MathBraceInset::write(WriteStream & os) const
|
|
{
|
|
os << '{' << cell(0) << '}';
|
|
}
|
|
|
|
|
|
void MathBraceInset::normalize(NormalStream & os) const
|
|
{
|
|
os << "[block " << cell(0) << ']';
|
|
}
|
|
|
|
|
|
void MathBraceInset::maple(MapleStream & os) const
|
|
{
|
|
os << cell(0);
|
|
}
|
|
|
|
|
|
void MathBraceInset::octave(OctaveStream & os) const
|
|
{
|
|
os << cell(0);
|
|
}
|
|
|
|
|
|
void MathBraceInset::mathmlize(MathMLStream & os) const
|
|
{
|
|
os << MTag("mrow") << cell(0) << ETag("mrow");
|
|
}
|
|
|
|
|
|
void MathBraceInset::mathematica(MathematicaStream & os) const
|
|
{
|
|
os << cell(0);
|
|
}
|
|
|
|
|
|
void MathBraceInset::infoize(std::ostream & os) const
|
|
{
|
|
os << "Nested Block: ";
|
|
}
|