Search in sources :

Example 1 with ToolbarItem

use of com.cburch.draw.toolbar.ToolbarItem 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 2 with ToolbarItem

use of com.cburch.draw.toolbar.ToolbarItem in project logisim-evolution by reds-heig.

the class KeyboardToolSelection method actionPerformed.

public void actionPerformed(ActionEvent event) {
    ToolbarModel model = toolbar.getToolbarModel();
    int i = -1;
    for (ToolbarItem item : model.getItems()) {
        if (item.isSelectable()) {
            i++;
            if (i == index) {
                model.itemSelected(item);
            }
        }
    }
}
Also used : ToolbarItem(com.cburch.draw.toolbar.ToolbarItem) ToolbarModel(com.cburch.draw.toolbar.ToolbarModel)

Aggregations

ToolbarItem (com.cburch.draw.toolbar.ToolbarItem)2 ToolbarModel (com.cburch.draw.toolbar.ToolbarModel)1 ToolbarSeparator (com.cburch.draw.toolbar.ToolbarSeparator)1 ToolbarData (com.cburch.logisim.file.ToolbarData)1 Tool (com.cburch.logisim.tools.Tool)1 ArrayList (java.util.ArrayList)1