]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/xformsImage.C
Change glob() API to accept a dir parameter.
[lyx.git] / src / frontends / xforms / xformsImage.C
index ea97d222b3d5c549803f71774ba90c0a123d6c40..493f5357269bd14e13f24cfa9d027a5096d8b08c 100644 (file)
 #include <config.h>
 
 #include "xformsImage.h"
-#include "graphics/GraphicsParams.h"
 #include "Color.h"
-#include "format.h"
+
 #include "debug.h"
-#include "support/LAssert.h"
+#include "format.h"
+#include "LColor.h"
+
+#include "graphics/GraphicsParams.h"
+
 #include "support/lstrings.h"
-#include "support/lyxfunctional.h"  // compare_memfun
 #include "support/lyxlib.h"
 
 #include "lyx_forms.h"
 # endif
 #endif
 
+#include <boost/bind.hpp>
 #include <boost/tuple/tuple.hpp>
 
-using namespace lyx::support;
+using lyx::frontend::getRGBColor;
 
+using lyx::support::float_equal;
+using lyx::support::prefixIs;
+using lyx::support::rtrim;
+
+using boost::bind;
+
+using std::equal_to;
 using std::find_if;
+using std::string;
 
 
 namespace {
@@ -96,7 +107,9 @@ Image::FormatList xformsImage::loadableFormats()
 
                Formats::const_iterator it =
                        find_if(begin, end,
-                               lyx::compare_memfun(&Format::extension, ext));
+                               bind(equal_to<string>(),
+                                    bind(&Format::extension, _1),
+                                    ext));
                if (it != end)
                        fmts.push_back(it->name());
        }
@@ -146,13 +159,21 @@ xformsImage::~xformsImage()
 }
 
 
-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;
@@ -161,7 +182,7 @@ unsigned int xformsImage::getWidth() const
 }
 
 
-unsigned int xformsImage::getHeight() const
+unsigned int xformsImage::getHeight_impl() const
 {
        if (!image_)
                return 0;
@@ -169,21 +190,13 @@ unsigned int xformsImage::getHeight() const
 }
 
 
-bool xformsImage::isDrawable() const
-{
-       return pixmap_;
-}
-
-
-Pixmap xformsImage::getPixmap() const
+bool xformsImage::isDrawable_impl() 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]
@@ -211,7 +224,7 @@ void xformsImage::load(string const & filename)
 }
 
 
-bool xformsImage::setPixmap(Params const & params)
+bool xformsImage::setPixmap_impl(Params const & params)
 {
        if (!image_ || params.display == NoDisplay)
                return false;
@@ -258,7 +271,7 @@ bool xformsImage::setPixmap(Params const & params)
 }
 
 
-void xformsImage::clip(Params const & params)
+void xformsImage::clip_impl(Params const & params)
 {
        if (!image_)
                return;
@@ -296,7 +309,7 @@ void xformsImage::clip(Params const & params)
 }
 
 
-void xformsImage::rotate(Params const & params)
+void xformsImage::rotate_impl(Params const & params)
 {
        if (!image_)
                return ;
@@ -322,7 +335,7 @@ void xformsImage::rotate(Params const & params)
 }
 
 
-void xformsImage::scale(Params const & params)
+void xformsImage::scale_impl(Params const & params)
 {
        if (!image_)
                return;
@@ -376,7 +389,7 @@ extern "C" {
 
 int status_report(FL_IMAGE * ob, const char *s)
 {
-       Assert(ob && ob->u_vdata);
+       BOOST_ASSERT(ob && ob->u_vdata);
 
        string const str = s ? rtrim(s) : string();
        if (str.empty())
@@ -395,7 +408,7 @@ int status_report(FL_IMAGE * ob, const char *s)
 
 static void error_report(FL_IMAGE * ob, const char *s)
 {
-       Assert(ob && ob->u_vdata);
+       BOOST_ASSERT(ob && ob->u_vdata);
 
        string const str = s ? rtrim(s) : string();
        if (str.empty())
@@ -463,7 +476,7 @@ unsigned int packedcolor(LColor::color col)
        bool const success = getRGBColor(col, r, g, b);
        if (!success)
                // Set to black on failure
-               return FL_PACK(255,255,255);
+               return FL_PACK(255, 255, 255);
 
        return FL_PACK(r, g, b);
 }