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

Represents a rest in the score. More...

#include <rest.h>

Inheritance diagram for CARest:
Inheritance graph
[legend]

List of all members.

Public Types

enum  CARestType { Undefined = -1, Normal, Hidden }

Public Member Functions

 CARest (CARestType type, CAPlayableLength length, CAVoice *voice, int timeStart, int timeLength=-1)
 ~CARest ()
CARestclone (CAVoice *voice=0)
CARestType restType ()
void setRestType (CARestType type)
int compare (CAMusElement *elt)

Static Public Member Functions

static const QString restTypeToString (CARestType)
static CARestType restTypeFromString (const QString)
static QList< CARest * > composeRests (int timeLength, int timeStart, CAVoice *voice=0, CARestType=Hidden)

Private Attributes

CARestType _restType

Detailed Description

Represents a rest 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 represents every rest in the score. It inherits the base class CAPlayable.

Member Enumeration Documentation

Enumerator:
Undefined 
Normal 
Hidden 

Constructor & Destructor Documentation

CARest::CARest ( CARestType  type,
CAPlayableLength  length,
CAVoice voice,
int  timeStart,
int  timeLength = -1 
)

Creates a new rest with given type, playable length length in voice voice with starting time in the score timeStart and number of dots dotted. timeLength is calculated automatically from the playable length.

See also:
CARestType, CAPlayableLength, CAPlayable, CAVoice

References CAMusElement::_musElementType, _restType, and CAMusElement::Rest.

Referenced by clone(), and composeRests().

Here is the caller graph for this function:

Destroys the rest.


Member Function Documentation

CARest * CARest::clone ( CAVoice voice = 0) [virtual]
int CARest::compare ( CAMusElement elt) [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.

Implements CAMusElement.

References CAMusElement::musElementType(), CAPlayable::playableLength(), and CAMusElement::Rest.

Here is the call graph for this function:

QList< CARest * > CARest::composeRests ( int  timeLength,
int  timeStart,
CAVoice voice = 0,
CARestType  type = Hidden 
) [static]

Generates a list of new rests in the total length of timeLength. Rests are sorted from the shortes to the longest one. The first rest has the given timeStart. Passing voice and restType is optional.

This function is usually called when a gap between two voices with shared elements appear in one voice and the gap with custom length needs to be filled with rests.

Note:
Only non-dotted rests are generated.

References CAPlayableLength::Breve, CARest(), CAMusElement::timeStart(), and CAPlayable::voice().

Referenced by CAMainWin::deleteSelection(), CAMainWin::insertMusElementAt(), CAMainWin::on_uiPlayableLength_toggled(), CAMusicXmlImport::readForward(), CAMainWin::scoreViewPortKeyPress(), and CAStaff::synchronizeVoices().

Here is the call graph for this function:

Here is the caller graph for this function:

References _restType.

Referenced by clone(), CALilyPondExport::exportPlayable(), CACanorusMLExport::exportVoiceImpl(), and CAMainWin::updatePlayableToolBar().

Here is the caller graph for this function:

Converts rest type from QString to CARestType. This is usually used when loading the score.

See also:
CARestType, CACanorusML

References Hidden, and Normal.

Referenced by CACanorusMLImport::startElement().

Here is the caller graph for this function:

const QString CARest::restTypeToString ( CARestType  type) [static]

Converts rest type CARestType to QString. This is usually used when saving the score.

See also:
CARestType, CACanorusML

References Hidden, and Normal.

Referenced by CACanorusMLExport::exportVoiceImpl().

Here is the caller graph for this function:

void CARest::setRestType ( CARestType  type) [inline]

References _restType.

Referenced by CAMainWin::on_uiHiddenRest_toggled().

Here is the caller graph for this function:


Member Data Documentation

CARest::_restType [private]

Type of the rest.

See also:
CARestType, restType()

Referenced by CARest(), restType(), and setRestType().


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