Thread: [Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool RelationTool.java, 1.4, 1.5 SpaceTool
Status: Pre-Alpha
Brought to you by:
henryml
|
From: rimestad <rim...@us...> - 2007-05-07 13:29:56
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9942/src/net/sourceforge/bprocessor/gl/tool Modified Files: RelationTool.java SpaceTool.java ExtrusionTool.java AltMoveTool.java AbstractPencil.java Protractor.java ArcTool.java EdgeMoveTool.java Log Message: Made all tools implement onvertex to make them act on length field input Index: RelationTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RelationTool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RelationTool.java 13 Mar 2007 14:37:37 -0000 1.4 --- RelationTool.java 7 May 2007 13:29:48 -0000 1.5 *************** *** 81,85 **** */ protected void pressed(MouseEvent e) { ! onVertex(e); moved(e); } --- 81,85 ---- */ protected void pressed(MouseEvent e) { ! onVertex(); moved(e); } *************** *** 94,103 **** source = null; } - /** ! * Current vertex is pressed ! * @param e The event that resulted in this call */ ! public void onVertex(MouseEvent e) { if (source == null) { if (target != null) { --- 94,102 ---- source = null; } /** ! * {@inheritDoc} */ ! @Override ! public void onVertex() { if (source == null) { if (target != null) { Index: ArcTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ArcTool.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ArcTool.java 10 Oct 2006 15:00:26 -0000 1.14 --- ArcTool.java 7 May 2007 13:29:48 -0000 1.15 *************** *** 31,34 **** --- 31,36 ---- /** Radius of the current arc */ private double radius = 0; + + private Intersection first; /** *************** *** 37,44 **** */ protected void updateFeedback() { ! if (start != null) { if (end != null) { ! Edge e1 = new Edge(start.vertex(), current.vertex()); Edge e2 = new Edge(current.vertex(), end.vertex()); Collection edges = new LinkedList(); --- 39,46 ---- */ protected void updateFeedback() { ! if (first != null) { if (end != null) { ! Edge e1 = new Edge(first.vertex(), current.vertex()); Edge e2 = new Edge(current.vertex(), end.vertex()); Collection edges = new LinkedList(); *************** *** 46,52 **** edges.add(e2); ! feedback(createArc(start.vertex(), current.vertex(), end.vertex(), false)); } else { ! Edge edge = new Edge(start.vertex(), current.vertex()); Collection edges = new LinkedList(); edges.add(edge); --- 48,54 ---- edges.add(e2); ! feedback(createArc(first.vertex(), current.vertex(), end.vertex(), false)); } else { ! Edge edge = new Edge(first.vertex(), current.vertex()); Collection edges = new LinkedList(); edges.add(edge); *************** *** 182,200 **** /** * @param e MouseEvent */ protected void pressed(MouseEvent e) { if (current != null) { ! if (start == null) { ! start = current; active = true; } else { if (end == null) { end = current; } else { ! Geometry.insertEdges(createArc(start.vertex(), current.vertex(), end.vertex(), false)); ! start = null; ! end = null; ! active = false; } } --- 184,214 ---- /** + * {@inheritDoc} + */ + @Override + public void onVertex() { + Geometry.insertEdges(createArc(first.vertex(), current.vertex(), end.vertex(), false)); + first = null; + end = null; + active = false; + cleanUp(); + } + + /** * @param e MouseEvent */ protected void pressed(MouseEvent e) { if (current != null) { ! if (first == null) { ! first = current; active = true; } else { if (end == null) { end = current; + Vertex between = end.vertex().minus(first.vertex()); + between.scale(0.5); + start = new Intersection(first.vertex().add(between), Intersection.VERTEX, null); } else { ! onVertex(); } } *************** *** 220,223 **** --- 234,238 ---- public void cleanUp() { super.cleanUp(); + first = null; end = null; } Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** ExtrusionTool.java 7 May 2007 13:19:07 -0000 1.55 --- ExtrusionTool.java 7 May 2007 13:29:48 -0000 1.56 *************** *** 416,419 **** --- 416,427 ---- /** + * {@inheritDoc} + */ + @Override + public void onVertex() { + + } + + /** * Apply current tool with specified length value * @param length The lengthfield value Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** AbstractPencil.java 7 May 2007 13:19:07 -0000 1.75 --- AbstractPencil.java 7 May 2007 13:29:48 -0000 1.76 *************** *** 25,28 **** --- 25,29 ---- import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.gl.view.View; + import net.sourceforge.bprocessor.gui.GUI; import net.sourceforge.bprocessor.model.Constructor; import net.sourceforge.bprocessor.model.CoordinateSystem; *************** *** 666,672 **** * onVertex - current vertex is pressed */ ! public void onVertex() { ! log.info("onVertex"); ! } /** --- 667,671 ---- * onVertex - current vertex is pressed */ ! public abstract void onVertex(); /** *************** *** 675,679 **** */ public void apply(double length) { - log.info("general-apply(" + length + ")"); if (current != null) { Vertex before = null; --- 674,677 ---- *************** *** 693,696 **** --- 691,696 ---- } } + } else { + GUI.getInstance().alert("No action to apply the given length on"); } } Index: EdgeMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/EdgeMoveTool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EdgeMoveTool.java 23 Mar 2007 15:27:23 -0000 1.2 --- EdgeMoveTool.java 7 May 2007 13:29:49 -0000 1.3 *************** *** 56,60 **** } ! private void move(Vertex to) { --- 56,68 ---- } ! /** ! * {@inheritDoc} ! */ ! @Override ! public void onVertex() { ! move(current.vertex()); ! start = null; ! cleanUp(); ! } private void move(Vertex to) { Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** SpaceTool.java 14 Apr 2007 15:00:52 -0000 1.72 --- SpaceTool.java 7 May 2007 13:29:48 -0000 1.73 *************** *** 9,12 **** --- 9,13 ---- import java.awt.Cursor; + import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; *************** *** 26,30 **** --- 27,33 ---- import javax.swing.JMenu; import javax.swing.JMenuItem; + import javax.swing.JPanel; import javax.swing.JPopupMenu; + import javax.swing.JScrollPane; import org.apache.log4j.Logger; *************** *** 324,328 **** glv.getView().makeTarget(null); Selection.primary().set(space); - Project.getInstance().changed(Project.getInstance()); } } --- 327,330 ---- *************** *** 336,340 **** glv.getView().makeTarget(null); space.edit(); - Project.getInstance().changed(Project.getInstance()); } } --- 338,341 ---- *************** *** 347,350 **** --- 348,352 ---- Selection.primary().set(spaceCopy); glv.changeTool(Tool.MOVE_TOOL); + space.getOwner().changed(); } } *************** *** 374,397 **** JMenu funcMenu = new JMenu("Functional " + category + "s"); JMenu constMenu = new JMenu("Construction " + category + "s"); ! if (domains != null) { Iterator domIt = domains.iterator(); while (domIt.hasNext()) { Space domain = (Space)domIt.next(); ! if (domain instanceof Space) { ! JMenuItem domainItem = new JMenuItem(domain.getDisplayName()); ! ActionListener ml = new DomainPopupListener(domain, ! surface, ! side.equals("front")); ! domainItem.addActionListener(ml); ! if (domain.isFunctionalSpace()) { ! funcMenu.add(domainItem); ! } else { ! constMenu.add(domainItem); ! } } } } funcMenu.addSeparator(); funcMenu.add(createFuncItem); --- 376,408 ---- JMenu funcMenu = new JMenu("Functional " + category + "s"); + JPanel funcs = new JPanel(); + JScrollPane funcScroll = new JScrollPane(funcs, + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + funcScroll.setSize(new Dimension(150, 400)); + funcScroll.setPreferredSize(new Dimension(150, 400)); JMenu constMenu = new JMenu("Construction " + category + "s"); ! JScrollPane constScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, ! JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); ! constScroll.setSize(new Dimension(150, 400)); ! constScroll.setPreferredSize(new Dimension(150, 400)); if (domains != null) { Iterator domIt = domains.iterator(); while (domIt.hasNext()) { Space domain = (Space)domIt.next(); ! JMenuItem domainItem = new JMenuItem(domain.getDisplayName()); ! ActionListener ml = new DomainPopupListener(domain, ! surface, ! side.equals("front")); ! domainItem.addActionListener(ml); ! if (domain.isFunctionalSpace()) { ! funcs.add(domainItem); ! } else { ! constMenu.add(domainItem); } + domainItem.setFocusTraversalPolicyProvider(false); } } + funcMenu.add(funcScroll); funcMenu.addSeparator(); funcMenu.add(createFuncItem); Index: AltMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AltMoveTool.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** AltMoveTool.java 21 Apr 2007 13:35:59 -0000 1.10 --- AltMoveTool.java 7 May 2007 13:29:48 -0000 1.11 *************** *** 50,54 **** } ! private void move(Vertex to) { --- 50,60 ---- } ! /** ! * {@inheritDoc} ! */ ! @Override ! public void onVertex() { ! ! } private void move(Vertex to) { Index: Protractor.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Protractor.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Protractor.java 7 Sep 2006 11:38:41 -0000 1.5 --- Protractor.java 7 May 2007 13:29:48 -0000 1.6 *************** *** 72,75 **** --- 72,85 ---- /** + * {@inheritDoc} + */ + @Override + public void onVertex() { + Line l = createConstructor(start.vertex(), current.vertex()); + Geometry.insertConstructor(l); + start = null; + } + + /** * @param e MouseEven */ *************** *** 78,84 **** start = current; } else { ! Line l = createConstructor(start.vertex(), current.vertex()); ! Geometry.insertConstructor(l); ! start = null; } updateFeedback(); --- 88,92 ---- start = current; } else { ! onVertex(); } updateFeedback(); |