+2003-09-16 Angus Leeming <leeming@lyx.org>
+
+ * PreviewedInset.[Ch] (c-tor) move out of line.
+ (d-tor): make private.
+ (inset): return a const reference rather than a non-const pointer.
+
2003-09-16 Angus Leeming <leeming@lyx.org>
* GraphicsImage.h: separate interface from implementation. Make all the
}
+PreviewedInset::PreviewedInset(InsetOld & inset)
+ : inset_(inset), pimage_(0)
+{}
+
+
BufferView * PreviewedInset::view() const
{
return inset_.view();
pimage_ = &pimage;
if (view())
- view()->updateInset(inset());
+ view()->updateInset(&inset());
}
} // namespace graphics
* Full author contact details are available in file CREDITS.
*
* lyx::graphics::PreviewedInset is an abstract base class that can help
- * insets to generate previews. The daughter class must instantiate three small
+ * insets to generate previews. The daughter class must instantiate two small
* methods. The Inset would own an instance of this daughter class.
*/
static bool activated();
///
- PreviewedInset(InsetOld & inset) : inset_(inset), pimage_(0) {}
- ///
- virtual ~PreviewedInset() {}
+ PreviewedInset(InsetOld & inset);
/** Find the PreviewLoader, add a LaTeX snippet to it and
* start the loading process.
bool previewReady() const;
/// If !previewReady() returns 0.
- PreviewImage const * pimage() const { return pimage_; }
+ PreviewImage const * pimage() const;
protected:
+ ///
+ virtual ~PreviewedInset() {}
/// Allow the daughter classes to cast up to the parent inset.
- InsetOld * inset() const { return &inset_; }
+ InsetOld const & inset() const;
///
BufferView * view() const;
boost::signals::connection connection_;
};
+
+inline
+PreviewImage const * PreviewedInset::pimage() const
+{
+ return pimage_;
+}
+
+
+inline
+InsetOld const & PreviewedInset::inset() const
+{
+ return inset_;
+}
+
} // namespace graphics
} // namespace lyx
+2003-09-16 Angus Leeming <leeming@lyx.org>
+
+ * insetinclude.C (PreviewImpl::parent): return a const reference.
+
2003-09-16 Angus Leeming <leeming@lyx.org>
* insetcollapsable.[Ch]: make all member variables, except for 'inset', private.
///
string const latexString() const;
///
- InsetInclude & parent() const {
- return *static_cast<InsetInclude*>(inset());
+ InsetInclude const & parent() const {
+ return dynamic_cast<InsetInclude const &>(inset());
}
///
+2003-09-16 Angus Leeming <leeming@lyx.org>
+
+ * formula.C (PreviewImpl::parent): return a const reference.
+
2003-09-16 Angus Leeming <leeming@lyx.org>
* formula.C:
///
string const latexString() const;
///
- InsetFormula & parent() const
+ InsetFormula const & parent() const
{
- return *static_cast<InsetFormula*>(inset());
+ return dynamic_cast<InsetFormula const &>(inset());
}
};