]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt2/QLImage.C
better selection and scrolling behaviour
[lyx.git] / src / frontends / qt2 / QLImage.C
index 787bc17aa8cbdfdcb51e2f1499d7c54fdad18c5c..1d70b20ea67066e1351284be0366cc0192f46892 100644 (file)
@@ -160,26 +160,21 @@ bool QLImage::setPixmap(Params const & params)
 
        lyxerr[Debug::GRAPHICS] << "setPixmap()" << endl;
 
-// FIXME
-#if 0
-       int color_key;
-       switch (params.display) {
-       case MonochromeDisplay:
-               color_key = FL_IMAGE_MONO;
-               break;
-       case GrayscaleDisplay:
-               color_key = FL_IMAGE_GRAY;
-               break;
-       case ColorDisplay:
-       default: // NoDisplay cannot happen!
-               color_key = FL_IMAGE_RGB;
-               break;
-       }
+       // FIXME: it's a fake kind of grayscale !
 
-       if (color_key != FL_IMAGE_RGB) {
-               flimage_convert(image_, color_key, 0);
+       switch (params.display) {
+               case GrayscaleDisplay:
+               case MonochromeDisplay: {
+                       QImage i(xformed_pixmap_.convertToImage());
+                       xformed_pixmap_.convertFromImage(i, QPixmap::Mono);
+                       break;
+               }
+
+               default:
+                       break;
        }
-
+// FIXME
+#if 0
        unsigned int fill = packedcolor(LColor::graphicsbg);
        if (fill != image_->fill_color) {
                // the background color has changed.
@@ -217,8 +212,8 @@ void QLImage::clip(Params const & params)
                return;
 
        int const xoffset_l = params.bb.xl;
-       int const yoffset_t = ( pixmap_.height() > params.bb.yt ?
-                               pixmap_.height() - params.bb.yt : 0 );
+       int const yoffset_t = (pixmap_.height() > params.bb.yt ?
+                               pixmap_.height() - params.bb.yt : 0);
 
        xformed_pixmap_.resize(new_width, new_height);
        QPainter p;
@@ -259,9 +254,10 @@ void QLImage::scale(Params const & params)
        if (width == getWidth() && height == getHeight())
                return;
 
-       lyxerr[Debug::GRAPHICS] << "resizing image to " << width << "(" <<
-               (double(width)/getWidth()) << ")," << height << "(" <<
-               (double(height)/getHeight()) << ")" << endl;
+       lyxerr[Debug::GRAPHICS] << "resizing image to " << width << '('
+                               << (double(width)/getWidth()) << "),"
+                               << height << '('
+                               << (double(height)/getHeight()) << ')' << endl;
        QWMatrix m;
        m.scale(double(width) / getWidth(), double(height) / getHeight());
        xformed_pixmap_ = xformed_pixmap_.xForm(m);