use of com.cburch.logisim.proj.Dependencies in project logisim-evolution by reds-heig.
the class AddTool method mousePressed.
@Override
public void mousePressed(Canvas canvas, Graphics g, MouseEvent e) {
// verify the addition would be valid
Circuit circ = canvas.getCircuit();
if (!canvas.getProject().getLogisimFile().contains(circ)) {
canvas.setErrorMessage(Strings.getter("cannotModifyError"));
return;
}
if (factory instanceof SubcircuitFactory) {
SubcircuitFactory circFact = (SubcircuitFactory) factory;
Dependencies depends = canvas.getProject().getDependencies();
if (!depends.canAdd(circ, circFact.getSubcircuit())) {
canvas.setErrorMessage(Strings.getter("circularError"));
return;
}
}
if (shouldSnap)
Canvas.snapToGrid(e);
moveTo(canvas, g, e.getX(), e.getY());
setState(canvas, SHOW_ADD);
}
Aggregations