Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
CAMusElement Class Reference

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

#include <muselement.h>

Inheritance diagram for CAMusElement:
Inheritance graph
[legend]

List of all members.

Public Types

enum  CAMusElementType {
  Undefined = 0, Note, Rest, Barline,
  Clef, TimeSignature, KeySignature, Slur,
  Tuplet, Syllable, FunctionMark, 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 ()
CAContextsetContext (CAContext *context)
virtual int timeStart ()
void setTimeStart (int time)
virtual int timeLength ()
void setTimeLength (int length)
int timeEnd ()
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)
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

QList< CAMark * > _markList
CAMusElementType _musElementType
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.

    \sa CAMusElementType, CAContext, CADrawableMusElement

Member Enumeration Documentation

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 
Barline 
Clef 
TimeSignature 
KeySignature 
Slur 
Tuplet 
Syllable 
FunctionMark 
Mark 

Constructor & Destructor Documentation

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:

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

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

Here is the call graph for this function:


Member Function Documentation

void CAMusElement::addMark ( CAMark mark)
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:

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

Clones a music element with exact properties including the context.

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

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

Here is the caller graph for this function:

const QColor CAMusElement::color ( ) [inline]

References _color.

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

Here is the caller graph for this function:

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 CANote, CAFunctionMark, CAKeySignature, CAClef, CAArticulation, CATimeSignature, CASlur, CAMark, CAFingering, CASyllable, CABarline, CARepeatMark, CARest, CAFermata, CADynamic, CACrescendo, CARitardando, CATuplet, CABookMark, CAText, CAInstrumentChange, and CATempo.

CAMusElement::context ( ) [inline]
const bool CAMusElement::isVisible ( ) [inline]

References _visible.

Referenced by CAScoreViewPort::paintEvent().

Here is the caller graph for this function:

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

Returns the music element type.

See also:
CAMusElementType

References _musElementType.

Referenced by CAVoice::append(), CATuplet::assignTimes(), CAInstrumentChange::clone(), CACrescendo::clone(), CADynamic::clone(), CAFermata::clone(), CARepeatMark::clone(), CAStaff::clone(), CAFingering::clone(), CAArticulation::clone(), CATempo::compare(), CAInstrumentChange::compare(), CAText::compare(), CABookMark::compare(), CATuplet::compare(), CARitardando::compare(), CACrescendo::compare(), CADynamic::compare(), CAFermata::compare(), CARest::compare(), CARepeatMark::compare(), CABarline::compare(), CASyllable::compare(), CAFingering::compare(), CAMark::compare(), CASlur::compare(), CATimeSignature::compare(), CAClef::compare(), CAKeySignature::compare(), CAFunctionMark::compare(), CANote::compare(), CAMusElementFactory::configureMark(), CAMainWin::copySelection(), CAScoreViewPort::createTextEdit(), CAMainWin::deleteSelection(), CACanorusMLImport::endElement(), CACanorusMLExport::exportMarks(), CALilyPondExport::exportPlayable(), CACanorusMLExport::exportVoiceImpl(), CALilyPondExport::exportVoiceImpl(), CALilyPondImport::findSharedElement(), CAMidiImport::findSharedElement(), CAVoice::getBar(), CANote::getChord(), CAVoice::getClef(), CAVoice::getKeySig(), CAVoice::getTimeSig(), CACanorusMLImport::importMark(), CALilyPondImport::importVoiceImpl(), CAVoice::insert(), CAVoice::insertMusElement(), CAMainWin::insertMusElementAt(), CANote::isFirstInChord(), CANote::isLastInChord(), CANote::isPartOfChord(), isPlayable(), CALyricsContext::next(), CAVoice::nextByType(), CAMainWin::on_uiPlayableLength_toggled(), CAMainWin::onTextEditKeyPressEvent(), CAScoreViewPort::paintEvent(), CAMainWin::pasteAt(), CAEngraver::placeMarks(), CALyricsContext::previous(), CAVoice::previousByType(), CALyricsContext::remove(), CAVoice::remove(), CAEngraver::reposit(), CATuplet::resetTimes(), CAPlayback::run(), CAMainWin::scoreViewPortKeyPress(), CAMainWin::scoreViewPortMousePress(), CAMainWin::setMode(), CATranspose::transposeByInterval(), CAMainWin::updatePlayableToolBar(), CALilyPondExport::writeRelativeIntro(), and ~CAMusElement().

Converts QString type to music element type.

