From 19dcaa43912e9a45831c3b06c70e6b0561946093 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Thu, 18 Sep 2003 13:13:49 +0000 Subject: [PATCH] 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 --- src/graphics/ChangeLog | 5 +++++ src/graphics/PreviewedInset.C | 2 +- src/graphics/PreviewedInset.h | 6 ++++-- src/insets/ChangeLog | 4 ++++ src/insets/insetinclude.C | 9 +++------ src/mathed/ChangeLog | 4 ++++ src/mathed/formula.C | 4 ++-- 7 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/graphics/ChangeLog b/src/graphics/ChangeLog index b65440d09b..dc5ad2cd32 100644 --- a/src/graphics/ChangeLog +++ b/src/graphics/ChangeLog @@ -1,3 +1,8 @@ +2003-09-18 Angus Leeming + + * PreviewedInset.C (latexString): add a Buffer const & arg. + * PreviewedInset.C (addPreview): pass the buffer to latexString. + 2003-09-16 Angus Leeming * PreviewedInset.[Ch] (c-tor) move out of line. diff --git a/src/graphics/PreviewedInset.C b/src/graphics/PreviewedInset.C index 85e4c95c31..79ded1294f 100644 --- a/src/graphics/PreviewedInset.C +++ b/src/graphics/PreviewedInset.C @@ -65,7 +65,7 @@ void PreviewedInset::addPreview(PreviewLoader & ploader) if (!Previews::activated() || !previewWanted()) return; - snippet_ = support::trim(latexString()); + snippet_ = support::trim(latexString(ploader.buffer())); if (snippet_.empty()) return; diff --git a/src/graphics/PreviewedInset.h b/src/graphics/PreviewedInset.h index 33c46eae14..197ded4d77 100644 --- a/src/graphics/PreviewedInset.h +++ b/src/graphics/PreviewedInset.h @@ -20,8 +20,10 @@ #include #include -class InsetOld; +class Buffer; class BufferView; +class InsetOld; + namespace lyx { namespace graphics { @@ -73,7 +75,7 @@ private: /// Does the owning inset want a preview? virtual bool previewWanted() const = 0; /// a wrapper to Inset::latex - virtual string const latexString() const = 0; + virtual string const latexString(Buffer const &) const = 0; /// InsetOld & inset_; diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index d84a0548ef..48647ce290 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2003-09-18 Angus Leeming + + * insetinclude.C (latexString): add a Buffer const & arg. + 2003-09-18 Angus Leeming * inset.C: diff --git a/src/insets/insetinclude.C b/src/insets/insetinclude.C index 96dc8c393c..ef1032ff2d 100644 --- a/src/insets/insetinclude.C +++ b/src/insets/insetinclude.C @@ -72,7 +72,7 @@ public: /// bool previewWanted() const; /// - string const latexString() const; + string const latexString(Buffer const &) const; /// InsetInclude const & parent() const { return dynamic_cast(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; LatexRunParams runparams; runparams.flavor = LatexRunParams::LATEX; - parent().latex(*view()->buffer(), os, runparams); + parent().latex(buffer, os, runparams); return os.str(); } diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index ad85d89e9f..bbdc3cb077 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,7 @@ +2003-09-18 Angus Leeming + + * formula.C (latexString): add a Buffer const & arg. + 2003-09-16 Angus Leeming * formula.C (PreviewImpl::parent): return a const reference. diff --git a/src/mathed/formula.C b/src/mathed/formula.C index b4fe5e2176..36b39d32fd 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -46,7 +46,7 @@ private: /// bool previewWanted() const; /// - string const latexString() const; + string const latexString(Buffer const &) 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; WriteStream wi(ls, false, false); -- 2.39.2