コード例 #1
0
  protected int execute(TypedEvent e) {
    Caret caret = getEditor().getTablature().getCaret();
    if (caret.getSelectedNote() != null) {
      // comienza el undoable
      UndoableMeasureGeneric undoable = UndoableMeasureGeneric.startUndo();

      getSongManager().getMeasureManager().changeTieNote(caret.getSelectedNote());

      // termia el undoable
      addUndoableEdit(undoable.endUndo());
    } else {
      TGNote note = getSongManager().getFactory().newNote();
      note.setValue(0);
      note.setVelocity(caret.getVelocity());
      note.setString(caret.getSelectedString().getNumber());
      note.setTiedNote(true);

      TGDuration duration = getSongManager().getFactory().newDuration();
      caret.getDuration().copy(duration);

      setTiedNoteValue(note, caret);

      // comienza el undoable
      UndoableMeasureGeneric undoable = UndoableMeasureGeneric.startUndo();

      getSongManager()
          .getMeasureManager()
          .addNote(caret.getSelectedBeat(), note, duration, caret.getVoice());

      // termia el undoable
      addUndoableEdit(undoable.endUndo());
    }
    TuxGuitar.instance().getFileHistory().setUnsavedFile();
    updateTablature();
    return 0;
  }