]> git.lyx.org Git - lyx.git/blobdiff - src/Bullet.C
Fix the missing "Figure #:" label from the caption of a figure float.
[lyx.git] / src / Bullet.C
index 8ea4a538ab1837078bff46132ad75d67a1e67cff..2eef9c5bbd7c1d386a844d73cac983e875376b23 100644 (file)
@@ -1,33 +1,35 @@
+/**
+ * \file Bullet.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Lars Gullik Bjønnes
+ * \author Allan Rae
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
 /* Completes the implementation of the Bullet class
  * It defines the various LaTeX commands etc. required to
  * generate the bullets in the bullet-panel's.
- *
- * This file is part of
- * ====================================================== 
- *
- *           LyX, The Document Processor
- *
- *           Copyright 1997-1998 Allan Rae
- *           and the LyX Team
- *
- * ====================================================== */
+ */
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
 #include "Bullet.h"
-#include "support/LAssert.h"
+
+#include <boost/assert.hpp>
+
+using std::string;
+
 
 /** The four LaTeX itemize environment default bullets
  */
 extern
-Bullet const ITEMIZE_DEFAULTS[4] = { Bullet( 0, 8 ),//"\\(\\bullet\\)"
-                                    Bullet( 0, 0 ),//"\\normalfont\\bfseries{--}"
-                                    Bullet( 0, 6 ),//"\\(\\ast\\)"
-                                    Bullet( 0, 10 ) };//"\\(\\cdot\\)"
+Bullet const ITEMIZE_DEFAULTS[4] = { Bullet(0, 8),//"\\(\\bullet\\)"
+                                    Bullet(0, 0),//"\\normalfont\\bfseries{--}"
+                                    Bullet(0, 6),//"\\(\\ast\\)"
+                                    Bullet(0, 10) };//"\\(\\cdot\\)"
 
 // will need these later if still using full text as below
 // \usepackage{latexsym,pifont,amssymb}
@@ -47,19 +49,15 @@ Bullet::Bullet(int f, int c, int s)
                size = MIN;
        }
        generateText();
-#ifdef ENABLE_ASSERTIONS
        testInvariant();
-#endif
 }
 
 
 
-Bullet::Bullet(string const & t) 
-       :  font(MIN), character(MIN), size(MIN), user_text(1), text(t)
+Bullet::Bullet(string const & t)
+       : font(MIN), character(MIN), size(MIN), user_text(1), text(t)
 {
-#ifdef ENABLE_ASSERTIONS
        testInvariant();
-#endif
 }
 
 
@@ -71,9 +69,7 @@ void Bullet::setCharacter(int c)
                character = c;
        }
        user_text = 0;
-#ifdef ENABLE_ASSERTIONS
        testInvariant();
-#endif
 }
 
 
@@ -85,9 +81,7 @@ void Bullet::setFont(int f)
                font = f;
        }
        user_text = 0;
-#ifdef ENABLE_ASSERTIONS
        testInvariant();
-#endif
 }
 
 
@@ -99,9 +93,7 @@ void Bullet::setSize(int s)
                size = s;
        }
        user_text = 0;
-#ifdef ENABLE_ASSERTIONS
        testInvariant();
-#endif
 }
 
 
@@ -110,9 +102,7 @@ void Bullet::setText(string const & t)
        font = character = size = MIN;
        user_text = 1;
        text = t;
-#ifdef ENABLE_ASSERTIONS
        testInvariant();
-#endif
 }
 
 
@@ -136,17 +126,13 @@ int Bullet::getSize() const
 
 Bullet & Bullet::operator=(Bullet const & b)
 {
-#ifdef ENABLE_ASSERTIONS
        b.testInvariant();
-#endif
        font = b.font;
        character = b.character;
        size = b.size;
        user_text = b.user_text;
        text = b.text;
-#ifdef ENABLE_ASSERTIONS
        this->testInvariant();
-#endif
        return *this;
 }
 
