]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.5.42
authorfred <fred>
Wed, 27 Mar 2002 02:06:57 +0000 (02:06 +0000)
committerfred <fred>
Wed, 27 Mar 2002 02:06:57 +0000 (02:06 +0000)
lily/gourlay-breaking.cc
lily/include/beam.hh
lily/include/lily-guile.hh
lily/include/stem-info.hh
lily/simple-spacer.cc
lily/stem.cc
scm/beam.scm
scm/grob-description.scm
scm/interface-description.scm

index 96728b602a9f3d402cbca308663b065e9980ef85..b61a750562d3c6718cd8d3ff702a54be32ab9d78 100644 (file)
@@ -207,9 +207,15 @@ Gourlay_breaking::combine_demerits (Column_x_positions const &prev,
        }
     }
 
+#if 1
+  /*
+    Q: do want globally non-cramped lines, or locally equally cramped lines. 
+   */
   Real demerit = abs (this_one.force_f_) + abs (prev.force_f_ - this_one.force_f_)
     + break_penalties;
-
+#else
+  Real demerit = abs (this_one.force_f_) + break_penalties;
+#endif
 
    if (!this_one.satisfies_constraints_b_)
      {
index c0c7c2893333ce6a871bcfab4913beda7991ccb4..86c539d8ffadb5d7595de15554f2af7caa05ce3f 100644 (file)
@@ -35,7 +35,12 @@ public:
   DECLARE_SCHEME_CALLBACK (check_concave, (SCM));
   DECLARE_SCHEME_CALLBACK (slope_damping, (SCM));
   DECLARE_SCHEME_CALLBACK (quantise_position, (SCM));
-
+  DECLARE_SCHEME_CALLBACK (new_quanting, (SCM));
+  DECLARE_SCHEME_CALLBACK (score_slopes_dy, (SCM, SCM,SCM));
+  DECLARE_SCHEME_CALLBACK (score_stem_lengths, (SCM, SCM,SCM));
+  DECLARE_SCHEME_CALLBACK (score_forbidden_quants, (SCM, SCM,SCM));
+  
+  
   static Molecule stem_beams (Grob*,Item *here, Item *next, Item *prev,
                              Real dydx);
 
index d4ea1f81926547f10755d17bfbcf544b7593e021..a5d1b283aa89f628b2c4ed7dc9ffb55e0374227a 100644 (file)
@@ -219,10 +219,12 @@ typedef SCM (*Scheme_function_unknown) ();
 typedef SCM (*Scheme_function_0) ();
 typedef SCM (*Scheme_function_1) (SCM);
 typedef SCM (*Scheme_function_2) (SCM,SCM);     
+typedef SCM (*Scheme_function_3) (SCM,SCM, SCM);        
 #else
 typedef SCM (*Scheme_function_0) (...);
 typedef SCM (*Scheme_function_1) (...);
 typedef SCM (*Scheme_function_2) (...);
+typedef SCM (*Scheme_function_3) (...);
 #endif
 
 #define DECLARE_SCHEME_CALLBACK(NAME,ARGS) \
index 25c0a8eec2362bd2f688bd0be3a9a1724ce87958..d4496a442db315aa564c1ea966f044c6895a456c 100644 (file)
 
 #include "real.hh"
 
+/*
+  Parameters for a stem, (multiply with stemdirection, to get real values
+  for a downstem.)
+  
+ */
 struct Stem_info 
 {
   Real idealy_f_;
index f6a36eaa489257027d8694311b2cd9d53b9db96c..fa75e433a7cdcbb8ad96607461db8b2922ae04e5 100644 (file)
@@ -317,9 +317,10 @@ void
 Simple_spacer::solve (Column_x_positions *positions) const
 {
   positions->force_f_ = force_f_;
-  if (compression_penalty_b_ &&  (force_f_ < 0))
+  if ((force_f_ < 0))
     {
-
+      positions->force_f_ *= 1.3; 
+      if (compression_penalty_b_)
        positions->force_f_ *= 2; //  hmm.
     }
   
index e69de92f549e16faf7cce22445d4bb20454883db..3268f31bca496608fda23ba25ada96ffd54c1a0e 100644 (file)
@@ -660,6 +660,19 @@ Stem::beam_l (Grob*me)
 Stem_info
 Stem::calc_stem_info (Grob*me) 
 {
+  SCM scm_info = me->get_grob_property ("stem-info");
+
+  if (gh_pair_p (scm_info ))
+    {
+      Stem_info si ;
+
+      si.idealy_f_ = gh_scm2double (gh_car (scm_info)); 
+      si.maxy_f_ = gh_scm2double (gh_cadr (scm_info)); 
+      si.miny_f_ = gh_scm2double (gh_caddr (scm_info));
+
+      return si;
+    }
+    
   Grob * beam = beam_l (me);
 
   Direction beam_dir = Directional_element_interface::get (beam);
@@ -715,7 +728,7 @@ Stem::calc_stem_info (Grob*me)
          info.idealy_f_ += thick + (multiplicity - 1) * interbeam_f;
        }
       info.miny_f_ = info.idealy_f_;
-      info.maxy_f_ = INT_MAX;
+      info.maxy_f_ = 1000;  // INT_MAX;
 
       info.idealy_f_ += stem_length;
       info.miny_f_ += minimum_length;
@@ -749,7 +762,7 @@ Stem::calc_stem_info (Grob*me)
     {
       info.idealy_f_ -= thick;
       info.maxy_f_ = info.idealy_f_;
-      info.miny_f_ = -INT_MAX;
+      info.miny_f_ = - 1000 ; // INT_MAX;
 
       info.idealy_f_ -= stem_length;
       info.maxy_f_ -= minimum_length;
@@ -770,6 +783,12 @@ Stem::calc_stem_info (Grob*me)
   info.miny_f_ += interstaff_f;
   info.maxy_f_ += interstaff_f ;
 
+  me->set_grob_property ("stem-info",
+                        scm_list_n (gh_double2scm (info.idealy_f_),
+                                    gh_double2scm (info.maxy_f_ ),
+                                    gh_double2scm (info.miny_f_),
+                                    SCM_UNDEFINED));
+  
   return info;
 }
 
index efcc28835eafde51a5fd3543f14590bc9e55e91b..4ab5e2eb4bd3ab6f5539623f258715a774b325a6 100644 (file)
     ;; period: 1 (staff-space)
     (append quants (list (+ 1 (car quants))))))
 
+(define (default-left-beam-pos-quants beam multiplicity dir dy staff-line)
+  (default-beam-pos-quants beam multiplicity 1 staff-line))
+;;
+(define (foo beam multiplicity dir dy staff-line)
+  (let* ((beam-straddle 0)
+        (thick (ly-get-grob-property beam 'thickness))
+        (beam-sit (/ (- thick staff-line) 2))
+        (beam-hang (- 1 (/ (- thick staff-line) 2)))
+        (quants '())
+        )
+
+    (if (or (<= multiplicity 1)
+           (and (not (equal? dir 1))
+                (not (< dy 0))))
+       (set! quants (cons beam-sit quants)))
+    (if (or (<= multiplicity 1)
+           (and (not (equal? dir -1))
+                (not (> dy 0))))
+       (set! quants (cons beam-hang quants)))
+    (if (or (<= multiplicity 2) (>= (abs dy) (/ staff-line 2)))
+       (set! quants (cons beam-straddle quants)))
+    ;; period: 1 (staff-space)
+    (append quants (list (+ 1 (car quants))))))
+
+(define (default-right-beam-pos-quants beam multiplicity dir dy staff-line)
+  (default-beam-pos-quants beam multiplicity 1 staff-line))
+;;
+(define (foo beam multiplicity dir dy staff-line)
+  (let* ((beam-straddle 0)
+        (thick (ly-get-grob-property beam 'thickness))
+        (beam-sit (/ (- thick staff-line) 2))
+        (beam-hang (- 1 (/ (- thick staff-line) 2)))
+        (quants '())
+        )
+
+    
+    (if (or (<= multiplicity 1)
+           (and (not (equal? dir 1))
+                (not (> dy 0))))
+       (set! quants (cons beam-sit quants)))
+    (if (or (<= multiplicity 1)
+           (and (not (equal? dir -1))
+                (not (< dy 0))))
+       (set! quants (cons beam-hang quants)))
+    (if (or (<= multiplicity 2) (>= (abs dy) (/ staff-line 2)))
+       (set! quants (cons beam-straddle quants)))
+    ;; period: 1 (staff-space)
+    (append quants (list (+ 1 (car quants))))))
+
 (define (beam-traditional-pos-quants beam multiplicity dy staff-line)
   (let* ((beam-straddle 0)
        (thick (ly-get-grob-property beam 'thickness))
index fcb3f3b90f4b91207151a4366afc50f8ba4a45f5..d6e3d431a2677124f469f1dccdafae64ee57fba0 100644 (file)
        (position-callbacks . (,Beam::least_squares
                               ,Beam::check_concave
                               ,Beam::slope_damping
-                              ,Beam::quantise_position))
+                              ,Beam::new_quanting
+                              ))
        
        (thickness . 0.48) ; in staff-space
        (before-line-breaking-callback . ,Beam::before_line_breaking)
                                         ,Beam::end_after_line_breaking))
        (neutral-direction . -1)
        (dir-function . ,beam-dir-majority)
-       (vertical-position-quant-function . ,default-beam-pos-quants)
+       (left-position-quant-function . ,default-left-beam-pos-quants)
+       (right-position-quant-function . ,default-right-beam-pos-quants)
        (beamed-stem-shorten . (1.0 0.5))
        (outer-stem-length-limit . 0.2)
        (slope-limit . 0.2)
        (space-function . ,default-beam-space-function)
        (damping . 1)
        (auto-knee-gap . 7)
+       (font-name . "cmr10")
+       (quant-score-functions . (,Beam::score_forbidden_quants
+                                 ,Beam::score_slopes_dy
+                                 ,Beam::score_stem_lengths
+                                 ))
        (meta . ,(grob-description beam-interface))
        ))
 
index dd05c80db01e02f0df3ca9ea91474e7840e40f8b..38499a65b4cab1f0481e418f7de893d2eb1b3136 100644 (file)
 #'thickness= weight of beams, in staffspace
   "
  '(auto-knee-gap
-   staff-position
-   height
-   flag-width-function 
-   damping 
-   neutral-direction 
-   thickness 
-   space-function 
    beamed-stem-shorten 
-   height-quants 
-   vertical-position-quant-function 
    damping 
+   flag-width-function 
+   neutral-direction 
    outer-stem-length-limit 
+   positions
    slope-limit 
-   auto-knee-gap
+   space-function 
+   thickness 
+   vertical-position-quant-function 
    )
  )