: parent_(p), buffer_(b), finished_generating_(true)
{
font_scaling_factor_ = int(buffer_.fontScalingFactor());
- fg_color_ = strtol(theApp()->hexName(foregroundColor()).c_str(), 0, 16);
- bg_color_ = strtol(theApp()->hexName(backgroundColor()).c_str(), 0, 16);
+ if (theApp()) {
+ fg_color_ = strtol(theApp()->hexName(foregroundColor()).c_str(), 0, 16);
+ bg_color_ = strtol(theApp()->hexName(backgroundColor()).c_str(), 0, 16);
+ } else {
+ fg_color_ = 0x0;
+ bg_color_ = 0xffffff;
+ }
if (!pconverter_)
pconverter_ = setConverter("lyxpreview");
PreviewLoader::Impl::preview(string const & latex_snippet) const
{
int fs = int(buffer_.fontScalingFactor());
- int fg = strtol(theApp()->hexName(foregroundColor()).c_str(), 0, 16);
- int bg = strtol(theApp()->hexName(backgroundColor()).c_str(), 0, 16);
+ int fg = 0x0;
+ int bg = 0xffffff;
+ if (theApp()) {
+ fg = strtol(theApp()->hexName(foregroundColor()).c_str(), 0, 16);
+ bg = strtol(theApp()->hexName(backgroundColor()).c_str(), 0, 16);
+ }
if (font_scaling_factor_ != fs || fg_color_ != fg || bg_color_ != bg) {
// Schedule refresh of all previews on zoom or color changes.
// The previews are regenerated only after the zoom factor
}
of << "\\batchmode\n";
+ // Set \jobname of previews to the document name (see bug 9627)
+ of << "\\def\\jobname{"
+ << from_utf8(changeExtension(buffer_.latexName(true), ""))
+ << "}\n";
+
LYXERR(Debug::LATEX, "Format = " << buffer_.params().getDefaultOutputFormat());
string latexparam = "";
bool docformat = !buffer_.params().default_output_format.empty()