[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    [patch] click activates shape
From:       Thomas Zander <zander () kde ! org>
Date:       2008-11-11 21:47:43
Message-ID: 200811112247.44027.zander () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


Hi,

at the berlin meeting we talked about an interaction problem in flake.
Usecase;
User edits content of one flake.  For example a path-shape.
user notices another shape on screen and wants to switch from editing the 
current shape to editing the other shape.  So she clicks on that other 
shape.

Currently nothing happens.
Suggestion is to make such a click to start editing the shape the user 
clicked on.

This avoids the current mess that you have to select the default tool, then 
select the second shape, then select the preferred tool again.

As this is a new feature and behavioral change in the feature freeze I'd 
like to get at least one person that tries the patch and preferably one 
that proof-reads the concepts behind the patch before I can commit it.

Thanks!
-- 
Thomas Zander

["interaction-adjustment.diff" (text/x-diff)]

commit 28548afae1d8064d7654946664ef13bd47b479ea
Author: Thomas Zander <zander@kde.org>
Date:   Mon Nov 10 22:18:20 2008 +0100

    Fix interaction annoyance as discussed in berlin.
    Details; Proxy intercepts down+release to change the selection + tool if the \
click is on a shape that is currently not selected and on top.

diff --git a/libs/flake/KoToolProxy.cpp b/libs/flake/KoToolProxy.cpp
index fb538ae..176517a 100644
--- a/libs/flake/KoToolProxy.cpp
+++ b/libs/flake/KoToolProxy.cpp
@@ -149,6 +149,8 @@ public:
     KoCanvasController *controller;
     KoToolProxy *parent;
 
+    QPoint mouseDownPoint; // used to determine if the mouse-release is after a drag \
or a simple click +
     bool mouseLeaveWorkaround; // up until at least 4.3.0 we get a mouse move event \
when the tablet leaves the canvas.  };
 
@@ -214,6 +216,7 @@ void KoToolProxy::mousePressEvent(QMouseEvent *event, const \
QPointF &point)  d->mouseLeaveWorkaround = false;
     KoInputDevice id;
     KoToolManager::instance()->switchInputDevice(id);
+    d->mouseDownPoint = event->pos();
 
     if (d->tabletPressed) // refuse to send a press unless there was a release \
first.  return;
@@ -260,7 +263,28 @@ void KoToolProxy::mouseReleaseEvent(QMouseEvent *event, const \
QPointF &point)  d->scrollTimer.stop();
 
     KoPointerEvent ev(event, point);
-    if (d->activeTool) d->activeTool->mouseReleaseEvent(&ev);
+    if (d->activeTool) {
+        d->activeTool->mouseReleaseEvent(&ev);
+
+        if (! event->isAccepted() && qAbs(d->mouseDownPoint.x() - event->x()) < 5
+                && qAbs(d->mouseDownPoint.y() - event->y()) < 5) {
+            // we potentiall will change the selection
+            Q_ASSERT(d->activeTool->m_canvas);
+            KoShapeManager *manager = d->activeTool->m_canvas->shapeManager();
+            Q_ASSERT(manager);
+            if (manager->selection()->count() <= 1) {
+                KoShape *shape = manager->shapeAt(point);
+                if (shape && !manager->selection()->isSelected(shape)) {
+                    manager->selection()->deselectAll();
+                    manager->selection()->select(shape);
+                    QList<KoShape*> shapes;
+                    shapes << shape;
+                    QString tool = \
KoToolManager::instance()->preferredToolForSelection(shapes); +                    \
KoToolManager::instance()->switchToolRequested(tool); +                }
+            }
+        }
+    }
 }
 
 void KoToolProxy::keyPressEvent(QKeyEvent *event)


["signature.asc" (application/pgp-signature)]

_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic