Canorus 0.0
Public Member Functions | Private Attributes | List of all members
CALyricsContext Class Reference

One stanza line of lyrics. More...

#include <lyricscontext.h>

Inheritance diagram for CALyricsContext:
Inheritance graph
[legend]

Public Member Functions

 CALyricsContext (const QString name, int stanzaNumber, CAVoice *v)
 
 CALyricsContext (const QString name, int stanzaNumber, CASheet *s)
 
 ~CALyricsContext ()
 
CALyricsContextclone (CASheet *s)
 
void cloneLyricsContextProperties (CALyricsContext *)
 
void repositSyllables ()
 
CAMusElementnext (CAMusElement *)
 
CAMusElementprevious (CAMusElement *)
 
bool remove (CAMusElement *)
 
void clear ()
 
const QList< CASyllable * > & syllableList ()
 
bool addSyllable (CASyllable *, bool replace=true)
 
bool addEmptySyllable (int timeStart, int timeLength)
 
CASyllableremoveSyllableAtTimeStart (int timeStart)
 
CASyllablesyllableAtTimeStart (int timeStart)
 
CAVoiceassociatedVoice ()
 
void setAssociatedVoice (CAVoice *v)
 
int stanzaNumber ()
 
void setStanzaNumber (int sn)
 
QString customStanzaName ()
 
void setCustomStanzaName (QString name)
 
- Public Member Functions inherited from CAContext
 CAContext (const QString name, CASheet *s)
 
virtual ~CAContext ()
 
virtual CAContextclone (CASheet *)=0
 
const QString name ()
 
void setName (const QString name)
 
CAContextType contextType ()
 
CASheetsheet ()
 
void setSheet (CASheet *sheet)
 
virtual void clear ()=0
 
virtual CAMusElementnext (CAMusElement *elt)=0
 
virtual CAMusElementprevious (CAMusElement *elt)=0
 
virtual bool remove (CAMusElement *elt)=0
 

Private Attributes

QList< CASyllable * > _syllableList
 
CAVoice_associatedVoice
 
int _stanzaNumber
 
QString _customStanzaName
 

Additional Inherited Members

- Public Types inherited from CAContext
enum  CAContextType { Staff , LyricsContext , FunctionMarkContext , FiguredBassContext }
 
- Protected Member Functions inherited from CAContext
void setContextType (CAContextType t)
 
- Protected Attributes inherited from CAContext
CASheet_sheet
 
QString _name
 
CAContextType _contextType
 

Detailed Description

One stanza line of lyrics.

Copyright (c) 2007, Matevž Jekovec, Canorus development team All Rights Reserved. See AUTHORS for a complete list of authors.

Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE.GPL for details.

This class represents a single stanza of the lyrics. It consists of various syllables (text under every note) sorted by their timeStarts.

Every LyricsContext has its associated voice. This is the voice which the syllables are assigned to (one syllable per chord). Assocciated voice is a common LilyPond syntax \lyricsto.

If the user wants to create multiple stanzas, it should create multiple lyrics contexts - one for each stanza.

See also
_syllableMap, CASyllable

Constructor & Destructor Documentation

◆ CALyricsContext() [1/2]

CALyricsContext::CALyricsContext ( const QString  name,
int  stanzaNumber,
CAVoice v 
)

References _associatedVoice, CAContext::LyricsContext, setAssociatedVoice(), CAContext::setContextType(), setStanzaNumber(), and stanzaNumber().

Referenced by clone().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CALyricsContext() [2/2]

CALyricsContext::CALyricsContext ( const QString  name,
int  stanzaNumber,
CASheet s 
)

◆ ~CALyricsContext()

CALyricsContext::~CALyricsContext ( )

References associatedVoice(), clear(), and CAVoice::removeLyricsContext().

Here is the call graph for this function:

Member Function Documentation

◆ addEmptySyllable()

bool CALyricsContext::addEmptySyllable ( int  timeStart,
int  timeLength 
)

Adds an empty syllable to the context. This function is usually called when initializing the lyrics context or inserting a new note.

References _syllableList.

Referenced by CAMainWin::pasteAt(), and repositSyllables().

Here is the caller graph for this function:

◆ addSyllable()

bool CALyricsContext::addSyllable ( CASyllable syllable,
bool  replace = true 
)

Adds a syllable to the context. The syllable at that location is replaced (default) by the new one, if replace is True. Time starts after the inserted syllable are increased for the length of the inserted syllable. Syllables are always sorted by their startTimes.

See also
_syllableList

References _syllableList, CAMusElement::timeLength(), and CAMusElement::timeStart().

Referenced by clone(), CAMainWin::copySelection(), CALilyPondImport::importLyricsContextImpl(), and CAMainWin::pasteAt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ associatedVoice()

