+2003-09-16 Angus Leeming <leeming@lyx.org>
+
+ * QLImage.[Ch]: separate interface from implementation. Make all the virtual
+ functions private.
+
2003-09-16 Angus Leeming <leeming@lyx.org>
* QCharacter.C, QPrefs.C, lyx_gui.C: add #include "LColor.h".
}
-Image * QLImage::clone() const
+Image * QLImage::clone_impl() const
{
return new QLImage(*this);
}
-unsigned int QLImage::getWidth() const
+unsigned int QLImage::getWidth_impl() const
{
return xformed_pixmap_.width();
}
-unsigned int QLImage::getHeight() const
+unsigned int QLImage::getHeight_impl() const
{
return xformed_pixmap_.height();
}
-void QLImage::load(string const & filename)
+void QLImage::load_impl(string const & filename)
{
if (!pixmap_.isNull()) {
lyxerr[Debug::GRAPHICS]
}
-bool QLImage::setPixmap(Params const & params)
+bool QLImage::setPixmap_impl(Params const & params)
{
if (pixmap_.isNull() || params.display == NoDisplay)
return false;
}
-void QLImage::clip(Params const & params)
+void QLImage::clip_impl(Params const & params)
{
if (xformed_pixmap_.isNull())
return;
}
-void QLImage::rotate(Params const & params)
+void QLImage::rotate_impl(Params const & params)
{
if (xformed_pixmap_.isNull())
return;
}
-void QLImage::scale(Params const & params)
+void QLImage::scale_impl(Params const & params)
{
if (xformed_pixmap_.isNull())
return;
static FormatList loadableFormats();
~QLImage();
-
- /// Create a copy
- virtual Image * clone() const;
-
QPixmap const & qpixmap() const { return xformed_pixmap_; }
+private:
+ /// Create a copy
+ virtual Image * clone_impl() const;
/// Get the image width
- virtual unsigned int getWidth() const;
-
+ virtual unsigned int getWidth_impl() const;
/// Get the image height
- virtual unsigned int getHeight() const;
-
- // FIXME
- virtual bool isDrawable() const { return true; }
-
+ virtual unsigned int getHeight_impl() const;
+ // FIXME Is the image drawable ?
+ virtual bool isDrawable_impl() const { return true; }
/**
* Load the image file into memory.
* The process is asynchronous, so this method starts the loading.
* When finished, the Image::finishedLoading signal is emitted.
*/
- virtual void load(string const & filename);
-
+ virtual void load_impl(string const & filename);
/**
* Generate the pixmap, based on the current state of
* image_ (clipped, rotated, scaled etc).
* Uses the params to decide on color, grayscale etc.
* Returns true if the pixmap is created.
*/
- virtual bool setPixmap(Params const & params);
-
+ virtual bool setPixmap_impl(Params const & params);
/// Clip the image using params.
- virtual void clip(Params const & params);
-
+ virtual void clip_impl(Params const & params);
/// Rotate the image using params.
- virtual void rotate(Params const & params);
-
+ virtual void rotate_impl(Params const & params);
/// Scale the image using params.
- virtual void scale(Params const & params);
-private:
+ virtual void scale_impl(Params const & params);
+
/// Access to the class is through newImage() and clone.
QLImage();
///
+2003-09-16 Angus Leeming <leeming@lyx.org>
+
+ * xformsImage.[Ch]: separate interface from implementation. Make all the virtual
+ functions private.
+
2003-09-16 Lars Gullik Bjønnes <larsbj@gullik.net>
* lyx_gui.C: use namespace alias for lyx::support::os
}
-Image * xformsImage::clone() const
+Pixmap xformsImage::getPixmap() const
+{
+ if (!pixmap_status_ == PIXMAP_SUCCESS)
+ return 0;
+ return pixmap_;
+}
+
+
+Image * xformsImage::clone_impl() const
{
return new xformsImage(*this);
}
-unsigned int xformsImage::getWidth() const
+unsigned int xformsImage::getWidth_impl() const
{
if (!image_)
return 0;
}
-unsigned int xformsImage::getHeight() const
+unsigned int xformsImage::getHeight_impl() const
{
if (!image_)
return 0;
}
-bool xformsImage::isDrawable() const
+bool xformsImage::isDrawable_impl() const
{
return pixmap_;
}
-Pixmap xformsImage::getPixmap() const
-{
- if (!pixmap_status_ == PIXMAP_SUCCESS)
- return 0;
- return pixmap_;
-}
-
-
-void xformsImage::load(string const & filename)
+void xformsImage::load_impl(string const & filename)
{
if (image_) {
lyxerr[Debug::GRAPHICS]
}
-bool xformsImage::setPixmap(Params const & params)
+bool xformsImage::setPixmap_impl(Params const & params)
{
if (!image_ || params.display == NoDisplay)
return false;
}
-void xformsImage::clip(Params const & params)
+void xformsImage::clip_impl(Params const & params)
{
if (!image_)
return;
}
-void xformsImage::rotate(Params const & params)
+void xformsImage::rotate_impl(Params const & params)
{
if (!image_)
return ;
}
-void xformsImage::scale(Params const & params)
+void xformsImage::scale_impl(Params const & params)
{
if (!image_)
return;
///
~xformsImage();
-
- /// Create a copy
- Image * clone() const;
-
///
Pixmap getPixmap() const;
- /// Get the image width
- unsigned int getWidth() const;
+ /// Internal callbacks.
+ void statusCB(string const &);
+ void errorCB(string const &);
+private:
+ /// Create a copy
+ virtual Image * clone_impl() const;
+ /// Get the image width
+ virtual unsigned int getWidth_impl() const;
/// Get the image height
- unsigned int getHeight() const;
-
- virtual bool isDrawable() const;
-
+ virtual unsigned int getHeight_impl() const;
+ /// Is the image drawable ?
+ virtual bool isDrawable_impl() const;
/** Load the image file into memory.
* The process is asynchronous, so this method starts the loading.
* When finished, the Image::finishedLoading signal is emitted.
*/
- void load(string const & filename);
-
+ virtual void load_impl(string const & filename);
/** Generate the pixmap, based on the current state of
* image_ (clipped, rotated, scaled etc).
* Uses the params to decide on color, grayscale etc.
* Returns true if the pixmap is created.
*/
- bool setPixmap(Params const & params);
-
+ bool setPixmap_impl(Params const & params);
/// Clip the image using params.
- void clip(Params const & params);
+ virtual void clip_impl(Params const & params);
/// Rotate the image using params.
- void rotate(Params const & params);
+ virtual void rotate_impl(Params const & params);
/// Scale the image using params.
- void scale(Params const & params);
-
- /// Internal callbacks.
- void statusCB(string const &);
- ///
- void errorCB(string const &);
+ virtual void scale_impl(Params const & params);
-private:
/// Access to the class is through newImage() and clone.
xformsImage();
///
+2003-09-16 Angus Leeming <leeming@lyx.org>
+
+ * GraphicsImage.h: separate interface from implementation. Make all the
+ pure virtual functions private.
+
2003-09-16 Angus Leeming <leeming@lyx.org>
* PreviewLoader.C: add #include "LColor.h".
///
static boost::function0<FormatList> 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 ~Image() {}
/// Create a copy
- virtual Image * clone() const = 0;
+ Image * clone() const;
/// Get the image width
- virtual unsigned int getWidth() const = 0;
+ unsigned int getWidth() const;
/// Get the image height
- virtual unsigned int getHeight() const = 0;
+ unsigned int getHeight() const;
- /// is the image drawable ?
- virtual bool isDrawable() const = 0;
+ /// Is the image drawable ?
+ bool isDrawable() const;
/** At the end of the loading process inform the outside world
* by emitting a signal.
* 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;
+ void load(string const & filename);
/** Generate the pixmap.
* Uses the params to decide on color, grayscale etc.
* Returns true if the pixmap is created.
*/
- virtual bool setPixmap(Params const & params) = 0;
+ bool setPixmap(Params const & params);
/// Clip the image using params.
- virtual void clip(Params const & params) = 0;
+ void clip(Params const & params);
/// Rotate the image using params.
- virtual void rotate(Params const & params) = 0;
+ void rotate(Params const & params);
/// Scale the image using params.
- virtual void scale(Params const & params) = 0;
+ void scale(Params const & params);
protected:
+ /// Must define default c-tor explicitly as we define a copy c-tor.
+ Image() {}
+ /// Don't copy the signal finishedLoading
+ Image(Image const &) {}
+
/** Uses the params to ascertain the dimensions of the scaled image.
* Returned as make_pair(width, height).
* If something goes wrong, returns make_pair(getWidth(), getHeight())
*/
std::pair<unsigned int, unsigned int>
getScaledDimensions(Params const & params) const;
+
+private:
+ /// Create a copy
+ virtual Image * clone_impl() const = 0;
+ /// Get the image width
+ virtual unsigned int getWidth_impl() const = 0;
+
+ /// Get the image height
+ virtual unsigned int getHeight_impl() const = 0;
+
+ /// is the image drawable ?
+ virtual bool isDrawable_impl() const = 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_impl(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_impl(Params const & params) = 0;
+
+ /// Clip the image using params.
+ virtual void clip_impl(Params const & params) = 0;
+
+ /// Rotate the image using params.
+ virtual void rotate_impl(Params const & params) = 0;
+
+ /// Scale the image using params.
+ virtual void scale_impl(Params const & params) = 0;
};
+
+inline
+Image * Image::clone() const
+{
+ return clone_impl();
+}
+
+
+inline
+unsigned int Image::getWidth() const
+{
+ return getWidth_impl();
+}
+
+
+inline
+unsigned int Image::getHeight() const
+{
+ return getHeight_impl();
+}
+
+
+inline
+bool Image::isDrawable() const
+{
+ return isDrawable_impl();
+}
+
+
+inline
+void Image::load(string const & filename)
+{
+ return load_impl(filename);
+}
+
+
+inline
+bool Image::setPixmap(Params const & params)
+{
+ return setPixmap_impl(params);
+}
+
+
+inline
+void Image::clip(Params const & params)
+{
+ return clip_impl(params);
+}
+
+
+inline
+void Image::rotate(Params const & params)
+{
+ return rotate_impl(params);
+}
+
+
+inline
+void Image::scale(Params const & params)
+{
+ return scale_impl(params);
+}
+
} // namespace graphics
} // namespace lyx