2010-09-19 22:12:06 +00:00
|
|
|
/**
|
|
|
|
* \file InsetMathDiagram.cpp
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author André Pönitz
|
|
|
|
* \author Ronen Abravanel
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include "InsetMathDiagram.h"
|
|
|
|
|
|
|
|
#include "MathStream.h"
|
|
|
|
|
2016-06-04 08:41:13 +00:00
|
|
|
#include "LaTeXFeatures.h"
|
|
|
|
#include "MetricsInfo.h"
|
|
|
|
|
2010-09-19 22:12:06 +00:00
|
|
|
#include <ostream>
|
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
|
|
|
|
InsetMathDiagram::InsetMathDiagram(Buffer * buf) : InsetMathGrid(buf, 1, 1)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Inset * InsetMathDiagram::clone() const
|
|
|
|
{
|
|
|
|
return new InsetMathDiagram(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int InsetMathDiagram::colsep() const
|
|
|
|
{
|
|
|
|
return 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int InsetMathDiagram::rowsep() const
|
|
|
|
{
|
|
|
|
return 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InsetMathDiagram::metrics(MetricsInfo & mi, Dimension & dim) const
|
|
|
|
{
|
2016-11-22 10:26:15 +00:00
|
|
|
Changer dummy2 = mi.base.changeEnsureMath();
|
2016-11-19 20:25:34 +00:00
|
|
|
FontInfo & f = mi.base.font;
|
2019-06-14 14:42:02 +00:00
|
|
|
Changer dummy = (f.style() == DISPLAY_STYLE) ? f.changeStyle(TEXT_STYLE)
|
2016-11-20 18:53:16 +00:00
|
|
|
: Changer();
|
2010-09-19 22:12:06 +00:00
|
|
|
InsetMathGrid::metrics(mi, dim);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-11-19 20:25:34 +00:00
|
|
|
void InsetMathDiagram::draw(PainterInfo & pi, int x, int y) const
|
|
|
|
{
|
2016-11-22 10:26:15 +00:00
|
|
|
Changer dummy2 = pi.base.changeEnsureMath();
|
2016-11-19 20:25:34 +00:00
|
|
|
FontInfo & f = pi.base.font;
|
2019-06-14 14:42:02 +00:00
|
|
|
Changer dummy = (f.style() == DISPLAY_STYLE) ? f.changeStyle(TEXT_STYLE)
|
2016-11-20 18:53:16 +00:00
|
|
|
: Changer();
|
2016-11-19 20:25:34 +00:00
|
|
|
InsetMathGrid::draw(pi, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-19 22:12:06 +00:00
|
|
|
void InsetMathDiagram::write(WriteStream & os) const
|
|
|
|
{
|
|
|
|
MathEnsurer ensurer(os);
|
|
|
|
os << "\\Diagram";
|
2015-10-07 03:13:21 +00:00
|
|
|
bool open = os.startOuterRow();
|
2010-09-19 22:12:06 +00:00
|
|
|
os << '{';
|
|
|
|
InsetMathGrid::write(os);
|
|
|
|
os << "}\n";
|
2015-10-07 03:13:21 +00:00
|
|
|
if (open)
|
|
|
|
os.startOuterRow();
|
2010-09-19 22:12:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InsetMathDiagram::infoize(odocstream & os) const
|
|
|
|
{
|
|
|
|
os << "Diagram ";
|
|
|
|
InsetMathGrid::infoize(os);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InsetMathDiagram::normalize(NormalStream & os) const
|
|
|
|
{
|
|
|
|
os << "[Diagram ";
|
|
|
|
InsetMathGrid::normalize(os);
|
|
|
|
os << ']';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InsetMathDiagram::maple(MapleStream & os) const
|
|
|
|
{
|
|
|
|
os << "Diagram(";
|
|
|
|
InsetMathGrid::maple(os);
|
|
|
|
os << ')';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void InsetMathDiagram::validate(LaTeXFeatures & features) const
|
|
|
|
{
|
|
|
|
features.require("feyn");
|
|
|
|
InsetMathGrid::validate(features);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|