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

« back to all changes in this revision

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