1 //=============================================================================
2 //  MuseScore
3 //  Linux Music Score Editor
4 //
5 //  Copyright (C) 2009 Werner Schweer and others
6 //
7 //  This program is free software; you can redistribute it and/or modify
8 //  it under the terms of the GNU General Public License version 2.
9 //
10 //  This program is distributed in the hope that it will be useful,
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //  GNU General Public License for more details.
14 //
15 //  You should have received a copy of the GNU General Public License
16 //  along with this program; if not, write to the Free Software
17 //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //=============================================================================
19 
20 #ifndef __KEYCANVAS_H__
21 #define __KEYCANVAS_H__
22 
23 namespace Ms {
24 
25 class Accidental;
26 class Clef;
27 
28 //---------------------------------------------------------
29 //   KeyCanvas
30 //---------------------------------------------------------
31 
32 class KeyCanvas : public QFrame {
33       Q_OBJECT
34 
35       Accidental* dragElement;
36       Accidental* moveElement;
37       QTransform _matrix, imatrix;
38       double extraMag;
39       QList<Accidental*> accidentals;
40       QPointF startMove;
41       QPointF base;
42       Clef* clef;
43 
44       virtual void paintEvent(QPaintEvent*);
45       virtual void mousePressEvent(QMouseEvent*);
46       virtual void mouseMoveEvent(QMouseEvent*);
47       virtual void mouseReleaseEvent(QMouseEvent*);
48 
49       virtual void dragEnterEvent(QDragEnterEvent*);
50       virtual void dragMoveEvent(QDragMoveEvent*);
51       virtual void dropEvent(QDropEvent*);
52       void snap(Accidental*);
53 
54    private slots:
55       void deleteElement();
56 
57    public:
58       KeyCanvas(QWidget* parent = 0);
59       void clear();
getAccidentals()60       const QList<Accidental*> getAccidentals() const { return accidentals; }
61       };
62 
63 
64 } // namespace Ms
65 #endif
66 
67