From: André Pönitz Date: Fri, 12 Sep 2003 10:14:31 +0000 (+0000) Subject: poor man's support for \boldsymbol X-Git-Tag: 1.6.10~16108 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=22990dde1f9dd0daccd91b7817ef02547e93e9d1;p=features.git poor man's support for \boldsymbol git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7736 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 8825ee9aa0..e980d12884 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,10 @@ + +2003-09-12 André Pönitz + + * math_boldsymbolinset.[Ch]: preliminary support + + * Makefile.am: adjust + 2003-09-05 Jean-Marc Lasgouttes * math_kerninset.h: diff --git a/src/mathed/Makefile.am b/src/mathed/Makefile.am index b39f933fe5..97cdf58834 100644 --- a/src/mathed/Makefile.am +++ b/src/mathed/Makefile.am @@ -25,6 +25,8 @@ libmathed_la_SOURCES = \ math_biginset.h \ math_binominset.C \ math_binominset.h \ + math_boldsymbolinset.C \ + math_boldsymbolinset.h \ math_boxinset.C \ math_boxinset.h \ math_braceinset.C \ diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index f28bd4af7b..438539d3c1 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -302,11 +302,11 @@ dispatch_result InsetFormulaBase::lfunMouseMotion(FuncRequest const & cmd) dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd) { - //lyxerr << "InsetFormulaBase::localDispatch: act: " << cmd.action - // << " arg: '" << cmd.argument - // << " x: '" << cmd.x - // << " y: '" << cmd.y - // << "' button: " << cmd.button() << endl; + lyxerr << "InsetFormulaBase::localDispatch: act: " << cmd.action + << " arg: '" << cmd.argument + << " x: '" << cmd.x + << " y: '" << cmd.y + << "' button: " << cmd.button() << endl; BufferView * bv = cmd.view(); diff --git a/src/mathed/math_boldsymbolinset.C b/src/mathed/math_boldsymbolinset.C new file mode 100644 index 0000000000..d60189ae2b --- /dev/null +++ b/src/mathed/math_boldsymbolinset.C @@ -0,0 +1,80 @@ +/** + * \file math_boldsymbolinset.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 + +#include "math_boldsymbolinset.h" +#include "math_mathmlstream.h" +#include "math_data.h" +#include "LaTeXFeatures.h" +#include "support/std_ostream.h" + +using std::auto_ptr; + + +MathBoldsymbolInset::MathBoldsymbolInset() + : MathNestInset(1) +{} + + +auto_ptr MathBoldsymbolInset::clone() const +{ + return auto_ptr(new MathBoldsymbolInset(*this)); +} + + +void MathBoldsymbolInset::metrics(MetricsInfo & mi, Dimension & dim) const +{ + //FontSetChanger dummy(mi.base, "mathbf"); + cell(0).metrics(mi, dim); + metricsMarkers(1); + ++dim.wid; // for 'double stroke' + dim_ = dim; +} + + +void MathBoldsymbolInset::draw(PainterInfo & pi, int x, int y) const +{ + //FontSetChanger dummy(pi.base, "mathbf"); + cell(0).draw(pi, x + 1, y); + cell(0).draw(pi, x + 2, y); + drawMarkers(pi, x, y); +} + + +void MathBoldsymbolInset::metricsT(TextMetricsInfo const & mi, Dimension & /*dim*/) const +{ + cell(0).metricsT(mi, dim_); +} + + +void MathBoldsymbolInset::drawT(TextPainter & pain, int x, int y) const +{ + cell(0).drawT(pain, x, y); +} + + +void MathBoldsymbolInset::validate(LaTeXFeatures & features) const +{ + MathNestInset::validate(features); + features.require("amssymb"); +} + + +void MathBoldsymbolInset::write(WriteStream & os) const +{ + os << "\\boldsymbol{" << cell(0) << "}"; +} + + +void MathBoldsymbolInset::infoize(std::ostream & os) const +{ + os << "Boldsymbol "; +} diff --git a/src/mathed/math_boldsymbolinset.h b/src/mathed/math_boldsymbolinset.h new file mode 100644 index 0000000000..f44dbb808b --- /dev/null +++ b/src/mathed/math_boldsymbolinset.h @@ -0,0 +1,41 @@ +// -*- C++ -*- +/** + * \file math_boldsymbolinset.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_BOLDSYMBOLINSET_H +#define MATH_BOLDSYMBOLINSET_H + +#include "math_nestinset.h" + + +/// Inset for AMSTeX's \boldsymbol +class MathBoldsymbolInset : public MathNestInset { +public: + /// + MathBoldsymbolInset(); + /// + std::auto_ptr clone() const; + /// + void metrics(MetricsInfo & mi, Dimension & dim) const; + /// + void draw(PainterInfo & pi, int x, int y) const; + /// + void metricsT(TextMetricsInfo const & mi, Dimension & dim) const; + /// + void drawT(TextPainter & pi, int x, int y) const; + /// + void validate(LaTeXFeatures & features) const; + /// + void write(WriteStream & os) const; + /// + void infoize(std::ostream & os) const; +}; + +#endif diff --git a/src/mathed/math_factory.C b/src/mathed/math_factory.C index 8eab4f5b91..d9e28d85b2 100644 --- a/src/mathed/math_factory.C +++ b/src/mathed/math_factory.C @@ -16,6 +16,7 @@ #include "math_amsarrayinset.h" #include "math_binominset.h" #include "math_boxinset.h" +#include "math_boldsymbolinset.h" #include "math_casesinset.h" #include "math_decorationinset.h" #include "math_dotsinset.h" @@ -306,6 +307,8 @@ MathAtom createMathInset(string const & s) return MathAtom(new MathLefteqnInset); if (s == "lyxert") return MathAtom(new MathErtInset); + if (s == "boldsymbol") + return MathAtom(new MathBoldsymbolInset); if (MathMacroTable::has(s)) return MathAtom(new MathMacro(s));