]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/slur.cc (get_attachment): do something sensible when
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 29 Sep 2003 22:33:12 +0000 (22:33 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 29 Sep 2003 22:33:12 +0000 (22:33 +0000)
attaching to stem without heads (eg. a rest).

* lily/stem.cc: remove #'up-to-staff ; use #'stem-end for forcing
up to staff. Add #'rests.
remove #'support-head property
(brew_molecule): small cleanup.
(flag): remove #'grace property.

ChangeLog
lily/custos.cc
lily/slur.cc
lily/stem.cc
scm/define-grob-properties.scm
scm/define-grobs.scm
scm/output-lib.scm

index 3fad186f009c03ab5cad63526adb368bbb64d2cf..5e11ed1ec8f0a3604156d72b8b04333f0f8eba9f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2003-09-30  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+       * lily/slur.cc (get_attachment): do something sensible when
+       attaching to stem without heads (eg. a rest).
+
+       * lily/stem.cc: remove #'up-to-staff ; use #'stem-end for forcing
+       up to staff. Add #'rests.
+       remove #'support-head property
+       (brew_molecule): small cleanup.
+       (flag): remove #'grace property.
+
 2003-09-29  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * cygwin/postinstall-lilypond.sh: 
@@ -38,7 +49,7 @@
        
        * input/regression/bar-scripts.ly (onestaff): raggedright
 
-v/pri2003-09-28  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+2003-09-28  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
        * lily/*.cc: remove #if 0'd code in couple of places.
 
index 4471e9042b3efa2fdb41a49528769b12ecf133ac..ad8d408ea9dbf0b4ebb135cbcf1ba6ea0154837b 100644 (file)
@@ -48,8 +48,8 @@ Custos::brew_molecule (SCM smob)
    * staffline or not, or shall we use individual font characters
    * for both cases?
    */
-  bool adjust =
-    to_boolean (me->get_grob_property ("adjust-if-on-staffline"));
+  bool adjust
+    to_boolean (me->get_grob_property ("adjust-if-on-staffline"));
 
   int neutral_pos;
   SCM ntr_pos = me->get_grob_property ("neutral-position");
index 0d3ce25aa52b48c44894391ef5afa878d688d036..c3d7b1e2c1cc8fff4c6c3ca049787d04abb501dc 100644 (file)
@@ -129,7 +129,6 @@ Slur::after_line_breaking (SCM smob)
 void
 Slur::check_slope (Grob *me)
 {
-
   /*
     Avoid too steep slurs.
    */
@@ -294,37 +293,44 @@ Slur::get_attachment (Grob *me, Direction dir,
       s = set_extremities (me);
     }
   
-  SCM a = dir == LEFT ? ly_car (s) : ly_cdr (s);
+  SCM a = (dir == LEFT) ? ly_car (s) : ly_cdr (s);
   Spanner*sp = dynamic_cast<Spanner*> (me);
   String str = ly_symbol2string (a);
+  
   Real staff_space = Staff_symbol_referencer::staff_space ((Grob*)me);
   Real hs = staff_space / 2.0;
   Offset o;
   
-  int slurdir = gh_scm2int (me->get_grob_property ("direction"));
+  Direction slurdir = to_dir (me->get_grob_property ("direction"));
   
   Grob *stem = 0;
   if (Note_column::has_interface (sp->get_bound (dir)))
     {
       Grob * n =sp->get_bound (dir);
-      if ((stem = Note_column::get_stem (n)))
+      stem = Note_column::get_stem (n);
+      if (stem)
        {
          Real x_extent;
-         if (Grob *head = Note_column::first_head (n))
+         Grob *head = Note_column::first_head (n);
+         if (head)
            x_extent = head->extent (head, X_AXIS).length ();
          else
            x_extent = n->extent (n, X_AXIS).length ();
 
-         if (str == "head")
+         if (!head)
+           {
+             o = Offset (0, n->extent (n, Y_AXIS)[slurdir]);
+           }
+         else if (str == "head")
            {
              o = Offset (0, Stem::head_positions (stem)
-                         [Directional_element_interface::get (me)] * hs);
+                         [slurdir] * hs);
              /*
                Default position is centered in X, on outer side of head Y
               */
              o += Offset (0.5 * x_extent,
                           0.5 * staff_space
-                          * Directional_element_interface::get (me));
+                          * slurdir);
            }
          else if (str == "alongside-stem")
            {
@@ -334,7 +340,7 @@ Slur::get_attachment (Grob *me, Direction dir,
               */
              o += Offset (x_extent * (1 + Stem::get_direction (stem)),
                           0.5 * staff_space
-                          * Directional_element_interface::get (me));
+                          * slurdir);
            }
          else if (str == "stem")
            {
@@ -378,7 +384,7 @@ Slur::get_attachment (Grob *me, Direction dir,
     {
       Offset off = ly_scm2offset (ly_cdr (l)) * staff_space;
       off[X_AXIS] *= dir;
-      off[Y_AXIS] *= Directional_element_interface::get (me);
+      off[Y_AXIS] *= slurdir;
       o += off;
     }
 
@@ -396,7 +402,7 @@ Slur::get_attachment (Grob *me, Direction dir,
                                          ("attachment-offset"),
                                          dir)) * staff_space;
 
-  off[Y_AXIS] *= Directional_element_interface::get (me);
+  off[Y_AXIS] *= slurdir;
   o += off;
   return o;
 }
index 32576c2170c7988311010a39c8fc282498564bb1..968339aec4609f88247eb26e63483ce273067f9d 100644 (file)
@@ -130,11 +130,7 @@ Stem::set_stemend (Grob*me, Real se)
 Grob*
 Stem::support_head (Grob*me)
 {
-  SCM h = me->get_grob_property ("support-head");
-  Grob * nh = unsmob_grob (h);
-  if (nh)
-    return nh;
-  else if (head_count (me) == 1)
+  if (head_count (me) == 1)
     {
       /*
        UGH.
@@ -242,6 +238,9 @@ Stem::add_head (Grob*me, Grob *n)
   n->set_grob_property ("stem", me->self_scm ());
   n->add_dependency (me);
 
+  /*
+    TODO: why not store Rest pointers? 
+  */
   if (Note_head::has_interface (n))
     {
       Pointer_group_interface::add_grob (me, ly_symbol2scm ("note-heads"), n);
@@ -277,19 +276,10 @@ Stem::get_default_dir (Grob*me)
 Real
 Stem::get_default_stem_end_position (Grob*me) 
 {
-  /* Tab notation feature: make stem end extend out of staff. */
-  SCM up_to_staff = me->get_grob_property ("up-to-staff");
-  if (to_boolean (up_to_staff))
-    {
-      int line_count = Staff_symbol_referencer::line_count (me);
-      Direction dir = get_direction (me);
-      return dir * (line_count + 3.5);
-    }
   Real ss = Staff_symbol_referencer::staff_space (me); 
 
   int durlog = duration_log (me);
     
-  bool grace_b = to_boolean (me->get_grob_property ("grace"));
   SCM s;
   Array<Real> a;
 
@@ -387,7 +377,7 @@ Stem::get_default_stem_end_position (Grob*me)
     TODO: change name  to extend-stems to staff/center/'()
   */
   bool no_extend_b = to_boolean (me->get_grob_property ("no-stem-extend"));
-  if (!grace_b && !no_extend_b && dir * st < 0) // junkme?
+  if (!no_extend_b && dir * st < 0) // junkme?
     st = 0.0;
 
   /*
@@ -708,31 +698,18 @@ Stem::brew_molecule (SCM smob)
   
   
      
-  Real y1;
-
-  /*
-    This is required to avoid stems passing in tablature chords...
-   */
-
-
   /*
     TODO: make  the stem start a direction ?
+
+    This is required to avoid stems passing in tablature chords...
   */
-  if (to_boolean (me->get_grob_property ("avoid-note-head")))
-    {
-      Grob * lh = last_head (me);
-      if (!lh)
-       return SCM_EOL;
-      y1 = Staff_symbol_referencer::get_position (lh);
-    }
-  else
-    {
-      Grob * lh = first_head (me);
-      if (!lh)
-       return SCM_EOL;
-      y1 = Staff_symbol_referencer::get_position (lh);
-    }
+  Grob *lh = to_boolean (me->get_grob_property ("avoid-note-head")) 
+    ? last_head (me) :  lh = first_head (me);
+
+  if (!lh)
+    return SCM_EOL;
   
+  Real y1 = Staff_symbol_referencer::get_position (lh);
   Real y2 = stem_end_position (me);
   
   Interval stem_y (y1 <? y2,y2 >? y1);
@@ -858,22 +835,6 @@ Stem::get_stem_info (Grob *me)
 void
 Stem::calc_stem_info (Grob *me)
 {
-  /* Tab notation feature: make stem end extend out of staff. */
-  SCM up_to_staff = me->get_grob_property ("up-to-staff");
-  if (to_boolean (up_to_staff))
-    {
-      int line_count = Staff_symbol_referencer::line_count (me);
-      Direction dir = get_direction (me);
-      Real ideal_y = dir * (line_count + 1.5);
-      Real shortest_y = ideal_y;
-      
-      me->set_grob_property ("stem-info",
-                            scm_list_n (gh_double2scm (ideal_y),
-                                        gh_double2scm (shortest_y),
-                                        SCM_UNDEFINED));
-      return;
-    }
-
   Direction my_dir = Directional_element_interface::get (me);
   Real staff_space = Staff_symbol_referencer::staff_space (me);
   Grob *beam = get_beam (me);
@@ -939,11 +900,9 @@ Stem::calc_stem_info (Grob *me)
      Obviously not for grace beams.
      
      Also, not for knees.  Seems to be a good thing. */
-  SCM grace = me->get_grob_property ("grace");
-  bool grace_b = to_boolean (grace);
   bool no_extend_b = to_boolean (me->get_grob_property ("no-stem-extend"));
   bool knee_b = to_boolean (beam->get_grob_property ("knee"));
-  if (!grace_b && !no_extend_b && !knee_b)
+  if (!no_extend_b && !knee_b)
     {
       /* Highest beam of (UP) beam must never be lower than middle
         staffline */
@@ -998,7 +957,13 @@ Stem::beam_multiplicity (Grob *stem)
   these are too many props.
  */
 ADD_INTERFACE (Stem,"stem-interface",
-  "A stem",
-  "tremolo-flag french-beaming up-to-staff avoid-note-head adjust-if-on-staffline thickness stem-info beamed-lengths beamed-minimum-free-lengths beamed-extreme-minimum-free-lengths lengths beam stem-shorten duration-log beaming neutral-direction stem-end-position support-head note-heads direction length flag-style no-stem-extend stroke-style");
+              "A stem",
+              "tremolo-flag french-beaming "
+              "avoid-note-head adjust-if-on-staffline thickness "
+              "stem-info beamed-lengths beamed-minimum-free-lengths "
+              "beamed-extreme-minimum-free-lengths lengths beam stem-shorten "
+              "duration-log beaming neutral-direction stem-end-position "
+              "note-heads direction length flag-style "
+              "no-stem-extend stroke-style ");
 
 
index e6004e4cf482838874fdabf054e230fa9e9860bd..978fb0f950de88998312fa515d88e1f0ebe419ea 100644 (file)
@@ -434,8 +434,6 @@ the Nth element of the list gives the amount stem shortening of a note with N fl
 (grob-property-description 'stems grob-list? "list of stem objects, corresponding to the notes that the arpeggio has to be before.")
 (grob-property-description 'stropha boolean? "is this neume a stropha?.")
 (grob-property-description 'style symbol? "a string determining what style of  glyph is typeset. Valid choices depend on the function that is reading this property. .")
-(grob-property-description 'support-head ly:grob? "the note head at
-one end of the stem.")
 (grob-property-description 'text markup? "Text markup.  See the
 notation manual for more information.")
 (grob-property-description 'thick-thickness number? "thickness, measured in stafflinethickness.")
@@ -547,8 +545,6 @@ functions set spanner positions.")
 
 (grob-property-description 'avoid-note-head boolean? "if set, the stem of a chord does not pass through all note head, but start at the last note head. Used by tablature.")
 
-(grob-property-description 'up-to-staff boolean? "if set, stems' lengths are set so as stems end out of the staff. Used by tablature.")
-
 (grob-property-description 'use-breve-rest boolean? "boolean that
 tells multi-measure-rest to use a breve rest to represent the duration
 of 1 measure instead of whole rest.  It defaults to false.  It is set
index be9b6422df83c90bed0f861b200928e3ca3c16df..c0e8d887d620fb8b220e57781952282a14a94c1a 100644 (file)
        (Y-offset-callbacks . (,Staff_symbol_referencer::callback))
        (adjust-if-on-staffline . #t)
        (font-family . music)      
-       (avoid-note-head . #f)
-       (up-to-staff . #f)
        (meta . ((interfaces . (stem-interface  font-interface item-interface ))))
        ))
 
index fc9b682897b3e3db8818de344b3486be48675285..f47c98bedd3a1068b54f7c7c8d99650247f2c6ab 100644 (file)
 
 
 (define-public (number-pair->string c)
-  (string-append (number->string (car c)) " "
-                (number->string (cdr c)) " "))
+  (string-append (ly:number->string (car c)) " "
+                (ly:number->string (cdr c)) " "))
 
 (define (font i)
   (string-append