Line data Source code
1 : /*
2 : * SPDX-License-Identifier: GPL-3.0-only
3 : * MuseScore-Studio-CLA-applies
4 : *
5 : * MuseScore Studio
6 : * Music Composition & Notation
7 : *
8 : * Copyright (C) 2021 MuseScore Limited and others
9 : *
10 : * This program is free software: you can redistribute it and/or modify
11 : * it under the terms of the GNU General Public License version 3 as
12 : * published by the Free Software Foundation.
13 : *
14 : * This program is distributed in the hope that it will be useful,
15 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : * GNU General Public License for more details.
18 : *
19 : * You should have received a copy of the GNU General Public License
20 : * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 : */
22 :
23 : #ifndef MU_ENGRAVING_STAFFLINES_H
24 : #define MU_ENGRAVING_STAFFLINES_H
25 :
26 : #include <vector>
27 :
28 : #include "engravingitem.h"
29 :
30 : namespace mu::engraving {
31 : //-------------------------------------------------------------------
32 : // @@ StaffLines
33 : /// The StaffLines class is the graphic representation of a staff,
34 : /// it draws the horizontal staff lines.
35 : //-------------------------------------------------------------------
36 :
37 : class StaffLines final : public EngravingItem
38 : {
39 47599 : OBJECT_ALLOCATOR(engraving, StaffLines)
40 : DECLARE_CLASSOF(ElementType::STAFF_LINES)
41 :
42 : public:
43 :
44 0 : StaffLines* clone() const override { return new StaffLines(*this); }
45 :
46 : PointF pagePos() const override; ///< position in page coordinates
47 : PointF canvasPos() const override; ///< position in page coordinates
48 :
49 20 : const std::vector<LineF>& lines() const { return m_lines; }
50 44190 : void setLines(const std::vector<LineF>& l) { m_lines = l; }
51 :
52 234487 : Measure* measure() const { return (Measure*)ownershipParent(); }
53 : double y1() const;
54 :
55 88400 : double lw() const { return m_lw; }
56 44190 : void setLw(double w) { m_lw = w; }
57 :
58 : RectF hitBBox() const override;
59 : Shape hitShape() const override;
60 :
61 : bool collectForDrawing() const override;
62 :
63 : private:
64 : friend class Factory;
65 : StaffLines(DummyParentOr<Measure> parent);
66 :
67 : double m_lw = 0.0;
68 : std::vector<LineF> m_lines;
69 : };
70 : }
71 :
72 : #endif // MU_LIBMSCORE_STAFFLINES_H
|