Package com.cburch.logisim.tools

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


            for (Element sub_elt : XmlIterator.forChildElements(elt, "tool")) {
                if (!sub_elt.hasAttribute("name")) {
                    loader.showError(getFromLocale("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

        }

        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(getFromLocale("mappingMissingError"));
                    continue;
                }
                int mods;
                try {
                    mods = InputEventUtil.fromString(mods_str);
                } catch (NumberFormatException e) {
                    loader.showError(getFromLocale("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

            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

            Library lib = findLibrary(elt.getAttribute("lib"));
            String name = elt.getAttribute("name");
            if (name == null || name.equals("")) {
                throw new XmlReaderException(getFromLocale("toolNameMissing"));
            }
            Tool tool = lib.getTool(name);
            if (tool == null) {
                throw new XmlReaderException(getFromLocale("toolNotFound"));
            }
            return tool;
        }
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;
            }

        }
View Full Code Here

        @Override
        public void mouseExited(MouseEvent e) { }
        @Override
        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

        //
        @Override
        public void selectionChanged(ProjectExplorerEvent event) {
            Object target = event.getTarget();
            if (target instanceof ProjectExplorerToolNode) {
                Tool tool = ((ProjectExplorerToolNode) target).getValue();
                setCurrentTool(tool);
            } else {
                setCurrentTool(null);
            }
        }
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.