Search in sources :

Example 1 with Dependencies

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);
}
Also used : SubcircuitFactory(com.cburch.logisim.circuit.SubcircuitFactory) Circuit(com.cburch.logisim.circuit.Circuit) Dependencies(com.cburch.logisim.proj.Dependencies)

Aggregations

Circuit (com.cburch.logisim.circuit.Circuit)1 SubcircuitFactory (com.cburch.logisim.circuit.SubcircuitFactory)1 Dependencies (com.cburch.logisim.proj.Dependencies)1