A little further clean-up.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7895 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-10-10 21:24:06 +00:00
parent dff822442a
commit 1c4ae33f9a
4 changed files with 13 additions and 16 deletions

View File

@ -1,3 +1,10 @@
2003-10-10 Angus Leeming <leeming@lyx.org>
* insetinclude.C (metrics): use preview_->metrics.
(draw): use preview_->draw.
* render_preview.[Ch] (pimage): removed.
2003-10-10 Angus Leeming <leeming@lyx.org> 2003-10-10 Angus Leeming <leeming@lyx.org>
* renderers.[Ch]: removed. * renderers.[Ch]: removed.

View File

@ -519,9 +519,7 @@ void InsetInclude::fillWithBibKeys(Buffer const & buffer,
void InsetInclude::metrics(MetricsInfo & mi, Dimension & dim) const void InsetInclude::metrics(MetricsInfo & mi, Dimension & dim) const
{ {
if (preview_->previewReady()) { if (preview_->previewReady()) {
dim.asc = preview_->pimage()->ascent(); preview_->metrics(mi, dim);
dim.des = preview_->pimage()->descent();
dim.wid = preview_->pimage()->width();
} else { } else {
if (!set_label_) { if (!set_label_) {
set_label_ = true; set_label_ = true;
@ -555,8 +553,7 @@ void InsetInclude::draw(PainterInfo & pi, int x, int y) const
preview_->startMonitoring(included_file); preview_->startMonitoring(included_file);
} }
pi.pain.image(x + button_.box().x1, y - dim_.asc, dim_.wid, dim_.height(), preview_->draw(pi, x + button_.box().x1, y);
*(preview_->pimage()->image()));
} }

View File

@ -60,9 +60,9 @@ RenderBase * RenderPreview::clone() const
void RenderPreview::metrics(MetricsInfo &, Dimension & dim) const void RenderPreview::metrics(MetricsInfo &, Dimension & dim) const
{ {
if (previewReady()) { if (previewReady()) {
dim.asc = pimage()->ascent(); dim.asc = pimage_->ascent();
dim.des = pimage()->descent(); dim.des = pimage_->descent();
dim.wid = pimage()->width(); dim.wid = pimage_->width();
} else { } else {
dim.asc = 20; dim.asc = 20;
dim.des = 20; dim.des = 20;
@ -75,15 +75,12 @@ void RenderPreview::metrics(MetricsInfo &, Dimension & dim) const
void RenderPreview::draw(PainterInfo & pi, int x, int y) const void RenderPreview::draw(PainterInfo & pi, int x, int y) const
{ {
BOOST_ASSERT(pi.base.bv);
view_ = pi.base.bv->owner()->view();
if (!previewReady()) if (!previewReady())
pi.pain.rectangle(x, y - dim_.asc, dim_.wid, dim_.height(), pi.pain.rectangle(x, y - dim_.asc, dim_.wid, dim_.height(),
LColor::foreground); LColor::foreground);
else else
pi.pain.image(x, y - dim_.asc, dim_.wid, dim_.height(), pi.pain.image(x, y - dim_.asc, dim_.wid, dim_.height(),
*(pimage()->image())); *(pimage_->image()));
} }

View File

@ -73,10 +73,6 @@ public:
/// The preview has been generated and is ready to use. /// The preview has been generated and is ready to use.
bool previewReady() const; bool previewReady() const;
/// If the preview is not ready, returns 0.
lyx::graphics::PreviewImage const * const pimage() const
{ return pimage_; }
/// Connect and you'll be informed when the preview is ready. /// Connect and you'll be informed when the preview is ready.
typedef boost::signal0<void>::slot_type slot_type; typedef boost::signal0<void>::slot_type slot_type;
boost::signals::connection connect(slot_type const &); boost::signals::connection connect(slot_type const &);