On 11/12/12 14:08, Jean-Marc Lasgouttes wrote: > Le 11/12/2012 10:12, Tommaso Cucinotta a écrit : >> Yes, everything compiles fine. Also ColorCache.h was not giving any trouble, >> till I included it in graphics/PreviewLoader.cpp, because then gcc >> complained it cannot find QColor nor QPalette (and I had to add the QtGui/). > > Just by curiosity:why do you need to access ColorCache.h from graphics/. I > would tend to think that is 'private' to the frontend and that this > separation makes sense.
In the export code, it used to be (more or less, follow the sense): theApp()->... hexName(fg); theApp()->... hexName(bg); Now, when exporting from the command-line, it seems we don't really build a GuiApplication (theApp() returns NULL). However, the above was only needed for the sake of converting a ColorCode (Color_Background, etc...) into a hex, using some color map, stored in the GuiApplication ColorCache private element. However, I just noticed that, building temporarily such a ColorCache instance directly in PreviewLoader.cpp, then it gets filled with some default color translation map, and I can use it. So, the code has become (from the patch): + if (theApp()) { + fg_name = theApp()->hexName(fg); + bg_name = theApp()->hexName(bg); + } else { + ColorCache cc; + fg_name = ltrim(fromqstr(cc.get(fg).name()), "#"); + bg_name = ltrim(fromqstr(cc.get(bg).name()), "#"); + } [...] - << " --fg " << theApp()->hexName(fg) - << " --bg " << theApp()->hexName(bg); + << " --fg " << fg_name + << " --bg " << bg_name; I have to confess I have no clue on whether this colours mangling machinery makes any sense at all, as the above is actually needed to convert document images to PNG, whilst the colours in the GuiApplication might be related to the GUI application appearance itself, but I'm not really sure. Simply, as often, I tried to solve the "puzzle" (segfault) in some working way, but no time to really dig into parts of LyX I don't know..... the devel list is just there for these things, isn't it :-) ? As in the prior patch, an alternative to this problem at all is the one to simply remove the "--fg" and "--bg" options to the command-line invoking the external command. Someone who knows this part of the code should advise on the best solution. Thanks, T.