On Tue, Mar 16, 2004 at 03:47:50PM +0100, Jean-Marc Lasgouttes wrote: > > For some time, I have been annoyed by the fact that, when I load a > file in lyx 1.4.0cvs, it appears in a random color. While the visual > effect is probably the consequence of a nonunititalized variable on my > particular setting (I have seen nobody reporting that),
And I don't see it. But it's in the saved file afterwards.. > it is probably related to the bug about superfluous \textcolor{ } > reported earlier by Kayvan. > > After a too long hunt, I came up with the attached patch, which > basically makes sure that we do not honor case in LyX Names for > colors. The problem was coming from the 'Color "None"' (instead of > "none") that can be found in our layout files. Great! I gave up after a short while... > However, I do not understand the logic between the getLyXName() > behaviour. After my patch, it reads: > > LColor::color LColor::getFromLyXName(string const & lyxname) const > { > string const lcname = ascii_lowercase(lyxname); > if (pimpl_->transform.find(lcname) == pimpl_->transform.end()) { > lyxerr << "LColor::getFromLyXName: Unknown color \"" > << lyxname << '"' << endl; > addColor(static_cast<color>(pimpl_->infotab.size()), lcname); > } > > return static_cast<LColor::color>(pimpl_->transform[lcname]); > } > > > I really do not understand why the call to addColor has been added. > Its effect is that, if I put a bogus 'Color "foo"' statement in a > layout file, instead of correctly falling back to "none" or something, > the code will create a new color "foo" which is not bound to anything > useful, and will create havoc later. But it won't silently swallow unknown colours anymore, will it? > Angus, Martin, I see that these changes were related to the branches > work. Could you tell me what it is good for? [...] Btw, I have the strong feeling that the ignorance of case in configuration files is more likely to create trouble than it helps the user. In fact, having a choice there usually leads to a lot of time spent for 'beautification' (change everything to lower, to upper, to lower again). Andre', remembering the time when he was programming in Pascal. Voluntarily, no less...