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 __BREATH_H__
14 #define __BREATH_H__
15 
16 #include "element.h"
17 #include "sym.h"
18 
19 namespace Ms {
20 
21 //---------------------------------------------------------
22 //   BreathType
23 //---------------------------------------------------------
24 
25 struct BreathType {
26       SymId id;
27       bool isCaesura;
28       qreal pause;
29       };
30 
31 //---------------------------------------------------------
32 //   @@ Breath
33 //!    breathType() is index in symList
34 //---------------------------------------------------------
35 
36 class Breath final : public Element {
37       qreal _pause;
38       SymId _symId;
39 
40    public:
41       Breath(Score* s);
42 
type()43       ElementType type() const override { return ElementType::BREATH; }
clone()44       Breath* clone() const override    { return new Breath(*this); }
45 
46       qreal mag() const override;
47 
setSymId(SymId id)48       void setSymId(SymId id)          { _symId = id; }
symId()49       SymId symId() const              { return _symId; }
pause()50       qreal pause() const              { return _pause; }
setPause(qreal v)51       void setPause(qreal v)           { _pause = v; }
52 
segment()53       Segment* segment() const         { return (Segment*)parent(); }
54 
55       void draw(QPainter*) const override;
56       void layout() override;
57       void write(XmlWriter&) const override;
58       void read(XmlReader&) override;
59       QPointF pagePos() const override;      ///< position in page coordinates
60 
61       QVariant getProperty(Pid propertyId) const override;
62       bool setProperty(Pid propertyId, const QVariant&) override;
63       QVariant propertyDefault(Pid) const override;
64 
65       Element* nextSegmentElement() override;
66       Element* prevSegmentElement() override;
67       QString accessibleInfo() const override;
68 
69       bool isCaesura() const;
70 
71       static const std::vector<BreathType> breathList;
72       };
73 
74 
75 }     // namespace Ms
76 #endif
77 
78