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 :
36 186 : Segment* segment() const { return toSegment(ownershipParent()); }
37 : BarLine* barline() const;
38 :
39 0 : bool isEditable() const override { return true; }
40 : void endEdit(EditData&) override;
41 0 : bool allowTimeAnchor() const override { return false; }
42 : RectF drag(EditData& ed) override;
43 :
44 0 : String playCountCustomText() const { return m_playCountCustomText; }
45 : void setPlayCountCustomText(const String& v) { m_playCountCustomText = v; }
46 :
47 : void setPlayCountTextSetting(const AutoCustomHide& v) { m_playCountTextSetting = v; }
48 6 : AutoCustomHide playCountTextSetting() const { return m_playCountTextSetting; }
49 :
50 : PropertyValue getProperty(Pid propertyId) const override;
51 : bool setProperty(Pid propertyId, const PropertyValue&) override;
52 : PropertyValue propertyDefault(Pid propertyId) const override;
53 :
54 6 : bool positionRelativeToNoteheadRest() const override { return false; }
55 :
56 : private:
57 : friend class Factory;
58 : PlayCountText(DummyParentOr<Segment> parent, TextStyleType tid = TextStyleType::REPEAT_PLAY_COUNT);
59 :
60 : AutoCustomHide m_playCountTextSetting = AutoCustomHide::AUTO;
61 : String m_playCountCustomText = u"";
62 : };
63 : } // namespace mu::engraving
|