@cindex stem, cross staff
@cindex distance between staves in piano music
-The distance between the two staves is the same for all systems in the
-score. It is possible to override this per system, but it does require
-an arcane command incantation. See
-@inputfileref{input/@/test,piano@/-staff@/-distance@/.ly}.
-
@node Automatic staff changes
@subsection Automatic staff changes
staff, or vice versa.
@lilypond[ragged-right,verbatim,quote]
-stemExtend = \once \override Stem #'length = #22
+stemExtend = {
+ \once \override Stem #'length = #10
+ \once \override Stem #'cross-staff = ##t
+}
noFlag = \once \override Stem #'flag-style = #'no-flag
\new PianoStaff <<
\new Staff {
@menu
* Vertical spacing inside a system::
-* Vertical spacing of piano staves::
* Vertical spacing between systems::
* Controlling spacing of individual systems::
* Two-pass vertical spacing::
@inputfileref{input/regression/,alignment-vertical-spacing.ly}.
-@node Vertical spacing of piano staves
-@subsection Vertical spacing of piano staves
-
-The distance between staves of a @internalsref{PianoStaff} cannot be
-computed during formatting. Rather, to make cross-staff beaming work
-correctly, that distance has to be fixed beforehand.
-
-The distance of staves in a @code{PianoStaff} is set with the
-@code{forced-distance} property of the
-@internalsref{VerticalAlignment} object, created in
-@internalsref{PianoStaff}.
-
-It can be adjusted as follows
-@example
-\new PianoStaff \with @{
- \override VerticalAlignment #'forced-distance = #7
-@} @{
- ...
-@}
-@end example
-
-@noindent
-This would bring the staves together at a distance of 7 staff spaces,
-measured from the center line of each staff.
-
-The difference is demonstrated in the following example,
-@lilypond[quote,verbatim]
-\relative c'' <<
- \new PianoStaff \with {
- \override VerticalAlignment #'forced-distance = #7
- } <<
- \new Staff { c1 }
- \new Staff { c }
- >>
- \new PianoStaff <<
- \new Staff { c }
- \new Staff { c }
- >>
->>
-@end lilypond
-
-
-@seealso
-
-Example files: @inputfileref{input/regression/,alignment-vertical-spacing.ly}.
-
-
@node Vertical spacing between systems
@subsection Vertical spacing between systems
\context {
\PianoStaff
\accepts Dynamics
- \override VerticalAlignment #'forced-distance = #7
}
}
}
@lilypond[quote,ragged-right,verbatim,fragment,relative=2]
\times 2/3 { f8 g a }
\times 2/3 { c r c }
-\times 2/3 { f,8 g16 a g a }
+\times 2/3 { f,8 g16[ a g a] }
\times 2/3 { d4 a8 }
@end lilypond
\change Staff=bass
- \once\override TextScript #'extra-offset = #'(-3 . -4) %tweak
-
cis,16^2(^\markup {\small \italic "m.d." }\sustainUp
<fis fis,>8 <e! e,!>
| %4
#(set-octavation 1)
- \once\override TextScript #'extra-offset = #'(-3 . -2) %tweak
-
\tieUp
cis''''4^\markup { \small \italic "m.g." }\arpeggio~
\grace {
r8. e,16(\f_2 <a a,>8[ <b b,>]
| %2
- \override Staff.SustainPedalLineSpanner #'staff-padding = #5 %tweak
+ %\override Staff.SustainPedalLineSpanner #'staff-padding = #5 %tweak
<cis cis,>4\sustainDown
\change Staff=treble
r8. cis,,16(\sustainUp <fis fis,>8 <gis gis,>
| %3
-% \once \override Stem #'length = #6 %tweak
+
<a a,>4\sustainDown
\change Staff=treble
\override Fingering #'direction = #DOWN
- \override Staff.SustainPedalLineSpanner #'staff-padding = #3.5 %tweak
+ %\override Staff.SustainPedalLineSpanner #'staff-padding = #3.5 %tweak
\set Staff.pedalSustainStyle = #'mixed
%%a,8 e'[-5(<a-2 cis-3>])
}
middleDynamics = {
- \override Dynamics.TextScript #'padding = #-1 %tweak
+ %\override Dynamics.TextScript #'padding = #-1 %tweak
s2
s1*2
| %4
s8
s16 s s
s32 s
- \once\override Dynamics.Hairpin #'extra-offset = #'(0 . 2) %tweak
s\> s
- s32 s s s\!
+ s32 s s\! s
}
\fatText
\emptyText
| %5
s2-"a tempo" s8
- \once\override Dynamics.Hairpin #'extra-offset = #'(1 . 0) %tweak
s \> s s
| %6
s8\!
\type "Engraver_group"
\name Dynamics
\consists "Output_property_engraver"
- \override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1)
+ \override VerticalAxisGroup #'minimum-Y-extent = #'(0 . 0)
\consists "Script_engraver"
\consists "Dynamic_engraver"
\context {
\PianoStaff
\accepts Dynamics
- \override VerticalAlignment #'forced-distance = #7
}
}
}
--- /dev/null
+\header
+{
+
+ texidoc = "left attach dir for text crescendi starting on an
+ absolute dynamic is changed, so cresc. and the absolute dynamic
+ don't overstrike."
+
+}
+
+\version "2.11.14"
+\paper { ragged-right = ##t }
+
+\relative c' {
+ \setTextCresc
+ c4\p\< c c c\!
+}
--- /dev/null
+
+\header {
+
+ texidoc = "If @code{extendersOverRests} is set, an extender
+is not terminated upon encountering a rest. "
+
+}
+
+\paper {
+ ragged-right = ##T
+}
+
+\version "2.11.15"
+
+<<
+ \new Voice = "one" \relative c'' {
+ c4\melisma
+ c4 r c\melismaEnd c
+ }
+ \new Lyrics \lyricsto "one" {
+ \set extendersOverRests = ##t
+
+ Test __ end
+ }
+>>
wordwrap:
\wordwrap-field #'bla
}
+
+ draw-line: \draw-line #'(5 . 3)
}
}
--- /dev/null
+\header {
+
+ texidoc = "Microtonal shifts should be corrected before the start of
+ the next (possibly grace) note. "
+}
+
+\version "2.10.14"
+
+\score
+{
+
+ \relative {
+ a geseh \acciaccatura a geseh
+ }
+
+ \midi {}
+}
\break
+ \override Staff.NoteHead #'style = #'harmonic-black
+ s1*0^\markup { "harmonic-black" }
+ \pattern
+
+ \override Staff.NoteHead #'style = #'harmonic-mixed
+ s1*0^\markup { "harmonic-mixed" }
+ \pattern
+
+ \break
+
\override Staff.NoteHead #'style = #'diamond
s1*0^\markup { "diamond" }
\pattern
\new Staff {
\applyMusic #skip-of-length { c\breve } f4 r2.
\applyMusic #mmrest-of-length { c\breve } f4 r2.
- \displayMusic \musicMap #skip->rest s\breve
+ \musicMap #skip->rest s\breve
}
>>
>>
\layout {
- \context {
- \PianoStaff
- \override VerticalAlignment #'forced-distance = #10
- }
line-width = 18.0 \cm
}
\override Stem #'stemlet-length = #0.5
\override Slur #'height-limit = #1.5
}
- \context {
- \PianoStaff
- \override VerticalAlignment #'forced-distance = #10
- }
}
\midi {
*/
-MAKE_SCHEME_CALLBACK(Accidental_placement, calc_positioning_done, 1);
+MAKE_SCHEME_CALLBACK (Accidental_placement, calc_positioning_done, 1);
SCM
Accidental_placement::calc_positioning_done (SCM smob)
{
if (!me->is_live ())
return boxes;
- SCM scm_style = me->get_property ("style");
- if (!scm_is_symbol (scm_style)
- && !to_boolean (me->get_property ("restore-first"))
+ if (!to_boolean (me->get_property ("restore-first"))
&& !parens)
{
Rational alteration
SCM axis = scm_car (me->get_property ("axes"));
Axis ax = Axis (scm_to_int (axis));
- SCM force = me->get_property ("forced-distance");
- if (scm_is_number (force))
- Align_interface::align_to_fixed_distance (me, ax);
- else
- Align_interface::align_elements_to_extents (me, ax);
+ Align_interface::align_elements_to_extents (me, ax);
return SCM_BOOL_T;
}
/*
- merge with align-to-extents?
+ TODO: This belongs to the old two-pass spacing. Delete me.
*/
-MAKE_SCHEME_CALLBACK(Align_interface, stretch_after_break, 1)
+MAKE_SCHEME_CALLBACK (Align_interface, stretch_after_break, 1)
SCM
Align_interface::stretch_after_break (SCM grob)
{
Direction stacking_dir = robust_scm2dir (me->get_property ("stacking-dir"),
DOWN);
- Real delta = extra_space / elems.size() * stacking_dir;
+ Real delta = extra_space / elems.size () * stacking_dir;
for (vsize i = 0; i < elems.size (); i++)
elems[i]->translate_axis (i * delta, Y_AXIS);
}
return SCM_UNSPECIFIED;
}
-/*
- merge with align-to-extents?
-*/
-void
-Align_interface::align_to_fixed_distance (Grob *me, Axis a)
-{
- Direction stacking_dir = robust_scm2dir (me->get_property ("stacking-dir"),
- DOWN);
-
- Real dy = robust_scm2double (me->get_property ("forced-distance"), 0.0);
-
- extract_grob_set (me, "elements", elem_source);
-
- vector<Grob*> elems (elem_source); // writable..
-
- Real where = 0;
-
- Interval v;
- v.set_empty ();
- vector<Real> translates;
-
- for (vsize j = elems.size (); j--;)
- {
- /*
- This is not very elegant, in that we need special support for
- hara-kiri. Unfortunately, the generic wiring of
- force_hara_kiri_callback () (extent and offset callback) is
- such that we might get into a loop if we call extent () or
- offset () the elements.
- */
- if (a == Y_AXIS
- && Hara_kiri_group_spanner::has_interface (elems[j]))
- Hara_kiri_group_spanner::consider_suicide (elems[j]);
-
- if (!elems[j]->is_live ())
- elems.erase (elems.begin () + j);
- }
-
- for (vsize j = 0; j < elems.size (); j++)
- {
- where += stacking_dir * dy;
- translates.push_back (where);
- v.unite (Interval (where, where));
- }
-
- for (vsize i = 0; i < translates.size (); i++)
- elems[i]->translate_axis (translates[i] - v.center (), a);
-}
-
/* for each grob, find its upper and lower skylines. If the grob has
an empty extent, delete it from the list instead. If the extent is
non-empty but there is no skyline available (or pure is true), just
for (vsize i = elements->size (); i--;)
{
Grob *g = (*elements)[i];
- Interval extent = g->maybe_pure_extent (g, a, pure, start, end);
- Interval other_extent = pure ? Interval (-infinity_f, infinity_f)
- : g->extent (common_refpoint, other_axis (a));
- Box b;
- b[a] = extent;
- b[other_axis (a)] = other_extent;
-
- if (extent.is_empty ())
- {
- elements->erase (elements->begin () + i);
- continue;
- }
-
Skyline_pair skylines;
- if (!pure
- && Skyline_pair::unsmob (g->get_property ("skylines")))
- skylines = *Skyline_pair::unsmob (g->get_property ("skylines"));
- else
- {
- if (!pure)
- programming_error ("no skylines for alignment-child\n");
-
- skylines = Skyline_pair (b, 0, other_axis (a));
- }
/* each skyline is calculated relative to (potentially) a different other_axis
coordinate. In order to compare the skylines effectively, we need to shift them
to some absolute reference point */
if (!pure)
{
+ Skyline_pair *skys = Skyline_pair::unsmob (g->get_property ("skylines"));
+ if (skys)
+ skylines = *skys;
+ else
+ programming_error ("no skylines for alignment-child\n");
+
/* this is perhaps an abuse of minimum-?-extent: maybe we should create
another property? But it seems that the only (current) use of
minimum-Y-extent is to separate vertically-aligned elements */
SCM min_extent = g->get_property (a == X_AXIS ? "minimum-X-extent" : "minimum-Y-extent");
+
if (is_number_pair (min_extent))
{
+ Box b;
+ Interval other_extent = g->extent (common_refpoint, other_axis (a));
b[a] = ly_scm2interval (min_extent);
- skylines.insert (b, 0, other_axis (a));
+ b[other_axis (a)] = other_extent;
+ if (!other_extent.is_empty ())
+ skylines.insert (b, 0, other_axis (a));
}
Real offset = child_refpoints[i]->relative_coordinate (common_refpoint, other_axis (a));
skylines.shift (offset);
}
+ else
+ {
+ assert (a == Y_AXIS);
+ Interval extent = g->pure_height (g, start, end);
+ if (!extent.is_empty ())
+ {
+ Box b;
+ b[a] = extent;
+ b[other_axis (a)] = Interval (-infinity_f, infinity_f);
+ skylines.insert (b, 0, other_axis (a));
+ }
+ }
-
- ret->push_back (skylines);
+ if (skylines.is_empty ())
+ elements->erase (elements->begin () + i);
+ else
+ ret->push_back (skylines);
}
reverse (*ret);
}
get_skylines (me, &elems, a, pure, start, end, &skylines);
Real where = 0;
+ /* TODO: extra-space stuff belongs to two-pass spacing. Delete me */
SCM extra_space_handle = scm_assq (ly_symbol2scm ("alignment-extra-space"), line_break_details);
Real extra_space = robust_scm2double (scm_is_pair (extra_space_handle)
? scm_cdr (extra_space_handle)
Real padding = robust_scm2double (me->get_property ("padding"), 0.0);
vector<Real> translates;
+ Skyline down_skyline (stacking_dir);
for (vsize j = 0; j < elems.size (); j++)
{
Real dy = 0;
if (j == 0)
dy = skylines[j][-stacking_dir].max_height ();
else
- dy = skylines[j-1][stacking_dir].distance (skylines[j][-stacking_dir]);
+ {
+ down_skyline.merge (skylines[j-1][stacking_dir]);
+ dy = down_skyline.distance (skylines[j][-stacking_dir]);
+ }
- where += stacking_dir * max (0.0, dy + padding + extra_space / elems.size ());
+ dy = max (0.0, dy + padding + extra_space / elems.size ());
+ down_skyline.raise (-stacking_dir * dy);
+ where += stacking_dir * dy;
translates.push_back (where);
}
all_grobs[j]->translate_axis (translates[j], a);
}
+/* After we have already determined the y-offsets of our children, we may still
+ want to stretch them a little. */
+void
+Align_interface::stretch (Grob *me, Real amount, Axis a)
+{
+ extract_grob_set (me, "elements", elts);
+ Real non_empty_elts = stretchable_children_count (me);
+ Real offset = 0.0;
+ Direction dir = robust_scm2dir (me->get_property ("stacking-dir"), DOWN);
+ for (vsize i = 0; i < elts.size (); i++)
+ {
+ elts[i]->translate_axis (dir * offset, a);
+ if (!elts[i]->extent (me, a).is_empty ()
+ && !to_boolean (elts[i]->get_property ("keep-fixed-while-stretching")))
+ offset += amount / non_empty_elts;
+ }
+ me->flush_extent_cache (Y_AXIS);
+}
+
Real
Align_interface::get_pure_child_y_translation (Grob *me, Grob *ch, int start, int end)
{
ga->set_ordered (true);
}
+int
+Align_interface::stretchable_children_count (Grob const *me)
+{
+ extract_grob_set (me, "elements", elts);
+ int ret = 0;
+
+ /* start at 1: we will never move the first child while stretching */
+ for (vsize i = 1; i < elts.size (); i++)
+ if (!to_boolean (elts[i]->get_property ("keep-fixed-while-stretching"))
+ && !elts[i]->extent (elts[i], Y_AXIS).is_empty ())
+ ret++;
+
+ return ret;
+}
+
+MAKE_SCHEME_CALLBACK (Align_interface, calc_max_stretch, 1)
+SCM
+Align_interface::calc_max_stretch (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ Spanner *spanner_me = dynamic_cast<Spanner*> (me);
+ Real ret = 0;
+
+ if (spanner_me && stretchable_children_count (me) > 0)
+ {
+ Paper_column *left = dynamic_cast<Paper_column*> (spanner_me->get_bound (LEFT));
+ Real height = me->extent (me, Y_AXIS).length ();
+ SCM line_break_details = left->get_property ("line-break-system-details");
+ SCM fixed_offsets = scm_assq (ly_symbol2scm ("alignment-offsets"),
+ line_break_details);
+
+ /* if there are fixed offsets, we refuse to stretch */
+ if (fixed_offsets != SCM_BOOL_F)
+ ret = 0;
+ else
+ ret = height * height / 80.0; /* why this, exactly? -- jneem */
+ }
+ return scm_from_double (ret);
+}
+
/*
Find Y-axis parent of G that has a #'forced-distance property. This
has the effect of finding the piano-staff given an object in that
piano staff.
+
+ FIXME: piano staves no longer have forced-distance. The code that
+ relies on this function (in line-spanner) is broken.
*/
Grob *
find_fixed_alignment_parent (Grob *g)
{
- while (g)
- {
- if (scm_is_number (g->get_property ("forced-distance")))
- return g;
-
- g = g->get_parent (Y_AXIS);
- }
-
+ (void) g;
+ programming_error ("deprecated. We don't use forced-distance anymore");
return 0;
}
"align-dir "
"axes "
"elements "
- "forced-distance "
"padding "
"positioning-done "
"stacking-dir "
(SCM name),
"Load the font @var{name}. ")
{
- LY_ASSERT_TYPE(scm_is_string, name, 1);
+ LY_ASSERT_TYPE (scm_is_string, name, 1);
Font_metric *fm = all_fonts_global->find_font (ly_scm2string (name));
Ambitus_engraver::process_music ()
{
/*
- * Ensure that ambitus is created in the very first timestep (on
- * which lily does not call start_translation_timestep ()).
- * Otherwise, if a voice begins with a rest, the ambitus grob will
- * be placed after the rest.
+ * Ensure that ambitus is created in the very first timestep
*/
if (!ambitus_)
create_ambitus ();
Real total_t = moment_to_real (dynamics_.back ()->get_column ()->when () - start);
- for (vsize i = 1; i < dynamics_.size(); i ++)
+ for (vsize i = 1; i < dynamics_.size (); i ++)
{
Moment dt_moment = dynamics_[i]->get_column ()->when ()
- start;
protected:
void stop_translation_timestep ();
- void start_translation_timestep ();
void process_music ();
virtual void finalize ();
virtual void derived_mark () const;
void
Auto_beam_engraver::process_music ()
{
+ /*
+ don't beam over skips
+ */
+ if (stems_)
+ {
+ Moment now = now_mom ();
+ if (extend_mom_ < now)
+ end_beam ();
+ }
+
if (scm_is_string (get_property ("whichBar")))
{
consider_end (shortest_mom_);
return 0;
/*
- Can't use make_spanner_from_properties() because we have to use
+ Can't use make_spanner_from_properties () because we have to use
beam_settings_.
*/
Spanner *beam = new Spanner (beam_settings_);
}
}
-void
-Auto_beam_engraver::start_translation_timestep ()
-{
- process_acknowledged_count_ = 0;
- /*
- don't beam over skips
- */
- if (stems_)
- {
- Moment now = now_mom ();
- if (extend_mom_ < now)
- end_beam ();
- }
- forbid_ = 0;
-}
-
void
Auto_beam_engraver::stop_translation_timestep ()
{
typeset_beam ();
+ process_acknowledged_count_ = 0;
+ forbid_ = 0;
}
void
Grob_array *ga = unsmob_grob_array (elements);
SCM_ASSERT_TYPE (ga || scm_is_pair (elements), elements, SCM_ARG1, __FUNCTION__, "list or Grob_array");
- LY_ASSERT_SMOB(Grob, common, 2);
- LY_ASSERT_TYPE(is_axis, axis, 3);
+ LY_ASSERT_SMOB (Grob, common, 2);
+ LY_ASSERT_TYPE (is_axis, axis, 3);
vector<Grob*> elts;
if (!ga)
for (vsize i = 0; i < elts.size (); i++)
{
Grob *se = elts[i];
- Interval dims = se->extent (common, a);
- if (!dims.is_empty ())
- r.unite (dims);
+ if (!to_boolean (se->get_property ("cross-staff")))
+ {
+ Interval dims = se->extent (common, a);
+ if (!dims.is_empty ())
+ r.unite (dims);
+ }
}
return r;
}
return common;
}
-MAKE_SCHEME_CALLBACK(Axis_group_interface,calc_x_common, 1);
+MAKE_SCHEME_CALLBACK (Axis_group_interface, calc_x_common, 1);
SCM
Axis_group_interface::calc_x_common (SCM grob)
{
return common->self_scm ();
}
-MAKE_SCHEME_CALLBACK(Axis_group_interface,calc_y_common, 1);
+MAKE_SCHEME_CALLBACK (Axis_group_interface, calc_y_common, 1);
SCM
Axis_group_interface::calc_y_common (SCM grob)
{
else if (priority_1 > priority_2)
return false;
+ /* if neither grob has an outside-staff priority, the ordering will have no
+ effect -- we just need to choose a consistent ordering. We do this to
+ avoid the side-effect of calculating extents. */
+ if (isinf (priority_1))
+ return g1 < g2;
+
/* if there is no preference in staff priority, choose the left-most one */
Grob *common = g1->common_refpoint (g2, X_AXIS);
Real start_1 = g1->extent (common, X_AXIS)[LEFT];
for (vsize i = 0; i < elements->size (); i++)
add_boxes (elements->grob (i), x_common, y_common, boxes);
}
- else if (!scm_is_number (me->get_property ("outside-staff-priority")))
+ else if (!scm_is_number (me->get_property ("outside-staff-priority"))
+ && !to_boolean (me->get_property ("cross-staff")))
boxes->push_back (Box (me->extent (x_common, X_AXIS),
me->extent (y_common, Y_AXIS)));
}
return skylines;
}
+MAKE_SCHEME_CALLBACK (Axis_group_interface, calc_max_stretch, 1)
+SCM
+Axis_group_interface::calc_max_stretch (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ Real ret = 0;
+ extract_grob_set (me, "elements", elts);
+
+ for (vsize i = 0; i < elts.size (); i++)
+ if (Axis_group_interface::has_interface (elts[i]))
+ ret += robust_scm2double (elts[i]->get_property ("max-stretch"), 0.0);
+
+ return scm_from_double (ret);
+}
+
ADD_INTERFACE (Axis_group_interface,
"An object that groups other layout objects.",
"Y-common "
"axes "
"elements "
+ "keep-fixed-while-stretching "
+ "max-stretch "
"pure-Y-common "
"pure-relevant-elements "
"skylines "
class Balloon_engraver : public Engraver
{
- TRANSLATOR_DECLARATIONS(Balloon_engraver);
+ TRANSLATOR_DECLARATIONS (Balloon_engraver);
- DECLARE_TRANSLATOR_LISTENER(annotate_output);
- DECLARE_ACKNOWLEDGER(grob);
+ DECLARE_TRANSLATOR_LISTENER (annotate_output);
+ DECLARE_ACKNOWLEDGER (grob);
vector<Stream_event *> events_;
void stop_translation_timestep ();
-ADD_ACKNOWLEDGER(Balloon_engraver,grob);
+ADD_ACKNOWLEDGER (Balloon_engraver, grob);
-ADD_TRANSLATOR(Balloon_engraver,
+ADD_TRANSLATOR (Balloon_engraver,
"Create balloon texts",
"BalloonTextItem ",
/*read*/ "",
Grob *p = me->get_parent (X_AXIS);
- Offset off(me->relative_coordinate (p, X_AXIS),
+ Offset off (me->relative_coordinate (p, X_AXIS),
me->relative_coordinate (p, Y_AXIS));
Box b (p->extent (p, X_AXIS),
Real bot_y = max ((i - dash_size) * half_space,
-(count-1) * half_space - line_thick/2);
- bar.add_stencil (Lookup::round_filled_box (Box (Interval (0,thick),
+ bar.add_stencil (Lookup::round_filled_box (Box (Interval (0, thick),
Interval (bot_y, top_y)),
blot));
}
s.translate (Offset (thick/2, -h/2));
return s;
}
- return Stencil();
+ return Stencil ();
}
void
Bar_number_engraver::stop_translation_timestep ()
{
- if (text_)
- {
- text_->set_object ("side-support-elements",
- grob_list_to_grob_array (get_property ("stavesFound")));
- text_ = 0;
- }
+ text_ = 0;
}
void
}
-ADD_ACKNOWLEDGER(Bar_number_engraver,break_aligned);
-ADD_ACKNOWLEDGER(Bar_number_engraver,break_alignment);
+ADD_ACKNOWLEDGER (Bar_number_engraver, break_aligned);
+ADD_ACKNOWLEDGER (Bar_number_engraver, break_alignment);
ADD_TRANSLATOR (Bar_number_engraver,
/* doc */ "A bar number is created whenever measurePosition "
if (beam_
&& !scm_is_number (info.grob ()->get_property_data ("staff-position")))
{
- chain_offset_callback (info.grob(),
+ chain_offset_callback (info.grob (),
Beam::rest_collision_callback_proc, Y_AXIS);
}
}
return best_start;
}
-MAKE_SCHEME_CALLBACK(Beam, calc_beaming, 1)
+MAKE_SCHEME_CALLBACK (Beam, calc_beaming, 1)
SCM
Beam::calc_beaming (SCM smob)
{
do
{
bool on_bound = (event_dir == LEFT) ? j == 0 :
- j == segs.size() - 1;
+ j == segs.size () - 1;
bool inside_stem = (event_dir == LEFT)
? segs[j].stem_index_ > 0
if (event_dir == RIGHT)
{
segments.push_back (current);
- current = Beam_segment();
+ current = Beam_segment ();
}
}
while (flip (&event_dir) != LEFT);
return segments;
}
-MAKE_SCHEME_CALLBACK(Beam, print, 1);
+MAKE_SCHEME_CALLBACK (Beam, print, 1);
SCM
Beam::print (SCM grob)
{
sets stem directions, a constant shift does not have an
influence.
*/
- head_extents += stem->relative_coordinate (common, Y_AXIS);
+ head_extents += stem->pure_relative_y_coordinate (common, 0, INT_MAX);
if (to_dir (stem->get_property_data ("direction")))
{
-MAKE_SCHEME_CALLBACK(Beam, calc_stem_shorten, 1)
+MAKE_SCHEME_CALLBACK (Beam, calc_stem_shorten, 1)
SCM
Beam::calc_stem_shorten (SCM smob)
{
Real dx = lvs->relative_coordinate (commonx, X_AXIS) - x0;
Drul_array<Real> pos = ly_scm2interval (posns);
-
scale_drul (&pos, Staff_symbol_referencer::staff_space (me));
Hmm. At this time, beam position and slope are determined. Maybe,
stem directions and length should set to relative to the chord's
position of the beam. */
-MAKE_SCHEME_CALLBACK(Beam, set_stem_lengths, 1);
+MAKE_SCHEME_CALLBACK (Beam, set_stem_lengths, 1);
SCM
Beam::set_stem_lengths (SCM smob)
{
return knee;
}
+bool
+Beam::is_cross_staff (Grob *me)
+{
+ extract_grob_set (me, "stems", stems);
+ Grob *staff_symbol = Staff_symbol_referencer::get_staff_symbol (me);
+ for (vsize i = 0; i < stems.size (); i++)
+ if (Staff_symbol_referencer::get_staff_symbol (stems[i]) != staff_symbol)
+ return true;
+ return false;
+}
+
+MAKE_SCHEME_CALLBACK (Beam, cross_staff, 1)
+SCM
+Beam::cross_staff (SCM smob)
+{
+ return scm_from_bool (is_cross_staff (unsmob_grob (smob)));
+}
+
int
Beam::get_direction_beam_count (Grob *me, Direction d)
{
de_grace ();
if (infos_[0].start_moment_ < Moment (0))
- for (vsize i = 0; i < infos_.size(); i++)
+ for (vsize i = 0; i < infos_.size (); i++)
infos_[i].start_moment_ += options.measure_length_;
Moment measure_pos (0);
vector<Moment> beat_starts;
SCM grouping = options.grouping_;
- while (measure_pos <= infos_.back().start_moment_)
+ while (measure_pos <= infos_.back ().start_moment_)
{
int count = 2;
if (scm_is_pair (grouping))
vsize j = 0;
vsize k = 0;
- for (vsize i = 0; i < infos_.size(); i++)
+ for (vsize i = 0; i < infos_.size (); i++)
{
- while (j + 1 < group_starts.size()
+ while (j + 1 < group_starts.size ()
&& group_starts[j+1] <= infos_[i].start_moment_)
j++;
infos_[i].group_start_ = group_starts[j];
infos_[i].beat_length_ = options.beat_length_;
- while (k + 1 < beat_starts.size()
+ while (k + 1 < beat_starts.size ()
&& beat_starts[k+1] <= infos_[i].start_moment_)
k++;
- if (k < beat_starts.size())
+ if (k < beat_starts.size ())
infos_[i].beat_start_ = beat_starts[k];
}
slurs. For large slurs, this gives a certain hookiness at the end,
so we increase the indent.
- indent = G(w)
+ indent = G (w)
- w -> 0, G(w) -> .33 w
+ w -> 0, G (w) -> .33 w
(due to derivative constraints, we cannot have indent > len/3)
- w -> inf, G(w) -> 2*h_inf
+ w -> inf, G (w) -> 2*h_inf
i.e.
- G(0) = 0 , G'(0) 1/3, G(infty) = 2h_inf
+ G (0) = 0 , G'(0) 1/3, G (infty) = 2h_inf
solve from
- G(w) = r + p/(w+q)
+ G (w) = r + p/(w+q)
yields
- G(w) = 2 h_inf - max_fraction * q^2/ (w + q)
+ G (w) = 2 h_inf - max_fraction * q^2/ (w + q)
with q = 2 h_inf
*/
}
/*
- Cache binom(3,j) t^j (1-t)^{3-j}
+ Cache binom (3, j) t^j (1-t)^{3-j}
*/
struct Polynomial_cache {
Polynomial terms_[4];
{
Book *book = unsmob_book (book_smob);
- LY_ASSERT_SMOB(Book, book_smob, 1);
- LY_ASSERT_SMOB(Output_def, default_paper, 2);
- LY_ASSERT_SMOB(Output_def, default_layout, 3);
+ LY_ASSERT_SMOB (Book, book_smob, 1);
+ LY_ASSERT_SMOB (Output_def, default_paper, 2);
+ LY_ASSERT_SMOB (Output_def, default_layout, 3);
Paper_book *pb = book->process (unsmob_output_def (default_paper),
unsmob_output_def (default_layout));
"output).")
{
LY_ASSERT_SMOB (Book, book_smob, 1);
- LY_ASSERT_SMOB(Output_def, default_paper, 2);
- LY_ASSERT_SMOB(Output_def, default_layout, 3);
+ LY_ASSERT_SMOB (Output_def, default_paper, 2);
+ LY_ASSERT_SMOB (Output_def, default_layout, 3);
Book *book = unsmob_book (book_smob);
Score *newscore = unsmob_score (scm_car (p))->clone ();
*t = scm_cons (newscore->self_scm (), SCM_EOL);
- t = SCM_CDRLOC(*t);
+ t = SCM_CDRLOC (*t);
newscore->unprotect ();
}
}
Align_interface::add_element (me, toadd);
}
-MAKE_SCHEME_CALLBACK(Break_alignment_interface, calc_positioning_done, 1)
+MAKE_SCHEME_CALLBACK (Break_alignment_interface, calc_positioning_done, 1)
SCM
Break_alignment_interface::calc_positioning_done (SCM smob)
{
-MAKE_SCHEME_CALLBACK(Break_alignable_interface, self_align_callback, 1)
+MAKE_SCHEME_CALLBACK (Break_alignable_interface, self_align_callback, 1)
SCM
Break_alignable_interface::self_align_callback (SCM grob)
{
}
Direction which_edge = LEFT;
- if (vsize (last_idx_found + 1) < elements.size())
+ if (vsize (last_idx_found + 1) < elements.size ())
last_idx_found ++;
else
which_edge = RIGHT;
{
public:
DECLARE_SCHEME_CALLBACK (height, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
MAKE_SCHEME_CALLBACK (Cluster_beacon, height, 1);
#include "warn.hh"
/*
- We use the following optimal substructure. Let W(A) be our weight function.
+ We use the following optimal substructure. Let W (A) be our weight function.
- Let A_{k,n} = (a_{k,n,1}, ... a_{k,n,k}) be the optimal set of line breaks
- for k systems and n potential breakpoints. a_{k,n,k} = n (it is the end of
+ Let A_{k, n} = (a_{k, n,1}, ... a_{k, n, k}) be the optimal set of line breaks
+ for k systems and n potential breakpoints. a_{k, n, k} = n (it is the end of
the piece)
Then A_{k+1, m} is contructed from
- min_ {k < j < m} ( W(A_{k,j} :: m) )
+ min_ {k < j < m} ( W (A_{k, j} :: m) )
where by A::m we denote appending m to the list A
Indices in the code:
The above algorithm makes it easy to end at a point before the end of the
- score (just find A_{k,m} for some m < breaks_.size () - 1). However, we must
+ score (just find A_{k, m} for some m < breaks_.size () - 1). However, we must
add information for starting at a point after the beginning. One constructor
allows the specification of a list of starting columns, start_. We then have
start_.size () different solution arrays. state_[i] is the array for the
. . . .
. . . .
where the X's mark invalid solutions (can't have more systems than
- breakpoints). Note that each value is of the form a_{x,n,x}. This is because
- a breakpoint of the form a_{x,n,x-1} will also be called a_{x-1,m,x-1} for
+ breakpoints). Note that each value is of the form a_{x, n, x}. This is because
+ a breakpoint of the form a_{x, n, x-1} will also be called a_{x-1, m, x-1} for
some m < n. Each cell in the array stores the value of its m (ie. the
ending breakpoint of the previous line) as "prev_".
- For finding A_{sys, brk}, let "me" be the (sys_count,brk) cell in our
+ For finding A_{sys, brk}, let "me" be the (sys_count, brk) cell in our
solution array (state_[start][sys * rank + brk]).
Then A_{sys, brk} = A_{sys - 1, me.prev_} :: me
return found_something;
}
-vector<Column_x_positions>
-Constrained_breaking::solve ()
-{
- if (!systems_)
- return get_best_solution (0, VPOS);
-
- resize (systems_);
- return get_solution(0, VPOS, systems_);
-}
Column_x_positions
Constrained_breaking::space_line (vsize i, vsize j)
Column_x_positions col;
vector<Grob*> line (all_.begin () + breaks_[i],
- all_.begin() + breaks_[j] + 1);
+ all_.begin () + breaks_[j] + 1);
Interval line_dims = line_dimensions_int (pscore_->layout (), i);
bool last = j == breaks_.size () - 1;
bool ragged = ragged_right || (last && ragged_last);
}
vector<Column_x_positions>
-Constrained_breaking::get_solution (vsize start, vsize end, vsize sys_count)
+Constrained_breaking::solve (vsize start, vsize end, vsize sys_count)
{
vsize start_brk = starting_breakpoints_[start];
vsize end_brk = prepare_solution (start, end, sys_count);
}
}
/* if we get to here, just put everything on one line */
- warning (_ ("cannot find line breaking that satisfies constraints" ));
+ warning (_ ("cannot find line breaking that satisfies constraints"));
ret.push_back (space_line (0, end_brk));
return ret;
}
vector<Column_x_positions>
-Constrained_breaking::get_best_solution (vsize start, vsize end)
+Constrained_breaking::best_solution (vsize start, vsize end)
{
- vsize min_systems = get_min_systems (start, end);
- vsize max_systems = get_max_systems (start, end);
+ vsize min_systems = min_system_count (start, end);
+ vsize max_systems = max_system_count (start, end);
Real best_demerits = infinity_f;
vector<Column_x_positions> best_so_far;
if (dem < best_demerits)
{
best_demerits = dem;
- best_so_far = get_solution (start, end, i);
+ best_so_far = solve (start, end, i);
}
else
{
- vector<Column_x_positions> cur = get_solution (start, end, i);
+ vector<Column_x_positions> cur = solve (start, end, i);
bool too_many_lines = true;
for (vsize j = 0; j < cur.size (); j++)
}
if (best_so_far.size ())
return best_so_far;
- return get_solution (start, end, max_systems);
+ return solve (start, end, max_systems);
}
std::vector<Line_details>
-Constrained_breaking::get_details (vsize start, vsize end, vsize sys_count)
+Constrained_breaking::line_details (vsize start, vsize end, vsize sys_count)
{
vsize brk = prepare_solution (start, end, sys_count);
Matrix<Constrained_break_node> const &st = state_[start];
}
int
-Constrained_breaking::get_min_systems (vsize start, vsize end)
+Constrained_breaking::min_system_count (vsize start, vsize end)
{
vsize sys_count;
vsize brk = prepare_solution (start, end, 1);
}
int
-Constrained_breaking::get_max_systems (vsize start, vsize end)
+Constrained_breaking::max_system_count (vsize start, vsize end)
{
vsize brk = (end >= start_.size ()) ? breaks_.size () : starting_breakpoints_[end];
return brk - starting_breakpoints_[start];
line.force_ = forces[i*breaks_.size () + j];
if (ragged && last && !isinf (line.force_))
- line.force_ = 0;
+ line.force_ = (line.force_ < 0) ? infinity_f : 0;
if (isinf (line.force_))
break;
SCM
Context_def::mark_smob (SCM smob)
{
- ASSERT_LIVE_IS_ALLOWED();
+ ASSERT_LIVE_IS_ALLOWED ();
Context_def *me = (Context_def *) SCM_CELL_WORD_1 (smob);
/*
tack onto alist. We can use set_car, since
- updated_grob_properties() in child contexts will check
+ updated_grob_properties () in child contexts will check
for changes in the car.
*/
if (ok)
Context *tr = unsmob_context (context);
LY_ASSERT_SMOB (Context, context, 1);
- LY_ASSERT_TYPE(ly_is_symbol, name, 2);
+ LY_ASSERT_TYPE (ly_is_symbol, name, 2);
return updated_grob_properties (tr, name);
}
Context *tg = unsmob_context (context);
LY_ASSERT_SMOB (Context, context, 1);
- LY_ASSERT_TYPE(ly_is_symbol, grob, 2);
- LY_ASSERT_TYPE(ly_is_symbol, eltprop, 3);
+ LY_ASSERT_TYPE (ly_is_symbol, grob, 2);
+ LY_ASSERT_TYPE (ly_is_symbol, eltprop, 3);
execute_pushpop_property (tg, grob, eltprop, val);
"Return the value of @var{name} from context @var{c}")
{
LY_ASSERT_SMOB (Context, c, 1);
- LY_ASSERT_TYPE(ly_is_symbol, name, 2);
+ LY_ASSERT_TYPE (ly_is_symbol, name, 2);
Context *t = unsmob_context (c);
return t->internal_get_property (name);
"to @var{val}.")
{
LY_ASSERT_SMOB (Context, context, 1);
- LY_ASSERT_TYPE(ly_is_symbol, name, 2);
+ LY_ASSERT_TYPE (ly_is_symbol, name, 2);
Context *tr = unsmob_context (context);
"where @var{name} is defined.")
{
LY_ASSERT_SMOB (Context, context, 1);
- LY_ASSERT_TYPE(ly_is_symbol,name, 2);
+ LY_ASSERT_TYPE (ly_is_symbol, name, 2);
Context *tr = unsmob_context (context);
"Unset value of property @var{name} in context @var{context}.")
{
LY_ASSERT_SMOB (Context, context, 1);
- LY_ASSERT_TYPE(ly_is_symbol,name, 2);
+ LY_ASSERT_TYPE (ly_is_symbol, name, 2);
Context *tr = unsmob_context (context);
tr->unset_property (name);
"Return @code{#f} if not found.")
{
LY_ASSERT_SMOB (Context, context, 1);
- LY_ASSERT_TYPE(ly_is_symbol,name, 2);
+ LY_ASSERT_TYPE (ly_is_symbol, name, 2);
Context *tr = unsmob_context (context);
while (tr)
Context *a = 0;
- if (to_boolean (get_music()->get_property ("create-new")))
+ if (to_boolean (get_music ()->get_property ("create-new")))
a = get_outlet ()->create_unique_context (ct, c_id, ops);
else
a = get_outlet ()->find_create_context (ct, c_id, ops);
vector<Audio_item*> texts_;
void add_text (Audio_text::Type, string);
- TRANSLATOR_DECLARATIONS(Control_track_performer);
+ TRANSLATOR_DECLARATIONS (Control_track_performer);
protected:
virtual void initialize ();
Dispatcher *f = unsmob_dispatcher (from);
LY_ASSERT_SMOB (Dispatcher, to, 1);
- LY_ASSERT_SMOB(Dispatcher, from, 2);
+ LY_ASSERT_SMOB (Dispatcher, from, 2);
t->register_as_listener (f);
Dispatcher *d = unsmob_dispatcher (disp);
LY_ASSERT_SMOB (Listener, list, 1);
- LY_ASSERT_SMOB(Dispatcher, disp, 2);
+ LY_ASSERT_SMOB (Dispatcher, disp, 2);
for (int arg = SCM_ARG3; scm_is_pair (cl); cl = scm_cdr (cl), arg++)
{
LY_ASSERT_SMOB (Dispatcher, disp, 1);
- LY_ASSERT_SMOB(Stream_event, ev, 2);
+ LY_ASSERT_SMOB (Stream_event, ev, 2);
d->broadcast (e);
return SCM_UNDEFINED;
}
*/
struct { int prio; SCM list; } lists[num_classes+1];
int i = 0;
- for (SCM cl = class_list; scm_is_pair(cl); cl = scm_cdr (cl))
+ for (SCM cl = class_list; scm_is_pair (cl); cl = scm_cdr (cl))
{
SCM list = scm_hashq_ref (listeners_, scm_car (cl), SCM_EOL);
- if (!scm_is_pair(list))
+ if (!scm_is_pair (list))
num_classes--;
else
{
}
// go to the next listener; bubble-sort the class list.
SCM next = scm_cdr (lists[0].list);
- if (!scm_is_pair(next))
+ if (!scm_is_pair (next))
num_classes--;
- int prio = (scm_is_pair(next)) ? scm_to_int (scm_caar (next)) : INT_MAX;
+ int prio = (scm_is_pair (next)) ? scm_to_int (scm_caar (next)) : INT_MAX;
for (i = 0; prio > lists[i+1].prio; i++)
lists[i] = lists[i+1];
lists[i].prio = prio;
{
/* Tell all dispatchers that we listen to, that we want to hear ev_class
events */
- for (SCM disp = dispatchers_; scm_is_pair(disp); disp = scm_cdr (disp))
+ for (SCM disp = dispatchers_; scm_is_pair (disp); disp = scm_cdr (disp))
{
int priority = scm_to_int (scm_cdar (disp));
Dispatcher *d = unsmob_dispatcher (scm_caar (disp));
SCM dummy = scm_cons (SCM_EOL, list);
SCM e = dummy;
- while (scm_is_pair(scm_cdr (e)))
+ while (scm_is_pair (scm_cdr (e)))
if (*unsmob_listener (scm_cdadr (e)) == l && first)
{
- scm_set_cdr_x (e, scm_cddr(e));
+ scm_set_cdr_x (e, scm_cddr (e));
first = false;
break;
}
}
}
-MAKE_SCHEME_CALLBACK(Dot_column, calc_positioning_done, 1);
+MAKE_SCHEME_CALLBACK (Dot_column, calc_positioning_done, 1);
SCM
Dot_column::calc_positioning_done (SCM smob)
{
class Dots_engraver : public Engraver
{
- DECLARE_ACKNOWLEDGER(rhythmic_head);
- TRANSLATOR_DECLARATIONS(Dots_engraver);
+ DECLARE_ACKNOWLEDGER (rhythmic_head);
+ TRANSLATOR_DECLARATIONS (Dots_engraver);
};
Dots_engraver::Dots_engraver ()
}
-ADD_ACKNOWLEDGER(Dots_engraver, rhythmic_head);
+ADD_ACKNOWLEDGER (Dots_engraver, rhythmic_head);
-ADD_TRANSLATOR(Dots_engraver,
+ADD_TRANSLATOR (Dots_engraver,
"Create @ref{Dots} objects for @ref{rhythmic-head-interface}s.",
/* create */
}
Moment len = get_event_length (n);
- if (now_mom().grace_part_)
+ if (now_mom ().grace_part_)
{
len.grace_part_ = len.main_part_;
len.main_part_ = Rational (0);
2, 0, 0, (SCM p1, SCM p2),
"Is @var{p1} shorter than @var{p2}?")
{
- LY_ASSERT_SMOB(Duration, p1, 1);
- LY_ASSERT_SMOB(Duration, p2, 2);
+ LY_ASSERT_SMOB (Duration, p1, 1);
+ LY_ASSERT_SMOB (Duration, p2, 2);
Duration *a = unsmob_duration (p1);
Duration *b = unsmob_duration (p2);
bool compress = false;
if (num != SCM_UNDEFINED)
{
- LY_ASSERT_TYPE (scm_is_number,num, 3);
+ LY_ASSERT_TYPE (scm_is_number, num, 3);
compress = true;
}
else
if (den != SCM_UNDEFINED)
{
- LY_ASSERT_TYPE (scm_is_number,den, 4);
+ LY_ASSERT_TYPE (scm_is_number, den, 4);
compress = true;
}
else
void typeset_all ();
TRANSLATOR_DECLARATIONS (Dynamic_engraver);
- DECLARE_ACKNOWLEDGER (accidental);
- DECLARE_ACKNOWLEDGER (stem_tremolo);
DECLARE_ACKNOWLEDGER (note_column);
- DECLARE_ACKNOWLEDGER (slur);
DECLARE_TRANSLATOR_LISTENER (absolute_dynamic);
DECLARE_TRANSLATOR_LISTENER (span_dynamic);
context ()->set_property ((start_type + "Text").c_str (),
SCM_EOL);
}
+
+ if (script_)
+ {
+ set_nested_property (cresc_,
+ scm_list_3 (ly_symbol2scm ("attach-dir"),
+ ly_symbol2scm ("left"),
+ ly_symbol2scm ("bound-details")
+ ),
+ scm_from_int (RIGHT));
+ }
}
if (script_)
}
}
-void
-Dynamic_engraver::acknowledge_accidental (Grob_info info)
-{
- if (line_spanner_)
- Side_position_interface::add_support (line_spanner_, info.grob ());
-}
-
-void
-Dynamic_engraver::acknowledge_stem_tremolo (Grob_info info)
-{
- if (line_spanner_)
- Side_position_interface::add_support (line_spanner_, info.grob ());
-}
-
-void
-Dynamic_engraver::acknowledge_slur (Grob_info info)
-{
- if (line_spanner_)
- Side_position_interface::add_support (line_spanner_, info.grob ());
-}
-
void
Dynamic_engraver::acknowledge_note_column (Grob_info info)
{
finished_cresc_->set_bound (RIGHT, info.grob ());
}
-ADD_ACKNOWLEDGER (Dynamic_engraver, accidental);
ADD_ACKNOWLEDGER (Dynamic_engraver, note_column);
-ADD_ACKNOWLEDGER (Dynamic_engraver, slur);
-ADD_ACKNOWLEDGER (Dynamic_engraver, stem_tremolo);
ADD_TRANSLATOR (Dynamic_engraver,
/* doc */
if (span_events_[START])
{
- span_dynamic_ = new Audio_span_dynamic();
+ span_dynamic_ = new Audio_span_dynamic ();
announce_element (Audio_element_info (span_dynamic_, span_events_[START]));
span_dynamic_->grow_dir_ = grow_dir_[START];
struct Enclosing_bracket
{
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
public:
- DECLARE_SCHEME_CALLBACK(print, (SCM));
- DECLARE_SCHEME_CALLBACK(width, (SCM));
+ DECLARE_SCHEME_CALLBACK (print, (SCM));
+ DECLARE_SCHEME_CALLBACK (width, (SCM));
};
-ADD_INTERFACE(Enclosing_bracket,
+ADD_INTERFACE (Enclosing_bracket,
"Brackets alongside bass figures.",
else
continue;
- SCM acklist = scm_hashq_ref (acknowledge_hash_table_drul_[info.start_end()],
+ SCM acklist = scm_hashq_ref (acknowledge_hash_table_drul_[info.start_end ()],
nm, SCM_BOOL_F);
Engraver_dispatch_list *dispatch
protected:
DECLARE_TRANSLATOR_LISTENER (extender);
DECLARE_ACKNOWLEDGER (lyric_syllable);
+
virtual void finalize ();
+
void stop_translation_timestep ();
void process_music ();
};
}
else
{
- if (pending_extender_)
+ if (pending_extender_
+ && !get_property ("extendersOverRests"))
{
completize_extender (pending_extender_);
pending_extender_ = 0;
ADD_TRANSLATOR (Extender_engraver,
/* doc */ "Create lyric extenders",
/* create */ "LyricExtender",
- /* read */ "",
+ /* read */ "extendersOverRests",
/* write */ "");
struct Figured_bass_continuation
{
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
public:
- DECLARE_SCHEME_CALLBACK(print, (SCM));
- DECLARE_SCHEME_CALLBACK(center_on_figures, (SCM));
+ DECLARE_SCHEME_CALLBACK (print, (SCM));
+ DECLARE_SCHEME_CALLBACK (center_on_figures, (SCM));
};
MAKE_SCHEME_CALLBACK (Figured_bass_continuation, center_on_figures, 1);
return extender.smobbed_copy ();
}
-ADD_INTERFACE(Figured_bass_continuation,
+ADD_INTERFACE (Figured_bass_continuation,
"Simple extender line between bounds.",
/* props */
struct Figured_bass_engraver : public Engraver
{
- TRANSLATOR_DECLARATIONS(Figured_bass_engraver);
- void clear_spanners();
+ TRANSLATOR_DECLARATIONS (Figured_bass_engraver);
+ void clear_spanners ();
void add_brackets ();
void create_grobs ();
new_event_found_ = true;
/*
- No ASSIGN_EVENT_ONCE() ; otherwise we get warnings about
+ No ASSIGN_EVENT_ONCE () ; otherwise we get warnings about
polyphonic rests.
*/
rest_event_ = ev;
if (consecutive_lines.size () == 2)
{
vector<Grob*> left_figs;
- for (vsize j = consecutive_lines.size(); j--;)
+ for (vsize j = consecutive_lines.size (); j--;)
left_figs.push_back (consecutive_lines[j]->get_bound (LEFT));
SCM ga = Grob_array::make_array ();
unsmob_grob_array (ga)->set_array (left_figs);
- for (vsize j = consecutive_lines.size(); j--;)
+ for (vsize j = consecutive_lines.size (); j--;)
consecutive_lines[j]->set_object ("figures",
unsmob_grob_array (ga)->smobbed_copy ());
}
Figured_bass_engraver::center_repeated_continuations ()
{
vector<Spanner*> consecutive_lines;
- for (vsize i = 0; i <= groups_.size(); i++)
+ for (vsize i = 0; i <= groups_.size (); i++)
{
if (i < groups_.size ()
&& groups_[i].continuation_line_
&& (consecutive_lines.empty ()
- || (consecutive_lines[0]->get_bound(LEFT)->get_column ()
+ || (consecutive_lines[0]->get_bound (LEFT)->get_column ()
== groups_[i].continuation_line_->get_bound (LEFT)->get_column ()
- && consecutive_lines[0]->get_bound(RIGHT)->get_column ()
+ && consecutive_lines[0]->get_bound (RIGHT)->get_column ()
== groups_[i].continuation_line_->get_bound (RIGHT)->get_column ())))
consecutive_lines.push_back (groups_[i].continuation_line_);
else
}
if (to_boolean (get_property ("figuredBassCenterContinuations")))
- center_repeated_continuations();
+ center_repeated_continuations ();
for (vsize i = 0; i < groups_.size (); i++)
{
if (use_extenders)
{
vector<int> junk_continuations;
- for (vsize i = 0; i < groups_.size(); i++)
+ for (vsize i = 0; i < groups_.size (); i++)
{
Figure_group &group = groups_[i];
{
for (vsize i = 0; i <= junk_continuations.size (); i++)
{
- if (i < junk_continuations.size()
+ if (i < junk_continuations.size ()
&& (i == 0 || junk_continuations[i-1] == junk_continuations[i] - 1))
consecutive.push_back (groups_[junk_continuations[i]].continuation_line_);
else
alignment_->set_bound (RIGHT, muscol);
SCM proc = get_property ("figuredBassFormatter");
- for (vsize i = 0; i < groups_.size(); i++)
+ for (vsize i = 0; i < groups_.size (); i++)
{
Figure_group &group = groups_[i];
class Figured_bass_position_engraver : public Engraver
{
- TRANSLATOR_DECLARATIONS(Figured_bass_position_engraver);
+ TRANSLATOR_DECLARATIONS (Figured_bass_position_engraver);
Spanner *bass_figure_alignment_;
Spanner *positioner_;
{
assert (!positioner_);
- positioner_ = make_spanner("BassFigureAlignmentPositioning", bass_figure_alignment_->self_scm ());
+ positioner_ = make_spanner ("BassFigureAlignmentPositioning", bass_figure_alignment_->self_scm ());
positioner_->set_bound (LEFT, bass_figure_alignment_->get_bound (LEFT));
Axis_group_interface::add_element (positioner_, bass_figure_alignment_);
}
}
-ADD_ACKNOWLEDGER(Figured_bass_position_engraver,note_column);
-ADD_ACKNOWLEDGER(Figured_bass_position_engraver,slur);
-ADD_END_ACKNOWLEDGER(Figured_bass_position_engraver,slur);
+ADD_ACKNOWLEDGER (Figured_bass_position_engraver, note_column);
+ADD_ACKNOWLEDGER (Figured_bass_position_engraver, slur);
+ADD_END_ACKNOWLEDGER (Figured_bass_position_engraver, slur);
-ADD_ACKNOWLEDGER(Figured_bass_position_engraver,tie);
-ADD_ACKNOWLEDGER(Figured_bass_position_engraver,bass_figure_alignment);
-ADD_END_ACKNOWLEDGER(Figured_bass_position_engraver,bass_figure_alignment);
+ADD_ACKNOWLEDGER (Figured_bass_position_engraver, tie);
+ADD_ACKNOWLEDGER (Figured_bass_position_engraver, bass_figure_alignment);
+ADD_END_ACKNOWLEDGER (Figured_bass_position_engraver, bass_figure_alignment);
ADD_TRANSLATOR (Figured_bass_position_engraver,
/* doc */
/*
- file-name-map.cc -- implement map_file_name()
+ file-name-map.cc -- implement map_file_name ()
source file of the GNU LilyPond music typesetter
display_config (FcConfig *fcc)
{
string retval;
- retval += display_strlist ("Config files", FcConfigGetConfigFiles(fcc));
- retval += display_strlist ("Config dir", FcConfigGetConfigDirs(fcc));
- retval += display_strlist ("Font dir", FcConfigGetFontDirs(fcc));
+ retval += display_strlist ("Config files", FcConfigGetConfigFiles (fcc));
+ retval += display_strlist ("Config dir", FcConfigGetConfigDirs (fcc));
+ retval += display_strlist ("Font dir", FcConfigGetFontDirs (fcc));
return retval;
}
val.type = FcTypeString;
val.u.s = (const FcChar8*)ly_scm2string (name).c_str (); // FC_SLANT_ITALIC;
- FcPatternAdd(pat, FC_FAMILY, val, FcFalse);
+ FcPatternAdd (pat, FC_FAMILY, val, FcFalse);
FcResult result;
SCM scm_result = SCM_BOOL_F;
FcConfigSubstitute (NULL, pat, FcMatchFont);
FcDefaultSubstitute (pat);
- pat = FcFontMatch(NULL, pat, &result);
+ pat = FcFontMatch (NULL, pat, &result);
FcChar8 *str = 0;
if (FcPatternGetString (pat, FC_FILE, 0, &str) == FcResultMatch)
scm_result = scm_from_locale_string ((char const*) str);
{
Font_metric *fm = unsmob_metrics (font);
LY_ASSERT_SMOB (Font_metric, font, 1);
- LY_ASSERT_TYPE(scm_is_string,name, 2);
+ LY_ASSERT_TYPE (scm_is_string, name, 2);
Stencil m = fm->find_by_name (ly_scm2string (name));
{
Font_metric *fm = unsmob_metrics (font);
LY_ASSERT_SMOB (Font_metric, font, 1);
- LY_ASSERT_TYPE(scm_is_number, index,2);
+ LY_ASSERT_TYPE (scm_is_number, index,2);
return fm->get_ascii_char_stencil (scm_to_int (index)).smobbed_copy ();
}
{
Font_metric *fm = unsmob_metrics (font);
LY_ASSERT_SMOB (Font_metric, font, 1);
- LY_ASSERT_TYPE(scm_is_string,name, 2);
+ LY_ASSERT_TYPE (scm_is_string, name, 2);
return scm_from_int (fm->name_to_index (ly_scm2string (name)));
}
{
Font_metric *fm = unsmob_metrics (font);
LY_ASSERT_SMOB (Font_metric, font, 1);
- LY_ASSERT_TYPE(scm_is_integer,index, 2);
+ LY_ASSERT_TYPE (scm_is_integer, index, 2);
return scm_from_unsigned_integer (fm->index_to_charcode (scm_to_int (index)));
}
{
Font_metric *fm = unsmob_metrics (font);
LY_ASSERT_SMOB (Font_metric, font, 1);
- LY_ASSERT_TYPE(scm_is_string,name, 2);
+ LY_ASSERT_TYPE (scm_is_string, name, 2);
return scm_from_unsigned_integer (fm->index_to_charcode (fm->name_to_index (ly_scm2string (name))));
}
(unsmob_metrics (font));
LY_ASSERT_SMOB (Font_metric, font, 1);
- LY_ASSERT_TYPE(scm_is_string,text, 2);
+ LY_ASSERT_TYPE (scm_is_string, text, 2);
Stencil stc (fm->text_stencil (ly_scm2string (text)));
return scm_cons (ly_interval2scm (stc.extent (X_AXIS)),
ly_interval2scm (stc.extent (Y_AXIS)));
#include "freetype.hh"
#undef __FTERRORS_H__
-#define FT_ERRORDEF( e, v, s ) { e, s },
+#define FT_ERRORDEF(e, v, s) { e, s },
#define FT_ERROR_START_LIST {
#define FT_ERROR_END_LIST { 0, 0 } };
#include "lily-guile.hh"
#include "warn.hh"
-/* type predicates. */
-#include "spanner.hh"
-#include "item.hh"
-
static SCM doc_hash_table;
scm_set_procedure_property_x (func, ly_symbol2scm ("documentation"),
ly_string2scm (s));
SCM entry = scm_cons (ly_string2scm (varlist), ly_string2scm (doc));
- scm_hashq_set_x (doc_hash_table, ly_symbol2scm (fname.c_str()), entry);
+ scm_hashq_set_x (doc_hash_table, ly_symbol2scm (fname.c_str ()), entry);
}
LY_DEFINE (ly_get_all_function_documentation, "ly:get-all-function-documentation",
predicate_to_typename (void *ptr)
{
if (type_names.find (ptr) == type_names.end ())
- return "unknown type";
+ {
+ programming_error ("Unknown type predicate");
+ return "unknown type";
+ }
else
return type_names[ptr];
}
-static int
-arg_dir (int a, int b)
-{
- if (&a < &b)
- return 1;
- else
- return -1;
-}
-
+/* type predicates. */
+#include "spanner.hh"
+#include "item.hh"
+#include "music.hh"
+#include "music-function.hh"
+#include "performance.hh"
+#include "paper-score.hh"
+#include "global-context.hh"
+#include "input.hh"
-int function_argument_direction;
void
init_func_doc ()
{
- function_argument_direction = arg_dir (2,3);
+ ly_add_type_predicate ((void*) &is_direction, "direction");
+ ly_add_type_predicate ((void*) &is_music_function, "Music_function");
+ ly_add_type_predicate ((void*) &ly_is_port, "port");
+ ly_add_type_predicate ((void*) &unsmob_global_context, "Global_context");
+ ly_add_type_predicate ((void*) &unsmob_input, "Input");
+ ly_add_type_predicate ((void*) &unsmob_moment, "Moment");
+ ly_add_type_predicate ((void*) &unsmob_paper_score, "Paper_score");
+ ly_add_type_predicate ((void*) &unsmob_performance, "Performance");
- ly_add_type_predicate ((void*) &scm_is_integer, "integer");
- ly_add_type_predicate ((void*) &scm_is_bool, "boolean");
- ly_add_type_predicate ((void*) &scm_is_pair, "pair");
+ ly_add_type_predicate ((void*) &is_axis, "axis");
ly_add_type_predicate ((void*) &is_number_pair, "number pair");
+ ly_add_type_predicate ((void*) &ly_is_list, "list");
+ ly_add_type_predicate ((void*) &ly_is_procedure, "procedure");
+ ly_add_type_predicate ((void*) &ly_is_symbol, "symbol");
+ ly_add_type_predicate ((void*) &scm_is_bool, "boolean");
+ ly_add_type_predicate ((void*) &scm_is_integer, "integer");
ly_add_type_predicate ((void*) &scm_is_number, "number");
+ ly_add_type_predicate ((void*) &scm_is_pair, "pair");
+ ly_add_type_predicate ((void*) &scm_is_rational, "rational");
ly_add_type_predicate ((void*) &scm_is_string, "string");
- ly_add_type_predicate ((void*) &ly_is_symbol, "symbol");
ly_add_type_predicate ((void*) &scm_is_vector, "vector");
- ly_add_type_predicate ((void*) &is_axis, "axis");
- ly_add_type_predicate ((void*) &unsmob_spanner, "spanner");
- ly_add_type_predicate ((void*) &unsmob_item, "item");
+ ly_add_type_predicate ((void*) &unsmob_item, "Item");
+ ly_add_type_predicate ((void*) &unsmob_music, "Music");
+ ly_add_type_predicate ((void*) &unsmob_spanner, "Spanner");
}
-ADD_SCM_INIT_FUNC(func_doc, init_func_doc);
+ADD_SCM_INIT_FUNC (func_doc, init_func_doc);
int sz = INT_MAX;
if (size != SCM_UNDEFINED)
{
- LY_ASSERT_TYPE(scm_is_number,size, 2);
+ LY_ASSERT_TYPE (scm_is_number, size, 2);
sz = scm_to_int (size);
}
"Replace @var{a} by @var{b} in @var{s}.")
{
LY_ASSERT_TYPE (scm_is_string, s, 1);
- LY_ASSERT_TYPE(scm_is_string,b, 2);
- LY_ASSERT_TYPE(scm_is_string,s, 3);
+ LY_ASSERT_TYPE (scm_is_string, b, 2);
+ LY_ASSERT_TYPE (scm_is_string, s, 3);
string ss = ly_scm2string (s);
replace_all (ss, string (scm_i_string_chars (a)),
return scm_cons (key, result);
}
-LY_DEFINE(ly_hash_table_keys, "ly:hash-table-keys",
+LY_DEFINE (ly_hash_table_keys, "ly:hash-table-keys",
1,0,0, (SCM tab),
"return a list of keys in @var{tab}")
{
warning (_ ("Found infinity or nan in output. Substituting 0.0"));
return ("0.0");
if (strict_infinity_checking)
- abort();
+ abort ();
}
else
return (String_convert::form_string ("%.*lf", precision, val));
vector<string> results;
vsize i = 0;
- while (i < format.size())
+ while (i < format.size ())
{
vsize tilde = format.find ('~', i);
+ ": too many arguments");
vsize len = 0;
- for (vsize i = 0; i < results.size(); i++)
- len += results[i].size();
+ for (vsize i = 0; i < results.size (); i++)
+ len += results[i].size ();
char *result = (char*) scm_malloc (len + 1);
char *ptr = result;
- for (vsize i = 0; i < results.size(); i++)
+ for (vsize i = 0; i < results.size (); i++)
{
- strncpy (ptr, results[i].c_str (), results[i].size());
- ptr += results[i].size();
+ strncpy (ptr, results[i].c_str (), results[i].size ());
+ ptr += results[i].size ();
}
*ptr = '\0';
"final state.\n")
{
LY_ASSERT_SMOB (Music, mus, 1);
- LY_ASSERT_TYPE (unsmob_global_context,ctx, 2);
+ LY_ASSERT_TYPE (unsmob_global_context, ctx, 2);
Music *music = unsmob_music (mus);
if (!music
{
Grob_array *me = unsmob_grob_array (grob_arr);
LY_ASSERT_SMOB (Grob_array, grob_arr, 1);
- LY_ASSERT_TYPE(scm_is_integer,index, 2);
+ LY_ASSERT_TYPE (scm_is_integer, index, 2);
vsize i = scm_to_unsigned (index);
if (i == VPOS || i >= me->size ())
static SCM all_ifaces;
-LY_DEFINE (ly_add_interface, "ly:add-interface",
- 3, 0, 0, (SCM a, SCM b, SCM c),
- "Add an interface description.")
+void
+internal_add_interface (SCM a, SCM b, SCM c)
{
- LY_ASSERT_TYPE (ly_is_symbol, a, 1);
- LY_ASSERT_TYPE(scm_is_string,b, 2);
- LY_ASSERT_TYPE(ly_is_list,c, 3);
if (!all_ifaces)
{
SCM tab = scm_c_make_hash_table (59);
SCM entry = scm_list_n (a, b, c, SCM_UNDEFINED);
scm_hashq_set_x (all_ifaces, a, entry);
+}
+
+LY_DEFINE (ly_add_interface, "ly:add-interface",
+ 3, 0, 0, (SCM a, SCM b, SCM c),
+ "Add an interface description.")
+{
+ LY_ASSERT_TYPE (ly_is_symbol, a, 1);
+ LY_ASSERT_TYPE (scm_is_string, b, 2);
+ LY_ASSERT_TYPE (ly_is_list, c, 3);
+
+ internal_add_interface (a,b,c);
return SCM_UNSPECIFIED;
}
SCM d = scm_from_locale_string (descr);
SCM l = parse_symbol_list (vars);
- ly_add_interface (s, d, l);
+ internal_add_interface (s, d, l);
return s;
}
/*
We can't change signatures depending on NDEBUG, since NDEBUG comes
over the command line and may be different per .cc file. This
- should be done through the macro expansion of get_property().
+ should be done through the macro expansion of get_property ().
*/
void
Grob::internal_set_property (SCM sym, SCM v, char const *file, int line, char const *fun)
if (val == ly_symbol2scm ("calculation-in-progress"))
programming_error (_f ("cyclic dependency: calculation-in-progress encountered for #'%s (%s)",
ly_symbol2string (sym).c_str (),
- name().c_str ()));
+ name ().c_str ()));
#endif
if (ly_is_procedure (val)
/*
If the function returns SCM_UNSPECIFIED, we assume the
- property has been set with an explicit set_property()
+ property has been set with an explicit set_property ()
call.
*/
if (value == SCM_UNSPECIFIED)
return scm_apply_0 (scm_call_pure_function,
scm_list_4 (unpure, args, scm_from_int (start), scm_from_int (end)));
}
+
+
+/*
+ PROP_PATH should be big-to-small ordering
+ */
+SCM
+nested_property_alist (SCM alist, SCM prop_path, SCM value)
+{
+ SCM new_value = SCM_BOOL_F;
+ if (scm_is_pair (scm_cdr (prop_path)))
+ {
+ SCM sub_alist = ly_assoc_get (scm_car (prop_path), alist, SCM_EOL);
+ new_value = nested_property_alist (sub_alist, scm_cdr (prop_path), value);
+ }
+ else
+ {
+ new_value = value;
+ }
+
+ return scm_acons (scm_car (prop_path), new_value, alist);
+}
+
+
+void
+set_nested_property (Grob *me, SCM property_path, SCM value)
+{
+ SCM big_to_small = scm_reverse (property_path);
+ SCM alist = me->get_property (scm_car (big_to_small));
+
+ alist = nested_property_alist (alist, scm_cdr (big_to_small), value);
+
+ me->set_property (scm_car (big_to_small),
+ alist);
+}
+
Han-Wen Nienhuys <hanwen@xs4all.nl>
*/
-#include "warn.hh" // error()
+#include "warn.hh" // error ()
#include "item.hh"
#include "output-def.hh"
#include "system.hh"
Grob *sc = unsmob_grob (grob);
LY_ASSERT_SMOB (Grob, grob, 1);
- LY_ASSERT_TYPE (ly_is_symbol,sym, 2);
+ LY_ASSERT_TYPE (ly_is_symbol, sym, 2);
return sc->get_property_data (sym);
}
Grob *sc = unsmob_grob (grob);
LY_ASSERT_SMOB (Grob, grob, 1);
- LY_ASSERT_TYPE (ly_is_symbol,sym, 2);
+ LY_ASSERT_TYPE (ly_is_symbol, sym, 2);
if (!ly_is_procedure (val)
&& !type_check_assignment (sym, val, ly_symbol2scm ("backend-type?")))
Grob *sc = unsmob_grob (grob);
LY_ASSERT_SMOB (Grob, grob, 1);
- LY_ASSERT_TYPE (ly_is_symbol,sym, 2);
+ LY_ASSERT_TYPE (ly_is_symbol, sym, 2);
if (deflt == SCM_UNDEFINED)
deflt = SCM_EOL;
Grob *sc = unsmob_grob (grob);
LY_ASSERT_SMOB (Grob, grob, 1);
- LY_ASSERT_TYPE (ly_is_symbol,sym, 2);
+ LY_ASSERT_TYPE (ly_is_symbol, sym, 2);
return sc->internal_get_object (sym);
}
LY_ASSERT_SMOB (Grob, grob, 1);
- LY_ASSERT_SMOB(Grob, refp, 2);
- LY_ASSERT_TYPE(is_axis,axis, 3);
+ LY_ASSERT_SMOB (Grob, refp, 2);
+ LY_ASSERT_TYPE (is_axis, axis, 3);
Axis a = Axis (scm_to_int (axis));
LY_ASSERT_SMOB (Grob, grob, 1);
- LY_ASSERT_SMOB(Grob, refp, 2);
- LY_ASSERT_TYPE(is_axis,axis, 3);
+ LY_ASSERT_SMOB (Grob, refp, 2);
+ LY_ASSERT_TYPE (is_axis, axis, 3);
Axis a = Axis (scm_to_int (axis));
LY_ASSERT_SMOB (Grob, grob, 1);
- LY_ASSERT_SMOB(Grob,refp, 2);
- LY_ASSERT_TYPE(is_axis,axis, 3);
+ LY_ASSERT_SMOB (Grob, refp, 2);
+ LY_ASSERT_TYPE (is_axis, axis, 3);
Axis a = Axis (scm_to_int (axis));
SCM_ASSERT_TYPE (false, refp, SCM_ARG2, __FUNCTION__, "common refpoint");
}
- return scm_from_double (sc->relative_coordinate (ref,a));
+ return scm_from_double (sc->relative_coordinate (ref, a));
}
Grob *sc = unsmob_grob (grob);
LY_ASSERT_SMOB (Grob, grob, 1);
- LY_ASSERT_TYPE(is_axis,axis, 2);
+ LY_ASSERT_TYPE (is_axis, axis, 2);
Grob *par = sc->get_parent (Axis (scm_to_int (axis)));
return par ? par->self_scm () : SCM_EOL;
Grob *me = unsmob_grob (grob);
LY_ASSERT_SMOB (Grob, grob, 1);
- LY_ASSERT_TYPE(scm_is_number,d, 2);
- LY_ASSERT_TYPE(is_axis,a, 3);
+ LY_ASSERT_TYPE (scm_is_number, d, 2);
+ LY_ASSERT_TYPE (is_axis, a, 3);
me->translate_axis (scm_to_double (d), Axis (scm_to_int (a)));
return SCM_UNSPECIFIED;
Grob *gr = unsmob_grob (grob);
LY_ASSERT_SMOB (Grob, grob, 1);
- LY_ASSERT_SMOB(Grob,other, 2);
+ LY_ASSERT_SMOB (Grob, other, 2);
Grob *o = unsmob_grob (other);
- LY_ASSERT_TYPE(is_axis,axis, 3);
+ LY_ASSERT_TYPE (is_axis, axis, 3);
Grob *refp = gr->common_refpoint (o, Axis (scm_to_int (axis)));
return refp ? refp->self_scm () : SCM_BOOL_F;
Grob *gr = unsmob_grob (grob);
LY_ASSERT_SMOB (Grob, grob, 1);
- LY_ASSERT_SMOB(Grob_array,others, 2);
+ LY_ASSERT_SMOB (Grob_array, others, 2);
Grob_array *ga = unsmob_grob_array (others);
- LY_ASSERT_TYPE(is_axis,axis, 3);
+ LY_ASSERT_TYPE (is_axis, axis, 3);
Grob *refp = common_refpoint_of_array (ga->array (), gr, Axis (scm_to_int (axis)));
return refp ? refp->self_scm () : SCM_BOOL_F;
SCM
Grob::mark_smob (SCM ses)
{
- ASSERT_LIVE_IS_ALLOWED();
+ ASSERT_LIVE_IS_ALLOWED ();
Grob *s = (Grob *) SCM_CELL_WORD_1 (ses);
scm_gc_mark (s->immutable_property_alist_);
"before-line-breaking "
"cause "
"color "
+ "cross-staff "
"extra-X-extent "
"extra-Y-extent "
"extra-offset "
return grob_stencil_extent (me, Y_AXIS);
}
-MAKE_SCHEME_CALLBACK(Grob, y_parent_positioning, 1);
+MAKE_SCHEME_CALLBACK (Grob, y_parent_positioning, 1);
SCM
Grob::y_parent_positioning (SCM smob)
{
}
-MAKE_SCHEME_CALLBACK(Grob, x_parent_positioning, 1);
+MAKE_SCHEME_CALLBACK (Grob, x_parent_positioning, 1);
SCM
Grob::x_parent_positioning (SCM smob)
{
Box extent (Interval (-rad, rad), Interval (-rad, rad));
/* Hmmm, perhaps we should have a Lookup::circle () method? */
- Stencil circle(extent,
+ Stencil circle (extent,
scm_list_4 (ly_symbol2scm ("circle"),
scm_from_double (rad),
scm_from_double (thick),
return Axis_group_interface::generic_group_extent (me, Y_AXIS);
}
+MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, calc_skylines, 1);
+SCM
+Hara_kiri_group_spanner::calc_skylines (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ consider_suicide (me);
+ return Axis_group_interface::calc_skylines (smob);
+}
+
MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, pure_height, 3);
SCM
Hara_kiri_group_spanner::pure_height (SCM smob, SCM start_scm, SCM end_scm)
}
else
{
- Stencil b = make_bracket (me, ext.length(), a, dir);
+ Stencil b = make_bracket (me, ext.length (), a, dir);
b.translate_axis (ext[LEFT] - refpoint->relative_coordinate (common, a), a);
return b;
{
DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM));
DECLARE_SCHEME_CALLBACK (stretch_after_break, (SCM element));
- static void align_to_fixed_distance (Grob *, Axis a);
+ DECLARE_SCHEME_CALLBACK (calc_max_stretch, (SCM));
+ static void stretch (Grob *, Real amount, Axis a);
static void align_elements_to_extents (Grob *, Axis a);
static vector<Real> get_extents_aligned_translates (Grob *, vector<Grob*> const&,
Axis a,
bool safe, int start, int end);
+ static int stretchable_children_count (Grob const*);
static void set_ordered (Grob *);
static Axis axis (Grob *);
static void add_element (Grob *, Grob *);
#include "moment.hh"
#include "pitch.hh"
-/**
-
-Any piece of audio information. We need virtual constructors, let's
-try decentralised factory for specific audio implemenations.
-*/
class Audio_item : public Audio_element
{
public:
DECLARE_SCHEME_CALLBACK (pure_height, (SCM smob, SCM start, SCM end));
DECLARE_SCHEME_CALLBACK (calc_skylines, (SCM smob));
DECLARE_SCHEME_CALLBACK (combine_skylines, (SCM smob));
+ DECLARE_SCHEME_CALLBACK (calc_max_stretch, (SCM smob));
static Interval relative_group_extent (vector<Grob*> const &list,
Grob *common, Axis);
static Interval relative_pure_height (Grob *me, vector<Grob*> const &list,
static Grob *last_normal_stem (Grob *);
DECLARE_GROB_INTERFACE();
static void add_stem (Grob *, Grob *);
+ static bool is_cross_staff (Grob *);
static bool is_knee (Grob *);
static void set_beaming (Grob *, Beaming_pattern const *);
static void set_stemlens (Grob *);
DECLARE_SCHEME_CALLBACK (calc_normal_stems, (SCM));
DECLARE_SCHEME_CALLBACK (calc_concaveness, (SCM));
DECLARE_SCHEME_CALLBACK (set_stem_lengths, (SCM));
+ DECLARE_SCHEME_CALLBACK (cross_staff, (SCM));
/* position callbacks */
DECLARE_SCHEME_CALLBACK (shift_region_to_valid, (SCM, SCM));
class Constrained_breaking
{
public:
- vector<Column_x_positions> solve ();
+ vector<Column_x_positions> solve (vsize start, vsize end, vsize sys_count);
+ vector<Column_x_positions> best_solution (vsize start, vsize end);
+ vector<Line_details> line_details (vsize start, vsize end, vsize sys_count);
+
Constrained_breaking (Paper_score *ps);
Constrained_breaking (Paper_score *ps, vector<vsize> const &start_col_posns);
- vector<Column_x_positions> get_solution (vsize start, vsize end, vsize sys_count);
- vector<Column_x_positions> get_best_solution (vsize start, vsize end);
- vector<Line_details> get_details (vsize start, vsize end, vsize sys_count);
- int get_max_systems (vsize start, vsize end);
- int get_min_systems (vsize start, vsize end);
-
- void resize (vsize systems);
+ int max_system_count (vsize start, vsize end);
+ int min_system_count (vsize start, vsize end);
private:
Paper_score *pscore_;
vector<vsize> breaks_;
void initialize ();
+ void resize (vsize systems);
Column_x_positions space_line (vsize start_col, vsize end_col);
vsize prepare_solution (vsize start, vsize end, vsize sys_count);
char const *vars);
SCM ly_add_interface (SCM, SCM, SCM);
+void internal_add_interface (SCM, SCM, SCM);
SCM ly_all_grob_interfaces ();
#endif /* INTERFACE_HH */
SCM get_property_alist_chain (SCM) const;
SCM internal_get_property (SCM symbol) const;
SCM internal_get_property_data (SCM symbol) const;
+ SCM internal_get_non_callback_marker_property_data (SCM symbol) const;
SCM internal_get_object (SCM symbol) const;
void internal_set_object (SCM sym, SCM val);
void internal_del_property (SCM symbol);
SCM call_pure_function (SCM unpure, SCM args, int start, int end);
+void set_nested_property (Grob *, SCM property_path, SCM value);
+
+
#endif /* GROB_HH */
public:
DECLARE_SCHEME_CALLBACK (force_hara_kiri_callback, (SCM));
DECLARE_SCHEME_CALLBACK (y_extent, (SCM smob));
+ DECLARE_SCHEME_CALLBACK (calc_skylines, (SCM smob));
DECLARE_SCHEME_CALLBACK (pure_height, (SCM smob, SCM start, SCM end));
DECLARE_SCHEME_CALLBACK (force_hara_kiri_in_y_parent_callback, (SCM));
DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
vector<Real> spring_positions () const;
Real force () const;
+ Real force_penalty (bool ragged) const;
bool fits () const;
DECLARE_SIMPLE_SMOBS (Simple_spacer);
Real height (Real airplane) const;
Real max_height () const;
void set_minimum_height (Real height);
+ bool is_empty () const;
};
class Skyline_pair
void merge (Skyline_pair const &other);
Skyline &operator [] (Direction d);
Skyline const &operator [] (Direction d) const;
+ bool is_empty () const;
};
#endif /* SKYLINE_HH */
DECLARE_SCHEME_CALLBACK (height, (SCM));
DECLARE_SCHEME_CALLBACK (outside_slur_callback, (SCM, SCM));
DECLARE_SCHEME_CALLBACK (pure_outside_slur_callback, (SCM, SCM, SCM, SCM));
+ DECLARE_SCHEME_CALLBACK (cross_staff, (SCM));
DECLARE_GROB_INTERFACE();
static Bezier get_curve (Grob *me);
};
static int head_count (Grob *);
static bool is_invisible (Grob *);
static bool is_normal_stem (Grob *);
+ static bool is_cross_staff (Grob *);
static Interval head_positions (Grob *);
static Real stem_end_position (Grob *);
static Stencil flag (Grob *);
DECLARE_SCHEME_CALLBACK (width, (SCM smob));
DECLARE_SCHEME_CALLBACK (pure_height, (SCM, SCM, SCM));
DECLARE_SCHEME_CALLBACK (height, (SCM));
+ DECLARE_SCHEME_CALLBACK (cross_staff, (SCM));
};
#endif
DECLARE_SCHEME_CALLBACK (undump, (SCM));
DECLARE_SCHEME_CALLBACK (dump, (SCM));
-
};
#define in_event_class(class_name) internal_in_event_class (ly_symbol2scm (class_name))
{
int rank_;
Grob_array *all_elements_;
- Drul_array<Skyline> skylines_;
+ Skyline_pair skylines_;
void build_skylines ();
void init_elements ();
friend class Paper_score; // ugh.
public:
Paper_score *paper_score () const;
int get_rank () const;
+ void do_break_substitution_and_fixup_refpoints ();
void post_processing ();
SCM get_paper_system ();
SCM get_paper_systems ();
+ SCM get_broken_system_grobs ();
System (SCM);
System (System const &);
DECLARE_GROB_INTERFACE();
DECLARE_SCHEME_CALLBACK (print, (SCM));
static void modify_edge_height (Spanner *);
- static void add_column (Grob *, Grob *col);
static void add_bar (Grob *me, Item *bar);
};
Input *ip = unsmob_input (sip);
LY_ASSERT_TYPE (unsmob_input, sip, 1);
- LY_ASSERT_TYPE(scm_is_string, msg,2);
+ LY_ASSERT_TYPE (scm_is_string, msg,2);
msg = scm_simple_format (SCM_BOOL_F, msg, rest);
class Instrument_switch_engraver : public Engraver
{
- TRANSLATOR_DECLARATIONS(Instrument_switch_engraver);
+ TRANSLATOR_DECLARATIONS (Instrument_switch_engraver);
protected:
Grob *text_;
SCM cue_name_;
text_ = 0;
}
-ADD_TRANSLATOR(Instrument_switch_engraver,
+ADD_TRANSLATOR (Instrument_switch_engraver,
"Create a cue text for taking instrument.",
"InstrumentSwitch ",
SCM last = get_property ("lastKeySignature");
SCM key = get_property ("keySignature");
- bool extranatural = to_boolean(get_property("extraNatural"));
+ bool extranatural = to_boolean (get_property ("extraNatural"));
if ((to_boolean (get_property ("printKeyCancellation"))
|| key == SCM_EOL)
struct Key_signature_interface
{
DECLARE_SCHEME_CALLBACK (print, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
Interval x_extent,
Real left_shorten);
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
Stencil
{
int line_count = (staff_extent.contains (pos)
? 0
- : sign (pos) * int (rint(pos - staff_extent[Direction (sign (pos))])) / 2);
+ : sign (pos) * int (rint (pos - staff_extent[Direction (sign (pos))])) / 2);
Stencil stencil;
if (line_count)
{
struct Ledgered_interface
{
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
ADD_INTERFACE (Ledgered_interface,
SCM
ly_string2scm (string const &str)
{
- return scm_from_locale_stringn (str.c_str(),
+ return scm_from_locale_stringn (str.c_str (),
str.length ());
}
for (vsize i = 0; i < os.size (); i++)
{
*tail = scm_cons (ly_offset2scm (os[i]), SCM_EOL);
- tail = SCM_CDRLOC(*tail);
+ tail = SCM_CDRLOC (*tail);
}
return l;
}
#include "lily-lexer.hh"
-LY_DEFINE(ly_lexer_keywords, "ly:lexer-keywords",
+LY_DEFINE (ly_lexer_keywords, "ly:lexer-keywords",
1, 0, 0, (SCM lexer),
"Return a list of (KEY . CODE) pairs, signifying the lilypond reserved words list.")
{
scm_from_int (keytable_->table_[i].tokcode_),
SCM_EOL);
- tail = SCM_CDRLOC(*tail);
+ tail = SCM_CDRLOC (*tail);
}
return l;
SCM
Lily_lexer::mark_smob (SCM s)
{
- ASSERT_LIVE_IS_ALLOWED();
+ ASSERT_LIVE_IS_ALLOWED ();
Lily_lexer *lexer = (Lily_lexer *) SCM_CELL_WORD_1 (s);
LY_ASSERT_SMOB (Lily_parser, parser_smob, 1);
Lily_parser *parser = unsmob_lily_parser (parser_smob);
- LY_ASSERT_TYPE (ly_is_symbol,symbol, 2);
+ LY_ASSERT_TYPE (ly_is_symbol, symbol, 2);
parser->lexer_->set_identifier (scm_symbol_to_string (symbol), val);
return SCM_UNSPECIFIED;
Lily_parser *parser = unsmob_lily_parser (parser_smob);
- LY_ASSERT_TYPE (ly_is_symbol,symbol, 2);
+ LY_ASSERT_TYPE (ly_is_symbol, symbol, 2);
SCM val = parser->lexer_->lookup_identifier (ly_scm2string (scm_symbol_to_string (symbol)));
if (val != SCM_UNDEFINED)
{
LY_ASSERT_SMOB (Lily_parser, parser_smob, 1);
Lily_parser *parser = unsmob_lily_parser (parser_smob);
- LY_ASSERT_TYPE(scm_is_string,ly_code, 2);
+ LY_ASSERT_TYPE (scm_is_string, ly_code, 2);
parser->parse_string (ly_scm2string (ly_code));
LY_ASSERT_SMOB (Lily_parser, parser, 1);
Lily_parser *p = unsmob_lily_parser (parser);
- LY_ASSERT_TYPE(scm_is_string,msg, 2);
+ LY_ASSERT_TYPE (scm_is_string, msg, 2);
string s = ly_scm2string (msg);
Input *i = unsmob_input (input);
if (period <= 0)
return Stencil ();
- Real len = (to-from).length();
+ Real len = (to-from).length ();
int n = (int) rint ((len - period * fraction) / period);
if (n > 0)
TODO: figure out something intelligent for really short
sections.
*/
- period = ((to-from).length() - period * fraction) / n;
+ period = ((to-from).length () - period * fraction) / n;
}
stil = make_dashed_line (thick, from, to, period, fraction);
}
DECLARE_SCHEME_CALLBACK (calc_left_bound_info_and_text, (SCM));
DECLARE_SCHEME_CALLBACK (calc_right_bound_info, (SCM));
DECLARE_SCHEME_CALLBACK (calc_bound_info, (SCM, Direction));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
else
{
Grob *commony = me->common_refpoint (me->get_bound (dir), Y_AXIS);
- y = me->get_bound (dir)->extent (commony, Y_AXIS).center();
+ y = me->get_bound (dir)->extent (commony, Y_AXIS).center ();
details = scm_acons (ly_symbol2scm ("common-Y"), commony->self_scm (), details);
}
{
if (music_context_)
{
- music_context_->event_source()->remove_listener (GET_LISTENER (set_busy), ly_symbol2scm ("music-event"));
+ music_context_->event_source ()->remove_listener (GET_LISTENER (set_busy), ly_symbol2scm ("music-event"));
}
music_context_ = to;
if (to)
{
- to->event_source()->add_listener (GET_LISTENER (set_busy), ly_symbol2scm ("music-event"));
+ to->event_source ()->add_listener (GET_LISTENER (set_busy), ly_symbol2scm ("music-event"));
}
}
*/
string prefix_directory;
-/* The jail specification: USER,GROUP,JAIL,DIR. */
+/* The jail specification: USER, GROUP, JAIL, DIR. */
string jail_spec;
/* The option parser */
{_i ("DIR"), "include", 'I', _i ("add DIR to search path")},
{_i ("FILE"), "init", 'i', _i ("use FILE as init file")},
#if HAVE_CHROOT
- {_i ("USER,GROUP,JAIL,DIR"), "jail", 'j', _i ("chroot to JAIL, become USER:GROUP\n"
+ {_i ("USER, GROUP, JAIL, DIR"), "jail", 'j', _i ("chroot to JAIL, become USER:GROUP\n"
"and cd into DIR")},
#endif
{0, "no-print", 0, _i ("do not generate printed output")},
void
Mark_engraver::stop_translation_timestep ()
{
- if (text_)
- {
- text_->set_object ("side-support-elements",
- grob_list_to_grob_array (get_property ("stavesFound")));
- text_ = 0;
- }
+ text_ = 0;
mark_ev_ = 0;
}
/*
Interpolate stem directions for neutral stems.
*/
-MAKE_SCHEME_CALLBACK(Melody_spanner,calc_neutral_stem_direction, 1);
+MAKE_SCHEME_CALLBACK (Melody_spanner, calc_neutral_stem_direction, 1);
SCM
Melody_spanner::calc_neutral_stem_direction (SCM smob)
{
{
Grob *mc = unsmob_grob (get_property ("currentMusicalColumn"));
text_->set_parent (mc, X_AXIS);
- text_->set_object ("side-support-elements",
- grob_list_to_grob_array (get_property ("stavesFound")));
-
text_ = 0;
}
}
{
string str = Midi_chunk::data_string ();
- for (vector<Midi_event*>::const_iterator i (events_.begin());
- i != events_.end(); i ++)
+ for (vector<Midi_event*>::const_iterator i (events_.begin ());
+ i != events_.end (); i ++)
{
str += (*i)->to_string ();
}
// print warning if fine tuning was needed, HJJ
if (get_fine_tuning () != 0)
{
- warning (_f ("experimental: temporarily fine tuning (of %d cents) a channel.",
- get_fine_tuning ()));
-
finetune = PITCH_WHEEL_CENTER;
// Move pitch wheel to a shifted position.
// The pitch wheel range (of 4 semitones) is multiplied by the cents.
str += ::to_string ((char) status_byte);
str += ::to_string ((char) (get_semitone_pitch () + c0_pitch_));
- str += ::to_string ((char)dynamic_byte_);
+ str += ::to_string ((char) dynamic_byte_);
return str;
}
Midi_walker::do_start_note (Midi_note *note)
{
Audio_item *ptr = items_[index_];
+ assert (note->audio_ == ptr);
int stop_ticks = int (moment_to_real (note->audio_->length_mom_) * Real (384 * 4))
+ ptr->audio_column_->ticks ();
}
}
-/**
- Output note events for all notes which end before #max_mom#
-*/
void
Midi_walker::do_stop_notes (int max_ticks)
{
"In absence of grace notes, @var{g} is zero.\n")
{
LY_ASSERT_TYPE (scm_is_integer, n, 1);
- LY_ASSERT_TYPE(scm_is_integer,d, 2);
+ LY_ASSERT_TYPE (scm_is_integer, d, 2);
int grace_num = 0;
if (gn != SCM_UNDEFINED)
{
- LY_ASSERT_TYPE(scm_is_integer,gn, 3);
+ LY_ASSERT_TYPE (scm_is_integer, gn, 3);
grace_num = scm_to_int (gn);
}
int grace_den = 1;
if (gd != SCM_UNDEFINED)
{
- LY_ASSERT_TYPE(scm_is_integer,gd, 4);
+ LY_ASSERT_TYPE (scm_is_integer, gd, 4);
grace_den = scm_to_int (gd);
}
"Subtract two moments.")
{
LY_ASSERT_SMOB (Moment, a, 1);
- LY_ASSERT_SMOB (Moment,b, 2);
+ LY_ASSERT_SMOB (Moment, b, 2);
Moment *ma = unsmob_moment (a);
Moment *mb = unsmob_moment (b);
"Add two moments.")
{
LY_ASSERT_SMOB (Moment, a, 1);
- LY_ASSERT_SMOB(Moment,b, 2);
+ LY_ASSERT_SMOB (Moment, b, 2);
Moment *ma = unsmob_moment (a);
Moment *mb = unsmob_moment (b);
"Multiply two moments.")
{
LY_ASSERT_SMOB (Moment, a, 1);
- LY_ASSERT_SMOB(Moment, b, 2);
+ LY_ASSERT_SMOB (Moment, b, 2);
Moment *ma = unsmob_moment (a);
Moment *mb = unsmob_moment (b);
"Divide two moments.")
{
LY_ASSERT_SMOB (Moment, a, 1);
- LY_ASSERT_SMOB(Moment, b, 2);
+ LY_ASSERT_SMOB (Moment, b, 2);
Moment *ma = unsmob_moment (a);
Moment *mb = unsmob_moment (b);
"Modulo of two moments.")
{
LY_ASSERT_SMOB (Moment, a, 1);
- LY_ASSERT_SMOB(Moment, b, 2);
+ LY_ASSERT_SMOB (Moment, b, 2);
Moment *ma = unsmob_moment (a);
Moment *mb = unsmob_moment (b);
"If @var{sym} is undefined, return @code{'()}.\n")
{
LY_ASSERT_TYPE (unsmob_music, mus, 1);
- return ly_prob_property (mus,sym,dfault);
+ return ly_prob_property (mus, sym, dfault);
}
LY_DEFINE (ly_music_set_property_x, "ly:music-set-property!",
"Compress music object @var{m} by moment @var{factor}.")
{
LY_ASSERT_TYPE (unsmob_music, m, 1);
- LY_ASSERT_TYPE(unsmob_moment,factor, 2);
+ LY_ASSERT_TYPE (unsmob_moment, factor, 2);
Music *sc = unsmob_music (m);
sc->compress (*unsmob_moment (factor));
void
New_fingering_engraver::stop_translation_timestep ()
{
- position_all();
+ position_all ();
stem_ = 0;
heads_.clear ();
}
}
-MAKE_SCHEME_CALLBACK(Note_collision_interface, calc_positioning_done, 1)
+MAKE_SCHEME_CALLBACK (Note_collision_interface, calc_positioning_done, 1)
SCM
Note_collision_interface::calc_positioning_done (SCM smob)
{
Direction d = UP;
do
{
- for (vsize i = cg[d].size(); i--; )
+ for (vsize i = cg[d].size (); i--; )
{
/*
Trigger positioning
#include "font-metric.hh"
-LY_DEFINE(ly_note_head__stem_attachment, "ly:note-head::stem-attachment",
+LY_DEFINE (ly_note_head__stem_attachment, "ly:note-head::stem-attachment",
2, 0, 0, (SCM font_metric, SCM glyph_name),
"Get attachment in @var{font-metric} for attaching a stem to notehead "
"@var{glyph-name}.")
{
LY_ASSERT_SMOB (Font_metric, font_metric, 1);
Font_metric *fm = unsmob_metrics (font_metric);
- LY_ASSERT_TYPE(scm_is_string,glyph_name, 2);
+ LY_ASSERT_TYPE (scm_is_string, glyph_name, 2);
return ly_offset2scm (Note_head::get_stem_attachment (fm, ly_scm2string (glyph_name)));
}
return att;
}
-MAKE_SCHEME_CALLBACK(Note_head, calc_stem_attachment, 1);
+MAKE_SCHEME_CALLBACK (Note_head, calc_stem_attachment, 1);
SCM
Note_head::calc_stem_attachment (SCM smob)
{
#include "translator.icc"
-/**
- Convert evs to audio notes.
-*/
class Note_performer : public Performer
{
public:
private:
vector<Stream_event*> note_evs_;
vector<Audio_note*> notes_;
+
+
+ vector<Audio_note*> last_notes_;
+ Moment last_start_;
+
};
void
Note_performer::process_music ()
{
- if (note_evs_.size ())
+ if (!note_evs_.size ())
+ return;
+
+ Pitch transposing;
+ SCM prop = get_property ("instrumentTransposition");
+ if (unsmob_pitch (prop))
+ transposing = *unsmob_pitch (prop);
+
+ for (vsize i = 0; i < note_evs_.size (); i ++)
{
- Pitch transposing;
- SCM prop = get_property ("instrumentTransposition");
- if (unsmob_pitch (prop))
- transposing = *unsmob_pitch (prop);
+ Stream_event *n = note_evs_[i];
+ SCM pit = n->get_property ("pitch");
- while (note_evs_.size ())
+ if (Pitch *pitp = unsmob_pitch (pit))
{
- Stream_event *n = note_evs_.back ();
- note_evs_.pop_back ();
- SCM pit = n->get_property ("pitch");
+ SCM articulations = n->get_property ("articulations");
+ Stream_event *tie_event = 0;
+ for (SCM s = articulations;
+ !tie_event && scm_is_pair (s);
+ s = scm_cdr (s))
+ {
+ Stream_event *ev = unsmob_stream_event (scm_car (s));
+ if (!ev)
+ continue;
+
+ if (ev->in_event_class ("tie-event"))
+ tie_event = ev;
+ }
- if (Pitch *pitp = unsmob_pitch (pit))
+ Moment len = get_event_length (n);
+ if (now_mom ().grace_part_)
{
- SCM articulations = n->get_property ("articulations");
- Stream_event *tie_event = 0;
- for (SCM s = articulations;
- !tie_event && scm_is_pair (s);
- s = scm_cdr (s))
- {
- Stream_event *ev = unsmob_stream_event (scm_car (s));
- if (!ev)
- continue;
+ len.grace_part_ = len.main_part_;
+ len.main_part_ = Rational (0);
+ }
- if (ev->in_event_class ("tie-event"))
- tie_event = ev;
- }
+ Audio_note *p = new Audio_note (*pitp, len,
+ tie_event, transposing.negated ());
+ Audio_element_info info (p, n);
+ announce_element (info);
+ notes_.push_back (p);
- Moment len = get_event_length (n);
- if (now_mom().grace_part_)
+ /*
+ shorten previous note.
+ */
+ if (now_mom ().grace_part_)
+ {
+ if (last_start_.grace_part_ == Rational (0))
{
- len.grace_part_ = len.main_part_;
- len.main_part_ = Rational (0);
+ for (vsize i = 0; i < last_notes_.size (); i++)
+ last_notes_[i]->length_mom_ += Moment (0,
+ now_mom().grace_part_);
}
-
- Audio_note *p = new Audio_note (*pitp, len,
- tie_event, transposing.negated ());
- Audio_element_info info (p, n);
- announce_element (info);
- notes_.push_back (p);
}
}
- note_evs_.clear ();
}
}
void
Note_performer::stop_translation_timestep ()
{
- // why don't grace notes show up here?
- // --> grace notes effectively do not get delayed
+ if (note_evs_.size ())
+ {
+ last_notes_ = notes_;
+ last_start_ = now_mom ();
+ }
+
notes_.clear ();
note_evs_.clear ();
}
if (g)
{
if (g->common_refpoint (it_col, X_AXIS) != it_col)
- programming_error ("Note_spacing::get_spacing(): Common refpoint incorrect");
+ programming_error ("Note_spacing::get_spacing (): Common refpoint incorrect");
else
left_head_wid = g->extent (it_col, X_AXIS);
}
Open_type_font *otf = dynamic_cast<Open_type_font *> (fm->original_font ());
SCM_ASSERT_TYPE (otf, font, SCM_ARG1, __FUNCTION__, "OTF font-metric");
- LY_ASSERT_TYPE(scm_is_string, glyph, 2);
+ LY_ASSERT_TYPE (scm_is_string, glyph, 2);
SCM sym = scm_string_to_symbol (glyph);
return scm_hashq_ref (otf->get_char_table (), sym, SCM_EOL);
char name[len];
size_t code = FT_Get_Glyph_Name (face_, signed_idx, name, len);
if (code)
- warning (_f ("FT_Get_Glyph_Name() Freetype error: %s",
+ warning (_f ("FT_Get_Glyph_Name () Freetype error: %s",
freetype_error_string (code)));
SCM sym = ly_symbol2scm (name);
char name[len];
size_t code = FT_Get_Glyph_Name (face_, i, name, len);
if (code)
- warning (_f ("FT_Get_Glyph_Name() error: %s",
+ warning (_f ("FT_Get_Glyph_Name () error: %s",
freetype_error_string (code).c_str ()));
*tail = scm_cons (scm_from_locale_string (name), SCM_EOL);
struct Ottava_bracket
{
DECLARE_SCHEME_CALLBACK (print, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
/*
Output_def::lookup_variable (SCM sym) const
{
SCM var = ly_module_lookup (scope_, sym);
- if (SCM_VARIABLEP (var) && SCM_VARIABLE_REF(var) != SCM_UNDEFINED)
+ if (SCM_VARIABLEP (var) && SCM_VARIABLE_REF (var) != SCM_UNDEFINED)
return SCM_VARIABLE_REF (var);
if (parent_)
{
}
-ADD_ACKNOWLEDGER (Output_property_engraver,grob);
+ADD_ACKNOWLEDGER (Output_property_engraver, grob);
ADD_TRANSLATOR (Output_property_engraver,
/* doc */
{
programming_error ("did not find a valid page breaking configuration");
ignore_div = true;
- assert (0);
}
for (vsize i = 0; i + 1 < chunks.size (); i++)
line_breaker_args (sys, chunks[i], chunks[i+1], &start, &end);
vector<Column_x_positions> pos = ignore_div
- ? line_breaking_[sys].get_best_solution (start, end)
- : line_breaking_[sys].get_solution (start, end, div[i]);
+ ? line_breaking_[sys].best_solution (start, end)
+ : line_breaking_[sys].solve (start, end, div[i]);
all_[sys].pscore_->root_system ()->break_into_pieces (pos);
}
}
{
if (all_[sys].pscore_)
{
- SCM lines = all_[sys].pscore_->root_system ()->get_paper_systems ();
- ret = scm_cons (scm_vector_to_list (lines), ret);
+ all_[sys].pscore_->root_system ()->do_break_substitution_and_fixup_refpoints ();
+ SCM lines = all_[sys].pscore_->root_system ()->get_broken_system_grobs ();
+ ret = scm_cons (lines, ret);
}
else
{
vsize end;
line_breaker_args (sys, chunks[i], chunks[i+1], &start, &end);
- vector<Line_details> details = line_breaking_[sys].get_details (start, end, div[i]);
+ vector<Line_details> details = line_breaking_[sys].line_details (start, end, div[i]);
ret.insert (ret.end (), details.begin (), details.end ());
}
else
SCM layout_module = scm_c_resolve_module ("scm layout-page-layout");
SCM page_module = scm_c_resolve_module ("scm page");
- SCM make_page = scm_c_module_lookup (layout_module, "make-page-from-systems");
+ SCM make_page = scm_c_module_lookup (layout_module, "stretch-and-draw-page");
SCM page_stencil = scm_c_module_lookup (page_module, "page-stencil");
make_page = scm_variable_ref (make_page);
page_stencil = scm_variable_ref (page_stencil);
vsize end;
line_breaker_args (sys, chunks[i], chunks[i+1], &start, &end);
ret[i] = min
- ? line_breaking_[sys].get_min_systems (start, end)
- : line_breaking_[sys].get_max_systems (start, end);
+ ? line_breaking_[sys].min_system_count (start, end)
+ : line_breaking_[sys].max_system_count (start, end);
}
}
return ret;
}
-/* the cases for page_count = 1 or 2 can be done in O(n) time. Since they
+/* the cases for page_count = 1 or 2 can be done in O (n) time. Since they
are by far the most common cases, we have special functions for them */
static Spacing_result
space_systems_on_1_page (vector<Line_details> const &lines, Real page_height, bool ragged)
{
int errorcode = FT_Get_Glyph_Name (ftface, pg, glyph_name, GLYPH_NAME_LEN);
if (errorcode)
- programming_error (_f ("FT_Get_Glyph_Name() error: %s",
- freetype_error_string (errorcode).c_str()
+ programming_error (_f ("FT_Get_Glyph_Name () error: %s",
+ freetype_error_string (errorcode).c_str ()
));
}
/* read the breakbefore property of a score block and set up the preceding
system-spec to honour it. That is, SYM should be the system spec that
immediately precedes the score (from which HEADER is taken)
- in the get_system_specs() list */
+ in the get_system_specs () list */
void
set_system_penalty (SCM sys, SCM header)
{
Prob *ps = make_paper_system (props);
paper_system_set_stencil (ps, title);
- return ps->self_scm();
+ return ps->self_scm ();
}
return SCM_BOOL_F;
&& !measure_position (context ()).main_part_);
/*
- We can't do this in start_translation_timestep(), since time sig
+ We can't do this in start_translation_timestep (), since time sig
changes won't have happened by then.
*/
if (start_of_measure)
items_.clear ();
if (to_boolean (get_property ("forbidBreak")))
- command_column_->set_property ("line-break-permission", SCM_EOL);
+ {
+ command_column_->set_property ("page-break-permission", SCM_EOL);
+ command_column_->set_property ("line-break-permission", SCM_EOL);
+ if (break_events_.size ())
+ warning (_f ("break event at moment %d/%d was overridden by some other event, are you using bar checks?",
+ now_mom ().num (), now_mom ().den ()));
+ }
else if (Paper_column::is_breakable (command_column_))
{
breaks_++;
{
LY_ASSERT_SMOB (Paper_outputter, outputter, 1);
- LY_ASSERT_SMOB(Stencil, stencil, 2);
+ LY_ASSERT_SMOB (Stencil, stencil, 2);
Paper_outputter *po = unsmob_outputter (outputter);
Stencil *st = unsmob_stencil (stencil);
"Dump @var{str} onto @var{outputter}.")
{
LY_ASSERT_SMOB (Paper_outputter, outputter, 1);
- LY_ASSERT_TYPE(scm_is_string, str, 2);
+ LY_ASSERT_TYPE (scm_is_string, str, 2);
Paper_outputter *po = unsmob_outputter (outputter);
int system_count = robust_scm2int (layout ()->c_variable ("system-count"), 0);
if (system_count)
- algorithm.resize (system_count);
+ return algorithm.solve (0, VPOS, system_count);
- return algorithm.solve ();
+ return algorithm.best_solution (0, VPOS);
}
void
vector<Column_x_positions> breaking = calc_breaking ();
system_->break_into_pieces (breaking);
message (_ ("Drawing systems...") + " ");
+ system_->do_break_substitution_and_fixup_refpoints ();
paper_systems_ = system_->get_paper_systems ();
}
return paper_systems_;
if (is_number_pair (yext))
{
- Box b = s.extent_box();
+ Box b = s.extent_box ();
b[Y_AXIS] = ly_scm2interval (yext);
s = Stencil (b, s.expr ());
DECLARE_ACKNOWLEDGER (grob);
};
-Parenthesis_engraver::Parenthesis_engraver()
+Parenthesis_engraver::Parenthesis_engraver ()
{
}
&& to_boolean (get_property ("countPercentRepeats")))
{
Item *double_percent_counter = make_item ("DoublePercentRepeatCounter",
- percent_event_->self_scm());
+ percent_event_->self_scm ());
SCM text = scm_number_to_string (count,
scm_from_int (10));
{
percent_event_->origin ()->warning (_ ("unterminated percent repeat"));
percent_->suicide ();
- percent_counter_->suicide();
+ percent_counter_->suicide ();
}
}
class Percent_repeat_iterator : public Sequential_iterator
{
public:
- DECLARE_CLASSNAME(Percent_repeat_iterator);
+ DECLARE_CLASSNAME (Percent_repeat_iterator);
DECLARE_SCHEME_CALLBACK (constructor, ());
Percent_repeat_iterator ();
protected:
"Write @var{performance} to @var{filename}")
{
LY_ASSERT_TYPE (unsmob_performance, performance, 1);
- LY_ASSERT_TYPE(scm_is_string, filename, 2);
+ LY_ASSERT_TYPE (scm_is_string, filename, 2);
unsmob_performance (performance)->write_output (ly_scm2string (filename));
return SCM_UNSPECIFIED;
struct Piano_pedal_bracket
{
DECLARE_SCHEME_CALLBACK (print, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
MAKE_SCHEME_CALLBACK (Piano_pedal_bracket, print, 1);
a->type_string_ = pedal_type;
a->dir_ = STOP;
audios_.push_back (a);
- Audio_element_info info(a, p->event_drul_[STOP]);
+ Audio_element_info info (a, p->event_drul_[STOP]);
announce_element (info);
}
p->start_event_ = 0;
a->type_string_ = pedal_type;
a->dir_ = START;
audios_.push_back (a);
- Audio_element_info info(a, p->event_drul_[START]);
+ Audio_element_info info (a, p->event_drul_[START]);
announce_element (info);
}
p->event_drul_[START] = 0;
"The @var{alter} is a rational number of whole tones for alteration.")
{
LY_ASSERT_TYPE (scm_is_integer, octave, 1);
- LY_ASSERT_TYPE(scm_is_integer, note, 2);
- LY_ASSERT_TYPE(scm_is_rational, alter, 3);
+ LY_ASSERT_TYPE (scm_is_integer, note, 2);
+ LY_ASSERT_TYPE (scm_is_rational, alter, 3);
Pitch p (scm_to_int (octave), scm_to_int (note),
ly_scm2rational (alter));
alteration_ = Rational (0);
alteration_ -= tone_pitch () - pitch;
}
- while (alteration_ < Rational(-1))
+ while (alteration_ < Rational (-1))
{
if (notename_ == 0)
{
*/
#include "prob.hh"
+#include "skyline.hh"
LY_DEFINE (ly_prob_set_property_x, "ly:prob-set-property!",
2, 1, 0, (SCM obj, SCM sym, SCM value),
{
LY_ASSERT_SMOB (Prob, obj, 1);
Prob *ps = unsmob_prob (obj);
- LY_ASSERT_TYPE (ly_is_symbol,sym, 2);
+ LY_ASSERT_TYPE (ly_is_symbol, sym, 2);
if (dfault == SCM_UNDEFINED)
dfault = SCM_EOL;
"If obj the specified prob-type?")
{
Prob*prob = unsmob_prob (obj);
- return scm_from_bool (prob && prob->type() == type);
+ return scm_from_bool (prob && prob->type () == type);
}
LY_DEFINE (ly_make_prob, "ly:make-prob",
}
-LY_DEFINE(ly_paper_system_p, "ly:paper-system?",
+LY_DEFINE (ly_paper_system_p, "ly:paper-system?",
1, 0, 0, (SCM obj),
"Type predicate.")
{
return ly_prob_type_p (obj, ly_symbol2scm ("paper-system"));
}
+
+LY_DEFINE (ly_paper_system_minimum_distance, "ly:paper-system-minimum-distance",
+ 2, 0, 0, (SCM sys1, SCM sys2),
+ "Measure the minimum distance between these two paper-systems "
+ "using their stored skylines if possible and falling back to "
+ "their extents otherwise.")
+{
+ Real ret = 0;
+ Prob *p1 = unsmob_prob (sys1);
+ Prob *p2 = unsmob_prob (sys2);
+ Skyline_pair *sky1 = Skyline_pair::unsmob (p1->get_property ("skylines"));
+ Skyline_pair *sky2 = Skyline_pair::unsmob (p2->get_property ("skylines"));
+
+ if (sky1 && sky2)
+ ret = (*sky1)[DOWN].distance ((*sky2)[UP]);
+ else
+ {
+ Stencil *s1 = unsmob_stencil (p1->get_property ("stencil"));
+ Stencil *s2 = unsmob_stencil (p2->get_property ("stencil"));
+ Interval iv1 = s1->extent (Y_AXIS);
+ Interval iv2 = s2->extent (Y_AXIS);
+ ret = iv2[UP] - iv1[DOWN];
+ }
+ return scm_from_double (ret);
+}
SCM bprop = props[1][i];
for (;
- scm_is_pair (aprop) && scm_is_pair(bprop);
+ scm_is_pair (aprop) && scm_is_pair (bprop);
aprop = scm_cdr (aprop), bprop = scm_cdr (bprop))
{
SCM aval = scm_cdar (aprop);
SCM
Prob::mark_smob (SCM smob)
{
- ASSERT_LIVE_IS_ALLOWED();
+ ASSERT_LIVE_IS_ALLOWED ();
Prob *system = (Prob *) SCM_CELL_WORD_1 (smob);
scm_gc_mark (system->mutable_property_alist_);
/*
When running from build dir, a full LILYPOND_PREFIX is set-up at
- $(OUTBASE)/{share,lib}/lilypond/current
+ $(OUTBASE)/{share, lib}/lilypond/current
*/
string
expand_environment_variables (string orig)
{
- const char *start_ptr = orig.c_str();
- const char *ptr = orig.c_str();
- size_t len = orig.length();
+ const char *start_ptr = orig.c_str ();
+ const char *ptr = orig.c_str ();
+ size_t len = orig.length ();
string out;
while (ptr < start_ptr + len)
if (start_var < end_var)
{
string var_name (start_var, end_var - start_var);
- const char *value = getenv (var_name.c_str());
+ const char *value = getenv (var_name.c_str ());
if (value != NULL)
out += string (value);
value = expand_environment_variables (value);
if (command == "set")
- sane_putenv (variable.c_str(), value, true);
+ sane_putenv (variable.c_str (), value, true);
else if (command == "setdir")
- set_env_dir (variable.c_str(), value);
+ set_env_dir (variable.c_str (), value);
else if (command == "setfile")
- set_env_file (variable.c_str(), value);
+ set_env_file (variable.c_str (), value);
else if (command == "prependdir")
prepend_env_path (variable.c_str (), value);
else
TODO: look at horizontal-shift to determine ordering between rests
for more than two voices.
*/
-MAKE_SCHEME_CALLBACK(Rest_collision, calc_positioning_done, 1);
+MAKE_SCHEME_CALLBACK (Rest_collision, calc_positioning_done, 1);
SCM
Rest_collision::calc_positioning_done (SCM smob)
{
{
}
-IMPLEMENT_SMOBS(Scale);
-IMPLEMENT_DEFAULT_EQUAL_P(Scale);
+IMPLEMENT_SMOBS (Scale);
+IMPLEMENT_DEFAULT_EQUAL_P (Scale);
typeset_all ();
}
-IMPLEMENT_LISTENER(Score_engraver, one_time_step);
+IMPLEMENT_LISTENER (Score_engraver, one_time_step);
void
Score_engraver::one_time_step (SCM)
{
"Return score with @var{music} encapsulated in @var{score}.")
{
LY_ASSERT_SMOB (Music, music, 1);
- Music *mus = unsmob_music (music);
Score *score = new Score;
score->set_music (music);
SCM l = SCM_EOL;
for (vsize i = 0; i < sc->defs_.size (); i++)
- l = scm_cons (sc->defs_[i]->self_scm(), l);
+ l = scm_cons (sc->defs_[i]->self_scm (), l);
return scm_reverse_x (l, SCM_EOL);
}
struct Text_script
{
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
};
ADD_INTERFACE (Text_script,
#include "tie-column-format.hh"
-ADD_INTERFACE(Semi_tie_column,
+ADD_INTERFACE (Semi_tie_column,
"The interface for a column of l.v. ties.",
/* properties */
/*
Cut & paste from tie-column.cc
*/
-MAKE_SCHEME_CALLBACK(Semi_tie_column, calc_positioning_done, 1);
+MAKE_SCHEME_CALLBACK (Semi_tie_column, calc_positioning_done, 1);
SCM
Semi_tie_column::calc_positioning_done (SCM smob)
{
problem.set_manual_tie_configuration (manual_configs);
Ties_configuration base = problem.generate_optimal_configuration ();
- for (vsize i = 0; i < lv_ties.size(); i++)
+ for (vsize i = 0; i < lv_ties.size (); i++)
{
SCM cp = Tie::get_control_points (lv_ties[i], problem.common_x_refpoint (), base[i],
problem.details_);
#include "warn.hh"
#include "staff-symbol-referencer.hh"
-ADD_INTERFACE(Semi_tie,
+ADD_INTERFACE (Semi_tie,
"A tie which is only on one side connected to note heads. ",
"thickness "
);
-MAKE_SCHEME_CALLBACK(Semi_tie, calc_control_points, 1)
+MAKE_SCHEME_CALLBACK (Semi_tie, calc_control_points, 1)
SCM
Semi_tie::calc_control_points (SCM smob)
{
}
-MAKE_SCHEME_CALLBACK(Separation_item,calc_skylines,1);
+MAKE_SCHEME_CALLBACK (Separation_item, calc_skylines,1);
SCM
Separation_item::calc_skylines (SCM smob)
{
return SCM_EOL;
}
-LY_DEFINE(ly_simple_closure_p, "ly:simple-closure?",
+LY_DEFINE (ly_simple_closure_p, "ly:simple-closure?",
1,0,0, (SCM clos),
"Type predicate.")
{
return scm_from_bool (is_simple_closure (clos));
}
-LY_DEFINE(ly_make_simple_closure, "ly:make-simple-closure",
+LY_DEFINE (ly_make_simple_closure, "ly:make-simple-closure",
1, 0, 0, (SCM expr),
"Make a simple closure. @var{expr} should be form of "
"@code{(@var{func} @var{a1} @var{A2} ...)}, and will be invoked "
{
SCM z;
- SCM_NEWSMOB(z, simple_closure_tag, expr);
+ SCM_NEWSMOB (z, simple_closure_tag, expr);
return z;
}
-LY_DEFINE(ly_eval_simple_closure, "ly:eval-simple-closure",
+LY_DEFINE (ly_eval_simple_closure, "ly:eval-simple-closure",
2, 2, 0, (SCM delayed, SCM closure, SCM scm_start, SCM scm_end),
"Evaluate a simple closure with the given delayed argument. "
"If start and end are defined, evaluate it purely with those "
SCM_ASSERT_TYPE (len >= 0, springs, SCM_ARG1, __FUNCTION__, "list of springs");
SCM_ASSERT_TYPE (scm_ilength (rods) > 0, rods, SCM_ARG1, __FUNCTION__, "list of rods");
- LY_ASSERT_TYPE(scm_is_number, length, 3);
+ LY_ASSERT_TYPE (scm_is_number, length, 3);
bool is_ragged = ragged == SCM_BOOL_T;
Simple_spacer spacer;
return ret;
}
+Real
+Simple_spacer::force_penalty (bool ragged) const
+{
+ /* If we are ragged-right, we don't want to penalise according to the force,
+ but according to the amount of whitespace that is present after the end
+ of the line. */
+ if (ragged)
+ return max (0.0, line_len_ - configuration_length (0.0));
+
+ /* Use a convex compression penalty. */
+ Real f = force_;
+ return f - (f < 0 ? f*f*f*f*4 : 0);
+}
+
/****************************************************************/
Spring_description::Spring_description ()
}
}
spacer.solve ((b == 0) ? line_len - indent : line_len, ragged);
-
- /* add a (convex) penalty for compression. We do this _only_ in get_line_forces,
- not get_line_configuration. This is temporary, for backwards compatibility;
- the old line/page-breaking stuff ignores page breaks when it calculates line
- breaks, so compression penalties can result in scores (eg. wtk-fugue) blowing
- up to too many pages. */
- Real f = spacer.force ();
- force[b * breaks.size () + c] = f - (f < 0 ? f*f*f*f*4 : 0);
+ force[b * breaks.size () + c] = spacer.force_penalty (ragged);
if (!spacer.fits ())
{
}
spacer.solve (line_len, ragged);
- ret.force_ = spacer.force ();
+ ret.force_ = spacer.force_penalty (ragged);
- /*
- We used to have a penalty for compression, no matter what, but that
- fucked up wtk1-fugue2 (taking 3 full pages.)
- */
ret.config_ = spacer.spring_positions ();
for (vsize i = 0; i < ret.config_.size (); i++)
ret.config_[i] += indent;
void
Building::precompute ()
{
- slope_ = (height_[RIGHT] - height_[LEFT]) / (iv_.length());
+ slope_ = (height_[RIGHT] - height_[LEFT]) / (iv_.length ());
if (height_[LEFT] == height_[RIGHT]) /* in case they're both infinity */
slope_ = 0;
while (!buildings->empty ())
partials.push_back (non_overlapping_skyline (buildings));
- /* we'd like to say while (partials->size () > 1) but that's O(n).
+ /* we'd like to say while (partials->size () > 1) but that's O (n).
Instead, we exit in the middle of the loop */
while (!partials.empty ())
{
return out;
}
+bool
+Skyline::is_empty () const
+{
+ return buildings_.empty ();
+}
+
Skyline_pair::Skyline_pair ()
: skylines_ (Skyline (DOWN), Skyline (UP))
{
skylines_[DOWN].merge (other[DOWN]);
}
+bool
+Skyline_pair::is_empty () const
+{
+ return skylines_[UP].is_empty ()
+ && skylines_[DOWN].is_empty ();
+}
+
Skyline&
Skyline_pair::operator [] (Direction d)
{
SCM
Skyline::mark_smob (SCM)
{
- ASSERT_LIVE_IS_ALLOWED();
+ ASSERT_LIVE_IS_ALLOWED ();
return SCM_EOL;
}
}
-MAKE_SCHEME_CALLBACK(Slur, calc_control_points, 1)
+MAKE_SCHEME_CALLBACK (Slur, calc_control_points, 1)
SCM
Slur::calc_control_points (SCM smob)
{
if (!xe.is_empty ()
&& !ye.is_empty ())
- avoid.push_back (Offset (xe.center(), ye[dir_]));
+ avoid.push_back (Offset (xe.center (), ye[dir_]));
}
}
return avoid;
-MAKE_SCHEME_CALLBACK(Slur, calc_direction, 1)
+MAKE_SCHEME_CALLBACK (Slur, calc_direction, 1)
SCM
Slur::calc_direction (SCM smob)
{
e->warning ("Ignoring grob for slur. avoid-slur not set?");
}
+MAKE_SCHEME_CALLBACK (Slur, cross_staff, 1)
+SCM
+Slur::cross_staff (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ Grob *staff = Staff_symbol_referencer::get_staff_symbol (me);
+ assert (staff); // delete me
+ extract_grob_set (me, "note-columns", cols);
+
+ for (vsize i = 0; i < cols.size (); i++)
+ if (Staff_symbol_referencer::get_staff_symbol (cols[i]) != staff)
+ return SCM_BOOL_T;
+ return SCM_BOOL_F;
+}
ADD_INTERFACE (Slur,
}
ADD_SCM_INIT_FUNC (init_smob_protection, init_smob_protection);
-LY_DEFINE(ly_smob_protects, "ly:smob-protects",
+LY_DEFINE (ly_smob_protects, "ly:smob-protects",
0, 0, 0, (),
"Return lily's internal smob protection list")
{
string context = line.substr (0, ch)
+ to_string ('\n')
+ to_string (' ', col)
- + line.substr (ch, line.length()-ch);
+ + line.substr (ch, line.length ()-ch);
return context;
}
#include "ly-smobs.icc"
-IMPLEMENT_SMOBS(Source_file);
-IMPLEMENT_DEFAULT_EQUAL_P(Source_file);
-IMPLEMENT_TYPE_P(Source_file, "ly:source-file?");
+IMPLEMENT_SMOBS (Source_file);
+IMPLEMENT_DEFAULT_EQUAL_P (Source_file);
+IMPLEMENT_TYPE_P (Source_file, "ly:source-file?");
SCM
Source_file::mark_smob (SCM smob)
Spanner *me = unsmob_spanner (smob);
/*
- can't use get_system() ? --hwn.
+ can't use get_system () ? --hwn.
*/
Spacing_options options;
options.init_from_grob (me);
Spacing_spanner::fills_measure (Grob *me, Item *left, Item *col)
{
System *sys = get_root_system (me);
- Item *next = sys->column (col->get_column()->get_rank () + 1);
+ Item *next = sys->column (col->get_column ()->get_rank () + 1);
if (!next)
return false;
"for left, and @code{1} for right.")
{
LY_ASSERT_TYPE (unsmob_spanner, slur, 1);
- LY_ASSERT_TYPE(is_direction, dir,2);
+ LY_ASSERT_TYPE (is_direction, dir,2);
return unsmob_spanner (slur)->get_bound (to_dir (dir))->self_scm ();
}
return dynamic_cast<Spanner *> (unsmob_grob (s));
}
-MAKE_SCHEME_CALLBACK(Spanner, bounds_width, 1);
+MAKE_SCHEME_CALLBACK (Spanner, bounds_width, 1);
SCM
Spanner::bounds_width (SCM grob)
{
return z[X_AXIS] * get_line_thickness (me) + z[Y_AXIS] * staff_space (me);
}
-MAKE_SCHEME_CALLBACK(Staff_symbol,height,1);
+MAKE_SCHEME_CALLBACK (Staff_symbol, height,1);
SCM
Staff_symbol::height (SCM smob)
{
if (!stem)
{
programming_error ("no stem for stem-tremolo");
- return Stencil();
+ return Stencil ();
}
Direction stemdir = get_grob_direction (stem);
if (!is_normal_stem (me))
return ly_interval2scm (iv);
+
+ /* if we are part of a cross-staff beam, return empty */
+ if (get_beam (me) && Beam::is_cross_staff (get_beam (me)))
+ return ly_interval2scm (iv);
Real ss = Staff_symbol_referencer::staff_space (me);
Real len = scm_to_double (calc_length (smob)) * ss / 2;
return (scm_is_number (s)) ? scm_to_int (s) : 2;
}
-MAKE_SCHEME_CALLBACK(Stem, calc_positioning_done, 1);
+MAKE_SCHEME_CALLBACK (Stem, calc_positioning_done, 1);
SCM
Stem::calc_positioning_done (SCM smob)
{
return SCM_BOOL_T;
}
-MAKE_SCHEME_CALLBACK(Stem, calc_direction, 1);
+MAKE_SCHEME_CALLBACK (Stem, calc_direction, 1);
SCM
Stem::calc_direction (SCM smob)
{
return scm_from_int (dir);
}
-MAKE_SCHEME_CALLBACK(Stem, calc_default_direction, 1);
+MAKE_SCHEME_CALLBACK (Stem, calc_default_direction, 1);
SCM
Stem::calc_default_direction (SCM smob)
{
}
/*
- Can't get_stencil(), since that would cache stencils too early.
+ Can't get_stencil (), since that would cache stencils too early.
This causes problems with beams.
*/
Stencil *stencil = unsmob_stencil (print (smob));
- Interval iv = stencil ? stencil->extent (Y_AXIS) : Interval();
+ Interval iv = stencil ? stencil->extent (Y_AXIS) : Interval ();
if (beam)
{
if (dir == CENTER)
return si;
}
-MAKE_SCHEME_CALLBACK(Stem, calc_stem_info, 1);
+MAKE_SCHEME_CALLBACK (Stem, calc_stem_info, 1);
SCM
Stem::calc_stem_info (SCM smob)
{
return le;
}
+bool
+Stem::is_cross_staff (Grob *stem)
+{
+ Grob *beam = unsmob_grob (stem->get_object ("beam"));
+ return beam && Beam::is_cross_staff (beam);
+}
+
+MAKE_SCHEME_CALLBACK (Stem, cross_staff, 1)
+SCM
+Stem::cross_staff (SCM smob)
+{
+ return scm_from_bool (is_cross_staff (unsmob_grob (smob)));
+}
+
/* FIXME: Too many properties */
ADD_INTERFACE (Stem,
"The stem represent the graphical stem. "
{
Stencil *s = unsmob_stencil (stil);
LY_ASSERT_SMOB (Stencil, stil, 1);
- LY_ASSERT_TYPE(scm_is_number,amount, 2);
- LY_ASSERT_TYPE(is_axis,axis, 3);
+ LY_ASSERT_TYPE (scm_is_number, amount, 2);
+ LY_ASSERT_TYPE (is_axis, axis, 3);
Real real_amount = scm_to_double (amount);
{
Stencil *s = unsmob_stencil (stil);
LY_ASSERT_SMOB (Stencil, stil, 1);
- LY_ASSERT_TYPE(is_number_pair, offset, 2);
+ LY_ASSERT_TYPE (is_number_pair, offset, 2);
Offset o = ly_scm2offset (offset);
SCM new_s = s->smobbed_copy ();
{
Stencil *s = unsmob_stencil (stil);
LY_ASSERT_SMOB (Stencil, stil, 1);
- LY_ASSERT_TYPE(is_axis, axis, 2);
+ LY_ASSERT_TYPE (is_axis, axis, 2);
return ly_interval2scm (s->extent (Axis (scm_to_int (axis))));
}
first, SCM_ARG1, __FUNCTION__, "Stencil, #f or ()");
SCM_ASSERT_TYPE (s2 || second == SCM_BOOL_F || second == SCM_EOL,
second, SCM_ARG4, __FUNCTION__, "Stencil, #f or ()");
- LY_ASSERT_TYPE(is_axis, axis, 2);
- LY_ASSERT_TYPE(is_direction, direction, 3);
+ LY_ASSERT_TYPE (is_axis, axis, 2);
+ LY_ASSERT_TYPE (is_direction, direction, 3);
Real p = 0.0;
if (padding != SCM_UNDEFINED)
{
- LY_ASSERT_TYPE(scm_is_number, padding, 5);
+ LY_ASSERT_TYPE (scm_is_number, padding, 5);
p = scm_to_double (padding);
}
Real m = 0.0;
if (minimum != SCM_UNDEFINED)
{
- LY_ASSERT_TYPE(scm_is_number, minimum, 6);
+ LY_ASSERT_TYPE (scm_is_number, minimum, 6);
m = scm_to_double (minimum);
}
Interval x;
if (xext != SCM_UNDEFINED)
{
- LY_ASSERT_TYPE(is_number_pair, xext, 2);
+ LY_ASSERT_TYPE (is_number_pair, xext, 2);
x = ly_scm2interval (xext);
}
Interval y;
if (yext != SCM_UNDEFINED)
{
- LY_ASSERT_TYPE(is_number_pair,yext, 3);
+ LY_ASSERT_TYPE (is_number_pair, yext, 3);
y = ly_scm2interval (yext);
}
"Other values are interpolated (so 0 means the center).")
{
LY_ASSERT_SMOB (Stencil, stil, 1);
- LY_ASSERT_TYPE(is_axis,axis, 2);
- LY_ASSERT_TYPE(scm_is_number, dir, 3);
+ LY_ASSERT_TYPE (is_axis, axis, 2);
+ LY_ASSERT_TYPE (scm_is_number, dir, 3);
Stencil target = *unsmob_stencil (stil);
"may be negative. The thickness is given by @var{t}.")
{
LY_ASSERT_TYPE (is_axis, a, 1);
- LY_ASSERT_TYPE(is_number_pair,iv, 2);
- LY_ASSERT_TYPE(scm_is_number, t,3);
- LY_ASSERT_TYPE(scm_is_number, p,4);
+ LY_ASSERT_TYPE (is_number_pair, iv, 2);
+ LY_ASSERT_TYPE (scm_is_number, t,3);
+ LY_ASSERT_TYPE (scm_is_number, p,4);
return Lookup::bracket ((Axis)scm_to_int (a), ly_scm2interval (iv),
scm_to_double (t),
{
Stencil *s = unsmob_stencil (stil);
LY_ASSERT_SMOB (Stencil, stil, 1);
- LY_ASSERT_TYPE(scm_is_number,angle, 2);
- LY_ASSERT_TYPE(scm_is_number, x,3);
- LY_ASSERT_TYPE(scm_is_number, y, 4);
+ LY_ASSERT_TYPE (scm_is_number, angle, 2);
+ LY_ASSERT_TYPE (scm_is_number, x,3);
+ LY_ASSERT_TYPE (scm_is_number, y, 4);
Real a = scm_to_double (angle);
Real x_off = scm_to_double (x);
Real y_off = scm_to_double (y);
"@var{yext} and roundness @var{blot}.")
{
LY_ASSERT_TYPE (is_number_pair, xext, 1);
- LY_ASSERT_TYPE(is_number_pair, yext, 2);
- LY_ASSERT_TYPE(scm_is_number, blot, 3);
+ LY_ASSERT_TYPE (is_number_pair, yext, 2);
+ LY_ASSERT_TYPE (scm_is_number, blot, 3);
return Lookup::round_filled_box (Box (ly_scm2interval (xext), ly_scm2interval (yext)),
scm_to_double (blot)).smobbed_copy ();
LY_ASSERT_TYPE (ly_is_symbol, cl, 1);
/* should be scm_list_p, but scm_list_p is expensive. */
- LY_ASSERT_TYPE(scm_is_pair, proplist, 2);
+ LY_ASSERT_TYPE (scm_is_pair, proplist, 2);
if (proplist == SCM_UNDEFINED)
proplist = SCM_EOL;
--- /dev/null
+/*
+ system-scheme.cc -- implement scheme bindings to System
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2007 Joe Neeman <joeneeman@gmail.com>
+*/
+
+#include "align-interface.hh"
+#include "pointer-group-interface.hh"
+#include "system.hh"
+
+
+LY_DEFINE (ly_system_print, "ly:system-print",
+ 1, 0, 0, (SCM system),
+ "Draw the system and return the prob containing its "
+ "stencil.")
+{
+ Grob *me = unsmob_grob (system);
+ System *me_system = dynamic_cast<System*> (me);
+ SCM_ASSERT_TYPE (me, system, SCM_ARG1, __FUNCTION__, "grob");
+
+ return me_system->get_paper_system ();
+}
+
+LY_DEFINE (ly_system_stretch, "ly:system-stretch",
+ 2, 0, 0, (SCM system, SCM amount_scm),
+ "Stretch the system vertically by the given amount. "
+ "This must be called before the system is drawn (for example "
+ "with ly:system-print).")
+{
+ Grob *me = unsmob_grob (system);
+ Real amount = robust_scm2double (amount_scm, 0.0);
+
+ extract_grob_set (me, "elements", elts);
+ for (vsize i = 0; i < elts.size (); i++)
+ if (Align_interface::has_interface (elts[i]))
+ {
+ Align_interface::stretch (elts[i], amount, Y_AXIS);
+ break;
+ }
+ return SCM_UNDEFINED;
+}
struct Bracket_nesting_node
{
public:
- virtual ~Bracket_nesting_node(){}
+ virtual ~Bracket_nesting_node (){}
virtual bool add_staff (Grob *) { return false; }
virtual void add_support (Grob *) { }
virtual void set_bound (Direction, Grob *){}
void
System_start_delimiter_engraver::acknowledge_staff_symbol (Grob_info inf)
{
- Grob *staff = inf.grob();
+ Grob *staff = inf.grob ();
bool succ = nesting_->add_staff (staff);
if (!succ)
while (hi - lo > 1);
Stencil stil (fm->find_by_name ("brace" + to_string (lo)));
- stil.translate_axis (-b[X_AXIS].length()/2, X_AXIS);
+ stil.translate_axis (-b[X_AXIS].length ()/2, X_AXIS);
stil.translate_axis (-0.2, X_AXIS);
{
public:
static Stencil get_stencil (Grob *);
- DECLARE_GROB_INTERFACE();
+ DECLARE_GROB_INTERFACE ();
DECLARE_SCHEME_CALLBACK (print, (SCM));
};
p->align_to (Y_AXIS, robust_scm2double (align_y, 0.0));
return *p;
}
- return Stencil();
+ return Stencil ();
}
grobs[i]->fixup_refpoint ();
}
-SCM
-System::get_paper_systems ()
+void
+System::do_break_substitution_and_fixup_refpoints ()
{
for (vsize i = 0; i < all_elements_->size (); i++)
{
if (be_verbose_global)
message (_f ("Element count %d.", count + element_count ()));
+}
+
+SCM
+System::get_broken_system_grobs ()
+{
+ SCM ret = SCM_EOL;
+ for (vsize i = 0; i < broken_intos_.size (); i++)
+ ret = scm_cons (broken_intos_[i]->self_scm (), ret);
+ return scm_reverse (ret);
+}
+SCM
+System::get_paper_systems ()
+{
SCM lines = scm_c_make_vector (broken_intos_.size (), SCM_EOL);
for (vsize i = 0; i < broken_intos_.size (); i++)
{
System *system = dynamic_cast<System *> (broken_intos_[i]);
- system->post_processing ();
- system->build_skylines ();
- if (i > 0)
- {
- System *prev = dynamic_cast<System*> (broken_intos_[i-1]);
- Real r = prev->skylines_[DOWN].distance (system->skylines_[UP]);
- system->set_property ("skyline-distance", scm_from_double (r));
- }
scm_vector_set_x (lines, scm_from_int (i),
system->get_paper_system ());
SCM exprs = SCM_EOL;
SCM *tail = &exprs;
+ post_processing ();
+ build_skylines ();
+
vector<Layer_entry> entries;
for (vsize j = 0; j < all_elements_->size (); j++)
{
Grob *g = entries[j].grob_;
Stencil st = g->get_print_stencil ();
- if (st.expr() == SCM_EOL)
+ if (st.expr () == SCM_EOL)
continue;
Offset o;
/* information that the page breaker might need */
Grob *right_bound = this->get_bound (RIGHT);
- pl->set_property ("skyline-distance", get_property ("skyline-distance"));
+ pl->set_property ("skylines", skylines_.smobbed_copy ());
pl->set_property ("page-break-permission", right_bound->get_property ("page-break-permission"));
pl->set_property ("page-turn-permission", right_bound->get_property ("page-turn-permission"));
pl->set_property ("page-break-penalty", right_bound->get_property ("page-break-penalty"));
pl->set_property ("page-turn-penalty", right_bound->get_property ("page-turn-penalty"));
- if (!scm_is_pair (pl->get_property ("refpoint-Y-extent")))
- {
- Interval staff_refpoints;
- staff_refpoints.set_empty ();
- extract_grob_set (this, "spaceable-staves", staves);
- for (vsize i = 0; i < staves.size (); i++)
- {
- Grob *g = staves[i];
- staff_refpoints.add_point (g->relative_coordinate (this, Y_AXIS));
- }
- pl->set_property ("refpoint-Y-extent", ly_interval2scm (staff_refpoints));
- }
+ Interval staff_refpoints;
+ extract_grob_set (this, "spaceable-staves", staves);
+ for (vsize i = 0; i < staves.size (); i++)
+ staff_refpoints.add_point (staves[i]->relative_coordinate (this, Y_AXIS));
+ pl->set_property ("staff-refpoint-extent", ly_interval2scm (staff_refpoints));
pl->set_property ("system-grob", this->self_scm ());
return pl->unprotect ();
DECLARE_ACKNOWLEDGER (note_head);
};
-Tab_harmonic_engraver::Tab_harmonic_engraver()
+Tab_harmonic_engraver::Tab_harmonic_engraver ()
{
}
public:
TRANSLATOR_DECLARATIONS (Tab_staff_symbol_engraver);
protected:
- DECLARE_ACKNOWLEDGER(staff_symbol);
+ DECLARE_ACKNOWLEDGER (staff_symbol);
};
void
void process_acknowledged ();
DECLARE_TRANSLATOR_LISTENER (text_script);
- DECLARE_ACKNOWLEDGER (stem_tremolo);
- DECLARE_ACKNOWLEDGER (stem);
- DECLARE_ACKNOWLEDGER (rhythmic_head);
};
IMPLEMENT_TRANSLATOR_LISTENER (Text_engraver, text_script);
evs_.push_back (ev);
}
-void
-Text_engraver::acknowledge_rhythmic_head (Grob_info inf)
-{
- for (vsize i = 0; i < texts_.size (); i++)
- {
- Grob *t = texts_[i];
- Side_position_interface::add_support (t, inf.grob ());
-
- /*
- ugh.
- */
- if (Side_position_interface::get_axis (t) == X_AXIS
- && !t->get_parent (Y_AXIS))
- t->set_parent (inf.grob (), Y_AXIS);
- else if (Side_position_interface::get_axis (t) == Y_AXIS
- && !t->get_parent (X_AXIS))
- t->set_parent (inf.grob (), X_AXIS);
- }
-}
-
-void
-Text_engraver::acknowledge_stem (Grob_info inf)
-{
- for (vsize i = 0; i < texts_.size (); i++)
- Side_position_interface::add_support (texts_[i], inf.grob ());
-}
-
-void
-Text_engraver::acknowledge_stem_tremolo (Grob_info info)
-{
- for (vsize i = 0; i < texts_.size (); i++)
- Side_position_interface::add_support (texts_[i], info.grob ());
-}
-
void
Text_engraver::process_acknowledged ()
{
{
}
-ADD_ACKNOWLEDGER (Text_engraver, stem);
-ADD_ACKNOWLEDGER (Text_engraver, stem_tremolo);
-ADD_ACKNOWLEDGER (Text_engraver, rhythmic_head);
ADD_TRANSLATOR (Text_engraver,
/* doc */ "Create text-scripts",
/* create */ "TextScript",
SCM markup)
{
LY_ASSERT_SMOB (Output_def, layout_smob, 1);
- LY_ASSERT_TYPE (scm_is_string, props, 3);
+ LY_ASSERT_TYPE (scm_is_string, markup, 3);
string str = ly_scm2string (markup);
Output_def *layout = unsmob_output_def (layout_smob);
TRANSLATOR_DECLARATIONS (Text_spanner_engraver);
protected:
virtual void finalize ();
- DECLARE_ACKNOWLEDGER (note_column);
DECLARE_TRANSLATOR_LISTENER (text_span);
void stop_translation_timestep ();
void process_music ();
}
}
-void
-Text_spanner_engraver::acknowledge_note_column (Grob_info info)
-{
- Spanner *spans[2] ={span_, finished_};
- for (int i = 0; i < 2; i++)
- {
- if (spans[i])
- {
- Side_position_interface::add_support (spans[i], info.grob ());
- add_bound_item (spans[i], info.grob ());
- }
- }
-}
-
void
Text_spanner_engraver::typeset_all ()
{
}
}
-ADD_ACKNOWLEDGER (Text_spanner_engraver, note_column);
-
ADD_TRANSLATOR (Text_spanner_engraver,
/* doc */
"Create text spanner from an event.",
return SCM_UNSPECIFIED;
}
-MAKE_SCHEME_CALLBACK(Tie_column, calc_positioning_done, 1)
+MAKE_SCHEME_CALLBACK (Tie_column, calc_positioning_done, 1)
SCM
Tie_column::calc_positioning_done (SCM smob)
{
Ties_configuration base = problem.generate_optimal_configuration ();
- for (vsize i = 0; i < base.size(); i++)
+ for (vsize i = 0; i < base.size (); i++)
{
SCM cp = Tie::get_control_points (ties[i], problem.common_x_refpoint (),
base[i],
Bezier
Tie_configuration::get_untransformed_bezier (Tie_details const &details) const
{
- Real l = attachment_x_.length();
+ Real l = attachment_x_.length ();
if (isinf (l) || isnan (l))
{
programming_error ("Inf or NaN encountered");
Real
Tie_configuration::height (Tie_details const &details) const
{
- Real l = attachment_x_.length();
+ Real l = attachment_x_.length ();
return slur_shape (l,
details.height_limit_,
details.ratio_).curve_point (0.5)[Y_AXIS];
}
-Ties_configuration::Ties_configuration()
+Ties_configuration::Ties_configuration ()
{
score_ = 0.0;
scored_ = false;
Ties_configuration::complete_score_card () const
{
string s;
- for (vsize i = 0; i < size(); i++)
+ for (vsize i = 0; i < size (); i++)
{
s += complete_tie_card (i);
}
SCM details = me->get_property ("details");
- height_limit_ = get_real_detail("height-limit", 0.75);
- ratio_ = get_real_detail("ratio", .333);
+ height_limit_ = get_real_detail ("height-limit", 0.75);
+ ratio_ = get_real_detail ("ratio", .333);
between_length_limit_ = get_real_detail ("between-length-limit", 1.0);
- wrong_direction_offset_penalty_ = get_real_detail("wrong-direction-offset-penalty", 10);
+ wrong_direction_offset_penalty_ = get_real_detail ("wrong-direction-offset-penalty", 10);
- min_length_ = get_real_detail("min-length", 1.0);
- min_length_penalty_factor_ = get_real_detail("min-length-penalty-factor", 1.0);
+ min_length_ = get_real_detail ("min-length", 1.0);
+ min_length_penalty_factor_ = get_real_detail ("min-length-penalty-factor", 1.0);
// in half-space
center_staff_line_clearance_ = get_real_detail ("center-staff-line-clearance", 0.4);
tip_staff_line_clearance_ = get_real_detail ("tip-staff-line-clearance", 0.4);
- staff_line_collision_penalty_ = get_real_detail("staff-line-collision-penalty", 5);
+ staff_line_collision_penalty_ = get_real_detail ("staff-line-collision-penalty", 5);
dot_collision_clearance_ = get_real_detail ( "dot-collision-clearance", 0.25);
dot_collision_penalty_ = get_real_detail ( "dot-collision-penalty", 0.25);
x_gap_ = get_real_detail ("note-head-gap", 0.2);
if (!wait && new_heads_to_tie.size ())
heads_to_tie_.clear ();
- // hmmm, how to do with copy() ?
+ // hmmm, how to do with copy () ?
for (vsize i = 0; i < new_heads_to_tie.size (); i++)
heads_to_tie_.push_back (new_heads_to_tie[i]);
return attachments;
}
-Tie_formatting_problem::Tie_formatting_problem()
+Tie_formatting_problem::Tie_formatting_problem ()
{
x_refpoint_ = 0;
}
x.add_point (stem->relative_coordinate (x_refpoint_, X_AXIS));
x.widen (staff_space / 20); // ugh.
Interval y;
- y.add_point (Stem::stem_end_position (stem) * staff_space * .5);
+ Real stem_end_position =
+ Stem::is_cross_staff (stem)
+ ? get_grob_direction (stem) * infinity_f
+ : Stem::stem_end_position (stem) * staff_space * .5;
+
+ y.add_point (stem_end_position);
Direction stemdir = get_grob_direction (stem);
y.add_point (Stem::head_positions (stem)[-stemdir]
*/
boxes.push_back (Box (x, y));
- stem_extents_[key].unite (Box (x,y));
+ stem_extents_[key].unite (Box (x, y));
if (dir == LEFT)
{
Box flag_box = Stem::get_translated_flag (stem).extent_box ();
- flag_box.translate( Offset (x[RIGHT], X_AXIS));
+ flag_box.translate ( Offset (x[RIGHT], X_AXIS));
boxes.push_back (flag_box);
}
}
}
extract_grob_set (stem, "note-heads", heads);
- for (vsize i = 0; i < heads.size(); i ++)
+ for (vsize i = 0; i < heads.size (); i ++)
{
- if (find (bounds.begin(), bounds.end (), dynamic_cast<Item*> (heads[i])) == bounds.end ())
+ if (find (bounds.begin (), bounds.end (), dynamic_cast<Item*> (heads[i])) == bounds.end ())
{
/*
other untied notes in the same chord.
{
Interval x;
Interval y;
- if (head_boxes.size())
+ if (head_boxes.size ())
{
Box b = boundary (head_boxes, updowndir, 0);
x = b[X_AXIS];
while (flip (&d) != LEFT);
if (ties_conf
- && ties_conf->size() == 1)
+ && ties_conf->size () == 1)
{
Direction d = LEFT;
Drul_array<Grob*> stems (0, 0);
);
vars.push_back (var);
}
- if (i == ties.size() && !specifications_[i].has_manual_position_
+ if (i == ties.size () && !specifications_[i].has_manual_position_
&& ties[i].dir_ == UP)
{
Tie_configuration_variation var;
if (to_boolean (x_refpoint_->layout ()
->lookup_variable (ly_symbol2scm ("debug-tie-scoring"))))
{
- for (vsize i = 0; i < base.size(); i++)
+ for (vsize i = 0; i < base.size (); i++)
{
string card = base.complete_tie_card (i);
specifications_[i].tie_grob_->set_property ("quant-score",
heads_to_tie_ = now_heads_;
}
- for (vsize i = now_tied_heads_.size(); i--;)
+ for (vsize i = now_tied_heads_.size (); i--;)
heads_to_tie_.push_back (now_tied_heads_[i]);
event_ = 0;
}
-MAKE_SCHEME_CALLBACK(Tie, calc_direction, 1);
+MAKE_SCHEME_CALLBACK (Tie, calc_direction, 1);
SCM
Tie::calc_direction (SCM smob)
{
}
-MAKE_SCHEME_CALLBACK(Tie, calc_control_points, 1);
+MAKE_SCHEME_CALLBACK (Tie, calc_control_points, 1);
SCM
Tie::calc_control_points (SCM smob)
{
public:
DECLARE_SCHEME_CALLBACK (constructor, ());
/* construction */
- DECLARE_CLASSNAME(Time_scaled_music_iterator);
+ DECLARE_CLASSNAME (Time_scaled_music_iterator);
Time_scaled_music_iterator ();
protected:
virtual void process (Moment m);
m.main_part_ == next_split_mom_)
{
descend_to_bottom_context ();
- if (tuplet_handler_.get_outlet())
+ if (tuplet_handler_.get_outlet ())
create_event (STOP)->send_to_context (tuplet_handler_.get_outlet ());
if (m.main_part_ < music_get_length ().main_part_)
tuplet_handler_.set_context (0);
}
}
- Music_wrapper_iterator::process(m);
+ Music_wrapper_iterator::process (m);
if (child_iter_ && child_iter_->ok ())
descend_to_child (child_iter_->get_outlet ());
interface_name += "-interface";
/*
- this is only called during program init, so safe to use scm_gc_protect_object()
+ this is only called during program init, so safe to use scm_gc_protect_object ()
*/
inf.symbol_ = scm_gc_protect_object (ly_symbol2scm (interface_name.c_str ()));
ack_array->push_back (inf);
assert (0 == ev_class.find (prefix));
/* "listen_foo_bar" -> "foo-bar" */
- ev_class.erase (0, strlen(prefix));
+ ev_class.erase (0, strlen (prefix));
replace_all (ev_class, '_', '-');
new_ev->origin ()->warning (_f ("Two simultaneous %s events, junking this one", ev_class.c_str ()));
TRANSLATOR_DECLARATIONS (Trill_spanner_engraver);
protected:
virtual void finalize ();
- DECLARE_ACKNOWLEDGER (note_column);
DECLARE_TRANSLATOR_LISTENER (trill_span);
void stop_translation_timestep ();
void process_music ();
}
}
-void
-Trill_spanner_engraver::acknowledge_note_column (Grob_info info)
-{
- Spanner *spans[2] ={span_, finished_};
- for (int i = 0; i < 2; i++)
- {
- if (spans[i])
- {
- Side_position_interface::add_support (spans[i], info.grob ());
- add_bound_item (spans[i], info.grob ());
- }
- }
-}
-
void
Trill_spanner_engraver::typeset_all ()
{
}
}
-ADD_ACKNOWLEDGER (Trill_spanner_engraver, note_column);
ADD_TRANSLATOR (Trill_spanner_engraver,
/* doc */ "Create trill spanner from an event.",
/* create */
FT_UInt gindex;
FT_CharMap current_cmap = face->charmap;
- FT_Select_Charmap(face, FT_ENCODING_UNICODE);
+ FT_Select_Charmap (face, FT_ENCODING_UNICODE);
int j = 0;
for (charcode = FT_Get_First_Char (face, &gindex); gindex != 0;
GLYPH_NAME_LEN);
if (error)
{
- programming_error ("FT_Get_Glyph_Name(): error.");
+ programming_error ("FT_Get_Glyph_Name (): error.");
glyph_name[0] = 0;
}
}
Note_column::get_stem (cols.back ()));
if (dynamic_cast<Item*> (stems[RIGHT])->get_column ()
- != me->get_bound (RIGHT)->get_column())
+ != me->get_bound (RIGHT)->get_column ())
return 0;
Drul_array<Grob*> beams;
}
-MAKE_SCHEME_CALLBACK(Tuplet_bracket,calc_connect_to_neighbors,1);
+MAKE_SCHEME_CALLBACK (Tuplet_bracket, calc_connect_to_neighbors,1);
SCM
Tuplet_bracket::calc_connect_to_neighbors (SCM smob)
{
return commonx;
}
-MAKE_SCHEME_CALLBACK(Tuplet_bracket,calc_control_points,1)
+MAKE_SCHEME_CALLBACK (Tuplet_bracket, calc_control_points,1)
SCM
Tuplet_bracket::calc_control_points (SCM smob)
{
/*
This may happen if the end of a tuplet is part of a quoted voice.
*/
- Moment now = now_mom();
+ Moment now = now_mom ();
for (vsize i = tuplets_.size (); i --; )
{
if (tuplets_[i].stop_moment_ == now)
struct Tuplet_number
{
- DECLARE_SCHEME_CALLBACK(print, (SCM));
- DECLARE_GROB_INTERFACE();
+ DECLARE_SCHEME_CALLBACK (print, (SCM));
+ DECLARE_GROB_INTERFACE ();
};
-MAKE_SCHEME_CALLBACK(Tuplet_number, print, 1);
+MAKE_SCHEME_CALLBACK (Tuplet_number, print, 1);
SCM
Tuplet_number::print (SCM smob)
{
DECLARE_ACKNOWLEDGER (grob);
};
-Tweak_engraver::Tweak_engraver()
+Tweak_engraver::Tweak_engraver ()
{
}
void
Vaticana_ligature_engraver::check_for_ambiguous_dot_pitch (Grob_info primitive)
{
- // TODO: Fix performance, which is currently O(n^2) (since this
- // method is called O(n) times and takes O(n) steps in the for
- // loop), but could be O(n) (by replacing the for loop by e.g. a
- // bitmask based O(1) test); where n=<number of primitives in the
+ // TODO: Fix performance, which is currently O (n^2) (since this
+ // method is called O (n) times and takes O (n) steps in the for
+ // loop), but could be O (n) (by replacing the for loop by e.g. a
+ // bitmask based O (1) test); where n=<number of primitives in the
// ligature> (which is typically small (n<10), though).
Stream_event *new_cause = primitive.event_cause ();
int new_pitch = unsmob_pitch (new_cause->get_property ("pitch"))->steps ();
add_bound_item (dynamic_cast<Spanner *> (me), b);
}
-void
-Volta_bracket_interface::add_column (Grob *me, Grob *c)
-{
- Side_position_interface::add_support (me, c);
-}
-
ADD_INTERFACE (Volta_bracket_interface,
"Volta bracket with number",
DECLARE_END_ACKNOWLEDGER (staff_symbol);
DECLARE_ACKNOWLEDGER (staff_symbol);
- DECLARE_ACKNOWLEDGER (note_column);
DECLARE_ACKNOWLEDGER (bar_line);
virtual void finalize ();
}
}
-void
-Volta_engraver::acknowledge_note_column (Grob_info i)
-{
- if (volta_span_)
- Volta_bracket_interface::add_column (volta_span_, i.grob ());
-}
-
void
Volta_engraver::acknowledge_bar_line (Grob_info i)
{
*/
ADD_ACKNOWLEDGER (Volta_engraver, staff_symbol);
ADD_END_ACKNOWLEDGER (Volta_engraver, staff_symbol);
-ADD_ACKNOWLEDGER (Volta_engraver, note_column);
ADD_ACKNOWLEDGER (Volta_engraver, bar_line);
ADD_TRANSLATOR (Volta_engraver,
/* doc */ "Make volta brackets.",
\consists "Figured_bass_position_engraver"
\consists "Script_row_engraver"
- \override VerticalAxisGroup #'minimum-Y-extent = #'(-3.5 . 3.5)
localKeySignature = #'()
createSpacing = ##t
ignoreFiguredBassRest = ##t
\description
"Just like @code{GrandStaff} but with a forced distance between
the staves, so cross staff beaming and slurring can be used."
-
- \override VerticalAlignment #'forced-distance = #12
- \override VerticalAlignment #'self-alignment-Y = #0
- \consists "Vertical_align_engraver"
+ \override VerticalAxisGroup #'minimum-Y-extent = #'(-4 . 4)
\consists "Instrument_name_engraver"
instrumentName = #'()
\override VerticalAxisGroup #'remove-first = ##t
\override VerticalAxisGroup #'remove-empty = ##t
+ \override VerticalAxisGroup #'keep-fixed-while-stretching = ##t
\override SeparationItem #'padding = #0.2
\override InstrumentName #'self-alignment-Y = ##f
draw_shifted_too;
fet_beginchar ("Flat (slashed)", "flat.slash");
- set_char_box (1.2 stafflinethickness#, .8 staff_space#,
+ set_char_box (.4 staff_space#, .8 staff_space#,
0.6 staff_space#, 1.9 staff_space#);
draw_meta_flat (0, w, 0.31 staff_space);
fet_endchar;
fet_beginchar ("Flat (slashed twice)", "flat.slashslash");
- set_char_box (1.2 stafflinethickness#, .8 staff_space#,
+ set_char_box (.4 staff_space#, .8 staff_space#,
0.6 staff_space#, 1.9 staff_space#);
draw_meta_flat (0, w, 0.31 staff_space);
+
+
fet_beginchar ("Semi flat", "mirroredflat");
set_char_box (1.2 stafflinethickness#, .8 staff_space#,
0.6 staff_space#, 1.9 staff_space#);
currentpicture := currentpicture xscaled -1 shifted (w - b, 0);
fet_endchar;
+fet_beginchar ("Semi flat", "mirroredflat.backslash");
+ set_char_box (.4 staff_space#, .8 staff_space#,
+ 0.6 staff_space#, 1.9 staff_space#);
+
+ draw_meta_flat (0, w, 0.31 staff_space);
+ clearxy;
+
+ save slope, slash_width;
+ slope = 0.5;
+ slash_width = w;
+ z1 = (0, h / 2);
+ z2 = z1 - (slash_width, slash_width * slope)/2;
+ z3 = z1 + (slash_width, slash_width * slope)/2;
+ pickup pencircle scaled 1.5 stafflinethickness;
+ draw z2 .. z3;
+
+ currentpicture := currentpicture xscaled -1 shifted (w - b, 0);
+
+ labels (1, 2, 3);
+
+fet_endchar;
+
fet_beginchar ("Double Flat", "flatflat");
save left_wid, overlap, right_wid;
INSTALLATION_OUT_FILES1=$(OUT_PY_MODULES) $(OUT_PYC_MODULES)
$(outdir)/midi.lo: $(outdir)/config.hh
+
+default: $(outdir)/relocate-preamble.py
return str
conversions.append (((2, 11, 13), conv, """#'arrow = ##t -> #'bound-details #'right #'arrow = ##t"""))
+
+def conv (str):
+ def sub_edge_height (m):
+ s = ''
+ for (var, h) in [('left', m.group (3)),
+ ('right', m.group (4))]:
+
+ if h and float (h):
+ s += (r"%s \override %s #'bound-details #'%s #'text = \markup { \draw-line #'(0 . %s) }"
+ % (m.group(1), m.group (2), var, h))
+
+ s += '\n'
+
+ return s
+
+
+ str = re.sub (r"(\\once)?\s*\\override\s*([a-zA-Z.]+)\s*#'edge-height\s*=\s*#'\(([0-9.-]+)\s+[.]\s+([0-9.-]+)\)",
+ sub_edge_height, str)
+ return str
+
+conversions.append (((2, 11, 15), conv, """#'edge-height -> #'bound-details #'right/left #'text = ..."""))
changes. @samp{\\override} of the @code{break-visibility} property will set the
visibility for normal (i.e. at the start of the line) key signatures.")
+ (extendersOverRests ,boolean? "Whether to continue extenders as
+they cross a rest.")
(extraNatural ,boolean? "Whether to typeset an
extra natural sign before accidentals changing from a non-natural to
another non-natural.")
(font-shape ,symbol? "Select the shape of a font. Choices include @code{upright},
@code{italic}, @code{caps}.")
(forced ,boolean? "manually forced accidental")
- (forced-distance ,ly:dimension? "A fixed distance between object
-reference points in an alignment.")
(force-hshift ,number? "This specifies a manual shift for notes
in collisions. The unit is the note head width of the first voice
note. This is used by @internalsref{note-collision-interface}.")
(inspect-index ,integer? "If debugging is set,
set beam/slur configuration to this index, and print the respective scores.")
(implicit ,boolean? "Is this an implicit bass figure?")
+ (keep-fixed-while-stretching ,boolean? "A grob with this property set to true will be fixed relative to the staff above it when systems are stretched.")
(keep-inside-line ,boolean? "If set, this column cannot have
things sticking into the margin.")
(kern ,ly:dimension? "Amount of extra white space to add. For
(long-text ,markup? "Text markup. See @usermanref{Text markup}.")
(max-beam-connect ,integer? "Maximum number of beams to connect
to beams from this stem. Further beams are typeset as beamlets.")
+ (max-stretch ,number? "The maximum amount that this vertical-axis-group
+can be vertically stretched (for example, in order to better fill a page).")
(measure-length ,ly:moment? "Length of a
measure. Used in some spacing situations.")
(measure-count ,integer? "The number of measures for a
(arpeggio ,ly:grob? "pointer to arpeggio object.")
(beam ,ly:grob? "pointer to the beam, if applicable.")
(bracket ,ly:grob? "the bracket for a number.")
+ (cross-staff ,boolean? "for a beam or a stem, true if we depend on inter-staff spacing")
(direction-source ,ly:grob? "in case side-relative-direction is
set, which grob to get the direction from .")
(dot ,ly:grob? "reference to Dots object.")
(beaming . ,ly:beam::calc-beaming)
(stencil . ,ly:beam::print)
(clip-edges . #t)
+ (cross-staff . ,ly:beam::cross-staff)
(details . ((hint-direction-penalty . 20)))
;; TODO: should be in SLT.
(Y-offset . ,ly:side-position-interface::y-aligned-side)
(staff-padding . 0.1)
(padding . 0.6)
- (avoid-slur . outside)
(slur-padding . 0.3)
(minimum-space . 1.2)
(direction . ,DOWN)
(font-series . bold)
(font-encoding . fetaDynamic)
(font-shape . italic)
- (avoid-slur . around)
(extra-spacing-width . (+inf.0 . -inf.0))
(outside-staff-priority . 250)
(meta . ((class . Item)
(minimum-length . 1.5)
(height-limit . 2.0)
(ratio . 0.333)
+ (cross-staff . ,ly:slur::cross-staff)
(meta . ((class . Spanner)
(interfaces . (slur-interface))))))
(height-limit . 2.0)
(ratio . 0.25)
(avoid-slur . inside)
+ (cross-staff . ,ly:slur::cross-staff)
(meta . ((class . Spanner)
(interfaces . (slur-interface))))))
(Y-extent . ,ly:stem::height)
(length . ,ly:stem::calc-length)
(thickness . 1.3)
+ (cross-staff . ,ly:stem::cross-staff)
(details
. (
;; 3.5 (or 3 measured from note head) is standard length
(X-extent . ,ly:axis-group-interface::width)
(Y-extent . ,ly:axis-group-interface::height)
(skylines . ,ly:axis-group-interface::calc-skylines)
+ (max-stretch . ,ly:axis-group-interface::calc-max-stretch)
(skyline-horizontal-padding . 1.0)
(meta . ((class . System)
(interfaces . (system-interface
(stacking-dir . -1)
(padding . 0.5)
(skylines . ,ly:axis-group-interface::combine-skylines)
+ (max-stretch . ,ly:align-interface::calc-max-stretch)
(meta . ((class . Spanner)
(object-callbacks . ((Y-common . ,ly:axis-group-interface::calc-y-common)))
(interfaces . (align-interface
(Y-offset . ,ly:hara-kiri-group-spanner::force-hara-kiri-callback)
(Y-extent . ,ly:hara-kiri-group-spanner::y-extent)
(X-extent . ,ly:axis-group-interface::width)
- (skylines . ,ly:axis-group-interface::calc-skylines);
+ (skylines . ,ly:hara-kiri-group-spanner::calc-skylines)
+ (max-stretch . ,ly:axis-group-interface::calc-max-stretch)
(meta . ((class . Spanner)
(object-callbacks . ((X-common . ,ly:axis-group-interface::calc-x-common)))
(interfaces . (axis-group-interface
;; geometric shapes
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(define-builtin-markup-command (draw-line layout props dest)
+ (number-pair?)
+ "A simple line. Uses the @code{thickness} property. "
+ (let*
+ ((th (chain-assoc-get 'thickness props 0.1))
+ (x (car dest))
+ (y (cdr dest)))
+
+ (ly:make-stencil
+ `(draw-line
+ ,th
+ 0 0
+ ,x ,y)
+
+ (cons (min x 0) (min y 0))
+ (cons (max x 0) (max y 0)))))
+
(define-builtin-markup-command (draw-circle layout props radius thickness fill)
(number? number? boolean?)
"A circle of radius @var{radius}, thickness @var{thickness} and
;(map (lambda (s) (interpret-markup layout props s)) parts))
(interpret-markup layout props str)))
-
-;; TODO: use font recoding.
-;; (make-line-markup
-;; (map make-word-markup (string-tokenize str)))))
-
(define-public empty-markup
(make-simple-markup ""))
#:use-module (lily)
#:export (post-process-pages optimal-page-breaks make-page-from-systems
page-breaking-wrapper
+ stretchable-line? ; delete me
;; utilities for writing custom page breaking functions
line-height line-next-space line-next-padding
line-minimum-distance line-ideal-distance
first-line-position
line-ideal-relative-position line-minimum-relative-position
- line-minimum-position-on-page stretchable-line?
+ line-minimum-position-on-page
page-maximum-space-to-fill page-maximum-space-left space-systems))
+; this is for 2-pass spacing. Delete me.
+(define (stretchable-line? line)
+ "Say whether a system can be stretched."
+ (not (or (ly:prob-property? line 'is-title)
+ (let ((system-extent (paper-system-staff-extents line)))
+ (= (interval-start system-extent)
+ (interval-end system-extent))))))
+
+(define (stretch-and-draw-page paper-book systems page-number ragged last)
+ (define (max-stretch sys)
+ (if (ly:grob? sys)
+ (ly:grob-property sys 'max-stretch)
+ 0.0))
+
+ (define (stretchable? sys)
+ (and (ly:grob? sys)
+ (> (max-stretch sys) 0.0)))
+
+ (define (height-estimate sys)
+ (interval-length
+ (if (ly:grob? sys)
+ (ly:grob-property sys 'pure-Y-extent)
+ (paper-system-extent sys Y))))
+
+ (define (print-system sys)
+ (if (ly:grob? sys)
+ (ly:system-print sys)
+ sys))
+
+ (define (set-line-stretch! sorted-lines rest-height space-left)
+ (if (not (null? sorted-lines))
+ (let* ((line (first sorted-lines))
+ (height (height-estimate line))
+ (stretch (min (max-stretch line)
+ (if (positive? rest-height)
+ (/ (* height space-left) rest-height)
+ 0.0))))
+ (if (stretchable? line)
+ (ly:system-stretch line stretch))
+ (set-line-stretch! (cdr sorted-lines)
+ (if (stretchable? line)
+ (- rest-height height)
+ rest-height)
+ (- space-left stretch)))))
+
+ (let* ((page (make-page paper-book
+ 'page-number page-number
+ 'is-last last))
+ (paper (ly:paper-book-paper paper-book))
+ (height (page-printable-height page))
+ ; there is a certain amount of impreciseness going on here:
+ ; the system heights are estimated, we aren't using skyline distances
+ ; yet, etc. If we overstretch because of underestimation, the result
+ ; is very bad. So we stick in some extra space, just to be sure.
+ (buffer (/ height 10.0))
+ (total-system-height (apply + (map height-estimate systems)))
+ (height-left (- height total-system-height buffer)))
+
+ (if (not ragged)
+ (set-line-stretch! (sort systems
+ (lambda (s1 s2)
+ (< (height-estimate s1)
+ (height-estimate s2))))
+ (apply + (map height-estimate
+ (filter stretchable? systems)))
+ (- (page-printable-height page)
+ total-system-height)))
+
+ (let* ((lines (map print-system systems))
+ (posns (if (null? lines)
+ (list)
+ (let* ((paper (ly:paper-book-paper paper-book))
+ (space-to-fill (page-maximum-space-to-fill
+ page lines paper))
+ (spacing (space-systems space-to-fill lines ragged paper #f)))
+ (if (and (> (length lines) 1)
+ (or (not (car spacing)) (inf? (car spacing))))
+ (begin
+ (ly:warning (_ "Can't fit systems on page -- ignoring between-system-padding"))
+ (cdr (space-systems space-to-fill lines ragged paper #t)))
+ (cdr spacing))))))
+ (page-set-property! page 'lines lines)
+ (page-set-property! page 'configuration posns)
+ page)))
+
(define (page-breaking-wrapper paper-book)
"Compute line and page breaks by calling the page-breaking paper variable,
then performs the post process function using the page-post-process paper
;;;
;;; Utilities for computing line distances and positions
;;;
+(define (line-extent line)
+ "Return the extent of the line (its lowest and highest Y-coordinates)."
+ (paper-system-extent line Y))
+
(define (line-height line)
"Return the system height, that is the length of its vertical extent."
- (interval-length (paper-system-extent line Y)))
+ (interval-length (line-extent line)))
(define (line-next-space line next-line layout)
"Return space to use between `line' and `next-line'.
"Minimum distance between `line' reference position and `next-line'
reference position. If next-line is #f, return #f."
(and next-line
- (let ((non-skyline-distance (- (interval-end (paper-system-extent next-line Y))
- (interval-start (paper-system-extent line Y)))))
- (max 0 (+ (ly:prob-property next-line 'skyline-distance non-skyline-distance)
- (if ignore-padding 0 (line-next-padding line next-line layout)))))))
+ (let ((padding (if ignore-padding
+ 0
+ (line-next-padding line next-line layout))))
+ (if (or (ly:grob? line) (ly:grob? next-line))
+ (max 0 (+ padding
+ (- (interval-start (line-extent line))
+ (interval-end (line-extent next-line)))))
+ (max 0 (+ padding
+ (ly:paper-system-minimum-distance line next-line)))))))
(define (line-ideal-distance line next-line layout ignore-padding)
"Ideal distance between `line' reference position and `next-line'
0.0
(ly:output-def-lookup layout 'page-top-space))
(interval-end (paper-system-staff-extents line)))
- (interval-end (paper-system-extent line Y))))
+ (interval-end (line-extent line))))
(define (line-ideal-relative-position line prev-line layout ignore-padding)
"Return ideal position of `line', relative to `prev-line' position.
(position (+ (line-minimum-relative-position line prev-line layout #f)
(if prev-line prev-position 0.0)))
(bottom-position (- position
- (interval-start (paper-system-extent line Y)))))
+ (interval-start (line-extent line)))))
(and (or (not prev-line)
(< bottom-position (page-printable-height page)))
position)))
-(define (stretchable-line? line)
- "Say whether a system can be stretched."
- (not (or (ly:prob-property? line 'is-title)
- (let ((system-extent (paper-system-staff-extents line)))
- (= (interval-start system-extent)
- (interval-end system-extent))))))
-
(define (page-maximum-space-to-fill page lines paper)
"Return the space between the first line top position and the last line
bottom position. This constitutes the maximum space to fill on `page'
(first-line-position (first lines) paper)
(ly:prob-property last-line
'bottom-space 0.0)
- (- (interval-start (paper-system-extent last-line Y))))))
+ (- (interval-start (line-extent last-line))))))
(define (page-maximum-space-left page)
(let ((paper (ly:paper-book-paper (page-property page 'paper-book))))
(and position
(- (page-printable-height page)
(- position
- (interval-start (paper-system-extent line Y)))))
+ (interval-start (line-extent line)))))
(bottom-position (cdr lines) line position)))))))
;;;
(+ y topskip)))
(cdr space-result)))))
-(define (make-page-from-systems paper-book lines page-number ragged last)
- "Return a new page, filled with `lines'."
- (let* ((page (make-page paper-book
- 'lines lines
- 'page-number page-number
- 'is-last last))
- (posns (if (null? lines)
- (list)
- (let* ((paper (ly:paper-book-paper paper-book))
- (space-to-fill (page-maximum-space-to-fill
- page lines paper))
- (spacing (space-systems space-to-fill lines ragged paper #f)))
- (if (and (> (length lines) 1)
- (or (not (car spacing)) (inf? (car spacing))))
- (begin
- (ly:warning (_ "Can't fit systems on page -- ignoring between-system-padding"))
- (cdr (space-systems space-to-fill lines ragged paper #t)))
- (cdr spacing))))))
- (page-set-property! page 'configuration posns)
- page))
;;;
;;; Page breaking function
HELP2MAN_EXECS = $(SEXECUTABLES)
AT_FILES=relocate-preamble
-at-ext=.py.in
-at-dir=$(depth)/python
+at-ext=.py
+at-dir=$(top-build-dir)/python/$(outdir)
include $(depth)/make/stepmake.make
include $(stepdir)/executable-targets.make