use of com.cburch.draw.model.CanvasObject in project logisim-evolution by reds-heig.
the class RevertAppearanceAction method doIt.
@Override
public void doIt(Project proj) {
CircuitAppearance appear = circuit.getAppearance();
wasDefault = appear.isDefaultAppearance();
old = new ArrayList<CanvasObject>(appear.getObjectsFromBottom());
appear.setDefaultAppearance(true);
}
use of com.cburch.draw.model.CanvasObject in project logisim-evolution by reds-heig.
the class Selection method setMovingShapes.
public void setMovingShapes(Collection<? extends CanvasObject> shapes, int dx, int dy) {
for (CanvasObject o : shapes) {
suppressed.put(o, TRANSLATING);
}
moveDx = dx;
moveDy = dy;
}
use of com.cburch.draw.model.CanvasObject 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);
}
}
}
use of com.cburch.draw.model.CanvasObject 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);
}
}
use of com.cburch.draw.model.CanvasObject in project logisim-evolution by logisim-evolution.
the class PolyTool method commit.
private CanvasObject commit(Canvas canvas) {
if (!active)
return null;
CanvasObject add = null;
active = false;
final var locs = locations;
for (var i = locs.size() - 2; i >= 0; i--) {
if (locs.get(i).equals(locs.get(i + 1)))
locs.remove(i);
}
if (locs.size() > 1) {
final var model = canvas.getModel();
add = new Poly(closed, locs);
canvas.doAction(new ModelAddAction(model, add));
repaintArea(canvas);
}
locs.clear();
return add;
}
Aggregations