Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
CARest Class Reference

Represents a rest in the score. More...

#include <rest.h>

Inheritance diagram for CARest:
Inheritance graph
[legend]

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)
 
- Public Member Functions inherited from CAPlayable
 CAPlayable (CAPlayableLength length, CAVoice *voice, int timeStart, int timeLength=-1)
 
virtual ~CAPlayable ()
 
CAPlayableLengthplayableLength ()
 
void setPlayableLength (CAPlayableLength &l)
 
virtual CAPlayableclone (CAContext *context)
 
CATuplettuplet ()
 
void setTuplet (CATuplet *t)
 
CAVoicevoice ()
 
void setVoice (CAVoice *v)
 
CAStaffstaff ()
 
bool isFirstInTuplet ()
 
bool isLastInTuplet ()
 
void resetTime ()
 
void calculateTimeLength ()
 
- Public Member Functions inherited from CAMusElement
 CAMusElement (CAContext *context, int timeStart, int timeLength=0)
 
virtual ~CAMusElement ()
 
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 restTypeToString (CARestType)
 
static CARestType restTypeFromString (const QString)
 
static QList< CARest * > composeRests (int timeLength, int timeStart, CAVoice *voice=0, CARestType=Hidden)
 

Private Attributes

CARestType _restType
 

Additional Inherited Members

- Protected Member Functions inherited from CAMusElement
void setMusElementType (CAMusElementType type)
 
- Protected Attributes inherited from CAPlayable
CAPlayableLength _playableLength
 
CAVoice_voice
 
CATuplet_tuplet
 

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:

CARest::~CARest ( )

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:

CARestType CARest::restType ( )
inline

References _restType.

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

Here is the caller graph for this function:

CARest::CARestType CARest::restTypeFromString ( const QString  type)
static

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: