]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/ledger-line-engraver.cc: new file.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 23 Jul 2004 18:41:35 +0000 (18:41 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 23 Jul 2004 18:41:35 +0000 (18:41 +0000)
* lily/ledger-line-spanner.cc (print): new file. Set limits to
ledger line length to avoid clashes.

27 files changed:
VERSION
input/regression/auto-beam-no-beam.ly
input/regression/auto-beam.ly
input/regression/bar-check-redefine.ly
input/regression/lyric-combine-polyphonic.ly
input/regression/lyric-hyphen.ly
input/regression/multi-measure-rest-grace.ly
input/regression/new-slur.ly
input/regression/newaddlyrics.ly
input/regression/part-combine-solo-end.ly
input/regression/property-grace-polyphony.ly
input/regression/property-once.ly
input/regression/quote-transposition.ly
input/regression/rhythmic-staff.ly
lily/ambitus.cc
lily/include/paper-column.hh
lily/include/spanner.hh
lily/include/stem.hh
lily/ledger-line-engraver.cc
lily/ledger-line-spanner.cc
lily/new-slur.cc
lily/note-spacing.cc
lily/slur-quanting.cc
lily/stem-tremolo.cc
lily/stem.cc
ly/engraver-init.ly
scm/define-grob-properties.scm

diff --git a/VERSION b/VERSION
index 6da315743fbe71533583183b9167f009f31d49f7..5e56c23773843af13a318f4c0b0625a16a4f3c35 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,6 +1,6 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=2
 MINOR_VERSION=3
-PATCH_LEVEL=7
+PATCH_LEVEL=8
 MY_PATCH_LEVEL=
 
index 96c4c89a092000b6cc7cc163be52cebdadd316b5..ac170d55054802db82e96fa9c1a1e2aecc9d148b 100644 (file)
@@ -5,8 +5,10 @@
 
 
     }
+
 \version "2.3.4"
+\paper {
+    raggedright = ##t
+}
 
-\score {
-     { c8 c-\noBeam c c }
-    }
+{ c8 c-\noBeam c c }
index e5e61b0ea6a28fe70a0fe460062e74cdc31561a2..38c0f2de0832861b62aa221e695a8afedc5812b7 100644 (file)
@@ -1,15 +1,10 @@
-
 \header {
-
 texidoc="Beams are place automatically; the last measure should have a single 
 beam."
-
 }
 
 \version "2.3.4"
 
-
-
 \paper  { raggedright = ##t } 
 
 \score {
@@ -20,8 +15,7 @@ beam."
   \paper {
     \context {
       \Staff
-       \remove "Clef_engraver"
-%%     \remove "Staff_symbol_engraver"
+      \remove "Clef_engraver"
     }
   }
 }
index 24860d30d35d3d43176d50037fde7bb6cbdceae4..b8f5c885ba078cf4ea5779f05be1e855b9a0ad0c 100644 (file)
@@ -6,7 +6,6 @@ identifier @code{pipeSymbol}."
 
 pipeSymbol = \bar "||"
 
-\score {
-      { c'2 | c'2 | }
-}
+\paper { raggedright = ##t }
+{ c'2 | c'2 | }
     
index 53ff8461b919af0e35c39264a8a33992c4c9fbf7..0c2a3ae6c8b89aef6585397e6c2f9d5e3c212270 100644 (file)
@@ -12,6 +12,9 @@ texidoc ="Polyphonic rhythms and rests do not disturb
        \time 8/8
        \key des \major
        <<
+        \lyricsto "one" \new Lyrics \lyrics {
+            Do mi nus ex
+        }
           \context Voice = one {
               \voiceOne
               bes'4 bes'4
@@ -24,9 +27,6 @@ texidoc ="Polyphonic rhythms and rests do not disturb
           \lyricsto "two" \new Lyrics \lyrics {
              Do na
          }
-        \lyricsto "one" \new Lyrics \lyrics {
-            Do mi nus ex
-        }
        >>
     }
     \paper { raggedright = ##t}
index 886796a0d31da4e7b0493f9412cf99aecb2e599b..95a9865d7cc3ea7bcd2f3929495e7948f579b3c1 100644 (file)
@@ -2,13 +2,16 @@
 \header {
     texidoc = "In lyrics, hyphens may be used."
 }
-\score{
-       <<
-       \context Staff  { c' (c') c'( c') }
-       \context Lyrics \lyrics { bla -- alb xxx -- yyy }
-       >>
+\paper {
+
+    raggedright= ##t
 }
 
+<<
+    \context Staff  { c' (c') c'( c') }
+    \context Lyrics \lyrics { bla -- alb xxx -- yyy }
+>>
+
 
 
 
