[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool ToolFactory.java,1.4,1.5
Status: Pre-Alpha
Brought to you by:
henryml
From: Nordholt <nor...@us...> - 2005-08-30 12:55:03
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3284 Modified Files: ToolFactory.java Log Message: added code to handle the holetool Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ToolFactory.java 22 Aug 2005 14:30:59 -0000 1.4 --- ToolFactory.java 30 Aug 2005 12:54:55 -0000 1.5 *************** *** 43,48 **** /** debug tool */ - private PencilTool debug; /** --- 43,50 ---- /** debug tool */ private PencilTool debug; + + /** hole tool */ + private HoleTool hole; /** *************** *** 56,59 **** --- 58,62 ---- extrusion = new ExtrusionTool(glv); debug = new PencilTool(glv); + hole = new HoleTool(glv); Toolbar tb = Toolbar.getInstance(); *************** *** 68,71 **** --- 71,76 ---- but = tb.registerAction(new DebugAction(glv)); but.setToolTipText("Debug"); + but = tb.registerAction(new HoleAction(glv)); + but.setToolTipText("Hole"); Notifier.getInstance().addListener(select); } *************** *** 107,110 **** --- 112,117 ---- } else if (i == Tool.DEBUG_TOOL) { return debug; + } else if (i == Tool.HOLE_TOOL) { + return hole; } else { log.error("[get] No such tool " + i); *************** *** 224,227 **** --- 231,262 ---- } } + + /** + * The hole action inner class + */ + class HoleAction extends AbstractAction { + /** The GLView */ + private GLView glv = null; + + /** + * Constructor + * @param glv TheGLView + */ + HoleAction(GLView glv) { + this.glv = glv; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("drawicon.png"); + ImageIcon im = new ImageIcon(url); + putValue(Action.SMALL_ICON, im); + } + + /** + * Called when the button is pressed + * @param e The ActionEvent + */ + public void actionPerformed(ActionEvent e) { + glv.changeTool(Tool.HOLE_TOOL); + } + } } /** *************** *** 231,235 **** /** The GLView */ private GLView glv = null; ! /** * Constructor --- 266,270 ---- /** The GLView */ private GLView glv = null; ! /** * Constructor *************** *** 243,247 **** putValue(Action.SMALL_ICON, im); } ! /** * Called when the button is pressed --- 278,282 ---- putValue(Action.SMALL_ICON, im); } ! /** * Called when the button is pressed *************** *** 252,253 **** --- 287,289 ---- } } + |