~ubuntu-branches/ubuntu/oneiric/tuxguitar/oneiric

« back to all changes in this revision

Viewing changes to src/org/herac/tuxguitar/gui/editors/lyric/LyricModifyListener.java

  • Committer: Bazaar Package Importer
  • Author(s): Philippe Coval
  • Date: 2008-06-19 00:30:30 UTC
  • mto: (5.1.2 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20080619003030-h719szrhsngou7c6
Tags: upstream-1.0
ImportĀ upstreamĀ versionĀ 1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package org.herac.tuxguitar.gui.editors.lyric;
2
 
 
3
 
import org.eclipse.swt.events.ModifyEvent;
4
 
import org.eclipse.swt.events.ModifyListener;
5
 
import org.eclipse.swt.widgets.Spinner;
6
 
import org.eclipse.swt.widgets.Text;
7
 
import org.herac.tuxguitar.gui.TuxGuitar;
8
 
import org.herac.tuxguitar.gui.helper.SyncThread;
9
 
 
10
 
public class LyricModifyListener implements ModifyListener,Runnable{
11
 
 
12
 
        private LyricEditor editor;
13
 
        
14
 
        public LyricModifyListener(LyricEditor editor){
15
 
                this.editor = editor;
16
 
        }
17
 
        
18
 
        public void modifyText(ModifyEvent e) {
19
 
                if(e.widget instanceof Text){           
20
 
                        this.editor.getTrack().getLyrics().setLyrics(((Text)e.widget).getText());
21
 
                }else if(e.widget instanceof Spinner){
22
 
                        this.editor.getTrack().getLyrics().setFrom(((Spinner)e.widget).getSelection());
23
 
                }
24
 
                
25
 
                if(!TuxGuitar.isDisposed()){
26
 
                        new SyncThread(this).start();           
27
 
                }
28
 
        }
29
 
 
30
 
        public void run() {             
31
 
                TuxGuitar.instance().getTablatureEditor().getTablature().getViewLayout().updateLyrics();
32
 
                TuxGuitar.instance().redraw();  
33
 
        }
34
 
        
35
 
}