Package com.cburch.logisim.circuit

Examples of com.cburch.logisim.circuit.CircuitState$MyCircuitListener


    }
    Collections.sort(newChildren, new CompareByName());
    Collections.sort(subcircs, this);
    for (Component comp : subcircs) {
      SubcircuitFactory factory = (SubcircuitFactory) comp.getFactory();
      CircuitState state = factory.getSubstate(circuitState, comp);
      SimulationTreeCircuitNode toAdd = null;
      for (TreeNode o : children) {
        if (o instanceof SimulationTreeCircuitNode) {
          SimulationTreeCircuitNode n = (SimulationTreeCircuitNode) o;
          if (n.circuitState == state) { toAdd = n; break; }
View Full Code Here


       
        Tool t = event.getTool();
        if (t == nullsetCursor(Cursor.getDefaultCursor());
        else            setCursor(t.getCursor());
      } else if (act == ProjectEvent.ACTION_SET_STATE) {
        CircuitState oldState = (CircuitState) event.getOldData();
        CircuitState newState = (CircuitState) event.getData();
        if (oldState != null && newState != null) {
          Propagator oldProp = oldState.getPropagator();
          Propagator newProp = newState.getPropagator();
          if (oldProp != newProp) {
            tickCounter.clear();
          }
        }
      }
View Full Code Here

          }
          proj.setTool(next);
        }
       
        if (circ != null) {
          CircuitState state = getCircuitState();
          CircuitState last = state;
          while (state != null && state.getCircuit() != circ) {
            last = state;
            state = state.getParentState();
          }
          if (state != null) {
            getProject().setCircuitState(last.cloneState());
          }
        }
      }
    }
View Full Code Here

    public void attributeListChanged(AttributeEvent e) { }
    public void attributeValueChanged(AttributeEvent e) {
      Attribute<?> attr = e.getAttribute();
      if (attr == Options.ATTR_GATE_UNDEFINED) {
        CircuitState circState = getCircuitState();
        circState.markComponentsDirty(getCircuit().getNonWires());
        // TODO actually, we'd want to mark all components in
        // subcircuits as dirty as well
      }
    }
View Full Code Here

          haltPin = pin;
        }
      }
    }
   
    CircuitState circState = new CircuitState(proj, circuit);
    // we have to do our initial propagation before the simulation starts -
    // it's necessary to populate the circuit with substates.
    circState.getPropagator().propagate();
    if (args.getLoadFile() != null) {
      try {
        boolean loaded = loadRam(circState, args.getLoadFile());
        if (!loaded) {
          System.err.println(Strings.get("loadNoRamError")); //OK
View Full Code Here

   
    public int print(Graphics base, PageFormat format, int pageIndex) {
      if (pageIndex >= circuits.size()) return Printable.NO_SUCH_PAGE;
     
      Circuit circ = circuits.get(pageIndex);
      CircuitState circState = proj.getCircuitState(circ);
      Graphics g = base.create();
      Graphics2D g2 = g instanceof Graphics2D ? (Graphics2D) g : null;
      FontMetrics fm = g.getFontMetrics();
      String head = (header != null && !header.equals(""))
        ? format(header, pageIndex + 1, circuits.size(),
View Full Code Here

  }

  private void computeSize(boolean immediate) {
    hidePopup();
    Bounds bounds;
    CircuitState circState = circuitState;
    if (circState == null) {
      bounds = Bounds.create(0, 0, 50, 50);
    } else {
      bounds = circState.getCircuit().getAppearance().getAbsoluteBounds();
    }
    int width = bounds.getX() + bounds.getWidth() + BOUNDS_BUFFER;
    int height = bounds.getY() + bounds.getHeight() + BOUNDS_BUFFER;
    Dimension dim;
    if (canvasPane == null) {
View Full Code Here

        JOptionPane.showMessageDialog(frame,
            Strings.get("couldNotCreateImage"));
        monitor.close();
      }

      CircuitState circuitState = canvas.getProject().getCircuitState(circuit);
      ComponentDrawContext context = new ComponentDrawContext(canvas,
          circuit, circuitState, base, g, printerView);
      circuit.draw(context, null);

      File where;
View Full Code Here

  public void setPort(int portIndex, Value value, int delay) {
    throw new UnsupportedOperationException("setValue on InstancePainter");
  }
 
  public InstanceData getData() {
    CircuitState circState = context.getCircuitState();
    if (circState == null || comp == null) {
      throw new UnsupportedOperationException("setData on InstancePainter");
    } else {
      return (InstanceData) circState.getData(comp);
    }
  }
View Full Code Here

      return (InstanceData) circState.getData(comp);
    }
  }
 
  public void setData(InstanceData value) {
    CircuitState circState = context.getCircuitState();
    if (circState == null || comp == null) {
      throw new UnsupportedOperationException("setData on InstancePainter");
    } else {
      circState.setData(comp, value);
    }
  }
View Full Code Here

TOP

Related Classes of com.cburch.logisim.circuit.CircuitState$MyCircuitListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.