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

#include <drawablestaff.h>

Inheritance diagram for CADrawableStaff:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CADrawableStaff (CAStaff *staff, double x, double y)
void draw (QPainter *, const CADrawSettings s)
CADrawableStaffclone ()
CAStaffstaff ()
double lineSpace ()
double calculateCenterYCoord (int pitch, CAClef *clef)
double calculateCenterYCoord (CANote *note, CAClef *clef)
double calculateCenterYCoord (CANote *note, double x)
double calculateCenterYCoord (int pitch, double x)
double calculateCenterYCoord (double y)
int calculatePitch (double x, double y)
void addClef (CADrawableClef *clef)
void addKeySignature (CADrawableKeySignature *keySig)
void addTimeSignature (CADrawableTimeSignature *keySig)
bool removeClef (CADrawableClef *clef)
bool removeKeySignature (CADrawableKeySignature *keySig)
bool removeTimeSignature (CADrawableTimeSignature *keySig)
CAClefgetClef (double x)
CAKeySignaturegetKeySignature (double x)
CATimeSignaturegetTimeSignature (double x)
int getAccs (double x, int pitch)
void addMElement (CADrawableMusElement *elt)
int removeMElement (CADrawableMusElement *elt)

Private Attributes

QList< CADrawableClef * > _drawableClefList
QList< CADrawableKeySignature * > _drawableKeySignatureList
QList< CADrawableTimeSignature * > _drawableTimeSignatureList

Static Private Attributes

static const double STAFFLINE_WIDTH = 0.8

Constructor & Destructor Documentation

CADrawableStaff::CADrawableStaff ( CAStaff staff,
double  x,
double  y 
)

References CADrawableContext::_drawableContextType, CADrawableContext::DrawableStaff, CADrawable::setHeight(), and CADrawable::setWidth().

Referenced by clone().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

Adds a clef clef to the clef list for faster search of the current clef in the staff.

References _drawableClefList, and CADrawable::xPos().

Referenced by addMElement().

Here is the call graph for this function:

Here is the caller graph for this function:

Adds a key signature keySig to the key signatures list for faster search of the current key signature in the staff.

References _drawableKeySignatureList, and CADrawable::xPos().

Referenced by addMElement().

Here is the call graph for this function:

Here is the caller graph for this function:

Adds a time signature timeSig to the time signatures list for faster search of the current time signature in the staff.

References _drawableTimeSignatureList, and CADrawable::xPos().

Referenced by addMElement().

Here is the call graph for this function:

Here is the caller graph for this function:

double CADrawableStaff::calculateCenterYCoord ( int  pitch,
CAClef clef 
)

Returns the center Y coordinate of the given note in this staff.

Parameters:
pitchNote pitch which the following coordinates are being calculated for.
clefCorresponding clef.
Returns:
Center of a space/line of a staff in absolute world units.

References CAClef::c1(), CADrawable::height(), lineSpace(), and CADrawable::yPos().

Referenced by CADrawableKeySignature::CADrawableKeySignature(), and calculateCenterYCoord().

Here is the call graph for this function:

Here is the caller graph for this function:

double CADrawableStaff::calculateCenterYCoord ( CANote note,
CAClef clef 
)

This is an overloaded member function, provided for convenience.

Returns the center Y coordinate of the given note in this staff.

Parameters:
noteNote which the following coordinates are being calculated.
clefCorresponding clef.
Returns:
Center of a space/line of a staff in absolute world units.

References calculateCenterYCoord(), CANote::diatonicPitch(), and CADiatonicPitch::noteName().

Here is the call graph for this function:

double CADrawableStaff::calculateCenterYCoord ( CANote note,
double  x 
)

This is an overloaded member function, provided for convenience.

Returns the center Y coordinate of the given note in this staff.

Parameters:
noteNote which the following coordinates are being calculated.
xX coordinate of the note.
Returns:
Center of a space/line of a staff in absolute world units.

References calculateCenterYCoord(), CANote::diatonicPitch(), getClef(), and CADiatonicPitch::noteName().

Here is the call graph for this function:

double CADrawableStaff::calculateCenterYCoord ( int  pitch,
double  x 
)

