]> git.lyx.org Git - features.git/commitdiff
While exporting from the command-line, theApp() doesn't exist.
authorTommaso Cucinotta <tommaso@lyx.org>
Mon, 10 Dec 2012 23:22:10 +0000 (23:22 +0000)
committerTommaso Cucinotta <tommaso@lyx.org>
Wed, 12 Dec 2012 22:15:42 +0000 (22:15 +0000)
It was only needed for getting hex names of colors. So, get them
directly from a ColorCache object with default mapping.

Conflicts:
src/graphics/PreviewLoader.cpp

src/Makefile.am
src/graphics/PreviewLoader.cpp

index 4c9e979886a92e07c9816c7a5d653bbdf8bc8db7..39bf0d9c76d6cb3321572992fba920a0408229bd 100644 (file)
@@ -5,7 +5,7 @@ include $(top_srcdir)/config/common.am
 DISTCLEANFILES += libintl.h
 
 AM_CPPFLAGS += $(PCH_FLAGS) -I$(top_srcdir)/src $(BOOST_INCLUDES) $(ENCHANT_CFLAGS) $(HUNSPELL_CFLAGS)
-AM_CPPFLAGS += $(QT4_CPPFLAGS) $(QT4_CORE_INCLUDES)
+AM_CPPFLAGS += $(QT4_CPPFLAGS) $(QT4_INCLUDES)
 
 if BUILD_CLIENT_SUBDIR
 CLIENT = client
index cc66df793517b22a7ebc1bee89fdcea85a9d1aa6..b3280f39dd2a0f55d0070cf77dd25168de02e93e 100644 (file)
@@ -27,6 +27,7 @@
 #include "TexRow.h"
 
 #include "frontends/Application.h" // hexName
+#include "frontends/qt4/ColorCache.h"
 
 #include "insets/Inset.h"
 
@@ -36,6 +37,7 @@
 #include "support/filetools.h"
 #include "support/ForkedCalls.h"
 #include "support/lstrings.h"
+#include "support/qstring_helpers.h"
 
 #include "support/bind.h"
 
@@ -591,16 +593,26 @@ void PreviewLoader::Impl::startLoading(bool wait)
        // FIXME XHTML 
        // The colors should be customizable.
        ColorCode const bg = buffer_.isExporting() 
-                      ? Color_white : PreviewLoader::backgroundColor();
+               ? Color_white : PreviewLoader::backgroundColor();
        ColorCode const fg = buffer_.isExporting() 
-                      ? Color_black : PreviewLoader::foregroundColor();
+               ? 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()), "#");
+       }
+
        // The conversion command.
        ostringstream cs;
        cs << pconverter_->command << ' ' << pconverter_->to << ' '
           << quoteName(latexfile.toFilesystemEncoding()) << ' '
           << int(font_scaling_factor) << ' '
-          << theApp()->hexName(fg) << ' '
-          << theApp()->hexName(bg);
+          << fg_name << ' '
+          << bg_name;
        // FIXME what about LuaTeX?
        if (buffer_.params().useNonTeXFonts)
                cs << " xelatex";