Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(191)

Unified Diff: lily/multi-measure-rest.cc

Issue 4543055: Handles longa in MultiMeasureRest (Closed)
Patch Set: Created 12 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lily/multi-measure-rest-engraver.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lily/multi-measure-rest.cc
diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc
index 9628402a5ecec1ce899d4ef1d4ea57002b7529af..8f13e1c2c7926d251fd31046e4a998cdef18b22b 100644
--- a/lily/multi-measure-rest.cc
+++ b/lily/multi-measure-rest.cc
@@ -141,31 +141,29 @@ Multi_measure_rest::symbol_stencil (Grob *me, Real space)
Font_metric *musfont = Font_interface::get_default_font (me);
- SCM sml = me->get_property ("use-breve-rest");
+ bool use_longa = to_boolean (me->get_property ("use-longa-rest"));
+ bool use_breve = to_boolean (me->get_property ("use-breve-rest"));
+ int rest_max_value = -1;
+ if (use_longa)
+ rest_max_value = -2;
+
if (measures == 1)
{
- if (to_boolean (sml))
- {
- Stencil s = musfont->find_by_name (Rest::glyph_name (me, -1, "", false));
-
- s.translate_axis ((space - s.extent (X_AXIS).length ()) / 2, X_AXIS);
-
- return s;
- }
+ Stencil s;
+ if (use_breve || use_longa)
+ s = musfont->find_by_name (Rest::glyph_name (me, rest_max_value, "", false));
else
{
- Stencil s = musfont->find_by_name (Rest::glyph_name (me, 0, "", true));
+ s = musfont->find_by_name (Rest::glyph_name (me, 0, "", true));
/*
ugh.
*/
if (Staff_symbol_referencer::get_position (me) == 0.0)
s.translate_axis (staff_space, Y_AXIS);
-
- s.translate_axis ((space - s.extent (X_AXIS).length ()) / 2, X_AXIS);
-
- return s;
}
+ s.translate_axis ((space - s.extent (X_AXIS).length ()) / 2, X_AXIS);
+ return s;
}
else
return church_rest (me, musfont, measures, space);
@@ -213,13 +211,27 @@ Multi_measure_rest::church_rest (Grob *me, Font_metric *musfont, int measures,
int count = 0;
Real symbols_width = 0.0;
+ bool use_longa = to_boolean (me->get_property ("use-longa-rest"));
bool use_breve = to_boolean (me->get_property ("use-breve-rest"));
while (l)
{
- if (use_breve)
+ int k;
+ if (use_longa)
+ {
+ if (l >= 2)
+ {
+ l -= 2;
+ k = -3;
+ }
+ else
+ {
+ l -= 1;
+ k = -2;
+ }
+ }
+ else if (use_breve)
{
- int k;
if (l >= 2)
{
l -= 2;
@@ -230,14 +242,9 @@ Multi_measure_rest::church_rest (Grob *me, Font_metric *musfont, int measures,
l -= 1;
k = -1;
}
-
- Stencil r (musfont->find_by_name ("rests." + to_string (k)));
- symbols_width += r.extent (X_AXIS).length ();
- mols = scm_cons (r.smobbed_copy (), mols);
}
else
{
- int k;
if (l >= 4)
{
l -= 4;
@@ -253,16 +260,15 @@ Multi_measure_rest::church_rest (Grob *me, Font_metric *musfont, int measures,
k = 0;
l--;
}
-
- Stencil r (musfont->find_by_name ("rests." + to_string (k)));
- if (k == 0)
- {
- Real staff_space = Staff_symbol_referencer::staff_space (me);
- r.translate_axis (staff_space, Y_AXIS);
- }
- symbols_width += r.extent (X_AXIS).length ();
- mols = scm_cons (r.smobbed_copy (), mols);
}
+ Stencil r (musfont->find_by_name ("rests." + to_string (k)));
+ if (k == 0)
+ {
+ Real staff_space = Staff_symbol_referencer::staff_space (me);
+ r.translate_axis (staff_space, Y_AXIS);
+ }
+ symbols_width += r.extent (X_AXIS).length ();
+ mols = scm_cons (r.smobbed_copy (), mols);
count++;
}
@@ -369,5 +375,6 @@ ADD_INTERFACE (Multi_measure_rest,
"minimum-length "
"spacing-pair "
"thick-thickness "
+ "use-longa-rest "
"use-breve-rest "
);
« no previous file with comments | « no previous file | lily/multi-measure-rest-engraver.cc » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b