Info for Documentation
----------------------
-Current version of the manual: 2.9.13
+Current version of the manual: 2.11.10 ?
*** Please update this whenever you run convert-ly on the docs.
convert-ly --from=... --to=... --no-version *.itely
* Lines should be less than 80 characters long.
+* Use @q instead of `....' and @qq instead of ``...''
+
%%%%%
HINTS FOR TECHNICAL WRITING STYLE
Quoting grace notes is broken and can even cause LilyPond to crash.
+Quoting nested triplets may result in poor notation.
+
+
@seealso
In this manual: @ref{Instrument transpositions}.
cd $resultdir
-echo 'foo = \new Staff \new Voice \repeat unfold 50 \relative { c4 d8[ d16( e]~ e16[ e e) f] g8 }
+cat > long-score.ly << EOF
+\version "2.10.0"
+foo = \new Staff \new Voice \repeat unfold 50 \relative { c4 d8[ d16( e]~ e16[ e e) f] g8 }
\new ChoirStaff <<
\foo \foo \foo \foo
\foo \foo \foo \foo
->>' > long-score.ly
+>>
+EOF
rm gmon.sum
"
}
-\paper {
- #(define page-breaking ly:page-turn-breaking)
- paper-height = #70
- print-page-number = ##t
-}
+\book {
+ \paper {
+ #(define page-breaking ly:page-turn-breaking)
+ paper-height = #65
+ print-page-number = ##t
+ }
-\relative c' {
- a b c d a b c d \break
- c d e f c d e f \break
- d e f g d e f g
+ \score {
+ \relative c' {
+ a b c d a b c d \break
+ c d e f c d e f \break
+ d e f g d e f g
+ }
+ }
}
--- /dev/null
+\version "2.10.0"
+
+\header {
+ texidoc = "The page-turn engraver will not count potential page
+turns if they occur in the middle of a repeat unless there is a
+long gap at the beginning or at the end of the repeat.
+"
+}
+
+\layout {
+ \context {
+ \Staff
+ \consists "Page_turn_engraver"
+ }
+}
+
+\book {
+ \paper {
+ #(define page-breaking ly:page-turn-breaking)
+ paper-height = #80
+ print-page-number = ##t
+ print-first-page-number = ##t
+ }
+
+ \score {
+ \relative {
+ \set Score.skipBars = ##t
+ % this should be kept on one page
+ \repeat volta 2 {
+ \repeat unfold 7 {a4 b c d16 d d d} R1*10
+ \repeat unfold 8 {a4 b c d16 d d d} \pageTurn
+ }
+ % use up a page
+ a4 b c d a b c d \pageBreak
+
+ % this should be allowed to have a page turn
+ \repeat volta 2 {
+ \repeat unfold 7 {a4 b c d16 d d d} R1*10
+ \repeat unfold 7 {a4 b c d16 d d d} R1*3
+ }
+ }
+ }
+}
\ No newline at end of file
"
}
-\paper {
- #(define page-breaking ly:page-turn-breaking)
- paper-height = #70
- auto-first-page-number = ##t
- print-page-number = ##t
- print-first-page-number = ##t
-}
-
\layout {
\context {
\Staff
}
}
-\relative c' {
- a b c d a b c d \break
- c d e f c d e f R1*4
- \repeat unfold 15 {d4 e f g} \break
- c d e f c d e f R1*2 \bar "||" R1*2
- \repeat unfold 15 {d4 e f g}
+\book {
+
+ \paper {
+ #(define page-breaking ly:page-turn-breaking)
+ paper-height = #65
+ auto-first-page-number = ##t
+ print-page-number = ##t
+ print-first-page-number = ##t
+ }
+
+ \score {
+ \relative c' {
+ a b c d a b c d \break
+ c d e f c d e f R1*4
+ \repeat unfold 15 {d4 e f g} \break
+ c d e f c d e f R1*2 \bar "||" R1*2
+ \repeat unfold 15 {d4 e f g}
+ }
+ }
}
#include "international.hh"
#include "item.hh"
#include "output-def.hh"
+#include "paper-column.hh"
#include "pitch.hh"
#include "stencil.hh"
return SCM_UNSPECIFIED;
}
+/* This callback exists for the sole purpose of allowing us to override
+ its pure equivalent to accidental-interface::pure-height */
+MAKE_SCHEME_CALLBACK (Accidental_interface, height, 1);
+SCM
+Accidental_interface::height (SCM smob)
+{
+ return Grob::stencil_height (smob);
+}
+
+MAKE_SCHEME_CALLBACK (Accidental_interface, pure_height, 3);
+SCM
+Accidental_interface::pure_height (SCM smob, SCM start_scm, SCM)
+{
+ Item *me = dynamic_cast<Item*> (unsmob_grob (smob));
+ int start = scm_to_int (start_scm);
+ int rank = me->get_column ()->get_rank ();
+
+ bool visible = to_boolean (me->get_property ("forced"))
+ || !unsmob_grob (me->get_object ("tie"))
+ || rank != start + 1; /* we are in the middle of a line */
+
+ return visible ? Grob::stencil_height (smob) : ly_interval2scm (Interval ());
+}
+
vector<Box>
Accidental_interface::accurate_boxes (Grob *me, Grob **common)
{
Interval
Grob::pure_height (Grob *refp, int start, int end)
{
- SCM proc = get_property_data ( ly_symbol2scm ("Y-extent"));
- Interval iv = robust_scm2interval (call_pure_function (proc,
- scm_list_1 (self_scm ()),
- start, end),
- Interval (0, 0));
+ SCM proc = get_property_data (ly_symbol2scm ("Y-extent"));
+ SCM iv_scm = call_pure_function (proc,
+ scm_list_1 (self_scm ()),
+ start, end);
+ Interval iv = robust_scm2interval (iv_scm, Interval (0, 0));
Real offset = pure_relative_y_coordinate (refp, start, end);
SCM min_ext = get_property ("minimum-Y-extent");
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (calc_stencils, (SCM));
DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
+ DECLARE_SCHEME_CALLBACK (height, (SCM));
+ DECLARE_SCHEME_CALLBACK (pure_height, (SCM, SCM, SCM));
DECLARE_GROB_INTERFACE();
static string get_fontcharname (string style, int alteration);
bool conceals (Building const &other) const;
bool sane () const;
Building sloped_neighbour (Real horizon_padding, Direction d) const;
+
+ bool operator< (Building const &other)
+ {
+ return iv_[LEFT] < other.iv_[LEFT];
+ }
};
class Skyline
void internal_merge_skyline (list<Building>*, list<Building>*,
list<Building> *const result);
- void internal_build_skyline (list<Building>*, list<Building> *const result);
- bool is_legal_skyline () const;
+ list<Building> internal_build_skyline (list<Building>*);
DECLARE_SIMPLE_SMOBS(Skyline);
public:
/* If [START, END] does not contain an intermediate
breakpoint, we may need to consider solutions that result in a bad turn.
In this case, we won't abort if the min_page_count is too big */
- if (start < end - 1 && min_p_count > 2)
+ if (start < end - 1 && min_p_count + (page_number % 2) > 2)
return Break_node ();
/* if PAGE-NUMBER is odd, we are starting on a right hand page. That is, we
Page_turn_page_breaking::final_page_num (Break_node const &b)
{
vsize end = b.first_page_number_ + b.page_count_;
- return end + 1 - (end % 2);
+ return end - 1 + (end % 2);
}
void
cur = put_systems_on_pages (start, end, line, div[d], p_num);
if (isinf (cur.demerits_)
- || (cur.page_count_ > 2
+ || (cur.page_count_ + (p_num % 2) > 2
&& (!isinf (this_start_best.demerits_))
&& final_page_num (cur) > final_page_num (this_start_best)))
{
*/
#include "skyline.hh"
+#include <deque>
#include "ly-smobs.icc"
}
}
-bool
-Skyline::is_legal_skyline () const
+static bool
+is_legal_skyline (list<Building> const &buildings)
{
list<Building>::const_iterator i;
Real last_x = -infinity_f;
- for (i = buildings_.begin (); i != buildings_.end (); i++)
+ for (i = buildings.begin (); i != buildings.end (); i++)
{
if (i->iv_[LEFT] != last_x)
return false;
-infinity_f, b.iv_[LEFT]));
}
-void
-Skyline::internal_build_skyline (list<Building> *buildings, list<Building> *const result)
+/* remove a non-overlapping set of buildings from BUILDINGS and build a skyline
+ out of them */
+static list<Building>
+non_overlapping_skyline (list<Building> *const buildings)
+{
+ list<Building> result;
+ Real last_end = -infinity_f;
+ list<Building>::iterator i = buildings->begin ();
+ while (i != buildings->end ())
+ {
+ if (approx_less_than (i->iv_[LEFT], last_end))
+ {
+ i++;
+ continue;
+ }
+
+ if (approx_greater_than (i->iv_[LEFT], last_end))
+ result.push_back (Building (last_end, -infinity_f, -infinity_f, i->iv_[LEFT]));
+ else
+ i->iv_[LEFT] = last_end;
+
+ last_end = i->iv_[RIGHT];
+ list<Building>::iterator j = i;
+ i++;
+ result.splice (result.end (), *buildings, j);
+ }
+ if (last_end < infinity_f)
+ result.push_back (Building (last_end, -infinity_f, -infinity_f, infinity_f));
+ assert (is_legal_skyline (result));
+ return result;
+}
+
+list<Building>
+Skyline::internal_build_skyline (list<Building> *buildings)
{
vsize size = buildings->size ();
if (size == 0)
{
- empty_skyline (result);
- return;
+ list<Building> result;
+ empty_skyline (&result);
+ return result;
}
else if (size == 1)
{
- single_skyline (buildings->front (), 0, result);
- return;
+ list<Building> result;
+ single_skyline (buildings->front (), 0, &result);
+ return result;
}
- list<Building> right_half;
- list<Building>::iterator i = buildings->begin ();
+ deque<list<Building> > partials;
+ buildings->sort ();
+ while (!buildings->empty ())
+ partials.push_back (non_overlapping_skyline (buildings));
- for (vsize s = 0; s < size/2; s++)
- i++;
- right_half.splice (right_half.end (), *buildings, i, buildings->end ());
-
- list<Building> right;
- list<Building> left;
- internal_build_skyline (&right_half, &right);
- internal_build_skyline (buildings, &left);
- internal_merge_skyline (&right, &left, result);
+ /* 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 ())
+ {
+ list<Building> merged;
+ list<Building> one = partials.front ();
+ partials.pop_front ();
+ if (partials.empty ())
+ return one;
+
+ list<Building> two = partials.front ();
+ partials.pop_front ();
+ internal_merge_skyline (&one, &two, &merged);
+ partials.push_back (merged);
+ }
+ assert (0);
+ return list<Building> ();
}
Skyline::Skyline ()
}
}
- internal_build_skyline (&bldgs, &buildings_);
- assert (is_legal_skyline ());
+ buildings_ = internal_build_skyline (&bldgs);
+ assert (is_legal_skyline (buildings_));
}
Skyline::Skyline (Box const &b, Real horizon_padding, Axis horizon_axis, Direction sky)
list<Building> my_bld;
my_bld.splice (my_bld.begin (), buildings_);
internal_merge_skyline (&other_bld, &my_bld, &buildings_);
- assert (is_legal_skyline ());
+ assert (is_legal_skyline (buildings_));
}
void
my_bld.splice (my_bld.begin (), buildings_);
single_skyline (Building (b, 0, a, sky_), horizon_padding, &other_bld);
internal_merge_skyline (&other_bld, &my_bld, &buildings_);
- assert (is_legal_skyline ());
+ assert (is_legal_skyline (buildings_));
}
void
i->height_[RIGHT] += sky_ * r;
i->y_intercept_ += sky_ * r;
}
- assert (is_legal_skyline ());
+ assert (is_legal_skyline (buildings_));
}
void
(glyph-name-alist . ,standard-alteration-glyph-name-alist)
(alteration . ,accidental-interface::calc-alteration)
(stencil . ,ly:accidental-interface::print)
+ (Y-extent . ,ly:accidental-interface::height)
(after-line-breaking
. ,ly:accidental-interface::after-line-breaking)
(meta . ((class . Item)
(glyph-name-alist . ,standard-alteration-glyph-name-alist)
(alteration . ,accidental-interface::calc-alteration)
(stencil . ,ly:accidental-interface::print)
+ (Y-extent . ,ly:accidental-interface::height)
(after-line-breaking
. ,ly:accidental-interface::after-line-breaking)
(meta . ((class . Item)
(AccidentalSuggestion
. (
(stencil . ,ly:accidental-interface::print)
+ (Y-extent . ,ly:accidental-interface::height)
(X-offset . ,(ly:make-simple-closure
`(,+
,(ly:make-simple-closure (list ly:self-alignment-interface::centered-on-x-parent))
(X-offset . ,ly:side-position-interface::x-aligned-side)
(direction . ,LEFT)
(stencil . ,ly:accidental-interface::print)
+ (Y-extent . ,ly:accidental-interface::height)
(glyph-name-alist . ,standard-alteration-glyph-name-alist)
(after-line-breaking . ,ly:accidental-interface::after-line-breaking)
(side-axis . ,X)
(font-size . -4)
(side-axis . ,X)
(stencil . ,ly:accidental-interface::print)
+ (Y-extent . ,ly:accidental-interface::height)
(glyph-name-alist . ,standard-alteration-glyph-name-alist)
(meta . ((class . Item)
(interfaces . (trill-pitch-accidental-interface
(list
ly:bar-line::print
ly:note-head::print
- ly:accidental-interface::print
ly:dots::print
ly:clef::print
ly:text-interface::print
'(0 . 0))))
(define pure-conversions-alist
- (list
- `(,ly:slur::outside-slur-callback . ,ly:slur::pure-outside-slur-callback)
- `(,ly:stem::height . ,ly:stem::pure-height)
- `(,ly:rest::height . ,ly:rest::pure-height)
- `(,ly:grob::stencil-height . ,pure-stencil-height)
- `(,ly:side-position-interface::y-aligned-side . ,ly:side-position-interface::pure-y-aligned-side)
- `(,ly:axis-group-interface::height . ,ly:axis-group-interface::pure-height)
- `(,ly:hara-kiri-group-spanner::y-extent . ,ly:hara-kiri-group-spanner::pure-height)
- `(,ly:slur::height . ,ly:slur::pure-height)
- `(,ly:side-position-interface::y-aligned-side . ,ly:side-position-interface::pure-y-aligned-side)))
+ `(
+ (,ly:accidental-interface::height . ,ly:accidental-interface::pure-height)
+ (,ly:slur::outside-slur-callback . ,ly:slur::pure-outside-slur-callback)
+ (,ly:stem::height . ,ly:stem::pure-height)
+ (,ly:rest::height . ,ly:rest::pure-height)
+ (,ly:grob::stencil-height . ,pure-stencil-height)
+ (,ly:side-position-interface::y-aligned-side . ,ly:side-position-interface::pure-y-aligned-side)
+ (,ly:axis-group-interface::height . ,ly:axis-group-interface::pure-height)
+ (,ly:hara-kiri-group-spanner::y-extent . ,ly:hara-kiri-group-spanner::pure-height)
+ (,ly:slur::height . ,ly:slur::pure-height)
+ (,ly:side-position-interface::y-aligned-side . ,ly:side-position-interface::pure-y-aligned-side)))
(define pure-functions
(list
close_beam_state(state)
voices_append (bs)
if do_curly != '':
- voices_append("} }")
+ voices_append("} ")
do_curly = ''
return str