Canorus  0.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CAMusElement Class Referenceabstract

An abstract class which represents every music element in the score. More...

#include <muselement.h>

Inheritance diagram for CAMusElement:
Inheritance graph
[legend]

Public Types

enum  CAMusElementType {
  Undefined = 0, Note, Rest, MidiNote,
  Barline, Clef, TimeSignature, KeySignature,
  Slur, Tuplet, Syllable, FunctionMark,
  FiguredBassMark, Mark
}
 

Public Member Functions

 CAMusElement (CAContext *context, int timeStart, int timeLength=0)
 
virtual ~CAMusElement ()
 
virtual CAMusElementclone (CAContext *context=0)=0
 
virtual int compare (CAMusElement *elt)=0
 
CAMusElementType musElementType ()
 
CAContextcontext ()
 
void setContext (CAContext *context)
 
virtual int timeStart () const
 
void setTimeStart (int time)
 
virtual int timeLength () const
 
void setTimeLength (int length)
 
int timeEnd ()
 
virtual int realTimeStart ()
 
virtual int realTimeLength ()
 
int realTimeEnd ()
 
const QString name ()
 
void setName (const QString name)
 
const bool isVisible ()
 
void setVisible (const bool v)
 
const QColor color ()
 
void setColor (const QColor c)
 
const QList< CAMark * > markList ()
 
void addMark (CAMark *mark)
 
void addMarks (QList< CAMark * > marks)
 
void removeMark (CAMark *mark)
 
const QList< CANoteCheckerError * > & noteCheckerErrorList ()
 
void addNoteCheckerError (CANoteCheckerError *nce)
 
void removeNoteCheckerError (CANoteCheckerError *nce)
 
bool isPlayable ()
 

Static Public Member Functions

static const QString musElementTypeToString (CAMusElementType)
 
static CAMusElementType musElementTypeFromString (const QString)
 

Protected Member Functions

void setMusElementType (CAMusElementType type)
 

Protected Attributes

CAMusElementType _musElementType
 
QList< CAMark * > _markList
 
QList< CANoteCheckerError * > _noteCheckerErrorList
 
CAContext_context
 
int _timeStart
 
int _timeLength
 
bool _visible
 
QColor _color
 
QString _name
 

Detailed Description

An abstract class which represents every music element in the score.

Copyright (c) 2006-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 is a base class for every music element in the score. Music elements can be of various types, note, rest, barline, clef, lyrics syllable, function mark, figured bass mark etc. See CAMusElementType for details.

Every music element belongs to a so called parent area in the score called context. See CAContext for details.

Since Canorus tends to be built in Model-View-Controller style, every music element has one or more of its drawable instances. These classes are named CADrawableClassName, where ClassName is type of the music element. eg. CADrawableClef, CADrawableBarline etc.

See also
CAMusElementType, CAContext, CADrawableMusElement

Member Enumeration Documentation

◆ CAMusElementType

Includes different types for describing the CAMusElement:

  • Note - A music element which represents CANote.
  • NoteBracket - A music element which represents CANoteBracket (the bracket which connects the stems).
  • Chord - A virtual music element which represents CAChord.
  • Rest - A music element which represents CARest.
  • BarLine - A music elemnet which represents CABarLine.
  • Clef - A music element which represents CAClef.
  • TimeSignature - A music element which represents CATimeSignature.
  • KeySignature - A music element which represents CAKeySignature.
  • Slur - A music element which represents CASlur.
  • Tie - A music element which represents CATie.
  • PhrazingSlur - A music element which represents CAPhrazingSlur.
  • ExpressionMark - A music element which represents any technical text marks about how the score should be played - CAExpressionMark (eg. Legato)
  • VolumeSign - A music element which represents any volue sign (forte, piano etc.).
  • Text - A music element which represents any text notes and authors additions to the score. (eg. These 3 measures still need to be fixed)
See also
musElementType()
Enumerator
Undefined 
Note 
Rest 
MidiNote 
Barline 
Clef 
TimeSignature 
KeySignature 
Slur 
Tuplet 
Syllable 
FunctionMark 
FiguredBassMark 
Mark 

Constructor & Destructor Documentation

◆ CAMusElement()

CAMusElement::CAMusElement ( CAContext context,
int  time,
int  length = 0 
)

Constructs a music element with parent context (staff, lyrics, functionmarks) context, start time time and length length.

References _color, _context, _musElementType, _timeLength, _timeStart, _visible, context(), and Undefined.

Here is the call graph for this function:

◆ ~CAMusElement()

CAMusElement::~CAMusElement ( )
virtual

Destroys a music element. This removes the music element from the parent context as well!

References _markList, _noteCheckerErrorList, context(), isPlayable(), musElementType(), Note, and CAContext::remove().

Here is the call graph for this function:

Member Function Documentation

◆ addMark()

void CAMusElement::addMark ( CAMark mark)

◆ addMarks()

void CAMusElement::addMarks ( QList< CAMark * >  marks)

Adds a list of marks to the mark list in correct order.

References addMark().

Here is the call graph for this function:

◆ addNoteCheckerError()

void CAMusElement::addNoteCheckerError ( CANoteCheckerError nce)
inline

References _noteCheckerErrorList.

Referenced by CANoteCheckerError::CANoteCheckerError().

Here is the caller graph for this function:

◆ clone()

CAMusElement::clone ( CAContext context = 0)
pure virtual

Clones a music element with exact properties including the context.

Implemented in CATuplet, CATimeSignature, CASlur, CAKeySignature, CAFunctionMark, CAFiguredBassMark, CAClef, CABarline, CASyllable, CAPlayable, and CAMark.

Referenced by CAMusElementFactory::cloneMusElem(), CAMainWin::copySelection(), and CAMainWin::pasteAt().

Here is the caller graph for this function:

◆ color()

const QColor CAMusElement::color ( )
inline

References _color.

Referenced by CACanorusMLExport::exportColor(), and CAScoreView::paintEvent().

Here is the caller graph for this function:

◆ compare()

CAMusElement::compare ( CAMusElement elt)
pure virtual

Compares the music element with the given elt and returns number of differences in their properties. Returns 0, if the music elements are exact; -1 if the music element type differs; otherwise number greater than 0.

This method is usually used when opening a score document where music elements are written in various voices (eg. barlines), but are eventually merged and written only once per staff.

Implemented in CAFunctionMark, CATimeSignature, CAText, CATempo, CASlur, CARest, CANote, CAMidiNote, CAMark, CAKeySignature, CAFingering, CAFiguredBassMark, CAClef, CABookMark, CABarline, CAArticulation, CATuplet, CASyllable, CARitardando, CARepeatMark, CAInstrumentChange, CAFermata, CADynamic, and CACrescendo.

◆ context()

CAMusElement::context ( )
inline

◆ isPlayable()

bool CAMusElement::isPlayable ( )

Returns true, if the current element is playable; otherwise false. Playable elements are music elements with _timeLength variable greater than 0 (notes, rests). They inherit CAPlayable.

See also
_timeLength, CAPlayable

References musElementType(), Note, and Rest.

Referenced by CAFermata::clone(), CARitardando::clone(), CAText::clone(), CAMusElementFactory::configureMark(), CAMainWin::copySelection(), CACanorusMLExport::exportTime(), CACanorusMLImport::importMark(), CAVoice::insert(), CAMainWin::insertMusElementAt(), CAScoreView::paintEvent(), CAMainWin::pasteAt(), CAVoice::remove(), CALayoutEngine::reposit(), CAMainWin::scoreViewKeyPress(), CAMainWin::scoreViewMousePress(), and ~CAMusElement().

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

◆ isVisible()

const bool CAMusElement::isVisible ( )
inline

References _visible.

Referenced by CAScoreView::paintEvent().

Here is the caller graph for this function:

◆ markList()

const QList<CAMark*> CAMusElement::markList ( )
inline

