2002-07-05 21:24:15 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file PreviewImage.h
|
2002-09-05 15:14:23 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-07-05 21:24:15 +00:00
|
|
|
*
|
2002-09-05 11:31:30 +00:00
|
|
|
* \author Angus Leeming
|
|
|
|
*
|
2002-09-05 14:10:50 +00:00
|
|
|
* Full author contact details are available in file CREDITS
|
2002-07-05 21:24:15 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PREVIEWIMAGE_H
|
|
|
|
#define PREVIEWIMAGE_H
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "LString.h"
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
|
|
|
|
2002-07-15 11:08:46 +00:00
|
|
|
class Inset;
|
|
|
|
class BufferView;
|
|
|
|
|
2002-07-05 21:24:15 +00:00
|
|
|
namespace grfx {
|
|
|
|
|
|
|
|
class PreviewLoader;
|
|
|
|
class Image;
|
|
|
|
|
|
|
|
class PreviewImage {
|
|
|
|
public:
|
|
|
|
/** ascent = height * ascent_frac
|
|
|
|
* descent = height * (1 - ascent_frac)
|
|
|
|
*/
|
|
|
|
PreviewImage(PreviewLoader & parent,
|
|
|
|
string const & latex_snippet,
|
|
|
|
string const & bitmap_file,
|
|
|
|
double ascent_frac);
|
|
|
|
///
|
|
|
|
~PreviewImage();
|
|
|
|
|
|
|
|
///
|
|
|
|
string const & snippet() const;
|
|
|
|
///
|
|
|
|
int ascent() const;
|
|
|
|
///
|
|
|
|
int descent() const;
|
|
|
|
///
|
|
|
|
int width() const;
|
2002-07-15 11:08:46 +00:00
|
|
|
|
|
|
|
/** If the image is not yet loaded (WaitingToLoad), then this method
|
|
|
|
* triggers that.
|
|
|
|
* inset and bv are passed so we can choose to load only
|
|
|
|
* those insets that are visible.
|
|
|
|
*/
|
|
|
|
Image const * image(Inset const & inset, BufferView const & bv) const;
|
2002-07-05 21:24:15 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
/// Use the Pimpl idiom to hide the internals.
|
|
|
|
class Impl;
|
|
|
|
/// The pointer never changes although *pimpl_'s contents may.
|
|
|
|
boost::scoped_ptr<Impl> const pimpl_;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace grfx
|
|
|
|
|
|
|
|
#endif // PREVIEWIMAGE_H
|