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