2006-02-22 12:26:06 +00:00
|
|
|
|
/**
|
2006-09-17 09:14:18 +00:00
|
|
|
|
* \file InsetMathXYMatrix.C
|
2006-02-22 12:26:06 +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 "InsetMathXYMatrix.h"
|
2006-10-22 10:15:23 +00:00
|
|
|
|
#include "MathStream.h"
|
2006-02-22 12:26:06 +00:00
|
|
|
|
|
|
|
|
|
#include "LaTeXFeatures.h"
|
|
|
|
|
#include "support/std_ostream.h"
|
|
|
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
|
|
|
2006-10-31 19:10:30 +00:00
|
|
|
|
InsetMathXYMatrix::InsetMathXYMatrix(LyXLength const & s, char c)
|
|
|
|
|
: InsetMathGrid(1, 1), spacing_(s), spacing_code_(c)
|
2006-02-22 12:26:06 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
std::auto_ptr<InsetBase> InsetMathXYMatrix::doClone() const
|
2006-02-22 12:26:06 +00:00
|
|
|
|
{
|
2006-09-16 18:11:38 +00:00
|
|
|
|
return std::auto_ptr<InsetBase>(new InsetMathXYMatrix(*this));
|
2006-02-22 12:26:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
int InsetMathXYMatrix::colsep() const
|
2006-02-22 12:26:06 +00:00
|
|
|
|
{
|
|
|
|
|
return 40;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
int InsetMathXYMatrix::rowsep() const
|
2006-02-22 12:26:06 +00:00
|
|
|
|
{
|
|
|
|
|
return 40;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathXYMatrix::metrics(MetricsInfo & mi, Dimension & dim) const
|
2006-02-22 12:26:06 +00:00
|
|
|
|
{
|
|
|
|
|
if (mi.base.style == LM_ST_DISPLAY)
|
|
|
|
|
mi.base.style = LM_ST_TEXT;
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathGrid::metrics(mi, dim);
|
2006-02-22 12:26:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathXYMatrix::write(WriteStream & os) const
|
2006-02-22 12:26:06 +00:00
|
|
|
|
{
|
2006-10-31 19:10:30 +00:00
|
|
|
|
os << "\\xymatrix";
|
|
|
|
|
switch (spacing_code_) {
|
|
|
|
|
case 'R':
|
|
|
|
|
case 'C':
|
|
|
|
|
case 'M':
|
|
|
|
|
case 'W':
|
|
|
|
|
case 'H':
|
|
|
|
|
case 'L':
|
|
|
|
|
os << '@' << spacing_code_ << '='
|
|
|
|
|
<< from_ascii(spacing_.asLatexString());
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
if (!spacing_.empty())
|
|
|
|
|
os << "@=" << from_ascii(spacing_.asLatexString());
|
|
|
|
|
}
|
|
|
|
|
os << '{';
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathGrid::write(os);
|
2006-02-22 12:26:06 +00:00
|
|
|
|
os << "}\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-22 10:15:23 +00:00
|
|
|
|
void InsetMathXYMatrix::infoize(odocstream & os) const
|
2006-02-22 12:26:06 +00:00
|
|
|
|
{
|
|
|
|
|
os << "xymatrix ";
|
2006-10-31 19:10:30 +00:00
|
|
|
|
switch (spacing_code_) {
|
|
|
|
|
case 'R':
|
|
|
|
|
case 'C':
|
|
|
|
|
case 'M':
|
|
|
|
|
case 'W':
|
|
|
|
|
case 'H':
|
|
|
|
|
case 'L':
|
|
|
|
|
os << spacing_code_ << ' '
|
|
|
|
|
<< from_ascii(spacing_.asLatexString()) << ' ';
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
if (!spacing_.empty())
|
|
|
|
|
os << from_ascii(spacing_.asLatexString()) << ' ';
|
|
|
|
|
}
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathGrid::infoize(os);
|
2006-02-22 12:26:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathXYMatrix::normalize(NormalStream & os) const
|
2006-02-22 12:26:06 +00:00
|
|
|
|
{
|
|
|
|
|
os << "[xymatrix ";
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathGrid::normalize(os);
|
2006-02-22 12:26:06 +00:00
|
|
|
|
os << ']';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-09-16 18:11:38 +00:00
|
|
|
|
void InsetMathXYMatrix::maple(MapleStream & os) const
|
2006-02-22 12:26:06 +00:00
|
|
|
|
{
|
|
|
|
|
os << "xymatrix(";
|
2006-09-16 18:11:38 +00:00
|
|
|
|
InsetMathGrid::maple(os);
|
2006-02-22 12:26:06 +00:00
|
|
|
|
os << ')';
|
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
2006-10-31 19:10:30 +00:00
|
|
|
|
void InsetMathXYMatrix::validate(LaTeXFeatures & features) const
|
|
|
|
|
{
|
|
|
|
|
features.require("xy");
|
|
|
|
|
InsetMathGrid::validate(features);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
} // namespace lyx
|