]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/GraphicsCacheItem.h
small fix with footnote, use stringstream some more
[lyx.git] / src / graphics / GraphicsCacheItem.h
index 01843f46ceeb8fd90f4602dd42304d4de3af8fd2..5f22d950c5e7269b10c7ab6c1c9c4abe439087f8 100644 (file)
 #include XPM_H_LOCATION
 #include "LString.h"
 
-#include "sigc++/signal_system.h"
-#ifdef SIGC_CXX_NAMESPACES
-using SigC::Signal0;
-#endif
-
-
-/* (Baruch Even 2000-08-05)
- * This has a major drawback: it is only designed for X servers, no easy
- * porting to non X-server based platform is offered right now, this is done
- * in order to get a first version out of the door.
- *
- * Later versions should consider how to do this with more platform 
- * independence, this will probably involve changing the Painter class too.
- */
+#include <boost/utility.hpp>
+#include <boost/smart_ptr.hpp>
 
-class GraphicsCacheItem_pimpl;
+#include <sigc++/signal_system.h>
 
+class LyXImage;
 
 /// A GraphicsCache item holder.
-class GraphicsCacheItem {
+class GraphicsCacheItem : boost::noncopyable {
 public:
+       /// c-tor
+       GraphicsCacheItem(string const & filename);
        /// d-tor, frees the image structures.
        ~GraphicsCacheItem();
-       /// copy c-tor.
-       GraphicsCacheItem(GraphicsCacheItem const &);
-       /// Assignment operator.
-       GraphicsCacheItem & operator=(GraphicsCacheItem const &);
        
-       /// Get the height of the image. Returns -1 on error.
-       int getHeight() const; 
-       
-       /// Get the width of the image. Returns -1 on error.
-       int getWidth() const; 
-
        /// Return a pixmap that can be displayed on X server.
-       Pixmap getImage() const; 
+       LyXImage * getImage() const; 
        ///
        enum ImageStatus {
                ///
@@ -66,6 +47,8 @@ public:
                ///
                ErrorReading,
                ///
+               UnknownError,
+               ///
                Loaded
        };
        
@@ -78,27 +61,19 @@ public:
        void imageConverted(int retval);
 
 private:
-       /// Private c-tor so that only GraphicsCache can create an instance.
-       GraphicsCacheItem();
-
-       /// internal copy mechanism.
-       void copy(GraphicsCacheItem const &);
-       /// internal destroy mechanism.
-       void destroy();
-
-       /// Set the filename this item will be pointing too.
-       bool setFilename(string const & filename);
-
-       ///
-       friend class GraphicsCache;
-
-       ///
-       GraphicsCacheItem_pimpl * pimpl;
+       bool convertImage(string const & filename);
+       void loadImage();
 
        /** 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