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_*/
Represents a single sheet of paper in the document.
Definition: sheet.h:20
void indentLess()
Definition: lilypondexport.h:79
LilyPond export filter This class is used to export the document or parts of the document to LilyPond...
Definition: lilypondexport.h:27
void setCurSheet(CASheet *sheet)
Definition: lilypondexport.h:85
QString markupString(QString)
Definition: lilypondexport.cpp:600
void exportMarks(CAMusElement *)
Definition: lilypondexport.cpp:222
void setIndentLevel(int level)
Definition: lilypondexport.h:88
const QString clefTypeToLilyPond(CAClef::CAClefType type, int c1, int offset)
Definition: lilypondexport.cpp:361
void indent()
Definition: lilypondexport.cpp:811
CASheet * curSheet()
Definition: lilypondexport.h:36
Class which represents a voice in the staff.
Definition: voice.h:22
Represents a time signature in the staff.
Definition: timesignature.h:18
void exportLyricsContextBlock(CALyricsContext *lc)
Definition: lilypondexport.cpp:245
void setCurContext(CAContext *context)
Definition: lilypondexport.h:86
void exportDocumentImpl(CADocument *doc)
Definition: lilypondexport.cpp:534
void setCurVoice(CAVoice *voice)
Definition: lilypondexport.h:84
CARestType
Definition: rest.h:17
int _curContextIndex
Definition: lilypondexport.h:97
void exportLyricsContextImpl(CALyricsContext *lc)
Definition: lilypondexport.cpp:264
Class which represents the current document.
Definition: document.h:19
const QString syllableToLilyPond(CASyllable *s)
Definition: lilypondexport.cpp:520
void exportPlayable(CAPlayable *elt)
Definition: lilypondexport.cpp:131
Represents a note in the score.
Definition: note.h:18
CAVoice * _curVoice
Definition: lilypondexport.h:94
void spellNumbers(QString &s)
Definition: lilypondexport.cpp:823
CADiatonicPitch _lastNotePitch
Definition: lilypondexport.h:101
const QString playableLengthToLilyPond(CAPlayableLength length)
Definition: lilypondexport.cpp:417
Base class for export filters.
Definition: export.h:22
QTextStream * _out
Definition: lilypondexport.h:93
int curIndentLevel()
Definition: lilypondexport.h:39
Musical note pitch.
Definition: diatonicpitch.h:14
Musical length of notes and rests.
Definition: playablelength.h:16
int curContextIndex()
Definition: lilypondexport.h:38
const QString relativePitchToString(CANote *note, CADiatonicPitch prevPitch)
Definition: lilypondexport.h:67
void indentMore()
Definition: lilypondexport.h:78
const QString diatonicPitchToLilyPond(CADiatonicPitch p)
Definition: lilypondexport.cpp:457
CAContext * _curContext
Definition: lilypondexport.h:96
CAClefType
Definition: clef.h:36
const QString barlineTypeToLilyPond(CABarline::CABarlineType type)
Definition: lilypondexport.cpp:494
void exportVoiceImpl(CAVoice *voice)
Definition: lilypondexport.cpp:53
void exportSheetImpl(CASheet *sheet)
Definition: lilypondexport.cpp:557
int _curStreamTime
Definition: lilypondexport.h:103
An abstract class which represents every music element in the score.
Definition: muselement.h:20
const QString restTypeToLilyPond(CARest::CARestType type)
Definition: lilypondexport.cpp:480
One stanza line of lyrics.
Definition: lyricscontext.h:19
Playable instances of music elements.
Definition: playable.h:18
CAPlayableLength _lastPlayableLength
Definition: lilypondexport.h:102
CABarlineType
Definition: barline.h:19
CAContext * curContext()
Definition: lilypondexport.h:37
Represents a staff in the sheet.
Definition: staff.h:24
void exportScoreBlock(CASheet *sheet)
Definition: lilypondexport.cpp:678
CALilyPondExport(QTextStream *out=0)
Definition: lilypondexport.cpp:43
void setCurContextIndex(int c)
Definition: lilypondexport.h:87
void voiceVariableName(QString &name, int staffNum, int voiceNum)
Definition: lilypondexport.cpp:647
CASheet * _curSheet
Definition: lilypondexport.h:95
int _curIndentLevel
Definition: lilypondexport.h:98
const QString diatonicKeyGenderToLilyPond(CADiatonicKey::CAGender gender)
Definition: lilypondexport.cpp:405
Lyrics under the note.
Definition: syllable.h:19
void exportStaffVoices(CAStaff *staff)
Definition: lilypondexport.cpp:617
void doAnacrusisCheck(CATimeSignature *time)
Definition: lilypondexport.cpp:274
QString escapeWeirdChars(QString)
Definition: lilypondexport.cpp:607
CADiatonicPitch writeRelativeIntro()
Definition: lilypondexport.cpp:310
QTextStream & out()
Definition: export.h:71
CAVoice * curVoice()
Definition: lilypondexport.h:35
void writeDocumentHeader()
Definition: lilypondexport.cpp:580
Line of music elements in the sheet.
Definition: context.h:16
CADiatonicPitch & diatonicPitch()
Definition: note.h:34
CAGender
Definition: diatonickey.h:17