mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-28 12:26:59 +00:00
d4ee9c38b6
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1777 a592a061-630c-0410-9148-cb99ea01b6c8
80 lines
1.6 KiB
C++
80 lines
1.6 KiB
C++
// -*- C++ -*-
|
|
/* This file is part of
|
|
* =================================================
|
|
*
|
|
* LyX, The Document Processor
|
|
* Copyright 1995 Matthias Ettrich.
|
|
* Copyright 1995-2000 The LyX Team.
|
|
*
|
|
* This file Copyright 2000 Baruch Even
|
|
* ================================================= */
|
|
|
|
#ifndef GRAPHICSCACHEITEM_H
|
|
#define GRAPHICSCACHEITEM_H
|
|
|
|
#include <config.h>
|
|
|
|
#ifdef __GNUG__
|
|
#pragma interface
|
|
#endif
|
|
|
|
#include XPM_H_LOCATION
|
|
#include "LString.h"
|
|
|
|
#include <boost/utility.hpp>
|
|
#include <boost/smart_ptr.hpp>
|
|
|
|
#include <sigc++/signal_system.h>
|
|
|
|
class LyXImage;
|
|
|
|
/// A GraphicsCache item holder.
|
|
class GraphicsCacheItem : public boost::noncopyable {
|
|
public:
|
|
/// c-tor
|
|
GraphicsCacheItem(string const & filename);
|
|
/// d-tor, frees the image structures.
|
|
~GraphicsCacheItem();
|
|
|
|
/// Return a pixmap that can be displayed on X server.
|
|
LyXImage * getImage() const;
|
|
///
|
|
enum ImageStatus {
|
|
///
|
|
Loading = 1,
|
|
///
|
|
ErrorConverting,
|
|
///
|
|
ErrorReading,
|
|
///
|
|
UnknownError,
|
|
///
|
|
Loaded
|
|
};
|
|
|
|
/// Is the pixmap ready for display?
|
|
ImageStatus getImageStatus() const;
|
|
|
|
/** Get a notification when the image conversion is done.
|
|
used by an internal callback mechanism.
|
|
*/
|
|
void imageConverted(int retval);
|
|
|
|
private:
|
|
bool renderXPM(string const & filename);
|
|
void loadXPMImage();
|
|
|
|
/** The filename we refer too.
|
|
This is used when removing ourselves from the cache.
|
|
*/
|
|
string filename_;
|
|
/// The temporary file that we use
|
|
string tempfile;
|
|
/// The image status
|
|
ImageStatus imageStatus_;
|
|
/// The image (if it got loaded)
|
|
boost::scoped_ptr<LyXImage> image_;
|
|
};
|
|
|
|
#endif
|