readd xymatrix inset (bug 2238)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13265 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2006-02-22 12:26:06 +00:00
parent 085b2cd11f
commit 2535ea14bd
6 changed files with 144 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2006-02-17 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* math_xymatrixinset.[Ch]: Readd
* Makefile.am: Readd math_xymatrixinset.[Ch]
* math_factory.C (createMathInset): Readd xymatrix
* math_parser.C (parse1): Readd xymatrix
2006-02-13 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* math_macro.C (editXY): Prevent crash (fix by Andrew Beck)

View File

@ -147,6 +147,8 @@ libmathed_la_SOURCES = \
math_undersetinset.h \
math_xarrowinset.C \
math_xarrowinset.h \
math_xymatrixinset.C \
math_xymatrixinset.h \
command_inset.h \
command_inset.C \
ref_inset.h \

View File

@ -50,6 +50,7 @@
#include "math_undersetinset.h"
#include "math_unknowninset.h"
#include "math_xarrowinset.h"
#include "math_xymatrixinset.h"
//#include "insets/insetref.h"
#include "ref_inset.h"
@ -292,6 +293,8 @@ MathAtom createMathInset(string const & s)
return MathAtom(new MathMakeboxInset);
if (s == "kern")
return MathAtom(new MathKernInset);
if (s == "xymatrix")
return MathAtom(new MathXYMatrixInset);
if (s == "xrightarrow" || s == "xleftarrow")
return MathAtom(new MathXArrowInset(s));
if (s == "split" || s == "gathered" || s == "aligned" || s == "alignedat")

View File

@ -1248,6 +1248,11 @@ void Parser::parse1(MathGridInset & grid, unsigned flags,
parse2(cell->back(), FLAG_ITEM, mode, false);
}
else if (t.cs() == "xymatrix") {
cell->push_back(createMathInset(t.cs()));
parse2(cell->back(), FLAG_ITEM, mode, false);
}
else if (t.cs() == "framebox" || t.cs() == "makebox") {
cell->push_back(createMathInset(t.cs()));
parse(cell->back().nucleus()->cell(0), FLAG_OPTION, MathInset::TEXT_MODE);

View File

@ -0,0 +1,80 @@
/**
* \file math_xymatrixinset.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_xymatrixinset.h"
#include "math_mathmlstream.h"
#include "math_streamstr.h"
#include "LaTeXFeatures.h"
#include "support/std_ostream.h"
MathXYMatrixInset::MathXYMatrixInset()
: MathGridInset(1, 1)
{}
std::auto_ptr<InsetBase> MathXYMatrixInset::doClone() const
{
return std::auto_ptr<InsetBase>(new MathXYMatrixInset(*this));
}
int MathXYMatrixInset::colsep() const
{
return 40;
}
int MathXYMatrixInset::rowsep() const
{
return 40;
}
void MathXYMatrixInset::metrics(MetricsInfo & mi, Dimension & dim) const
{
if (mi.base.style == LM_ST_DISPLAY)
mi.base.style = LM_ST_TEXT;
MathGridInset::metrics(mi, dim);
}
void MathXYMatrixInset::write(WriteStream & os) const
{
os << "\\xymatrix{";
MathGridInset::write(os);
os << "}\n";
}
void MathXYMatrixInset::infoize(std::ostream & os) const
{
os << "xymatrix ";
MathGridInset::infoize(os);
}
void MathXYMatrixInset::normalize(NormalStream & os) const
{
os << "[xymatrix ";
MathGridInset::normalize(os);
os << ']';
}
void MathXYMatrixInset::maple(MapleStream & os) const
{
os << "xymatrix(";
MathGridInset::maple(os);
os << ')';
}

View File

@ -0,0 +1,47 @@
// -*- C++ -*-
/**
* \file math_xymatrixinset.h
* 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.
*/
#ifndef MATH_XYMATRIX_H
#define MATH_XYMATRIX_H
#include "lyxlength.h"
#include "math_gridinset.h"
class MathXYMatrixInset : public MathGridInset {
public:
///
MathXYMatrixInset();
///
void metrics(MetricsInfo &, Dimension &) const;
///
MathXYMatrixInset const * asXYMatrixInset() const { return this; }
///
virtual int colsep() const;
///
virtual int rowsep() const;
///
void normalize();
///
void write(WriteStream & os) const;
///
void infoize(std::ostream & os) const;
///
void normalize(NormalStream &) const;
///
void maple(MapleStream &) const;
private:
///
virtual std::auto_ptr<InsetBase> doClone() const;
};
#endif