Package com.cburch.logisim.proj

Examples of com.cburch.logisim.proj.Action


      xnReverse.execute();
    }

    @Override
    public boolean shouldAppendTo(Action other) {
      Action last;
      if (other instanceof JoinedAction) last = ((JoinedAction) other).getLastAction();
      else last = other;
     
      SelectionSave otherAfter = null;
      if (last instanceof Paste) {
View Full Code Here


      if ((e.getModifiers() & InputEvent.SHIFT_MASK) == 0) {
        setState(proj, MOVING);
        proj.repaintCanvas();
        return;
      } else {
        Action act = SelectionActions.drop(sel, in_sel);
        if (act != null) {
          proj.doAction(act);
        }
      }
    }

    // if the user clicks into a component outside selection, user
    // wants to add/reset selection
    Collection<Component> clicked = circuit.getAllContaining(start, g);
    if (!clicked.isEmpty()) {
      if ((e.getModifiers() & InputEvent.SHIFT_MASK) == 0) {
        if (sel.getComponentsContaining(start).isEmpty()) {
          Action act = SelectionActions.dropAll(sel);
          if (act != null) {
            proj.doAction(act);
          }
        }
      }
      for (Component comp : clicked) {
        if (!in_sel.contains(comp)) {
          sel.add(comp);
        }
      }
      setState(proj, MOVING);
      proj.repaintCanvas();
      return;
    }

    // The user clicked on the background. This is a rectangular
    // selection (maybe with the shift key down).
    if ((e.getModifiers() & InputEvent.SHIFT_MASK) == 0) {
      Action act = SelectionActions.dropAll(sel);
      if (act != null) {
        proj.doAction(act);
      }
    }
    setState(proj, RECT_SELECT);
View Full Code Here

      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);
      }
      setState(proj, IDLE);
      proj.repaintCanvas();
View Full Code Here

    } else {
      switch (e.getKeyCode()) {
      case KeyEvent.VK_BACK_SPACE:
      case KeyEvent.VK_DELETE:
        if (!canvas.getSelection().isEmpty()) {
          Action act = SelectionActions.clear(canvas.getSelection());
          canvas.getProject().doAction(act);
          e.consume();
        }
        break;
      default:
View Full Code Here

            xnReverse.execute();
        }

        @Override
        public boolean shouldAppendTo(Action other) {
            Action last;
            if (other instanceof JoinedAction) last = ((JoinedAction) other).getLastAction();
            else {
                last = other;
            }
View Full Code Here

            xnReverse.execute();
        }

        @Override
        public boolean shouldAppendTo(Action other) {
            Action last;
            if (other instanceof JoinedAction) last = ((JoinedAction) other).getLastAction();
            else {
                last = other;
            }
View Full Code Here

    @Override
    public void paste() {
        Project proj = frame.getProject();
        Selection sel = frame.getCanvas().getSelection();
        selectSelectTool(proj);
        Action action = SelectionActions.pasteMaybe(proj, sel);
        if (action != null) {
            proj.doAction(action);
        }
    }
View Full Code Here

                else {
                    desc = getFromLocale("addWiresAction");
                }

                Action act = mutation.toAction(desc);
                canvas.getProject().doAction(act);
                lastAction = act;
            }
        }
    }
View Full Code Here

    public void keyPressed(Canvas canvas, KeyEvent e) {
        switch (e.getKeyCode()) {
        case KeyEvent.VK_BACK_SPACE:
        case KeyEvent.VK_DELETE:
            if (!canvas.getSelection().isEmpty()) {
                Action act = SelectionActions.clear(canvas.getSelection());
                canvas.getProject().doAction(act);
                e.consume();
            } else {
                wiring.keyPressed(canvas, e);
            }
            break;
        case KeyEvent.VK_INSERT:
            Action act = SelectionActions.duplicate(canvas.getSelection());
            canvas.getProject().doAction(act);
            e.consume();
            break;
        case KeyEvent.VK_UP:
            if (e.getModifiersEx() == 0) {
View Full Code Here

            }

            try {
                CircuitMutation mutation = new CircuitMutation(circ);
                mutation.add(c);
                Action action = mutation.toAction(getFromLocale("addComponentAction", factory.getDisplayGetter()));
                canvas.getProject().doAction(action);
                lastAddition = action;
                added = c;
            } catch (CircuitException ex) {
                JOptionPane.showMessageDialog(canvas.getProject().getFrame(),
                    ex.getMessage());
            }
            setState(canvas, SHOW_GHOST);
        } else if (state == SHOW_ADD_NO) {
            setState(canvas, SHOW_NONE);
        }

        Project proj = canvas.getProject();
        Tool next = determineNext(proj);
        if (next != null) {
            proj.setTool(next);
            Action act = SelectionActions.dropAll(canvas.getSelection());
            if (act != null) {
                proj.doAction(act);
            }
            if (added != null) {
                canvas.getSelection().add(added);
View Full Code Here

TOP

Related Classes of com.cburch.logisim.proj.Action

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.