X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fgraphics%2FGraphicsImage.h;h=6d31f53016f4d311e671d51ada70aa9e0d95f966;hb=13349032cb4dc8ef44146aa652ff6bbff6698249;hp=1afa3bf980145da19b9c393cbbfd566ff8a545a3;hpb=8283e978f8d621041c432b9b88a476bfd567385c;p=lyx.git diff --git a/src/graphics/GraphicsImage.h b/src/graphics/GraphicsImage.h index 1afa3bf980..6d31f53016 100644 --- a/src/graphics/GraphicsImage.h +++ b/src/graphics/GraphicsImage.h @@ -1,19 +1,21 @@ // -*- C++ -*- /** * \file GraphicsImage.h - * Copyright 2002 the LyX Team - * Read the file COPYING + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * \author Baruch Even - * \author Angus Leeming + * \author Baruch Even + * \author Angus Leeming + * + * Full author contact details are available in file CREDITS * * An abstract base class for the images themselves. * Allows the user to retrieve the pixmap, once loaded and to issue commands * to modify it. * - * The signals newImage and loadableFormats are connected to the approriate - * derived classes elsewhere, allowing the graphics cache to access them - * without knowing anything about their instantiation. + * The boost::functions newImage and loadableFormats are connected to the + * appropriate derived classes elsewhere, allowing the graphics cache to + * access them without knowing anything about their instantiation. * * The loading process can be asynchronous, but cropping, rotating and * scaling block execution. @@ -22,13 +24,14 @@ #ifndef GRAPHICSIMAGE_H #define GRAPHICSIMAGE_H -#include "GraphicsTypes.h" #include "LString.h" -#include -#include + +#include +#include +#include + #include #include -#include #ifdef __GNUG__ #pragma interface @@ -36,29 +39,31 @@ namespace grfx { -class GParams; +class Params; -class GImage -{ +class Image { public: - /// A list of supported formats. - typedef std::vector FormatList; - /** This will be connected to a function that will return whichever - * derived class we desire. + /** This is to be connected to a function that will return a new + * instance of a viable derived class. */ - static SigC::Signal0 newImage; + typedef boost::shared_ptr ImagePtr; + /// + static boost::function0 newImage; /// Return the list of loadable formats. - static SigC::Signal0 loadableFormats; + typedef std::vector FormatList; + /// + static boost::function0 loadableFormats; + /// Must define default c-tor explicitly as we define a copy c-tor. + Image() {} + /// Don't copy the signal finishedLoading + Image(Image const &) {} /// - virtual ~GImage() {} + virtual ~Image() {} /// Create a copy - virtual GImage * clone() const = 0; - - /// - virtual Pixmap getPixmap() const = 0; + virtual Image * clone() const = 0; /// Get the image width virtual unsigned int getWidth() const = 0; @@ -66,37 +71,44 @@ public: /// Get the image height virtual unsigned int getHeight() const = 0; - /** At the end of the loading or modification process, return the new - * image by emitting this signal */ - typedef SigC::Signal1 SignalType; + /// is the image drawable ? + virtual bool isDrawable() const = 0; + + /** At the end of the loading process inform the outside world + * by emitting a signal. + */ + typedef boost::signal1 SignalType; /// - typedef boost::shared_ptr SignalTypePtr; + SignalType finishedLoading; - /// Start loading the image file. - virtual void load(string const & filename, SignalTypePtr) = 0; + /** Start loading the image file. + * The caller should expect this process to be asynchronous and + * so should connect to the "finished" signal above. + */ + virtual void load(string const & filename) = 0; /** Generate the pixmap. * Uses the params to decide on color, grayscale etc. * Returns true if the pixmap is created. */ - virtual bool setPixmap(GParams const & params) = 0; + virtual bool setPixmap(Params const & params) = 0; /// Clip the image using params. - virtual void clip(GParams const & params) = 0; + virtual void clip(Params const & params) = 0; /// Rotate the image using params. - virtual void rotate(GParams const & params) = 0; + virtual void rotate(Params const & params) = 0; /// Scale the image using params. - virtual void scale(GParams const & params) = 0; + virtual void scale(Params const & params) = 0; protected: /** Uses the params to ascertain the dimensions of the scaled image. * Returned as make_pair(width, height). - * If something geso wrong, returns make_pair(getWidth(), getHeight()) + * If something goes wrong, returns make_pair(getWidth(), getHeight()) */ std::pair - getScaledDimensions(GParams const & params) const; + getScaledDimensions(Params const & params) const; }; } // namespace grfx