◆ musElementType()

CAMusElement::musElementType ( )
inline

Returns the music element type.

See also
CAMusElementType

References _musElementType.

Referenced by CAVoice::append(), CATuplet::assignTimes(), CAArticulation::clone(), CACrescendo::clone(), CADynamic::clone(), CAFermata::clone(), CAFingering::clone(), CAInstrumentChange::clone(), CARepeatMark::clone(), CAStaff::clone(), CACrescendo::compare(), CADynamic::compare(), CAFermata::compare(), CAInstrumentChange::compare(), CARepeatMark::compare(), CARitardando::compare(), CASyllable::compare(), CATuplet::compare(), CABarline::compare(), CABookMark::compare(), CAClef::compare(), CAFiguredBassMark::compare(), CAFingering::compare(), CAKeySignature::compare(), CAMark::compare(), CAMidiNote::compare(), CANote::compare(), CARest::compare(), CASlur::compare(), CATempo::compare(), CAText::compare(), CATimeSignature::compare(), CAFunctionMark::compare(), CAMusElementFactory::configureMark(), CAMainWin::confirmTextEdit(), CAMainWin::copySelection(), CAScoreView::createTextEdit(), CAMainWin::deleteSelection(), CACanorusMLImport::endElement(), CACanorusMLExport::exportMarks(), CAMusicXmlExport::exportMeasure(), CALilyPondExport::exportPlayable(), CACanorusMLExport::exportVoiceImpl(), CALilyPondImport::findSharedElement(), CATuplet::firstNote(), CAVoice::getBar(), CANote::getChord(), CAVoice::getClef(), CAVoice::getKeySig(), CATuplet::getNoteSlurs(), CAVoice::getTimeSig(), CACanorusMLImport::importMark(), CAVoice::insert(), CAVoice::insertMusElement(), CAMainWin::insertMusElementAt(), CANote::isFirstInChord(), CANote::isLastInChord(), CANote::isPartOfChord(), isPlayable(), CATuplet::lastNote(), CALyricsContext::next(), CAFiguredBassContext::next(), CAVoice::nextByType(), CAMainWin::on_uiPlayableLength_toggled(), CAMainWin::onTextEditKeyPressEvent(), CAScoreView::paintEvent(), CAMainWin::pasteAt(), CALayoutEngine::placeMarks(), CALyricsContext::previous(), CAFiguredBassContext::previous(), CAVoice::previousByType(), CATranspose::reinterpretAccidentals(), CALyricsContext::remove(), CAFiguredBassContext::remove(), CAVoice::remove(), CALayoutEngine::reposit(), CATuplet::resetTimes(), CAPlayback::run(), CAMainWin::scoreViewKeyPress(), CAMainWin::scoreViewMousePress(), CAMainWin::scoreViewMouseRelease(), CATranspose::transposeByInterval(), CAMainWin::updatePlayableToolBar(), and ~CAMusElement().

◆ musElementTypeFromString()

CAMusElement::CAMusElementType CAMusElement::musElementTypeFromString ( const QString  type)
static

Converts QString type to music element type.

See also
CAMusElementType, musElementTypeToString()

References Barline, Clef, FiguredBassMark, FunctionMark, KeySignature, Mark, MidiNote, Note, Rest, Slur, Syllable, TimeSignature, Tuplet, and Undefined.

◆ musElementTypeToString()

const QString CAMusElement::musElementTypeToString ( CAMusElement::CAMusElementType  type)
static

Converts a music element type to QString.

See also
CAMusElementType, musElementTypeFromString()

References Barline, Clef, FiguredBassMark, FunctionMark, KeySignature, Mark, MidiNote, Note, Rest, Slur, Syllable, TimeSignature, Tuplet, and Undefined.

Referenced by CALilyPondImport::importVoiceImpl().

Here is the caller graph for this function:

◆ name()

CAMusElement::name ( )
inline

Returns the name of the music element.

References _name.

