Bug 137236 - disable autozoom when picture fits in window
Summary: disable autozoom when picture fits in window
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: ImageEditor-Canvas (show other bugs)
Version: 0.9.0
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-12 15:15 UTC by Thomas Schildknecht
Modified: 2017-08-07 08:40 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 0.9.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schildknecht 2006-11-12 15:15:52 UTC
Version:           0.9.0-beta3 (using KDE 3.5.5, Kubuntu (edgy) 4:3.5.5-0ubuntu3)
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.17-10-generic

in the image editor, the autozoom (I don't know the right english translation...) is always activated, even when the current picture is small and fits in the window. So, when we have a small picture and we wants to zoom in, we must first desactivate the autozoom toolbar button in order to enable the zoom buttons

So it's maybe better to automatically disable the autozoom when then current pictures fits in the windows and to enable the zoom toolbar buttons
Comment 1 Achim Bohnet 2006-12-29 23:59:50 UTC
While solution is not exactly the same, whatever get's done for

  http://bugs.kde.org/show_bug.cgi?id=106508

will affect this bug report. 

DanaKil: please compare your solution witht he suggested ones in
#106508.  Add your opionion there if you disagree (or vote for the
other bug report ;)

Then we can mark this report as a duplicate of #106508

Thx,
Achim
Comment 2 caulier.gilles 2007-03-20 09:26:43 UTC
SVN commit 644497 by cgilles:

digikam from trunk : with small image, autozoom button will adapt image size to canvas size.

BUG: 137236

 M  +9 -17     canvas.cpp  


--- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/canvas.cpp #644496:644497
@@ -351,20 +351,13 @@
 
 void Canvas::updateAutoZoom()
 {
-    double srcWidth, srcHeight, dstWidth, dstHeight;
+    double srcWidth  = d->im->origWidth();
+    double srcHeight = d->im->origHeight();
+    double dstWidth  = contentsRect().width();
+    double dstHeight = contentsRect().height();
 
-    srcWidth  = d->im->origWidth();
-    srcHeight = d->im->origHeight();
-    dstWidth  = contentsRect().width();
-    dstHeight = contentsRect().height();
+    d->zoom = QMIN(dstWidth/srcWidth, dstHeight/srcHeight);
 
-    if (dstWidth > srcWidth &&
-        dstHeight > srcHeight)
-        d->zoom = 1.0;
-    else
-        d->zoom = QMIN(dstWidth/srcWidth,
-                       dstHeight/srcHeight);
-
     d->im->zoom(d->zoom);
     
     emit signalZoomChanged(d->zoom);
@@ -401,8 +394,8 @@
         int centery = contentsRect().height()/2;
         int xoffset = int(centerx - wZ/2);
         int yoffset = int(centery - hZ/2);
-        xoffset = QMAX(xoffset, 0);
-        yoffset = QMAX(yoffset, 0);
+        xoffset     = QMAX(xoffset, 0);
+        yoffset     = QMAX(yoffset, 0);
 
         d->pixmapRect = QRect(xoffset, yoffset, wZ, hZ);
     }
@@ -572,13 +565,12 @@
     p.setBrush(NoBrush);
 
     QRect r(d->rubber->normalize());
-    r = QRect(contentsToViewport(QPoint(r.x(),r.y())), r.size());
+    r = QRect(contentsToViewport(QPoint(r.x(), r.y())), r.size());
 
     QPoint pnt(r.x(), r.y());
 
     style().drawPrimitive(QStyle::PE_FocusRect, &p,
-                          QRect( pnt.x(), pnt.y(),
-                                 r.width(), r.height() ),
+                          QRect(pnt.x(), pnt.y(), r.width(), r.height()),
                           colorGroup(), QStyle::Style_Default,
                           QStyleOption(colorGroup().base()));
     p.end();