log.setText(Strings.get("simulateLogItem"));
}
public void setCurrentState(Simulator sim, CircuitState value) {
if (currentState == value) return;
Simulator oldSim = currentSim;
CircuitState oldState = currentState;
currentSim = sim;
currentState = value;
if (bottomState == null) {
bottomState = currentState;
} else if (currentState == null) {
bottomState = null;
} else {
CircuitState cur = bottomState;
while (cur != null && cur != currentState) {
cur = cur.getParentState();
}
if (cur == null) bottomState = currentState;
}
boolean oldPresent = oldState != null;
boolean present = currentState != null;
if (oldPresent != present) {
computeEnabled();
}
if (currentSim != oldSim) {
double freq = currentSim == null ? 1.0 : currentSim.getTickFrequency();
for (int i = 0; i < tickFreqs.length; i++) {
tickFreqs[i].setSelected(Math.abs(tickFreqs[i].freq - freq) < 0.001);
}
if (oldSim != null) oldSim.removeSimulatorListener(myListener);
if (currentSim != null) currentSim.addSimulatorListener(myListener);
myListener.simulatorStateChanged(new SimulatorEvent(sim));
}
clearItems(downStateItems);