use of com.cburch.logisim.instance.InstanceComponent in project logisim-evolution by reds-heig.
the class Netlist method circuitChanged.
@Override
public void circuitChanged(CircuitEvent event) {
int ev = event.getAction();
if (event.getData() instanceof InstanceComponent) {
InstanceComponent inst = (InstanceComponent) event.getData();
if (event.getCircuit().equals(MyCircuit)) {
switch(ev) {
case CircuitEvent.ACTION_ADD:
DRCStatus = DRC_REQUIRED;
if (inst.getFactory() instanceof SubcircuitFactory) {
SubcircuitFactory fac = (SubcircuitFactory) inst.getFactory();
Circuit sub = fac.getSubcircuit();
if (MySubCircuitMap.containsKey(sub)) {
MySubCircuitMap.put(sub, MySubCircuitMap.get(sub) + 1);
} else {
MySubCircuitMap.put(sub, 1);
sub.addCircuitListener(this);
}
}
break;
case CircuitEvent.ACTION_REMOVE:
DRCStatus = DRC_REQUIRED;
if (inst.getFactory() instanceof SubcircuitFactory) {
SubcircuitFactory fac = (SubcircuitFactory) inst.getFactory();
Circuit sub = fac.getSubcircuit();
if (MySubCircuitMap.containsKey(sub)) {
if (MySubCircuitMap.get(sub) == 1) {
MySubCircuitMap.remove(sub);
sub.removeCircuitListener(this);
} else {
MySubCircuitMap.put(sub, MySubCircuitMap.get(sub) - 1);
}
}
}
break;
case CircuitEvent.ACTION_CHANGE:
case CircuitEvent.ACTION_CLEAR:
case CircuitEvent.ACTION_INVALIDATE:
DRCStatus = DRC_REQUIRED;
break;
}
} else {
if (inst.getFactory() instanceof Pin) {
DRCStatus = DRC_REQUIRED;
}
}
}
}
use of com.cburch.logisim.instance.InstanceComponent in project logisim-evolution by reds-heig.
the class SimpleDRCContainer method ClearMarks.
public void ClearMarks() {
if (!DRCInfoPresent())
return;
for (Object obj : DRCComponents) {
if (obj instanceof Wire) {
Wire wire = (Wire) obj;
if ((MarkType & MARK_WIRE) != 0) {
wire.SetMarked(false);
}
} else if (obj instanceof Splitter) {
Splitter split = (Splitter) obj;
if ((MarkType & MARK_INSTANCE) != 0) {
split.SetMarked(false);
}
} else if (obj instanceof InstanceComponent) {
InstanceComponent comp = (InstanceComponent) obj;
comp.clearMarks();
}
}
}
Aggregations