Package com.cburch.logisim.data

Examples of com.cburch.logisim.data.AttributeSet


  private HashMap<Component,Component> copyComponents(Collection<Component> components,
      int dx, int dy) {
    HashMap<Component,Component> ret = new HashMap<Component,Component>();
    for (Component comp : components) {
      Location oldLoc = comp.getLocation();
      AttributeSet attrs = (AttributeSet) comp.getAttributeSet().clone();
      int newX = oldLoc.getX() + dx;
      int newY = oldLoc.getY() + dy;
      Object snap = comp.getFactory().getFeature(ComponentFactory.SHOULD_SNAP, attrs);
      if (snap == null || ((Boolean) snap).booleanValue()) {
        newX = Canvas.snapXToGrid(newX);
View Full Code Here


  private void viewAttributes(Tool newTool, boolean force) {
    viewAttributes(null, newTool, force);
  }

  private void viewAttributes(Tool oldTool, Tool newTool, boolean force) {
    AttributeSet newAttrs;
    if (newTool == null) {
      newAttrs = null;
      if (!force) return;
    } else {
      newAttrs = newTool.getAttributeSet(layoutCanvas);
View Full Code Here

      subcircInstance.fireInvalidated();
    }
  }
 
  static AttributeSet createBaseAttrs(Circuit source, String name) {
    AttributeSet ret = AttributeSets.fixedSet(STATIC_ATTRS, STATIC_DEFAULTS);
    ret.setValue(CircuitAttributes.NAME_ATTR, name);
    ret.addAttributeListener(new StaticListener(source));
    return ret;
  }
View Full Code Here

      } else if (act == ProjectEvent.ACTION_SET_FILE) {
        LogisimFile old = (LogisimFile) event.getOldData();
        if (old != null) old.getOptions().getAttributeSet().removeAttributeListener(this);
        LogisimFile file = (LogisimFile) event.getData();
        if (file != null) {
          AttributeSet attrs = file.getOptions().getAttributeSet();
          attrs.addAttributeListener(this);
          loadOptions(attrs);
          mappings = file.getOptions().getMouseMappings();
        }
      } else if (act == ProjectEvent.ACTION_SET_TOOL) {
        viewport.setErrorMessage(null, null);
View Full Code Here

      int width, int height);

  protected void paintRectangular(InstancePainter painter,
      int width, int height) {
    int don = negateOutput ? 10 : 0;
    AttributeSet attrs = painter.getAttributeSet();
    painter.drawRectangle(-width, -height / 2, width - don, height,
        getRectangularLabel(attrs));
    if (negateOutput) {
      painter.drawDongle(-5, 0);
    }
View Full Code Here

  @Override
  public void propagate(InstanceState state) {
    GateAttributes attrs = (GateAttributes) state.getAttributeSet();
    int inputCount = attrs.inputs;
    int negated = attrs.negated;
    AttributeSet opts = state.getProject().getOptions().getAttributeSet();
    boolean errorIfUndefined = opts.getValue(Options.ATTR_GATE_UNDEFINED)
                  .equals(Options.GATE_UNDEFINED_ERROR);

    Value[] inputs = new Value[inputCount];
    int numInputs = 0;
    boolean error = false;
View Full Code Here

    }

    // if nothing found, create a new label
    if (caret == null) {
      if (loc.getX() < 0 || loc.getY() < 0) return;
      AttributeSet copy = (AttributeSet) attrs.clone();
      caretComponent = Text.FACTORY.createComponent(loc, copy);
      caretCreatingText = true;
      TextEditable editable = (TextEditable) caretComponent.getFeature(TextEditable.class);
      if (editable != null) {
        caret = editable.getTextCaret(event);
View Full Code Here

  }
 
  public void addToolAttributeListener(AttributeListener l) {
    for (Tool tool : contents) {
      if (tool != null) {
        AttributeSet attrs = tool.getAttributeSet();
        if (attrs != null) attrs.addAttributeListener(l);
      }
    }
    toolListeners.add(l);
  }
View Full Code Here

  }
 
  public void removeToolAttributeListener(AttributeListener l) {
    for (Tool tool : contents) {
      if (tool != null) {
        AttributeSet attrs = tool.getAttributeSet();
        if (attrs != null) attrs.removeAttributeListener(l);
      }
    }
    toolListeners.remove(l);
  }
View Full Code Here

    toolListeners.remove(l);
  }

  private void addAttributeListeners(Tool tool) {
    for (AttributeListener l : toolListeners) {
      AttributeSet attrs = tool.getAttributeSet();
      if (attrs != null) attrs.addAttributeListener(l);
    }
  }
View Full Code Here

TOP

Related Classes of com.cburch.logisim.data.AttributeSet

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.