Package com.cburch.logisim.proj

Examples of com.cburch.logisim.proj.Action


        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

            } 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

            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

            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

            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

class MenuEdit extends Menu {
    private class MyListener implements ProjectListener, ActionListener {
        @Override
        public void projectChanged(ProjectEvent e) {
            Project proj = menubar.getProject();
            Action last = proj == null ? null : proj.getLastAction();
      if( last == null )
      {
        undo.setText( getFromLocale( "editCantUndoItem" ) );
        undo.setEnabled( false );
      }
      else
      {
        undo.setText( getFromLocale( "editUndoItem", last.getName() ) );
        undo.setEnabled( true );
            }

      // If there is a project open...
      if( proj != null )
        // And you CAN redo an undo...
        if( proj.getCanRedo() )
        {
          // Get that action
          Action lastRedo = proj.getLastRedoAction();

          // Set the detailed, localized text

          redo.setText( getFromLocale( "editRedoItem", lastRedo.getName() ) );
         
          // Set it to enabled
          redo.setEnabled( true );
        }
        else
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.