See also:
CAMusElementType, musElementTypeToString()

References Barline, Clef, FunctionMark, KeySignature, Note, Rest, Slur, Syllable, TimeSignature, and Undefined.

Converts a music element type to QString.

See also:
CAMusElementType, musElementTypeFromString()

References Barline, Clef, FunctionMark, KeySignature, Note, Rest, Slur, Syllable, TimeSignature, and Undefined.

Referenced by CALilyPondImport::importVoiceImpl().

Here is the caller graph for this function:

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:

void CAMusElement::removeMark ( CAMark mark) [inline]

References _markList.

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

Here is the caller graph for this function:

void CAMusElement::setColor ( const QColor  c) [inline]

References _color.

Referenced by CACanorusMLImport::startElement().

Here is the caller graph for this function:

CAContext* CAMusElement::setContext ( CAContext context) [inline]

References _context, and context().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void CAMusElement::setMusElementType ( CAMusElementType  type) [inline, protected]
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:

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::assignTimes(), CAPlayable::calculateTimeLength(), and CASlur::CASlur().

Here is the caller graph for this function:

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(), CAVoice::insert(), CAVoice::insertInTupletAndVoiceAt(), CAMainWin::pasteAt(), CAPlayable::resetTime(), and CAVoice::updateTimes().

Here is the caller graph for this function:

void CAMusElement::setVisible ( const bool  v) [inline]

References _visible.

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::assignTimes(), CAScoreViewPort::coordsToTime(), CAMainWin::deleteSelection(), CAMainWin::insertMusElementAt(), CAPlayable::resetTime(), CAMainWin::scoreViewPortMousePress(), CAStaff::synchronizeVoices(), CATuplet::timeLength(), and CANote::updateTies().

Here is the call graph for this function:

Here is the caller graph for this function:

CAMusElement::timeLength ( ) [inline, virtual]
CAMusElement::timeStart ( ) [inline, virtual]

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

Reimplemented in CATuplet.

References _timeStart.

Referenced by CATuplet::addNote(), CAVoice::addNoteToChord(), CALyricsContext::addSyllable(), CAVoice::append(), CAScoreViewPort::calculateTime(), CASlur::CASlur(), CACrescendo::clone(), CARest::clone(), CANote::clone(), CABarline::clone(), CASyllable::clone(), CAMark::clone(), CAFunctionMark::clone(), CAKeySignature::clone(), CARest::composeRests(), CAMusElementFactory::configureNote(), CAScoreViewPort::coordsToTime(), CAMainWin::copySelection(), CAMainWin::deleteSelection(), CACanorusMLImport::endElement(), CACanorusMLExport::exportMarks(), CALilyPondExport::exportPlayable(), CACanorusMLExport::exportTime(), CALilyPondExport::exportVoiceImpl(), CALilyPondImport::findSharedElement(), CAMidiImport::findSharedElement(), CANote::getChord(), CAVoice::insert(), CAVoice::insertInTupletAndVoiceAt(), CAMainWin::insertMusElementAt(), CANote::isFirstInChord(), CANote::isLastInChord(), CANote::isPartOfChord(), CAPlayableLength::matchToBars(), CAKeybdInput::midiInEventToScore(), CATuplet::nextTimed(), CAMainWin::on_uiPlayableLength_toggled(), CAMainWin::pasteAt(), CAMusElementFactory::placeAutoBar(), CAMusicXmlImport::readNote(), CAPlayable::resetTime(), CAMainWin::scoreViewPortKeyPress(), CAMainWin::scoreViewPortMousePress(), CAStaff::synchronizeVoices(), timeEnd(), CAScoreViewPort::timeToCoords(), CAScoreViewPort::timeToCoordsSimpleVersion(), and CANote::updateTies().

Here is the caller graph for this function:


Member Data Documentation

QColor CAMusElement::_color [protected]

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

Pointer to the context which the music element belongs to.

See also:
context()

Referenced by CAMusElement(), context(), CASyllable::lyricsContext(), CAMark::setAssociatedElement(), setContext(), CAPlayable::setVoice(), and CAPlayable::staff().

QList< CAMark* > CAMusElement::_markList [protected]
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().

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(), setTimeLength(), and timeLength().

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(), CATimeSignature::clone(), CAClef::clone(), CANote::isFirstInChord(), CANote::isLastInChord(), CANote::isPartOfChord(), setTimeStart(), and timeStart().

bool CAMusElement::_visible [protected]

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


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