Canorus 0.0
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 Types inherited from CAMusElement
enum  CAMusElementType {
  Undefined = 0 , Note , Rest , MidiNote ,
  Barline , Clef , TimeSignature , KeySignature ,
  Slur , Tuplet , Syllable , FunctionMark ,
  FiguredBassMark , Mark
}
 

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)
 
virtual CAPlayableclone (CAVoice *voice=0)=0
 
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 ()
 
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 restTypeToString (CARestType)
 
static CARestType restTypeFromString (const QString)
 
static QList< CARest * > composeRests (int timeLength, int timeStart, CAVoice *voice=0, CARestType=Hidden)
 
- Static Public Member Functions inherited from CAMusElement
static const QString musElementTypeToString (CAMusElementType)
 
static CAMusElementType musElementTypeFromString (const QString)
 

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
 
- Protected Attributes inherited from CAMusElement
CAMusElementType _musElementType
 
QList< CAMark * > _markList
 
QList< CANoteCheckerError * > _noteCheckerErrorList
 
CAContext_context
 
int _timeStart
 
int _timeLength
 
bool _visible
 
QColor _color
 
QString _name
 

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

◆ CARestType

Enumerator
Undefined 
Normal 
Hidden 

Constructor & Destructor Documentation

◆ CARest()

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::~CARest ( )

Destroys the rest.

Member Function Documentation

◆ clone()

CARest * CARest::clone ( CAVoice voice = 0)
virtual

◆ compare()

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:

◆ composeRests()

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::timeLength(), CAMusElement::timeStart(), and CAPlayable::voice().

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

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

◆ restType()

CARestType CARest::restType ( )
inline

◆ restTypeFromString()

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:

◆ restTypeToString()

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:

◆ setRestType()

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

◆ _restType

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: