Bug 104439 - Use left mouse button to scroll image
Summary: Use left mouse button to scroll image
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Unclassified
Component: Usability-Mouse (show other bugs)
Version: 0.7.2
Platform: unspecified Linux
: NOR wishlist with 20 votes (vote)
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-23 21:48 UTC by Aewyn Vienna
Modified: 2017-08-08 17:02 UTC (History)
1 user (show)

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 Aewyn Vienna 2005-04-23 21:48:41 UTC
Version:           0.7.2 (using KDE 3.4.0, Debian Package 4:3.4.0-0pre3 (3.1))
Compiler:          gcc version 3.3.5 (Debian 1:3.3.5-8)
OS:                Linux (i686) release 2.6.9-1-k7

Please give an option to use panning left mouse button.

Panning is used 99% and crop uses only 1%, so for the default action I would like to use the default button (left).

Another reason: on my mouse the midle button is the scroller, but it is very hard to press, so it is real painful using panning now.

Thanks!
Comment 1 caulier.gilles 2007-03-20 11:31:27 UTC
Aewyn,

I considerate this file like invalid because selction is used everywhere, to crop, correct red eyes, inpainting, etc. 

I recommend you to buy a new mouse with a wheel. It's not very expensive (:=)))

Gilles Caulier
Comment 2 caulier.gilles 2007-03-20 20:59:27 UTC
Aewyn,

I reopen the file, because i have found a solution in my computer using a Pan tool

Gilles Caulier
Comment 3 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 4 Aewyn Vienna 2007-03-26 23:11:21 UTC
Thanks Gilles, this is good solution, but not for the original problem.

First, no other application has such a behaviour: using select without choosing on select tool. It is a strange ergonomic error.

Second, for You, as developer and tester, I can imagine it is a common task to select and edit. But for an ordinary user not.

This is a really pain in ass thing. Please use common/standard UI solutions. 

Thanks, Aew

Comment 5 Gerhard Kulzer 2007-03-27 06:23:49 UTC
I disagree with your statement, I like the immediate response to selection with LMB very much. In any application it is unnerving to always have to select some mode or field to do the logical action. The direct selection with a mouse button must be preserved. 
A possible solution could be to use LMB & RMB concurrently for selection.

I also disagree with the statement that 99% is panning, panning for me is less than 10% of the use, and we have a panning tool now.

And never argue like "my mouse button is hard to press", otherwise the next one will come and ask to avoid half of the keyboard because he spilled coffee into it :_)
Comment 6 Arnd Baecker 2007-03-27 12:47:23 UTC
Hmm, and I don't like the selection with the left mouse
(I use panning more often than selecting ...;-).
What about making this configurable?