Canorus 0.0
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
CAClef Class Reference

#include <clef.h>

Inheritance diagram for CAClef:
Inheritance graph
[legend]

Public Types

enum  CAPredefinedClefType {
  Undefined =-1 , Treble , Bass , French ,
  Soprano , Mezzosoprano , Alto , Tenor ,
  Baritone , Varbaritone , Subbass , Percussion ,
  Tablature
}
 
enum  CAClefType {
  F , G , C , PercussionHigh ,
  PercussionLow , Tab
}
 
- 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

 CAClef (CAPredefinedClefType type, CAStaff *staff, int time, int offsetInterval=0)
 
 CAClef (CAClefType type, int c1, CAStaff *staff, int time, int offset=0)
 
CAClefclone (CAContext *context=0)
 
CAStaffstaff ()
 
void setPredefinedType (CAPredefinedClefType type)
 
CAClefType clefType ()
 
const int c1 ()
 
const int centerPitch ()
 
int compare (CAMusElement *elt)
 
void setClefType (CAClefType type)
 
void setOffset (int offset)
 
int offset ()
 
- 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 clefTypeToString (CAClefType)
 
static CAClefType clefTypeFromString (const QString)
 
static const int offsetFromReadable (const int offsetInterval)
 
static const int offsetToReadable (const int offset)
 
- Static Public Member Functions inherited from CAMusElement
static const QString musElementTypeToString (CAMusElementType)
 
static CAMusElementType musElementTypeFromString (const QString)
 

Private Attributes

CAClefType _clefType
 
int _c1
 
int _centerPitch
 
int _offset
 

Additional Inherited Members

- Protected Member Functions inherited from CAMusElement
void setMusElementType (CAMusElementType type)
 
- 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

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.

Represents a clef in the score

This class represents every clef in the score. It directly inherits the base class CAMusElement. Element is not playable (_timeLength=0).

Member Enumeration Documentation

◆ CAClefType

Enumerator
PercussionHigh 
PercussionLow 
Tab 

◆ CAPredefinedClefType

Enumerator
Undefined 
Treble 
Bass 
French 
Soprano 
Mezzosoprano 
Alto 
Tenor 
Baritone 
Varbaritone 
Subbass 
Percussion 
Tablature 

Constructor & Destructor Documentation

◆ CAClef() [1/2]

CAClef::CAClef ( CAPredefinedClefType  type,
CAStaff staff,
int  time,
int  offsetInterval = 0 
)

Creates a new predefined clef with type type, parent staff and start time time. _timeLength is set to 0. offsetInterval can be custom -1,0,1 no offset, +8 or -8 etc. mean the 8 written above or below the clef which raises or lowers the clef for one octave or whichever interval. Offset is the musical interval, not the internal offset.

See also
CAPredefinedClefType, CAMusElement

References CAMusElement::_musElementType, _offset, CAMusElement::Clef, offsetFromReadable(), and setPredefinedType().

Referenced by clone().

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

◆ CAClef() [2/2]

CAClef::CAClef ( CAClefType  type,
int  c1,
CAStaff staff,
int  time,
int  offset = 0 
)

Creates a new clef with type type, location of middle C c1, time start time and parent staff. offset is the internal clef offset 0, +7, -7 etc. It does not affect c1.

See also
CAPredefinedClefType, CAMusElement

References _c1, CAMusElement::_musElementType, _offset, c1(), CAMusElement::Clef, offset(), and setClefType().

Here is the call graph for this function:

Member Function Documentation

◆ c1()

const int CAClef::c1 ( )
inline

◆ centerPitch()

const int CAClef::centerPitch ( )
inline

References _centerPitch.

◆ clefType()

CAClefType CAClef::clefType ( )
inline

References _clefType.

Referenced by compare(), CAMusicXmlExport::exportClef(), CALilyPondExport::exportVoiceImpl(), and CACanorusMLExport::exportVoiceImpl().

Here is the caller graph for this function:

◆ clefTypeFromString()

CAClef::CAClefType CAClef::clefTypeFromString ( const QString  type)
static

