CVSROOT:        /cvsroot/lilypond
Module name:    lilypond
Branch:         
Changes by:     Han-Wen Nienhuys <[EMAIL PROTECTED]>    05/10/16 14:09:31

Modified files:
        .              : ChangeLog 
        lily           : beam.cc grob.cc note-head.cc stem.cc system.cc 
        ly             : engraver-init.ly 
        python         : convertrules.py 
        scm            : define-grob-properties.scm define-grobs.scm 

Log message:
        * ly/engraver-init.ly (AncientRemoveEmptyStaffContext): use 
length-fraction.
        
        * lily/stem.cc (calc_length): multiply with length_fraction. Makes
        for easier grace tweaks.
        
        * lily/beam.cc: remove dir-function.
        
        * lily/system.cc (pre_processing): use callback to trigger spacing 
procedures.
        
        * lily/grob.cc: remove spacing-procedure.
        
        * lily/note-head.cc (calc_stem_attachment): new function.
        (internal_print): use callback to get glyph-name.
        
        * lily/stem.cc (calc_stem_end_position): new function.
        (calc_length): new function.
        document details for stem.
        remove Stem::get_direction()
        
        * lily/grob.cc (get_stencil): simplify: use callback mechanism to
        calculate stencil.
        (get_print_stencil): rename from get_stencil: create stencil with
        transparency, color and cause.
        
        * scm/define-grobs.scm: change print-function to stencil callback 
everywhere.
        
        * python/convertrules.py (conv): insert temporary warning rule.
        
        * lily/grob.cc: elucidate doc about after/before-line-breaking
        
        * lily/stem.cc (height): idem.
        
        * lily/grob.cc: change after/before-line-breaking-callback to
        after/before-line-breaking dummy properties.
        
        * lily/grob.cc (other_axis_parent_positioning): new function.
        (same_axis_parent_positioning): new function
        
        * lily/beam.cc (calc_direction): use pseudo-property for beam
        direction callback.
        (calc_positions): use callback
        
        * lily/stem.cc (calc_stem_end_position): use callback.
        (calc_positioning_done): idem.
        (calc_direction): idem.
        (calc_stem_end_position): idem
        (calc_stem_info): idem.
        
        * scm/define-grob-properties.scm (all-user-grob-properties): doc
        callbacks property.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.4181&tr2=1.4182&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/beam.cc.diff?tr1=1.317&tr2=1.318&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/grob.cc.diff?tr1=1.149&tr2=1.150&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/note-head.cc.diff?tr1=1.156&tr2=1.157&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/stem.cc.diff?tr1=1.282&tr2=1.283&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/system.cc.diff?tr1=1.125&tr2=1.126&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ly/engraver-init.ly.diff?tr1=1.257&tr2=1.258&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/python/convertrules.py.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/define-grob-properties.scm.diff?tr1=1.129&tr2=1.130&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/define-grobs.scm.diff?tr1=1.252&tr2=1.253&r1=text&r2=text

Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.4181 lilypond/ChangeLog:1.4182
--- lilypond/ChangeLog:1.4181   Sun Oct 16 13:28:19 2005
+++ lilypond/ChangeLog  Sun Oct 16 14:09:30 2005
@@ -1,5 +1,19 @@
 2005-10-16  Han-Wen Nienhuys  <[EMAIL PROTECTED]>
 
+       * ly/engraver-init.ly (AncientRemoveEmptyStaffContext): use 
length-fraction.
+
+       * lily/stem.cc (calc_length): multiply with length_fraction. Makes
+       for easier grace tweaks.
+
+       * lily/beam.cc: remove dir-function.
+
+       * lily/system.cc (pre_processing): use callback to trigger spacing 
procedures.
+
+       * lily/grob.cc: remove spacing-procedure.
+
+       * lily/note-head.cc (calc_stem_attachment): new function.
+       (internal_print): use callback to get glyph-name.
+
        * lily/grob-property.cc (get_interfaces): new function.
 
        * lily/grob-scheme.cc (LY_DEFINE): new function ly:grob-interfaces
Index: lilypond/lily/beam.cc
diff -u lilypond/lily/beam.cc:1.317 lilypond/lily/beam.cc:1.318
--- lilypond/lily/beam.cc:1.317 Sun Oct 16 13:28:20 2005
+++ lilypond/lily/beam.cc       Sun Oct 16 14:09:30 2005
@@ -544,18 +544,18 @@
        }
     }
 
