Planeshift
|
A measure containing measure elements. More...
#include <pawssheetline.h>
Classes | |
class | MeasureAttributes |
Keep general attributes that can change from a measure to another like key signature, beats and tempo. More... | |
Public Member Functions | |
void | AppendMeasure (Measure *measure) |
Append the given measure after this one. | |
void | AttachMeasure (Measure *measure) |
Insert the given measure after this one and update the chord list. | |
bool | Cut (uint divisions) |
Cut the last chords of the measures that exceeds the given number of durations. | |
void | DeleteAllElements () |
Delete all elements from the measure. | |
void | DeleteChord (Chord *chord) |
Deletes the chord if it belong to this measure. | |
void | DeleteElement (size_t n) |
Delete the element in position n. | |
void | Draw (pawsSheetLine *pawsLine, Chord *selectedChord, int startPosition) |
Draws this measure. | |
void | Empty () |
Deletes all the chords in this line and keeps only an empty chord. | |
void | Fill (uint divisions) |
Fills the measure with rests if it is incomplete. | |
void | Fit (const MeasureAttributes *const attributes) |
Remove the elements at the end of the measures that exceeds the total duration or push a rest if there are not enough elements. | |
MeasureAttributes | GetAttributes () const |
Get a copy of the attributes of this measure. | |
MeasureElementType & | GetElement (size_t n) |
Get the element at position n. | |
const MeasureElementType & | GetElement (size_t n) const |
uint | GetEnding () |
Gets the number of this ending. | |
uint | GetEndRepeat () |
Gets the number of times this part must be repeat. | |
Chord * | GetFirstChord () |
Returns the first chord of this measure. | |
Chord * | GetLastChord () |
Returns the last chord of this measure. | |
uint | GetMimimumSize (uint noteLength) |
Gets the mimimum size of this measure. | |
uint | GetNChords () |
Returns the number of chords in this measure. | |
size_t | GetNElements () const |
Get the number of elements in this measure. | |
int | GetNEndRepeat () const |
Get the number of time the repeat at the end of this measure must be performed. | |
uint | GetSize (uint noteLength) |
Returns the measure's size. | |
bool | GetStartRepeat () |
Gets the start repeat state. | |
bool | Hit (int x, Chord *&chord, bool &before) |
Check if a chord in this measure is hit. | |
Chord * | InsertChord (Chord *nearChord, bool before) |
Inserts a new empty chord before or after the given one. | |
void | InsertElement (size_t n, const MeasureElementType &element) |
Insert a copy of the given element after element n. | |
bool | IsEmpty () const |
Check if the measure has at least one element. | |
bool | IsEnding () const |
Return true if this is an ending measure. | |
bool | IsEndRepeat () const |
Return true if this measure ends a repeat section. | |
bool | IsStartRepeat () const |
Return true if this measure starts a repeat section. | |
Measure (csRef< iDocumentNode > measure, int quarterDivisions) | |
Constructor. | |
Measure () | |
Constructor. | |
Measure (Chord *firstChord) | |
Constructor. | |
Measure * | Next () |
Returns the next Measure. | |
Measure * | Prev () |
Returns the previous Measure. | |
void | PushChord (Chord *chord) |
Pushes a chord at the end of the measure. | |
size_t | PushElement (const MeasureElementType &element) |
Push a copy of the given element after all the elements currently in the measure. | |
void | SetBeat (int beats, int beatType) |
Set the beat information. | |
void | SetEnding (bool isEnding) |
Set this measure as an ending. | |
void | SetEnding (bool isEnding) |
Sets this measure as an ending and updates all the following endings. | |
void | SetEndRepeat (uint repeat) |
Sets the number of times this part must be repeat. | |
void | SetFifths (int fifths) |
void | SetNEndRepeat (int nEndRepeat) |
Set the number of time the repeat at the end of this measure must be performed. | |
bool | SetSize (uint size, uint noteLength) |
Sets the measure's size. | |
void | SetStartRepeat (bool isStartRepeat) |
Set this measure to start a repeat section. | |
void | SetStartRepeat (bool repeat) |
Sets the start repeat of this measure. | |
void | SetTempo (int tempo) |
csString | ToXML (uint number, csString attributes="") |
Writes this measure as a <measure> XML node. | |
~Measure () | |
Destructor. | |
~Measure () | |
Destructor. |
A measure containing measure elements.
Definition at line 229 of file pawssheetline.h.
Constructor.
Creates a non empty measure.
firstChord | the first chord of the measure. |
Measure< MeasureElementType >::Measure | ( | csRef< iDocumentNode > | measure, |
int | quarterDivisions | ||
) |
Constructor.
Creates a measure from a <measure> XML node.
measure | the <measure> XML node. |
quarterDivisions | the number of divisions in a quarter. |
void Measure< MeasureElementType >::AppendMeasure | ( | Measure< MeasureElementType > * | measure | ) |
Append the given measure after this one.
This is not an insertion and the next measure is lost.
measure | the measure to insert. |
void Measure< MeasureElementType >::AttachMeasure | ( | Measure< MeasureElementType > * | measure | ) |
Insert the given measure after this one and update the chord list.
If the given measure is already the next one it does nothing.
measure | the measure to insert. |
bool Measure< MeasureElementType >::Cut | ( | uint | divisions | ) |
Cut the last chords of the measures that exceeds the given number of durations.
divisions | the number of divisions that this measure must have. |
void Measure< MeasureElementType >::DeleteAllElements | ( | ) | [inline] |
Delete all elements from the measure.
Definition at line 422 of file scoreelements.h.
void Measure< MeasureElementType >::DeleteChord | ( | Chord * | chord | ) |
Deletes the chord if it belong to this measure.
chord | the chord to delete. |
void Measure< MeasureElementType >::DeleteElement | ( | size_t | n | ) | [inline] |
Delete the element in position n.
If n is not a valid index it does nothing.
n | The index of the measure element. |
Definition at line 417 of file scoreelements.h.
void Measure< MeasureElementType >::Draw | ( | pawsSheetLine * | pawsLine, |
Chord * | selectedChord, | ||
int | startPosition | ||
) |
Draws this measure.
pawsLine | the pawsSheetLine that store the font-dependent parameters. |
selectedChord | the current selected chord. |
startPosition | the horizontal position where the first chord must be drawn. |
void Measure< MeasureElementType >::Empty | ( | ) |
Deletes all the chords in this line and keeps only an empty chord.
void Measure< MeasureElementType >::Fill | ( | uint | divisions | ) |
Fills the measure with rests if it is incomplete.
Converts all the empty chords into rests of the same duration.
divisions | the number of divisions that this measure must have. |
void Measure< MeasureElementType >::Fit | ( | const MeasureAttributes *const | attributes | ) |
Remove the elements at the end of the measures that exceeds the total duration or push a rest if there are not enough elements.
The total duration is determined from the beat and beat type contained in the attributes. Attributes specified in this measure have priority. If they are undefined, the given attributes are used instead.
attributes | Attributes of previous measures. This can be a null pointer if this measure specifies both beat and beat type. If this is not the case however, the parameter must specify at least information about beat and beat type. |
MeasureAttributes Measure< MeasureElementType >::GetAttributes | ( | ) | const |
Get a copy of the attributes of this measure.
MeasureElementType& Measure< MeasureElementType >::GetElement | ( | size_t | n | ) | [inline] |
Get the element at position n.
n | The index of the element. |
Definition at line 450 of file scoreelements.h.
const MeasureElementType& Measure< MeasureElementType >::GetElement | ( | size_t | n | ) | const [inline] |
Get the element at position n.
n | The index of the element. |
Definition at line 455 of file scoreelements.h.
uint Measure< MeasureElementType >::GetEnding | ( | ) | [inline] |
Gets the number of this ending.
Definition at line 319 of file pawssheetline.h.
uint Measure< MeasureElementType >::GetEndRepeat | ( | ) | [inline] |
Gets the number of times this part must be repeat.
Definition at line 307 of file pawssheetline.h.
Chord* Measure< MeasureElementType >::GetFirstChord | ( | ) | [inline] |
Returns the first chord of this measure.
Definition at line 345 of file pawssheetline.h.
Chord* Measure< MeasureElementType >::GetLastChord | ( | ) | [inline] |
Returns the last chord of this measure.
Definition at line 351 of file pawssheetline.h.
uint Measure< MeasureElementType >::GetMimimumSize | ( | uint | noteLength | ) |
Gets the mimimum size of this measure.
noteLength | the length of a note. |
uint Measure< MeasureElementType >::GetNChords | ( | ) | [inline] |
Returns the number of chords in this measure.
Definition at line 266 of file pawssheetline.h.
size_t Measure< MeasureElementType >::GetNElements | ( | ) | const [inline] |
Get the number of elements in this measure.
Definition at line 462 of file scoreelements.h.
int Measure< MeasureElementType >::GetNEndRepeat | ( | ) | const [inline] |
Get the number of time the repeat at the end of this measure must be performed.
Definition at line 470 of file scoreelements.h.
uint Measure< MeasureElementType >::GetSize | ( | uint | noteLength | ) |
Returns the measure's size.
noteLength | the length of a note. |
bool Measure< MeasureElementType >::GetStartRepeat | ( | ) | [inline] |
Gets the start repeat state.
Definition at line 295 of file pawssheetline.h.
bool Measure< MeasureElementType >::Hit | ( | int | x, |
Chord *& | chord, | ||
bool & | before | ||
) |
Check if a chord in this measure is hit.
x | the horizontal position of the input from the beginning of the measure. |
chord | at the end this pointer will contains the hit chord or null if any chord has been hit. |
before | at the end this boolean will be true if the click has happened before the selected chord, false if after. |
Chord* Measure< MeasureElementType >::InsertChord | ( | Chord * | nearChord, |
bool | before | ||
) |
Inserts a new empty chord before or after the given one.
nearChord | the chord near the new one. |
before | true to insert before the given chord, false to insert it after. |
void Measure< MeasureElementType >::InsertElement | ( | size_t | n, |
const MeasureElementType & | element | ||
) |
Insert a copy of the given element after element n.
If n is greater than the number of elements in this measure, the element is pushed at the end.
n | The number of the element after which the given element must be inserted. |
element | The element to insert in the measure. |
bool Measure< MeasureElementType >::IsEmpty | ( | ) | const [inline] |
Check if the measure has at least one element.
Definition at line 486 of file scoreelements.h.
bool Measure< MeasureElementType >::IsEnding | ( | ) | const [inline] |
Return true if this is an ending measure.
Definition at line 493 of file scoreelements.h.
bool Measure< MeasureElementType >::IsEndRepeat | ( | ) | const [inline] |
Return true if this measure ends a repeat section.
Definition at line 500 of file scoreelements.h.
bool Measure< MeasureElementType >::IsStartRepeat | ( | ) | const [inline] |
Return true if this measure starts a repeat section.
Definition at line 507 of file scoreelements.h.
Returns the previous Measure.
Definition at line 260 of file pawssheetline.h.
void Measure< MeasureElementType >::PushChord | ( | Chord * | chord | ) |
Pushes a chord at the end of the measure.
chord | the new chord. |
size_t Measure< MeasureElementType >::PushElement | ( | const MeasureElementType & | element | ) | [inline] |
Push a copy of the given element after all the elements currently in the measure.
element | The element to push in the measure. |
Definition at line 515 of file scoreelements.h.
void Measure< MeasureElementType >::SetBeat | ( | int | beats, |
int | beatType | ||
) |
Set the beat information.
Both beats and beatType must be defined. If only one of them is undefined, both of them will be saved as undefined.
beats | The numerator of the time signature. |
beatType | The denominator of the time signature. |
void Measure< MeasureElementType >::SetEnding | ( | bool | isEnding | ) |
Set this measure as an ending.
isEnding | True if this is an ending, false otherwise. |
void Measure< MeasureElementType >::SetEnding | ( | bool | isEnding | ) |
Sets this measure as an ending and updates all the following endings.
isEnding | true if this is an ending. |
void Measure< MeasureElementType >::SetEndRepeat | ( | uint | repeat | ) | [inline] |
Sets the number of times this part must be repeat.
repeat | 0 to not repeat. |
Definition at line 313 of file pawssheetline.h.
Set the key signature as the number of accidentals.
fifths | The number of accidentals in the key signature. Positive for sharps, negative for flats. |
void Measure< MeasureElementType >::SetNEndRepeat | ( | int | nEndRepeat | ) |
Set the number of time the repeat at the end of this measure must be performed.
nEndRepeat | The number of time the repeat must be performed or 0 if this measure does not end a repeat. |
bool Measure< MeasureElementType >::SetSize | ( | uint | size, |
uint | noteLength | ||
) |
Sets the measure's size.
size | the new size of the measure. |
noteLength | the length of the note with the current font. |
void Measure< MeasureElementType >::SetStartRepeat | ( | bool | isStartRepeat | ) |
Set this measure to start a repeat section.
isEnding | True if this is the start of a repeat section, false otherwise. |
void Measure< MeasureElementType >::SetStartRepeat | ( | bool | repeat | ) | [inline] |
Sets the start repeat of this measure.
repeat | true to start a repeat, false otherwise. |
Definition at line 301 of file pawssheetline.h.
Set the tempo.
tempo | The new tempo. |
csString Measure< MeasureElementType >::ToXML | ( | uint | number, |
csString | attributes = "" |
||
) |
Writes this measure as a <measure> XML node.
number | the number of this measure. |
attributes | the attributes and direction nodes. |