Converts QString type to clef type.

See also
CAClefType, clefTypeToString()

References C, F, G, PercussionHigh, PercussionLow, and Tab.

Referenced by CACanorusMLImport::startElement().

Here is the caller graph for this function:

◆ clefTypeToString()

const QString CAClef::clefTypeToString ( CAClefType  type)
static

Converts clef type to QString.

See also
CAClefType, clefTypeFromString()

References C, F, G, PercussionHigh, PercussionLow, and Tab.

Referenced by CACanorusMLExport::exportVoiceImpl().

Here is the caller graph for this function:

◆ clone()

CAClef * CAClef::clone ( CAContext context = 0)
virtual

Clones a music element with exact properties including the context.

Implements CAMusElement.

References _c1, _clefType, _offset, CAMusElement::_timeStart, CAMusElement::addMark(), CAClef(), CAMusElement::context(), and CAMusElement::markList().

Here is the call graph for this function:

◆ compare()

int CAClef::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 _c1, _clefType, _offset, c1(), CAMusElement::Clef, clefType(), CAMusElement::musElementType(), and offset().

Here is the call graph for this function:

◆ offset()

int CAClef::offset ( )
inline

◆ offsetFromReadable()

const int CAClef::offsetFromReadable ( const int  offset)
static

Converts the musical interval offset to Canorus internal offset. This method is usually called where user inputs the offset interval and it needs to be stored.

See also
offsetToReadable()

References offset().

Referenced by CAClef(), and CAMainWin::on_uiClefOffset_valueChanged().

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

◆ offsetToReadable()

const int CAClef::offsetToReadable ( const int  offsetInterval)
static

Converts the internal clef offset to the musical interval. eg. offset +1 means +2 (supper second), +7 means +8 (supper octave), -7 means -8 (sub octave), 0 is an exception and stays 0 (instead of prime)

This method is usually called when displaying the offset of the key (eg. when rendering it).

See also
offsetFromReadable()

Referenced by CAMainWin::updateClefToolBar().

Here is the caller graph for this function:

◆ setClefType()

void CAClef::setClefType ( CAClefType  type)

Sets the clef type to type and update _c1 and _centerPitch.

See also
CAClefType, _clefType

References _centerPitch, _clefType, C, F, G, offset(), PercussionHigh, PercussionLow, and Tab.

Referenced by CAClef(), and setPredefinedType().

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

◆ setOffset()

void CAClef::setOffset ( int  offset)
inline

References _c1, _offset, and offset().

Referenced by CAMainWin::on_uiClefOffset_valueChanged().

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

◆ setPredefinedType()

void CAClef::setPredefinedType ( CAPredefinedClefType  type)

References _c1, Alto, Baritone, Bass, C, F, French, G, Mezzosoprano, offset(), Percussion, setClefType(), Soprano, Subbass, Tablature, Tenor, Treble, Undefined, and Varbaritone.

Referenced by CAClef().

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

◆ staff()

CAStaff * CAClef::staff ( )
inline

References CAMusElement::context().

Here is the call graph for this function:

Member Data Documentation

◆ _c1

CAClef::_c1
private

Location of the middle C:

  • 0 - 1st line
  • 1 - 1st space
  • -2 - 1st ledger line below staff (ie. C1 in treble clef) etc.
See also
c1(), _centerPitch

Referenced by c1(), CAClef(), clone(), compare(), setOffset(), and setPredefinedType().

◆ _centerPitch

CAClef::_centerPitch
private

Location of the clefs physical center:

  • 24 - f for bass clef
  • 32 - g for treble clef
  • 28 - middle C for c-clefs etc. This is needed for Y position in the staff calculation.
See also
centerPitch(), _c1

Referenced by centerPitch(), and setClefType().

◆ _clefType

CAClefType CAClef::_clefType
private

Referenced by clefType(), clone(), compare(), and setClefType().

◆ _offset

int CAClef::_offset
private

Referenced by CAClef(), clone(), compare(), offset(), and setOffset().


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