Package com.cburch.logisim.proj

Examples of com.cburch.logisim.proj.Action


      caret.removeCaretListener(this);
      caretCircuit.removeCircuitListener(this);
     
      String val = caret.getText();
      boolean isEmpty = (val == null || val.equals(""));
      Action a;
      Project proj = caretCanvas.getProject();
      if (caretCreatingText) {
        if (!isEmpty) {
          CircuitMutation xn = new CircuitMutation(caretCircuit);
          xn.add(caretComponent);
View Full Code Here


      } else if (type == ProjectEvent.ACTION_MERGE) {
        SelectionSave save = savedSelections.get(event.getOldData());
        savedSelections.put((Action) event.getData(), save);
      } else if (type == ProjectEvent.UNDO_COMPLETE) {
        Circuit circ = event.getProject().getCurrentCircuit();
        Action act = (Action) event.getData();
        SelectionSave save = savedSelections.get(act);
        if (save != null) {
          lifted.clear();
          selected.clear();
          for (int i = 0; i < 2; i++) {
View Full Code Here

      }

      try {
        CircuitMutation mutation = new CircuitMutation(circ);
        mutation.add(c);
        Action action = mutation.toAction(Strings.getter("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

    if (handler != null) {
      AttributeSet baseAttrs = getBaseAttributes();
      KeyConfigurationEvent e = new KeyConfigurationEvent(type, baseAttrs, event, this);
      KeyConfigurationResult r = handler.keyEventReceived(e);
      if (r != null) {
        Action act = ToolAttributeAction.create(r);
        canvas.getProject().doAction(act);
      }
    }
  }
View Full Code Here

    AttributeSet base = getBaseAttributes();
    Object feature = source.getFeature(ComponentFactory.FACING_ATTRIBUTE_KEY, base);
    @SuppressWarnings("unchecked")
    Attribute<Direction> attr = (Attribute<Direction>) feature;
    if (attr != null) {
      Action act = ToolAttributeAction.create(this, attr, facing);
      canvas.getProject().doAction(act);
    }
  }
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

      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

        CircuitMutation mutation = new CircuitMutation(canvas.getCircuit());
        mutation.addAll(ws);
        StringGetter desc;
        if (ws.size() == 1) desc = Strings.getter("addWireAction");
        else desc = Strings.getter("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) attemptReface(canvas, Direction.NORTH, e);
View Full Code Here

class MenuEdit extends Menu {
  private class MyListener implements ProjectListener, ActionListener {
    public void projectChanged(ProjectEvent e) {
      Project proj = menubar.getProject();
      Action last = proj == null ? null : proj.getLastAction();
      if (last == null) {
        undo.setText(Strings.get("editCantUndoItem"));
        undo.setEnabled(false);
      } else {
        undo.setText(StringUtil.format(Strings.get("editUndoItem"),
          last.getName()));
        undo.setEnabled(true);
      }
    }
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.