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) 2024 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 "engravingitem.h"
26 :
27 : #include "draw/types/font.h"
28 :
29 : namespace mu::engraving {
30 : class SoundFlag final : public EngravingItem
31 : {
32 18 : OBJECT_ALLOCATOR(engraving, SoundFlag)
33 : DECLARE_CLASSOF(ElementType::SOUND_FLAG)
34 :
35 : public:
36 : explicit SoundFlag(DummyParentOr<StaffText> parent);
37 :
38 : SoundFlag* clone() const override;
39 9 : void setOwnershipParent(DummyParentOr<StaffText> parent) { EngravingItem::setOwnershipParent(parent); }
40 : bool isEditable() const override;
41 :
42 : void setSelected(bool f) override;
43 :
44 : PropertyValue getProperty(Pid id) const override;
45 : bool setProperty(Pid id, const PropertyValue& value) override;
46 : PropertyValue propertyDefault(Pid id) const override;
47 :
48 0 : bool canBeExcludedFromOtherParts() const override { return false; }
49 :
50 : using PresetCodes = StringList;
51 : using PlayingTechniqueCode = String;
52 :
53 : const PresetCodes& soundPresets() const;
54 : void setSoundPresets(const PresetCodes& soundPresets);
55 :
56 : const PlayingTechniqueCode& playingTechnique() const;
57 : void setPlayingTechnique(const PlayingTechniqueCode& technique);
58 :
59 : bool play() const;
60 : void setPlay(bool play);
61 :
62 : bool applyToAllStaves() const;
63 : void setApplyToAllStaves(bool apply);
64 :
65 : void clear();
66 :
67 : bool shouldHide() const;
68 :
69 : void undoChangeSoundFlag(const PresetCodes& presets, const PlayingTechniqueCode& technique);
70 :
71 : char16_t iconCode() const;
72 : muse::draw::Font iconFont() const;
73 : Color iconBackgroundColor() const;
74 :
75 : private:
76 : PresetCodes m_soundPresets;
77 : PlayingTechniqueCode m_playingTechnique;
78 :
79 : muse::draw::Font m_iconFont;
80 : bool m_iconFontValid = false;
81 :
82 : bool m_play = true;
83 : bool m_applyToAllStaves = true;
84 : };
85 : }
|