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

« back to all changes in this revision

Viewing changes to src/org/herac/tuxguitar/gui/actions/mouse/SelectComponentAction.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
 
/*
2
 
 * Created on 17-dic-2005
3
 
 *
4
 
 * TODO To change the template for this generated file go to
5
 
 * Window - Preferences - Java - Code Style - Code Templates
6
 
 */
7
 
package org.herac.tuxguitar.gui.actions.mouse;
8
 
 
9
 
import org.eclipse.swt.events.TypedEvent;
10
 
import org.herac.tuxguitar.gui.actions.Action;
11
 
import org.herac.tuxguitar.gui.editors.TablatureEditor;
12
 
 
13
 
/**
14
 
 * @author julian
15
 
 * 
16
 
 * TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates
17
 
 * @deprecated
18
 
 */
19
 
public class SelectComponentAction extends Action {
20
 
    public static final String NAME = "SELECT_COMPONENT";
21
 
 
22
 
    public SelectComponentAction(TablatureEditor tablatureEditor) {
23
 
        super(NAME, tablatureEditor);
24
 
    }
25
 
 
26
 
    public boolean doAction(TypedEvent e) {
27
 
        /*
28
 
        int x = -1;
29
 
        int y = -1;
30
 
        if (e instanceof MouseEvent) {
31
 
            MouseEvent mouseEvent = (MouseEvent) e;
32
 
            x = mouseEvent.x;
33
 
            y = mouseEvent.y;
34
 
        }else{
35
 
                Point point = TuxGuitar.instance().getTablatureEditor().getTablature().toControl(TuxGuitar.instance().getDisplay().getCursorLocation());
36
 
            x = point.x;
37
 
            y = point.y;                
38
 
        }
39
 
        if(x >= 0 && y >= 0){
40
 
                SongTrackCoords trackCoords = getTrackCoords(y);
41
 
                if (trackCoords != null) {
42
 
                        MeasureCoords measureCoords = getMeasureCoords(trackCoords, x,y);
43
 
                        if (measureCoords != null) {
44
 
                                MeasureComponent measureComponent = getMeasureComponent(measureCoords, x);
45
 
                                InstrumentString instrumentString = getMeasureString(measureCoords, y);
46
 
                                if (measureComponent != null) {
47
 
                                        getEditor().getTablature().getCaret().moveTo(trackCoords, measureCoords, measureComponent);
48
 
                                        if (instrumentString != null) {
49
 
                                                getEditor().getTablature().getCaret().setStringNumber(instrumentString.getNumber());
50
 
                                        }
51
 
                                        redraw();
52
 
                                }
53
 
                        }
54
 
                }
55
 
                return true;
56
 
        }*/
57
 
        return false;
58
 
    }
59
 
/*
60
 
    private SongTrackCoords getTrackCoords(int y) {
61
 
        return getEditor().getTablature().getSongCoords().getTrackAt(y, -getEditor().getTablature().getVerticalBar().getSelection());
62
 
    }
63
 
 
64
 
    private MeasureCoords getMeasureCoords(SongTrackCoords trackCoords, int x,int y) {
65
 
        return trackCoords.getMeasureAt(x,y, -getEditor().getTablature().getHorizontalBar().getSelection(),-getEditor().getTablature().getVerticalBar().getSelection());
66
 
    }    
67
 
 
68
 
    private MeasureComponent getMeasureComponent(MeasureCoords measureCoords, int x) {
69
 
        return measureCoords.getComponentAt(x);
70
 
    }
71
 
 
72
 
    private InstrumentString getMeasureString(MeasureCoords measureCoords, int y) {
73
 
        return measureCoords.getStringAt(y);
74
 
    }
75
 
*/
76
 
 
77
 
}
 
 
b'\\ No newline at end of file'