index e766b599e6294153260a8c1cdb13fda8a845df05..d1b4d66478691df239f0f784f8b1bc2d807ec2bb 100644 (file)
@@ -5,9 +5,9 @@
 texidoc= "Multi-measure rests are centered also in the case of grace notes."
 }
 
-\score   {
- <<
-       \new Staff { R1 R1 R1*3 }
-       \new Staff { \clef bass c1 \grace c8 c2 c2 c1  \grace c16 c2 c2 c1 }
+\paper { raggedright = ##t }
+
+<<
+    \new Staff { R1 R1 R1*3 }
+    \new Staff { \clef bass c1 \grace c8 c2 c2 c1  \grace c16 c2 c2 c1 }
 >>
-}
index a3ae44c1c31210a37ce76929c11a2c7eb033da1e..9f7fd0daa5892ffd9b7fdbb8e1a7b39d5bcbef48 100644 (file)
 %% \score
 
 \relative {
-    \override Slur #'after-line-breaking-callback = #New_slur::after_line_breaking
-    \override Slur #'print-function = #New_slur::print     
-    \override Slur #'height = ##f
-
+  
     \grace e=''16( d8.[) c16]
-    d8.[ \grace f16( e16)]
+    d=''8.[ \grace f16( e16)]
     s2
     << {c=''8.([ es16] bes4~bes )}
        \\
@@ -41,7 +38,6 @@
     c,^( c'' c) 
     c,,^( c'')
     c,,^( c')
-    s4
     | b='2( a4) s4
     | b='4.( c8) s2
     | << c=''1_(
@@ -49,6 +45,8 @@
     \break
     b4)
     e=''4.( c8) s4
+    | << { b='8[( c]) } \\
+        { b='8[( c]) }>>
     
 
     
index 6011d3c1946bb0871edec3a2216c3d3dc0a7179b..1a469c78441c75f17570110b4b284496d8e8b4dd 100644 (file)
@@ -3,32 +3,25 @@
     texidoc = "newlyrics, multiple stanzas, multiple lyric voices."
     
 }
-
-%% only this works as advertised...
+\paper { raggedright = ##t }
 <<
     \new Staff \relative {
        d'2 d c4 bes a2 \break
-       c2 c d4 f g2
     }
     \newlyrics {
        My first Li -- ly song,
-       Not much can go wrong!
     }
     \newlyrics {
-       My next Li -- ly verse
        Not much can go wrong!
     }
     \new Staff \relative {
        \clef bass
        d2 d c4 bes a2 \break
-       c2 c d4 f g2
     }
     \newlyrics {
        MY FIRST LI -- LY SONG,
-       NOT MUCH CAN GO WRONG!
     }
     \newlyrics {
-       MY NEXT LI -- LY VERSE
        NOT MUCH CAN GO WRONG!
     }
 >>
index 8a5169d034a48dab20ed5cebadd806df151b6732..5a9173636915195809b65c13b18bd184932cef7a 100644 (file)
@@ -6,12 +6,11 @@
 }
 
 \version "2.3.4"
+\paper { raggedright = ##t }
 
-\score {
-   <<
-     \new Staff
-       \partcombine
-          { R1 * 2 }
-          { c'8\> c'\! r2.  }
-   >>
-}
+<<
+    \new Staff
+    \partcombine
+    { R1 * 2 }
+    { c'8\> c'\! r2.  }
+>>
index 46202ef924fe7a3c5be170107fe676bd0e17a578..72e8798d412791adce3a22be5a09af3a6b97d82f 100644 (file)
@@ -5,13 +5,12 @@
     not interfere with the overrides and reverts from polyphony."
 
 }
+\paper { raggedright = ##t }
 
 \version "2.3.4"
-\score {
    \relative c'' {
       <<
          { \grace e8 d2 }
          \\ { a2 } >>
   }
-}
 
index 233a809603ba78479d2c331f4f079d8dfa4aa97c..a7e410ea7ef82563c727508ffe0454954a836b25 100644 (file)
@@ -4,15 +4,15 @@
     texidoc = "Once properties take effect during a single time step only."
 }
 
-\score {
-       \relative c' {
-         c4
-         \once \set Stem = #'()
-         c4
-         \once \override Stem  #'thickness = #5.0
-         c4
-         c4
-  }
+\paper { raggedright = ##t }
+
+\relative c' {
+    c4
+    \once \set Stem = #'()
+    c4
+    \once \override Stem  #'thickness = #5.0
+    c4
+    c4
 }
  
 
index d7c2a5cc7af3674a4ac8d88a12f2d7a67badb1b6..98349f27fa8c2c8ca97fa883a5e744163d1f13a0 100644 (file)
@@ -8,6 +8,8 @@ In this example, all instruments play sounding central C, the target is a instru
 }
 \version "2.3.4"
 
+\paper { raggedright = ##t }
+
 
 \addquote clarinet  {
     \transposition bes
@@ -15,19 +17,16 @@ In this example, all instruments play sounding central C, the target is a instru
     d'16 d'16 d'8 
     d'16 d'16 d'8 
     d'16 d'16 d'8 
-    }
+}
 \addquote sax  {
     \transposition es'
     a8 a a a a a  a a 
-    }
-
-\score {
-    {
-       \transposition f  % french horn
-       
-       g'4
-       << \quote clarinet 4 s4^"clar" >> 
-       << \quote sax 4 s4^"sax" >> 
-    }
+}
+{
+    \transposition f  % french horn
+    
+    g'4
+    << \quote clarinet 4 s4^"clar" >> 
+    << \quote sax 4 s4^"sax" >> 
 }
 
index 8274163b016d12471c408a55d5fc5e166b29c132..e0955ed56d8a8a7c71bd7b132741e79ec7a4e9f6 100644 (file)
@@ -5,9 +5,10 @@
     texidoc = "In rhythmic staves stems should go up, and bar lines have the size for a  5 line staff. The whole note hangs from the rhythmic staff."
 }
 
-\score {  \context RhythmicStaff
-  {
-            r4 c4. c8 r8 c8 | c2 r2 | r1
-  }
+\paper { raggedright = ##t }
+
+\context RhythmicStaff
+{
+    r4 c4. c8 r8 c8 | c2 r2 | r1
 }
 
index cb46229ec05fdf800a15e84c9e8d56c16844befc..739b68b09ce2ea8908fcc5fdf3763633e998f5c5 100644 (file)
@@ -49,7 +49,8 @@ Ambitus::print (SCM smob)
       
       if (pmin < pmax)
        {
-         Real linethickness = me->get_paper ()->get_dimension (ly_symbol2scm ("linethickness")) * robust_scm2double (me->get_property ("thickness"), 1.0); 
+         Real linethickness = me->get_paper ()->get_dimension (ly_symbol2scm ("linethickness"))
+           * robust_scm2double (me->get_property ("thickness"), 1.0); 
          Real blotdiameter = me->get_paper ()->get_dimension (ly_symbol2scm ("blotdiameter"));
          Interval x_extent = 0.5 * linethickness *Interval (-1,1);
          Interval y_extent = Interval (pmin, pmax);
index 935e7b8fe416611711395edf0c00368b0faa48e8..f69ced71477729d69ae27225c5c1247eb75cde95 100644 (file)
@@ -30,7 +30,7 @@ public:
   virtual System *get_system () const;
   
   static int get_rank (Grob*);
-
+  
   DECLARE_SCHEME_CALLBACK (print, (SCM));
   DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM));
   
index f04c3aca5651dadc4a435469ce13d8ddc1e50c4e..c4670d0122bd78def662a0a791abd21f27170f77 100644 (file)
@@ -68,7 +68,7 @@ protected:
 };
 
 void add_bound_item (Spanner*, Grob*);
-///DECLARE_UNSMOB (Spanner, spanner);
 
+bool spanner_less ( Spanner *s1, Spanner* s2);
 int broken_spanner_index (Spanner * sp);
 #endif
index e3078a13d6fa4b9eaef470e0a631ba95a12c5c70..22721dad318d46b5d6b8736901e636ff0703a238 100644 (file)
@@ -19,7 +19,7 @@ public:
   static int duration_log (Grob *);
   static void set_beaming (Grob *, int, Direction d);
   static int get_beaming (Grob *, Direction d);
-  static Grob *get_beam (Grob *);
+  static Spanner *get_beam (Grob *);
   static Grob *first_head (Grob *);
   static Grob *last_head (Grob *);
   static Drul_array<Grob*> extremal_heads (Grob *);
index 55913f0beaafdc81cfb5cd4d53bdd3b77d347447..7fda2b047b2927c389f8d23784b4a584ffc274bd 100644 (file)
@@ -11,7 +11,6 @@
 #include "group-interface.hh"
 #include "spanner.hh"
 #include "engraver.hh"
-#include "ambitus.hh"
 
 class Ledger_line_engraver : public Engraver
 {
index ad03ae36496ad8290f1aeffef2c5cdfe7d3648ff..2a213f9591371af4fef45ab48b73aed1b2a9c290 100644 (file)
@@ -17,7 +17,6 @@
 #include "spanner.hh" 
 #include "group-interface.hh" 
 #include "paper-column.hh"
-#include "ambitus.hh"
 
 struct Ledger_line_spanner
 {
@@ -110,6 +109,12 @@ Ledger_line_spanner::print (SCM smob)
 
   if (heads.is_empty ())
     return SCM_EOL;
+  
+  // find size of note heads.
+  Grob * staff = Staff_symbol_referencer::get_staff_symbol (me);
+  if (!staff)
+    return SCM_EOL;
+  
     
   Stencil ledgers;
   Stencil default_ledger;
@@ -125,8 +130,6 @@ Ledger_line_spanner::print (SCM smob)
          common[a] = common[a]->common_refpoint (g, a);
     }
 
-  // find size of note heads.
-  Grob * staff = Staff_symbol_referencer::get_staff_symbol (me);
   int interspaces = Staff_symbol::line_count (staff)-1;
   Ledger_requests reqs;
   Real length_fraction = 0.25;
@@ -135,7 +138,8 @@ Ledger_line_spanner::print (SCM smob)
       Item *h = dynamic_cast<Item*> (heads[i]);
       
       int pos = Staff_symbol_referencer::get_rounded_position (h);
-      if (abs (pos) > interspaces)
+      if (pos
+         && abs (pos) > interspaces)
        {
          Interval head_extent = h->extent (common[X_AXIS], X_AXIS);
          Interval ledger_extent = head_extent;
index 53a004a16d5ae126d20948d2c96b9a5ec3e7edc1..f617c320f1788ecbbc244cfa7efe4dbf85ec7ee0 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  slur.cc -- implement score based Slur
+  slur.cc -- implement external interface for Slur
 
   source file of the GNU LilyPond music typesetter
 
index 54a391a881776862221b794e8f40d963ed677aa6..57af38e0e2d6ff4348b6daee940717b22fd776a9 100644 (file)
@@ -250,7 +250,7 @@ Note_spacing::stem_dir_correction (Grob*me, Item * rcolumn,
   Drul_array<SCM> props (me->get_property ("left-items"),
                        me->get_property ("right-items"));
 
-  Drul_array<Grob*> beams_drul (0,0);
+  Drul_array<Spanner*> beams_drul (0,0);
   Drul_array<Grob*> stems_drul (0,0);
   
   stem_dirs[LEFT] = stem_dirs[RIGHT] = CENTER;
@@ -301,7 +301,6 @@ Note_spacing::stem_dir_correction (Grob*me, Item * rcolumn,
 
          stems_drul[d] = stem;
          beams_drul[d] = Stem::get_beam (stem);
-           
          
          Direction sd = Stem::get_direction (stem);
          if (stem_dirs[d] && stem_dirs[d] != sd)
index 970a5a873d1b07e2bea9e91758f6cce253636597..cc33c91b1730c15e5d535fb67c4305a5be8ce57c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  slur.cc -- implement score based Slur
+  slur-quanting.cc -- Score based slur formatting
 
   source file of the GNU LilyPond music typesetter
 
@@ -24,6 +24,8 @@
 #include "staff-symbol.hh"
 #include "stem.hh"
 #include "warn.hh"
+#include "paper-column.hh"
+
 
 struct Slur_score
 {
@@ -92,7 +94,7 @@ struct Bound_info
 {
   Box stem_extent_;
   Direction stem_dir_;
-  Grob *bound_;
+  Item *bound_;
   Grob *note_column_;
   Grob *slur_head_;
   Grob *staff_;
@@ -504,6 +506,22 @@ get_y_attachment_range (Spanner*me,
   return end_ys;
 }
 
+bool
+spanner_less (Spanner *s1, Spanner* s2)
+{
+  Slice b1, b2;
+  Direction d  = LEFT;
+  do
+    {
+      b1[d] = s1->get_bound (d)->get_column ()->rank_;
+      b2[d] = s2->get_bound (d)->get_column ()->rank_;
+    } while (flip (&d) != LEFT);  
+
+  return b2[LEFT] <= b1[LEFT] && b2[RIGHT] >= b1[RIGHT]
+    && (b2[LEFT] != b1[LEFT] || b2[RIGHT] != b1[RIGHT]);
+}
+
+
 Drul_array<Offset>
 get_base_attachments (Spanner *me,
                      Grob **common, Drul_array<Bound_info> extremes)
@@ -531,11 +549,14 @@ get_base_attachments (Spanner *me,
        }
       else
        {
+         bool same_beam =
+           (extremes[d].stem_ && extremes[-d].stem_
+            && Stem::get_beam (extremes[d].stem_) == Stem::get_beam (extremes[-d].stem_));
          if (stem
              && extremes[d].stem_dir_ == dir
              && Stem::get_beaming (stem, -d)
-             && columns.size () > 2
-             )
+             && (!spanner_less (me, Stem::get_beam (stem))
+                 || same_beam))
            y = extremes[d].stem_extent_[Y_AXIS][dir];
          else if (head)
            y = head->extent (common[Y_AXIS], Y_AXIS)[dir];
index 84a70cc432e732ea8588ccb98e0daf41f7f26f12..0a64888da40144deb80be724deb2dc883dc17c04 100644 (file)
@@ -6,7 +6,7 @@
   (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
-
+#include "spanner.hh"
 #include "beam.hh"
 #include "directional-element-interface.hh"
 #include "item.hh"
@@ -52,8 +52,7 @@ Stencil
 Stem_tremolo::raw_stencil (Grob *me)
 {
   Grob *stem = unsmob_grob (me->get_property ("stem"));
-  Grob *beam = Stem::get_beam (stem);
-  
+  Spanner*beam = Stem::get_beam (stem);
   Real dydx;
   if (beam)
     {
@@ -119,7 +118,7 @@ Stem_tremolo::print (SCM grob)
       return SCM_EOL;
     }
   
-  Grob *beam = Stem::get_beam (stem);
+  Spanner *beam = Stem::get_beam (stem);
   Direction stemdir = Stem::get_direction (stem);
   if (stemdir == 0)
     stemdir = UP;
index faca4aa1843e610f9a991f9b4737c271d478e2dd..c15682728ee13dc3a4957fdcbf59249f94b528e4 100644 (file)
@@ -736,11 +736,11 @@ Stem::off_callback (SCM element_smob, SCM)
   return scm_make_real (r);
 }
 
-Grob *
+Spanner *
 Stem::get_beam (Grob *me)
 {
   SCM b = me->get_property ("beam");
-  return unsmob_grob (b);
+  return dynamic_cast<Spanner*> (unsmob_grob (b));
 }
 
 Stem_info
index 611e4ffd0d82ff897403a0f5bfebdf4d5ced7cab..a28944421b348f8bd9ea6975802c698a2f6a5d14 100644 (file)
@@ -30,6 +30,7 @@
        \consists "Clef_engraver"
        \consists "Key_engraver"
        \consists "Time_signature_engraver"
+       \consists "Ledger_line_engraver" 
        \consists "Staff_symbol_engraver"
        \consists "Collision_engraver"
        \consists "Rest_collision_engraver"
     \consists "Bar_engraver"
     \consists "Time_signature_engraver"
     \consists "Staff_symbol_engraver"
+    \consists "Ledger_line_engraver" 
     \consists "Instrument_name_engraver"
     \consistsend "Axis_group_engraver"
     \accepts "Voice"
     \consists "Breathing_sign_engraver"
                                % \consists "Rest_engraver"
     \consists "Note_heads_engraver"
-    \consists "Ledger_line_engraver" 
     \consists "Rest_engraver"
 
     \consists "Stem_engraver"
index 65f0c23270a743ef7fdb62109393cc48ca32925a..f338a60d7847a48f1d6320c9dd84f83d8133629a 100644 (file)
@@ -367,9 +367,6 @@ this column.  10000 or more means forbid line break, -10000 or less
 means force line break.  Other values influence line breaking decisions
 as a real penalty.")
 
-     (pitch-max ,ly:pitch? "Top pitch for ambitus.")
-     (pitch-min ,ly:pitch? "Bottom pitch for ambitus.")
-
      (positions ,pair?
                "Pair of staff coordinates @code{(@var{left}
 . @var{right})}, where both @var{left} and @var{right} are in the
@@ -536,7 +533,6 @@ sizes (like the dynamic @b{p} and @b{f}) on their baselines.")
      (after-line-breaking-callback ,procedure? "This procedure is called after line breaking. Its return value is ignored.")     
      (all-elements ,grob-list? "list of all grobs in this line. Its
 function is to protect objects from being garbage collected.")
-     (ambituses ,grob-list? "list of Ambitus objects")
      (arpeggio ,ly:grob? "pointer to arpeggio object.")
      (beam ,ly:grob? "pointer to the beam, if applicable.")
      (center-element ,ly:grob? "grob which will be at the center of
@@ -661,7 +657,6 @@ than a whole rest.")
      (join-left ,boolean? "is this ligature head joined with the previous one by a vertical line?")
      (context-info ,integer? "DOCME")
      (inclinatum ,boolean? "is this neume an inclinatum?")
-     (note-head-style ,string? "name of the font character to be used as note heads in the ambitus grob.")
      (oriscus ,boolean? "is this neume an oriscus?")
      (quilisma ,boolean? "is this neume a quilisma?")
      (pes-or-flexa ,boolean? "shall this neume be joined with the previous head?")
@@ -673,9 +668,6 @@ than a whole rest.")
      
      ;; end ancient notation
 
-     ; ugh.
-     (accidentals-style ,symbol? "style for ambitus.")
-     
      )))
 
 (define-public all-backend-properties