MuseScore  3.4
Music composition and notation
page.h
Go to the documentation of this file.
1 //=============================================================================
2 // MuseScore
3 // Music Composition & Notation
4 //
5 // Copyright (C) 2002-2011 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 // as published by the Free Software Foundation and appearing in
10 // the file LICENCE.GPL
11 //=============================================================================
12 
13 #ifndef __PAGE_H__
14 #define __PAGE_H__
15 
16 #include "config.h"
17 #include "element.h"
18 #include "bsp.h"
19 
20 namespace Ms {
21 
22 class System;
23 class Text;
24 class Measure;
25 class XmlWriter;
26 class Score;
27 class MeasureBase;
28 
29 //---------------------------------------------------------
30 // @@ Page
31 // @P pagenumber int (read only)
32 //---------------------------------------------------------
33 
34 class Page final : public Element {
35  QList<System*> _systems;
36  int _no; // page number
37 #ifdef USE_BSP
38  BspTree bspTree;
39  void doRebuildBspTree();
40 #endif
42 
43  QString replaceTextMacros(const QString&) const;
44  void drawHeaderFooter(QPainter*, int area, const QString&) const;
45 
46  public:
47  Page(Score*);
48  ~Page();
49  virtual Page* clone() const { return new Page(*this); }
50  virtual ElementType type() const { return ElementType::PAGE; }
51  const QList<System*>& systems() const { return _systems; }
52  QList<System*>& systems() { return _systems; }
53  System* system(int idx) { return _systems[idx]; }
54 
55  virtual void write(XmlWriter&) const;
56  virtual void read(XmlReader&);
57 
58  void appendSystem(System* s);
59 
60  int no() const { return _no; }
61  void setNo(int n) { _no = n; }
62  bool isOdd() const;
63  qreal tm() const; // margins in pixel
64  qreal bm() const;
65  qreal lm() const;
66  qreal rm() const;
67 
68  virtual void draw(QPainter*) const override;
69  virtual void scanElements(void* data, void (*func)(void*, Element*), bool all=true) override;
70 
71  QList<Element*> items(const QRectF& r);
72  QList<Element*> items(const QPointF& p);
73  void rebuildBspTree() { bspTreeValid = false; }
74  QPointF pagePos() const { return QPointF(); }
75  QList<Element*> elements();
76  QRectF tbbox(); // tight bounding box, excluding white space
77  Fraction endTick() const;
78  };
79 
80 
81 
82 } // namespace Ms
83 #endif
~Page()
Definition: page.cpp:45
QPointF pagePos() const
position in page coordinates
Definition: page.h:74
Definition: bsp.h:33
Definition: xml.h:67
virtual void scanElements(void *data, void(*func)(void *, Element *), bool all=true) override
Definition: page.cpp:209
Fraction endTick() const
Definition: page.cpp:514
Page(Score *)
Definition: page.cpp:39
virtual void read(XmlReader &)
Definition: page.cpp:416
QList< Element * > elements()
list of visible elements
Definition: page.cpp:433
int _no
Definition: page.h:36
Base class of score layout elements.
Definition: element.h:158
void appendSystem(System *s)
Definition: page.cpp:82
virtual Page * clone() const
Definition: page.h:49
QRectF tbbox()
Definition: page.cpp:484
Definition: score.h:391
qreal rm() const
Definition: page.cpp:474
int no() const
Definition: page.h:60
qreal bm() const
Definition: page.cpp:454
bool isOdd() const
Definition: page.cpp:394
void setNo(int n)
Definition: page.h:61
QString replaceTextMacros(const QString &) const
Definition: page.cpp:297
bool bspTreeValid
Definition: page.h:41
void drawHeaderFooter(QPainter *, int area, const QString &) const
Definition: page.cpp:147
Definition: aeolus.cpp:26
qreal lm() const
Definition: page.cpp:464
const QList< System * > & systems() const
Definition: page.h:51
Definition: xml.h:218
void rebuildBspTree()
Definition: page.h:73
System * system(int idx)
Definition: page.h:53
virtual void draw(QPainter *) const override
Definition: page.cpp:93
Definition: xmlwriter.h:26
QList< Element * > items(const QRectF &r)
Definition: page.cpp:53
One row of measures for all instruments; a complete piece of the timeline.
Definition: system.h:79
QList< System * > _systems
Definition: page.h:35
Definition: fraction.h:46
ElementType
Definition: types.h:34
virtual void write(XmlWriter &) const
Definition: page.cpp:403
qreal tm() const
Definition: page.cpp:444
Definition: page.h:34
virtual ElementType type() const
Definition: page.h:50
QList< System * > & systems()
Definition: page.h:52