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

« back to all changes in this revision

Viewing changes to TuxGuitar/src/org/herac/tuxguitar/gui/editors/tab/layout/TrackSpacing.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.tab.layout;
 
2
 
 
3
public class TrackSpacing {
 
4
        public static final int SCORE = 0x01;
 
5
        public static final int TABLATURE = 0x02;
 
6
        
 
7
        /***     POSITIONS ARRAY INDICES     ***/
 
8
        public static final int POSITION_TOP = 0;
 
9
        public static final int POSITION_TEXT = 1;
 
10
        public static final int POSITION_BUFFER_SEPARATOR = 2;
 
11
        public static final int POSITION_REPEAT_ENDING = 3;
 
12
        public static final int POSITION_CHORD = 4;
 
13
        public static final int POSITION_SCORE_UP_LINES = 5;
 
14
        public static final int POSITION_SCORE_MIDDLE_LINES = 6;
 
15
        public static final int POSITION_SCORE_DOWN_LINES = 7;
 
16
        public static final int POSITION_TUPLETO = 8;
 
17
        public static final int POSITION_ACCENTUATED_EFFECT = 9;
 
18
        public static final int POSITION_HARMONIC_EFFEC = 10;
 
19
        public static final int POSITION_TAPPING_EFFEC = 11;
 
20
        public static final int POSITION_PALM_MUTE_EFFEC = 12;
 
21
        public static final int POSITION_VIBRATO_EFFEC = 13;
 
22
        public static final int POSITION_FADE_IN = 14;
 
23
        public static final int POSITION_TABLATURE_TOP_SEPARATOR = 15;
 
24
        public static final int POSITION_TABLATURE = 16;
 
25
        public static final int POSITION_LYRIC = 17;
 
26
        public static final int POSITION_BOTTOM = 18;
 
27
        
 
28
        private static final int[][] POSITIONS = new int[][]{
 
29
                /** SCORE **/
 
30
                new int[]{
 
31
                                0,  //POSITION_TOP
 
32
                                1,  //POSITION_TEXT
 
33
                                2,  //POSITION_BUFFER_SEPARATOR
 
34
                                3,  //POSITION_REPEAT_ENDING
 
35
                                4,  //POSITION_CHORD
 
36
                                11, //POSITION_SCORE_UP_LINES
 
37
                                12, //POSITION_SCORE_MIDDLE_LINES
 
38
                                13, //POSITION_SCORE_DOWN_LINES
 
39
                                14, //POSITION_TUPLETO
 
40
                                5,  //POSITION_ACCENTUATED_EFFECT
 
41
                                6,  //POSITION_HARMONIC_EFFEC
 
42
                                7,  //POSITION_TAPPING_EFFEC
 
43
                                8,  //POSITION_PALM_MUTE_EFFEC
 
44
                                9,  //POSITION_VIBRATO_EFFEC
 
45
                                10, //POSITION_FADE_IN
 
46
                                15, //POSITION_TABLATURE_TOP_SEPARATOR
 
47
                                16, //POSITION_TABLATURE
 
48
                                17, //POSITION_LYRIC
 
49
                                18, //POSITION_BOTTOM
 
50
                        },
 
51
                        
 
52
                /** TABLATURE **/
 
53
                new int[]{
 
54
                                0,  //POSITION_TOP
 
55
                                1,  //POSITION_TEXT
 
56
                                2,  //POSITION_BUFFER_SEPARATOR
 
57
                                3,  //POSITION_REPEAT_ENDING
 
58
                                4,  //POSITION_CHORD
 
59
                                16, //POSITION_SCORE_UP_LINES
 
60
                                17, //POSITION_SCORE_MIDDLE_LINES
 
61
                                18, //POSITION_SCORE_DOWN_LINES
 
62
                                13, //POSITION_TUPLETO
 
63
                                5,  //POSITION_ACCENTUATED_EFFECT
 
64
                                6,  //POSITION_HARMONIC_EFFEC
 
65
                                7,  //POSITION_TAPPING_EFFEC
 
66
                                8,  //POSITION_PALM_MUTE_EFFEC
 
67
                                9,  //POSITION_VIBRATO_EFFEC
 
68
                                10, //POSITION_FADE_IN
 
69
                                11, //POSITION_TABLATURE_TOP_SEPARATOR
 
70
                                12, //POSITION_TABLATURE
 
71
                                14, //POSITION_LYRIC
 
72
                                15, //POSITION_BOTTOM
 
73
                        },
 
74
                        
 
75
                /** SCORE | TABLATURE **/
 
76
                new int[]{
 
77
                                0,  //POSITION_TOP
 
78
                                1,  //POSITION_TEXT
 
79
                                2,  //POSITION_BUFFER_SEPARATOR
 
80
                                3,  //POSITION_REPEAT_ENDING
 
81
                                4,  //POSITION_CHORD
 
82
                                5,  //POSITION_SCORE_UP_LINES
 
83
                                6,  //POSITION_SCORE_MIDDLE_LINES
 
84
                                7,  //POSITION_SCORE_DOWN_LINES
 
85
                                8,  //POSITION_TUPLETO
 
86
                                9,  //POSITION_ACCENTUATED_EFFECT
 
87
                                10, //POSITION_HARMONIC_EFFEC
 
88
                                11, //POSITION_TAPPING_EFFEC
 
89
                                12, //POSITION_PALM_MUTE_EFFEC
 
90
                                13, //POSITION_VIBRATO_EFFEC
 
91
                                14, //POSITION_FADE_IN
 
92
                                15, //POSITION_TABLATURE_TOP_SEPARATOR
 
93
                                16, //POSITION_TABLATURE
 
94
                                17, //POSITION_LYRIC
 
95
                                18, //POSITION_BOTTOM
 
96
                        },
 
97
        };
 
98
        
 
99
        private int flags;
 
100
        private int[] spacing;
 
101
        
 
102
        public TrackSpacing(ViewLayout layout){
 
103
                this.flags = 0;
 
104
                this.flags |= ((layout.getStyle() & ViewLayout.DISPLAY_SCORE) != 0?SCORE:0);
 
105
                this.flags |= ((layout.getStyle() & ViewLayout.DISPLAY_TABLATURE) != 0 ?TABLATURE:0);
 
106
                this.spacing = new int[18];
 
107
        }
 
108
        
 
109
        public void setSize(int index,int size){
 
110
                this.spacing[ POSITIONS [this.flags -1] [index] ] = size;
 
111
        }
 
112
        
 
113
        public int getSize(){
 
114
                int spacing = 0;
 
115
                for(int i = 0;i < this.spacing.length; i ++){
 
116
                        spacing += this.spacing[i];
 
117
                }
 
118
                return spacing;
 
119
        }
 
120
        
 
121
        public int getPosition(int index){
 
122
                int spacing = 0;
 
123
                for(int i = 0;i < POSITIONS[this.flags -1][index]; i ++){
 
124
                        spacing += this.spacing[i];
 
125
                }
 
126
                return spacing;
 
127
        }
 
128
}
 
 
b'\\ No newline at end of file'