MuseScore  3.4
Music composition and notation
ruler.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 __RULER_H__
21 #define __RULER_H__
22 
23 #include "libmscore/pos.h"
24 
25 namespace Ms {
26 
27 class Score;
28 
29 static const int rulerHeight = 28;
30 
31 //---------------------------------------------------------
32 // Ruler
33 //---------------------------------------------------------
34 
35 class Ruler : public QWidget {
36  Q_OBJECT
37 
41 
42  int magStep;
43  double _xmag;
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 setMag(double xmag, double ymag);
66  void setPos(const Pos&);
67 
68  public:
69  Ruler(QWidget* parent = 0);
70  void setScore(Score*, Pos* locator);
71  double xmag() const { return _xmag; }
72  int xpos() const { return _xpos; }
73  };
74 
75 
76 } // namespace Ms
77 #endif
78 
virtual void mousePressEvent(QMouseEvent *)
Definition: ruler.cpp:325
void locatorMoved(int idx, const Pos &)
QFont _font2
Definition: ruler.h:46
Pos * _locator
Definition: ruler.h:40
void setXpos(int)
Definition: ruler.cpp:165
static QPixmap * markIcon[3]
Definition: ruler.h:48
virtual void mouseMoveEvent(QMouseEvent *event)
Definition: ruler.cpp:334
void setMag(double xmag, double ymag)
Definition: ruler.cpp:138
Ruler(QWidget *parent=0)
Definition: ruler.cpp:103
virtual void paintEvent(QPaintEvent *)
Definition: ruler.cpp:197
TType _timeType
Definition: ruler.h:45
int pos2pix(const Pos &p) const
Definition: ruler.cpp:187
int magStep
Definition: ruler.h:42
Definition: score.h:391
double _xmag
Definition: ruler.h:43
Definition: ruler.h:35
int _xpos
Definition: ruler.h:44
Definition: aeolus.cpp:26
double xmag() const
Definition: ruler.h:71
void setScore(Score *, Pos *locator)
Definition: ruler.cpp:125
Pos _cursor
Definition: ruler.h:39
void moveLocator(QMouseEvent *)
Definition: ruler.cpp:343
virtual void leaveEvent(QEvent *)
Definition: ruler.cpp:358
int xpos() const
Definition: ruler.h:72
QFont _font1
Definition: ruler.h:46
void posChanged(const Pos &)
Pos pix2pos(int x) const
Definition: ruler.cpp:175
TType
Definition: pos.h:32
Score * _score
Definition: ruler.h:38
void setPos(const Pos &)
Definition: ruler.cpp:369
Definition: pos.h:42