]> git.lyx.org Git - features.git/commitdiff
Merge InsetMathBoldSymbol and InsetMathBM by providing \boldsymbol
authorEnrico Forestieri <forenr@lyx.org>
Wed, 12 Mar 2008 14:33:16 +0000 (14:33 +0000)
committerEnrico Forestieri <forenr@lyx.org>
Wed, 12 Mar 2008 14:33:16 +0000 (14:33 +0000)
through the bm package.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23684 a592a061-630c-0410-9148-cb99ea01b6c8

development/scons/scons_manifest.py
lib/bind/cua.bind
lib/bind/mac.bind
src/LaTeXFeatures.cpp
src/Makefile.am
src/mathed/InsetMathBM.cpp [deleted file]
src/mathed/InsetMathBM.h [deleted file]
src/mathed/InsetMathBoldSymbol.cpp
src/mathed/InsetMathBoldSymbol.h
src/mathed/InsetMathHull.cpp
src/mathed/MathFactory.cpp

index 7f921de18b9cfa5a86d2c4769229f68284cd94b4..269dd0fddece72e8c317a992549fd725e7efcd07 100644 (file)
@@ -453,7 +453,6 @@ src_mathed_header_files = Split('''
     InsetMathAMSArray.h
     InsetMathArray.h
     InsetMathBig.h
-    InsetMathBM.h
     InsetMathBoldSymbol.h
     InsetMathBox.h
     InsetMathBrace.h
@@ -522,7 +521,6 @@ src_mathed_files = Split('''
     InsetMathAMSArray.cpp
     InsetMathArray.cpp
     InsetMathBig.cpp
-    InsetMathBM.cpp
     InsetMathBoldSymbol.cpp
     InsetMathBox.cpp
     InsetMathBrace.cpp
index 93b42cfa192056f02c3da0baada158beb20012c9..1fbe9553015e406c303eb851b8924df3526e621e 100644 (file)
@@ -55,6 +55,7 @@
 \bind "C-Prior"                        "buffer-previous"
 \bind "C-S-Tab"                        "buffer-previous"
 
+\bind "C-M-b"                  "math-insert \mathbf"
 \bind "C-b"                    "font-bold"
 \bind "C-e"                    "font-emph"
 # used below for line-delete-forward
index 8aff298fe27772ae049c9eca53c452320c9214bf..a540c90a5b01539ab7f44a581ee37ada6421f989 100644 (file)
@@ -42,6 +42,7 @@
 \bind "M-Tab"                  "buffer-next"
 \bind "M-S-BackTab"            "buffer-previous"
 
+\bind "C-M-b"                  "math-insert \mathbf"
 \bind "C-b"                    "font-bold"
 \bind "C-e"                    "font-emph"
 \bind "C-k"                    "font-noun"             # 'k' for capitals
index 60769c3a3a18d92bbfdd15291a920fa664558de7..4b47083660359ab38ce85ebee0c489465a26ed3f 100644 (file)
@@ -136,10 +136,6 @@ static string const floatingfootnote_def =
        "  \\expandafter\\noexpand\\csname SF@gobble@opt \\endcsname}\n"
        "\\def\\SF@gobble@twobracket[#1]#2{}\n";
 
-static string const boldsymbol_def =
-       "%% Bold symbol macro for standard LaTeX users\n"
-       "\\providecommand{\\boldsymbol}[1]{\\mbox{\\boldmath $#1$}}\n";
-
 static string const binom_def =
        "%% Binom macro for standard LaTeX users\n"
        "\\newcommand{\\binom}[2]{{#1 \\choose #2}}\n";
@@ -664,8 +660,6 @@ string const LaTeXFeatures::getMacros() const
                macros << guillemotright_def << '\n';
 
        // Math mode
-       if (mustProvide("boldsymbol") && !isRequired("amsmath"))
-               macros << boldsymbol_def << '\n';
        if (mustProvide("binom") && !isRequired("amsmath"))
                macros << binom_def << '\n';
        if (mustProvide("mathcircumflex"))
index 9c778971191051f3993fbe876e9004fcf0fe1246..cc907b5407282c478913b933c153359e62a4710e 100644 (file)
@@ -329,7 +329,6 @@ SOURCEFILESMATHED = \
        mathed/InsetMathAMSArray.cpp \
        mathed/InsetMathArray.cpp \
        mathed/InsetMathBig.cpp \
-       mathed/InsetMathBM.cpp \
        mathed/InsetMathBoldSymbol.cpp \
        mathed/InsetMathBox.cpp \
        mathed/InsetMathBrace.cpp \
@@ -395,7 +394,6 @@ HEADERFILESMATHED = \
        mathed/InsetMathAMSArray.h \
        mathed/InsetMathArray.h \
        mathed/InsetMathBig.h \
-       mathed/InsetMathBM.h \
        mathed/InsetMathBoldSymbol.h \
        mathed/InsetMathBox.h \
        mathed/InsetMathBrace.h \
diff --git a/src/mathed/InsetMathBM.cpp b/src/mathed/InsetMathBM.cpp
deleted file mode 100644 (file)
index 9001ea8..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/**\r
- * \file InsetMathBM.cpp\r
- * This file is part of LyX, the document processor.\r
- * Licence details can be found in the file COPYING.\r
- *\r
- * \author Bernhard Roider\r
- *\r
- * Full author contact details are available in file CREDITS.\r
- */\r
-\r
-#include <config.h>\r
-\r
-#include "InsetMathBM.h"\r
-\r
-#include "MathStream.h"\r
-#include "MathData.h"\r
-#include "LaTeXFeatures.h"\r
-\r
-#include <ostream>\r
-\r
-\r
-namespace lyx {\r
-\r
-InsetMathBM::InsetMathBM()\r
-       : InsetMathNest(1)\r
-{}\r
-\r
-\r
-Inset * InsetMathBM::clone() const\r
-{\r
-       return new InsetMathBM(*this);\r
-}\r
-\r
-\r
-void InsetMathBM::metrics(MetricsInfo & mi, Dimension & dim) const\r
-{\r
-       //FontSetChanger dummy(mi.base, "mathbf");\r
-       cell(0).metrics(mi, dim);\r
-       metricsMarkers(dim);\r
-       ++dim.wid;  // for 'double stroke'\r
-}\r
-\r
-\r
-void InsetMathBM::draw(PainterInfo & pi, int x, int y) const\r
-{\r
-       //FontSetChanger dummy(pi.base, "mathbf");\r
-       cell(0).draw(pi, x + 1, y);\r
-       cell(0).draw(pi, x + 2, y);\r
-       drawMarkers(pi, x, y);\r
-}\r
-\r
-\r
-void InsetMathBM::metricsT(TextMetricsInfo const & mi, Dimension & /*dim*/) const\r
-{\r
-       // FIXME: BROKEN!\r
-       Dimension dim;\r
-       cell(0).metricsT(mi, dim);\r
-}\r
-\r
-\r
-void InsetMathBM::drawT(TextPainter & pain, int x, int y) const\r
-{\r
-       cell(0).drawT(pain, x, y);\r
-}\r
-\r
-\r
-void InsetMathBM::validate(LaTeXFeatures & features) const\r
-{\r
-       InsetMathNest::validate(features);\r
-       features.require("bm");\r
-}\r
-\r
-\r
-void InsetMathBM::write(WriteStream & os) const\r
-{\r
-       os << "\\bm{" << cell(0) << "}";\r
-}\r
-\r
-\r
-void InsetMathBM::infoize(odocstream & os) const\r
-{\r
-       os << "bm ";\r
-}\r
-\r
-\r
-} // namespace lyx\r
diff --git a/src/mathed/InsetMathBM.h b/src/mathed/InsetMathBM.h
deleted file mode 100644 (file)
index 5192930..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-// -*- C++ -*-\r
-/**\r
- * \file InsetMathBM.h\r
- * This file is part of LyX, the document processor.\r
- * Licence details can be found in the file COPYING.\r
- *\r
- * \author Bernhard Roider\r
- *\r
- * Full author contact details are available in file CREDITS.\r
- */\r
-\r
-#ifndef MATH_BMINSET_H\r
-#define MATH_BMINSET_H\r
-\r
-#include "InsetMathNest.h"\r
-\r
-\r
-namespace lyx {\r
-\r
-\r
-/// Inset for \bm\r
-class InsetMathBM : public InsetMathNest {\r
-public:\r
-       ///\r
-       InsetMathBM();\r
-       ///\r
-       void metrics(MetricsInfo & mi, Dimension & dim) const;\r
-       ///\r
-       void draw(PainterInfo & pi, int x, int y) const;\r
-       ///\r
-       void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;\r
-       ///\r
-       void drawT(TextPainter & pi, int x, int y) const;\r
-       ///\r
-       void validate(LaTeXFeatures & features) const;\r
-       ///\r
-       void write(WriteStream & os) const;\r
-       ///\r
-       void infoize(odocstream & os) const;\r
-private:\r
-       virtual Inset * clone() const;\r
-};\r
-\r
-\r
-} // namespace lyx\r
-\r
-#endif\r
index 45ed5355ef42719211aaa72b5ac0c00894a37301..7a7e5ece76c4568fa1507353189f7c84baa7ba8b 100644 (file)
@@ -21,8 +21,8 @@
 
 namespace lyx {
 
-InsetMathBoldSymbol::InsetMathBoldSymbol()
-       : InsetMathNest(1)
+InsetMathBoldSymbol::InsetMathBoldSymbol(Kind kind)
+       : InsetMathNest(1), kind_(kind)
 {}
 
 
@@ -67,19 +67,33 @@ void InsetMathBoldSymbol::drawT(TextPainter & pain, int x, int y) const
 void InsetMathBoldSymbol::validate(LaTeXFeatures & features) const
 {
        InsetMathNest::validate(features);
-       features.require("amssymb");
+       features.require("bm");
 }
 
 
 void InsetMathBoldSymbol::write(WriteStream & os) const
 {
-       os << "\\boldsymbol{" << cell(0) << "}";
+       switch (kind_) {
+       case BOLD:
+               os << "\\boldsymbol{" << cell(0) << "}";
+               break;
+       case HEAVY:
+               os << "\\heavysymbol{" << cell(0) << "}";
+               break;
+       }
 }
 
 
 void InsetMathBoldSymbol::infoize(odocstream & os) const
 {
-       os << "Boldsymbol ";
+       switch (kind_) {
+       case BOLD:
+               os << "Boldsymbol ";
+               break;
+       case HEAVY:
+               os << "Heavysymbol ";
+               break;
+       }
 }
 
 
index 80e0e43da74ddb68a22ebf9a0300ceade82157ef..0a998b149e7edfffd3b9192813d9ba0e64bb3c81 100644 (file)
@@ -21,8 +21,12 @@ namespace lyx {
 /// Inset for AMSTeX's \boldsymbol
 class InsetMathBoldSymbol : public InsetMathNest {
 public:
+       enum Kind {
+               BOLD,
+               HEAVY
+       };
        ///
-       InsetMathBoldSymbol();
+       InsetMathBoldSymbol(Kind kind = BOLD);
        ///
        void metrics(MetricsInfo & mi, Dimension & dim) const;
        ///
@@ -37,6 +41,8 @@ public:
        void write(WriteStream & os) const;
        ///
        void infoize(odocstream & os) const;
+       ///
+       Kind kind_;
 private:
        virtual Inset * clone() const;
 };
index c4d9d7481ae0d2651e5cc13f8290231d3f4876bb..e8db74d582ad889a267d4a9a821db0c7433318d3 100644 (file)
@@ -570,7 +570,6 @@ void InsetMathHull::validate(LaTeXFeatures & features) const
        //if (features.amsstyle)
        //  return;
 
-       features.require("boldsymbol");
        //features.binom      = true;
 
        InsetMathGrid::validate(features);
index b1e73b2a3a3ed38bb1232f2159c909310a7d8aed..fbd9ffabe32f03d4071c839e572bdfb0f1c908f0 100644 (file)
@@ -14,7 +14,6 @@
 
 #include "InsetMathAMSArray.h"
 #include "InsetMathArray.h"
-#include "InsetMathBM.h"
 #include "InsetMathBoldSymbol.h"
 #include "InsetMathBox.h"
 #include "InsetMathCases.h"
@@ -376,10 +375,10 @@ MathAtom createInsetMath(docstring const & s)
                return MathAtom(new InsetMathFrac(InsetMathFrac::ATOP));
        if (s == "lefteqn")
                return MathAtom(new InsetMathLefteqn);
-       if (s == "boldsymbol")
-               return MathAtom(new InsetMathBoldSymbol);
-       if (s == "bm")
-               return MathAtom(new InsetMathBM);
+       if (s == "boldsymbol" || s == "bm")
+               return MathAtom(new InsetMathBoldSymbol(InsetMathBoldSymbol::BOLD));
+       if (s == "heavysymbol" || s == "hm")
+               return MathAtom(new InsetMathBoldSymbol(InsetMathBoldSymbol::HEAVY));
        if (s == "color" || s == "normalcolor")
                return MathAtom(new InsetMathColor(true));
        if (s == "textcolor")