[Digikam-devel] extragear/graphics/digikam/utilities/imageeditor/canvas

Gilles Caulier caulier.gilles at gmail.com
Thu Apr 5 11:57:40 BST 2007


SVN commit 650728 by cgilles:

digikam from trunk : image editor canvas : do not lost the current image selection if the a resize event appear.

CCMAIL: digikam-devel at kde.org

 M  +7 -10     canvas.cpp  
 M  +1 -1      canvas.h  


--- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/canvas.cpp #650727:650728
@@ -253,7 +253,7 @@
     if (d->autoZoom)
         updateAutoZoom();
 
-    updateContentsSize();
+    updateContentsSize(true);
 
     viewport()->setUpdatesEnabled(true);
     viewport()->update();
@@ -359,7 +359,6 @@
 QRect Canvas::getSelectedArea()
 {
     int x, y, w, h;
-    
     d->im->getSelectedArea(x, y, w, h);
     return ( QRect(x, y, w, h) );
 }
@@ -372,7 +371,6 @@
     double srcHeight = d->im->origHeight();
     double dstWidth  = contentsRect().width();
     double dstHeight = contentsRect().height();
-
     return QMIN(dstWidth/srcWidth, dstHeight/srcHeight);
 }
 
@@ -380,11 +378,10 @@
 {
     d->zoom = calcAutoZoomFactor();
     d->im->zoom(d->zoom);
-    
     emit signalZoomChanged(d->zoom);
 }
 
-void Canvas::updateContentsSize()
+void Canvas::updateContentsSize(bool deleteRubber)
 {
     viewport()->setUpdatesEnabled(false);
 
@@ -395,7 +392,7 @@
     viewport()->unsetCursor();
     viewport()->setMouseTracking(false);
 
-    if (d->rubber)
+    if (deleteRubber && d->rubber)
     {
         delete d->rubber;
         d->rubber = 0;
@@ -439,7 +436,7 @@
     if (d->autoZoom)
         updateAutoZoom();
 
-    updateContentsSize();
+    updateContentsSize(false);
 
     // No need to repaint. its called   
     // automatically after resize
@@ -926,7 +923,7 @@
     } 
 
     d->im->zoom(d->zoom);
-    updateContentsSize();
+    updateContentsSize(true);
 
     viewport()->setUpdatesEnabled(false);
     center((int)(((cpx * d->zoom) * (d->tileSize / d->zoom)) / floor(d->tileSize / d->zoom)), 
@@ -954,7 +951,7 @@
 
     d->im->zoom(d->zoom);
 
-    updateContentsSize();
+    updateContentsSize(true);
     viewport()->update();
 }
 
@@ -1196,7 +1193,7 @@
         updateAutoZoom();
     d->im->zoom(d->zoom);
 
-    updateContentsSize();
+    updateContentsSize(true);
     viewport()->update();
 
     // To be sure than corner widget used to pan image will be hide/show 
--- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/canvas.h #650727:650728
@@ -118,7 +118,7 @@
     QRect calcSeletedArea();
     double calcAutoZoomFactor();
     void updateAutoZoom();
-    void updateContentsSize();
+    void updateContentsSize(bool deleteRubber);
     void drawRubber();
 
     void paintViewport(const QRect& er, bool antialias);



More information about the Digikam-devel mailing list