]> git.lyx.org Git - lyx.git/blobdiff - src/LColor.C
Fix small bug in reading \set_color in lyxrc
[lyx.git] / src / LColor.C
index c4763d8f72fc69624171fc477a1e2974f01205ee..16777903939838bb5e09316d786a41ab17345c80 100644 (file)
@@ -22,6 +22,7 @@
 #include "gettext.h"
 #include "support/lstrings.h"
 
+using std::endl;
 
 void LColor::fill(LColor::color col, string const & gui,
                  string const & latex, string const & x11,
@@ -171,6 +172,22 @@ void LColor::setColor(LColor::color col, string const & x11name)
 }
 
 
+bool LColor::setColor(string const & lyxname, string const & x11name)
+{
+       color col = getFromLyXName (lyxname);
+
+       // "inherit" is returned for colors not in the database
+       // (and anyway should not be redefined)
+       if (col == inherit || col == ignore) {
+               lyxerr << "Color " << lyxname << " is undefined or may not be"
+                       " redefined" << endl;
+               return false;
+       }
+       setColor (col, x11name);
+       return true;
+}
+
+
 LColor::color LColor::getFromGUIName(string const & guiname) const
 {
        InfoTab::const_iterator ici = infotab.begin();