]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.g2d/src/org/simantics/g2d/participant/HandPainter.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / participant / HandPainter.java
index 95b9ddeed402837f73b84821874f44207e35f023..76929c5e39e4af35fb6a14b5be946a026b430f66 100644 (file)
@@ -1,74 +1,74 @@
-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- *     VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.g2d.participant;\r
-\r
-import org.simantics.g2d.canvas.impl.AbstractCanvasParticipant;\r
-import org.simantics.g2d.canvas.impl.DependencyReflection.Dependency;\r
-import org.simantics.scenegraph.g2d.events.MouseEvent;\r
-import org.simantics.scenegraph.g2d.events.EventHandlerReflection.EventHandler;\r
-import org.simantics.scenegraph.g2d.events.MouseEvent.MouseButtonEvent;\r
-import org.simantics.scenegraph.g2d.events.MouseEvent.MouseMovedEvent;\r
-\r
-/**\r
- * Paints a grabbed hand when canvas is grabbed.\r
- * \r
- * TODO: out of order for now, needs to be adapted to scene graph\r
- * \r
- * @author Toni Kalajainen\r
- */\r
-public class HandPainter extends AbstractCanvasParticipant {\r
-\r
-    @Dependency CanvasGrab grab;\r
-    @Dependency SymbolUtil symbols;\r
-    @Dependency TransformUtil util;\r
-    @Dependency MouseUtil mice;\r
-\r
-//    @Painter(priority=PointerPainter.CURSOR_PAINT_PRIORITY+10)\r
-//    public void paint(GraphicsContext gc) {\r
-//        assertDependencies();\r
-//        Map<Integer, PointerInfo> pis = grab.getGrabInfo();\r
-//        Collection<MouseInfo> mis = mice.getMiceInfo().values();\r
-//        if (mis.isEmpty()) return;\r
-//\r
-//        // Symbol\r
-//        Image grab = symbols.get(DefaultImages.GRAB32, gc.getGraphics2D().getDeviceConfiguration());\r
-//        double gcx = grab.getBounds().getCenterX();\r
-//        double gcy = grab.getBounds().getCenterY();\r
-//        Image hand = symbols.get(DefaultImages.HAND32, gc.getGraphics2D().getDeviceConfiguration());\r
-//        double hcx = hand.getBounds().getCenterX();\r
-//        double hcy = hand.getBounds().getCenterY();\r
-//\r
-//        for (MouseInfo mi : mis) {\r
-//            GraphicsContext g = gc.clone();\r
-//            PointerInfo pi = pis.get(mi.mouseId);\r
-//            if (pi!=null) {\r
-//                Point2D pos = util.canvasToControl(pi.anchorPos, null);\r
-//                g.getGraphics2D().translate(pos.getX(), pos.getY());\r
-//                g.getGraphics2D().translate(-gcx, -gcy);\r
-//                grab.paint(g);\r
-//            } else {\r
-//                Point2D pos = mi.controlPosition;\r
-//                g.getGraphics2D().translate(pos.getX(), pos.getY());\r
-//                g.getGraphics2D().translate(-gcx, -gcy);\r
-//                hand.paint(g);\r
-//            }\r
-//            g.dispose();\r
-//        }\r
-//    }\r
-\r
-    @EventHandler(priority = Integer.MAX_VALUE)\r
-    public boolean handleMouseEvent(MouseEvent e) {\r
-        if (e instanceof MouseMovedEvent || e instanceof MouseButtonEvent)\r
-            setDirty();\r
-        return false;\r
-    }\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.g2d.participant;
+
+import org.simantics.g2d.canvas.impl.AbstractCanvasParticipant;
+import org.simantics.g2d.canvas.impl.DependencyReflection.Dependency;
+import org.simantics.scenegraph.g2d.events.MouseEvent;
+import org.simantics.scenegraph.g2d.events.EventHandlerReflection.EventHandler;
+import org.simantics.scenegraph.g2d.events.MouseEvent.MouseButtonEvent;
+import org.simantics.scenegraph.g2d.events.MouseEvent.MouseMovedEvent;
+
+/**
+ * Paints a grabbed hand when canvas is grabbed.
+ * 
+ * TODO: out of order for now, needs to be adapted to scene graph
+ * 
+ * @author Toni Kalajainen
+ */
+public class HandPainter extends AbstractCanvasParticipant {
+
+    @Dependency CanvasGrab grab;
+    @Dependency SymbolUtil symbols;
+    @Dependency TransformUtil util;
+    @Dependency MouseUtil mice;
+
+//    @Painter(priority=PointerPainter.CURSOR_PAINT_PRIORITY+10)
+//    public void paint(GraphicsContext gc) {
+//        assertDependencies();
+//        Map<Integer, PointerInfo> pis = grab.getGrabInfo();
+//        Collection<MouseInfo> mis = mice.getMiceInfo().values();
+//        if (mis.isEmpty()) return;
+//
+//        // Symbol
+//        Image grab = symbols.get(DefaultImages.GRAB32, gc.getGraphics2D().getDeviceConfiguration());
+//        double gcx = grab.getBounds().getCenterX();
+//        double gcy = grab.getBounds().getCenterY();
+//        Image hand = symbols.get(DefaultImages.HAND32, gc.getGraphics2D().getDeviceConfiguration());
+//        double hcx = hand.getBounds().getCenterX();
+//        double hcy = hand.getBounds().getCenterY();
+//
+//        for (MouseInfo mi : mis) {
+//            GraphicsContext g = gc.clone();
+//            PointerInfo pi = pis.get(mi.mouseId);
+//            if (pi!=null) {
+//                Point2D pos = util.canvasToControl(pi.anchorPos, null);
+//                g.getGraphics2D().translate(pos.getX(), pos.getY());
+//                g.getGraphics2D().translate(-gcx, -gcy);
+//                grab.paint(g);
+//            } else {
+//                Point2D pos = mi.controlPosition;
+//                g.getGraphics2D().translate(pos.getX(), pos.getY());
+//                g.getGraphics2D().translate(-gcx, -gcy);
+//                hand.paint(g);
+//            }
+//            g.dispose();
+//        }
+//    }
+
+    @EventHandler(priority = Integer.MAX_VALUE)
+    public boolean handleMouseEvent(MouseEvent e) {
+        if (e instanceof MouseMovedEvent || e instanceof MouseButtonEvent)
+            setDirty();
+        return false;
+    }
+}