Enable previewing of Include insets within insets within insets...

(Don't use a BufferView cache to supply the Buffer when you can just pass
'Buffer const &' instead, Angus.'


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7789 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-09-18 13:13:49 +00:00
parent 2e7ac7ca77
commit 19dcaa4391
7 changed files with 23 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2003-09-18 Angus Leeming <leeming@lyx.org>
* PreviewedInset.C (latexString): add a Buffer const & arg.
* PreviewedInset.C (addPreview): pass the buffer to latexString.
2003-09-16 Angus Leeming <leeming@lyx.org> 2003-09-16 Angus Leeming <leeming@lyx.org>
* PreviewedInset.[Ch] (c-tor) move out of line. * PreviewedInset.[Ch] (c-tor) move out of line.

View File

@ -65,7 +65,7 @@ void PreviewedInset::addPreview(PreviewLoader & ploader)
if (!Previews::activated() || !previewWanted()) if (!Previews::activated() || !previewWanted())
return; return;
snippet_ = support::trim(latexString()); snippet_ = support::trim(latexString(ploader.buffer()));
if (snippet_.empty()) if (snippet_.empty())
return; return;

View File

@ -20,8 +20,10 @@
#include <boost/signals/trackable.hpp> #include <boost/signals/trackable.hpp>
#include <boost/signals/connection.hpp> #include <boost/signals/connection.hpp>
class InsetOld; class Buffer;
class BufferView; class BufferView;
class InsetOld;
namespace lyx { namespace lyx {
namespace graphics { namespace graphics {
@ -73,7 +75,7 @@ private:
/// Does the owning inset want a preview? /// Does the owning inset want a preview?
virtual bool previewWanted() const = 0; virtual bool previewWanted() const = 0;
/// a wrapper to Inset::latex /// a wrapper to Inset::latex
virtual string const latexString() const = 0; virtual string const latexString(Buffer const &) const = 0;
/// ///
InsetOld & inset_; InsetOld & inset_;

View File

@ -1,3 +1,7 @@
2003-09-18 Angus Leeming <leeming@lyx.org>
* insetinclude.C (latexString): add a Buffer const & arg.
2003-09-18 Angus Leeming <leeming@lyx.org> 2003-09-18 Angus Leeming <leeming@lyx.org>
* inset.C: * inset.C:

View File

@ -72,7 +72,7 @@ public:
/// ///
bool previewWanted() const; bool previewWanted() const;
/// ///
string const latexString() const; string const latexString(Buffer const &) const;
/// ///
InsetInclude const & parent() const { InsetInclude const & parent() const {
return dynamic_cast<InsetInclude const &>(inset()); return dynamic_cast<InsetInclude const &>(inset());
@ -600,15 +600,12 @@ bool InsetInclude::PreviewImpl::previewWanted() const
} }
string const InsetInclude::PreviewImpl::latexString() const string const InsetInclude::PreviewImpl::latexString(Buffer const & buffer) const
{ {
if (!view() || !view()->buffer())
return string();
ostringstream os; ostringstream os;
LatexRunParams runparams; LatexRunParams runparams;
runparams.flavor = LatexRunParams::LATEX; runparams.flavor = LatexRunParams::LATEX;
parent().latex(*view()->buffer(), os, runparams); parent().latex(buffer, os, runparams);
return os.str(); return os.str();
} }

View File

@ -1,3 +1,7 @@
2003-09-18 Angus Leeming <leeming@lyx.org>
* formula.C (latexString): add a Buffer const & arg.
2003-09-16 Angus Leeming <leeming@lyx.org> 2003-09-16 Angus Leeming <leeming@lyx.org>
* formula.C (PreviewImpl::parent): return a const reference. * formula.C (PreviewImpl::parent): return a const reference.

View File

@ -46,7 +46,7 @@ private:
/// ///
bool previewWanted() const; bool previewWanted() const;
/// ///
string const latexString() const; string const latexString(Buffer const &) const;
/// ///
InsetFormula const & parent() const InsetFormula const & parent() const
{ {
@ -313,7 +313,7 @@ bool InsetFormula::PreviewImpl::previewWanted() const
} }
string const InsetFormula::PreviewImpl::latexString() const string const InsetFormula::PreviewImpl::latexString(Buffer const &) const
{ {
ostringstream ls; ostringstream ls;
WriteStream wi(ls, false, false); WriteStream wi(ls, false, false);