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) 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 : #include "palettecommandsregister.h"
24 :
25 : #include "../palettecommands.h"
26 : #include "rcommand/commandtypes.h"
27 :
28 : using namespace muse;
29 : using namespace muse::rcommand;
30 : using namespace mu::palette;
31 :
32 : static const std::vector<CommandInfo> s_commandInfos = {
33 : CommandInfo{
34 : TOGGLE_MASTER_PALETTE_COMMAND,
35 : TranslatableString("palette", "&Master palette…"),
36 : TranslatableString("palette", "Open master palette"),
37 : InputSchema({
38 : { "palette_name", Arg(DataType::String, u"Selected palette name") }
39 : }),
40 : Decoration()
41 : },
42 : CommandInfo{
43 : TOGGLE_SPECIAL_CHARACTERS_COMMAND,
44 : TranslatableString("palette", "&Special characters…"),
45 : TranslatableString("palette", "Open special characters"),
46 : InputSchema(),
47 : Decoration()
48 : },
49 : CommandInfo{
50 : OPEN_TIME_SIGNATURE_PROPERTIES_COMMAND,
51 : TranslatableString("palette", "&Time signature properties…"),
52 : TranslatableString("palette", "Open time signature properties"),
53 : InputSchema(),
54 : Decoration()
55 : },
56 : CommandInfo{
57 : OPEN_CUSTOMIZE_KIT_COMMAND,
58 : TranslatableString("palette", "&Customize kit…"),
59 : TranslatableString("palette", "Open customize kit"),
60 : InputSchema(),
61 : Decoration()
62 : },
63 :
64 : CommandInfo{
65 : PALETTE_SEARCH_COMMAND,
66 : TranslatableString("palette", "Palette search"),
67 : TranslatableString("palette", "Search palettes"),
68 : InputSchema(),
69 : Decoration()
70 : },
71 : CommandInfo{
72 : PALETTE_APPLY_CURRENT_ELEMENT_COMMAND,
73 : TranslatableString("palette", "Apply current palette element"),
74 : TranslatableString("palette", "Apply current palette element"),
75 : InputSchema(),
76 : Decoration()
77 : },
78 :
79 : CommandInfo{
80 : PALETTE_TOGGLE_SINGLE_CLICK_TO_OPEN_COMMAND,
81 : TranslatableString("palette", "Single-click to open a palette"),
82 : TranslatableString("palette", "Toggle single click to open a palette"),
83 : InputSchema(),
84 : Decoration(rcommand::Checkable::Yes)
85 : },
86 : CommandInfo{
87 : PALETTE_TOGGLE_SINGLE_PALETTE_COMMAND,
88 : TranslatableString("palette", "Open only one palette at a time"),
89 : TranslatableString("palette", "Toggle open only one palette at a time"),
90 : InputSchema(),
91 : Decoration(rcommand::Checkable::Yes)
92 : },
93 : CommandInfo{
94 : PALETTE_TOGGLE_DRAG_ENABLED_COMMAND,
95 : TranslatableString("palette", "Allow reordering palettes"),
96 : TranslatableString("palette", "Toggle allow reordering palettes by dragging"),
97 : InputSchema(),
98 : Decoration(rcommand::Checkable::Yes)
99 : },
100 : CommandInfo{
101 : PALETTE_EXPAND_ALL_COMMAND,
102 : TranslatableString("palette", "Expand all palettes"),
103 : TranslatableString("palette", "Expand all palettes"),
104 : InputSchema(),
105 : Decoration()
106 : },
107 : CommandInfo{
108 : PALETTE_COLLAPSE_ALL_COMMAND,
109 : TranslatableString("palette", "Collapse all palettes"),
110 : TranslatableString("palette", "Collapse all palettes"),
111 : InputSchema(),
112 : Decoration()
113 : },
114 : };
115 :
116 0 : std::string PaletteCommandsRegister::moduleName() const
117 : {
118 0 : return "palette";
119 : }
120 :
121 0 : const std::vector<muse::rcommand::Command>& PaletteCommandsRegister::commandList() const
122 : {
123 0 : static std::vector<muse::rcommand::Command> commands;
124 0 : if (commands.empty()) {
125 0 : commands.reserve(s_commandInfos.size());
126 0 : for (const auto& info : s_commandInfos) {
127 0 : commands.push_back(info.command);
128 : }
129 : }
130 0 : return commands;
131 : }
132 :
133 0 : const std::vector<CommandInfo>& PaletteCommandsRegister::commandInfoList() const
134 : {
135 0 : return s_commandInfos;
136 : }
|