This is an overloaded member function, provided for convenience.

Returns the center Y coordinate of the given note in this staff.

Parameters:
pitchNote pitch which the following coordinates are being calculated for.
xX coordinate of the note.
Returns:
Center of a space/line of a staff in absolute world units.

References calculateCenterYCoord(), and getClef().

Here is the call graph for this function:

Rounds the given Y coordinate to the nearest one so it fits a line or a space (ledger lines too, if needed) in a staff.

Returns:
Center of the nearest space/line of a staff, whichever is closer in absolute world units.

References lineSpace(), and CADrawable::yPos().

Here is the call graph for this function:

int CADrawableStaff::calculatePitch ( double  x,
double  y 
)

Calculates the note pitch on the given clef and absolute world Y coordinate.

Parameters:
xX coordinate in absolute world units.
yY coordinate in absolute world units.
Returns:
Note pitch in logical units.

References CAClef::c1(), getClef(), CADrawable::height(), lineSpace(), and CADrawable::yPos().

Referenced by CAMainWin::insertMusElementAt(), and CAMainWin::scoreViewPortMouseMove().

Here is the call graph for this function:

Here is the caller graph for this function:

Implements CADrawableContext.

References CADrawableStaff(), staff(), CADrawable::xPos(), and CADrawable::yPos().

Here is the call graph for this function:

void CADrawableStaff::draw ( QPainter *  p,
const CADrawSettings  s 
) [virtual]
int CADrawableStaff::getAccs ( double  x,
int  pitch 
)

Returns accidentals at the given X-coordinate and pitch. eg. -1 for one flat, 2 for two sharps. This is useful to determine the note's pitch to be placed in certain measure or part of the measure, if accidentals have been placed before.

References CADrawableContext::_drawableMusElementList, CAKeySignature::accidentals(), CADrawableMusElement::DrawableBarline, CADrawableMusElement::DrawableKeySignature, CADrawableMusElement::DrawableNote, and getKeySignature().

Referenced by CAMainWin::scoreViewPortMouseMove().

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the pointer to the last clef placed before the given X-coordinate.

References _drawableClefList, and CADrawable::xPos().

Referenced by CADrawableKeySignature::CADrawableKeySignature(), calculateCenterYCoord(), and calculatePitch().

Here is the call graph for this function:

Here is the caller graph for this function:

References _drawableKeySignatureList, and CADrawable::xPos().

Referenced by CADrawableKeySignature::CADrawableKeySignature(), and getAccs().

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the pointer to the last time signature placed before the given X-coordinate.

References _drawableTimeSignatureList, and CADrawable::xPos().

Here is the call graph for this function:

double CADrawableStaff::lineSpace ( ) [inline]

References CADrawable::height(), and staff().

Referenced by CADrawableClef::CADrawableClef(), calculateCenterYCoord(), calculatePitch(), and draw().

Here is the call graph for this function:

Here is the caller graph for this function:

Removes the given clef from the clefs-lookup list. Returns True, if the clef was successfully removed, False otherwise.

References _drawableClefList.

Referenced by removeMElement().

Here is the caller graph for this function:

Removes the given key signature from the key signatures-lookup list. Returns True, if the key signature was successfully removed, False otherwise.

References _drawableKeySignatureList.

Referenced by removeMElement().

Here is the caller graph for this function:

Removes the given time signature from the time signatures-lookup list. Returns True, if the time signature was successfully removed, False otherwise.

References _drawableTimeSignatureList.

Referenced by removeMElement().

Here is the caller graph for this function:

References CADrawableContext::_context.

Referenced by CADrawableKeySignature::CADrawableKeySignature(), clone(), draw(), and lineSpace().

Here is the caller graph for this function:


Member Data Documentation

Referenced by addClef(), getClef(), and removeClef().

const double CADrawableStaff::STAFFLINE_WIDTH = 0.8 [static, private]

Copyright (c) 2006-2009, Matevž Jekovec, Canorus development team All Rights Reserved. See AUTHORS for a complete list of authors.

Licensed under the GNU GENERAL PUBLIC LICENSE. See COPYING for details.

Referenced by draw().


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