[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool ZoomTool.java, NONE, 1.1 PanTool.java
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2007-09-03 13:36:52
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv32610/src/net/sourceforge/bprocessor/gl/tool Modified Files: ToolFactory.java Tool.java Added Files: ZoomTool.java PanTool.java Removed Files: DragTool.java Log Message: zoomtool Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** ToolFactory.java 3 Sep 2007 11:31:34 -0000 1.81 --- ToolFactory.java 3 Sep 2007 13:36:52 -0000 1.82 *************** *** 127,131 **** /** Tool for navigating in the model */ ! private DragTool dragTool; /** The selection button */ --- 127,133 ---- /** Tool for navigating in the model */ ! private PanTool panTool; ! ! private ZoomTool zoomTool; /** The selection button */ *************** *** 201,207 **** Toolkit.getDefaultToolkit().createCustomCursor(arrowAddImage, new Point(0, 0), "Add"); url = cl.getResource("Bcursordrag.gif"); ! Image dragImage = Toolkit.getDefaultToolkit().getImage(url); ! Cursor dragCursor = ! Toolkit.getDefaultToolkit().createCustomCursor(dragImage, new Point(7, 8), "Drag"); select = new SpaceTool(glv, null); pencil = new Pencil(glv, pencilcursor); --- 203,213 ---- Toolkit.getDefaultToolkit().createCustomCursor(arrowAddImage, new Point(0, 0), "Add"); url = cl.getResource("Bcursordrag.gif"); ! Image panImage = Toolkit.getDefaultToolkit().getImage(url); ! Cursor panCursor = ! Toolkit.getDefaultToolkit().createCustomCursor(panImage, new Point(7, 8), "Pan"); ! url = cl.getResource("Bcursorzoominout.gif"); ! Image zoomImage = Toolkit.getDefaultToolkit().getImage(url); ! Cursor zoomCursor = ! Toolkit.getDefaultToolkit().createCustomCursor(zoomImage, new Point(7, 8), "Zoom"); select = new SpaceTool(glv, null); pencil = new Pencil(glv, pencilcursor); *************** *** 226,231 **** finalMoveTool = new FinalMoveTool(glv, pencilcursor); edgeMoveTool = new EdgeMoveTool(glv, pencilcursor); ! dragTool = new DragTool(glv, dragCursor); ! Toolbar tb = Toolbar.getInstance(); --- 232,237 ---- finalMoveTool = new FinalMoveTool(glv, pencilcursor); edgeMoveTool = new EdgeMoveTool(glv, pencilcursor); ! panTool = new PanTool(glv, panCursor); ! zoomTool = new ZoomTool(glv, zoomCursor); Toolbar tb = Toolbar.getInstance(); *************** *** 261,267 **** cRotBut = this.registerTool(Tool.CAMERA_TOOL, camera, "Biconrotcam.gif", "Orbit (Space)"); ! this.registerTool(Tool.DRAG_TOOL, dragTool, "Bicondrag.gif", "Drag (Space)"); ! flyBut = this.registerTool(Tool.FLY_TOOL, fly, "Biconfly.gif", "Fly"); ! walkBut = this.registerTool(Tool.WALK_TOOL, walk, "Biconwalk.gif", "Walk"); Action zoomAction = new ToolAction(glv, 0, "Biconzomeall.gif") { --- 267,274 ---- cRotBut = this.registerTool(Tool.CAMERA_TOOL, camera, "Biconrotcam.gif", "Orbit (Space)"); ! this.registerTool(Tool.DRAG_TOOL, panTool, "Bicondrag.gif", "Drag (Space)"); ! this.registerTool(Tool.ZOOM_TOOL, zoomTool, "Biconzomeinout.gif", "Zoom in/out"); ! //flyBut = this.registerTool(Tool.FLY_TOOL, fly, "Biconfly.gif", "Fly"); ! //walkBut = this.registerTool(Tool.WALK_TOOL, walk, "Biconwalk.gif", "Walk"); Action zoomAction = new ToolAction(glv, 0, "Biconzomeall.gif") { --- NEW FILE: PanTool.java --- //--------------------------------------------------------------------------------- // $Id: PanTool.java,v 1.1 2007/09/03 13:36:52 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import net.sourceforge.bprocessor.gl.GLView; import java.awt.Cursor; import java.awt.event.MouseEvent; import org.apache.log4j.Logger; /** * The selecttool */ public class PanTool extends AbstractTool { /** The logger */ private static Logger log = Logger.getLogger(PanTool.class); /** * The constructor * @param glv The 3D canvas * @param cursor The cursor */ public PanTool(GLView glv, Cursor cursor) { super(glv, cursor); dragDelay = 0; } /** * Invoked when the mouse cursor has been moved * @param e The MouseEvent object */ protected void moved(MouseEvent e) { pan.moved(e); } /** * Invoked when a mouse button has been pressed on a component. * @param e The MouseEvent object */ protected void pressed(MouseEvent e) { pan.pressed(e); } /** * Invoked when the mouse is held pressed and moved * @param e The MouseEvent object */ protected void dragged(MouseEvent e) { pan.dragged(e); } /** * Invoked when a mouse button has been released on a component. * @param e The MouseEvent */ protected void released(MouseEvent e) { pan.released(e); } /** * {@inheritDoc} */ public String initialTip() { return "Click and move mouse to navigate the model."; } } Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** Tool.java 3 Sep 2007 11:31:34 -0000 1.35 --- Tool.java 3 Sep 2007 13:36:52 -0000 1.36 *************** *** 72,75 **** --- 72,77 ---- /** the drag tool */ public static final int DRAG_TOOL = 25; + /** the zoom tool */ + public static final int ZOOM_TOOL = 26; /** --- NEW FILE: ZoomTool.java --- //--------------------------------------------------------------------------------- // $Id: ZoomTool.java,v 1.1 2007/09/03 13:36:52 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.model.Project; import java.awt.Cursor; import java.awt.event.MouseEvent; import org.apache.log4j.Logger; /** * The selecttool */ public class ZoomTool extends AbstractTool { /** The logger */ private static Logger log = Logger.getLogger(ZoomTool.class); private int prevY; private final int moveDist = 5; /** * The constructor * @param glv The 3D canvas * @param cursor The cursor */ public ZoomTool(GLView glv, Cursor cursor) { super(glv, cursor); dragDelay = 0; } /** * Invoked when the mouse cursor has been moved * @param e The MouseEvent object */ protected void moved(MouseEvent e) { } /** * Invoked when a mouse button has been pressed on a component. * @param e The MouseEvent object */ protected void pressed(MouseEvent e) { prevY = e.getY(); } /** * Invoked when the mouse is held pressed and moved * @param e The MouseEvent object */ protected void dragged(MouseEvent e) { if (prevY + moveDist < e.getY()) { prevY = e.getY(); Project.getInstance().getCurrentCamera().zoomout(); } if (prevY - moveDist > e.getY()) { prevY = e.getY(); Project.getInstance().getCurrentCamera().zoomin(); } } /** * Invoked when a mouse button has been released on a component. * @param e The MouseEvent */ protected void released(MouseEvent e) { } /** * {@inheritDoc} */ public String initialTip() { return "Click and move mouse to navigate the model."; } } --- DragTool.java DELETED --- |