use of com.cburch.draw.canvas.Selection in project logisim-evolution by reds-heig.
the class AppearanceEditHandler method delete.
@Override
public void delete() {
Selection sel = canvas.getSelection();
int n = sel.getSelected().size();
List<CanvasObject> select = new ArrayList<CanvasObject>(n);
List<CanvasObject> remove = new ArrayList<CanvasObject>(n);
Location anchorLocation = null;
Direction anchorFacing = null;
for (CanvasObject o : sel.getSelected()) {
if (o.canRemove()) {
remove.add(o);
} else {
select.add(o);
if (o instanceof AppearanceAnchor) {
AppearanceAnchor anchor = (AppearanceAnchor) o;
anchorLocation = anchor.getLocation();
anchorFacing = anchor.getFacing();
}
}
}
if (!remove.isEmpty()) {
canvas.getProject().doAction(new SelectionAction(canvas, Strings.getter("deleteSelectionAction"), remove, null, select, anchorLocation, anchorFacing));
}
}
use of com.cburch.draw.canvas.Selection in project logisim-evolution by reds-heig.
the class AppearanceEditHandler method selectAll.
@Override
public void selectAll() {
Selection sel = canvas.getSelection();
sel.setSelected(canvas.getModel().getObjectsFromBottom(), true);
canvas.repaint();
}
use of com.cburch.draw.canvas.Selection in project logisim-evolution by reds-heig.
the class AppearanceEditHandler method removeControlPoint.
@Override
public void removeControlPoint() {
Selection sel = canvas.getSelection();
Handle handle = sel.getSelectedHandle();
canvas.doAction(new ModelDeleteHandleAction(canvas.getModel(), handle));
}
use of com.cburch.draw.canvas.Selection in project logisim-evolution by reds-heig.
the class SelectionAction method undo.
@Override
public void undo(Project proj) {
AppearanceAnchor anchor = findAnchor(canvasModel);
if (anchor != null && anchorOldLocation != null) {
anchor.translate(anchorOldLocation.getX() - anchorNewLocation.getX(), anchorOldLocation.getY() - anchorNewLocation.getY());
}
if (anchor != null && anchorOldFacing != null) {
anchor.setValue(AppearanceAnchor.FACING, anchorOldFacing);
}
Selection sel = canvas.getSelection();
sel.clearSelected();
if (toAdd != null)
canvasModel.removeObjects(toAdd);
if (toRemove != null)
canvasModel.addObjects(toRemove);
sel.setSelected(oldSelection, true);
canvas.repaint();
}
Aggregations