1
package org.herac.tuxguitar.gui.editors.tab;
3
import org.eclipse.swt.graphics.GC;
4
import org.herac.tuxguitar.gui.editors.tab.layout.TrackSpacing;
5
import org.herac.tuxguitar.gui.editors.tab.layout.ViewLayout;
7
public class LyricPainter {
8
private SongTrackCoords trackCoords;
9
private String[] lyricBeats;
14
public LyricPainter(SongTrackCoords trackCoords){
15
this.trackCoords = trackCoords;
20
this.lyricBeats = trackCoords.getTrack().getLyrics().getLyricBeats();
21
this.from = trackCoords.getTrack().getLyrics().getFrom();
23
if(this.lyricBeats != null && this.lyricBeats.length > 0){
32
public void start(int index){
33
this.nextIndex = index;
37
public void setCurrentMeasure(MeasureCoords measure){
38
if(measure.getMeasure().getNumber() >= from){
39
measure.setLyricBeatIndex(nextIndex);
40
this.nextIndex += measure.getBeatPositions().size();
42
measure.setLyricBeatIndex(-1);
47
public void paintCurrentNoteBeats(GC gc,ViewLayout layout,MeasureCoords currentMeasure ,int fromX,int fromY){
48
int beatIndex = currentMeasure.getLyricBeatIndex();
49
if(this.lyricBeats != null && beatIndex >= 0 && beatIndex < this.lyricBeats.length){
50
for(int i = 0;i < currentMeasure.getBeatPositions().size();i ++){
51
MeasureCoords.BeatPosition noteBeat = (MeasureCoords.BeatPosition)currentMeasure.getBeatPositions().get(i);
53
if((beatIndex + i) < this.lyricBeats.length){
54
String str = lyricBeats[beatIndex + i];
55
if(str.trim().length() > 0){
56
int x = fromX + noteBeat.getPosX();
58
layout.setLyricStyle(gc);
59
if(layout.isPlayModeEnabled() && noteBeat.isPlayingBeat()){
60
layout.setPlayNoteColor(gc);
63
gc.drawString(str,x + 13,(fromY + currentMeasure.getTs().getPosition(TrackSpacing.POSITION_LYRIC)));
64
layout.setTabNoteColor(gc);
71
public int getHeight(){