Canorus 0.0
Public Member Functions | Static 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)
 
void addBarline (CADrawableBarline *barline)
 
bool removeClef (CADrawableClef *clef)
 
bool removeKeySignature (CADrawableKeySignature *keySig)
 
bool removeTimeSignature (CADrawableTimeSignature *keySig)
 
bool removeBarline (CADrawableBarline *barline)
 
CAClefgetClef (double x)
 
CAKeySignaturegetKeySignature (double x)
 
QList< CADrawableTimeSignature * > & drawableTimeSignatureList ()
 
CATimeSignaturegetTimeSignature (double x)
 
QList< CADrawableBarline * > & drawableBarlineList ()
 
CABarlinegetBarline (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 ()
 
virtual void addMElement (CADrawableMusElement *elt)
 
virtual int removeMElement (CADrawableMusElement *elt)
 
CADrawableMusElementlastDrawableMusElement ()
 
virtual CADrawableContextclone ()=0
 
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 ()
 
virtual void draw (QPainter *p, const CADrawSettings s)=0
 
virtual CADrawableclone ()
 
void drawHScaleHandles (QPainter *p, const CADrawSettings s)
 
void drawVScaleHandles (QPainter *p, const CADrawSettings s)
 
CADrawableType drawableType ()
 
double xPos () const
 
double yPos () const
 
double width () const
 
double height () const
 
double neededSpaceWidth () const
 
double neededSpaceHeight () const
 
double neededWidth () const
 
double neededHeight () const
 
double xCenter () const
 
double yCenter () const
 
const QRect bBox () const
 
bool isVisible () const
 
bool isSelectable () const
 
bool isHScalable () const
 
bool isVScalable () const
 
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)
 

Static Public Member Functions

static bool xDrawableBarlineLessThan (const CADrawableBarline *a, const double x)
 

Private Attributes

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

Static Private Attributes

static const double STAFFLINE_WIDTH = 0.8
 

Additional Inherited Members

- Public Types inherited from CADrawableContext
enum  CADrawableContextType { DrawableStaff , DrawableLyricsContext , DrawableFiguredBassContext , DrawableFunctionMarkContext }
 
- Public Types inherited from CADrawable
enum  CADrawableType { DrawableMusElement , DrawableContext }
 
enum  CADirection {
  Undefined , Top , Bottom , Left ,
  Right , TopLeft , TopRight , BottomLeft ,
  BottomRight
}
 
- Protected Member Functions inherited from CADrawableContext
void setDrawableContextType (CADrawableContextType type)
 
- Protected Member Functions inherited from CADrawable
void setDrawableType (CADrawableType t)
 
- Protected Attributes inherited from CADrawableContext
CADrawableContextType _drawableContextType
 
CAContext_context
 
QList< CADrawableMusElement * > _drawableMusElementList
 
- Protected Attributes inherited from CADrawable
CADrawableType _drawableType
 
double _xPos
 
double _yPos
 
double _width
 
double _height
 
double _neededSpaceWidth
 
double _neededSpaceHeight
 
bool _visible
 
bool _selectable
 
bool _hScalable
 
bool _vScalable
 
- Static Protected Attributes inherited from CADrawable
static const int SCALE_HANDLES_SIZE = 2
 

Constructor & Destructor Documentation

◆ CADrawableStaff()

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

◆ addBarline()

void CADrawableStaff::addBarline ( CADrawableBarline barline)

Adds a barline barlineto the barline list for faster search when drawing the ruler.

References _drawableBarlineList, and CADrawable::xPos().

Referenced by addMElement().

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

◆ addClef()

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:

◆ addKeySignature()

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:

◆ addMElement()

void CADrawableStaff::addMElement ( CADrawableMusElement elt)
virtual

◆ addTimeSignature()

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:

◆ calculateCenterYCoord() [1/5]

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:

◆ calculateCenterYCoord() [2/5]

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:

◆ calculateCenterYCoord() [3/5]

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:

◆ calculateCenterYCoord() [4/5]

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(), calculateCenterYCoord(), and CALayoutEngine::reposit().

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

◆ calculateCenterYCoord() [5/5]

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:

◆ calculatePitch()

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::scoreViewMouseMove().

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

◆ clone()

CADrawableStaff * CADrawableStaff::clone ( )
virtual

Implements CADrawableContext.

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

Here is the call graph for this function:

◆ draw()

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

◆ drawableBarlineList()

QList< CADrawableBarline * > & CADrawableStaff::drawableBarlineList ( )
inline

References _drawableBarlineList.

Referenced by CAScoreView::computeBarlinePositions().

Here is the caller graph for this function:

◆ drawableTimeSignatureList()

QList< CADrawableTimeSignature * > & CADrawableStaff::drawableTimeSignatureList ( )
inline

References _drawableTimeSignatureList.

Referenced by CAScoreView::computeBarlinePositions().

Here is the caller graph for this function:

◆ getAccs()

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, getKeySignature(), and CADrawable::xPos().

Referenced by CAMainWin::scoreViewMouseMove().

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

◆ getBarline()

CABarline * CADrawableStaff::getBarline ( double  x)

References _drawableBarlineList, and xDrawableBarlineLessThan().

Here is the call graph for this function:

◆ getClef()

CAClef * CADrawableStaff::getClef ( double  x)

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

References _drawableClefList.

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

Here is the caller graph for this function:

◆ getKeySignature()

CAKeySignature * CADrawableStaff::getKeySignature ( double  x)

References _drawableKeySignatureList.

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

Here is the caller graph for this function:

◆ getTimeSignature()

CATimeSignature * CADrawableStaff::getTimeSignature ( double  x)

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

References _drawableTimeSignatureList.

◆ lineSpace()

double CADrawableStaff::lineSpace ( )
inline

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

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

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

◆ removeBarline()

bool CADrawableStaff::removeBarline ( CADrawableBarline barline)

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

References _drawableBarlineList.

◆ removeClef()

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:

◆ removeKeySignature()

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:

◆ removeMElement()

int CADrawableStaff::removeMElement ( CADrawableMusElement elt)
virtual

◆ removeTimeSignature()

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:

◆ staff()

CAStaff * CADrawableStaff::staff ( )
inline

References CADrawableContext::_context.

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

Here is the caller graph for this function:

◆ xDrawableBarlineLessThan()

bool CADrawableStaff::xDrawableBarlineLessThan ( const CADrawableBarline a,
const double  x 
)
static

Helper function for getBarline() when doing the binary search over elements.

References CADrawable::xPos().

Referenced by getBarline().

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

Member Data Documentation

◆ _drawableBarlineList

QList<CADrawableBarline *> CADrawableStaff::_drawableBarlineList
private

◆ _drawableClefList

QList<CADrawableClef *> CADrawableStaff::_drawableClefList
private

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

◆ _drawableKeySignatureList

QList<CADrawableKeySignature *> CADrawableStaff::_drawableKeySignatureList
private

◆ _drawableTimeSignatureList

QList<CADrawableTimeSignature *> CADrawableStaff::_drawableTimeSignatureList
private

◆ STAFFLINE_WIDTH

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: