|
Canorus 0.0
|
An abstract class which represents every music element in the score. More...
#include <muselement.h>

Public Types | |
| enum | CAMusElementType { Undefined = 0 , Note , Rest , MidiNote , Barline , Clef , TimeSignature , KeySignature , Slur , Tuplet , Syllable , FunctionMark , FiguredBassMark , Mark } |
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 |
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.
Includes different types for describing the CAMusElement:
| Enumerator | |
|---|---|
| Undefined | |
| Note | |
| Rest | |
| MidiNote | |
| Barline | |
| Clef | |
| TimeSignature | |
| KeySignature | |
| Slur | |
| Tuplet | |
| Syllable | |
| FunctionMark | |
| FiguredBassMark | |
| Mark | |
| 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.

|
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().

| void CAMusElement::addMark | ( | CAMark * | mark | ) |
Adds a mark to the mark list in correct order.
References _markList, CAMark::Articulation, markList(), and CAMark::markType().
Referenced by addMarks(), CASyllable::clone(), CABarline::clone(), CAClef::clone(), CAFunctionMark::clone(), CAKeySignature::clone(), CATimeSignature::clone(), CANote::clone(), CARest::clone(), CAMusElementFactory::configureMark(), CACanorusMLImport::importMark(), CAMusicXmlImport::readNote(), CAVoice::remove(), and CAMidiImport::writeMidiChannelEventsToVoice_New().


| void CAMusElement::addMarks | ( | QList< CAMark * > | marks | ) |
Adds a list of marks to the mark list in correct order.
References addMark().

|
inline |
References _noteCheckerErrorList.
Referenced by CANoteCheckerError::CANoteCheckerError().

|
pure virtual |
Clones a music element with exact properties including the context.
Implemented in CAMark, CAPlayable, CASyllable, CABarline, CAClef, CAFiguredBassMark, CAFunctionMark, CAKeySignature, CASlur, CATimeSignature, and CATuplet.
Referenced by CAMusElementFactory::cloneMusElem(), CAMainWin::copySelection(), and CAMainWin::pasteAt().

|
inline |
References _color.
Referenced by CACanorusMLExport::exportColor(), and CAScoreView::paintEvent().

|
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 CACrescendo, CADynamic, CAFermata, CAInstrumentChange, CARepeatMark, CARitardando, CASyllable, CATuplet, CAArticulation, CABarline, CABookMark, CAClef, CAFiguredBassMark, CAFingering, CAKeySignature, CAMark, CAMidiNote, CANote, CARest, CASlur, CATempo, CAText, CATimeSignature, and CAFunctionMark.
|
inline |
Returns pointer to the CAContext which the music element belongs to.
References _context.
Referenced by CATuplet::assignTimes(), CAMusElement(), CAMark::clone(), CAPlayable::clone(), CASyllable::clone(), CABarline::clone(), CAClef::clone(), CAFiguredBassMark::clone(), CAFunctionMark::clone(), CAKeySignature::clone(), CASlur::clone(), CATimeSignature::clone(), CAMainWin::copySelection(), CAMainWin::deleteSelection(), CAFunctionMark::fmContext(), CAScoreView::paintEvent(), CAMainWin::pasteAt(), CALayoutEngine::reposit(), CAMainWin::scoreViewMousePress(), CAScoreView::selectNextMusElement(), CAScoreView::selectPrevMusElement(), CAMark::setAssociatedElement(), setContext(), CAClef::staff(), CAKeySignature::staff(), CATimeSignature::staff(), ~CAMusElement(), and CANoteCheckerError::~CANoteCheckerError().

| 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.
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().


|
inline |
References _visible.
Referenced by CAScoreView::paintEvent().

References _markList.
Referenced by addMark(), CASyllable::clone(), CABarline::clone(), CAClef::clone(), CAFunctionMark::clone(), CAKeySignature::clone(), CATimeSignature::clone(), CANote::clone(), CARest::clone(), CACanorusMLExport::exportMarks(), CALilyPondExport::exportMarksAfterElement(), CALilyPondExport::exportMarksBeforeElement(), CALilyPondExport::exportNoteMarks(), CALayoutEngine::placeMarks(), CAVoice::remove(), CAPlayback::run(), CALilyPondExport::scanForRepeats(), and CANote::~CANote().

|
inline |
Returns the music element type.
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().
|
static |
Converts QString type to music element type.
References Barline, Clef, FiguredBassMark, FunctionMark, KeySignature, Mark, MidiNote, Note, Rest, Slur, Syllable, TimeSignature, Tuplet, and Undefined.
|
static |
Converts a music element type to QString.
References Barline, Clef, FiguredBassMark, FunctionMark, KeySignature, Mark, MidiNote, Note, Rest, Slur, Syllable, TimeSignature, Tuplet, and Undefined.
Referenced by CALilyPondImport::importVoiceImpl().

|
inline |
Returns the name of the music element.
References _name.
Referenced by CANote::generateNoteName(), and setName().

|
inline |
References _noteCheckerErrorList.
Referenced by CALayoutEngine::placeNoteCheckerErrors().

