]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
* src/LaTeXFeatures.cpp: simplify greektext definition. Patch by G. Milde (bug #6458)
[lyx.git] / src / BufferParams.cpp
index 5d6e56046ff45220afd5ab4d19a80145646c783c..6ca616ae38bec104a259532f6ccd68554fbb1b6d 100644 (file)
@@ -375,6 +375,7 @@ BufferParams::BufferParams()
        isfontcolor = false;
        // light gray is the default font color for greyed-out notes
        notefontcolor = lyx::rgbFromHexName("#cccccc");
+       boxbgcolor = lyx::rgbFromHexName("#ff0000");
        compressed = lyxrc.save_compressed;
        for (int iter = 0; iter < 4; ++iter) {
                user_defined_bullet(iter) = ITEMIZE_DEFAULTS[iter];
@@ -737,8 +738,13 @@ string BufferParams::readToken(Lexer & lex, string const & token,
                string color = lex.getString();
                notefontcolor = lyx::rgbFromHexName(color);
                // set the font color within LyX
-               // FIXME: the color is correctly set but later overwritten by the default
                lcolor.setColor(Color_greyedouttext, color);
+       } else if (token == "\\boxbgcolor") {
+               lex.eatLine();
+               string color = lex.getString();
+               boxbgcolor = lyx::rgbFromHexName(color);
+               // set the font color within LyX
+               lcolor.setColor(Color_shadedbg, color);
        } else if (token == "\\paperwidth") {
                lex >> paperwidth;
        } else if (token == "\\paperheight") {
@@ -935,6 +941,8 @@ void BufferParams::writeFile(ostream & os) const
                os << "\\fontcolor " << lyx::X11hexname(fontcolor) << '\n';
        if (notefontcolor != lyx::rgbFromHexName("#cccccc"))
                os << "\\notefontcolor " << lyx::X11hexname(notefontcolor) << '\n';
+       if (boxbgcolor != lyx::rgbFromHexName("#ff0000"))
+               os << "\\boxbgcolor " << lyx::X11hexname(boxbgcolor) << '\n';
 
        BranchList::const_iterator it = branchlist().begin();
        BranchList::const_iterator end = branchlist().end();
@@ -1764,10 +1772,11 @@ bool BufferParams::setBaseClass(string const & classname)
        LayoutFileList & bcl = LayoutFileList::get();
        if (!bcl.haveClass(classname)) {
                docstring s = 
-                       bformat(_("The document class %1$s could not be found. "
-                               "A default textclass with default layouts will be used. "
-                               "LyX might not be able to produce output unless a correct "
-                               "textclass is selected from the document settings dialog."),
+                       bformat(_("The layout file:\n"
+                               "%1$s\n"
+                               "could not be found. A default textclass with default\n"
+                               "layouts will be used. LyX will not be able to produce\n"
+                               "correct output."),
                        from_utf8(classname));
                frontend::Alert::error(_("Document class not found"), s);
                bcl.addEmptyClass(classname);
@@ -1776,10 +1785,14 @@ bool BufferParams::setBaseClass(string const & classname)
        bool const success = bcl[classname].load();
        if (!success) {
                docstring s = 
-                       bformat(_("The document class %1$s could not be loaded."),
+                       bformat(_("Due to some error in it, the layout file:\n"
+                               "%1$s\n"
+                               "could not be loaded. A default textclass with default\n"
+                               "layouts will be used. LyX will not be able to produce\n"
+                               "correct output."),
                        from_utf8(classname));
                frontend::Alert::error(_("Could not load class"), s);
-               return false;
+               bcl.addEmptyClass(classname);
        }
 
        pimpl_->baseClass_ = classname;
@@ -1818,6 +1831,7 @@ void BufferParams::makeDocumentClass()
        }
 }
 
+
 bool BufferParams::moduleCanBeAdded(string const & modName) const
 {
        return layoutModules_.moduleCanBeAdded(modName, baseClass());