Referenced by CANote::generateNoteName(), and setName().

Here is the caller graph for this function:

◆ noteCheckerErrorList()

const QList<CANoteCheckerError*>& CAMusElement::noteCheckerErrorList ( )
inline

References _noteCheckerErrorList.

Referenced by CALayoutEngine::placeNoteCheckerErrors().

Here is the caller graph for this function:

◆ realTimeEnd()

int CAMusElement::realTimeEnd ( )
inline

References realTimeLength(), and realTimeStart().

Here is the call graph for this function:

◆ realTimeLength()

virtual int CAMusElement::realTimeLength ( )
inlinevirtual

References _timeLength.

Referenced by realTimeEnd().

Here is the caller graph for this function:

◆ realTimeStart()

virtual int CAMusElement::realTimeStart ( )
inlinevirtual

References _timeStart.

Referenced by realTimeEnd().

Here is the caller graph for this function:

◆ removeMark()

void CAMusElement::removeMark ( CAMark mark)
inline

References _markList.

Referenced by CAVoice::remove(), and CAMark::~CAMark().

Here is the caller graph for this function:

◆ removeNoteCheckerError()

void CAMusElement::removeNoteCheckerError ( CANoteCheckerError nce)
inline

References _noteCheckerErrorList.

Referenced by CANoteCheckerError::~CANoteCheckerError().

Here is the caller graph for this function:

◆ setColor()

void CAMusElement::setColor ( const QColor  c)
inline

References _color.

Referenced by CACanorusMLImport::startElement().

Here is the caller graph for this function:

◆ setContext()

void CAMusElement::setContext ( CAContext context)
inline

References _context, and context().

Referenced by CATuplet::assignTimes(), CAMark::clone(), and CAPlayable::clone().

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

◆ setMusElementType()

void CAMusElement::setMusElementType ( CAMusElementType  type)
inlineprotected

◆ setName()

CAMusElement::setName ( const QString  name)
inline

Sets the name of the music element to name.

See also
_name, name()

References _name, and name().

Here is the call graph for this function:

◆ setTimeLength()

CAMusElement::setTimeLength ( int  length)
inline

Sets the length in the score for this music element to time. The given time is in absolute time units.

See also
_timeLength, timeLength()

References _timeLength.

Referenced by CAVoice::addNoteToChord(), CATuplet::assignNoteSlurs(), CATuplet::assignTimes(), CAPlayable::calculateTimeLength(), CASlur::CASlur(), CAFiguredBassContext::repositFiguredBassMarks(), and CACanorusMLImport::startElement().

Here is the caller graph for this function:

◆ setTimeStart()

CAMusElement::setTimeStart ( int  time)
inline

Sets the time in the score when the music element appears for this music element to time. The given time is in absolute time units.

See also
_timeStart, timeStart()

References _timeStart.

Referenced by CAVoice::addNoteToChord(), CAVoice::append(), CATuplet::assignNoteSlurs(), CAVoice::insert(), CAVoice::insertInTupletAndVoiceAt(), CAMainWin::pasteAt(), CAFiguredBassContext::repositFiguredBassMarks(), CAPlayable::resetTime(), and CAVoice::updateTimes().

Here is the caller graph for this function:

◆ setVisible()

void CAMusElement::setVisible ( const bool  v)
inline

References _visible.

◆ timeEnd()

CAMusElement::timeEnd ( )
inline

Returns the time when the music element stops playing. This is always the sum of _timeStart + _timeLength. The returned time is in absolute time units.

See also
_timeStart, _timeLength

References timeLength(), and timeStart().

Referenced by CAVoice::append(), CATuplet::assignNoteSlurs(), CATuplet::assignTimes(), CAScoreView::coordsToTime(), CAMainWin::deleteSelection(), CAMainWin::insertMusElementAt(), CAStaff::placeAutoBar(), CAPlayable::resetTime(), CAMainWin::scoreViewMousePress(), CAStaff::synchronizeVoices(), CATuplet::timeLength(), CANote::updateTies(), and CAMidiImport::writeMidiChannelEventsToVoice_New().

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