|
inline |
|
inlinevirtual |
|
inlinevirtual |
|
inline |
References _markList.
Referenced by CAVoice::remove(), and CAMark::~CAMark().

|
inline |
References _noteCheckerErrorList.
Referenced by CANoteCheckerError::~CANoteCheckerError().

|
inline |
References _color.
Referenced by CACanorusMLImport::startElement().

|
inline |
References _context, and context().
Referenced by CATuplet::assignTimes(), CAMark::clone(), and CAPlayable::clone().


|
inlineprotected |
References _musElementType.
Referenced by CABarline::CABarline(), CAFiguredBassMark::CAFiguredBassMark(), CAKeySignature::CAKeySignature(), CAMark::CAMark(), CAMidiNote::CAMidiNote(), CASlur::CASlur(), CASyllable::CASyllable(), and CATuplet::CATuplet().

|
inline |
|
inline |
Sets the length in the score for this music element to time. The given time is in absolute time units.
References _timeLength.
Referenced by CAVoice::addNoteToChord(), CATuplet::assignNoteSlurs(), CATuplet::assignTimes(), CAPlayable::calculateTimeLength(), CASlur::CASlur(), CAFiguredBassContext::repositFiguredBassMarks(), and CACanorusMLImport::startElement().

|
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.
References _timeStart.
Referenced by CAVoice::addNoteToChord(), CAVoice::append(), CATuplet::assignNoteSlurs(), CAVoice::insert(), CAVoice::insertInTupletAndVoiceAt(), CAMainWin::pasteAt(), CAFiguredBassContext::repositFiguredBassMarks(), CAPlayable::resetTime(), and CAVoice::updateTimes().

|
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.
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().


|
inlinevirtual |
Returns the time how long the music element lasts in the score. The returned time is in absolute time units.
References _timeLength.
Referenced by CAFiguredBassContext::addFiguredBassMark(), CAFunctionMarkContext::addFunctionMark(), CAVoice::addNoteToChord(), CALyricsContext::addSyllable(), CADrawableMark::CADrawableMark(), CADrawableMidiNote::CADrawableMidiNote(), CAScoreView::calculateTime(), CAPlayable::CAPlayable(), CASlur::CASlur(), CASyllable::clone(), CAFiguredBassMark::clone(), CAFunctionMark::clone(), CACrescendo::clone(), CAMark::clone(), CARitardando::clone(), CAMidiNote::clone(), CANote::clone(), CARest::clone(), CARest::composeRests(), CAMusElementFactory::configureMark(), CAMusElementFactory::configureNote(), CAMainWin::deleteSelection(), CACanorusMLExport::exportMarks(), CALilyPondExport::exportPlayable(), CACanorusMLExport::exportTime(), CAVoice::insert(), CAMainWin::insertMusElementAt(), CAMainWin::on_uiPlayableLength_toggled(), CAMainWin::pasteAt(), CAPlayback::playSelectionImpl(), CAMusicXmlImport::readNote(), CAVoice::remove(), CALyricsContext::removeSyllableAtTimeStart(), CAMainWin::scoreViewKeyPress(), and timeEnd().

|
inlinevirtual |
Returns the time in the score when the music element appears in time. The returned time is in absolute time units.
References _timeStart.
Referenced by CAFiguredBassContext::addFiguredBassMark(), CAFunctionMarkContext::addFunctionMark(), 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(), CALayoutEngine::reposit(), CAPlayable::resetTime(), CAMainWin::scoreViewKeyPress(), CAMainWin::scoreViewMousePress(), CACanorusMLImport::startElement(), CAStaff::synchronizeVoices(), timeEnd(), CAScoreView::timeToCoords(), and CANote::updateTies().
|
protected |
Referenced by CAMusElement(), color(), and setColor().
|
protected |
Pointer to the context which the music element belongs to.
Referenced by CAMusElement(), context(), CASyllable::lyricsContext(), CAMark::setAssociatedElement(), setContext(), CAPlayable::setVoice(), CAPlayable::staff(), and CAFiguredBassMark::~CAFiguredBassMark().
|
protected |
Referenced by addMark(), markList(), removeMark(), and ~CAMusElement().
|
protected |
Stores the type of the music element.
Referenced by CAClef::CAClef(), CAFunctionMark::CAFunctionMark(), CAMusElement(), CANote::CANote(), CARest::CARest(), CATimeSignature::CATimeSignature(), musElementType(), and setMusElementType().
|
protected |
|
protected |
Referenced by addNoteCheckerError(), noteCheckerErrorList(), removeNoteCheckerError(), and ~CAMusElement().
|
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.
Referenced by CAMusElement(), realTimeLength(), setTimeLength(), and timeLength().
|
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.
Referenced by CAMusElement(), CAClef::clone(), CATimeSignature::clone(), CANote::isFirstInChord(), CANote::isLastInChord(), CANote::isPartOfChord(), realTimeStart(), setTimeStart(), and timeStart().
|
protected |
Referenced by CAMusElement(), isVisible(), and setVisible().