Package com.cburch.logisim.tools

Examples of com.cburch.logisim.tools.Tool


  public Tool getToolFor(int mods) {
    if (mods == cache_mods) {
      return cache_tool;
    } else {
      Tool ret = map.get(Integer.valueOf(mods));
      cache_mods = mods;
      cache_tool = ret;
      return ret;
    }
  }
View Full Code Here


  public Tool getToolFor(Integer mods) {
    if (mods.intValue() == cache_mods) {
      return cache_tool;
    } else {
      Tool ret = map.get(mods);
      cache_mods = mods.intValue();
      cache_tool = ret;
      return ret;
    }
  }
View Full Code Here

  public void copyFrom(MouseMappings other, LogisimFile file) {
    if (this == other) return;
    cache_mods = -1;
    this.map.clear();
    for (Integer mods : other.map.keySet()) {
      Tool srcTool = other.map.get(mods);
      Tool dstTool = file.findTool(srcTool);
      if (dstTool != null) {
        dstTool = dstTool.cloneTool();
        AttributeSets.copy(srcTool.getAttributeSet(),
            dstTool.getAttributeSet());
        this.map.put(mods, dstTool);
      }
    }
    fireMouseMappingsChanged();
  }
View Full Code Here

  //
  void replaceAll(Map<Tool,Tool> toolMap) {
    boolean changed = false;
    for (Map.Entry<Integer,Tool> entry : map.entrySet()) {
      Integer key = entry.getKey();
      Tool tool = entry.getValue();
      if (tool instanceof AddTool) {
        ComponentFactory factory = ((AddTool) tool).getFactory();
        if (toolMap.containsKey(factory)) {
          changed = true;
          Tool newTool = toolMap.get(factory);
          if (newTool == null) {
            map.remove(key);
          } else {
            Tool clone = newTool.cloneTool();
            LoadedLibrary.copyAttributes(clone.getAttributeSet(),
                tool.getAttributeSet());
            map.put(key, clone);
          }
        }
      } else {
        if (toolMap.containsKey(tool)) {
          changed = true;
          Tool newTool = toolMap.get(tool);
          if (newTool == null) {
            map.remove(key);
          } else {
            Tool clone = newTool.cloneTool();
            LoadedLibrary.copyAttributes(clone.getAttributeSet(),
                tool.getAttributeSet());
            map.put(key, clone);
          }
        }
      }
View Full Code Here

  }
 
  void setAttrTableModel(AttrTableModel value) {
    attrTable.setAttrTableModel(value);
    if (value instanceof AttrTableToolModel) {
      Tool tool = ((AttrTableToolModel) value).getTool();
      toolbox.setHaloedTool(tool);
      layoutToolbarModel.setHaloedTool(tool);
    } else {
      toolbox.setHaloedTool(null);
      layoutToolbarModel.setHaloedTool(null);
View Full Code Here

        }
        viewAttributes(proj.getTool());
        computeTitle();
      } else if (action == ProjectEvent.ACTION_SET_TOOL) {
        if (attrTable == null) return; // for startup
        Tool oldTool = (Tool) event.getOldData();
        Tool newTool = (Tool) event.getData();
        viewAttributes(oldTool, newTool, false);
      }
    }
View Full Code Here

      throw new RuntimeException("Cannot remove last circuit");
    }

    int index = getCircuits().indexOf(circuit);
    if (index >= 0) {
      Tool circuitTool = tools.remove(index);

      if (main == circuit) {
        AddTool dflt_tool = tools.get(0);
        SubcircuitFactory factory = (SubcircuitFactory) dflt_tool.getFactory();
        setMainCircuit(factory.getSubcircuit());
View Full Code Here

    }
  }
 
  Tool findTool(Tool query) {
    for (Library lib : getLibraries()) {
      Tool ret = findTool(lib, query);
      if (ret != null) return ret;
    }
    return null;
  }
View Full Code Here

    public void mouseExited(MouseEvent e) {
      if (drag_tool != null) {
        drag_tool.mouseExited(Canvas.this, getGraphics(), e);
      } else {
        Tool tool = getToolFor(e);
        if (tool != null) {
          tool.mouseExited(Canvas.this, getGraphics(), e);
        }
      }
    }
View Full Code Here

      if (drag_tool != null) {
        drag_tool.mouseReleased(Canvas.this, getGraphics(), e);
        drag_tool = null;
      }

      Tool tool = proj.getTool();
      if (tool != null) {
        tool.mouseMoved(Canvas.this, getGraphics(), e);
      }

      completeAction();
    }
View Full Code Here

TOP

Related Classes of com.cburch.logisim.tools.Tool

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.