Thread: [Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool AbstractTool.java, 1.111, 1.112 Relat
Status: Pre-Alpha
Brought to you by:
henryml
|
From: rimestad <rim...@us...> - 2007-02-08 12:23:20
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18991/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java RelationTool.java ToolFactory.java Log Message: added new icons and made relation tool use them... modified VK_META to be both that and VK_ALT because that only works on windows... Index: RelationTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RelationTool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RelationTool.java 6 Feb 2007 17:30:17 -0000 1.1 --- RelationTool.java 8 Feb 2007 12:23:13 -0000 1.2 *************** *** 8,12 **** --- 8,16 ---- import java.awt.Cursor; + import java.awt.Image; + import java.awt.Point; + import java.awt.Toolkit; import java.awt.event.MouseEvent; + import java.net.URL; import java.util.ArrayList; import java.util.List; *************** *** 17,20 **** --- 21,25 ---- import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Project; /** *************** *** 33,36 **** --- 38,47 ---- public RelationTool(GLView glv, Cursor cursor) { super(glv, cursor); + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("Bcursorremove.gif"); + Image arrowMinusCursor = Toolkit.getDefaultToolkit().getImage(url); + metaCursor = + Toolkit.getDefaultToolkit().createCustomCursor(arrowMinusCursor, + new Point(0, 0), "Remove connection"); } *************** *** 71,75 **** */ protected void pressed(MouseEvent e) { ! onVertex(); moved(e); } --- 82,86 ---- */ protected void pressed(MouseEvent e) { ! onVertex(e); moved(e); } *************** *** 87,92 **** /** * Current vertex is pressed */ ! public void onVertex() { if (constructor == null) { if (target != null) { --- 98,104 ---- /** * Current vertex is pressed + * @param e The event that resulted in this call */ ! public void onVertex(MouseEvent e) { if (constructor == null) { if (target != null) { *************** *** 105,109 **** if (target instanceof Geometric) { Geometric g = (Geometric) target; ! constructor.connect(g); cleanUp(); } else { --- 117,129 ---- if (target instanceof Geometric) { Geometric g = (Geometric) target; ! if (metaPressed) { ! // remove the connection ! constructor.disconnect(g); ! } else { ! // add a connection ! constructor.connect(g); ! } ! Project.getInstance().changed(constructor); ! Project.getInstance().checkpoint(); cleanUp(); } else { Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** ToolFactory.java 6 Feb 2007 17:30:17 -0000 1.74 --- ToolFactory.java 8 Feb 2007 12:23:13 -0000 1.75 *************** *** 184,187 **** --- 184,191 ---- Cursor walkCursor = Toolkit.getDefaultToolkit().createCustomCursor(walkImage, new Point(7, 8), "Walk"); + url = cl.getResource("Bcursoradd.gif"); + Image arrowAddImage = Toolkit.getDefaultToolkit().getImage(url); + Cursor arrowAddCursor = + Toolkit.getDefaultToolkit().createCustomCursor(arrowAddImage, new Point(0, 0), "Add"); select = new SpaceTool(glv, null); *************** *** 196,200 **** clipplane = new ClipplaneTool(glv, pencilcursor); tapeMeasure = new TapeMeasure(glv, pencilcursor); ! relation = new RelationTool(glv, pencilcursor); camera = new CameraTool(glv, rotationCursor); fly = new CameraFlyTool(glv, flyCursor); --- 200,204 ---- clipplane = new ClipplaneTool(glv, pencilcursor); tapeMeasure = new TapeMeasure(glv, pencilcursor); ! relation = new RelationTool(glv, arrowAddCursor); camera = new CameraTool(glv, rotationCursor); fly = new CameraFlyTool(glv, flyCursor); Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -d -r1.111 -r1.112 *** AbstractTool.java 6 Feb 2007 17:28:26 -0000 1.111 --- AbstractTool.java 8 Feb 2007 12:23:13 -0000 1.112 *************** *** 122,125 **** --- 122,131 ---- private Cursor orbitCursor; + /** true if meta is pressed otherwise false */ + protected boolean metaPressed = false; + + /** The cursor for alternative tool (that is when meta is pressed) */ + protected Cursor metaCursor = null; + /** * KeyListener for the GL Canvas *************** *** 229,234 **** sidewards.scale(2 / sidewards.length()); up.scale(2 / up.length()); ! if (e.getKeyCode() == KeyEvent.VK_META) { ! glv.setCursor(null); return; } --- 235,242 ---- sidewards.scale(2 / sidewards.length()); up.scale(2 / up.length()); ! if (e.getKeyCode() == KeyEvent.VK_META || e.getKeyCode() == KeyEvent.VK_ALT) { ! log.info("META:" + e); ! metaPressed = true; ! glv.setCursor(metaCursor); return; } *************** *** 272,276 **** */ public void keyReleased(KeyEvent e) { ! if (e.getKeyCode() == KeyEvent.VK_META) { glv.setCursor(cursor); } --- 280,285 ---- */ public void keyReleased(KeyEvent e) { ! if (e.getKeyCode() == KeyEvent.VK_META || e.getKeyCode() == KeyEvent.VK_ALT) { ! metaPressed = false; glv.setCursor(cursor); } |