1
package org.herac.tuxguitar.gui.editors.tab;
3
import org.herac.tuxguitar.gui.editors.TGPainter;
4
import org.herac.tuxguitar.gui.editors.tab.layout.TrackSpacing;
5
import org.herac.tuxguitar.gui.editors.tab.layout.ViewLayout;
6
import org.herac.tuxguitar.song.models.TGLyric;
8
public class TGLyricImpl extends TGLyric{
11
private int nextIndex = 0;
17
public void setFrom(int from) {
22
public void setLyrics(String lyrics) {
23
super.setLyrics(lyrics);
27
private void update(){
28
this.height = (this.isEmpty()?0:10);
35
public void start(int index){
36
this.nextIndex = index;
39
public void setCurrentMeasure(TGMeasureImpl measure){
40
if(measure.getNumber() >= getFrom()){
41
measure.setLyricBeatIndex(this.nextIndex);
42
this.nextIndex += (measure.getNotEmptyBeats());
44
measure.setLyricBeatIndex(-1);
49
public void paintCurrentNoteBeats(TGPainter painter,ViewLayout layout,TGMeasureImpl currentMeasure ,int fromX,int fromY){
50
int from = currentMeasure.getLyricBeatIndex();
51
String[] beats = getLyricBeats();
52
if(beats != null && from >= 0 && from < beats.length){
54
for(int i = 0;i < currentMeasure.countBeats();i ++){
55
TGBeatImpl beat = (TGBeatImpl)currentMeasure.getBeat(i);
56
if(!beat.isRestBeat()){
57
if((from + beatIndex) < beats.length){
58
String str = beats[from + beatIndex].trim();
60
int x = (fromX + beat.getPosX() + beat.getSpacing() + 2);
61
layout.setLyricStyle(painter,(layout.isPlayModeEnabled() && beat.isPlaying(layout)));
62
painter.drawString(str,x + 13,(fromY + currentMeasure.getTs().getPosition(TrackSpacing.POSITION_LYRIC)));
71
public int getHeight(){