Lomse library. API documentation  0.30.0
GmoBoxSystem Class Reference

#include <lomse_box_system.h>

Inheritance diagram for GmoBoxSystem:
GmoBox GmoObj

Detailed Description

GmoBoxSystem is a container for all boxes and shapes that represents a line of music in the printed score. Its bounding box encloses all the notation for the system.

GmoBoxSystem is also responsible for storing and managing a table with the relation timepos –> position for all occupied timepos in the score.

The recorded positions are for the center of note heads or rests. The last position is for the barline (if exists).

This object is responsible for supplying all valid timepos and their positions so that other objects could, for instance: a) Determine the timepos to assign to a mouse click in a certain position. b) Draw a grid of valid timepos c) To determine the position for a beat.

Important: There can exist many entries for a given timepos, the first ones are the x position for the non-timed staffobjs, and the last one is the x position for the notes/rests at that timepos. For example, a barline and the next note do have the same timepos, but they are placed at different positions. This also happens when there exist non-timed staffobjs, such as clefs, key signatures and time signatures.

Public Member Functions

Information about measures
int get_first_measure (int iInstr)
 
int get_num_measures (int iInstr)
 
LUnits get_start_measure_xpos ()
 
Information about staves
GmoShapeStaffget_staff_shape (int absStaff)
 
GmoShapeStaffget_staff_shape (int iInstr, int iStaff)
 
int instr_number_for_staff (int absStaff)
 
int staff_number_for (int absStaff, int iInstr)
 
Information about time positions and coordiantes
TimeUnits start_time ()
 
TimeUnits end_time ()
 
LUnits get_x_for_note_rest_at_time (TimeUnits timepos)
 
LUnits get_x_for_barline_at_time (TimeUnits timepos)
 
- Public Member Functions inherited from GmoObj
LUnits get_width ()
 
LUnits get_height ()
 
LUnits get_left () const
 
LUnits get_top () const
 
LUnits get_right () const
 
LUnits get_bottom () const
 
bool bounds_contains_point (UPoint &p)
 
URect get_bounds ()
 
UPoint get_origin ()
 
USize get_size ()
 

Friends

class TimeSlice
 
class SystemLayouter
 
class GmoBoxScorePage
 

Member Function Documentation

◆ end_time()

TimeUnits GmoBoxSystem::end_time ( )

Returns the timepos at end of this system.

◆ get_first_measure()

int GmoBoxSystem::get_first_measure ( int  iInstr)

Returns the index (0..n-1) for the measure that starts in this system, or -1 if no measures in this instrument. This index has nothing to do with the displayed measure number. First measure has always index 0 regardless of whether the first measure is measure number 1 or is an incomplete measure (the score begins on pickup).

Parameters
iInstrThe index (0..n-1), in current layout, for instrument to which this request refer to. Take into account that in polymetric music (music in which not all instruments have the same time signature) the measure number is not a common value for all instruments and, thus measure numbers in a system will depend on which instrument you refer to. Thus, it is necessary to specify an instrument.

◆ get_num_measures()

int GmoBoxSystem::get_num_measures ( int  iInstr)

Returns the number of measures in this system for an instrument.

Parameters
iInstrThe index (0..n-1), in current layout, for instrument to which this request refer to. Take into account that in polymetric music (music in which not all instruments have the same time signature) the number of measures is not a common value for all instruments and, thus the number of measures in a system will depend on which instrument you refer to. Thus, it is necessary to specify an instrument.

◆ get_staff_shape() [1/2]

GmoShapeStaff* GmoBoxSystem::get_staff_shape ( int  absStaff)

Returns the shape object representing an staff.

Parameters
absStaffAbsolute index (0..n-1) to the desired staff. The top staff in a system has index 0, the next one below it has index 1, and so on.

◆ get_staff_shape() [2/2]

GmoShapeStaff* GmoBoxSystem::get_staff_shape ( int  iInstr,
int  iStaff 
)

Returns the shape object representing an staff.

Parameters
iInstrThe index (0..n-1), in current layout, for the instrument to which this request refer to.
iStaffThe index (0..n-1) to the desired staff referred to the instrument iInstr. The top staff in an instrument has index 0, the next one below it has index 1, and so on.

◆ get_start_measure_xpos()

LUnits GmoBoxSystem::get_start_measure_xpos ( )
inline

Lomse considers two positions for barlines when they are at the end of a system:

  • the real position at end of a system, and
  • the virtual position at start of next system (the first available position after prolog).

This method returns the virtual start position for the measure starting the system.

◆ get_x_for_barline_at_time()

LUnits GmoBoxSystem::get_x_for_barline_at_time ( TimeUnits  timepos)

Returns the x position for the given timepos. This method takes only barlines into account, ignoring other staff objects that could exist at the same timepos (e.g. any staffobj after the barline). Therefore, the returned value is the x position of the first barline found at the provided timepos.

The returned value is in logical units, relative to GmoDocPage origin.

Parameters
timeposAbsolute time units for the requested position.

See get_x_for_note_rest_at_time()

◆ get_x_for_note_rest_at_time()

LUnits GmoBoxSystem::get_x_for_note_rest_at_time ( TimeUnits  timepos)

Returns the x position for the given timepos. This method only takes notes and rests into account, ignoring other staff objects that could exist at the same timepos in different locations, such as a barline or a clef before the note/rest. The returned value is the x position at which notes/rests are vertically aligned with notes/rests at the same timepos in other staves. If there are no notes/rests at the requested timepos, this method provides an approximated interpolated value.

The returned value is in logical units, relative to GmoDocPage origin.

Parameters
timeposAbsolute time units for the requested position.

See get_x_for_barline_at_time()

◆ instr_number_for_staff()

int GmoBoxSystem::instr_number_for_staff ( int  absStaff)

Returns the instrument index (0..n-1), in current layout, to which a staff belongs.

Parameters
absStaffAbsolute index (0..n-1) of the staff to which this request refer to. The top staff in a system has index 0, the next one below it has index 1, and so on.

◆ staff_number_for()

int GmoBoxSystem::staff_number_for ( int  absStaff,
int  iInstr 
)

Helper method to convert absolute staff index into a relative one. Once you know the instrument to which a staff belongs (by using method instr_number_for_staff() ) this method allows to determine the relative staff index (0..n-1) referred to the instrument.

◆ start_time()

TimeUnits GmoBoxSystem::start_time ( )

Returns the timepos at start of this system.