math_casesinset.h \
math_charinset.C \
math_charinset.h \
+ math_colorinset.C \
+ math_colorinset.h \
math_commentinset.C \
math_commentinset.h \
math_cursor.C \
{
lyxerr << "InsetFormulaBase::localDispatch: act: " << cmd.action
<< " arg: '" << cmd.argument
- << " x: '" << cmd.x
+ << "' x: '" << cmd.x
<< " y: '" << cmd.y
<< "' button: " << cmd.button() << endl;
} else if ((char_ == '>' || char_ == '<') && has_math_fonts) {
FontSetChanger dummy(mi.base, "cmm");
mathed_char_dim(mi.base.font, char_, dim);
- } else if (slanted(char_) && mi.base.fontname == "mathnormal") {
- ShapeChanger dummy(mi.base.font, LyXFont::ITALIC_SHAPE);
+ } else if (!slanted(char_) && mi.base.fontname == "mathnormal") {
+ ShapeChanger dummy(mi.base.font, LyXFont::UP_SHAPE);
mathed_char_dim(mi.base.font, char_, dim);
} else {
mathed_char_dim(mi.base.font, char_, dim);
} else if ((char_ == '>' || char_ == '<') && has_math_fonts) {
FontSetChanger dummy(pi.base, "cmm");
pi.draw(x, y, char_);
- } else if (slanted(char_) && pi.base.fontname == "mathnormal") {
- ShapeChanger dummy(pi.base.font, LyXFont::ITALIC_SHAPE);
+ } else if (!slanted(char_) && pi.base.fontname == "mathnormal") {
+ ShapeChanger dummy(pi.base.font, LyXFont::UP_SHAPE);
pi.draw(x, y, char_);
} else {
pi.draw(x, y, char_);
--- /dev/null
+/**
+ * \file math_colorinset.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_colorinset.h"
+#include "math_data.h"
+#include "math_mathmlstream.h"
+#include "math_support.h"
+
+#include "LaTeXFeatures.h"
+
+#include "support/std_ostream.h"
+
+using std::auto_ptr;
+
+
+MathColorInset::MathColorInset()
+ : MathNestInset(2)
+{}
+
+
+auto_ptr<InsetBase> MathColorInset::clone() const
+{
+ return auto_ptr<InsetBase>(new MathColorInset(*this));
+}
+
+
+void MathColorInset::metrics(MetricsInfo & mi, Dimension & dim) const
+{
+ FontSetChanger dummy(mi.base, "textnormal");
+ w_ = mathed_char_width(mi.base.font, '[');
+ MathNestInset::metrics(mi);
+ dim_ = cell(0).dim();
+ dim_ += cell(1).dim();
+ dim_.wid += 2 * w_ + 4;
+ metricsMarkers();
+ dim = dim_;
+}
+
+
+void MathColorInset::draw(PainterInfo & pi, int x, int y) const
+{
+ FontSetChanger dummy(pi.base, "textnormal");
+ drawMarkers(pi, x, y);
+
+ drawStrBlack(pi, x, y, "[");
+ x += w_;
+ cell(0).draw(pi, x, y);
+ x += cell(0).width();
+ drawStrBlack(pi, x, y, "]");
+ x += w_ + 2;
+
+ ColorChanger dummy1(pi.base.font, asString(cell(0)));
+ cell(1).draw(pi, x, y);
+}
+
+
+void MathColorInset::validate(LaTeXFeatures & features) const
+{
+ MathNestInset::validate(features);
+ features.require("color");
+}
+
+
+void MathColorInset::write(WriteStream & os) const
+{
+ os << "\\color" << '{' << cell(0) << '}' << '{' << cell(1) << '}';
+}
+
+
+void MathColorInset::normalize(NormalStream & os) const
+{
+ os << "[color " << cell(0) << ' ' << cell(1) << ']';
+}
+
+
+void MathColorInset::infoize(std::ostream & os) const
+{
+ os << "Color: " << cell(0);
+}
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file math_colorinset.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_COLORINSET_H
+#define MATH_COLORINSET_H
+
+#include "math_nestinset.h"
+
+/// Change colours.
+
+class MathColorInset : public MathNestInset {
+public:
+ ///
+ MathColorInset();
+ ///
+ virtual std::auto_ptr<InsetBase> clone() const;
+ ///
+ void metrics(MetricsInfo & mi, Dimension & dim) const;
+ ///
+ void draw(PainterInfo & pi, int x, int y) const;
+ /// we need package color
+ void validate(LaTeXFeatures & features) const;
+ ///
+ void write(WriteStream & os) const;
+ /// write normalized content
+ void normalize(NormalStream & ns) const;
+ ///
+ void infoize(std::ostream & os) const;
+private:
+ /// width of '[' in current font
+ mutable int w_;
+};
+
+#endif
#include "math_boxinset.h"
#include "math_boldsymbolinset.h"
#include "math_casesinset.h"
+#include "math_colorinset.h"
#include "math_decorationinset.h"
#include "math_dotsinset.h"
#include "math_ertinset.h"
return MathAtom(new MathErtInset);
if (s == "boldsymbol")
return MathAtom(new MathBoldsymbolInset);
+ if (s == "color")
+ return MathAtom(new MathColorInset);
if (MathMacroTable::has(s))
return MathAtom(new MathMacro(s));
{
if (type_ == "none")
return "lyxnochange";
+ lyxerr << "standard font: mathnormal\n";
return "mathnormal";
}
#include "math_mathmlstream.h"
#include "math_support.h"
+#include "support/std_ostream.h"
+
using std::auto_ptr;
{
os << "[makebox " << cell(0) << ' ' << cell(1) << ' ' << cell(2) << ']';
}
+
+
+void MathMakeboxInset::infoize(std::ostream & os) const
+{
+ os << "Makebox (width: " << cell(0)
+ << " pos: " << cell(1) << ")";
+}
void normalize(NormalStream & ns) const;
///
mode_type currentMode() const { return TEXT_MODE; }
+ ///
+ void infoize(std::ostream & os) const;
private:
/// width of '[' in current font
mutable int w_;
fontinfo fontinfos[] = {
// math fonts
{"mathnormal", inh_family, LyXFont::MEDIUM_SERIES,
- LyXFont::UP_SHAPE, LColor::math},
+ LyXFont::ITALIC_SHAPE, LColor::math},
{"mathbf", inh_family, LyXFont::BOLD_SERIES,
inh_shape, LColor::math},
{"mathcal", LyXFont::CMSY_FAMILY, inh_series,