]> git.donarmstrong.com Git - lilypond.git/commitdiff
Merge branch 'master' of ssh+git://hanwen@git.sv.gnu.org/srv/git/lilypond
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 8 Jan 2007 21:03:34 +0000 (22:03 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 8 Jan 2007 21:03:34 +0000 (22:03 +0100)
14 files changed:
Documentation/user/README.txt
Documentation/user/advanced-notation.itely
buildscripts/build-profile.sh
input/regression/page-turn-page-breaking-badturns.ly
input/regression/page-turn-page-breaking-repeats.ly [new file with mode: 0644]
input/regression/page-turn-page-breaking.ly
lily/accidental.cc
lily/grob.cc
lily/include/accidental-interface.hh
lily/include/skyline.hh
lily/page-turn-page-breaking.cc
lily/skyline.cc
scm/define-grobs.scm
scripts/abc2ly.py

index ba2f98793ac3cb7068cdb767c7d8dd2d505cc4d8..34b6d68e33adae7e7db19c44c2f1ec4a0afd3ddc 100644 (file)
@@ -1,7 +1,7 @@
 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
@@ -133,6 +133,8 @@ GENERAL GUIDELINES
 
 * Lines should be less than 80 characters long.
 
+* Use @q instead of `....'  and @qq instead of ``...''
+
 
 %%%%%
 HINTS FOR TECHNICAL WRITING STYLE
index 5cb891883f0efb4452311800b41ef639d76fb663..42cdb7bdae0f8a670720217f81e0be8b17cc7553 100644 (file)
@@ -1524,6 +1524,9 @@ statements that would switch to a different Voice.
 
 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}.
index ee85ec77732004281d35bace7662036639d302c1..4c53c644e49437cbc956bc36c10aa53484c92369 100755 (executable)
@@ -29,12 +29,15 @@ mkdir $resultdir
 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
 
index 0292751d52b78e68aaaf4fda075a8c553fa67020..df8386d1ccbf3cc6d1faf4b2bf0426f011a8fbde 100644 (file)
@@ -7,16 +7,20 @@ should appear on 3 pages.
 "
 }
 
-\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
+    }
+  }
 }
 
 
diff --git a/input/regression/page-turn-page-breaking-repeats.ly b/input/regression/page-turn-page-breaking-repeats.ly
new file mode 100644 (file)
index 0000000..f43184d
--- /dev/null
@@ -0,0 +1,43 @@
+\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
index 8c296b71b6b5c3ad43b81ad5cf2537d213608f6e..686622b7d5b7436deebe6acd142de23d42facf4f 100644 (file)
@@ -7,14 +7,6 @@ in which case the turn will go after the special barline.
 "
 }
 
-\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
@@ -22,11 +14,24 @@ in which case the turn will go after the special barline.
   }
 }
 
-\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}
+    }
+  }
 }
 
index a54a87efbc3c31e6cf07f1af9902038122439d10..1486c3f2cc113105c3f8c034a795afc2ee915415 100644 (file)
@@ -11,6 +11,7 @@
 #include "international.hh"
 #include "item.hh"
 #include "output-def.hh"
+#include "paper-column.hh"
 #include "pitch.hh"
 #include "stencil.hh"
 
@@ -49,6 +50,30 @@ Accidental_interface::after_line_breaking (SCM smob)
   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)
 {
index 0591ab115f6cc6ac8ed0ffddb2960141c4e77695..0d6898a1219452517368ecdc94b09fc3e74cff1e 100644 (file)
@@ -429,11 +429,11 @@ Grob::extent (Grob *refp, Axis a) const
 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");
index 13646895e63443e91477fcdcb2ff6910505ad292..daa4483a200d1a0f6663a61e0e093633a7ba1d8f 100644 (file)
@@ -21,6 +21,8 @@ public:
   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);
index ab8fe30c65dffd579ca0f72599fd4027749549df..c793927c8205ad563b85acd5032e2986414636e4 100644 (file)
@@ -38,6 +38,11 @@ struct Building
   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
@@ -48,8 +53,7 @@ private:
   
   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:
index 911e83467b6ff0a7bad8a58fa0a4daf16f481d66..e4739291a7b784ef3500f5d3cc6a851434403010 100644 (file)
@@ -53,7 +53,7 @@ Page_turn_page_breaking::put_systems_on_pages (vsize start,
   /* 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
@@ -115,7 +115,7 @@ vsize
 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
@@ -171,7 +171,7 @@ Page_turn_page_breaking::calc_subproblem (vsize ending_breakpoint)
               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)))
                 {
index e61abbaea6bed28b05f7b3a3f69aa532d8952be5..c009608fc96d5b3d12d0c23671c9de112d0f583e 100644 (file)
@@ -6,6 +6,7 @@
 */
 
 #include "skyline.hh"
+#include <deque>
 
 #include "ly-smobs.icc"
 
@@ -108,12 +109,12 @@ Skyline::print () const
     }
 }
 
-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;
@@ -325,34 +326,78 @@ single_skyline (Building b, Real horizon_padding, list<Building> *const ret)
                               -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 ()
@@ -406,8 +451,8 @@ Skyline::Skyline (vector<Box> const &boxes, Real horizon_padding, Axis horizon_a
        }
     }
   
-  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)
@@ -426,7 +471,7 @@ Skyline::merge (Skyline const &other)
   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
@@ -438,7 +483,7 @@ Skyline::insert (Box const &b, Real horizon_padding, Axis a)
   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
@@ -451,7 +496,7 @@ Skyline::raise (Real r)
       i->height_[RIGHT] += sky_ * r;
       i->y_intercept_ += sky_ * r;
     }
-  assert (is_legal_skyline ());
+  assert (is_legal_skyline (buildings_));
 }
 
 void
index 8dd4bb63485ad1bdd766e5d8e87a0ffa44961f35..8b06fb5927de30ff35ee2bbce0e11c73bfa55bc1 100644 (file)
@@ -23,6 +23,7 @@
        (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)
@@ -35,6 +36,7 @@
        (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)
@@ -45,6 +47,7 @@
     (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
index 9c697367b4fc020b285ad137cae64deeff5ab213..83dc1f79ae4d135b12b6c8b1d19a5be0a72d4ecd 100644 (file)
@@ -1179,7 +1179,7 @@ def try_parse_bar (str,state):
         close_beam_state(state)
         voices_append (bs)
         if do_curly != '':
-            voices_append("} }")
+            voices_append("} ")
             do_curly = ''
     return str