-  SCM func = me->get_property ("dir-function");
-  SCM s = scm_call_2 (func,
-                     scm_cons (scm_from_int (count[UP]),
-                               scm_from_int (count[DOWN])),
-                     scm_cons (scm_from_int (total[UP]),
-                               scm_from_int (total[DOWN])));
-
-  if (scm_is_number (s) && scm_to_int (s))
-    return to_dir (s);
-
-  /* If dir is not determined: get default */
-  return to_dir (me->get_property ("neutral-direction"));
+  Direction dir = CENTER;
+  
+  if (Direction d =  (Direction) sign (count[UP] - count[DOWN]))
+    dir = d;
+  else if (Direction d = (Direction)  sign (total[UP] / count[UP] - 
total[DOWN]/count[DOWN]))
+    dir = d;
+  else if (Direction d = (Direction)  sign (total[UP] - total[DOWN]))
+    dir = d;
+  else
+    dir = to_dir (me->get_property ("neutral-direction"));
+  
+  return dir;
 }
 
 /* Set all stems with non-forced direction to beam direction.
@@ -1395,7 +1395,6 @@
               "damping "
               "details "
               "direction " 
-              "dir-function "
               "flag-width-function "
               "gap "
               "gap-count "
Index: lilypond/lily/grob.cc
diff -u lilypond/lily/grob.cc:1.149 lilypond/lily/grob.cc:1.150
--- lilypond/lily/grob.cc:1.149 Sun Oct 16 13:52:42 2005
+++ lilypond/lily/grob.cc       Sun Oct 16 14:09:30 2005
@@ -732,7 +732,7 @@
               "meta "
               "minimum-X-extent "
               "minimum-Y-extent "
-              "spacing-procedure "
+              "springs-and-rods "
               "staff-symbol "
               "stencil "
               "transparent"
Index: lilypond/lily/note-head.cc
diff -u lilypond/lily/note-head.cc:1.156 lilypond/lily/note-head.cc:1.157
--- lilypond/lily/note-head.cc:1.156    Sun Oct 16 13:52:42 2005
+++ lilypond/lily/note-head.cc  Sun Oct 16 14:09:30 2005
@@ -154,7 +154,7 @@
               "note-names "
               "glyph-name-procedure "
               "accidental-grob "
-              "stem-attachment"
+              "stem-attachment "
               "style "
               );
 
Index: lilypond/lily/stem.cc
diff -u lilypond/lily/stem.cc:1.282 lilypond/lily/stem.cc:1.283
--- lilypond/lily/stem.cc:1.282 Sun Oct 16 13:52:42 2005
+++ lilypond/lily/stem.cc       Sun Oct 16 14:09:30 2005
@@ -317,6 +317,8 @@
       length -= shorten;
     }
 
+  length *= robust_scm2double (me->get_property ("length-fraction"), 1.0);
+
   /* Tremolo stuff.  */
   Grob *t_flag = unsmob_grob (me->get_object ("tremolo-flag"));
   if (t_flag && !unsmob_grob (me->get_object ("beam")))
@@ -805,6 +807,8 @@
   /* Simple standard stem length */
   SCM details = me->get_property ("details");
   SCM lengths = scm_cdr (scm_assq (ly_symbol2scm ("beamed-lengths"), details));
+
+  
   Real ideal_length
     = scm_to_double (robust_list_ref (beam_count - 1, lengths))
 
@@ -815,9 +819,12 @@
 
   /* Condition: sane minimum free stem length (chord to beams) */
   lengths = scm_cdr (scm_assq (ly_symbol2scm ("beamed-minimum-free-lengths"), 
details));
+  Real length_fraction
+    = robust_scm2double (me->get_property ("length-fraction"), 1.0);
+
   Real ideal_minimum_free
     = scm_to_double (robust_list_ref (beam_count - 1, lengths))
