Package com.cburch.logisim.tools

Examples of com.cburch.logisim.tools.Tool


    setCircuitState(circState);
  }

  public void setTool(Tool value) {
    if (tool == value) return;
    Tool old = tool;
    Canvas canvas = frame.getCanvas();
    if (old != null) old.deselect(canvas);
    Selection selection = canvas.getSelection();
    if (selection != null && !selection.isEmpty()) {
      Circuit circuit = canvas.getCircuit();
      CircuitMutation xn = new CircuitMutation(circuit);
      if (value == null) {
View Full Code Here


    public Component getListCellRendererComponent(JList list, Object value,
        int index, boolean isSelected, boolean cellHasFocus) {
      Component ret;
      Icon icon;
      if (value instanceof Tool) {
        Tool t = (Tool) value;
        ret = super.getListCellRendererComponent(list, t.getDisplayName(),
            index, isSelected, cellHasFocus);
        icon = new ToolIcon(t);
      } else if (value == null) {
        ret = super.getListCellRendererComponent(list, "---",
            index, isSelected, cellHasFocus);
View Full Code Here

      } else if (action == LibraryEvent.REMOVE_LIBRARY) {
        if (event.getSource() == curFile) {
          removeLibrary((Library) event.getData());
        }
      } else if (action == LibraryEvent.ADD_TOOL) {
        Tool tool = (Tool) event.getData();
        AttributeSet attrs = tool.getAttributeSet();
        if (attrs != null) attrs.addAttributeListener(this);
      } else if (action == LibraryEvent.REMOVE_TOOL) {
        Tool tool = (Tool) event.getData();
        AttributeSet attrs = tool.getAttributeSet();
        if (attrs != null) attrs.removeAttributeListener(this);
      }
      explorer.repaint();
    }
View Full Code Here

      if (ret instanceof JComponent) {
        JComponent comp = (JComponent) ret;
        comp.setToolTipText(null);
      }
      if (value instanceof Tool) {
        Tool tool = (Tool) value;
        if (ret instanceof JLabel) {
          ((JLabel) ret).setText(tool.getDisplayName());
          ((JLabel) ret).setIcon(new ToolIcon(tool));
          ((JLabel) ret).setToolTipText(tool.getDescription());
        }
      } else if (value instanceof Library) {
        if (ret instanceof JLabel) {
          Library lib = (Library) value;
          String text = lib.getDisplayName();
View Full Code Here

        }

        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

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

        Tool tool = lib.getTool(name);
        if (tool == null || !(tool instanceof AddTool)) {
            if (libName == null || libName.equals("")) {
                throw new XmlReaderException(getFromLocale("compUnknownError", name));
            } else {
                throw new XmlReaderException(getFromLocale("compAbsentError", name, libName));
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

                // for startup
                if (attrTable == null) {
                    return;
                }

                Tool oldTool = (Tool) event.getOldData();
                Tool newTool = (Tool) event.getData();
                if (getEditorView().equals(EDIT_LAYOUT)) {
                    viewAttributes(oldTool, newTool, false);
                }
            }
        }
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.