1 /*
2   MusicXML Library
3   Copyright (C) Grame 2006-2013
4 
5   This Source Code Form is subject to the terms of the Mozilla Public
6   License, v. 2.0. If a copy of the MPL was not distributed with this
7   file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9   Grame Research Laboratory, 11, cours de Verdun Gensoul 69002 Lyon - France
10   research@grame.fr
11 */
12 
13 #ifndef ___lpsrScores___
14 #define ___lpsrScores___
15 
16 /*
17 #include <sstream>
18 #include <vector>
19 #include <string>
20 #include <list>
21 
22 
23 #include "exports.h"
24 #include "typedefs.h"
25 
26 #include "msrBasicTypes.h"
27 
28 
29 #include "lpsrVarValAssocs.h"
30 
31 #include "lpsrScheme.h"
32 */
33 
34 #include "lpsrComments.h"
35 
36 #include "lpsrScheme.h"
37 
38 #include "lpsrHeaders.h"
39 #include "lpsrPapers.h"
40 #include "lpsrLayouts.h"
41 
42 #include "lpsrParallelMusic.h"
43 #include "lpsrVarValAssocs.h"
44 
45 #include "lpsrBookBlockElements.h"
46 
47 #include "msrScores.h"
48 
49 #include "msrMidi.h"
50 
51 
52 namespace MusicXML2
53 {
54 
55 
56 //______________________________________________________________________________
57 class lpsrScore : public lpsrElement
58 {
59   public:
60 
61     // creation from MusicXML
62     // ------------------------------------------------------
63 
64     static SMARTP<lpsrScore> create (
65       int        inputLineNumber,
66       S_msrScore mScore);
67 
68   protected:
69 
70     // constructors/destructor
71     // ------------------------------------------------------
72 
73     lpsrScore (
74       int        inputLineNumber,
75       S_msrScore mScore);
76 
77     virtual ~lpsrScore ();
78 
79   public:
80 
81     // set and get
82     // ------------------------------------------------------
83 
getMsrScore()84     S_msrScore            getMsrScore () const
85                               { return fMsrScore; }
86 
87     S_lpsrVarValAssoc
getLilypondVersion()88                           getLilypondVersion () const
89                               { return fLilypondVersion; }
90 
91     void                  setScoreGlobalStaffSizeSchemeVariable (float size);
92 
93     S_lpsrSchemeVariable
getScoreGlobalStaffSizeSchemeVariable()94                           getScoreGlobalStaffSizeSchemeVariable () const
95                               { return fScoreGlobalStaffSizeSchemeVariable; }
96 
getScoreHeader()97     S_lpsrHeader          getScoreHeader () const
98                               { return fScoreHeader; }
99 
getScorePaper()100     S_lpsrPaper           getScorePaper () const
101                               { return fScorePaper; }
102 
getScoreLayout()103     S_lpsrLayout          getScoreLayout () const
104                               { return fScoreLayout; }
105 
106     const list<S_msrElement>&
getScoreElementsList()107                           getScoreElementsList () const
108                               { return fScoreElementsList; }
109 
110     const list<S_lpsrBookBlock>&
getScoreBookBlocksList()111                           getScoreBookBlocksList () const
112                               { return fScoreBookBlocksList; }
113 
getScoreScoreBlock()114     S_lpsrScoreBlock      getScoreScoreBlock () const
115                               { return fScoreScoreBlock; }
116 
117     // files includes
118     // ---------------------
119 
120     void                  setJianpuFileIncludeIsNeeded ();
121 
getJianpuFileIncludeIsNeeded()122     bool                  getJianpuFileIncludeIsNeeded () const
123                               { return fJianpuFileIncludeIsNeeded; }
124 
125     // Scheme modules
126     // ---------------------
127 
128     void                  setScmAndAccregSchemeModulesAreNeeded ();
129 
getScmAndAccregSchemeModulesAreNeeded()130     bool                  getScmAndAccregSchemeModulesAreNeeded () const
131                               { return fScmAndAccregSchemeModulesAreNeeded; }
132 
133     // Scheme functions
134     // ---------------------
135 
136     // custom short bar lines
137     void                  setCustomShortBarlineSchemeFunctionIsNeeded ();
138 
getCustomShortBarlineSchemeFunctionIsNeeded()139     bool                  getCustomShortBarlineSchemeFunctionIsNeeded () const
140                               { return fCustomShortBarlineSchemeFunctionIsNeeded; }
141 
142     // tongue
143     void                  setTongueSchemeFunctionIsNeeded ();
144 
getTongueSchemeFunctionIsNeeded()145     bool                  getTongueSchemeFunctionIsNeeded () const
146                               { return fTongueSchemeFunctionIsNeeded; }
147 
148 
149     // editorial accidentals
150     void                  setEditorialAccidentalSchemeFunctionIsNeeded ();
151 
getEditorialAccidentalSchemeFunctionIsNeeded()152     bool                  getEditorialAccidentalSchemeFunctionIsNeeded () const
153                               {
154                                 return
155                                   fEditorialAccidentalSchemeFunctionIsNeeded;
156                               }
157 
158     // dynamics
159     void                  setDynamicsSchemeFunctionIsNeeded ();
160 
getDynamicsSchemeFunctionIsNeeded()161     bool                  getDynamicsSchemeFunctionIsNeeded () const
162                               {
163                                 return
164                                   fDynamicsSchemeFunctionIsNeeded;
165                               }
166 
167     // tuplets curved brackets
168     void                  setTupletsCurvedBracketsSchemeFunctionIsNeeded ();
169 
getTupletsCurvedBracketsSchemeFunctionIsNeeded()170     bool                  getTupletsCurvedBracketsSchemeFunctionIsNeeded () const
171                               {
172                                 return
173                                   fTupletsCurvedBracketsSchemeFunctionIsNeeded;
174                               }
175 
176     // after
177     void                  setAfterSchemeFunctionIsNeeded ();
178 
getAfterSchemeFunctionIsNeeded()179     bool                  getAfterSchemeFunctionIsNeeded () const
180                               {
181                                 return
182                                   fAfterSchemeFunctionIsNeeded;
183                               }
184 
185     // tempo relationships
186     void                  setTempoRelationshipSchemeFunctionIsNeeded ();
187 
getTempoRelationshipSchemeFunctionIsNeeded()188     bool                  getTempoRelationshipSchemeFunctionIsNeeded () const
189                               {
190                                 return
191                                   fTempoRelationshipSchemeFunctionIsNeeded;
192                               }
193 
194     // glissando with text
195     void                  setGlissandoWithTextSchemeFunctionsIsNeeded ();
196 
getGlissandoWithTextSchemeFunctionsIsNeeded()197     bool                  getGlissandoWithTextSchemeFunctionsIsNeeded () const
198                               {
199                                 return
200                                   fGlissandoWithTextSchemeFunctionsIsNeeded;
201                               }
202 
203     // other dynamic
204     void                  setOtherDynamicSchemeFunctionIsNeeded ();
205 
getOtherDynamicSchemeFunctionIsNeeded()206     bool                  getOtherDynamicSchemeFunctionIsNeeded () const
207                               {
208                                 return
209                                   fOtherDynamicSchemeFunctionIsNeeded;
210                               }
211 
212     // damps
213     void                  setDampMarkupIsNeeded ();
214 
getDampMarkupIsNeeded()215     bool                  getDampMarkupIsNeeded () const
216                               {
217                                 return
218                                   fDampMarkupIsNeeded;
219                               }
220 
221     void                  setDampAllMarkupIsNeeded ();
222 
getDampAllMarkupIsNeeded()223     bool                  getDampAllMarkupIsNeeded () const
224                               {
225                                 return
226                                   fDampAllMarkupIsNeeded;
227                               }
228 
229     // white note heads
230     void                  setWhiteNoteHeadsIsNeeded ();
231 
getWhiteNoteHeadsIsNeeded()232     bool                  getWhiteNoteHeadsIsNeeded () const
233                               {
234                                 return
235                                   fWhiteNoteHeadsIsNeeded;
236                               }
237 
238     // bar numbers
239     void                  setBoxAroundNextBarNumberIsNeeded ();
240 
getBoxAroundNextBarNumberIsNeeded()241     bool                  getBoxAroundNextBarNumberIsNeeded () const
242                               {
243                                 return
244                                   fBoxAroundNextBarNumberIsNeeded;
245                               }
246 
247     // jazz chords display
248     void                  setJazzChordsDisplayIsNeeded ();
249 
getJazzChordsDisplayIsNeeded()250     bool                  getJazzChordsDisplayIsNeeded () const
251                               {
252                                 return
253                                   fJazzChordsDisplayIsNeeded;
254                               }
255 
256     // colored ledger lines
257     void                  setColoredLedgerLinesIsNeeded ();
258 
getColoredLedgerLinesIsNeeded()259     bool                  getColoredLedgerLinesIsNeeded () const
260                               {
261                                 return
262                                   fColoredLedgerLinesIsNeeded;
263                               }
264 
265   public:
266 
267     // public services
268     // ------------------------------------------------------
269 
appendVoiceToScoreElementsList(S_msrVoice voice)270     void                  appendVoiceToScoreElementsList (
271                             S_msrVoice voice)
272                               { fScoreElementsList.push_back (voice); }
273 
appendStanzaToScoreElementsList(S_msrStanza stanza)274     void                  appendStanzaToScoreElementsList (
275                             S_msrStanza stanza)
276                               { fScoreElementsList.push_back (stanza); }
277 
appendBookBlockToBookBlocksList(S_lpsrBookBlock bookBlock)278     void                  appendBookBlockToBookBlocksList (
279                             S_lpsrBookBlock bookBlock)
280                               { fScoreBookBlocksList.push_back (bookBlock); }
281 
282     void                  addGlissandoWithTextSchemeFunctionsToScore ();
283 
284   private:
285 
286     // private services
287     // ------------------------------------------------------
288 
289     // files includes
290 
291     void                  addJianpuFileIncludeToScore ();
292 
293     // Scheme modules
294 
295     void                  addAccordionRegistrationSchemeModulesToScore ();
296 
297     // Scheme functions
298 
299     void                  addDateAndTimeSchemeFunctionsToScore ();
300 
301     void                  addPointAndClickOffSchemeFunctionsToScore ();
302 
303     void                  addCustomShortBarlineSchemeFunctionToScore ();
304 
305     void                  addTongueSchemeFunctionToScore ();
306 
307     void                  addEditorialAccidentalSchemeFunctionToScore ();
308 
309     void                  addDynamicsSchemeFunctionToScore ();
310 
311     void                  addTupletsCurvedBracketsSchemeFunctionToScore ();
312 
313     void                  addAfterSchemeFunctionToScore ();
314 
315     void                  addTempoRelationshipSchemeFunctionToScore ();
316 
317     void                  addOtherDynamicSchemeFunctionToScore ();
318 
319     // markups
320 
321     void                  addDampMarkupToScore ();
322     void                  addDampAllMarkupToScore ();
323 
324     // white note heads
325 
326     void                  addWhiteNoteHeadsToScore ();
327 
328     // bar numbers
329     void                  addBoxAroundNextBarNumberToScore ();
330 
331     // jazz chords display
332 
333     void                  addJazzChordsDisplayToScore ();
334 
335     // colored ledger lines
336 
337     void                  addColoredLedgerLinesToScore ();
338 
339   public:
340 
341     // visitors
342     // ------------------------------------------------------
343 
344     virtual void          acceptIn  (basevisitor* v);
345     virtual void          acceptOut (basevisitor* v);
346 
347     virtual void          browseData (basevisitor* v);
348 
349   public:
350 
351     // print
352     // ------------------------------------------------------
353 
354     virtual void          print (ostream& os) const;
355 
356   private:
357 
358     // fields
359     // ------------------------------------------------------
360 
361     // MSR data
362     S_msrScore            fMsrScore;
363 
364     // general information
365     S_lpsrVarValAssoc     fLilypondVersion;
366 
367     // command line
368     S_lpsrComment         fInputSourceNameComment;
369     S_lpsrComment         fTranslationDateComment;
370     S_lpsrComment         fCommandLineAsSuppliedComment;
371     S_lpsrComment         fCommandLineLongOptionsComment;
372     S_lpsrComment         fCommandLineShortOptionsComment;
373 
374     // scaling
375     S_lpsrSchemeVariable  fScoreGlobalStaffSizeSchemeVariable; // JMI
376 
377     // LilyPond stuff
378     S_lpsrHeader          fScoreHeader;
379     S_lpsrPaper           fScorePaper;
380     S_lpsrLayout          fScoreLayout;
381 
382     // to keep the original line breaks
383     S_lpsrVarValAssoc     fMyBreakIsBreakAssoc;
384     S_lpsrVarValAssoc     fMyBreakIsEmptyAssoc;
385 
386     // to keep the original page breaks
387     S_lpsrVarValAssoc     fMyPageBreakIsPageBreakAssoc;
388     S_lpsrVarValAssoc     fMyPageBreakIsEmptyAssoc;
389 
390     // to generate 'global' variable
391     S_lpsrVarValAssoc     fScoreGlobalAssoc;
392 
393     // variables, voices and stanzas
394     list<S_msrElement>    fScoreElementsList;
395 
396     // score LPSR book blocks list
397     list<S_lpsrBookBlock> fScoreBookBlocksList;
398     S_lpsrScoreBlock      fScoreScoreBlock; // JMI ???
399 
400     // files includes
401     bool                  fJianpuFileIncludeIsNeeded;
402 
403     // Scheme modules
404     bool                  fScmAndAccregSchemeModulesAreNeeded;
405 
406     // Scheme functions
407     bool                  fTongueSchemeFunctionIsNeeded;
408     bool                  fCustomShortBarlineSchemeFunctionIsNeeded;
409     bool                  fEditorialAccidentalSchemeFunctionIsNeeded;
410     bool                  fDynamicsSchemeFunctionIsNeeded;
411     bool                  fTupletsCurvedBracketsSchemeFunctionIsNeeded;
412     bool                  fAfterSchemeFunctionIsNeeded;
413     bool                  fTempoRelationshipSchemeFunctionIsNeeded;
414     bool                  fGlissandoWithTextSchemeFunctionsIsNeeded;
415     bool                  fOtherDynamicSchemeFunctionIsNeeded;
416 
417     // markups
418     bool                  fDampMarkupIsNeeded;
419     bool                  fDampAllMarkupIsNeeded;
420 
421     // white note heads
422     bool                  fWhiteNoteHeadsIsNeeded;
423 
424     // bar numbers
425     bool                  fBoxAroundNextBarNumberIsNeeded;
426 
427     // jazz chords display
428     bool                  fJazzChordsDisplayIsNeeded;
429 
430     // colored ledger lines
431     bool                  fColoredLedgerLinesIsNeeded;
432 
433     map<string, S_lpsrSchemeFunction>
434                           fScoreSchemeFunctionsMap;
435 };
436 typedef SMARTP<lpsrScore> S_lpsrScore;
437 EXP ostream& operator<< (ostream& os, const S_lpsrScore& elt);
438 
439 
440 }
441 
442 
443 #endif
444