Bug 137391 - picture navigation in image editor using the mouse
Summary: picture navigation in image editor using the mouse
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Unclassified
Component: Usability-Mouse (show other bugs)
Version: unspecified
Platform: unspecified Other
: NOR wishlist (vote)
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-15 15:17 UTC by Nadav Kavalerchik
Modified: 2017-08-06 09:41 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 Nadav Kavalerchik 2006-11-15 15:17:03 UTC
Version:           3.5.5, Debian Package 4:3.5.5a.dfsg.1-3 (4.0) (using KDE Linux (i686) release 2.6.18-1-686)
Compiler:          0.9.0-beta3
OS:                digikam/general

can you please add these features...
clicking on the right side of the image (in image editor) moves to the next image and clicking on the left side move to previous image
or scrolling the mouse wheel forwards and backwards to navigate between images

kindly,
nadav :-)
Comment 1 caulier.gilles 2007-03-20 10:49:06 UTC
Nadav,

> clicking on the right side of the image (in image editor) moves to 
> the next image and clicking on the left side move to previous image

==>Impossible do do : the editor canvas handle selection of image with mouse click event.

> or scrolling the mouse wheel forwards and backwards to navigate between images 
 
==> This can be done only when autozoom is enable.

Gilles Caulier
Comment 2 Nadav Kavalerchik 2007-03-20 11:32:08 UTC
what about : holding some key together with the mouse events ?
Comment 3 caulier.gilles 2007-03-20 11:54:09 UTC
> what about : holding some key together with the mouse events ? 

It's already implemented, but it won't work. I suspect a bug in Qt. Investiguation in progress...

Other solution is to add a pan icon widget like Gimp provide on corner scroolbar place (like gimp do)

A pan icon widget is already implemented with image plugins. I can re-use it easily. What do you think about ?

Gilles Caulier
Comment 4 Arnd Baecker 2007-03-20 12:52:40 UTC
So you mean a small window with a movable rectangle indicating
the current region, like the one
in gimp which pops up when clicking at the corner
where the scroll-bars meet?
I think that would be absolutely brilliant!!
Comment 5 caulier.gilles 2007-03-20 13:08:09 UTC
Yes, Arnd...

Gilles
Comment 6 caulier.gilles 2007-03-20 21:02:21 UTC
SVN commit 644731 by cgilles:

digikam from trunk : image editor improvement !

If you want to pan over a large image using the mouse, use my new Pan tool avaialble on the right bottom corner of canvas area... Look a fresh screenshot of this tool in action :

http://digikam3rdparty.free.fr/Screenshots/neweditorpantool.png

BUG: 104439
BUG: 137391



 M  +99 -29    canvas.cpp  
 M  +4 -0      canvas.h  


--- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/canvas.cpp #644730:644731
@@ -44,16 +44,21 @@
 #include <qcolor.h>
 #include <qdragobject.h> 
 #include <qclipboard.h>
+#include <qtoolbutton.h>
 
 // KDE includes.
 
 #include <kcursor.h>
 #include <klocale.h>
+#include <kiconloader.h>
+#include <kdatetbl.h>
+#include <kglobalsettings.h>
 
 // Local includes.
 
 #include "ddebug.h"
 #include "imagehistogram.h"
+#include "imagepaniconwidget.h"
 #include "dimginterface.h"
 #include "iccsettingscontainer.h"
 #include "exposurecontainer.h"
@@ -73,6 +78,9 @@
     CanvasPrivate() : 
         tileSize(128), minZoom(0.1), maxZoom(10.0), zoomStep(0.1) 
     {
+        panIconPopup    = 0;
+        panIconWidget   = 0;
+        cornerButton    = 0;
         parent          = 0;
         im              = 0;
         rubber          = 0;
@@ -81,40 +89,46 @@
         tileCache.setAutoDelete(true);
     }
 
-    bool               autoZoom;
-    bool               fullScreen;
-    bool               pressedMoved;
-    bool               pressedMoving;
-    bool               ltActive;
-    bool               rtActive;
-    bool               lbActive;
-    bool               rbActive;
-    bool               midButtonPressed;
+    bool                 autoZoom;
+    bool                 fullScreen;
+    bool                 pressedMoved;
+    bool                 pressedMoving;
+    bool                 ltActive;
+    bool                 rtActive;
+    bool                 lbActive;
+    bool                 rbActive;
+    bool                 midButtonPressed;
 
-    const int          tileSize;
-    int                midButtonX;
-    int                midButtonY;
+    const int            tileSize;
+    int                  midButtonX;
+    int                  midButtonY;
     
-    double             zoom;
-    const double       minZoom;
-    const double       maxZoom;
-    const double       zoomStep;
+    double               zoom;
+    const double         minZoom;
+    const double         maxZoom;
+    const double         zoomStep;
 
-    QRect             *rubber;
-    QRect              pixmapRect;
+    QToolButton         *cornerButton;
+
+    QRect               *rubber;
+    QRect                pixmapRect;
     
