Planeshift
SheetLine Class Reference

#include <pawssheetline.h>

Public Member Functions

ChordAdvance (uint divisions)
 This function pushes a new empty chord at the end of the line and it returns. More...
 
SheetLineAttachNewLine (Measure *firstMeasure)
 If this is the last measure, this method creates a new empty line and attaches it after this one. More...
 
bool Contains (Measure *measure)
 Check if this line contains the given measure. More...
 
void DeleteMeasure (Measure *measure)
 Delete the given measure if it belongs to this line. More...
 
void Draw (pawsSheetLine *pawsLine, Chord *selectedChord, int startPosition, int height)
 Draws this line. More...
 
MeasureGetFirstMeasure ()
 Returns the first measure of the line. More...
 
MeasureGetLastMeasure ()
 Returns the last measure of the line. More...
 
bool HasFirstMeasure ()
 Returns true if this line contains the first measure. More...
 
bool HasLastMeasure ()
 Returns true if this line contains the last measure. More...
 
bool Hit (int x, Chord *&chord, Measure *&measure, bool &before)
 Check if a chord in this line is hit and return the chord and its measure. More...
 
MeasureInsertNewMeasure (Measure *measureAfter)
 Inserts a new measure before the given one. More...
 
SheetLineNext ()
 Returns the next SheetLine. More...
 
SheetLinePrev ()
 Returns the previous SheetLine. More...
 
void PushMeasure (Measure *measure)
 Push a measure at the end of the line. More...
 
bool Resize ()
 Fixes the measures of this line and their size. More...
 
void ResizeAll (bool forceAll=false)
 Fixes the measures and their size of this line and all the following. More...
 
void SetCallback (void *object, void(*function)(void *, SheetLine *))
 Sets the callback function that will be called when a new sheet line is added or deleted. More...
 
bool SetSize (uint size, pawsSheetLine *pawsLine)
 Set the size and drawing parameters for this line. More...
 
 SheetLine (Measure *firstMeasure)
 Constructor. More...
 
 ~SheetLine ()
 Destructor. More...
 

Detailed Description

Definition at line 473 of file pawssheetline.h.

Constructor & Destructor Documentation

SheetLine::SheetLine ( Measure firstMeasure)

Constructor.

Parameters
firstMeasurethe first measure of the SheetLine.
SheetLine::~SheetLine ( )

Destructor.

It does not delete its measures.

Member Function Documentation

Chord* SheetLine::Advance ( uint  divisions)

This function pushes a new empty chord at the end of the line and it returns.

It should be called only to move the final cursor forward. If the line is completed, it creates a new line.

Parameters
divisionsthe number of sixteenths per measure.
Returns
the new chord.
SheetLine* SheetLine::AttachNewLine ( Measure firstMeasure)

If this is the last measure, this method creates a new empty line and attaches it after this one.

The new line has the same size and the same callback as this one.

Parameters
firstMeasurethe first measure of the new line.
Returns
the attached SheetLine, a null pointer if this is not the last line.
bool SheetLine::Contains ( Measure measure)

Check if this line contains the given measure.

Parameters
measurethe measure to look for.
Returns
true if this line contains the given measure, false otherwise.
void SheetLine::DeleteMeasure ( Measure measure)

Delete the given measure if it belongs to this line.

If it is the last measure, the method just empties it.

Parameters
measurethe measure to delete.
void SheetLine::Draw ( pawsSheetLine pawsLine,
Chord selectedChord,
int  startPosition,
int  height 
)

Draws this line.

Parameters
pawsLinethe pawsSheetLine that store the font-dependent parameters.
selectedChordthe current selected chord.
startPositionthe horizontal position where the first measure must be drawn.
heightthe height of the staff.
Measure* SheetLine::GetFirstMeasure ( )
inline

Returns the first measure of the line.

Returns
the first measure of the line.

Definition at line 522 of file pawssheetline.h.

Measure* SheetLine::GetLastMeasure ( )
inline

Returns the last measure of the line.

Returns
the last measure of the line.

Definition at line 528 of file pawssheetline.h.

bool SheetLine::HasFirstMeasure ( )
inline

Returns true if this line contains the first measure.

Returns
true if this is the first line, false otherwise.

Definition at line 503 of file pawssheetline.h.

bool SheetLine::HasLastMeasure ( )
inline

Returns true if this line contains the last measure.

Returns
true if this is the last line, false otherwise.

Definition at line 509 of file pawssheetline.h.

bool SheetLine::Hit ( int  x,
Chord *&  chord,
Measure *&  measure,
bool &  before 
)

Check if a chord in this line is hit and return the chord and its measure.

Parameters
xthe horizontal position of the input from the beginning of the line.
chordat the end this pointer will contain the hit chord or null if any chord has been hit.
measureat the end this pointer will contain the measure containing the hit chord or a null pointer if nothing is hit.
beforeat the end this boolean will be true if the click has happened before the selected chord, false if after.
Returns
true if a note has been hit, false otherwise.
Measure* SheetLine::InsertNewMeasure ( Measure measureAfter)

Inserts a new measure before the given one.

Parameters
measureAfterthe measure after the new one.
Returns
the new measure.
SheetLine* SheetLine::Next ( )
inline

Returns the next SheetLine.

Returns
the next SheetLine.

Definition at line 491 of file pawssheetline.h.

SheetLine* SheetLine::Prev ( )
inline

Returns the previous SheetLine.

Returns
the previous SheetLine.

Definition at line 497 of file pawssheetline.h.

void SheetLine::PushMeasure ( Measure measure)

Push a measure at the end of the line.

After this method a resize should be done.

Parameters
measurethe measure to push.
bool SheetLine::Resize ( )

Fixes the measures of this line and their size.

Returns
true if the following lines should be updated too, false otherwise.
void SheetLine::ResizeAll ( bool  forceAll = false)

Fixes the measures and their size of this line and all the following.

Parameters
forceAllif true all the sheet lines are resized, otherwise it continues only until the last measure is the same as before the resize.
void SheetLine::SetCallback ( void *  object,
void(*)(void *, SheetLine *)  function 
)

Sets the callback function that will be called when a new sheet line is added or deleted.

Parameters
objectthe callback object.
functionthe callback function.
bool SheetLine::SetSize ( uint  size,
pawsSheetLine pawsLine 
)

Set the size and drawing parameters for this line.

Parameters
sizethe new size.
pawsLinethe pawsSheetLine with the drawing parameters.
Returns
true if the line's size is changed.

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