]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
this we don't need anymore
[lyx.git] / src / BufferParams.cpp
index 43141b46e199df0333736f10b8b1de499adf230f..01fbfb0a457cf01dc65966e45ce492cd7aa365a9 100644 (file)
@@ -302,7 +302,7 @@ BufferParams::Impl::Impl()
 BufferParams::Impl *
 BufferParams::MemoryTraits::clone(BufferParams::Impl const * ptr)
 {
-       BOOST_ASSERT(ptr);
+       LASSERT(ptr, /**/);
 
        return new BufferParams::Impl(*ptr);
 }
@@ -361,7 +361,7 @@ BufferParams::BufferParams()
 
 docstring BufferParams::B_(string const & l10n) const
 {
-       BOOST_ASSERT(language);
+       LASSERT(language, /**/);
        return getMessages(language->code()).get(l10n);
 }
 
@@ -404,28 +404,28 @@ BranchList const & BufferParams::branchlist() const
 
 Bullet & BufferParams::temp_bullet(lyx::size_type const index)
 {
-       BOOST_ASSERT(index < 4);
+       LASSERT(index < 4, /**/);
        return pimpl_->temp_bullets[index];
 }
 
 
 Bullet const & BufferParams::temp_bullet(lyx::size_type const index) const
 {
-       BOOST_ASSERT(index < 4);
+       LASSERT(index < 4, /**/);
        return pimpl_->temp_bullets[index];
 }
 
 
 Bullet & BufferParams::user_defined_bullet(lyx::size_type const index)
 {
-       BOOST_ASSERT(index < 4);
+       LASSERT(index < 4, /**/);
        return pimpl_->user_defined_bullets[index];
 }
 
 
 Bullet const & BufferParams::user_defined_bullet(lyx::size_type const index) const
 {
-       BOOST_ASSERT(index < 4);
+       LASSERT(index < 4, /**/);
        return pimpl_->user_defined_bullets[index];
 }
 
@@ -845,19 +845,6 @@ void BufferParams::writeFile(ostream & os) const
                else
                        os << "\\author " << Author() << "\n";
        }
-
-       vector<string>::const_iterator e_it = extraEmbeddedFiles().begin();
-       vector<string>::const_iterator e_end = extraEmbeddedFiles().end();
-       os << "\\extra_embedded_files \"";
-       bool first = true;
-       for (; e_it != e_end; ++e_it) {
-               if (!first)
-                       os << ",";
-               else
-                       first = false;
-               os << *e_it;
-       }
-       os << "\"\n";
 }
 
 
@@ -1302,13 +1289,17 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
                lyxpreamble += oss.str();
        }
 
-       // this might be useful...
-       lyxpreamble += "\n\\makeatletter\n";
+       // only add \makeatletter and \makeatother when actually needed
+       bool makeatletter = false;
 
        // Some macros LyX will need
        docstring tmppreamble(from_ascii(features.getMacros()));
 
        if (!tmppreamble.empty()) {
+               if (!makeatletter) {
+                       lyxpreamble += "\n\\makeatletter\n";
+                       makeatletter = true;
+               }
                lyxpreamble += "\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
                        "LyX specific LaTeX commands.\n"
                        + tmppreamble + '\n';
@@ -1317,6 +1308,10 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
        // the text class specific preamble
        tmppreamble = features.getTClassPreamble();
        if (!tmppreamble.empty()) {
+               if (!makeatletter) {
+                       lyxpreamble += "\n\\makeatletter\n";
+                       makeatletter = true;
+               }
                lyxpreamble += "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
                        "Textclass specific LaTeX commands.\n"
                        + tmppreamble + '\n';
@@ -1324,6 +1319,10 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
 
        /* the user-defined preamble */
        if (!preamble.empty()) {
+               if (!makeatletter) {
+                       lyxpreamble += "\n\\makeatletter\n";
+                       makeatletter = true;
+               }
                // FIXME UNICODE
                lyxpreamble += "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
                        "User specified LaTeX commands.\n"
@@ -1362,10 +1361,16 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
                }
        }
 
-       if (!bullets_def.empty())
+       if (!bullets_def.empty()) {
+               if (!makeatletter) {
+                       lyxpreamble += "\n\\makeatletter\n";
+                       makeatletter = true;
+               }
                lyxpreamble += bullets_def + "}\n\n";
+       }
 
-       lyxpreamble += "\\makeatother\n\n";
+       if (makeatletter)
+               lyxpreamble += "\\makeatother\n\n";
 
        int const nlines =
                int(count(lyxpreamble.begin(), lyxpreamble.end(), '\n'));
@@ -1607,7 +1612,8 @@ void BufferParams::readGraphicsDriver(Lexer & lex)
                if (test == tmptok) {
                        graphicsDriver = tmptok;
                        break;
-               } else if (test == "") {
+               }
+               if (test.empty()) {
                        lex.printError(
                                "Warning: graphics driver `$$Token' not recognized!\n"
                                "         Setting graphics driver to `default'.\n");