#include "support/forkedcontr.h"
#include "support/lstrings.h"
#include "support/lyxlib.h"
-#include "support/tostr.h"
+#include "support/convert.h"
#include <boost/bind.hpp>
-#include "support/std_sstream.h"
+#include <sstream>
#include <fstream>
#include <iomanip>
/// Store info on a currently executing, forked process.
-struct InProgress {
+class InProgress {
+public:
///
InProgress() : pid(0) {}
///
namespace lyx {
namespace graphics {
-struct PreviewLoader::Impl : public boost::signals::trackable {
+class PreviewLoader::Impl : public boost::signals::trackable {
+public:
///
Impl(PreviewLoader & p, Buffer const & b);
/// Stop any InProgress items still executing.
void startLoading();
/// Emit this signal when an image is ready for display.
- boost::signal1<void, PreviewImage const &> imageReady;
+ boost::signal<void(PreviewImage const &)> imageReady;
Buffer const & buffer() const { return buffer_; }
namespace {
-struct IncrementedFileName {
+class IncrementedFileName {
+public:
IncrementedFileName(string const & to_format,
string const & filename_base)
: to_format_(to_format), base_(filename_base), counter_(1)
: parent_(p), buffer_(b), font_scaling_factor_(0.0)
{
font_scaling_factor_ = 0.01 * lyxrc.dpi * lyxrc.zoom *
- lyxrc.preview_scale_factor;
+ convert<double>(lyxrc.preview_scale_factor);
lyxerr[Debug::GRAPHICS] << "The font scaling factor is "
<< font_scaling_factor_ << endl;
namespace {
-struct EraseSnippet {
+class EraseSnippet {
+public:
EraseSnippet(string const & s) : snippet_(s) {}
void operator()(InProgressProcess & process)
{
// The conversion command.
ostringstream cs;
cs << pconverter_->command << ' ' << pconverter_->to << ' '
- << latexfile << ' ' << int(font_scaling_factor_) << ' '
+ << support::quoteName(latexfile) << ' '
+ << int(font_scaling_factor_) << ' '
<< lyx_gui::hexname(LColor::preview) << ' '
<< lyx_gui::hexname(LColor::background);
- string const command = support::LibScriptSearch(cs.str());
+ string const command = support::libScriptSearch(cs.str());
// Initiate the conversion from LaTeX to bitmap images files.
support::Forkedcall::SignalTypePtr
if (ret != 0) {
lyxerr[Debug::GRAPHICS] << "PreviewLoader::startLoading()\n"
- << "Unable to start process \n"
+ << "Unable to start process\n"
<< command << endl;
return;
}
runparams.nice = true;
runparams.moving_arg = true;
runparams.free_spacing = true;
- tmp.makeLaTeXFile(os, buffer_.filePath(), runparams, true, false);
+ tmp.writeLaTeXSource(os, buffer_.filePath(), runparams, true, false);
// FIXME! This is a HACK! The proper fix is to control the 'true'
// passed to WriteStream below:
InsetIterator const end = inset_iterator_end(inset);
for (; it != end; ++it)
- if (it->lyxCode() == InsetOld::MATHMACRO_CODE)
+ if (it->lyxCode() == InsetBase::MATHMACRO_CODE)
it->latex(buffer_, os, runparams);
// All equation lables appear as "(#)" + preview.sty's rendering of
string const unique_filename(string const bufferpath)
{
static int theCounter = 0;
- string const filename = tostr(theCounter++) + "lyxpreview";
- return support::AddName(bufferpath, filename);
+ string const filename = convert<string>(theCounter++) + "lyxpreview";
+ return support::addName(bufferpath, filename);
}