-    QTimer            *paintTimer;
+    QTimer              *paintTimer;
 
-    QCache<QPixmap>    tileCache;
+    QCache<QPixmap>      tileCache;
 
-    QPixmap*           tileTmpPix;
-    QPixmap            qcheck;
+    QPixmap*             tileTmpPix;
+    QPixmap              qcheck;
 
-    QColor             bgColor;
+    QColor               bgColor;
 
-    QWidget           *parent;
+    QWidget             *parent;
+
+    KPopupFrame         *panIconPopup;
     
-    DImgInterface     *im;
+    DImgInterface       *im;
+
+    ImagePanIconWidget  *panIconWidget;
 };
 
 Canvas::Canvas(QWidget *parent)
@@ -132,7 +146,7 @@
     d->autoZoom   = false;
     d->fullScreen = false;
     d->tileTmpPix = new QPixmap(d->tileSize, d->tileSize);
-    d->bgColor.setRgb( 0, 0, 0 );
+    d->bgColor.setRgb(0, 0, 0);
 
     d->rubber           = 0;
     d->pressedMoved     = false;
@@ -155,8 +169,18 @@
     p.fillRect(8, 0, 8, 8, QColor(100,100,100));
     p.end();
 
+    d->cornerButton = new QToolButton(this);
+    d->cornerButton->setIconSet(SmallIcon("move"));
+    setCornerWidget(d->cornerButton);
+
     // ------------------------------------------------------------
-    
+
+    connect(this, SIGNAL(signalZoomChanged(float)),
+            this, SLOT(slotZoomChanged(float)));
+
+    connect(d->cornerButton, SIGNAL(clicked()),
+            this, SLOT(slotCornerButtonClicked()));
+
     connect(d->im, SIGNAL(signalColorManagementTool()),
             this, SIGNAL(signalColorManagementTool()));
             
@@ -349,15 +373,19 @@
     return ( QRect(x, y, w, h) );
 }
 
-void Canvas::updateAutoZoom()
+float Canvas::calcAutoZoomFactor()
 {
     double srcWidth  = d->im->origWidth();
     double srcHeight = d->im->origHeight();
     double dstWidth  = contentsRect().width();
     double dstHeight = contentsRect().height();
 
-    d->zoom = QMIN(dstWidth/srcWidth, dstHeight/srcHeight);
+    return QMIN(dstWidth/srcWidth, dstHeight/srcHeight);
+}
 
+void Canvas::updateAutoZoom()
+{
+    d->zoom = calcAutoZoomFactor();
     d->im->zoom(d->zoom);
     
     emit signalZoomChanged(d->zoom);
@@ -1147,5 +1175,47 @@
     paintViewport(contentsRect(), true);
 }
 
+void Canvas::slotCornerButtonClicked()
+{    
+    if (!d->panIconPopup)
+    {
+        d->panIconPopup = new KPopupFrame(this);
+    
+        ImagePanIconWidget *pan = new ImagePanIconWidget(90, 60, d->panIconPopup);
+        d->panIconPopup->setMainWidget(pan);
+
+        QRect r((int)(contentsX() / d->zoom), (int)(contentsY() / d->zoom),
+                (int)(visibleWidth() / d->zoom), (int)(visibleHeight() / d->zoom));
+        pan->setRegionSelection(r);
+
+        connect(pan, SIGNAL(signalSelectionMoved(QRect, bool)),
+                this, SLOT(slotPanIconSelectionMoved(QRect, bool)));
+    }
+
+    QPoint g = mapToGlobal(d->cornerButton->pos());
+    d->panIconPopup->popup(QPoint(g.x() - d->panIconPopup->width(), g.y() - d->panIconPopup->height()));
+}
+
+void Canvas::slotPanIconSelectionMoved(QRect r, bool b)
+{
+    setContentsPos((int)(r.x()*d->zoom), (int)(r.y()*d->zoom));
+
+    if (b)
+    {
+        int r;
+        d->panIconPopup->close(r);
+        delete d->panIconPopup;
+        d->panIconPopup = 0;
+    }
+}
+
+void Canvas::slotZoomChanged(float zoom)
+{
+    if (zoom > calcAutoZoomFactor())
+        d->cornerButton->show();
+    else
+        d->cornerButton->hide();        
+}
+
 }  // namespace Digikam
 
--- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/canvas.h #644730:644731
@@ -115,6 +115,7 @@
     
 private:
 
+    float calcAutoZoomFactor();
     void updateAutoZoom();
     void updateContentsSize();
     void drawRubber();
@@ -153,6 +154,9 @@
     void slotModified();
     void slotImageLoaded(const QString& filePath, bool success);
     void slotImageSaved(const QString& filePath, bool success);
+    void slotCornerButtonClicked();
+    void slotPanIconSelectionMoved(QRect, bool);
+    void slotZoomChanged(float);
     
 signals:
 
Comment 7 Arnd Baecker 2007-03-21 13:24:31 UTC
Very very nice - Many thanks!!