Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
muselementfactory.h
Go to the documentation of this file.
1 
10 #ifndef MUSELEMENTFACTORY_H_
11 #define MUSELEMENTFACTORY_H_
12 #include "core/barline.h"
13 
14 #include "core/staff.h"
15 #include "core/muselement.h"
16 #include "core/clef.h"
17 #include "core/keysignature.h"
18 #include "core/timesignature.h"
19 #include "core/voice.h"
20 #include "core/rest.h"
21 #include "core/slur.h"
22 #include "core/functionmark.h"
23 #include "core/lyricscontext.h"
24 #include "core/syllable.h"
25 #include "core/mark.h"
26 #include "core/articulation.h"
27 #include "core/fermata.h"
28 #include "core/tempo.h"
29 #include "core/ritardando.h"
30 #include "core/crescendo.h"
31 #include "core/repeatmark.h"
32 #include "core/fingering.h"
33 #include "core/playablelength.h"
34 #include "core/diatonickey.h"
35 
36 class CAMusElement;
37 
39 public:
42 
44 
45  void removeMusElem( bool bReallyRemove = false );
46 
47  void configureMusElem( CAMusElement &roMusElement );
48 
49  inline CAMusElement *musElement() { return mpoMusElement; };
50  inline void setMusElement( CAMusElement *elt ) { mpoMusElement = elt; }
51 
53  inline void emptyMusElem() { mpoMusElement = mpoEmpty; }
54 
55  bool configureClef( CAStaff *staff,
56  CAMusElement *right );
57 
58  bool configureKeySignature( CAStaff *staff,
59  CAMusElement *right );
60 
61  bool configureTimeSignature( CAStaff *staff,
62  CAMusElement *right );
63 
64  bool configureBarline( CAStaff *staff,
65  CAMusElement *right );
66 
67  bool configureRest( CAVoice *voice,
68  CAMusElement *right );
69 
70 
71  bool configureNote( int pitch,
72  CAVoice *voice,
73  CAMusElement *right,
74  bool addToChord
75  );
76 
77  static void placeAutoBar( CAPlayable* elt );
78 
79  bool configureTuplet( QList<CAPlayable*> listOfNotes );
80 
81  bool configureSlur( CAStaff *staff,
82  CANote *noteStart, CANote *noteEnd );
83 
84  bool configureMark( CAMusElement *elt );
85 
87  int timeStart, int timeLength );
88 
91 
93 
96 
97  void addPlayableDotted( int add, CAPlayableLength curLength );
98 
100 
102  { _eNoteStemDirection = eDir; }
103 
104  inline int noteAccs() { return _iNoteAccs; };
105 
106  inline void setNoteAccs( int iNoteAccs )
107  { _iNoteAccs = iNoteAccs; };
108 
109  inline void addNoteAccs( int iAdd )
110  { if (_iNoteAccs+iAdd < 3) _iNoteAccs+= iAdd; };
111 
112  inline void subNoteAccs( int iSub )
113  { if (_iNoteAccs-iSub > -3) _iNoteAccs-= iSub; };
114 
116  inline void setDiatonicKeyNumberOfAccs(int accs) { _diatonicKeyNumberOfAccs = accs; }
119 
120  inline int noteExtraAccs() { return _iNoteExtraAccs; };
121 
122  inline void setNoteExtraAccs( int iNoteExtraAccs )
123  { _iNoteExtraAccs = iNoteExtraAccs; };
124 
125  inline void addNoteExtraAccs( int iAdd )
126  { _iNoteExtraAccs += iAdd; };
127 
128  inline void subNoteExtraAccs( int iSub )
129  { _iNoteExtraAccs -= iSub; };
130 
132 
133  inline void setRestType(CARest::CARestType eType)
134  { _eRestType = eType; }
135 
136  inline int timeSigBeats() { return _iTimeSigBeats; }
137  inline void setTimeSigBeats( int iTimeSigBeats )
138  { _iTimeSigBeats = iTimeSigBeats; };
139 
140  inline int timeSigBeat() { return _iTimeSigBeat; }
141  inline void setTimeSigBeat( int iTimeSigBeat )
142  { _iTimeSigBeat = iTimeSigBeat; };
143 
145  inline void setClef( CAClef::CAPredefinedClefType eClefType )
146  { _eClef = eClefType; };
147 
148  inline int clefOffset() { return _iClefOffset; } // readable offset interval, not internal offset
149  inline void setClefOffset( int offset )
150  { _iClefOffset= offset; };
151 
154  { _eBarlineType = type; }
155 
156  inline int tupletNumber() { return _tupletNumber; }
157  inline void setTupletNumber( int number ) { _tupletNumber = number; }
158 
159  inline int tupletActualNumber() { return _tupletActualNumber; }
160  inline void setTupletActualNumber( int actualNumber ) { _tupletActualNumber = actualNumber; }
161 
163  inline void setSlurType( CASlur::CASlurType type ) { _eSlurType = type; }
164 
166  inline void setSlurStyle( CASlur::CASlurStyle style ) { _slurStyle = style; }
167 
168  inline CAMark::CAMarkType markType() { return _markType; }
169  inline void setMarkType( CAMark::CAMarkType t ) { _markType = t; }
170 
173 
176 
179 
182 
183  inline bool isFMFunctionMinor() { return _fmFunctionMinor; }
184  inline void setFMFunctionMinor( bool m ) { _fmFunctionMinor = m; }
185 
186  inline bool isFMTonicDegreeMinor() { return _fmTonicDegreeMinor; }
187  inline void setFMTonicDegreeMinor( bool m ) { _fmTonicDegreeMinor = m; }
188 
189  inline bool isFMChordAreaMinor() { return _fmChordAreaMinor; }
190  inline void setFMChordAreaMinor( bool m ) { _fmChordAreaMinor = m; }
191 
192  inline bool isFMEllipse() { return _fmEllipse; }
193  inline void setFMEllipse( bool e ) { _fmEllipse = e; }
194 
195  inline const QString dynamicText() { return _dynamicText; }
196  inline void setDynamicText( const QString t ) { _dynamicText = t; }
197 
198  inline const int dynamicVolume() { return _dynamicVolume; }
199  inline void setDynamicVolume( const int vol ) { _dynamicVolume = vol; }
200 
201  inline const int instrument() { return _instrument; }
202  inline void setInstrument( const int instrument ) { _instrument = instrument; }
203 
205  inline void setFermataType( const CAFermata::CAFermataType type ) { _fermataType = type; }
206 
207  inline const int tempoBpm() { return _tempoBpm; }
208  inline void setTempoBpm( const int tempoBpm ) { _tempoBpm = tempoBpm; }
209 
210  inline CAPlayableLength& tempoBeat() { return _tempoBeat; }
211  inline void setTempoBeat( CAPlayableLength& length ) { _tempoBeat = length; }
212 
215 
216  inline const int crescendoFinalVolume() { return _crescendoFinalVolume; }
217  inline void setCrescendoFinalVolume( const int v ) { _crescendoFinalVolume = v; }
218 
221 
224 
225  inline const int repeatMarkVoltaNumber() { return _repeatMarkVoltaNumber; }
226  inline void setRepeatMarkVoltaNumber( const int n ) { _repeatMarkVoltaNumber = n; }
227 
230 
231  inline const bool isFingeringOriginal() { return _fingeringOriginal; }
232  inline void setFingeringOriginal( const int o ) { _fingeringOriginal = o; }
233 private:
234  CAMusElement *mpoMusElement; // Newly created music element itself
235  CAMusElement *mpoEmpty; // An empty (dummy) element.
236 
238  // Element creation parameters //
241 
242  // Staff music elements
243  CAPlayableLength _playableLength; // Length of note/rest to be added
244  CANote::CAStemDirection _eNoteStemDirection; // Note stem direction to be inserted
245  CASlur::CASlurType _eSlurType; // Slur type to be placed
246  int _tupletNumber; // Tuplet number of notes
247  int _tupletActualNumber; // Tuplet actual number of notes
248  int _iPlayableDotted; // Number of dots to be inserted for the note/rest
249  int _iNoteExtraAccs; // Extra note accidentals for new notes which user adds/removes with +/- keys
250  int _iNoteAccs; // Note accidentals at specific coordinates updated regularily when in insert mode
251  CARest::CARestType _eRestType; // Hidden/Normal rest
252  int _diatonicKeyNumberOfAccs; // Key signature number of accidentals
253  CADiatonicKey::CAGender _diatonicKeyGender; // Major/Minor gender of the key signature
254  int _iTimeSigBeats; // Time signature number of beats to be inserted
255  int _iTimeSigBeat; // Time signature beat to be inserted
256  CAClef::CAPredefinedClefType _eClef; // Type of the clef to be inserted
257  int _iClefOffset; // Interval offset for the clef
258  CABarline::CABarlineType _eBarlineType; // Type of the barline
259  CAMark::CAMarkType _markType; // Type of the mark
260  CAArticulation::CAArticulationType _articulationType; // Type of the articulation mark
261  CASlur::CASlurStyle _slurStyle; // Style of the slur (solid, dotted)
262 
263  // Function Mark
265  CAFunctionMark::CAFunctionType _fmChordArea; // Chord area of the function
266  CAFunctionMark::CAFunctionType _fmTonicDegree; // Tonic degree of the function
271 
272  // Marks
273  QString _dynamicText;
286 };
287 #endif // MUSELEMENTFACTORY_H_