MuseScore/libmscore/page.h

84 lines
2.6 KiB
C
Raw Normal View History

2012-05-26 14:26:10 +02:00
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2002-2011 Werner Schweer
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2
// as published by the Free Software Foundation and appearing in
// the file LICENCE.GPL
//=============================================================================
#ifndef __PAGE_H__
#define __PAGE_H__
#include "config.h"
2012-05-26 14:26:10 +02:00
#include "element.h"
#include "bsp.h"
2013-05-13 18:49:17 +02:00
namespace Ms {
2012-05-26 14:26:10 +02:00
class System;
class Text;
class Measure;
2016-11-19 11:51:21 +01:00
class XmlWriter;
2012-05-26 14:26:10 +02:00
class Score;
class MeasureBase;
//---------------------------------------------------------
2012-07-25 11:49:34 +02:00
// @@ Page
// @P pagenumber int (read only)
2012-05-26 14:26:10 +02:00
//---------------------------------------------------------
class Page final : public Element {
2012-05-26 14:26:10 +02:00
QList<System*> _systems;
int _no; // page number
#ifdef USE_BSP
BspTree bspTree;
void doRebuildBspTree();
#endif
bool bspTreeValid;
QString replaceTextMacros(const QString&) const;
2014-06-06 12:40:22 +02:00
void drawHeaderFooter(QPainter*, int area, const QString&) const;
2012-05-26 14:26:10 +02:00
public:
Page(Score*);
~Page();
2016-01-04 14:48:58 +01:00
virtual Page* clone() const { return new Page(*this); }
2017-03-14 17:00:38 +01:00
virtual ElementType type() const { return ElementType::PAGE; }
2016-01-04 14:48:58 +01:00
const QList<System*>& systems() const { return _systems; }
QList<System*>& systems() { return _systems; }
2016-03-02 13:20:19 +01:00
System* system(int idx) { return _systems[idx]; }
2012-05-26 14:26:10 +02:00
2016-11-19 11:51:21 +01:00
virtual void write(XmlWriter&) const;
2013-01-11 18:10:18 +01:00
virtual void read(XmlReader&);
2012-05-26 14:26:10 +02:00
void appendSystem(System* s);
int no() const { return _no; }
2016-03-24 12:39:18 +01:00
void setNo(int n) { _no = n; }
2012-05-26 14:26:10 +02:00
bool isOdd() const;
qreal tm() const; // margins in pixel
qreal bm() const;
qreal lm() const;
qreal rm() const;
2016-03-29 16:01:44 +02:00
virtual void draw(QPainter*) const override;
virtual void scanElements(void* data, void (*func)(void*, Element*), bool all=true) override;
2012-05-26 14:26:10 +02:00
QList<Element*> items(const QRectF& r);
QList<Element*> items(const QPointF& p);
2012-05-26 14:26:10 +02:00
void rebuildBspTree() { bspTreeValid = false; }
QPointF pagePos() const { return QPointF(); } ///< position in page coordinates
2016-03-24 12:39:18 +01:00
QList<Element*> elements(); ///< list of visible elements
QRectF tbbox(); // tight bounding box, excluding white space
Fraction endTick() const;
2012-05-26 14:26:10 +02:00
};
2013-05-13 18:49:17 +02:00
} // namespace Ms
2012-05-26 14:26:10 +02:00
#endif