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) 2025 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 : #pragma once
24 :
25 : #include "textbase.h"
26 :
27 : namespace mu::engraving {
28 : class PlayCountText final : public TextBase
29 : {
30 12 : OBJECT_ALLOCATOR(engraving, PlayCountText)
31 : DECLARE_CLASSOF(ElementType::PLAY_COUNT_TEXT)
32 :
33 : public:
34 0 : PlayCountText* clone() const override { return new PlayCountText(*this); }
35 : void setOwnershipParent(DummyParentOr<Segment> parent) { EngravingItem::setOwnershipParent(parent); }
36 :
37 186 : Segment* segment() const { return toSegment(ownershipParent()); }
38 : BarLine* barline() const;
39 :
40 0 : bool isEditable() const override { return true; }
41 : void endEdit(EditData&) override;
42 0 : bool allowTimeAnchor() const override { return false; }
43 : RectF drag(EditData& ed) override;
44 :
45 0 : String playCountCustomText() const { return m_playCountCustomText; }
46 : void setPlayCountCustomText(const String& v) { m_playCountCustomText = v; }
47 :
48 : void setPlayCountTextSetting(const AutoCustomHide& v) { m_playCountTextSetting = v; }
49 6 : AutoCustomHide playCountTextSetting() const { return m_playCountTextSetting; }
50 :
51 : PropertyValue getProperty(Pid propertyId) const override;
52 : bool setProperty(Pid propertyId, const PropertyValue&) override;
53 : PropertyValue propertyDefault(Pid propertyId) const override;
54 :
55 6 : bool positionRelativeToNoteheadRest() const override { return false; }
56 :
57 : private:
58 : friend class Factory;
59 : PlayCountText(DummyParentOr<Segment> parent, TextStyleType tid = TextStyleType::REPEAT_PLAY_COUNT);
60 :
61 : AutoCustomHide m_playCountTextSetting = AutoCustomHide::AUTO;
62 : String m_playCountCustomText = u"";
63 : };
64 : } // namespace mu::engraving
|