]> git.lyx.org Git - features.git/commitdiff
poor man's support for \boldsymbol
authorAndré Pönitz <poenitz@gmx.net>
Fri, 12 Sep 2003 10:14:31 +0000 (10:14 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 12 Sep 2003 10:14:31 +0000 (10:14 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7736 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/Makefile.am
src/mathed/formulabase.C
src/mathed/math_boldsymbolinset.C [new file with mode: 0644]
src/mathed/math_boldsymbolinset.h [new file with mode: 0644]
src/mathed/math_factory.C

index 8825ee9aa0322eb6792cd8e81f117f5034c5b236..e980d1288414b562d4fcb6291f08f0ff506c3f14 100644 (file)
@@ -1,3 +1,10 @@
+
+2003-09-12  André Pönitz  <poenitz@gmx.net>
+
+       * math_boldsymbolinset.[Ch]: preliminary support
+
+       * Makefile.am: adjust
+
 2003-09-05  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
 
        * math_kerninset.h:
index b39f933fe5a5836d18b6e19b86cd2ab61cdbb7dc..97cdf588345d30adb71f40e6eb89da2dd1ad23c7 100644 (file)
@@ -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 \
index f28bd4af7b4692372ad54a9e27a405ad8af97e11..438539d3c16fefa801f4230891b1750d6a999ef2 100644 (file)
@@ -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 (file)
index 0000000..d60189a
--- /dev/null
@@ -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 <config.h>
+
+#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<InsetBase> MathBoldsymbolInset::clone() const
+{
+       return auto_ptr<InsetBase>(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 (file)
index 0000000..f44dbb8
--- /dev/null
@@ -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<InsetBase> 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
index 8eab4f5b915ae256ecd80e40004d925f9c27653c..d9e28d85b222de7f8d178e25c78620409d761d4f 100644 (file)
@@ -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));