Package com.cburch.logisim.tools

Examples of com.cburch.logisim.tools.Tool


        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


    @Override
    public void selectionChanged(ProjectExplorerEvent event) {
        Object selected = event.getTarget();
        if (selected instanceof ProjectExplorerToolNode) {
            Tool tool = ((ProjectExplorerToolNode) selected).getValue();
            if (tool instanceof AddTool) {
                AddTool addTool = (AddTool) tool;
                ComponentFactory source = addTool.getFactory();
                if (source instanceof SubcircuitFactory) {
                    SubcircuitFactory circFact = (SubcircuitFactory) source;
View Full Code Here

    @Override
    public void doubleClicked(ProjectExplorerEvent event) {
        Object clicked = event.getTarget();
        if (clicked instanceof ProjectExplorerToolNode) {
            Tool baseTool = ((ProjectExplorerToolNode) clicked).getValue();
            if (baseTool instanceof AddTool) {
                AddTool tool = (AddTool) baseTool;
                ComponentFactory source = tool.getFactory();
                if (source instanceof SubcircuitFactory) {
                    SubcircuitFactory circFact = (SubcircuitFactory) source;
View Full Code Here

        Object request = event.getTarget();
        if (request instanceof ProjectExplorerLibraryNode) {
            Library lib = ((ProjectExplorerLibraryNode) request).getValue();
            ProjectLibraryActions.doUnloadLibrary(proj, lib);
        } else if (request instanceof ProjectExplorerToolNode) {
            Tool tool = ((ProjectExplorerToolNode) request).getValue();
            if (tool instanceof AddTool) {
                ComponentFactory factory = ((AddTool) tool).getFactory();
                if (factory instanceof SubcircuitFactory) {
                    SubcircuitFactory circFact = (SubcircuitFactory) factory;
                    ProjectCircuitActions.doRemoveCircuit(proj, circFact.getSubcircuit());
View Full Code Here

    @Override
    public JPopupMenu menuRequested(ProjectExplorerEvent event) {
        Object clicked = event.getTarget();
        if (clicked instanceof ProjectExplorerToolNode) {
            Tool baseTool = ((ProjectExplorerToolNode) clicked).getValue();
            if (baseTool instanceof AddTool) {
                AddTool tool = (AddTool) baseTool;
                ComponentFactory source = tool.getFactory();
                if (source instanceof SubcircuitFactory) {
                    Circuit circ = ((SubcircuitFactory) source).getSubcircuit();
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);
                }

            }
View Full Code Here

    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

        }

        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

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.