#include <config.h>
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
#include "PreviewLoader.h"
#include "PreviewImage.h"
#include "buffer.h"
#include "converter.h"
+#include "format.h"
#include "debug.h"
#include "lyxrc.h"
#include "LColor.h"
+#include "Lsstream.h"
#include "insets/inset.h"
#include "support/filetools.h"
#include "support/forkedcall.h"
#include "support/forkedcontr.h"
+#include "support/tostr.h"
#include "support/lstrings.h"
#include "support/lyxlib.h"
FindFirst(string const & comp) : comp_(comp) {}
bool operator()(StrPair const & sp)
{
- return sp.first < comp_;
+ return sp.first == comp_;
}
private:
string const comp_;
lyxerr[Debug::GRAPHICS] << "PreviewLoader::startLoading()" << endl;
// As used by the LaTeX file and by the resulting image files
- string const filename_base(unique_filename(buffer_.tmppath));
+ string directory = buffer_.tmppath;
+ if (directory.empty())
+ directory = buffer_.filePath();
+
+ string const filename_base(unique_filename(directory));
// Create an InProgress instance to place in the map of all
// such processes if it starts correctly.
in_progress_.erase(git);
// Tell the outside world
- std::list<PreviewImagePtr>::const_iterator nit = newimages.begin();
- std::list<PreviewImagePtr>::const_iterator nend = newimages.end();
+ std::list<PreviewImagePtr>::const_reverse_iterator
+ nit = newimages.rbegin();
+ std::list<PreviewImagePtr>::const_reverse_iterator
+ nend = newimages.rend();
for (; nit != nend; ++nit) {
imageReady(*nit->get());
}
// Why on earth is Buffer::makeLaTeXFile a non-const method?
Buffer & tmp = const_cast<Buffer &>(buffer_);
// Dump the preamble only.
- tmp.makeLaTeXFile(os, buffer_.filePath(), true, false, true);
+ LatexRunParams runparams;
+ runparams.flavor = LatexRunParams::LATEX;
+ runparams.nice = true;
+ runparams.moving_arg = true;
+ runparams.free_spacing = true;
+ tmp.makeLaTeXFile(os, buffer_.filePath(), runparams, false, true);
+
+ // FIXME! This is a HACK! The proper fix is to control the 'true'
+ // passed to WriteStream below:
+ // int InsetFormula::latex(Buffer const *, ostream & os,
+ // LatexRunParams const & runparams) const
+ // {
+ // WriteStream wi(os, runparams.moving_arg, true);
+ // par_->write(wi);
+ // return wi.line();
+ // }
+ os << "\n"
+ << "\\def\\lyxlock{}\n"
+ << "\n";
// Loop over the insets in the buffer and dump all the math-macros.
Buffer::inset_iterator it = buffer_.inset_const_iterator_begin();
for (; it != end; ++it)
if (it->lyxCode() == Inset::MATHMACRO_CODE)
- it->latex(&buffer_, os, true, true);
+ it->latex(&buffer_, os, runparams);
// All equation lables appear as "(#)" + preview.sty's rendering of
// the label name