Examples of Tool


Examples of com.cburch.logisim.tools.Tool

  Element fromMouseMappings() {
    Element elt = doc.createElement("mappings");
    MouseMappings map = file.getOptions().getMouseMappings();
    for (Map.Entry<Integer,Tool> entry : map.getMappings().entrySet()) {
      Integer mods = entry.getKey();
      Tool tool = entry.getValue();
      Element toolElt = fromTool(tool);
      String mapValue = InputEventUtil.toString(mods.intValue());
      toolElt.setAttribute("map", mapValue);
      elt.appendChild(toolElt);
    }
View Full Code Here

Examples of com.cburch.logisim.tools.Tool

    this.contents.clear();
    for (Tool srcTool : other.contents) {
      if (srcTool == null) {
        this.addSeparator();
      } else {
        Tool toolCopy = file.findTool(srcTool);
        if (toolCopy != null) {
          Tool dstTool = toolCopy.cloneTool();
          AttributeSets.copy(srcTool.getAttributeSet(),
              dstTool.getAttributeSet());
          this.addTool(dstTool);
          addAttributeListeners(toolCopy);
        }
      }
    }
View Full Code Here

Examples of com.cburch.logisim.tools.Tool

    contents.add(pos, null);
    fireToolbarChanged();
  }

  public Object move(int from, int to) {
    Tool moved = contents.remove(from);
    contents.add(to, moved);
    fireToolbarChanged();
    return moved;
  }
View Full Code Here

Examples of com.cburch.logisim.tools.Tool

    for (ListIterator<Tool> it = contents.listIterator(); it.hasNext(); ) {
      Object old = it.next();
      if (toolMap.containsKey(old)) {
        changed = true;
        removeAttributeListeners((Tool) old);
        Tool newTool = toolMap.get(old);
        if (newTool == null) {
          it.remove();
        } else {
          Tool addedTool = newTool.cloneTool();
          addAttributeListeners(addedTool);
          LoadedLibrary.copyAttributes(addedTool.getAttributeSet(),
              ((Tool) old).getAttributeSet());
          it.set(addedTool);
        }
      }
    }
View Full Code Here

Examples of com.cburch.logisim.tools.Tool

  }
 
  @Override
  public boolean isSelected(ToolbarItem item) {
    if (item instanceof ToolItem) {
      Tool tool = ((ToolItem) item).tool;
      return tool == proj.getTool();
    } else {
      return false;
    }
  }
View Full Code Here

Examples of com.cburch.logisim.tools.Tool

  }

  @Override
  public void itemSelected(ToolbarItem item) {
    if (item instanceof ToolItem) {
      Tool tool = ((ToolItem) item).tool;
      proj.setTool(tool);
    }
  }
View Full Code Here

Examples of com.cburch.logisim.tools.Tool

      for (Element sub_elt : XmlIterator.forChildElements(elt, "tool")) {
        if (!sub_elt.hasAttribute("name")) {
          loader.showError(Strings.get("toolNameMissingError"));
        } else {
          String tool_str = sub_elt.getAttribute("name");
          Tool tool = ret.getTool(tool_str);
          if (tool != null) {
            try {
              initAttributeSet(sub_elt, tool.getAttributeSet(), tool);
            } catch (XmlReaderException e) {
              addErrors(e, "lib." + name + "." + tool_str);
            }
          }
        }
View Full Code Here

Examples of com.cburch.logisim.tools.Tool

    }

    private void initMouseMappings(Element elt) {
      MouseMappings map = file.getOptions().getMouseMappings();
      for (Element sub_elt : XmlIterator.forChildElements(elt, "tool")) {
        Tool tool;
        try {
          tool = toTool(sub_elt);
        } catch (XmlReaderException e) {
          addErrors(e, "mapping");
          continue;
        }

        String mods_str = sub_elt.getAttribute("map");
        if (mods_str == null || mods_str.equals("")) {
          loader.showError(Strings.get("mappingMissingError"));
          continue;
        }
        int mods;
        try {
          mods = InputEventUtil.fromString(mods_str);
        } catch (NumberFormatException e) {
          loader.showError(StringUtil.format(
            Strings.get("mappingBadError"), mods_str));
          continue;
        }

        tool = tool.cloneTool();
        try {
          initAttributeSet(sub_elt, tool.getAttributeSet(), tool);
        } catch (XmlReaderException e) {
          addErrors(e, "mapping." + tool.getName());
        }

        map.setToolFor(mods, tool);
      }
    }
View Full Code Here

Examples of com.cburch.logisim.tools.Tool

      ToolbarData toolbar = file.getOptions().getToolbarData();
      for (Element sub_elt : XmlIterator.forChildElements(elt)) {
        if (sub_elt.getTagName().equals("sep")) {
          toolbar.addSeparator();
        } else if (sub_elt.getTagName().equals("tool")) {
          Tool tool;
          try {
            tool = toTool(sub_elt);
          } catch (XmlReaderException e) {
            addErrors(e, "toolbar");
            continue;
          }
          if (tool != null) {
            tool = tool.cloneTool();
            try {
              initAttributeSet(sub_elt, tool.getAttributeSet(), tool);
            } catch (XmlReaderException e) {
              addErrors(e, "toolbar." + tool.getName());
            }
            toolbar.addTool(tool);
          }
        }
      }
View Full Code Here

Examples of com.cburch.logisim.tools.Tool

      Library lib = findLibrary(elt.getAttribute("lib"));
      String name = elt.getAttribute("name");
      if (name == null || name.equals("")) {
        throw new XmlReaderException(Strings.get("toolNameMissing"));
      }
      Tool tool = lib.getTool(name);
      if (tool == null) {
        throw new XmlReaderException(Strings.get("toolNotFound"));
      }
      return tool;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.