[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/tool SpaceTool.java, 1.83, 1.84 AbstractPe
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2007-08-24 09:54:35
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3974/src/net/sourceforge/bprocessor/gl/tool Modified Files: SpaceTool.java AbstractPencil.java SelectStrategy.java SelectTool.java Log Message: Added shift draw selection and now there is no drag select if right mouse button is clicked as well as the label is staying Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** SpaceTool.java 19 Jul 2007 12:23:32 -0000 1.83 --- SpaceTool.java 24 Aug 2007 09:54:27 -0000 1.84 *************** *** 78,82 **** String side = (String)target; glv.popup(makeSpaceMenu(side), e.getX(), e.getY()); ! done = true; } } --- 78,82 ---- String side = (String)target; glv.popup(makeSpaceMenu(side), e.getX(), e.getY()); ! } } Index: SelectStrategy.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectStrategy.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** SelectStrategy.java 10 Aug 2007 11:20:11 -0000 1.16 --- SelectStrategy.java 24 Aug 2007 09:54:27 -0000 1.17 *************** *** 64,67 **** --- 64,69 ---- /** The y */ private int y; + + private boolean activated; /** *************** *** 100,104 **** */ public void pressed(MouseEvent e) { ! log.info("pressed"); Transformation t = glv.getView().transformation(); Vertex first = t.unProject(new Vertex(e.getX(), View.getHeight() - e.getY(), 0.001)); --- 102,106 ---- */ public void pressed(MouseEvent e) { ! log.debug("pressed"); Transformation t = glv.getView().transformation(); Vertex first = t.unProject(new Vertex(e.getX(), View.getHeight() - e.getY(), 0.001)); *************** *** 109,112 **** --- 111,117 ---- View view = glv.getView(); target = view.getObjectAtPoint(x, y, View.OBJECTS); + if (target == null || target instanceof Geometric) { + activated = true; + } } *************** *** 116,156 **** */ public void dragged(MouseEvent e) { ! log.info("dragged"); ! multipleSelection = true; ! Transformation t = glv.getView().transformation(); ! Vertex last = t.unProject(new Vertex(e.getX(), View.getHeight() - e.getY(), 0.001)); ! Vertex temp1 = t.unProject(new Vertex(e.getX(), View.getHeight() - y, 0.001)); ! Vertex temp2 = t.unProject(new Vertex(x, View.getHeight() - e.getY(), 0.001)); ! e1.setTo(temp1); ! e2.setFrom(temp1); ! e2.setTo(last); ! e3.setFrom(last); ! e3.setTo(temp2); ! e4.setFrom(temp2); ! for (Edge constructor : box) { ! glv.getView().addTempEdge(constructor); ! } ! Collection selection = Selection.primary(); ! selection.clear(); ! int newX = e.getX(); ! Set l = new HashSet(glv.getView().getObjectInArea(x, y, ! e.getX(), e.getY())); ! l.removeAll(box); ! l.remove(Project.getInstance().getActiveCoordinateSystem()); ! if (newX > x) { ! Set<Geometric> remove = new HashSet<Geometric>(); ! for (Object o : l) { ! if (o instanceof Geometric) { ! Geometric geo = (Geometric)o; ! Set<Vertex> vertices = geo.collect(); ! if (!l.containsAll(vertices)) { ! remove.add(geo); } } } - l.removeAll(remove); } - glv.getView().makeTarget(null); - selection.addAll(l); } --- 121,165 ---- */ public void dragged(MouseEvent e) { ! log.debug("dragged"); ! if (activated) { ! multipleSelection = true; ! Transformation t = glv.getView().transformation(); ! Vertex last = t.unProject(new Vertex(e.getX(), View.getHeight() - e.getY(), 0.001)); ! Vertex temp1 = t.unProject(new Vertex(e.getX(), View.getHeight() - y, 0.001)); ! Vertex temp2 = t.unProject(new Vertex(x, View.getHeight() - e.getY(), 0.001)); ! e1.setTo(temp1); ! e2.setFrom(temp1); ! e2.setTo(last); ! e3.setFrom(last); ! e3.setTo(temp2); ! e4.setFrom(temp2); ! for (Edge constructor : box) { ! glv.getView().addTempEdge(constructor); ! } ! int newX = e.getX(); ! Set l = new HashSet(glv.getView().getObjectInArea(x, y, ! e.getX(), e.getY())); ! l.removeAll(box); ! l.remove(Project.getInstance().getActiveCoordinateSystem()); ! if (newX > x) { ! Set<Geometric> remove = new HashSet<Geometric>(); ! for (Object o : l) { ! if (o instanceof Geometric) { ! Geometric geo = (Geometric)o; ! Set<Vertex> vertices = geo.collect(); ! if (!l.containsAll(vertices)) { ! remove.add(geo); ! } } } + l.removeAll(remove); + } + glv.getView().makeTarget(null); + if (!e.isShiftDown()) { + Selection.primary().set(l); + } else { + Selection.primary().addAll(l); } } } *************** *** 161,245 **** public void released(MouseEvent e) { log.debug("released with event:" + e.toString()); ! if (multipleSelection) { ! for (Edge constructor : box) { ! glv.getView().removeTempEdge(constructor); ! } ! multipleSelection = false; ! } else { ! Selection selection = Selection.primary(); ! if (e.getClickCount() >= 2) { ! if (e.getClickCount() == 2) { ! Collection<Geometric> extended = new HashSet(); ! extended.addAll(Selection.primary()); ! for (Geometric current : Selection.primary()) { ! if (current instanceof Edge) { ! Edge edge = (Edge) current; ! extended.addAll(edge.getSurfaces()); } ! if (current instanceof Surface) { ! Surface surface = (Surface) current; ! extended.addAll(surface.getEdges()); } } ! Selection.primary().clear(); ! Selection.primary().addAll(extended); ! } else { ! Collection<Geometric> geometrics = ! Geometric.connected(Selection.primary()); ! Selection.primary().set(geometrics); ! } ! ! if (1 < 0) { ! if (target instanceof Space) { ! Space space = (Space) target; ! space.edit(); ! } else if (target instanceof Surface) { ! Surface surface = (Surface) target; ! if (surface.getBackDomain() != null) { ! selection.addAll(surface.getBackDomain().getEnvelope()); ! } ! if (surface.getFrontDomain() != null) { ! selection.addAll(surface.getFrontDomain().getEnvelope()); } - } else if (target instanceof Constructor) { - Constructor c = (Constructor)target; - c.setActive(!c.isActive()); - } else if (target instanceof ClippingPlane) { - ClippingPlane cp = (ClippingPlane)target; - cp.setActive(!cp.isActive()); } else if (target instanceof GlCamera) { GlCamera glcam = (GlCamera)target; Project.getInstance().setCurrentCamera(glcam.getCamera()); - } - } - } else { - if (target == null) { - selection.clear(); - } else if (e.isShiftDown()) { - if (target instanceof Geometric) { - Geometric g = (Geometric)target; - if (!selection.contains(g)) { - selection.add(g); - } else { - selection.remove(g); - } } else { ! log.error("Tried to insert something different from Geometric in selection"); ! } ! } else if (target instanceof GlCamera) { ! GlCamera glcam = (GlCamera)target; ! Project.getInstance().setCurrentCamera(glcam.getCamera()); ! } else { ! if (target instanceof Geometric) { ! if (!selection.contains(target)) { ! selection.set((Geometric)target); } - } else { - log.warn("Target weren't a Geometric"); } } } } ! target = null; } } --- 170,253 ---- public void released(MouseEvent e) { log.debug("released with event:" + e.toString()); ! if (activated) { ! if (multipleSelection) { ! for (Edge constructor : box) { ! glv.getView().removeTempEdge(constructor); ! } ! multipleSelection = false; ! } else { ! Selection selection = Selection.primary(); ! if (e.getClickCount() >= 2) { ! if (e.getClickCount() == 2) { ! Collection<Geometric> extended = new HashSet(); ! extended.addAll(Selection.primary()); ! if (extended.isEmpty()) { ! //Move out one space/union level if possible ! Space sp = Project.getInstance().getActiveSpace(); ! if (sp.getLevel() > Space.PROJECT_LEVEL) { ! sp.getOwner().edit(); ! } } ! for (Geometric current : Selection.primary()) { ! if (current instanceof Edge) { ! Edge edge = (Edge) current; ! extended.addAll(edge.getSurfaces()); ! } else if (current instanceof Surface) { ! Surface surface = (Surface) current; ! extended.addAll(surface.getEdges()); ! } else if (target instanceof Space) { ! Space space = (Space) target; ! extended.clear(); ! space.edit(); ! break; ! } else if (target instanceof Constructor) { ! Constructor c = (Constructor)target; ! c.setActive(!c.isActive()); ! } else if (target instanceof ClippingPlane) { ! ClippingPlane cp = (ClippingPlane)target; ! cp.setActive(!cp.isActive()); ! } else if (target instanceof GlCamera) { ! GlCamera glcam = (GlCamera)target; ! Project.getInstance().setCurrentCamera(glcam.getCamera()); ! } } + Selection.primary().clear(); + Selection.primary().addAll(extended); + } else { + Collection<Geometric> geometrics = + Geometric.connected(Selection.primary()); + Selection.primary().set(geometrics); } ! } else { ! if (target == null) { ! selection.clear(); ! } else if (e.isShiftDown()) { ! if (target instanceof Geometric) { ! Geometric g = (Geometric)target; ! if (!selection.contains(g)) { ! selection.add(g); ! } else { ! selection.remove(g); ! } ! } else { ! log.error("Tried to insert something different from Geometric in selection"); } } else if (target instanceof GlCamera) { GlCamera glcam = (GlCamera)target; Project.getInstance().setCurrentCamera(glcam.getCamera()); } else { ! if (target instanceof Geometric) { ! if (!selection.contains(target)) { ! selection.set((Geometric)target); ! } ! } else { ! log.warn("Target weren't a Geometric"); } } } } + target = null; } ! activated = false; } } Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** SelectTool.java 19 Jun 2007 20:10:24 -0000 1.63 --- SelectTool.java 24 Aug 2007 09:54:27 -0000 1.64 *************** *** 54,58 **** */ protected void dragged(MouseEvent e) { ! select.dragged(e); } --- 54,60 ---- */ protected void dragged(MouseEvent e) { ! if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK) { ! select.dragged(e); ! } } *************** *** 62,66 **** */ protected void released(MouseEvent e) { ! select.released(e); } --- 64,70 ---- */ protected void released(MouseEvent e) { ! if (e.getButton() == MouseEvent.BUTTON1) { ! select.released(e); ! } } Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.86 retrieving revision 1.87 diff -C2 -d -r1.86 -r1.87 *** AbstractPencil.java 22 Aug 2007 13:22:47 -0000 1.86 --- AbstractPencil.java 24 Aug 2007 09:54:27 -0000 1.87 *************** *** 621,628 **** /** ! * @param intersection intersection ! * @return color */ ! public float[] targetColor(Intersection intersection) { float[] targetColor = View.TARGET_COLOR; switch (intersection.type()) { --- 621,629 ---- /** ! * Find the appropiate hit color for a given intersection ! * @param intersection The intersection ! * @return The resulting color */ ! protected float[] targetColor(Intersection intersection) { float[] targetColor = View.TARGET_COLOR; switch (intersection.type()) { |