CADrawableStaff Class Reference

#include <drawablestaff.h>

Inheritance diagram for CADrawableStaff:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 CADrawableStaff (CAStaff *staff, int x, int y)
void draw (QPainter *, const CADrawSettings s)
CADrawableStaffclone ()
CAStaffstaff ()
float lineSpace ()
int calculateCenterYCoord (int pitch, CAClef *clef)
int calculateCenterYCoord (CANote *note, CAClef *clef)
int calculateCenterYCoord (CANote *note, int x)
int calculateCenterYCoord (int pitch, int x)
int calculateCenterYCoord (int y)
int calculatePitch (int x, int 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 (int x)
CAKeySignaturegetKeySignature (int x)
CATimeSignaturegetTimeSignature (int x)
int getAccs (int 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 float STAFFLINE_WIDTH = 0.8


Detailed Description

Definition at line 22 of file drawablestaff.h.


Constructor & Destructor Documentation

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

Definition at line 22 of file drawablestaff.cpp.

References CADrawableContext::_drawableContextType, CADrawable::_height, CADrawable::_width, and CADrawableContext::DrawableStaff.

Referenced by clone().

Here is the caller graph for this function:


Member Function Documentation

void CADrawableStaff::draw ( QPainter *  p,
const CADrawSettings  s 
) [virtual]

Implements CADrawable.

Definition at line 28 of file drawablestaff.cpp.

References CADrawable::_height, CADrawSettings::color, CAStaff::numberOfLines(), staff(), STAFFLINE_WIDTH, CADrawSettings::w, CADrawSettings::y, and CADrawSettings::z.

Here is the call graph for this function:

CADrawableStaff * CADrawableStaff::clone (  )  [virtual]

Implements CADrawableContext.

Definition at line 42 of file drawablestaff.cpp.

References CADrawable::_xPos, CADrawable::_yPos, CADrawableStaff(), and staff().

Here is the call graph for this function:

CAStaff* CADrawableStaff::staff (  )  [inline]

Definition at line 27 of file drawablestaff.h.

References CADrawableContext::_context.

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

Here is the caller graph for this function:

float CADrawableStaff::lineSpace (  )  [inline]

Definition at line 29 of file drawablestaff.h.

References CADrawable::_height, and staff().

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

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

Definition at line 55 of file drawablestaff.cpp.

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:

int 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:
note Note which the following coordinates are being calculated.
clef Corresponding clef.
Returns:
Center of a space/line of a staff in absolute world units.

Definition at line 99 of file drawablestaff.cpp.

References calculateCenterYCoord(), and CANote::pitch().

Here is the call graph for this function:

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

This is an overloaded member function, provided for convenience.

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

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

Definition at line 71 of file drawablestaff.cpp.

References calculateCenterYCoord(), getClef(), and CANote::pitch().

Here is the call graph for this function:

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

This is an overloaded member function, provided for convenience.

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

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

Definition at line 85 of file drawablestaff.cpp.

References calculateCenterYCoord(), and getClef().

Here is the call graph for this function:

int CADrawableStaff::calculateCenterYCoord ( int  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.

Definition at line 108 of file drawablestaff.cpp.

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

Here is the call graph for this function:

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

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

Parameters:
x X coordinate in absolute world units.
y Y coordinate in absolute world units.
Returns:
Note pitch in logical units.

Definition at line 123 of file drawablestaff.cpp.

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:

void CADrawableStaff::addClef ( CADrawableClef clef  ) 

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

Definition at line 134 of file drawablestaff.cpp.

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.

Definition at line 191 of file drawablestaff.cpp.

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::addTimeSignature ( CADrawableTimeSignature timeSig  ) 

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

Definition at line 218 of file drawablestaff.cpp.

References _drawableTimeSignatureList, and CADrawable::xPos().

Referenced by addMElement().

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.

Definition at line 144 of file drawablestaff.cpp.

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.

Definition at line 201 of file drawablestaff.cpp.

References _drawableKeySignatureList.

Referenced by removeMElement().

Here is the caller graph for this function:

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.

Definition at line 228 of file drawablestaff.cpp.

References _drawableTimeSignatureList.

Referenced by removeMElement().

Here is the caller graph for this function:

CAClef * CADrawableStaff::getClef ( int  x  ) 

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

Definition at line 151 of file drawablestaff.cpp.

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 ( int  x  ) 

Definition at line 208 of file drawablestaff.cpp.

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 ( int  x  ) 

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

Definition at line 235 of file drawablestaff.cpp.

References _drawableTimeSignatureList, and CADrawable::xPos().

Here is the call graph for this function:

int CADrawableStaff::getAccs ( int  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.

Definition at line 163 of file drawablestaff.cpp.

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:

void CADrawableStaff::addMElement ( CADrawableMusElement elt  )  [virtual]

Reimplemented from CADrawableContext.

Definition at line 242 of file drawablestaff.cpp.

References CADrawableContext::_drawableMusElementList, addClef(), addKeySignature(), addTimeSignature(), CADrawableMusElement::DrawableClef, CADrawableMusElement::DrawableKeySignature, CADrawableMusElement::drawableMusElementType(), and CADrawableMusElement::DrawableTimeSignature.

Here is the call graph for this function:

int CADrawableStaff::removeMElement ( CADrawableMusElement elt  )  [virtual]

Reimplemented from CADrawableContext.

Definition at line 258 of file drawablestaff.cpp.

References CADrawableContext::_drawableMusElementList, CADrawableMusElement::DrawableClef, CADrawableMusElement::DrawableKeySignature, CADrawableMusElement::drawableMusElementType(), CADrawableMusElement::DrawableTimeSignature, removeClef(), removeKeySignature(), and removeTimeSignature().

Here is the call graph for this function:


Member Data Documentation

QList<CADrawableClef *> CADrawableStaff::_drawableClefList [private]

Definition at line 56 of file drawablestaff.h.

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

QList<CADrawableKeySignature *> CADrawableStaff::_drawableKeySignatureList [private]

Definition at line 57 of file drawablestaff.h.

Referenced by addKeySignature(), getKeySignature(), and removeKeySignature().

QList<CADrawableTimeSignature *> CADrawableStaff::_drawableTimeSignatureList [private]

Definition at line 58 of file drawablestaff.h.

Referenced by addTimeSignature(), getTimeSignature(), and removeTimeSignature().

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

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 COPYING for details.

Definition at line 59 of file drawablestaff.h.

Referenced by draw().


The documentation for this class was generated from the following files:
Generated on Sat Feb 9 13:13:29 2008 for Canorus by  doxygen 1.5.3