]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/PreviewLoader.cpp
Fix comparing a pointer with a char
[lyx.git] / src / graphics / PreviewLoader.cpp
index ce273aa1897c2672da0afb61c1cc371011ff9b8b..b4d78e0ab5b68503d21445c7a2b652ecda124d90 100644 (file)
@@ -27,7 +27,6 @@
 #include "TexRow.h"
 
 #include "frontends/Application.h" // hexName
-#include "frontends/qt4/ColorCache.h"
 
 #include "insets/Inset.h"
 
@@ -37,7 +36,6 @@
 #include "support/filetools.h"
 #include "support/ForkedCalls.h"
 #include "support/lstrings.h"
-#include "support/qstring_helpers.h"
 
 #include "support/bind.h"
 
@@ -585,30 +583,22 @@ void PreviewLoader::Impl::startLoading(bool wait)
        double const font_scaling_factor = 
                buffer_.isExporting() ? 75.0 * buffer_.params().html_math_img_scale 
                        : 0.01 * lyxrc.dpi * lyxrc.zoom * lyxrc.preview_scale_factor;
+       
+       // The conversion command.
+       ostringstream cs;
+       cs << pconverter_->command
+          << " " << quoteName(latexfile.toFilesystemEncoding())
+          << " --dpi " << int(font_scaling_factor);
 
        // FIXME XHTML 
        // The colors should be customizable.
-       ColorCode const bg = buffer_.isExporting() 
-               ? Color_white : PreviewLoader::backgroundColor();
-       ColorCode const fg = buffer_.isExporting() 
-               ? Color_black : PreviewLoader::foregroundColor();
-       std::string bg_name, fg_name;
-       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()), "#");
+       if (!buffer_.isExporting()) {
+               ColorCode const fg = PreviewLoader::foregroundColor();
+               ColorCode const bg = PreviewLoader::backgroundColor();
+               cs << " --fg " << theApp()->hexName(fg) 
+                  << " --bg " << theApp()->hexName(bg);
        }
 
-       // The conversion command.
-       ostringstream cs;
-       cs << pconverter_->command
-          << " " << quoteName(latexfile.toFilesystemEncoding())
-          << " --dpi " << int(font_scaling_factor)
-          << " --fg " << fg_name
-          << " --bg " << bg_name;
        // FIXME what about LuaTeX?
        if (buffer_.params().useNonTeXFonts)
                cs << " --latex=xelatex";
@@ -728,6 +718,7 @@ void PreviewLoader::Impl::dumpPreamble(otexstream & os) const
        runparams.nice = true;
        runparams.moving_arg = true;
        runparams.free_spacing = true;
+       runparams.is_child = buffer_.parent();
        buffer_.writeLaTeXSource(os, buffer_.filePath(), runparams, Buffer::OnlyPreamble);
 
        // FIXME! This is a HACK! The proper fix is to control the 'true'