]> Shamusworld >> Repos - architektonas/blobdiff - src/drawingview.cpp
Added key modifiers to Actions.
[architektonas] / src / drawingview.cpp
index bdc3540b0442fc51b243e6096da6a94b362d2632..95721178a70be35ee56600f4a492390b8f1ed44c 100644 (file)
@@ -393,7 +393,12 @@ Now we do... :-/
                        update();       // Do an update if collided with at least *one* object in the document
 
                if (toolAction)
+               {
+                       if (Object::snapToGrid)
+                               point = Object::SnapPointToGrid(point);
+
                        toolAction->MouseDown(point);
+               }
 
                // Didn't hit any object and not using a tool, so do a selection rectangle
                if (!(collided || toolAction))
@@ -491,3 +496,27 @@ void DrawingView::mouseReleaseEvent(QMouseEvent * event)
        }
 }
 
+
+void DrawingView::keyPressEvent(QKeyEvent * event)
+{
+       if (toolAction)
+       {
+               bool needUpdate = toolAction->KeyDown(event->key());
+
+               if (needUpdate)
+                       update();
+       }
+}
+
+
+void DrawingView::keyReleaseEvent(QKeyEvent * event)
+{
+       if (toolAction)
+       {
+               bool needUpdate = toolAction->KeyReleased(event->key());
+
+               if (needUpdate)
+                       update();
+       }
+}
+