2003-08-19 13:00:56 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file math_substackinset.C
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2002-02-14 14:52:23 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2005-03-30 09:05:30 +00:00
|
|
|
|
#include "LaTeXFeatures.h"
|
2002-02-14 14:52:23 +00:00
|
|
|
|
#include "math_substackinset.h"
|
2003-09-07 21:25:37 +00:00
|
|
|
|
#include "math_data.h"
|
2002-02-14 14:52:23 +00:00
|
|
|
|
#include "math_mathmlstream.h"
|
2003-09-05 17:23:11 +00:00
|
|
|
|
#include "support/std_ostream.h"
|
2002-02-14 14:52:23 +00:00
|
|
|
|
|
2005-04-03 12:07:49 +00:00
|
|
|
|
#include "funcrequest.h"
|
|
|
|
|
#include "FuncStatus.h"
|
|
|
|
|
#include "gettext.h"
|
|
|
|
|
|
|
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using lyx::support::bformat;
|
|
|
|
|
using std::string;
|
2003-07-25 17:11:25 +00:00
|
|
|
|
using std::auto_ptr;
|
|
|
|
|
|
2002-02-14 14:52:23 +00:00
|
|
|
|
|
|
|
|
|
MathSubstackInset::MathSubstackInset()
|
|
|
|
|
: MathGridInset(1, 1)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2004-11-23 23:04:52 +00:00
|
|
|
|
auto_ptr<InsetBase> MathSubstackInset::doClone() const
|
2002-02-14 14:52:23 +00:00
|
|
|
|
{
|
2003-07-25 17:11:25 +00:00
|
|
|
|
return auto_ptr<InsetBase>(new MathSubstackInset(*this));
|
2002-02-14 14:52:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-06-02 10:03:27 +00:00
|
|
|
|
void MathSubstackInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
2002-02-14 14:52:23 +00:00
|
|
|
|
{
|
2002-05-30 07:09:54 +00:00
|
|
|
|
if (mi.base.style == LM_ST_DISPLAY) {
|
2003-03-21 14:20:48 +00:00
|
|
|
|
StyleChanger dummy(mi.base, LM_ST_TEXT);
|
2004-01-30 11:41:12 +00:00
|
|
|
|
MathGridInset::metrics(mi, dim);
|
2002-05-30 07:09:54 +00:00
|
|
|
|
} else {
|
2004-01-30 11:41:12 +00:00
|
|
|
|
MathGridInset::metrics(mi, dim);
|
2002-05-30 07:09:54 +00:00
|
|
|
|
}
|
2004-01-30 11:41:12 +00:00
|
|
|
|
dim_ = dim;
|
2003-05-14 16:29:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MathSubstackInset::draw(PainterInfo & pi, int x, int y) const
|
|
|
|
|
{
|
|
|
|
|
MathGridInset::draw(pi, x + 1, y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-04-03 12:07:49 +00:00
|
|
|
|
bool MathSubstackInset::getStatus(LCursor & cur, FuncRequest const & cmd,
|
|
|
|
|
FuncStatus & flag) const
|
|
|
|
|
{
|
|
|
|
|
switch (cmd.action) {
|
|
|
|
|
case LFUN_TABULAR_FEATURE: {
|
|
|
|
|
string const name("substack");
|
|
|
|
|
string const s = cmd.argument;
|
|
|
|
|
if (s == "add-vline-left" || s == "add-vline-right") {
|
|
|
|
|
flag.message(bformat(
|
|
|
|
|
N_("Can't add vertical grid lines in '%1$s'"), name));
|
|
|
|
|
flag.enabled(false);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return MathGridInset::getStatus(cur, cmd, flag);
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
return MathGridInset::getStatus(cur, cmd, flag);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-05-14 16:29:25 +00:00
|
|
|
|
void MathSubstackInset::infoize(std::ostream & os) const
|
|
|
|
|
{
|
|
|
|
|
os << "Substack ";
|
2002-02-14 14:52:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MathSubstackInset::write(WriteStream & os) const
|
|
|
|
|
{
|
|
|
|
|
os << "\\substack{";
|
|
|
|
|
MathGridInset::write(os);
|
|
|
|
|
os << "}\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MathSubstackInset::normalize(NormalStream & os) const
|
|
|
|
|
{
|
|
|
|
|
os << "[substack ";
|
|
|
|
|
MathGridInset::normalize(os);
|
2002-11-27 10:30:28 +00:00
|
|
|
|
os << ']';
|
2002-02-14 14:52:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-02-14 14:30:09 +00:00
|
|
|
|
void MathSubstackInset::maple(MapleStream & os) const
|
2002-02-14 14:52:23 +00:00
|
|
|
|
{
|
|
|
|
|
os << "substack(";
|
2003-02-14 14:30:09 +00:00
|
|
|
|
MathGridInset::maple(os);
|
2002-11-27 10:30:28 +00:00
|
|
|
|
os << ')';
|
2002-02-14 14:52:23 +00:00
|
|
|
|
}
|
2005-03-30 09:05:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MathSubstackInset::validate(LaTeXFeatures & features) const
|
|
|
|
|
{
|
|
|
|
|
features.require("amsmath");
|
|
|
|
|
MathGridInset::validate(features);
|
|
|
|
|
}
|