◆ timeLength()

CAMusElement::timeLength ( ) const
inlinevirtual

◆ timeStart()

CAMusElement::timeStart ( ) const
inlinevirtual

Returns the time in the score when the music element appears in time. The returned time is in absolute time units.

See also
_timeStart, setTimeStart()

References _timeStart.

Referenced by CAFiguredBassContext::addFiguredBassMark(), CATuplet::addNote(), CAVoice::addNoteToChord(), CALyricsContext::addSyllable(), CAVoice::append(), CAScoreView::calculateTime(), CASlur::CASlur(), CASyllable::clone(), CABarline::clone(), CAFiguredBassMark::clone(), CAFunctionMark::clone(), CAKeySignature::clone(), CACrescendo::clone(), CAMark::clone(), CAMidiNote::clone(), CANote::clone(), CARest::clone(), CARest::composeRests(), CAMusElementFactory::configureNote(), CAScoreView::coordsToTime(), CAMainWin::copySelection(), CAMainWin::deleteSelection(), CACanorusMLImport::endElement(), CACanorusMLExport::exportMarks(), CALilyPondExport::exportPlayable(), CACanorusMLExport::exportTime(), CALilyPondExport::exportVoiceImpl(), CALilyPondImport::findSharedElement(), CANote::getChord(), CASheet::getTempo(), CAStaff::getTempo(), CAVoice::insert(), CAVoice::insertInTupletAndVoiceAt(), CAMainWin::insertMusElementAt(), CANote::isFirstInChord(), CANote::isLastInChord(), CANote::isPartOfChord(), CAPlayableLength::matchToBars(), CAKeybdInput::midiInEventToScore(), CAScoreView::musElementTimeLessThan(), CATuplet::nextTimed(), CANote::notePosition(), CAMainWin::on_uiPlayableLength_toggled(), CAMainWin::pasteAt(), CAStaff::placeAutoBar(), CAMusicXmlImport::readNote(), CAPlayable::resetTime(), CAMainWin::scoreViewKeyPress(), CAMainWin::scoreViewMousePress(), CACanorusMLImport::startElement(), CAStaff::synchronizeVoices(), timeEnd(), CAScoreView::timeToCoords(), and CANote::updateTies().

Member Data Documentation

◆ _color

QColor CAMusElement::_color
protected

Referenced by CAMusElement(), color(), and setColor().

◆ _context

CAMusElement::_context
protected

◆ _markList

QList< CAMark* > CAMusElement::_markList
protected

◆ _musElementType

CAMusElement::_musElementType
protected

◆ _name

CAMusElement::_name
protected

Specific name of the music element in QString. Names are optional and are not necessary unique.

See also
name(), setName()

Referenced by name(), and setName().

◆ _noteCheckerErrorList

QList< CANoteCheckerError* > CAMusElement::_noteCheckerErrorList
protected

◆ _timeLength

CAMusElement::_timeLength
protected

How long does this music element lasts. Time is stored in absolute time units and is not affected by different tempos or other expressions. Non-playable elements (barlines, clefs, key signatures etc.) have this time always 0. Playable elements (notes, rests) have this time always greater than 0.

See also
timeLength(), setTimeLength(), CAPlayable::CAPlayableLength

Referenced by CAMusElement(), realTimeLength(), setTimeLength(), and timeLength().

◆ _timeStart

CAMusElement::_timeStart
protected

Where does the music element starts in time. Time is stored in absolute time units and is not affected by different tempos or other expressions.

See also
timeStart(), setTimeStart()

Referenced by CAMusElement(), CAClef::clone(), CATimeSignature::clone(), CANote::isFirstInChord(), CANote::isLastInChord(), CANote::isPartOfChord(), realTimeStart(), setTimeStart(), and timeStart().

◆ _visible

bool CAMusElement::_visible
protected

Referenced by CAMusElement(), isVisible(), and setVisible().


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