Search in sources :

Example 36 with Handle

use of com.cburch.draw.model.Handle in project logisim-evolution by reds-heig.

the class Selection method setSelected.

public void setSelected(Collection<CanvasObject> shapes, boolean value) {
    if (value) {
        List<CanvasObject> added;
        added = new ArrayList<CanvasObject>(shapes.size());
        for (CanvasObject shape : shapes) {
            if (selected.add(shape)) {
                added.add(shape);
            }
        }
        if (!added.isEmpty()) {
            fireChanged(SelectionEvent.ACTION_ADDED, added);
        }
    } else {
        List<CanvasObject> removed;
        removed = new ArrayList<CanvasObject>(shapes.size());
        for (CanvasObject shape : shapes) {
            if (selected.remove(shape)) {
                suppressed.remove(shape);
                Handle h = selectedHandle;
                if (h != null && h.getObject() == shape)
                    setHandleSelected(null);
                removed.add(shape);
            }
        }
        if (!removed.isEmpty()) {
            fireChanged(SelectionEvent.ACTION_REMOVED, removed);
        }
    }
}
Also used : CanvasObject(com.cburch.draw.model.CanvasObject) Handle(com.cburch.draw.model.Handle)

Example 37 with Handle

use of com.cburch.draw.model.Handle in project logisim-evolution by reds-heig.

the class Selection method toggleSelected.

public void toggleSelected(Collection<CanvasObject> shapes) {
    List<CanvasObject> added;
    added = new ArrayList<CanvasObject>(shapes.size());
    List<CanvasObject> removed;
    removed = new ArrayList<CanvasObject>(shapes.size());
    for (CanvasObject shape : shapes) {
        if (selected.contains(shape)) {
            selected.remove(shape);
            suppressed.remove(shape);
            Handle h = selectedHandle;
            if (h != null && h.getObject() == shape)
                setHandleSelected(null);
            removed.add(shape);
        } else {
            selected.add(shape);
            added.add(shape);
        }
    }
    if (!removed.isEmpty()) {
        fireChanged(SelectionEvent.ACTION_REMOVED, removed);
    }
    if (!added.isEmpty()) {
        fireChanged(SelectionEvent.ACTION_ADDED, added);
    }
}
Also used : CanvasObject(com.cburch.draw.model.CanvasObject) Handle(com.cburch.draw.model.Handle)

Example 38 with Handle

use of com.cburch.draw.model.Handle in project logisim-evolution by reds-heig.

the class Selection method setHandleGesture.

public void setHandleGesture(HandleGesture gesture) {
    HandleGesture g = curHandleGesture;
    if (g != null)
        suppressed.remove(g.getHandle().getObject());
    Handle h = gesture.getHandle();
    suppressed.put(h.getObject(), MOVING_HANDLE);
    curHandleGesture = gesture;
}
Also used : HandleGesture(com.cburch.draw.model.HandleGesture) Handle(com.cburch.draw.model.Handle)

Example 39 with Handle

use of com.cburch.draw.model.Handle in project logisim-evolution by reds-heig.

the class Curve method moveHandle.

@Override
public Handle moveHandle(HandleGesture gesture) {
    Handle[] hs = getHandleArray(gesture);
    Handle ret = null;
    if (!hs[0].equals(p0)) {
        p0 = hs[0].getLocation();
        ret = hs[0];
    }
    if (!hs[1].equals(p1)) {
        p1 = hs[1].getLocation();
        ret = hs[1];
    }
    if (!hs[2].equals(p2)) {
        p2 = hs[2].getLocation();
        ret = hs[2];
    }
    bounds = CurveUtil.getBounds(toArray(p0), toArray(p1), toArray(p2));
    return ret;
}
Also used : Handle(com.cburch.draw.model.Handle)

Aggregations

Handle (com.cburch.draw.model.Handle)39 CanvasObject (com.cburch.draw.model.CanvasObject)9 Location (com.cburch.logisim.data.Location)9 Selection (com.cburch.draw.canvas.Selection)7 HandleGesture (com.cburch.draw.model.HandleGesture)7 Bounds (com.cburch.logisim.data.Bounds)5 ModelDeleteHandleAction (com.cburch.draw.actions.ModelDeleteHandleAction)1 ModelInsertHandleAction (com.cburch.draw.actions.ModelInsertHandleAction)1 ModelMoveHandleAction (com.cburch.draw.actions.ModelMoveHandleAction)1 ModelTranslateAction (com.cburch.draw.actions.ModelTranslateAction)1 CanvasModel (com.cburch.draw.model.CanvasModel)1 Circuit (com.cburch.logisim.circuit.Circuit)1 AppearanceElement (com.cburch.logisim.circuit.appear.AppearanceElement)1 Project (com.cburch.logisim.proj.Project)1 Graphics (java.awt.Graphics)1 Graphics2D (java.awt.Graphics2D)1 GeneralPath (java.awt.geom.GeneralPath)1 Map (java.util.Map)1 Element (org.w3c.dom.Element)1