Search in sources :

Example 1 with Tool

use of com.cburch.logisim.tools.Tool in project logisim-evolution by reds-heig.

the class Frame method setAttrTableModel.

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);
    }
    if (value instanceof AttrTableComponentModel) {
        Circuit circ = ((AttrTableComponentModel) value).getCircuit();
        Component comp = ((AttrTableComponentModel) value).getComponent();
        layoutCanvas.setHaloedComponent(circ, comp);
    } else {
        layoutCanvas.setHaloedComponent(null, null);
    }
}
Also used : Circuit(com.cburch.logisim.circuit.Circuit) Component(com.cburch.logisim.comp.Component) Tool(com.cburch.logisim.tools.Tool)

Example 2 with Tool

use of com.cburch.logisim.tools.Tool in project logisim-evolution by reds-heig.

the class LayoutEditHandler method selectSelectTool.

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);
        }
    }
}
Also used : Library(com.cburch.logisim.tools.Library) Base(com.cburch.logisim.std.base.Base) Tool(com.cburch.logisim.tools.Tool)

Example 3 with Tool

use of com.cburch.logisim.tools.Tool in project logisim-evolution by reds-heig.

the class LayoutToolbarModel method buildContents.

private void buildContents() {
    List<ToolbarItem> oldItems = items;
    List<ToolbarItem> newItems = new ArrayList<ToolbarItem>();
    ToolbarData data = proj.getLogisimFile().getOptions().getToolbarData();
    for (Tool tool : data.getContents()) {
        if (tool == null) {
            newItems.add(new ToolbarSeparator(4));
        } else {
            ToolbarItem i = findItem(oldItems, tool);
            if (i == null) {
                newItems.add(new ToolItem(tool));
            } else {
                newItems.add(i);
            }
        }
    }
    items = Collections.unmodifiableList(newItems);
    fireToolbarContentsChanged();
}
Also used : ToolbarItem(com.cburch.draw.toolbar.ToolbarItem) ToolbarSeparator(com.cburch.draw.toolbar.ToolbarSeparator) ArrayList(java.util.ArrayList) ToolbarData(com.cburch.logisim.file.ToolbarData) Tool(com.cburch.logisim.tools.Tool)

Example 4 with Tool

use of com.cburch.logisim.tools.Tool in project logisim-evolution by reds-heig.

the class Wiring method getTools.

@Override
public List<Tool> getTools() {
    if (tools == null) {
        List<Tool> ret = new ArrayList<Tool>(ADD_TOOLS.length + DESCRIPTIONS.length);
        for (Tool a : ADD_TOOLS) {
            ret.add(a);
        }
        ret.addAll(FactoryDescription.getTools(Wiring.class, DESCRIPTIONS));
        tools = ret;
    }
    return tools;
}
Also used : ArrayList(java.util.ArrayList) Tool(com.cburch.logisim.tools.Tool) AddTool(com.cburch.logisim.tools.AddTool)

Example 5 with Tool

use of com.cburch.logisim.tools.Tool in project logisim-evolution by reds-heig.

the class LogisimFile method getUnloadLibraryMessage.

public String getUnloadLibraryMessage(Library lib) {
    HashSet<ComponentFactory> factories = new HashSet<ComponentFactory>();
    for (Tool tool : lib.getTools()) {
        if (tool instanceof AddTool) {
            factories.add(((AddTool) tool).getFactory());
        }
    }
    for (Circuit circuit : getCircuits()) {
        for (Component comp : circuit.getNonWires()) {
            if (factories.contains(comp.getFactory())) {
                return StringUtil.format(Strings.get("unloadUsedError"), circuit.getName());
            }
        }
    }
    ToolbarData tb = options.getToolbarData();
    MouseMappings mm = options.getMouseMappings();
    for (Tool t : lib.getTools()) {
        if (tb.usesToolFromSource(t)) {
            return Strings.get("unloadToolbarError");
        }
        if (mm.usesToolFromSource(t)) {
            return Strings.get("unloadMappingError");
        }
    }
    return null;
}
Also used : ComponentFactory(com.cburch.logisim.comp.ComponentFactory) Circuit(com.cburch.logisim.circuit.Circuit) AddTool(com.cburch.logisim.tools.AddTool) Component(com.cburch.logisim.comp.Component) HashSet(java.util.HashSet) Tool(com.cburch.logisim.tools.Tool) AddTool(com.cburch.logisim.tools.AddTool)

Aggregations

Tool (com.cburch.logisim.tools.Tool)28 AddTool (com.cburch.logisim.tools.AddTool)16 ComponentFactory (com.cburch.logisim.comp.ComponentFactory)9 Library (com.cburch.logisim.tools.Library)7 Circuit (com.cburch.logisim.circuit.Circuit)6 SubcircuitFactory (com.cburch.logisim.circuit.SubcircuitFactory)6 ProjectExplorerToolNode (com.cburch.logisim.gui.generic.ProjectExplorerToolNode)4 SelectTool (com.cburch.logisim.tools.SelectTool)4 Component (com.cburch.logisim.comp.Component)3 ArrayList (java.util.ArrayList)3 Element (org.w3c.dom.Element)3 AttributeSet (com.cburch.logisim.data.AttributeSet)2 ProjectExplorerLibraryNode (com.cburch.logisim.gui.generic.ProjectExplorerLibraryNode)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 ToolbarItem (com.cburch.draw.toolbar.ToolbarItem)1 ToolbarSeparator (com.cburch.draw.toolbar.ToolbarSeparator)1 CircuitState (com.cburch.logisim.circuit.CircuitState)1 ComponentDrawContext (com.cburch.logisim.comp.ComponentDrawContext)1