@@ -215,7 +201,7 @@ string const Bullet::bulletSize(int s)
        // See additional comments in bulletEntry() below.
 
        static char const * BulletSize[SIZEMAX] = {
-               "\\tiny",  "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", 
+               "\\tiny",  "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize",
                "\\large", "\\Large",      "\\LARGE",        "\\huge",  "\\Huge"
        };
 
@@ -238,10 +224,10 @@ string const Bullet::bulletEntry(int f, int c)
        // to get around a compiler bug in an earler version of gcc (< 2.7.2.1)
        // static string const BulletPanels[FONTMAX][CHARMAX] = {
        static char const * BulletPanel0[CHARMAX] = {
-               /* standard */ 
+               /* standard */
                "\\normalfont\\bfseries{--}", "\\(\\vdash\\)",
                "\\(\\dashv\\)", "\\(\\flat\\)", "\\(\\natural\\)",
-               "\\(\\sharp\\)", "\\(\\ast\\)", "\\(\\star\\)", 
+               "\\(\\sharp\\)", "\\(\\ast\\)", "\\(\\star\\)",
                "\\(\\bullet\\)", "\\(\\circ\\)", "\\(\\cdot\\)",
                "\\(\\dagger\\)", "\\(\\bigtriangleup\\)",
                "\\(\\bigtriangledown\\)", "\\(\\triangleleft\\)",
@@ -249,9 +235,9 @@ string const Bullet::bulletEntry(int f, int c)
                "\\(\\oplus\\)", "\\(\\ominus\\)", "\\(\\otimes\\)",
                "\\(\\oslash\\)", "\\(\\odot\\)", "\\(\\spadesuit\\)",
                "\\(\\diamond\\)", "\\(\\Diamond\\)", "\\(\\Box\\)",
-               "\\(\\diamondsuit\\)", "\\(\\heartsuit\\)", 
+               "\\(\\diamondsuit\\)", "\\(\\heartsuit\\)",
                "\\(\\clubsuit\\)", "\\(\\rightarrow\\)", "\\(\\leadsto\\)",
-               "\\(\\rightharpoonup\\)", "\\(\\rightharpoondown\\)", 
+               "\\(\\rightharpoonup\\)", "\\(\\rightharpoondown\\)",
                "\\(\\Rightarrow\\)", "\\(\\succ\\)"
        };
        static char const * BulletPanel1[CHARMAX] = {
@@ -367,27 +353,28 @@ string const Bullet::bulletEntry(int f, int c)
        return BulletPanels[f][c];
 }
 
+void Bullet::testInvariant() const
+{
 #ifdef ENABLE_ASSERTIONS
-void Bullet::testInvariant() const {
-       lyx::Assert(font >= MIN);
-       lyx::Assert(font < FONTMAX);
-       lyx::Assert(character >= MIN);
-       lyx::Assert(character < CHARMAX);
-       lyx::Assert(size >= MIN);
-       lyx::Assert(size < SIZEMAX);
-       lyx::Assert(user_text >= -1);
-       lyx::Assert(user_text <= 1);
+       BOOST_ASSERT(font >= MIN);
+       BOOST_ASSERT(font < FONTMAX);
+       BOOST_ASSERT(character >= MIN);
+       BOOST_ASSERT(character < CHARMAX);
+       BOOST_ASSERT(size >= MIN);
+       BOOST_ASSERT(size < SIZEMAX);
+       BOOST_ASSERT(user_text >= -1);
+       BOOST_ASSERT(user_text <= 1);
        // now some relational/operational tests
        if (user_text == 1) {
-               lyx::Assert(font == -1 && (character == -1 && size == -1));
-               //        Assert(!text.empty()); // this isn't necessarily an error
+               BOOST_ASSERT(font == -1 && (character == -1 && size == -1));
+               //        BOOST_ASSERT(!text.empty()); // this isn't necessarily an error
        }
        //      else if (user_text == -1) {
-       //        Assert(!text.empty()); // this also isn't necessarily an error
+       //        BOOST_ASSERT(!text.empty()); // this also isn't necessarily an error
        //      }
        //      else {
        //        // user_text == 0
-       //        Assert(text.empty()); // not usually true
+       //        BOOST_ASSERT(text.empty()); // not usually true
        //      }
-}
 #endif
+}