Lomse library. API documentation
0.30.0
|
#include <lomse_measure_highlight.h>
MeasureHighlight is an ApplicationMark to display a colored background on any score measure.
MeasureHighlight objects are created by the Interactor associated to the View on which the highlight is going to be displayed.
See: Interactor::add_measure_highlight().
By default, the highlight will cover the whole staff from top line of first staff to bottom line of bottom staff, plus an additional height above and below (the added space is the spacing between systems, half is added on top and half on bottom. This additional height can be chaged by method extra_height().
Methods top() and bottom() allows to define the vertical position and height of the mark by defining the reference instruments and staves that will be covered by the highlight. When using any of these methods, the additional height will be changed to be the staves margin. You can later change this value by using method extra_height().
The height and vertical position of the highlight can be changed at any moment. See top(), bottom() and extra_height() methods.
Previous image was created with the following code, when clicking on third measure:
Observe that the marker is overlayed on top of the score image. Thus, you should use transparent colours.
The marker can be trimmed to occupy just some instruments or staves. For instance, the next code trims the marker to the clicked instrument:
And this is the result:
Public Member Functions | |
Customizable properties | |
MeasureHighlight * | top (int instr, int staff=0) |
MeasureHighlight * | bottom (int instr, int staff=-1) |
MeasureHighlight * | extra_height (Tenths value=0) |
MeasureHighlight * | color (Color value) |
Access to current values | |
Color | get_color () const |
MeasureHighlight* MeasureHighlight::bottom | ( | int | instr, |
int | staff = -1 |
||
) |
Place the bottom of the mark at first line of the specified staff of an instrument.
instr | The instrument number (0..n-1) of the instrument. |
staff | The staff number (0..m-1), relative to the number of staves in the instrument. Special value -1 means "the last staff of the instrument". |
When invoking this method, the extra height for the mark will be changed to be the staves margin. You can later change this value by using method extra_height().
|
inline |
Set the color of the mark.
MeasureHighlight* MeasureHighlight::extra_height | ( | Tenths | value = 0 | ) |
Define the additional height to add, at top and bottom of the mark line. Please note that the line heigth will be incremented in twice the passed value, as the extra height value will be added at top and also at bottom.
This extra lenght is specified in tenths, referred to the first staff in the system on which the mark is placed.
|
inline |
Return the current mark color.
MeasureHighlight* MeasureHighlight::top | ( | int | instr, |
int | staff = 0 |
||
) |
Place the start of the mark at top line of the specified staff of an instrument.
instr | The instrument number (0..n-1) of the instrument. |
staff | The staff number (0..m-1), relative to the number of staves in the instrument. Special value -1 means "the last staff of the instrument". |
When invoking this method, the extra height for the mark will be changed to be the staves margin. You can later change this value by using method extra_height().