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

« back to all changes in this revision

Viewing changes to src/org/herac/tuxguitar/gui/editors/FretBoardEditor.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;
2
 
 
3
 
import org.eclipse.swt.layout.FormAttachment;
4
 
import org.eclipse.swt.layout.FormData;
5
 
import org.eclipse.swt.widgets.Composite;
6
 
import org.herac.tuxguitar.gui.TuxGuitar;
7
 
import org.herac.tuxguitar.gui.editors.fretboard.FretBoard;
8
 
 
9
 
public class FretBoardEditor {
10
 
        private TablatureEditor tablatureEditor;
11
 
        private FretBoard fretBoard;
12
 
        private boolean visible;
13
 
        
14
 
        public FretBoardEditor(TablatureEditor tablatureEditor){
15
 
                this.tablatureEditor = tablatureEditor;
16
 
        }    
17
 
    
18
 
    private FretBoard getFretBoard(){
19
 
        return this.fretBoard;
20
 
    }
21
 
        
22
 
        public void hideFretBoard(){
23
 
                this.visible = false;
24
 
                getFretBoard().setVisible(this.visible);         
25
 
                TuxGuitar.instance().updateShellFooter(0,0,0);
26
 
        }               
27
 
        
28
 
        public void showFretBoard(){            
29
 
                this.visible = true;
30
 
                getFretBoard().setVisible(this.visible);
31
 
                TuxGuitar.instance().updateShellFooter(getFretBoard().getHeight(), 730,520);            
32
 
        }
33
 
                        
34
 
    public void showFretBoard(Composite parent) {
35
 
        FormData data = new FormData();
36
 
                data.left = new FormAttachment(0, 0);
37
 
                data.right = new FormAttachment(100, 0);
38
 
                data.top = new FormAttachment(0,0);
39
 
                data.bottom = new FormAttachment(100,0);
40
 
        
41
 
        this.fretBoard = new FretBoard(parent,this.tablatureEditor);            
42
 
        this.fretBoard.setLayoutData(data);
43
 
    }   
44
 
        
45
 
        public void setScaleChanges(){
46
 
                if(isVisible()){
47
 
                        getFretBoard().setChanges(true);
48
 
                }
49
 
        }
50
 
    
51
 
        public void dispose(){
52
 
                if(getFretBoard() != null && !getFretBoard().isDisposed()){
53
 
                        getFretBoard().dispose();
54
 
                }
55
 
        }
56
 
        
57
 
        public void redraw(){
58
 
                if(getFretBoard() != null && !getFretBoard().isDisposed()){
59
 
                        getFretBoard().redraw();
60
 
                }
61
 
        }
62
 
        
63
 
        public void redrawPlayingMode(){
64
 
                if(getFretBoard() != null && !getFretBoard().isDisposed()){
65
 
                        getFretBoard().redrawPlayingMode();
66
 
                }
67
 
        }
68
 
        
69
 
        public boolean isVisible(){
70
 
                return (getFretBoard() != null && !getFretBoard().isDisposed() && this.visible);
71
 
        }
72
 
        
73
 
        public void loadProperties(){
74
 
                if(getFretBoard() != null && !getFretBoard().isDisposed()){
75
 
                        getFretBoard().loadProperties();
76
 
                }
77
 
        }
78
 
 
79
 
}