-//
-// preview stuff
-//
-
-namespace {
-
-bool preview_wanted(InsetExternalParams const & params)
-{
- return params.display == external::PreviewDisplay &&
- params.filename.isFileReadable();
-}
-
-
-docstring const latex_string(InsetExternal const & inset, Buffer const & buffer)
-{
- odocstringstream os;
- // We don't need to set runparams.encoding since it is not used by
- // latex().
- OutputParams runparams(0);
- runparams.flavor = OutputParams::LATEX;
- inset.latex(buffer, os, runparams);
- return os.str();
-}
-
-
-void add_preview_and_start_loading(RenderMonitoredPreview & renderer,
- InsetExternal const & inset,
- Buffer const & buffer)
-{
- InsetExternalParams const & params = inset.params();
-
- if (RenderPreview::status() != LyXRC::PREVIEW_OFF &&
- preview_wanted(params)) {
- renderer.setAbsFile(params.filename);
- docstring const snippet = latex_string(inset, buffer);
- renderer.addPreview(snippet, buffer);
- renderer.startLoading(buffer);
- }
-}
-
-} // namespace anon
-
-