[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool ToolFactory.java, 1.109, 1.110 Abstra
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2010-12-01 10:28:12
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv7658/src/net/sourceforge/bprocessor/gl/tool Modified Files: ToolFactory.java AbstractTool.java OffsetTool.java Log Message: Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.109 retrieving revision 1.110 diff -C2 -d -r1.109 -r1.110 *** ToolFactory.java 26 Nov 2010 14:20:27 -0000 1.109 --- ToolFactory.java 1 Dec 2010 10:28:04 -0000 1.110 *************** *** 391,408 **** } ! /** ! * Get the previous tool ! * @return The tool ! */ ! private Tool getPrevious() { ! Tool temp = previousTool; ! previousTool = currentTool; ! currentTool = temp; ! if (currentTool != null) { ! JToggleButton button = (JToggleButton)buttons.get(currentTool); ! button.setSelected(true); ! } ! return temp; ! } /** --- 391,395 ---- } ! /** *************** *** 415,419 **** */ public JToggleButton registerTool(int key, Tool tool, String iconname, String tooltip) { ! tools.put(new Integer(key), tool); ToolAction action = new ToolAction(editor, key, iconname); JToggleButton button = Toolbar.getInstance().registerAction(action); --- 402,406 ---- */ public JToggleButton registerTool(int key, Tool tool, String iconname, String tooltip) { ! tools.put(String.valueOf(key), tool); ToolAction action = new ToolAction(editor, key, iconname); JToggleButton button = Toolbar.getInstance().registerAction(action); *************** *** 440,462 **** */ public Tool get(int i) { ! Tool temp = currentTool; ! Tool next = (Tool) tools.get(new Integer(i)); if (next != null) { ! JToggleButton button = (JToggleButton) buttons.get(next); ! button.setSelected(true); currentTool = next; ! if (currentTool != temp) { ! previousTool = temp; ! } ! return currentTool; ! } else { ! if (i == -1) { ! return getPrevious(); } - log.error("[get] No such tool " + i); - return null; } } /** * ToolAction --- 427,458 ---- */ public Tool get(int i) { ! Tool next = (Tool) tools.get(String.valueOf(i)); ! applyTool(next); ! return next; ! } ! ! /** ! * Get the previous tool ! * @return The tool ! */ ! public Tool getPrevious() { ! Tool next = previousTool; ! applyTool(next); ! return next; ! } ! ! ! private void applyTool(Tool next) { if (next != null) { ! previousTool = currentTool; currentTool = next; ! if (currentTool != null) { ! JToggleButton button = (JToggleButton)buttons.get(currentTool); ! button.setSelected(true); } } } + /** * ToolAction Index: OffsetTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/OffsetTool.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** OffsetTool.java 20 May 2010 10:58:51 -0000 1.29 --- OffsetTool.java 1 Dec 2010 10:28:04 -0000 1.30 *************** *** 371,397 **** Map<Vertex, Collection<Edge>> vertex2edges = new HashMap<Vertex, Collection<Edge>>(); Edge first = null; ! for (Geometric g : selection) { ! if (g instanceof Edge) { ! Edge e = (Edge)g; ! edges.add(e); ! Collection<Edge> fromlist = vertex2edges.get(e.getFrom()); ! if (fromlist != null) { ! fromlist.add(e); ! } else { ! fromlist = new ArrayList<Edge>(); ! fromlist.add(e); ! vertex2edges.put(e.getFrom(), fromlist); ! } ! Collection<Edge> tolist = vertex2edges.get(e.getTo()); ! if (tolist != null) { ! tolist.add(e); } else { ! tolist = new ArrayList<Edge>(); ! tolist.add(e); ! vertex2edges.put(e.getTo(), tolist); } - } else { - edges.clear(); - selection.clear(); } } --- 371,401 ---- Map<Vertex, Collection<Edge>> vertex2edges = new HashMap<Vertex, Collection<Edge>>(); Edge first = null; ! checking: ! { ! for (Geometric g : selection) { ! if (g instanceof Edge) { ! Edge e = (Edge)g; ! edges.add(e); ! Collection<Edge> fromlist = vertex2edges.get(e.getFrom()); ! if (fromlist != null) { ! fromlist.add(e); ! } else { ! fromlist = new ArrayList<Edge>(); ! fromlist.add(e); ! vertex2edges.put(e.getFrom(), fromlist); ! } ! Collection<Edge> tolist = vertex2edges.get(e.getTo()); ! if (tolist != null) { ! tolist.add(e); ! } else { ! tolist = new ArrayList<Edge>(); ! tolist.add(e); ! vertex2edges.put(e.getTo(), tolist); ! } } else { ! edges.clear(); ! selection.clear(); ! break checking; } } } Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -d -r1.154 -r1.155 *** AbstractTool.java 20 May 2010 10:58:51 -0000 1.154 --- AbstractTool.java 1 Dec 2010 10:28:04 -0000 1.155 *************** *** 185,191 **** */ protected void setActiveStrategy(Strategy which) { - Tool tool = null; ToolFactory factory = ToolFactory.getFactory(editor); ! if (which != null) { which.prepare(); --- 185,191 ---- */ protected void setActiveStrategy(Strategy which) { ToolFactory factory = ToolFactory.getFactory(editor); ! Tool tool = null; ! if (which != null) { which.prepare(); *************** *** 194,207 **** } else if (which == AbstractTool.orbit) { tool = factory.get(Tool.CAMERA_TOOL); - } else if (which == AbstractTool.select) { - tool = factory.get(Tool.SELECT_TOOL); } } else { ! if (activeStrategy == AbstractTool.select) { ! this.prepare(); ! } ! Tool prev = factory.get(Tool.PREVIOUS_TOOL); if (prev != this) { ! factory.get(Tool.PREVIOUS_TOOL); } tool = this; --- 194,203 ---- } else if (which == AbstractTool.orbit) { tool = factory.get(Tool.CAMERA_TOOL); } + } else { ! Tool prev = factory.getPrevious(); if (prev != this) { ! factory.getPrevious(); } tool = this; *************** *** 305,320 **** up.scaleIt(2 / up.length()); - - if (e.getKeyCode() == KeyEvent.VK_ALT) { - metaPressed = true; - editor.setCursor(metaCursor); - return; - } - if (e.getKeyCode() == KeyEvent.VK_CONTROL || e.getKeyCode() == KeyEvent.VK_META) { - setActiveStrategy(AbstractTool.select); - editor.getView().makeTarget(null); - editor.repaint(); - return; - } if (e.getKeyCode() == KeyEvent.VK_SPACE) { if (!typing) { --- 301,304 ---- *************** *** 365,372 **** setActiveStrategy(null); } - if (e.getKeyCode() == KeyEvent.VK_ALT) { - metaPressed = false; - editor.setCursor(cursor); - } if (e.getKeyCode() == KeyEvent.VK_S) { editor.getView().removeGlObjects3D(glCams); --- 349,352 ---- |