MuseScore  3.4
Music composition and notation
pianoruler.h
Go to the documentation of this file.
1 //=============================================================================
2 // MusE Score
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 __PIANO_RULER_H__
21 #define __PIANO_RULER_H__
22 
23 #include "libmscore/pos.h"
24 
25 namespace Ms {
26 
27 class Score;
28 
29 static const int pianoRulerHeight = 28;
30 static const int MAP_OFFSET = 480;
31 
32 //---------------------------------------------------------
33 // PianoRuler
34 //---------------------------------------------------------
35 
36 class PianoRuler : public QWidget {
37  Q_OBJECT
38 
42 
43  qreal _xZoom;
44  int _xpos;
46  QFont _font1, _font2;
47 
48  static QPixmap* markIcon[3];
49 
50  virtual void paintEvent(QPaintEvent*);
51  virtual void mousePressEvent(QMouseEvent*);
52  virtual void mouseMoveEvent(QMouseEvent* event);
53  virtual void leaveEvent(QEvent*);
54 
55  Pos pix2pos(int x) const;
56  int pos2pix(const Pos& p) const;
57  void moveLocator(QMouseEvent*);
58 
59  signals:
60  void posChanged(const Pos&);
61  void locatorMoved(int idx, const Pos&);
62 
63  public slots:
64  void setXpos(int);
65  void setXZoom(qreal);
66  void setPos(const Pos&);
67 
68  public:
69  PianoRuler(QWidget* parent = 0);
70  void setScore(Score*, Pos* locator);
71  int xpos() const { return _xpos; }
72  qreal xZoom() const { return _xZoom; }
73  };
74 
75 
76 } // namespace Ms
77 #endif
78 
79 
void setXZoom(qreal)
Definition: pianoruler.cpp:349
void posChanged(const Pos &)
Score * _score
Definition: pianoruler.h:39
virtual void mouseMoveEvent(QMouseEvent *event)
Definition: pianoruler.cpp:295
TType _timeType
Definition: pianoruler.h:45
Pos _cursor
Definition: pianoruler.h:40
QFont _font1
Definition: pianoruler.h:46
int _xpos
Definition: pianoruler.h:44
static QPixmap * markIcon[3]
Definition: pianoruler.h:48
qreal _xZoom
Definition: pianoruler.h:43
Pos pix2pos(int x) const
Definition: pianoruler.cpp:148
Definition: score.h:391
void setXpos(int)
Definition: pianoruler.cpp:138
int xpos() const
Definition: pianoruler.h:71
qreal xZoom() const
Definition: pianoruler.h:72
void moveLocator(QMouseEvent *)
Definition: pianoruler.cpp:304
PianoRuler(QWidget *parent=0)
Definition: pianoruler.cpp:104
Definition: aeolus.cpp:26
int pos2pix(const Pos &p) const
Definition: pianoruler.cpp:162
void setPos(const Pos &)
Definition: pianoruler.cpp:330
virtual void mousePressEvent(QMouseEvent *)
Definition: pianoruler.cpp:286
virtual void paintEvent(QPaintEvent *)
Definition: pianoruler.cpp:171
Pos * _locator
Definition: pianoruler.h:41
void locatorMoved(int idx, const Pos &)
Definition: pianoruler.h:36
TType
Definition: pos.h:32
virtual void leaveEvent(QEvent *)
Definition: pianoruler.cpp:319
void setScore(Score *, Pos *locator)
Definition: pianoruler.cpp:125
QFont _font2
Definition: pianoruler.h:46
Definition: pos.h:42