MuseScore  3.4
Music composition and notation
omrview.h
Go to the documentation of this file.
1 //=============================================================================
2 // MusE Reader
3 // Linux Music Score Reader
4 //
5 // Copyright (C) 2010 Werner Schweer
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 __SCAN_VIEW_H__
21 #define __SCAN_VIEW_H__
22 
23 namespace Ms {
24 
25 class Omr;
26 class Page;
27 class ScoreView;
28 class OmrPage;
29 
30 //---------------------------------------------------------
31 // Tile
32 //---------------------------------------------------------
33 
34 struct Tile {
35  int no;
36  QRect r;
37  QPixmap pm;
39  int pageNo;
40 
41  Tile();
42  };
43 
44 static const int TILE_H = 512;
45 static const int TILE_W = 512;
46 
47 //---------------------------------------------------------
48 // OmrView
49 //---------------------------------------------------------
50 
51 class OmrView : public QWidget {
52  Q_OBJECT
55  int maxTiles;
56 
57  QList<Tile*> usedTiles;
58  QStack<Tile*> freeTiles;
59  QPoint startDrag;
60 
61  QTransform _matrix;
62  int xoff, yoff;
63  int pageWidth;
64 
65  bool _fotoMode;
66  QRectF _foto;
67 
68  bool _showLines;
72 
73  void zoom(int step, const QPoint& pos);
74 
75  virtual void mousePressEvent(QMouseEvent*);
76  virtual void mouseMoveEvent(QMouseEvent*);
77  virtual void wheelEvent(QWheelEvent*);
78  virtual void paintEvent(QPaintEvent*);
79  virtual void contextMenuEvent(QContextMenuEvent*);
80 
81  qreal mag() const { return _matrix.m11(); }
82  void setMag(double mag);
83  void initTile(Tile* t);
84 
85  public slots:
86  void setScale(double);
87  void setOffset(double, double);
88 
89  signals:
90  void pageNumberChanged(int);
91  void xPosChanged(int);
92  void yPosChanged(int);
93 
94  public:
95  OmrView(ScoreView*, QWidget* parent = 0);
96  void setOmr(Omr*);
97  Omr* omr() const { return _omr; }
98  bool fotoMode() const { return _fotoMode; }
99  void setFotoMode(bool val) { _fotoMode = val; }
100 
101  void setShowLines(bool val) { _showLines = val; }
102  bool showLines() const { return _showLines; }
103  bool showBarlines() const { return _showBarlines; }
104  bool showSlices() const { return _showSlices; }
105  bool showStaves() const { return _showStaves; }
106  void setShowBarlines(bool val);
107  void setShowSlices(bool val);
108  void setShowStaves(bool val);
109  };
110 
111 }
112 
113 #endif
114 
bool showSlices() const
Definition: omrview.h:104
Definition: omr.h:124
QPixmap pm
Definition: omrview.h:37
Definition: scoreview.h:90
QList< Tile * > usedTiles
Definition: omrview.h:57
bool _showLines
Definition: omrview.h:68
Definition: omrview.h:34
qreal mag() const
Definition: omrview.h:81
bool showLines() const
Definition: omrview.h:102
int maxTiles
Definition: omrview.h:55
void setShowLines(bool val)
Definition: omrview.h:101
QPoint startDrag
Definition: omrview.h:59
int pageWidth
Definition: omrview.h:63
QRect r
Definition: omrview.h:36
QTransform _matrix
Definition: omrview.h:61
bool showStaves() const
Definition: omrview.h:105
Definition: aeolus.cpp:26
Omr * _omr
Definition: omrview.h:53
int pageNo
Definition: omrview.h:39
Definition: omrview.h:51
int yoff
Definition: omrview.h:62
Tile()
Definition: omrview.cpp:107
OmrPage * page
Definition: omrview.h:38
void setFotoMode(bool val)
Definition: omrview.h:99
bool fotoMode() const
Definition: omrview.h:98
int no
Definition: omrview.h:35
ScoreView * _scoreView
Definition: omrview.h:54
QStack< Tile * > freeTiles
Definition: omrview.h:58
QRectF _foto
Definition: omrview.h:66
bool _fotoMode
Definition: omrview.h:65
bool _showStaves
Definition: omrview.h:71
Omr * omr() const
Definition: omrview.h:97
bool showBarlines() const
Definition: omrview.h:103
bool _showSlices
Definition: omrview.h:70
Definition: omrpage.h:187
bool _showBarlines
Definition: omrview.h:69