+2004-04-20 Angus Leeming <leeming@lyx.org>
+
+ * render_preview.C (startLoading): remove lyxerr statement.
+ (draw): cosmetics.
+ (getPreviewLoader): new helper function.
+
2004-04-19 Angus Leeming <leeming@lyx.org>
* insetexternal.C:
* insetgraphics.C:
* insetinclude.C: ensuing simplification of the client code.
(statusChanged): now superfluous. Removed.
-
+
2004-04-12 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* ExternalTemplate.[Ch]: remove editCommand
2004-04-07 Angus Leeming <leeming@lyx.org>
- * insetexternal.C (priv_dispatch):
+ * insetexternal.C (priv_dispatch):
* insetinclude.C (priv_dispatch): prevent crash by invoking
InsetOld::priv_dispatch at the end of the switch, rather than
InsetOld::dispatch...
filename where appropriate
2004-04-05 André Pönitz <poenitz@gmx.net>
-
+
* insetbase.h: use LCursor & in notifyCursorLeave
2004-04-05 Angus Leeming <leeming@lyx.org>
2004-04-01 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
- * insetfloat.C (read): fix reading of float params
+ * insetfloat.C (read): fix reading of float params
(recognize "type")
2004-03-31 Alfredo Braunstein <abraunst@lyx.org>
2004-03-29 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* insetbibtex.[Ch]: bibtopic support.
-
+
* insetfloat.[Ch]: add param \sideways {true|false}
(support for sideways floats from rotating.sty).
2004-03-09 Alfredo Braunstein <abraunst@lyx.org>
- * insetcollapsable.[Ch] (metrics, draw): implemented an inlined-Open
+ * insetcollapsable.[Ch] (metrics, draw): implemented an inlined-Open
submode.
2004-03-07 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
2004-03-05 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* insetcite.C: Support second \cite option.
-
+
* insetcommand.[Ch]:
* insetcommandparams.[Ch]: add second optional argument.
* insetbase.C:
* insetbase.[Ch]: remove explicit 'DispatchResult' return type and
implicitly assume 'DispatchResult(true, true) with exception of
- InsetBase::priv_dispatch which does the equivalent of
+ InsetBase::priv_dispatch which does the equivalent of
'retrun DispatchResult(false)'
* inset*.[Ch] (priv_dispatch): adjust
2004-02-04 Alfredo Braunstein <abraunst@lyx.org>
- * insettext.C (edit):
+ * insettext.C (edit):
(updateLocal): use the cur argument instead of the global cursor
* insetcollapsable.C (edit): dont call inset.edit(x,y) when opening
#include "insets/inset.h"
#include "BufferView.h"
-#include "debug.h"
#include "dimension.h"
#include "gettext.h"
#include "LColor.h"
namespace {
+graphics::PreviewLoader & getPreviewLoader(Buffer const & buffer)
+{
+ graphics::Previews const & previews = graphics::Previews::get();
+ return previews.loader(buffer);
+}
+
+
string const statusMessage(BufferView const * bv, string const & snippet)
{
BOOST_ASSERT(bv && bv->buffer());
Buffer const & buffer = *bv->buffer();
- graphics::Previews const & previews = graphics::Previews::get();
- graphics::PreviewLoader const & loader = previews.loader(buffer);
+ graphics::PreviewLoader const & loader = getPreviewLoader(buffer);
graphics::PreviewLoader::Status const status = loader.status(snippet);
string message;
graphics::PreviewImage const *
RenderPreview::getPreviewImage(Buffer const & buffer) const
{
- graphics::Previews & previews = graphics::Previews::get();
- graphics::PreviewLoader & loader = previews.loader(buffer);
+ graphics::PreviewLoader const & loader = getPreviewLoader(buffer);
return loader.preview(snippet_);
}
-
+
void RenderPreview::metrics(MetricsInfo & mi, Dimension & dim) const
{
graphics::PreviewImage const * const pimage =
getPreviewImage(*pi.base.bv->buffer());
+ graphics::Image const * const image = pimage ? pimage->image() : 0;
- if (pimage && pimage->image()) {
+ if (image) {
pi.pain.image(x, y - dim_.asc, dim_.wid, dim_.height(),
- *(pimage->image()));
- return;
- }
+ *image);
+
+ } else {
+ int const offset = InsetOld::TEXT_TO_INSET_OFFSET;
+
+ pi.pain.rectangle(x + offset,
+ y - dim_.asc,
+ dim_.wid - 2 * offset,
+ dim_.asc + dim_.des,
+ LColor::foreground);
- pi.pain.rectangle(x + InsetOld::TEXT_TO_INSET_OFFSET,
- y - dim_.asc,
- dim_.wid - 2 * InsetOld::TEXT_TO_INSET_OFFSET,
- dim_.asc + dim_.des,
- LColor::foreground);
-
- LyXFont font(pi.base.font);
- font.setFamily(LyXFont::SANS_FAMILY);
- font.setSize(LyXFont::SIZE_FOOTNOTE);
- pi.pain.text(x + InsetOld::TEXT_TO_INSET_OFFSET + 6,
- y - font_metrics::maxAscent(font) - 4,
- statusMessage(pi.base.bv, snippet_), font);
+ LyXFont font(pi.base.font);
+ font.setFamily(LyXFont::SANS_FAMILY);
+ font.setSize(LyXFont::SIZE_FOOTNOTE);
+
+ pi.pain.text(x + offset + 6,
+ y - font_metrics::maxAscent(font) - 4,
+ statusMessage(pi.base.bv, snippet_), font);
+ }
}
if (status() == LyXRC::PREVIEW_OFF || snippet_.empty())
return;
- graphics::Previews & previews = graphics::Previews::get();
- graphics::PreviewLoader & loader = previews.loader(buffer);
+ graphics::PreviewLoader const & loader = getPreviewLoader(buffer);
loader.startLoading();
- lyxerr << "RenderPreview::startLoading: " << snippet_ << std::endl;
}
if (status() == LyXRC::PREVIEW_OFF)
return;
- graphics::Previews & previews = graphics::Previews::get();
- graphics::PreviewLoader & loader = previews.loader(buffer);
+ graphics::PreviewLoader & loader = getPreviewLoader(buffer);
addPreview(latex_snippet, loader);
}
if (snippet_.empty())
return;
- graphics::Previews & previews = graphics::Previews::get();
- graphics::PreviewLoader & loader = previews.loader(buffer);
+ graphics::PreviewLoader & loader = getPreviewLoader(buffer);
loader.remove(snippet_);
snippet_.erase();
}