-    * staff_space;
+    * staff_space * length_fraction;
 
   /* UGH
      It seems that also for ideal minimum length, we must use
@@ -872,7 +879,8 @@
 
   ideal_y -= robust_scm2double (beam->get_property ("shorten"), 0);
 
-  SCM bemfl = scm_cdr (scm_assq (ly_symbol2scm 
("beamed-extreme-minimum-free-lengths"), details));
+  SCM bemfl = scm_cdr (scm_assq (ly_symbol2scm 
("beamed-extreme-minimum-free-lengths"),
+                                details));
   
   Real minimum_free
     = scm_to_double (robust_list_ref (beam_count - 1, bemfl))
@@ -944,6 +952,7 @@
               "flag-style "
               "french-beaming "
               "length "
+              "length-fraction "
               "neutral-direction "
               "no-stem-extend "
               "note-heads "
Index: lilypond/lily/system.cc
diff -u lilypond/lily/system.cc:1.125 lilypond/lily/system.cc:1.126
--- lilypond/lily/system.cc:1.125       Sun Oct 16 11:36:37 2005
+++ lilypond/lily/system.cc     Sun Oct 16 14:09:30 2005
@@ -291,9 +291,7 @@
   for (int i = 0; i < all_elements_->size (); i++)
     {
       Grob *e = all_elements_->grob (i);
-      SCM proc = e->get_property ("spacing-procedure");
-      if (ly_is_procedure (proc))
-       scm_call_1 (proc, e->self_scm ());
+      (void) e->get_property ("springs-and-rods");
     }
 }
 
Index: lilypond/ly/engraver-init.ly
diff -u lilypond/ly/engraver-init.ly:1.257 lilypond/ly/engraver-init.ly:1.258
--- lilypond/ly/engraver-init.ly:1.257  Sun Oct 16 01:29:48 2005
+++ lilypond/ly/engraver-init.ly        Sun Oct 16 14:09:30 2005
@@ -550,21 +550,10 @@
   metronomeMarkFormatter = #format-metronome-markup
   graceSettings = #`(
     (Voice Stem direction 1)
-    ;; TODO: should take from existing definition.
-    ;; c&p from define-grobs.scm
-    
-    (Voice Stem lengths ,(map (lambda (x) (* 0.8 x)) '(3.5 3.5 3.5 4.5 5.0)))
-    (Voice Stem stem-shorten (0.4 0.4))
-    (Voice Stem  font-size -3)
+    (Voice Stem font-size -3)
     (Voice NoteHead  font-size -3)
-    (Voice Dots  font-size -3)
-    (Voice Stem beamed-lengths  
-     ,(map (lambda (x) (* 0.8 x)) '(3.3 3.3 4.0)))
-    (Voice Stem beamed-minimum-free-lengths  
-     ,(map (lambda (x) (* 0.8 x)) '(2.5 2.0 1.5)))
-    (Voice Stem beamed-extreme-minimum-free-lengths  
-     ,(map (lambda (x) (* 0.8 x)) '(1.83 1.5)))
-
+    (Voice Dots font-size -3)
+    (Voice Stem length-fraction 0.8)
     (Voice Stem no-stem-extend #t)
     (Voice Beam thickness 0.384)
     (Voice Beam space-function ,(lambda (beam mult)
Index: lilypond/python/convertrules.py
diff -u lilypond/python/convertrules.py:1.19 
lilypond/python/convertrules.py:1.20
--- lilypond/python/convertrules.py:1.19        Sun Oct 16 11:36:37 2005
+++ lilypond/python/convertrules.py     Sun Oct 16 14:09:30 2005
@@ -2584,7 +2584,7 @@
                     '''outputProperty -> overrideProperty'''))
 
 def conv (str):
-       if 
re.search(r'(after-line-breaking-callback|before-line-breaking-callback|print-function)',
 str):
+       if 
re.search(r'(spacing-procedure|after-line-breaking-callback|before-line-breaking-callback|print-function)',
 str):
                error_file.write ("""
 
 Conversion rules for 2.7.13 layout engine refactoring haven't been written yet.
Index: lilypond/scm/define-grob-properties.scm
diff -u lilypond/scm/define-grob-properties.scm:1.129 
lilypond/scm/define-grob-properties.scm:1.130
--- lilypond/scm/define-grob-properties.scm:1.129       Sun Oct 16 13:52:42 2005
+++ lilypond/scm/define-grob-properties.scm     Sun Oct 16 14:09:31 2005
@@ -152,20 +152,6 @@
      (arrow-length ,number? "Arrow length.")
      (arrow-width ,number? "Arrow width.")
 
-     ;; todo: why is this tunable?
-     (dir-function ,procedure? "The function to determine the
-direction of a beam. Choices include: 
-
[EMAIL PROTECTED] @code
[EMAIL PROTECTED] beam-dir-majority
-number count of up or down notes
[EMAIL PROTECTED] beam-dir-mean
-mean center distance of all notes
[EMAIL PROTECTED] beam-dir-median.
-mean center distance weighted per note
[EMAIL PROTECTED] table
-
-")
      
      (direction ,ly:dir? "Up or down, left or right?")
      (dot-color ,symbol? "Color of dots.  Options include 
@@ -290,9 +276,11 @@
 second for staff space. Both contributions are added.")
      (left-padding ,ly:dimension? "The amount of space that is put
 left to a group of accidentals.")
+     
      (length ,ly:dimension? "User override for the stem length of
 unbeamed stems.")
-     (length-fraction ,number? "Length of ledger line as fraction of note head 
size.")
+     (length-fraction ,number? "Multiplier for lengths. Used for
+determining ledger lines and stem lengths.")
 
      (line-break-system-details ,list?
                                "Alist of properties to use when this
@@ -321,8 +309,8 @@
 dimension, measured in staff space.")
      (minimum-Y-extent ,number-pair? "See @code{minimum-Y-extent}.")
      (minimum-length ,ly:dimension? "Try to make a spanner at least
-this long. This requires an appropriate routine for the
[EMAIL PROTECTED] property.")
+this long. This requires an appropriate callback for the
[EMAIL PROTECTED] property.")
      (minimum-space ,ly:dimension? "Minimum distance that the victim
 should move (after padding).")
      (neutral-direction ,ly:dir? "Which direction to take in the
@@ -410,9 +398,7 @@
 duration. Typically, the width of a note head. See also
 @internalsref{spacing-spanner-interface}.")
 
-     (spacing-procedure ,procedure? "Procedure for calculating spacing
-parameters.  The routine is called after
[EMAIL PROTECTED]")
+     (springs-and-rods ,boolean? "Dummy variable for triggering spacing 
routines.")
      (stacking-dir ,ly:dir? "Stack objects in which direction?")
      (staff-space ,ly:dimension? "Amount of space between staff lines,
 expressed in global staffspace.")
Index: lilypond/scm/define-grobs.scm
diff -u lilypond/scm/define-grobs.scm:1.252 lilypond/scm/define-grobs.scm:1.253
--- lilypond/scm/define-grobs.scm:1.252 Sun Oct 16 13:52:42 2005
+++ lilypond/scm/define-grobs.scm       Sun Oct 16 14:09:31 2005
@@ -270,7 +270,6 @@
        ;; TODO: should be in SLT.
        (thickness . 0.48) ; in staff-space
        (neutral-direction . -1)
-       (dir-function . ,beam-dir-majority-median)
 
        ;; Whe have some unreferenced problems here.
        ;;
@@ -409,8 +408,9 @@
 
     (ClusterSpanner
      . (
-       (callbacks . ((stencil . ,Cluster::print)))
-       (spacing-procedure . ,Spanner::set_spacing_rods)
+       (callbacks . ((springs-and-rods . ,Spanner::set_spacing_rods)
+                     (stencil . ,Cluster::print)))
+       
        (minimum-length . 0.0)
        (padding . 0.25)
        (style . ramp)
@@ -419,8 +419,8 @@
 
     (ChordName
      . (
-       (callbacks . ((stencil . ,Text_interface::print)))
-       (callbacks . ((after-line-breaking . ,Chord_name::after_line_breaking)
+       (callbacks . ((stencil . ,Text_interface::print)
+                     (after-line-breaking . ,Chord_name::after_line_breaking)
                      ))
        (word-space . 0.0)
        (font-family . sans)
@@ -648,10 +648,10 @@
      . (
        
        (callbacks . ((stencil . ,Hairpin::print)
+                     (springs-and-rods . ,Spanner::set_spacing_rods)
                      (after-line-breaking . ,Hairpin::after_line_breaking)))
        (thickness . 1.0)
        (height . 0.6666)
-       (spacing-procedure . ,Spanner::set_spacing_rods)
        (minimum-length . 2.0)
        (bound-padding . 1.0)
        (self-alignment-Y . 0)
@@ -762,12 +762,13 @@
     
     (LedgerLineSpanner
      . (
-       (callbacks . ((stencil . ,Ledger_line_spanner::print)))
+       (callbacks . ((springs-and-rods . 
,Ledger_line_spanner::set_spacing_rods)
+                     
+                     (stencil . ,Ledger_line_spanner::print)))
        (X-extent-callback . #f)
        (Y-extent-callback . #f)
        (minimum-length-fraction . 0.25)
        (length-fraction . 0.25)
-       (spacing-procedure . ,Ledger_line_spanner::set_spacing_rods)
        (layer . 0)
        (meta . ((class . Spanner)
                 (interfaces . (ledger-line-interface))))))
@@ -821,7 +822,7 @@
        (length . 0.66)
        (minimum-length . 0.3)
        (padding . 0.07)
-                                       ;       (spacing-procedure . 
,Hyphen_spanner::set_spacing_rods)
+                                       ;       (springs-and-rods . 
,Hyphen_spanner::set_spacing_rods)
        (callbacks . ((stencil . ,Hyphen_spanner::print)))
        (Y-extent . (0 . 0))
        (meta . ((class . Spanner)
@@ -904,8 +905,8 @@
 
     (MultiMeasureRestNumber
      . (
-       (callbacks . ((stencil . ,Text_interface::print)))
-       (spacing-procedure . ,Multi_measure_rest::set_spacing_rods)
+       (callbacks . ((springs-and-rods . ,Multi_measure_rest::set_spacing_rods)
+                     (stencil . ,Text_interface::print)))
        (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self
                               
,Self_alignment_interface::centered_on_other_axis_parent))
        (Y-offset-callbacks . (,Side_position_interface::aligned_side))
@@ -1057,11 +1058,11 @@
      . ((slur-details . ,default-slur-details)
        (callbacks . ((control-points . ,Slur::calc_control_points)
                      (direction . ,Slur::calc_direction)
+                     (springs-and-rods . ,Spanner::set_spacing_rods)
                      (stencil . ,Slur::print)                
                      ))
        
        (thickness . 1.1)
-       (spacing-procedure . ,Spanner::set_spacing_rods)
        (minimum-length . 1.5)
        (Y-extent-callback . ,Slur::height)
        (height-limit . 2.0)
@@ -1088,8 +1089,8 @@
 
     (PercentRepeat
      . (
-       (spacing-procedure . ,Multi_measure_rest::set_spacing_rods)
-       (callbacks . ((stencil . ,Multi_measure_rest::percent)))
+       (callbacks . ((springs-and-rods . ,Multi_measure_rest::set_spacing_rods)
+                     (stencil . ,Multi_measure_rest::percent)))
        (slope . 1.0)
        (thickness . 0.48)
        (font-encoding . fetaMusic)
@@ -1229,7 +1230,8 @@
 
     (SeparatingGroupSpanner
      . (
-       (spacing-procedure . ,Separating_group_spanner::set_spacing_rods)
+       (callbacks . ((springs-and-rods . 
,Separating_group_spanner::set_spacing_rods)
+                     ))
        (meta . ((class . Spanner)
                 (interfaces . (only-prebreak-interface
                                spacing-interface
@@ -1239,10 +1241,10 @@
      . ((slur-details . ,default-slur-details)
        (callbacks . ((control-points . ,Slur::calc_control_points)
                      (direction . ,Slur::calc_direction)
+                     (springs-and-rods . ,Spanner::set_spacing_rods)
                      (stencil . ,Slur::print)
                      ))
        (thickness . 1.0)
-       (spacing-procedure . ,Spanner::set_spacing_rods)
        (minimum-length . 1.5)
        (Y-extent-callback . ,Slur::height)
                                        ; Slur::height)
@@ -1253,7 +1255,7 @@
 
     (SpacingSpanner
      . (
-       (spacing-procedure . ,Spacing_spanner::set_springs)
+       (callbacks . ((springs-and-rods . ,Spacing_spanner::set_springs)))
        (grace-space-factor . 0.6)
        (shortest-duration-space . 2.0)
        (spacing-increment . 1.2)


_______________________________________________
Lilypond-cvs mailing list
Lilypond-cvs@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-cvs

Reply via email to