CAVoice * CALyricsContext::associatedVoice ( )
inline

◆ clear()

void CALyricsContext::clear ( )
virtual

Implements CAContext.

References _syllableList.

Referenced by ~CALyricsContext().

Here is the caller graph for this function:

◆ clone()

CALyricsContext * CALyricsContext::clone ( CASheet s)
virtual

Clones the current context with the given parent sheet s.

See also
CAMusElement::clone(), CADocument::clone()

Implements CAContext.

References _syllableList, addSyllable(), CALyricsContext(), cloneLyricsContextProperties(), CAContext::name(), and stanzaNumber().

Here is the call graph for this function:

◆ cloneLyricsContextProperties()

void CALyricsContext::cloneLyricsContextProperties ( CALyricsContext lc)

Sets the properties of the given lyrics context to this lyrics context.

References associatedVoice(), CAContext::name(), setAssociatedVoice(), CAContext::setName(), CAContext::setSheet(), setStanzaNumber(), CAContext::sheet(), and stanzaNumber().

Referenced by clone(), and CAMainWin::sourceViewCommit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ customStanzaName()

QString CALyricsContext::customStanzaName ( )
inline

References _customStanzaName.

◆ next()

CAMusElement * CALyricsContext::next ( CAMusElement elt)
virtual

Implements CAContext.

References _syllableList, CAMusElement::musElementType(), and CAMusElement::Syllable.

Referenced by CAScoreView::createTextEdit(), and CAMainWin::onTextEditKeyPressEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ previous()

CAMusElement * CALyricsContext::previous ( CAMusElement elt)
virtual

Implements CAContext.

References _syllableList, CAMusElement::musElementType(), and CAMusElement::Syllable.

Referenced by CAMainWin::onTextEditKeyPressEvent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove()

bool CALyricsContext::remove ( CAMusElement elt)
virtual

Removes the given syllable from the list.

Implements CAContext.

References _syllableList, CAMusElement::musElementType(), and CAMusElement::Syllable.

Referenced by CAMainWin::deleteSelection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeSyllableAtTimeStart()

CASyllable * CALyricsContext::removeSyllableAtTimeStart ( int  timeStart)

Removes the syllable at the given timeStart and updates the timeStarts for syllables after it. This function is usually called when removing the note.

Returns True if the syllable was found and removed; False otherwise.

References _syllableList, and CAMusElement::timeLength().

Here is the call graph for this function:

◆ repositSyllables()

void CALyricsContext::repositSyllables ( )

Keeps the content and order of the syllables, but changes startTimes and lengths according to the notes in associatedVoice. This function is usually called when associatedVoice is changed or the whole lyricsContext is initialized for the first time. If the notes and syllables aren't synchronized (too little syllables for notes) it adds empty syllables.

References _syllableList, addEmptySyllable(), associatedVoice(), and CAVoice::getNoteList().

Referenced by CAMusElementFactory::configureRest(), CAMainWin::deleteSelection(), CALilyPondImport::importLyricsContextImpl(), CAMainWin::pasteAt(), and setAssociatedVoice().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAssociatedVoice()

void CALyricsContext::setAssociatedVoice ( CAVoice v)

Sets a new associated voice and repositiones the syllables.

References _associatedVoice, CAVoice::addLyricsContext(), CAVoice::removeLyricsContext(), and repositSyllables().

Referenced by CALyricsContext(), and cloneLyricsContextProperties().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCustomStanzaName()

void CALyricsContext::setCustomStanzaName ( QString  name)
inline

References _customStanzaName, and CAContext::name().

Here is the call graph for this function:

◆ setStanzaNumber()

void CALyricsContext::setStanzaNumber ( int  sn)
inline

References _stanzaNumber.

Referenced by CALyricsContext(), and cloneLyricsContextProperties().

Here is the caller graph for this function:

◆ stanzaNumber()

int CALyricsContext::stanzaNumber ( )
inline

◆ syllableAtTimeStart()

CASyllable * CALyricsContext::syllableAtTimeStart ( int  timeStart)

Finds the syllable with exactly the given timeStart or Null, if such a syllables doesn't exist.

References _syllableList.

◆ syllableList()

const QList< CASyllable * > & CALyricsContext::syllableList ( )
inline

Member Data Documentation

◆ _associatedVoice

CAVoice* CALyricsContext::_associatedVoice
private

◆ _customStanzaName

QString CALyricsContext::_customStanzaName
private

◆ _stanzaNumber

int CALyricsContext::_stanzaNumber
private

Referenced by setStanzaNumber(), and stanzaNumber().

◆ _syllableList

QList< CASyllable* > CALyricsContext::_syllableList
private

The documentation for this class was generated from the following files: