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) 2021 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 "factory.h"
24 :
25 : #include "types/typesconv.h"
26 :
27 : #include "accidental.h"
28 : #include "actionicon.h"
29 : #include "ambitus.h"
30 : #include "anchors.h"
31 : #include "arpeggio.h"
32 : #include "articulation.h"
33 : #include "bagpembell.h"
34 : #include "barline.h"
35 : #include "beam.h"
36 : #include "bend.h"
37 : #include "box.h"
38 : #include "bracket.h"
39 : #include "breath.h"
40 : #include "capo.h"
41 : #include "chord.h"
42 : #include "chordbracket.h"
43 : #include "chordline.h"
44 : #include "deadslapped.h"
45 : #include "dynamic.h"
46 : #include "expression.h"
47 : #include "fermata.h"
48 : #include "figuredbass.h"
49 : #include "fingering.h"
50 : #include "fret.h"
51 : #include "glissando.h"
52 : #include "gradualtempochange.h"
53 : #include "guitarbend.h"
54 : #include "hairpin.h"
55 : #include "hammeronpulloff.h"
56 : #include "harmonicmark.h"
57 : #include "harmony.h"
58 : #include "harppedaldiagram.h"
59 : #include "image.h"
60 : #include "instrchange.h"
61 : #include "instrumentname.h"
62 : #include "jump.h"
63 : #include "keysig.h"
64 : #include "laissezvib.h"
65 : #include "layoutbreak.h"
66 : #include "letring.h"
67 : #include "lyrics.h"
68 : #include "marker.h"
69 : #include "measure.h"
70 : #include "measurenumber.h"
71 : #include "measurerepeat.h"
72 : #include "mmrest.h"
73 : #include "mmrestrange.h"
74 : #include "note.h"
75 : #include "noteline.h"
76 : #include "ornament.h"
77 : #include "ottava.h"
78 : #include "page.h"
79 : #include "pagelockindicator.h"
80 : #include "palmmute.h"
81 : #include "parenthesis.h"
82 : #include "partialtie.h"
83 : #include "pedal.h"
84 : #include "pickscrape.h"
85 : #include "playcounttext.h"
86 : #include "playtechannotation.h"
87 : #include "rasgueado.h"
88 : #include "rehearsalmark.h"
89 : #include "rest.h"
90 : #include "score.h"
91 : #include "segment.h"
92 : #include "slur.h"
93 : #include "soundflag.h"
94 : #include "spacer.h"
95 : #include "staff.h"
96 : #include "stafflines.h"
97 : #include "staffstate.h"
98 : #include "stafftext.h"
99 : #include "stafftypechange.h"
100 : #include "staffvisibilityindicator.h"
101 : #include "stavesharinglabel.h"
102 : #include "stem.h"
103 : #include "stemslash.h"
104 : #include "sticking.h"
105 : #include "stringtunings.h"
106 : #include "system.h"
107 : #include "systemdivider.h"
108 : #include "systemlockindicator.h"
109 : #include "systemtext.h"
110 : #include "tabdurationsymbol.h"
111 : #include "tapping.h"
112 : #include "tempotext.h"
113 : #include "text.h"
114 : #include "textline.h"
115 : #include "tie.h"
116 : #include "timesig.h"
117 : #include "tremolobar.h"
118 : #include "tremolosinglechord.h"
119 : #include "tremolotwochord.h"
120 : #include "trill.h"
121 : #include "tripletfeel.h"
122 : #include "tuplet.h"
123 : #include "vibrato.h"
124 : #include "volta.h"
125 : #include "whammybar.h"
126 :
127 : #include "log.h"
128 :
129 : using namespace mu;
130 : using namespace mu::engraving;
131 :
132 5146 : EngravingItem* Factory::createItem(ElementType type, DummyParentOr<EngravingItem> parent, bool isAccessibleEnabled)
133 : {
134 5146 : EngravingItem* item = doCreateItem(type, parent);
135 :
136 5146 : if (item) {
137 5146 : item->setAccessibleEnabled(isAccessibleEnabled);
138 : }
139 :
140 5146 : return item;
141 : }
142 :
143 : //! The parent if it is of the given type, the dummy otherwise: a parent of the wrong
144 : //! type is no parent at all.
145 : template<typename T>
146 1208 : static DummyParentOr<T> parentOfTypeOrDummy(EngravingItem* parent, DummyParent* dummy)
147 : {
148 1208 : return parentOrDummy(dynamic_cast<T*>(parent), dummy);
149 : }
150 :
151 5146 : EngravingItem* Factory::doCreateItem(ElementType type, DummyParentOr<EngravingItem> parent)
152 : {
153 5146 : EngravingObject* parentObject = parent;
154 5146 : Score* score = parentObject->score();
155 5146 : DummyParent* dummy = score->dummy();
156 : // null when the item is to be created unattached; the cases below that need a
157 : // parent of a particular type fall back to the dummy either way
158 5146 : EngravingItem* parentItem = parent.as<EngravingItem>();
159 :
160 5146 : switch (type) {
161 119 : case ElementType::VOLTA: return new Volta(parent);
162 158 : case ElementType::OTTAVA: return new Ottava(parent);
163 95 : case ElementType::TEXTLINE: return new TextLine(parent);
164 1 : case ElementType::NOTELINE: return new NoteLine(parent);
165 55 : case ElementType::TRILL: return new Trill(parent);
166 83 : case ElementType::LET_RING: return new LetRing(parent);
167 86 : case ElementType::GRADUAL_TEMPO_CHANGE: return new GradualTempoChange(parent);
168 32 : case ElementType::VIBRATO: return new Vibrato(parent);
169 92 : case ElementType::PALM_MUTE: return new PalmMute(parent);
170 64 : case ElementType::WHAMMY_BAR: return new WhammyBar(parent);
171 66 : case ElementType::RASGUEADO: return new Rasgueado(parent);
172 91 : case ElementType::HARMONIC_MARK: return new HarmonicMark(parent);
173 2 : case ElementType::PICK_SCRAPE: return new PickScrape(parent);
174 128 : case ElementType::PEDAL: return new Pedal(parent);
175 307 : case ElementType::HAIRPIN: return new Hairpin(parent);
176 0 : case ElementType::CLEF: return new Clef(parentOfTypeOrDummy<Segment>(parentItem, dummy));
177 0 : case ElementType::KEYSIG: return new KeySig(parentOfTypeOrDummy<Segment>(parentItem, dummy));
178 0 : case ElementType::TIMESIG: return new TimeSig(parentOfTypeOrDummy<Segment>(parentItem, dummy));
179 0 : case ElementType::BAR_LINE: return new BarLine(parentOfTypeOrDummy<Segment>(parentItem, dummy));
180 0 : case ElementType::SYSTEM_DIVIDER: return new SystemDivider(parentOfTypeOrDummy<System>(parentItem, dummy));
181 0 : case ElementType::ARPEGGIO: return new Arpeggio(parentOfTypeOrDummy<Chord>(parentItem, dummy));
182 0 : case ElementType::CHORD_BRACKET: return new ChordBracket(parentOfTypeOrDummy<Chord>(parentItem, dummy));
183 0 : case ElementType::BREATH: return new Breath(parentOfTypeOrDummy<Segment>(parentItem, dummy));
184 91 : case ElementType::GLISSANDO: return new Glissando(parent);
185 0 : case ElementType::BRACKET: return new Bracket(parent);
186 26 : case ElementType::ARTICULATION: return new Articulation(parentOfTypeOrDummy<ChordRest>(parentItem, dummy));
187 0 : case ElementType::TAPPING: return new Tapping(parentOfTypeOrDummy<ChordRest>(parentItem, dummy));
188 4 : case ElementType::ORNAMENT: return new Ornament(parentOfTypeOrDummy<ChordRest>(parentItem, dummy));
189 1 : case ElementType::FERMATA: return new Fermata(parent);
190 1 : case ElementType::CHORDLINE: return new ChordLine(parentOfTypeOrDummy<Chord>(parentItem, dummy));
191 0 : case ElementType::ACCIDENTAL: return new Accidental(parent);
192 17 : case ElementType::DYNAMIC: return new Dynamic(parentOfTypeOrDummy<Segment>(parentItem, dummy));
193 0 : case ElementType::EXPRESSION: return new Expression(parentOfTypeOrDummy<Segment>(parentItem, dummy));
194 0 : case ElementType::TEXT: return new Text(parent);
195 0 : case ElementType::MEASURE_NUMBER: return new MeasureNumber(parentOfTypeOrDummy<Measure>(parentItem, dummy));
196 0 : case ElementType::MMREST_RANGE: return new MMRestRange(parentOfTypeOrDummy<Measure>(parentItem, dummy));
197 0 : case ElementType::INSTRUMENT_NAME: return new InstrumentName(parentOfTypeOrDummy<System>(parentItem, dummy));
198 16 : case ElementType::STAFF_TEXT: return new StaffText(parentOfTypeOrDummy<Segment>(parentItem, dummy));
199 0 : case ElementType::STAVE_SHARING_LABEL: return new StaveSharingLabel(parentOfTypeOrDummy<Segment>(parentItem, dummy));
200 0 : case ElementType::PLAY_COUNT_TEXT: return new PlayCountText(parentOfTypeOrDummy<Segment>(parentItem, dummy));
201 37 : case ElementType::PLAYTECH_ANNOTATION: return new PlayTechAnnotation(parentOfTypeOrDummy<Segment>(parentItem, dummy));
202 8 : case ElementType::CAPO: return new Capo(parentOfTypeOrDummy<Segment>(parentItem, dummy));
203 50 : case ElementType::SYSTEM_TEXT: return new SystemText(parentOfTypeOrDummy<Segment>(parentItem, dummy));
204 54 : case ElementType::REHEARSAL_MARK: return new RehearsalMark(parentOfTypeOrDummy<Segment>(parentItem, dummy));
205 32 : case ElementType::INSTRUMENT_CHANGE: return new InstrumentChange(parent);
206 0 : case ElementType::SOUND_FLAG: return new SoundFlag(parent);
207 0 : case ElementType::STAFFTYPE_CHANGE: return new StaffTypeChange(parentOfTypeOrDummy<MeasureBase>(parentItem, dummy));
208 0 : case ElementType::STAFF_VISIBILITY_INDICATOR: return new StaffVisibilityIndicator(parentOfTypeOrDummy<System>(parentItem, dummy));
209 0 : case ElementType::NOTEHEAD: return new NoteHead(parentOfTypeOrDummy<Note>(parentItem, dummy));
210 0 : case ElementType::NOTEDOT: {
211 0 : if (parentItem && parentItem->isNote()) {
212 0 : return new NoteDot(toNote(parentItem));
213 0 : } else if (parentItem && parentItem->isRest()) {
214 0 : return new NoteDot(toRest(parentItem));
215 : } else {
216 0 : return new NoteDot(dummy);
217 : }
218 : }
219 18 : case ElementType::TREMOLO_SINGLECHORD: return new TremoloSingleChord(parentOfTypeOrDummy<Chord>(parentItem, dummy));
220 0 : case ElementType::TREMOLO_TWOCHORD: return new TremoloTwoChord(parentOfTypeOrDummy<Chord>(parentItem, dummy));
221 0 : case ElementType::LAYOUT_BREAK: return new LayoutBreak(parentOfTypeOrDummy<MeasureBase>(parentItem, dummy));
222 171 : case ElementType::MARKER: return new Marker(parent);
223 106 : case ElementType::JUMP: return new Jump(parentOfTypeOrDummy<Measure>(parentItem, dummy));
224 0 : case ElementType::MEASURE_REPEAT: return new MeasureRepeat(parentOfTypeOrDummy<Segment>(parentItem, dummy));
225 0 : case ElementType::ACTION_ICON: return new ActionIcon(parent);
226 205 : case ElementType::NOTE: return new Note(parentOfTypeOrDummy<Chord>(parentItem, dummy));
227 0 : case ElementType::SYMBOL: return new Symbol(parent);
228 0 : case ElementType::FSYMBOL: return new FSymbol(parent);
229 326 : case ElementType::CHORD: return new Chord(parentOfTypeOrDummy<Segment>(parentItem, dummy));
230 137 : case ElementType::REST: return new Rest(parentOfTypeOrDummy<Segment>(parentItem, dummy));
231 0 : case ElementType::MMREST: return new MMRest(parentOfTypeOrDummy<Segment>(parentItem, dummy));
232 0 : case ElementType::DEAD_SLAPPED: return new DeadSlapped(toRest(parentItem));
233 0 : case ElementType::SPACER: return new Spacer(parentOfTypeOrDummy<Measure>(parentItem, dummy));
234 0 : case ElementType::STAFF_STATE: return new StaffState(parent);
235 0 : case ElementType::TEMPO_TEXT: return new TempoText(parentOfTypeOrDummy<Segment>(parentItem, dummy));
236 5 : case ElementType::HARMONY: return new Harmony(parentOfTypeOrDummy<Segment>(parentItem, dummy));
237 0 : case ElementType::FRET_DIAGRAM: return new FretDiagram(parentOfTypeOrDummy<Segment>(parentItem, dummy));
238 13 : case ElementType::HARP_DIAGRAM: return new HarpPedalDiagram(parentOfTypeOrDummy<Segment>(parentItem, dummy));
239 0 : case ElementType::BEND: return new Bend(parentOfTypeOrDummy<Note>(parentItem, dummy));
240 103 : case ElementType::GUITAR_BEND: return new GuitarBend(parentOfTypeOrDummy<Note>(parentItem, dummy));
241 4 : case ElementType::TREMOLOBAR: return new TremoloBar(parent);
242 3 : case ElementType::LYRICS: return new Lyrics(parentOfTypeOrDummy<ChordRest>(parentItem, dummy));
243 4 : case ElementType::LYRICSLINE: return new LyricsLine(parent);
244 48 : case ElementType::FIGURED_BASS: return new FiguredBass(parentOfTypeOrDummy<Segment>(parentItem, dummy));
245 0 : case ElementType::STEM: return new Stem(parentOfTypeOrDummy<Chord>(parentItem, dummy));
246 291 : case ElementType::SLUR: return new Slur(parent);
247 8 : case ElementType::HAMMER_ON_PULL_OFF: return new HammerOnPullOff(parent);
248 1059 : case ElementType::TIE: return new Tie(parent);
249 0 : case ElementType::TUPLET: return new Tuplet(parentOfTypeOrDummy<Measure>(parentItem, dummy));
250 0 : case ElementType::FINGERING: return new Fingering(parentOfTypeOrDummy<Note>(parentItem, dummy));
251 85 : case ElementType::HBOX: return new HBox(score);
252 698 : case ElementType::VBOX: return new VBox(score);
253 101 : case ElementType::TBOX: return new TBox(score);
254 5 : case ElementType::FBOX: return new FBox(score);
255 0 : case ElementType::MEASURE: return new Measure(score);
256 0 : case ElementType::TAB_DURATION_SYMBOL: return new TabDurationSymbol(parentOfTypeOrDummy<ChordRest>(parentItem, dummy));
257 0 : case ElementType::IMAGE: return new Image(parent);
258 0 : case ElementType::BAGPIPE_EMBELLISHMENT: return new BagpipeEmbellishment(parent);
259 0 : case ElementType::AMBITUS: return new Ambitus(parentOfTypeOrDummy<Segment>(parentItem, dummy));
260 31 : case ElementType::STICKING: return new Sticking(parentOfTypeOrDummy<Segment>(parentItem, dummy));
261 0 : case ElementType::TRIPLET_FEEL: return new TripletFeel(parentOfTypeOrDummy<Segment>(parentItem, dummy));
262 0 : case ElementType::STRING_TUNINGS: return new StringTunings(parentOfTypeOrDummy<Segment>(parentItem, dummy));
263 0 : case ElementType::TIME_TICK_ANCHOR: return new TimeTickAnchor(parentOfTypeOrDummy<Segment>(parentItem, dummy));
264 0 : case ElementType::LAISSEZ_VIB: return new LaissezVib(parentOfTypeOrDummy<Note>(parentItem, dummy));
265 0 : case ElementType::PARTIAL_TIE: return new PartialTie(parentOfTypeOrDummy<Note>(parentItem, dummy));
266 9 : case ElementType::PARTIAL_LYRICSLINE: return new PartialLyricsLine(parent);
267 0 : case ElementType::PARENTHESIS: return new Parenthesis(parent);
268 :
269 0 : case ElementType::TEXTLINE_BASE:
270 : case ElementType::TEXTLINE_SEGMENT:
271 : case ElementType::GLISSANDO_SEGMENT:
272 : case ElementType::NOTELINE_SEGMENT:
273 : case ElementType::GUITAR_BEND_SEGMENT:
274 : case ElementType::GUITAR_BEND_HOLD:
275 : case ElementType::GUITAR_BEND_HOLD_SEGMENT:
276 : case ElementType::GUITAR_BEND_TEXT:
277 : case ElementType::SLUR_SEGMENT:
278 : case ElementType::TIE_SEGMENT:
279 : case ElementType::LAISSEZ_VIB_SEGMENT:
280 : case ElementType::PARTIAL_TIE_SEGMENT:
281 : case ElementType::STEM_SLASH:
282 : case ElementType::PAGE:
283 : case ElementType::BEAM:
284 : case ElementType::HOOK:
285 : case ElementType::HAIRPIN_SEGMENT:
286 : case ElementType::OTTAVA_SEGMENT:
287 : case ElementType::TRILL_SEGMENT:
288 : case ElementType::LET_RING_SEGMENT:
289 : case ElementType::GRADUAL_TEMPO_CHANGE_SEGMENT:
290 : case ElementType::VIBRATO_SEGMENT:
291 : case ElementType::PALM_MUTE_SEGMENT:
292 : case ElementType::WHAMMY_BAR_SEGMENT:
293 : case ElementType::RASGUEADO_SEGMENT:
294 : case ElementType::HARMONIC_MARK_SEGMENT:
295 : case ElementType::PICK_SCRAPE_SEGMENT:
296 : case ElementType::VOLTA_SEGMENT:
297 : case ElementType::PEDAL_SEGMENT:
298 : case ElementType::LYRICSLINE_SEGMENT:
299 : case ElementType::PARTIAL_LYRICSLINE_SEGMENT:
300 : case ElementType::LEDGER_LINE:
301 : case ElementType::STAFF_LINES:
302 : case ElementType::SELECTION:
303 : case ElementType::LASSO:
304 : case ElementType::SHADOW_NOTE:
305 : case ElementType::SEGMENT:
306 : case ElementType::SYSTEM:
307 : case ElementType::MAXTYPE:
308 : case ElementType::INVALID:
309 : case ElementType::PART:
310 : case ElementType::SHARED_PART:
311 : case ElementType::STAFF:
312 : case ElementType::SCORE:
313 : case ElementType::BRACKET_ITEM:
314 : case ElementType::GRACE_NOTES_GROUP:
315 : case ElementType::ROOT_ITEM:
316 : case ElementType::FIGURED_BASS_ITEM:
317 : case ElementType::DUMMY:
318 : case ElementType::SYSTEM_LOCK_INDICATOR:
319 : case ElementType::PAGE_LOCK_INDICATOR:
320 : case ElementType::HAMMER_ON_PULL_OFF_SEGMENT:
321 : case ElementType::HAMMER_ON_PULL_OFF_TEXT:
322 : case ElementType::TAPPING_HALF_SLUR:
323 : case ElementType::TAPPING_HALF_SLUR_SEGMENT:
324 : case ElementType::TAPPING_TEXT:
325 0 : break;
326 : }
327 :
328 0 : LOGD() << "Cannot create element of type " << static_cast<int>(type) << " (" << TConv::toXml(type) << ")";
329 :
330 0 : return nullptr;
331 : }
332 :
333 4420 : EngravingItem* Factory::createItemByName(const AsciiStringView& name, DummyParentOr<EngravingItem> parent, bool isAccessibleEnabled)
334 : {
335 4420 : ElementType type = TConv::fromXml(name, ElementType::INVALID, isAccessibleEnabled);
336 4420 : if (type == ElementType::INVALID) {
337 0 : LOGE() << "Invalid type: " << name;
338 0 : return nullptr;
339 : }
340 4420 : return createItem(type, parent, isAccessibleEnabled);
341 : }
342 :
343 : #define CREATE_ITEM_IMPL(T, P, isAccessibleEnabled) \
344 : T* Factory::create##T(P parent, bool isAccessibleEnabled) \
345 : { \
346 : T* e = new T(parent); \
347 : e->setAccessibleEnabled(isAccessibleEnabled); \
348 : return e; \
349 : } \
350 :
351 : #define MAKE_ITEM_IMPL(T, P) \
352 : std::shared_ptr<T> Factory::make##T(P parent) \
353 : { \
354 : return std::shared_ptr<T>(create##T(parent)); \
355 : } \
356 :
357 : #define COPY_ITEM_IMPL(T) \
358 : T* Factory::copy##T(const T& src) \
359 : { \
360 : T* copy = new T(src); \
361 : return copy; \
362 : } \
363 :
364 4941 : CREATE_ITEM_IMPL(Accidental, DummyParentOr<EngravingItem>, isAccessibleEnabled)
365 0 : MAKE_ITEM_IMPL(Accidental, DummyParentOr<EngravingItem>)
366 :
367 2 : CREATE_ITEM_IMPL(Ambitus, DummyParentOr<Segment>, isAccessibleEnabled)
368 0 : MAKE_ITEM_IMPL(Ambitus, DummyParentOr<Segment>)
369 :
370 144 : CREATE_ITEM_IMPL(Arpeggio, DummyParentOr<Chord>, isAccessibleEnabled)
371 0 : MAKE_ITEM_IMPL(Arpeggio, DummyParentOr<Chord>)
372 :
373 0 : CREATE_ITEM_IMPL(ChordBracket, DummyParentOr<Chord>, isAccessibleEnabled)
374 0 : MAKE_ITEM_IMPL(ChordBracket, DummyParentOr<Chord>)
375 :
376 986 : CREATE_ITEM_IMPL(Articulation, DummyParentOr<ChordRest>, isAccessibleEnabled)
377 0 : MAKE_ITEM_IMPL(Articulation, DummyParentOr<ChordRest>)
378 :
379 35 : CREATE_ITEM_IMPL(Tapping, DummyParentOr<ChordRest>, isAccessibleEnabled)
380 0 : MAKE_ITEM_IMPL(Tapping, DummyParentOr<ChordRest>)
381 :
382 277 : CREATE_ITEM_IMPL(Ornament, DummyParentOr<ChordRest>, isAccessibleEnabled)
383 0 : MAKE_ITEM_IMPL(Ornament, DummyParentOr<ChordRest>)
384 :
385 27880 : CREATE_ITEM_IMPL(BarLine, DummyParentOr<Segment>, isAccessibleEnabled)
386 6 : COPY_ITEM_IMPL(BarLine)
387 0 : MAKE_ITEM_IMPL(BarLine, DummyParentOr<Segment>)
388 :
389 2872 : CREATE_ITEM_IMPL(Beam, Score*, isAccessibleEnabled)
390 0 : MAKE_ITEM_IMPL(Beam, Score*)
391 :
392 4 : CREATE_ITEM_IMPL(Bend, DummyParentOr<Note>, isAccessibleEnabled)
393 0 : MAKE_ITEM_IMPL(Bend, DummyParentOr<Note>)
394 :
395 2069 : CREATE_ITEM_IMPL(Bracket, DummyParentOr<EngravingItem>, isAccessibleEnabled)
396 0 : MAKE_ITEM_IMPL(Bracket, DummyParentOr<EngravingItem>)
397 :
398 943 : BracketItem* Factory::createBracketItem(DummyParentOr<EngravingItem> parent)
399 : {
400 943 : BracketItem* bi = new BracketItem(parent);
401 943 : return bi;
402 : }
403 :
404 3 : BracketItem* Factory::createBracketItem(DummyParentOr<EngravingItem> parent, BracketType bracketType, size_t span)
405 : {
406 3 : BracketItem* bi = new BracketItem(parent, bracketType, span);
407 3 : return bi;
408 : }
409 :
410 120 : CREATE_ITEM_IMPL(Breath, DummyParentOr<Segment>, isAccessibleEnabled)
411 0 : MAKE_ITEM_IMPL(Breath, DummyParentOr<Segment>)
412 :
413 30065 : CREATE_ITEM_IMPL(Chord, DummyParentOr<Segment>, isAccessibleEnabled)
414 :
415 522 : Chord* Factory::copyChord(const Chord& src, bool link)
416 : {
417 522 : Chord* copy = new Chord(src, link);
418 522 : copy->setAccessibleEnabled(src.accessibleEnabled());
419 :
420 522 : return copy;
421 : }
422 0 : MAKE_ITEM_IMPL(Chord, DummyParentOr<Segment>)
423 :
424 158 : CREATE_ITEM_IMPL(ChordLine, DummyParentOr<Chord>, isAccessibleEnabled)
425 4 : COPY_ITEM_IMPL(ChordLine)
426 0 : MAKE_ITEM_IMPL(ChordLine, DummyParentOr<Chord>)
427 :
428 6618 : CREATE_ITEM_IMPL(Clef, DummyParentOr<Segment>, isAccessibleEnabled)
429 14 : COPY_ITEM_IMPL(Clef)
430 0 : MAKE_ITEM_IMPL(Clef, DummyParentOr<Segment>)
431 :
432 0 : CREATE_ITEM_IMPL(DeadSlapped, Rest*, isAccessibleEnabled)
433 0 : COPY_ITEM_IMPL(DeadSlapped)
434 :
435 202 : CREATE_ITEM_IMPL(Fermata, DummyParentOr<Segment>, isAccessibleEnabled)
436 0 : MAKE_ITEM_IMPL(Fermata, DummyParentOr<Segment>)
437 :
438 52 : CREATE_ITEM_IMPL(FiguredBass, DummyParentOr<Segment>, isAccessibleEnabled)
439 0 : MAKE_ITEM_IMPL(FiguredBass, DummyParentOr<Segment>)
440 :
441 130 : CREATE_ITEM_IMPL(FretDiagram, DummyParentOr<Segment>, isAccessibleEnabled)
442 0 : COPY_ITEM_IMPL(FretDiagram)
443 0 : MAKE_ITEM_IMPL(FretDiagram, DummyParentOr<Segment>)
444 :
445 9 : CREATE_ITEM_IMPL(HarpPedalDiagram, DummyParentOr<Segment>, isAccessibleEnabled)
446 0 : COPY_ITEM_IMPL(HarpPedalDiagram)
447 0 : MAKE_ITEM_IMPL(HarpPedalDiagram, DummyParentOr<Segment>);
448 :
449 6946 : CREATE_ITEM_IMPL(KeySig, DummyParentOr<Segment>, isAccessibleEnabled)
450 18 : COPY_ITEM_IMPL(KeySig)
451 0 : MAKE_ITEM_IMPL(KeySig, DummyParentOr<Segment>)
452 :
453 21 : CREATE_ITEM_IMPL(LaissezVib, DummyParentOr<Note>, isAccessibleEnabled)
454 0 : COPY_ITEM_IMPL(LaissezVib);
455 :
456 942 : CREATE_ITEM_IMPL(LayoutBreak, DummyParentOr<MeasureBase>, isAccessibleEnabled)
457 0 : COPY_ITEM_IMPL(LayoutBreak)
458 0 : MAKE_ITEM_IMPL(LayoutBreak, DummyParentOr<MeasureBase>)
459 :
460 1778 : CREATE_ITEM_IMPL(Lyrics, DummyParentOr<ChordRest>, isAccessibleEnabled)
461 2 : COPY_ITEM_IMPL(Lyrics)
462 :
463 243 : CREATE_ITEM_IMPL(LyricsLine, DummyParentOr<EngravingItem>, isAccessibleEnabled)
464 0 : COPY_ITEM_IMPL(LyricsLine)
465 :
466 17166 : CREATE_ITEM_IMPL(Measure, Score*, isAccessibleEnabled)
467 0 : COPY_ITEM_IMPL(Measure)
468 :
469 134 : CREATE_ITEM_IMPL(MeasureRepeat, DummyParentOr<Segment>, isAccessibleEnabled)
470 0 : COPY_ITEM_IMPL(MeasureRepeat)
471 :
472 19 : CREATE_ITEM_IMPL(StringTunings, DummyParentOr<Segment>, isAccessibleEnabled)
473 0 : COPY_ITEM_IMPL(StringTunings)
474 0 : MAKE_ITEM_IMPL(StringTunings, DummyParentOr<Segment>);
475 :
476 35735 : CREATE_ITEM_IMPL(Note, DummyParentOr<Chord>, isAccessibleEnabled)
477 5509 : Note* Factory::copyNote(const Note& src, bool link)
478 : {
479 5509 : Note* copy = new Note(src, link);
480 5509 : copy->setAccessibleEnabled(src.accessibleEnabled());
481 :
482 5509 : return copy;
483 : }
484 0 : MAKE_ITEM_IMPL(Note, DummyParentOr<Chord>)
485 :
486 677 : CREATE_ITEM_IMPL(NoteDot, DummyParentOr<Note>, isAccessibleEnabled)
487 145 : CREATE_ITEM_IMPL(NoteDot, Rest*, isAccessibleEnabled)
488 37 : COPY_ITEM_IMPL(NoteDot)
489 :
490 0 : CREATE_ITEM_IMPL(NoteLine, DummyParentOr<Note>, isAccessibleEnabled)
491 0 : MAKE_ITEM_IMPL(NoteLine, DummyParentOr<Note>);
492 :
493 3554 : CREATE_ITEM_IMPL(Page, Score*, isAccessibleEnabled)
494 :
495 56 : PageLockIndicator* Factory::createPageLockIndicator(DummyParentOr<System> parent, const RangeLock * lock, bool isAccessibleEnabled)
496 : {
497 56 : PageLockIndicator* pli = new PageLockIndicator(parent, lock);
498 56 : pli->setAccessibleEnabled(isAccessibleEnabled);
499 56 : return pli;
500 : }
501 :
502 0 : COPY_ITEM_IMPL(PageLockIndicator)
503 :
504 63 : CREATE_ITEM_IMPL(PartialTie, DummyParentOr<Note>, isAccessibleEnabled)
505 0 : COPY_ITEM_IMPL(PartialTie)
506 :
507 2 : CREATE_ITEM_IMPL(PartialLyricsLine, DummyParentOr<EngravingItem>, isAccessibleEnabled)
508 0 : COPY_ITEM_IMPL(PartialLyricsLine)
509 :
510 18415 : CREATE_ITEM_IMPL(Rest, DummyParentOr<Segment>, isAccessibleEnabled)
511 :
512 2912 : Rest* Factory::createRest(DummyParentOr<Segment> parent, const TDuration& t, bool isAccessibleEnabled)
513 : {
514 2912 : Rest* r = new Rest(parent, t);
515 2912 : r->setAccessibleEnabled(isAccessibleEnabled);
516 :
517 2912 : return r;
518 : }
519 :
520 1 : Rest* Factory::copyRest(const Rest& src, bool link)
521 : {
522 1 : Rest* copy = new Rest(src, link);
523 1 : copy->setAccessibleEnabled(src.accessibleEnabled());
524 :
525 1 : return copy;
526 : }
527 :
528 0 : CREATE_ITEM_IMPL(Segment, DummyParentOr<Measure>, isAccessibleEnabled)
529 :
530 69023 : Segment* Factory::createSegment(DummyParentOr<Measure> parent, SegmentType type, const Fraction& t, bool isAccessibleEnabled)
531 : {
532 69023 : Segment* s = new Segment(parent, type, t);
533 69023 : s->setAccessibleEnabled(isAccessibleEnabled);
534 :
535 69023 : return s;
536 : }
537 :
538 177 : CREATE_ITEM_IMPL(Slur, DummyParentOr<EngravingItem>, isAccessibleEnabled)
539 0 : MAKE_ITEM_IMPL(Slur, DummyParentOr<EngravingItem>)
540 :
541 1 : CREATE_ITEM_IMPL(Spacer, DummyParentOr<Measure>, isAccessibleEnabled)
542 0 : MAKE_ITEM_IMPL(Spacer, DummyParentOr<Measure>)
543 :
544 3558 : Staff* Factory::createStaff(Part * parent)
545 : {
546 3558 : Staff* staff = new Staff(parent);
547 3558 : staff->setPart(parent);
548 3558 : return staff;
549 : }
550 :
551 24600 : CREATE_ITEM_IMPL(StaffLines, DummyParentOr<Measure>, isAccessibleEnabled)
552 0 : COPY_ITEM_IMPL(StaffLines)
553 :
554 0 : CREATE_ITEM_IMPL(StaffState, DummyParentOr<EngravingItem>, isAccessibleEnabled)
555 :
556 18 : CREATE_ITEM_IMPL(StaffTypeChange, DummyParentOr<MeasureBase>, isAccessibleEnabled)
557 0 : MAKE_ITEM_IMPL(StaffTypeChange, DummyParentOr<MeasureBase>)
558 :
559 591 : StaffText* Factory::createStaffText(DummyParentOr<Segment> parent, TextStyleType textStyleType, bool isAccessibleEnabled)
560 : {
561 591 : StaffText* staffText = new StaffText(parent, textStyleType);
562 591 : staffText->setAccessibleEnabled(isAccessibleEnabled);
563 :
564 591 : return staffText;
565 : }
566 :
567 2 : StaveSharingLabel* Factory::createStaveSharingLabel(DummyParentOr<Segment> parent, TextStyleType textStyleType, bool isAccessibleEnabled)
568 : {
569 2 : StaveSharingLabel* staveSharingLabel = new StaveSharingLabel(parent, textStyleType);
570 2 : staveSharingLabel->setAccessibleEnabled(isAccessibleEnabled);
571 2 : return staveSharingLabel;
572 : }
573 :
574 9 : CREATE_ITEM_IMPL(SoundFlag, DummyParentOr<EngravingItem>, isAccessibleEnabled)
575 :
576 33 : CREATE_ITEM_IMPL(Expression, DummyParentOr<Segment>, isAccessibleEnabled)
577 :
578 36 : CREATE_ITEM_IMPL(RehearsalMark, DummyParentOr<Segment>, isAccessibleEnabled)
579 :
580 27509 : CREATE_ITEM_IMPL(Stem, DummyParentOr<Chord>, isAccessibleEnabled)
581 2514 : COPY_ITEM_IMPL(Stem)
582 :
583 142 : CREATE_ITEM_IMPL(StemSlash, DummyParentOr<Chord>, isAccessibleEnabled)
584 0 : COPY_ITEM_IMPL(StemSlash)
585 :
586 8361 : CREATE_ITEM_IMPL(System, Score*, isAccessibleEnabled)
587 :
588 14 : SystemText* Factory::createSystemText(DummyParentOr<Segment> parent, TextStyleType textStyleType, ElementType type,
589 : bool isAccessibleEnabled)
590 : {
591 14 : SystemText* systemText = new SystemText(parent, textStyleType, type);
592 14 : systemText->setAccessibleEnabled(isAccessibleEnabled);
593 :
594 14 : return systemText;
595 : }
596 :
597 0 : CREATE_ITEM_IMPL(InstrumentChange, DummyParentOr<Segment>, isAccessibleEnabled)
598 :
599 22 : InstrumentChange* Factory::createInstrumentChange(DummyParentOr<Segment> parent, const Instrument& instrument,
600 : bool isAccessibleEnabled)
601 : {
602 22 : InstrumentChange* instrumentChange = new InstrumentChange(instrument, parent);
603 22 : instrumentChange->setAccessibleEnabled(isAccessibleEnabled);
604 :
605 22 : return instrumentChange;
606 : }
607 :
608 28 : CREATE_ITEM_IMPL(Sticking, DummyParentOr<Segment>, isAccessibleEnabled)
609 :
610 209 : CREATE_ITEM_IMPL(Fingering, DummyParentOr<Note>, isAccessibleEnabled)
611 :
612 73 : Fingering* Factory::createFingering(DummyParentOr<Note> parent, TextStyleType textStyleType,
613 : bool isAccessibleEnabled)
614 : {
615 73 : Fingering* fingering = new Fingering(parent, textStyleType);
616 73 : fingering->setAccessibleEnabled(isAccessibleEnabled);
617 :
618 73 : return fingering;
619 : }
620 :
621 993 : CREATE_ITEM_IMPL(Harmony, DummyParentOr<EngravingItem>, isAccessibleEnabled)
622 :
623 748 : CREATE_ITEM_IMPL(TempoText, DummyParentOr<Segment>, isAccessibleEnabled)
624 :
625 15355 : Text* Factory::createText(DummyParentOr<EngravingItem> parent, TextStyleType tid, bool isAccessibleEnabled)
626 : {
627 15355 : Text* t = new Text(parent, tid);
628 15355 : t->setAccessibleEnabled(isAccessibleEnabled);
629 :
630 15355 : return t;
631 : }
632 :
633 0 : COPY_ITEM_IMPL(Text)
634 :
635 611 : CREATE_ITEM_IMPL(Tie, DummyParentOr<EngravingItem>, isAccessibleEnabled)
636 425 : Tie* Factory::copyTie(const Tie& src)
637 : {
638 425 : Tie* copy = src.isLaissezVib() ? new LaissezVib(*toLaissezVib(&src)) : new Tie(src);
639 425 : copy->setAccessibleEnabled(src.accessibleEnabled());
640 :
641 425 : return copy;
642 : }
643 :
644 3599 : CREATE_ITEM_IMPL(TimeSig, DummyParentOr<Segment>, isAccessibleEnabled)
645 90 : COPY_ITEM_IMPL(TimeSig)
646 0 : MAKE_ITEM_IMPL(TimeSig, DummyParentOr<Segment>)
647 :
648 73 : CREATE_ITEM_IMPL(TremoloTwoChord, DummyParentOr<Chord>, isAccessibleEnabled)
649 8 : COPY_ITEM_IMPL(TremoloTwoChord)
650 0 : MAKE_ITEM_IMPL(TremoloTwoChord, DummyParentOr<Chord>)
651 :
652 146 : CREATE_ITEM_IMPL(TremoloSingleChord, DummyParentOr<Chord>, isAccessibleEnabled)
653 2 : COPY_ITEM_IMPL(TremoloSingleChord)
654 0 : MAKE_ITEM_IMPL(TremoloSingleChord, DummyParentOr<Chord>)
655 :
656 26 : CREATE_ITEM_IMPL(TremoloBar, DummyParentOr<EngravingItem>, isAccessibleEnabled)
657 0 : MAKE_ITEM_IMPL(TremoloBar, DummyParentOr<EngravingItem>)
658 :
659 874 : CREATE_ITEM_IMPL(Tuplet, DummyParentOr<Measure>, isAccessibleEnabled)
660 4 : COPY_ITEM_IMPL(Tuplet)
661 :
662 54 : CREATE_ITEM_IMPL(Hairpin, DummyParentOr<EngravingItem>, isAccessibleEnabled)
663 0 : MAKE_ITEM_IMPL(Hairpin, DummyParentOr<EngravingItem>)
664 :
665 44 : CREATE_ITEM_IMPL(HammerOnPullOff, DummyParentOr<EngravingItem>, isAccessibleEnabled)
666 0 : MAKE_ITEM_IMPL(HammerOnPullOff, DummyParentOr<EngravingItem>)
667 :
668 65 : CREATE_ITEM_IMPL(Glissando, DummyParentOr<EngravingItem>, isAccessibleEnabled)
669 0 : MAKE_ITEM_IMPL(Glissando, DummyParentOr<EngravingItem>)
670 :
671 0 : CREATE_ITEM_IMPL(GuitarBend, DummyParentOr<Note>, isAccessibleEnabled)
672 0 : MAKE_ITEM_IMPL(GuitarBend, DummyParentOr<Note>)
673 :
674 53 : CREATE_ITEM_IMPL(Jump, DummyParentOr<Measure>, isAccessibleEnabled)
675 :
676 12 : CREATE_ITEM_IMPL(Trill, DummyParentOr<EngravingItem>, isAccessibleEnabled)
677 :
678 0 : TripletFeel* Factory::createTripletFeel(DummyParentOr<Segment> parent, TripletFeelType type, bool isAccessibleEnabled)
679 : {
680 0 : TripletFeel* t = new TripletFeel(parent, type);
681 0 : t->setAccessibleEnabled(isAccessibleEnabled);
682 :
683 0 : return t;
684 : }
685 :
686 0 : CREATE_ITEM_IMPL(Vibrato, DummyParentOr<EngravingItem>, isAccessibleEnabled)
687 :
688 4 : CREATE_ITEM_IMPL(TextLine, DummyParentOr<EngravingItem>, isAccessibleEnabled)
689 0 : MAKE_ITEM_IMPL(TextLine, DummyParentOr<EngravingItem>);
690 :
691 29 : CREATE_ITEM_IMPL(Ottava, DummyParentOr<EngravingItem>, isAccessibleEnabled)
692 :
693 5 : CREATE_ITEM_IMPL(LetRing, DummyParentOr<EngravingItem>, isAccessibleEnabled)
694 :
695 49 : CREATE_ITEM_IMPL(Marker, DummyParentOr<EngravingItem>, isAccessibleEnabled)
696 :
697 10 : Marker* Factory::createMarker(DummyParentOr<EngravingItem> parent, TextStyleType tid, bool isAccessibleEnabled)
698 : {
699 10 : Marker* m = new Marker(parent, tid);
700 10 : m->setAccessibleEnabled(isAccessibleEnabled);
701 :
702 10 : return m;
703 : }
704 :
705 0 : MAKE_ITEM_IMPL(Marker, DummyParentOr<EngravingItem>)
706 :
707 5 : CREATE_ITEM_IMPL(GradualTempoChange, DummyParentOr<EngravingItem>, isAccessibleEnabled)
708 :
709 0 : CREATE_ITEM_IMPL(PalmMute, DummyParentOr<EngravingItem>, isAccessibleEnabled)
710 :
711 0 : CREATE_ITEM_IMPL(WhammyBar, DummyParentOr<EngravingItem>, isAccessibleEnabled)
712 0 : MAKE_ITEM_IMPL(WhammyBar, DummyParentOr<EngravingItem>)
713 :
714 0 : CREATE_ITEM_IMPL(Rasgueado, DummyParentOr<EngravingItem>, isAccessibleEnabled)
715 :
716 0 : CREATE_ITEM_IMPL(HarmonicMark, DummyParentOr<EngravingItem>, isAccessibleEnabled)
717 :
718 0 : CREATE_ITEM_IMPL(PickScrape, DummyParentOr<EngravingItem>, isAccessibleEnabled)
719 :
720 37 : CREATE_ITEM_IMPL(Volta, DummyParentOr<EngravingItem>, isAccessibleEnabled)
721 :
722 27 : CREATE_ITEM_IMPL(Pedal, DummyParentOr<EngravingItem>, isAccessibleEnabled)
723 :
724 748 : CREATE_ITEM_IMPL(Dynamic, DummyParentOr<Segment>, isAccessibleEnabled)
725 :
726 107 : CREATE_ITEM_IMPL(MMRest, DummyParentOr<Segment>, isAccessibleEnabled)
727 :
728 3 : CREATE_ITEM_IMPL(VBox, Score*, isAccessibleEnabled)
729 :
730 528 : VBox* Factory::createTitleVBox(Score * parent, bool isAccessibleEnabled)
731 : {
732 528 : VBox* b = new VBox(parent);
733 528 : b->setAccessibleEnabled(isAccessibleEnabled);
734 528 : b->setSizeIsSpatiumDependent(false);
735 528 : b->setTick(Fraction(0, 1));
736 :
737 528 : return b;
738 : }
739 :
740 2 : CREATE_ITEM_IMPL(HBox, Score*, isAccessibleEnabled)
741 :
742 1 : CREATE_ITEM_IMPL(TBox, Score*, isAccessibleEnabled)
743 :
744 0 : CREATE_ITEM_IMPL(FBox, Score*, isAccessibleEnabled)
745 :
746 3 : Image* Factory::createImage(DummyParentOr<EngravingItem> parent)
747 : {
748 3 : Image* image = new Image(parent);
749 :
750 3 : return image;
751 : }
752 :
753 20 : CREATE_ITEM_IMPL(Symbol, DummyParentOr<EngravingItem>, isAccessibleEnabled)
754 0 : CREATE_ITEM_IMPL(FSymbol, DummyParentOr<EngravingItem>, isAccessibleEnabled)
755 :
756 6 : CREATE_ITEM_IMPL(PlayCountText, DummyParentOr<Segment>, isAccessibleEnabled)
757 :
758 26 : PlayTechAnnotation* Factory::createPlayTechAnnotation(DummyParentOr<Segment> parent, PlayingTechniqueType techniqueType,
759 : TextStyleType styleType,
760 : bool isAccessibleEnabled)
761 : {
762 26 : PlayTechAnnotation* annotation = new PlayTechAnnotation(parent, techniqueType, styleType);
763 26 : annotation->setAccessibleEnabled(isAccessibleEnabled);
764 :
765 26 : return annotation;
766 : }
767 :
768 7 : CREATE_ITEM_IMPL(Capo, DummyParentOr<Segment>, isAccessibleEnabled)
769 0 : MAKE_ITEM_IMPL(Capo, DummyParentOr<Segment>);
770 :
771 213 : CREATE_ITEM_IMPL(TimeTickAnchor, DummyParentOr<Segment>, isAccessibleEnabled)
772 :
773 48 : CREATE_ITEM_IMPL(StaffVisibilityIndicator, DummyParentOr<System>, isAccessibleEnabled)
774 :
775 99 : SystemLockIndicator* Factory::createSystemLockIndicator(DummyParentOr<System> parent, const RangeLock * lock, bool isAccessibleEnabled)
776 : {
777 99 : SystemLockIndicator* sli = new SystemLockIndicator(parent, lock);
778 99 : sli->setAccessibleEnabled(isAccessibleEnabled);
779 99 : return sli;
780 : }
781 :
782 0 : COPY_ITEM_IMPL(SystemLockIndicator)
783 :
784 506 : CREATE_ITEM_IMPL(Parenthesis, DummyParentOr<EngravingItem>, isAccessibleEnabled);
785 0 : COPY_ITEM_IMPL(Parenthesis)
|