[Bug 137391] picture navigation in image editor using the mouse

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 137391] picture navigation in image editor using the mouse

Gilles Caulier-4
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=137391         
caulier.gilles gmail com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From caulier.gilles gmail com  2007-03-20 21:02 -------
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:
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Bug 137391] picture navigation in image editor using the mouse

Bugzilla from mikmach@wp.pl
Dnia środa 21 marzec 2007, Gilles Caulier napisał:
> 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 :
>

Very good thing.

Few remarks:

IMO it would be better if it was by default turned on when autozoom is
off (and image is bigger than window). Pan window is very small and will
not disturb user but is hard to discover by accident. Easier to hide it
later than found what that cross is doing.

When opening/closing panel on the right Pan window closes. Shouldn't do
that.

After few seconds of dragging frame in Pan window Digikam crashes, such
drastic crash there is neither traditional KDE crash dialog nor console
output. I will try to recompile with debugging tomorrow.

Once again thanks for life changing feature.

m.

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel