#include "Converter.h"
#include "Encoding.h"
#include "Format.h"
-#include "InsetIterator.h"
#include "LaTeXFeatures.h"
#include "LyXRC.h"
#include "output.h"
#include "frontends/Application.h" // hexName
-#include "insets/Inset.h"
-
#include "support/convert.h"
#include "support/debug.h"
#include "support/FileName.h"
/// Called by the ForkedCall process that generated the bitmap files.
void finishedGenerating(pid_t, int);
///
- void dumpPreamble(otexstream &, OutputParams::FLAVOR) const;
+ void dumpPreamble(otexstream &, FLAVOR) const;
///
void dumpData(odocstream &, BitmapFile const &) const;
namespace {
-std::function<SnippetPair (string const &)> IncrementedFileName
- (string const & to_format, string const & filename_base)
-{
- return [&to_format, &filename_base](string const & snippet)
+class IncrementedFileName {
+public:
+ IncrementedFileName(string const & to_format,
+ string const & filename_base)
+ : to_format_(to_format), base_(filename_base), counter_(1)
+ {}
+
+ SnippetPair const operator()(string const & snippet)
{
- static int counter_ = 1;
ostringstream os;
- os << filename_base << counter_++ << '.' << to_format;
- string const file = os.str();
- return make_pair(snippet, FileName(file));
- };
-}
+ os << base_ << counter_++ << '.' << to_format_;
+ string const file_name = os.str();
+ return make_pair(snippet, FileName(file_name));
+ }
+
+private:
+ string const & to_format_;
+ string const & base_;
+ int counter_;
+};
InProgress::InProgress(string const & filename_base,
{
font_scaling_factor_ = int(buffer_.fontScalingFactor());
if (theApp()) {
- fg_color_ = strtol(theApp()->hexName(foregroundColor()).c_str(), nullptr, 16);
- bg_color_ = strtol(theApp()->hexName(backgroundColor()).c_str(), nullptr, 16);
+ fg_color_ = convert(theApp()->hexName(foregroundColor()).c_str(), 16);
+ bg_color_ = convert(theApp()->hexName(backgroundColor()).c_str(), 16);
} else {
fg_color_ = 0x0;
bg_color_ = 0xffffff;
int fg = 0x0;
int bg = 0xffffff;
if (theApp()) {
- fg = strtol(theApp()->hexName(foregroundColor()).c_str(), nullptr, 16);
- bg = strtol(theApp()->hexName(backgroundColor()).c_str(), nullptr, 16);
+ fg = convert(theApp()->hexName(foregroundColor()).c_str(), 16);
+ bg = convert(theApp()->hexName(backgroundColor()).c_str(), 16);
}
if (font_scaling_factor_ != fs || fg_color_ != fg || bg_color_ != bg) {
// Schedule refresh of all previews on zoom or color changes.
namespace {
-std::function<void (InProgressProcess &)> EraseSnippet(string const & s) {
+std::function<void (InProgressProcess &)> EraseSnippet(string const & s)
+{
return [&s](InProgressProcess & process) {
BitmapFile & snippets = process.second.snippets;
BitmapFile::iterator it = snippets.begin();
if (it != end)
snippets.erase(it, it+1);
};
-};
+}
} // namespace
// Set \jobname of previews to the document name (see bug 9627)
of << "\\def\\jobname{"
- << from_utf8(changeExtension(buffer_.latexName(true), ""))
+ << from_utf8(changeExtension(buffer_.latexName(), ""))
<< "}\n";
LYXERR(Debug::LATEX, "Format = " << buffer_.params().getDefaultOutputFormat());
&& buffer_.params().default_output_format != "default";
// Use LATEX flavor if the document does not specify a specific
// output format (see bug 9371).
- OutputParams::FLAVOR flavor = docformat
+ FLAVOR flavor = docformat
? buffer_.params().getOutputFlavor()
- : OutputParams::LATEX;
+ : FLAVOR::LATEX;
if (buffer_.params().encoding().package() == Encoding::japanese) {
latexparam = " --latex=platex";
- flavor = OutputParams::LATEX;
+ flavor = FLAVOR::LATEX;
}
else if (buffer_.params().useNonTeXFonts) {
- if (flavor == OutputParams::LUATEX)
+ if (flavor == FLAVOR::LUATEX)
latexparam = " --latex=lualatex";
else {
- flavor = OutputParams::XETEX;
+ flavor = FLAVOR::XETEX;
latexparam = " --latex=xelatex";
}
}
else {
switch (flavor) {
- case OutputParams::PDFLATEX:
+ case FLAVOR::PDFLATEX:
latexparam = " --latex=pdflatex";
break;
- case OutputParams::XETEX:
+ case FLAVOR::XETEX:
latexparam = " --latex=xelatex";
break;
- case OutputParams::LUATEX:
+ case FLAVOR::LUATEX:
latexparam = " --latex=lualatex";
break;
- case OutputParams::DVILUATEX:
+ case FLAVOR::DVILUATEX:
latexparam = " --latex=dvilualatex";
break;
default:
- flavor = OutputParams::LATEX;
+ flavor = FLAVOR::LATEX;
}
}
dumpPreamble(os, flavor);
}
-void PreviewLoader::Impl::dumpPreamble(otexstream & os, OutputParams::FLAVOR flavor) const
+void PreviewLoader::Impl::dumpPreamble(otexstream & os, FLAVOR flavor) const
{
// Dump the preamble only.
- LYXERR(Debug::LATEX, "dumpPreamble, flavor == " << flavor);
+ LYXERR(Debug::LATEX, "dumpPreamble, flavor == " << static_cast<int>(flavor));
OutputParams runparams(&buffer_.params().encoding());
runparams.flavor = flavor;
runparams.nice = true;