]> git.donarmstrong.com Git - lilypond.git/commitdiff
* ly/engraver-init.ly (AncientRemoveEmptyStaffContext): use length-fraction.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 16 Oct 2005 14:09:31 +0000 (14:09 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 16 Oct 2005 14:09:31 +0000 (14:09 +0000)
* 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.

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

index 7e3e6c77e569cec095d3b10644e9a195772defb4..bf4cd713839cfb7d0e905ac98ea8042672a0e27a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2005-10-16  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * 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 2ee9e7086c67c6b15fd1e277d3d785eae799102c..c4fc1147c4a26f4c084d3a82c715a9f44ab5c171 100644 (file)
@@ -544,18 +544,18 @@ Beam::get_default_dir (Grob *me)
        }
     }
 
-  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 @@ ADD_INTERFACE (Beam,
               "damping "
               "details "
               "direction " 
-              "dir-function "
               "flag-width-function "
               "gap "
               "gap-count "
index 3cde28542814acc827193021c7118de4faa44f55..38edbaf78528aaf0b81ad0b2cd64e30922c46e2c 100644 (file)
@@ -732,7 +732,7 @@ ADD_INTERFACE (Grob, "grob-interface",
               "meta "
               "minimum-X-extent "
               "minimum-Y-extent "
-              "spacing-procedure "
+              "springs-and-rods "
               "staff-symbol "
               "stencil "
               "transparent"
index 2517f5048b562866b46cdacd7d24310095681fee..eff41c8339736b9a8e360a6801562ccd74208344 100644 (file)
@@ -154,7 +154,7 @@ ADD_INTERFACE (Note_head, "note-head-interface",
               "note-names "
               "glyph-name-procedure "
               "accidental-grob "
-              "stem-attachment"
+              "stem-attachment "
               "style "
               );
 
index 758afae3c7f8ce359b12c5c38eaa2cf55834cb74..296a5f00caab48e15a09b316e5317fe88afe6667 100644 (file)
@@ -317,6 +317,8 @@ Stem::calc_length (SCM smob)
       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 @@ Stem::calc_stem_info (SCM smob)
   /* 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 @@ Stem::calc_stem_info (SCM smob)
 
   /* 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 @@ Stem::calc_stem_info (SCM smob)
 
   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 @@ ADD_INTERFACE (Stem, "stem-interface",
               "flag-style "
               "french-beaming "
               "length "
+              "length-fraction "
               "neutral-direction "
               "no-stem-extend "
               "note-heads "
index 0ca8cfda14383e1aaa00eef2d42650d982a9dc25..60bdfeed59b017bb9d74e84b46c4dd20bcdc36d7 100644 (file)
@@ -291,9 +291,7 @@ System::pre_processing ()
   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 f37e9b5b101e25fad9c39795bf795d413e4742b5..c2576b312c29bb6846a29aaaf4a645d9b48a7511 100644 (file)
@@ -550,21 +550,10 @@ AncientRemoveEmptyStaffContext = \context {
   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 15913c841420bba1bf20c28a41fc50fa416bf9e5..d6ebe80f9b35ea998f50178c66b2a9039dbb3325 100644 (file)
@@ -2584,7 +2584,7 @@ conversions.append (((2, 7, 12), conv,
                     '''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 4ebb7665d82d8c678be36d0c9fc96d38acd65ee6..0c2d656d36a4fa2c8f97cc1e88f05e4f3cc1cc10 100644 (file)
@@ -152,20 +152,6 @@ line).")
      (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: 
-
-@table @code
-@item beam-dir-majority
-number count of up or down notes
-@item beam-dir-mean
-mean center distance of all notes
-@item beam-dir-median.
-mean center distance weighted per note
-@end table
-
-")
      
      (direction ,ly:dir? "Up or down, left or right?")
      (dot-color ,symbol? "Color of dots.  Options include 
@@ -290,9 +276,11 @@ sum of 2 numbers.  The first is the factor for line thickness, and the
 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 @@ and notes or beam.")
 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
-@code{spacing-procedure} property.")
+this long. This requires an appropriate callback for the
+@code{springs-and-rods} 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 @@ beams.")
 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
-@code{before-line-breaking-callback}.")
+     (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 d32ea32ef924811cfc90453e238411413efbfa4f..bf7384578905261c2963eb81e93eefa8ca245d70 100644 (file)
        ;; 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.
        ;;
 
     (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)
 
     (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)
      . (
        
        (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)
     
     (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))))))
        (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)
 
     (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))
      . ((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)
 
     (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)
 
     (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
      . ((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)
 
     (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)