mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
New LColor::setColor
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8529 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7c70a8ee0f
commit
31c24b4002
@ -1,3 +1,12 @@
|
||||
2004-03-25 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
Martin Vermeer <martin.vermeer@hut.fi>
|
||||
|
||||
* lyxfunc.C (dispatch):
|
||||
* bufferparams.C (readToken): use the new LColor::setColor
|
||||
|
||||
* LColor.[Ch] (setColor): new version that takes two strings as
|
||||
argument and creates a new color entry if necessary
|
||||
|
||||
2003-02-12 Jean-Marc Lasgouttes <lasgouttes@freesurf.fr>
|
||||
|
||||
* buffer.C (makeLaTeXFile): if the main latex file that is
|
||||
|
17
src/LColor.C
17
src/LColor.C
@ -229,6 +229,21 @@ bool LColor::setColor(LColor::color col, string const & x11name)
|
||||
}
|
||||
|
||||
|
||||
bool LColor::setColor(string const & lyxname, string const &x11name)
|
||||
{
|
||||
string const lcname = ascii_lowercase(lyxname);
|
||||
if (pimpl_->transform.find(lcname) == pimpl_->transform.end()) {
|
||||
lyxerr[Debug::GUI]
|
||||
<< "LColor::setColor: Unknown color \""
|
||||
<< lyxname << '"' << endl;
|
||||
addColor(static_cast<color>(pimpl_->infotab.size()), lcname);
|
||||
}
|
||||
|
||||
return setColor(static_cast<LColor::color>(pimpl_->transform[lcname]),
|
||||
x11name);
|
||||
}
|
||||
|
||||
|
||||
LColor::color LColor::getFromGUIName(string const & guiname) const
|
||||
{
|
||||
Pimpl::InfoTab::const_iterator it = pimpl_->infotab.begin();
|
||||
@ -254,7 +269,7 @@ LColor::color LColor::getFromLyXName(string const & lyxname) const
|
||||
if (pimpl_->transform.find(lcname) == pimpl_->transform.end()) {
|
||||
lyxerr << "LColor::getFromLyXName: Unknown color \""
|
||||
<< lyxname << '"' << endl;
|
||||
addColor(static_cast<color>(pimpl_->infotab.size()), lcname);
|
||||
return none;
|
||||
}
|
||||
|
||||
return static_cast<LColor::color>(pimpl_->transform[lcname]);
|
||||
|
@ -198,6 +198,12 @@ public:
|
||||
*/
|
||||
bool setColor(LColor::color col, std::string const & x11name);
|
||||
|
||||
/** set the given LyX color to the color defined by the X11
|
||||
* name given \returns true if successful. A new color entry
|
||||
* is created if the color is unknown
|
||||
*/
|
||||
bool setColor(std::string const & lyxname, std::string const & x11name);
|
||||
|
||||
/// Get the GUI name of \c color.
|
||||
std::string const getGUIName(LColor::color c) const;
|
||||
|
||||
|
@ -352,7 +352,8 @@ string const BufferParams::readToken(LyXLex & lex, string const & token)
|
||||
// Update also the LColor table:
|
||||
if (color == "none")
|
||||
color = lcolor.getX11Name(LColor::background);
|
||||
lcolor.setColor(lcolor.getFromLyXName(branch), color);
|
||||
lcolor.setColor(branch, color);
|
||||
|
||||
}
|
||||
}
|
||||
} else if (token == "\\author") {
|
||||
|
@ -1073,8 +1073,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
|
||||
(lyx_name == lcolor.getLyXName(LColor::graphicsbg) &&
|
||||
x11_name != lcolor.getX11Name(LColor::graphicsbg));
|
||||
|
||||
LColor::color col = lcolor.getFromLyXName(lyx_name);
|
||||
if (!lcolor.setColor(col, x11_name)) {
|
||||
if (!lcolor.setColor(lyx_name, x11_name)) {
|
||||
setErrorMessage(
|
||||
bformat(_("Set-color \"%1$s\" failed "
|
||||
"- color is undefined or "
|
||||
|
Loading…
Reference in New Issue
Block a user