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

#include <drawablestaff.h>

Inheritance diagram for CADrawableStaff:
Inheritance graph
[legend]

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)
 
- Public Member Functions inherited from CADrawableContext
 CADrawableContext (CAContext *c, double x, double y)
 
CAContextcontext ()
 
CADrawableContextType drawableContextType ()
 
CADrawableMusElementlastDrawableMusElement ()
 
QList< CADrawableMusElement * > & drawableMusElementList ()
 
CADrawableMusElementfindMElement (CAMusElement *elt)
 
QList< CADrawableMusElement * > findInRange (double x1, double x2)
 
- Public Member Functions inherited from CADrawable
 CADrawable (double x, double y)
 
virtual ~CADrawable ()
 
void drawHScaleHandles (QPainter *p, const CADrawSettings s)
 
void drawVScaleHandles (QPainter *p, const CADrawSettings s)
 
CADrawableType drawableType ()
 
double xPos ()
 
double yPos ()
 
double width ()
 
double height ()
 
double neededSpaceWidth ()
 
double neededSpaceHeight ()
 
double neededWidth ()
 
double neededHeight ()
 
double xCenter ()
 
double yCenter ()
 
const QRect bBox ()
 
bool isVisible ()
 
bool isSelectable ()
 
bool isHScalable ()
 
bool isVScalable ()
 
void setXPos (double xPos)
 
void setYPos (double yPos)
 
void setWidth (double width)
 
void setHeight (double height)
 
void setNeededSpaceWidth (double width)
 
void setNeededSpaceHeight (double height)
 
void setVisible (bool v)
 
void setSelectable (bool s)
 
void setHScalable (bool s)
 
void setVScalable (bool s)
 

Private Attributes

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

Static Private Attributes

static const double STAFFLINE_WIDTH = 0.8
 

Additional Inherited Members

- Public Types inherited from CADrawableContext
enum  CADrawableContextType { DrawableStaff, DrawableLyricsContext, DrawableFunctionMarkContext }
 
- Protected Member Functions inherited from CADrawableContext
void setDrawableContextType (CADrawableContextType type)
 
- Protected Attributes inherited from CADrawableContext
CADrawableContextType _drawableContextType
 
CAContext_context
 
QList< CADrawableMusElement * > _drawableMusElementList
 
- Static Protected Attributes inherited from CADrawable
static const int SCALE_HANDLES_SIZE = 2
 

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

void CADrawableStaff::addClef ( CADrawableClef clef)

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:

void CADrawableStaff::addKeySignature ( CADrawableKeySignature keySig)

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:

void CADrawableStaff::addMElement ( CADrawableMusElement elt)
virtual
void CADrawableStaff::addTimeSignature ( CADrawableTimeSignature timeSig)

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:

double CADrawableStaff::calculateCenterYCoord ( double  y)

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:

CADrawableStaff * CADrawableStaff::clone ( )
virtual

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:

CAClef * CADrawableStaff::getClef ( double  x)

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:

CAKeySignature * CADrawableStaff::getKeySignature ( double  x)

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:

CATimeSignature * CADrawableStaff::getTimeSignature ( double  x)

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:

bool CADrawableStaff::removeClef ( CADrawableClef clef)

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:

bool CADrawableStaff::removeKeySignature ( CADrawableKeySignature keySig)

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:

int CADrawableStaff::removeMElement ( CADrawableMusElement elt)
virtual
bool CADrawableStaff::removeTimeSignature ( CADrawableTimeSignature timeSig)

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:

CAStaff* CADrawableStaff::staff ( )
inline

References CADrawableContext::_context.

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

Here is the caller graph for this function:

Member Data Documentation

QList<CADrawableClef *> CADrawableStaff::_drawableClefList
private

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

QList<CADrawableKeySignature *> CADrawableStaff::_drawableKeySignatureList
private
QList<CADrawableTimeSignature *> CADrawableStaff::_drawableTimeSignatureList
private
const double CADrawableStaff::STAFFLINE_WIDTH = 0.8
staticprivate

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: