Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lilypondexport.h
Go to the documentation of this file.
1 
8 #ifndef LILYPONDEXPORT_H_
9 #define LILYPONDEXPORT_H_
10 
11 #include <QTextStream>
12 #include <QString>
13 
14 #include "core/keysignature.h"
15 #include "core/timesignature.h"
16 #include "core/clef.h"
17 #include "core/barline.h"
18 #include "core/playable.h"
19 #include "core/note.h"
20 #include "core/rest.h"
21 #include "core/document.h"
22 #include "core/lyricscontext.h"
23 #include "core/syllable.h"
24 
25 #include "export/export.h"
26 
27 class CALilyPondExport : public CAExport {
28 public:
29  CALilyPondExport( QTextStream *out=0 );
30 
32  // Polling export status //
34  // Setter methods are private!
35  inline CAVoice *curVoice() { return _curVoice; }
36  inline CASheet *curSheet() { return _curSheet; }
37  inline CAContext *curContext() { return _curContext; }
38  inline int curContextIndex() { return _curContextIndex; }
39  inline int curIndentLevel() { return _curIndentLevel; }
40 
41 private:
42  void exportDocumentImpl(CADocument *doc);
43  void exportSheetImpl(CASheet *sheet);
44  void exportScoreBlock(CASheet *sheet);
45  void exportStaffVoices(CAStaff *staff);
46  void exportVoiceImpl(CAVoice *voice);
49  void exportMarks( CAMusElement* );
50  void exportPlayable( CAPlayable *elt );
51 
52  void writeDocumentHeader();
55 
57  // Helper methods //
59  const QString clefTypeToLilyPond( CAClef::CAClefType type, int c1, int offset );
61  const QString playableLengthToLilyPond( CAPlayableLength length );
62  const QString diatonicPitchToLilyPond( CADiatonicPitch p );
63  const QString restTypeToLilyPond(CARest::CARestType type);
65  const QString syllableToLilyPond( CASyllable *s );
66 
67  inline const QString relativePitchToString(CANote* note, CADiatonicPitch prevPitch) {
68  return relativePitchToString( note->diatonicPitch(), prevPitch);
69  }
70  const QString relativePitchToString( CADiatonicPitch p, CADiatonicPitch prevPitch);
71  void voiceVariableName( QString &name, int staffNum, int voiceNum );
72  void spellNumbers( QString &s );
73 
74  QString markupString( QString );
75  QString escapeWeirdChars( QString );
76 
77  void indent();
78  inline void indentMore() { ++_curIndentLevel; }
79  inline void indentLess() { --_curIndentLevel; }
80 
82  // Getter/Setter methods //
84  inline void setCurVoice(CAVoice *voice) { _curVoice = voice; }
85  inline void setCurSheet(CASheet *sheet) { _curSheet = sheet; }
86  inline void setCurContext(CAContext *context) { _curContext = context; }
87  inline void setCurContextIndex(int c) { _curContextIndex = c; }
88  inline void setIndentLevel( int level) { _curIndentLevel = level; }
89 
91  // Members //
93  QTextStream *_out;
99 
100  // Voice exporting current status
104 };
105 
106 #endif /* LILYPONDEXPORT_H_*/