Package com.cburch.logisim.tools

Examples of com.cburch.logisim.tools.Tool


    }
   
    private void copyToolAttributes(Library srcLib, Library dstLib) {
      for (Tool srcTool : srcLib.getTools()) {
        AttributeSet srcAttrs = srcTool.getAttributeSet();
        Tool dstTool = dstLib.getTool(srcTool.getName());
        if (srcAttrs != null && dstTool != null) {
          AttributeSet dstAttrs = dstTool.getAttributeSet();
          for (Attribute<?> attrBase : srcAttrs.getAttributes()) {
            @SuppressWarnings("unchecked")
            Attribute<Object> attr = (Attribute<Object>) attrBase;
            Object srcValue = srcAttrs.getValue(attr);
            Object dstValue = dstAttrs.getValue(attr);
View Full Code Here


    HashMap<ComponentFactory,ComponentFactory> componentMap;
    HashMap<Tool,Tool> toolMap;
    componentMap = new HashMap<ComponentFactory,ComponentFactory>();
    toolMap = new HashMap<Tool,Tool>();
    for (Tool oldTool : old.getTools()) {
      Tool newTool = base.getTool(oldTool.getName());
      toolMap.put(oldTool, newTool);
      if (oldTool instanceof AddTool) {
        ComponentFactory oldFactory = ((AddTool) oldTool).getFactory();
        if (newTool != null && newTool instanceof AddTool) {
          ComponentFactory newFactory = ((AddTool) newTool).getFactory();
View Full Code Here

  }
 
  private static void replaceAll(Map<ComponentFactory,ComponentFactory> compMap,
      Map<Tool,Tool> toolMap) {
    for (Project proj : Projects.getOpenProjects()) {
      Tool oldTool = proj.getTool();
      Circuit oldCircuit = proj.getCurrentCircuit();
      if (toolMap.containsKey(oldTool)) {
        proj.setTool(toolMap.get(oldTool));
      }
      SubcircuitFactory oldFactory = oldCircuit.getSubcircuitFactory();
View Full Code Here

 
  private void selectSelectTool(Project proj) {
    for (Library sub : proj.getLogisimFile().getLibraries()) {
      if (sub instanceof Base) {
        Base base = (Base) sub;
        Tool tool = base.getTool("Edit Tool");
        if (tool != null) proj.setTool(tool);
      }
    }
  }
View Full Code Here

    else return doSave(proj, f);
  }
 
  private static boolean doSave(Project proj, File f) {
    Loader loader = proj.getLogisimFile().getLoader();
    Tool oldTool = proj.getTool();
    proj.setTool(null);
    boolean ret = loader.save(proj.getLogisimFile(), f);
    if (ret) {
      AppPreferences.updateRecentFile(f);
      proj.setFileAsClean();
View Full Code Here

          }
        }
      }
     
      lastSelected = proj.getTool();
      Tool tool = (Tool) selected;
      proj.setTool(tool);
      proj.getFrame().viewAttributes(tool);
    }
  }
View Full Code Here

    Library lib = reader.findLibrary(libName);
    if (lib == null) {
      throw new XmlReaderException(Strings.get("compUnknownError", "no-lib"));
    }

    Tool tool = lib.getTool(name);
    if (tool == null || !(tool instanceof AddTool)) {
      if (libName == null || libName.equals("")) {
        throw new XmlReaderException(Strings.get("compUnknownError", name));
      } else {
        throw new XmlReaderException(Strings.get("compAbsentError", name, libName));
View Full Code Here

    public void mouseClicked(MouseEvent e) { }
    public void mouseEntered(MouseEvent e) { }
    public void mouseExited(MouseEvent e) { }
    public void mousePressed(MouseEvent e) {
      if (e.getSource() == addArea && curTool != null) {
        Tool t = curTool.cloneTool();
        Integer mods = Integer.valueOf(e.getModifiersEx());
        getProject().doAction(OptionsActions.setMapping(getOptions().getMouseMappings(), mods, t));
        setSelectedRow(model.getRow(mods));
      }
    }
View Full Code Here

      if (row < 0) {
        remove.setEnabled(false);
        attrTable.setAttrTableModel(null);
      } else {
        remove.setEnabled(true);
        Tool tool = model.getTool(row);
        Project proj = getProject();
        AttrTableModel model;
        if (tool.getAttributeSet() == null) {
          model = null;
        } else {
          model = new AttrTableToolModel(proj, tool);
        }
        attrTable.setAttrTableModel(model);
View Full Code Here

    public Object getValueAt(int row, int column) {
      Integer key = cur_keys.get(row);
      if (column == 0) {
        return InputEventUtil.toDisplayString(key.intValue());
      } else {
        Tool tool = getOptions().getMouseMappings().getToolFor(key);
        return tool.getDisplayName();
      }
    }
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.