Package com.cburch.logisim.gui.main

Examples of com.cburch.logisim.gui.main.Selection$MyListener


            clearCanvasMessage(canvas, dx, dy);
            repl = result.getReplacementMap();
          } else {
            repl = null;
          }
          Selection sel = proj.getSelection();
          proj.doAction(SelectionActions.translate(sel, dx, dy, repl));
        }
      }
      moveGesture = null;
      proj.repaintCanvas();
    } else if (state == RECT_SELECT) {
      Bounds bds = Bounds.create(start).add(start.getX() + curDx,
        start.getY() + curDy);
      Circuit circuit = canvas.getCircuit();
      Selection sel = proj.getSelection();
      Collection<Component> in_sel = sel.getComponentsWithin(bds, g);
      for (Component comp : circuit.getAllWithin(bds, g)) {
        if (!in_sel.contains(comp)) sel.add(comp);
      }
      Action act = SelectionActions.drop(sel, in_sel);
      if (act != null) {
        proj.doAction(act);
      }
View Full Code Here


 
  private void processKeyEvent(Canvas canvas, KeyEvent e, int type) {
    HashMap<Component, KeyConfigurator> handlers = keyHandlers;
    if (handlers == null) {
      handlers = new HashMap<Component, KeyConfigurator>();
      Selection sel = canvas.getSelection();
      for (Component comp : sel.getComponents()) {
        ComponentFactory factory = comp.getFactory();
        AttributeSet attrs = comp.getAttributeSet();
        Object handler = factory.getFeature(KeyConfigurator.class, attrs);
        if (handler != null) {
          KeyConfigurator base = (KeyConfigurator) handler;
View Full Code Here

    } else {
      dx = Math.max(e.getX() - start.getX(), -bds.getX());
      dy = Math.max(e.getY() - start.getY(), -bds.getY());
    }

    Selection sel = proj.getSelection();
    if (sel.shouldSnap()) {
      dx = Canvas.snapXToGrid(dx);
      dy = Canvas.snapYToGrid(dy);
    }
    curDx = dx;
    curDy = dy;
View Full Code Here

            if (canvas != null) {
                if (tool != null) {
                    tool.deselect(canvas);
                }

                Selection selection = canvas.getSelection();
                if (selection != null) {
                    Action act = SelectionActions.dropAll(selection);
                    if (act != null) {
                        doAction(act);
                    }
View Full Code Here

        Canvas canvas = frame.getCanvas();
        if (old != null) {
            old.deselect(canvas);
        }

        Selection selection = canvas.getSelection();
        if (selection != null && !selection.isEmpty()) {
            if (value == null || !getOptions().getMouseMappings().containsSelectTool()) {
                Action act = SelectionActions.anchorAll(selection);
                if (act != null) {
                    doAction(act);
                }
View Full Code Here

        Location oldWireLoc = wireLoc;
        wireLoc = NULL_LOCATION;
        lastX = Integer.MIN_VALUE;
        if (wire) {
            current = wiring;
            Selection sel = canvas.getSelection();
            Circuit circ = canvas.getCircuit();
            Collection<Component> selected = sel.getAnchoredComponents();
            ArrayList<Component> suppress = null;
            for (Wire w : circ.getWires()) {
                if (selected.contains(w)) {
                    if (w.contains(oldWireLoc)) {
                        if (suppress == null) {
                            suppress = new ArrayList<Component>();
                        }

                        suppress.add(w);
                    }
                }
            }
            sel.setSuppressHandles(suppress);
        } else {
            current = select;
        }
        pressX = e.getX();
        pressY = e.getY();
View Full Code Here

    }

    private void attemptReface(Canvas canvas, final Direction facing, KeyEvent e) {
        if (e.getModifiersEx() == 0) {
            final Circuit circuit = canvas.getCircuit();
            final Selection sel = canvas.getSelection();
            SetAttributeAction act = new SetAttributeAction(circuit,
                    getFromLocale("selectionRefaceAction"));
            for (Component comp : sel.getComponents()) {
                if (!(comp instanceof Wire)) {
                    Attribute<Direction> attr = getFacingAttribute(comp);
                    if (attr != null) {
                        act.set(comp, attr, facing);
                    }
View Full Code Here

        ComponentFactory factory = null;
        int factoryCount = 0;
        int totalCount = 0;
        boolean variousFound = false;

        Selection selection = frame.getCanvas().getSelection();
        for (Component comp : selection.getComponents()) {
            ComponentFactory fact = comp.getFactory();
            if (fact.equals(factory)) {
                factoryCount++;
            } else if (comp instanceof Wire) {
                wireFactory = fact;
View Full Code Here

    }

    @Override
    public void setValueRequested(Attribute<Object> attr, Object value)
            throws AttrTableSetException {
        Selection selection = frame.getCanvas().getSelection();
        Circuit circuit = frame.getCanvas().getCircuit();
        if (selection.isEmpty() && circuit != null) {
            AttrTableCircuitModel circuitModel = new AttrTableCircuitModel(project, circuit);
            circuitModel.setValueRequested(attr, value);
        } else {
            SetAttributeAction act = new SetAttributeAction(circuit,
                    getFromLocale("selectionAttributeAction"));
            for (Component comp : selection.getComponents()) {
                if (!(comp instanceof Wire)) {
                    act.set(comp, attr, value);
                }
            }
            project.doAction(act);
View Full Code Here

        int y = e.getY();
        Location pt = Location.create(x, y);

        JPopupMenu menu;
        Project proj = canvas.getProject();
        Selection sel = proj.getSelection();
        Collection<Component> in_sel = sel.getComponentsContaining(pt, g);
        if (!in_sel.isEmpty()) {
            Component comp = in_sel.iterator().next();
            if (sel.getComponents().size() > 1) {
                menu = new MenuSelection(proj);
            } else {
                menu = new MenuComponent(proj,
                    canvas.getCircuit(), comp);
                MenuExtender extender = (MenuExtender) comp.getFeature(MenuExtender.class);
View Full Code Here

TOP

Related Classes of com.cburch.logisim.gui.main.Selection$MyListener

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.