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<EngravingItem> parent);
37 :
38 : SoundFlag* clone() const override;
39 : bool isEditable() const override;
40 :
41 : void setSelected(bool f) override;
42 :
43 : PropertyValue getProperty(Pid id) const override;
44 : bool setProperty(Pid id, const PropertyValue& value) override;
45 : PropertyValue propertyDefault(Pid id) const override;
46 :
47 0 : bool canBeExcludedFromOtherParts() const override { return false; }
48 :
49 : using PresetCodes = StringList;
50 : using PlayingTechniqueCode = String;
51 :
52 : const PresetCodes& soundPresets() const;
53 : void setSoundPresets(const PresetCodes& soundPresets);
54 :
55 : const PlayingTechniqueCode& playingTechnique() const;
56 : void setPlayingTechnique(const PlayingTechniqueCode& technique);
57 :
58 : bool play() const;
59 : void setPlay(bool play);
60 :
61 : bool applyToAllStaves() const;
62 : void setApplyToAllStaves(bool apply);
63 :
64 : void clear();
65 :
66 : bool shouldHide() const;
67 :
68 : void undoChangeSoundFlag(const PresetCodes& presets, const PlayingTechniqueCode& technique);
69 :
70 : char16_t iconCode() const;
71 : muse::draw::Font iconFont() const;
72 : Color iconBackgroundColor() const;
73 :
74 : private:
75 : PresetCodes m_soundPresets;
76 : PlayingTechniqueCode m_playingTechnique;
77 :
78 : muse::draw::Font m_iconFont;
79 : bool m_iconFontValid = false;
80 :
81 : bool m_play = true;
82 : bool m_applyToAllStaves = true;
83 : };
84 : }
|