public static TGUndoableCloneTrack startUndo(TGContext context, TGTrack track) {
    TGUndoableCloneTrack undoable = new TGUndoableCloneTrack(context);
    undoable.doAction = UNDO_ACTION;
    undoable.trackNumber = track.getNumber();

    return undoable;
  }
  private void addSong(TGSong song) {
    int trackCount = song.countTracks();
    if (this.settings.isTrackGroupEnabled() && trackCount > 1) {
      this.writer.println("\\score {");
      if (this.settings.getTrack() == LilypondSettings.ALL_TRACKS) {
        this.writer.println(indent(1) + "<<");
      }
    }

    for (int i = 0; i < trackCount; i++) {
      TGTrack track = song.getTrack(i);
      if (this.settings.getTrack() == LilypondSettings.ALL_TRACKS
          || this.settings.getTrack() == track.getNumber()) {
        if (!this.settings.isTrackGroupEnabled() || trackCount == 1) {
          this.writer.println("\\score {");
        }
        this.writer.println(indent(1) + "\\" + this.trackID(i, "StaffGroup"));
        if (!this.settings.isTrackGroupEnabled() || trackCount == 1) {
          this.addHeader(song, track.getName(), 1);
          this.writer.println("}");
        }
      }
    }

    if (this.settings.isTrackGroupEnabled() && trackCount > 1) {
      if (this.settings.getTrack() == LilypondSettings.ALL_TRACKS) {
        this.writer.println(indent(1) + ">>");
      }
      this.addHeader(song, null, 1);
      this.writer.println("}");
    }
  }
 protected void processAction(TGActionContext context) {
   TGSong song = ((TGSong) context.getAttribute(TGDocumentContextAttributes.ATTRIBUTE_SONG));
   TGTrack track = getSongManager(context).getLastTrack(song);
   if (track != null) {
     TablatureEditor.getInstance(getContext()).getTablature().getCaret().update(track.getNumber());
   }
 }
 private void updateTrack(TGTrack track) {
   try {
     getSequencer().setMute(track.getNumber(), track.isMute());
     getSequencer().setSolo(track.getNumber(), track.isSolo());
   } catch (MidiPlayerException e) {
     e.printStackTrace();
   }
 }
 protected int execute(TypedEvent e) {
   Caret caret = getEditor().getTablature().getCaret();
   TGTrack track = getSongManager().getTrack(caret.getTrack().getNumber() + 1);
   if (track != null) {
     caret.update(track.getNumber());
   }
   return 0;
 }