]> git.donarmstrong.com Git - lilypond.git/commitdiff
*** empty log message ***
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 4 Feb 2005 16:13:33 +0000 (16:13 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 4 Feb 2005 16:13:33 +0000 (16:13 +0000)
lily/dimension-cache.cc
lily/grob.cc
lily/include/dimension-cache.hh
lily/include/rest-collision.hh
lily/rest-collision.cc
lily/rest.cc
mf/GNUmakefile

index e7ec1ea6581b5d837958672b5102ea0e67f78fe6..3d5a1a012c2b88020ef37621035d418e5b3e3657 100644 (file)
@@ -17,7 +17,7 @@ Dimension_cache::Dimension_cache (Dimension_cache const &d)
 {
   init ();
   dimension_ = d.dimension_;
-
+  dimension_callback_ = d.dimension_callback_;
   offset_ = d.offset_;
   offset_callbacks_ = d.offset_callbacks_;
   offsets_left_ = d.offsets_left_;
index a85266d427d5f89f52229a021a4a5cf04067f696..2ba0e243170d1546ee916d0166ced2247aff057d 100644 (file)
@@ -109,6 +109,7 @@ Grob::Grob (SCM basicprops,
          && ly_c_procedure_p (get_property ("print-function")))
        cb = stencil_extent_proc;
 
+      dim_cache_[a].dimension_callback_ = cb;
       dim_cache_[a].dimension_ = cb;
     }
 }
@@ -410,10 +411,11 @@ Grob::extent (Grob *refp, Axis a) const
 
   Dimension_cache *d = (Dimension_cache *) &dim_cache_[a];
   Interval ext;
-  if (scm_is_pair (d->dimension_))
+
+  SCM dimpair = d->dimension_;
+  if (scm_is_pair (dimpair))
     ;
   else if (ly_c_procedure_p (d->dimension_))
-    /* FIXME: add doco on types, and should typecheck maybe?  */
     d->dimension_ = scm_call_2 (d->dimension_, self_scm (), scm_int2num (a));
   else
     return ext;
@@ -610,6 +612,7 @@ Grob::mark_smob (SCM ses)
     {
       scm_gc_mark (s->dim_cache_[a].offset_callbacks_);
       scm_gc_mark (s->dim_cache_[a].dimension_);
+      scm_gc_mark (s->dim_cache_[a].dimension_callback_);
 
       /* Do not mark the parents.  The pointers in the mutable
         property list form two tree like structures (one for X
index 9f1da394fccc2d09f58744e576ace4d781c1083e..970b33db9c00eb26242f9519050cb01955444ce4 100644 (file)
@@ -24,7 +24,7 @@ struct Dimension_cache
     Multi typed:
 
      - cons: interval
-     - procedure: callback
+     - procedure: callback     
      - else: empty
    */
   SCM dimension_;
index 3da35e3764a0d85fcf1d8362dcdff6d4625acb13..a54a526a7701e5fbd73c1f4729737cf9921bc9c1 100644 (file)
@@ -23,6 +23,7 @@ public:
   
   static bool has_interface (Grob*);
   DECLARE_SCHEME_CALLBACK (force_shift_callback, (SCM element, SCM axis));
+  DECLARE_SCHEME_CALLBACK (force_shift_callback_rest, (SCM element, SCM axis));
   static SCM do_shift (Grob*);
 };
 #endif // REST_COLLISION_HH
index 81c477f4ba8a834e57c1856e6f23f1d9334024a3..7dd7c4cc3e5a2392365610ce4e27991a2a0bb263 100644 (file)
@@ -43,6 +43,20 @@ Rest_collision::force_shift_callback (SCM element_smob, SCM axis)
 }
 
 
+MAKE_SCHEME_CALLBACK (Rest_collision, force_shift_callback_rest, 2);
+SCM
+Rest_collision::force_shift_callback_rest (SCM rest, SCM axis)
+{
+  Grob *rest_grob = unsmob_grob (rest);
+  assert ((Axis) scm_to_int (axis) == Y_AXIS);
+
+  Grob *parent = rest_grob->get_parent (X_AXIS);
+  if (Note_column::has_interface (parent))
+    return force_shift_callback (parent->self_scm(), axis);
+  else
+    return scm_make_real (0.0);
+}
+
 
 void
 Rest_collision::add_column (Grob*me, Grob *p)
@@ -58,9 +72,14 @@ Rest_collision::add_column (Grob*me, Grob *p)
   */
   p->add_offset_callback (Rest_collision::force_shift_callback_proc, Y_AXIS);
   p->set_property ("rest-collision", me->self_scm ());
-}
-
 
+  Grob *rest = unsmob_grob (p->get_property ("rest"));
+  if (rest)
+    {
+      rest->add_offset_callback (Rest_collision::force_shift_callback_rest_proc,
+                                Y_AXIS);
+    }
+}
 
 /*
   TODO: look at horizontal-shift to determine ordering between rests
@@ -153,7 +172,7 @@ Rest_collision::do_shift (Grob *me)
 
       Real diff = 
        (ordered_rests[DOWN].top ()->extent (common, Y_AXIS)[UP]
-        - ordered_rests[UP].top ()->extent (common, Y_AXIS)[DOWN]) /staff_space;
+        - ordered_rests[UP].top ()->extent (common, Y_AXIS)[DOWN]) / staff_space;
 
       if (diff > 0)
        {
index 80062cfca27398efd24c49a988d1b0719d0435ca..80b473eb101ec6747ccccb247ada80b9837f0cbc 100644 (file)
@@ -41,12 +41,12 @@ Rest::after_line_breaking (SCM smob)
   if (d && bt > 4) // UGH.
     {
       d->set_property ("staff-position",
-                           scm_int2num ((bt == 7) ? 4 : 3));
+                      scm_int2num ((bt == 7) ? 4 : 3));
     }
   if (d && bt >= -1 && bt <= 1) // UGH again.
     {
       d->set_property ("staff-position",
-                           scm_int2num ((bt == 0) ? -1 : 1));
+                      scm_int2num ((bt == 0) ? -1 : 1));
     }
   return SCM_UNSPECIFIED;
 }
@@ -74,39 +74,42 @@ Rest::glyph_name (Grob *me, int balltype, String style, bool try_ledgers)
 
   String actual_style (style.to_str0 ());
 
-  if ((style == "mensural") || (style == "neomensural")) {
-
-    /*
-      FIXME: Currently, ancient font does not provide ledgered rests;
-      hence the "o" suffix in the glyph name is bogus.  But do we need
-      ledgered rests at all now that we can draw ledger lines with
-      variable width, length and blotdiameter? -- jr
-    */
-    ledgered_b = 0;
-
-    /*
-      There are no 32th/64th/128th mensural/neomensural rests.  In
-      these cases, revert back to default style.
-    */
-    if (balltype > 4)
+  if ((style == "mensural") || (style == "neomensural"))
+    {
+
+      /*
+       FIXME: Currently, ancient font does not provide ledgered rests;
+       hence the "o" suffix in the glyph name is bogus.  But do we need
+       ledgered rests at all now that we can draw ledger lines with
+       variable width, length and blotdiameter? -- jr
+      */
+      ledgered_b = 0;
+
+      /*
+       There are no 32th/64th/128th mensural/neomensural rests.  In
+       these cases, revert back to default style.
+      */
+      if (balltype > 4)
+       actual_style = "";
+    }
+
+  if ((style == "classical") && (balltype != 2))
+    {
+      /*
+       classical style: revert back to default style for any rest other
+       than quarter rest
+      */
       actual_style = "";
-  }
-
-  if ((style == "classical") && (balltype != 2)) {
-    /*
-      classical style: revert back to default style for any rest other
-      than quarter rest
-    */
-    actual_style = "";
-  }
-
-  if (style == "default") {
-    /*
-      Some parts of lily still prefer style "default" over "".
-      Correct this here. -- jr
-    */
-    actual_style = "";
-  }
+    }
+
+  if (style == "default")
+    {
+      /*
+       Some parts of lily still prefer style "default" over "".
+       Correct this here. -- jr
+      */
+      actual_style = "";
+    }
 
   return ("rests." + to_string (balltype) + (ledgered_b ? "o" : "")
          + actual_style);
@@ -145,6 +148,7 @@ Rest::print (SCM smob)
 {
   return brew_internal_stencil (smob, true);
 }
+
 MAKE_SCHEME_CALLBACK (Rest, extent_callback, 2);
 /*
   We need the callback. The real stencil has ledgers depending on
@@ -175,9 +179,10 @@ Rest::polyphonic_offset_callback (SCM smob, SCM)
     return scm_make_real (0);
 
   Direction d = get_grob_direction (me);
-  Real off = 2* d ;
+  Real off = 2 * d ;
   if (off)
     off *= Staff_symbol_referencer::staff_space (me);
+
   return scm_make_real (off);
 }
 
index dbeb90b8819a5fb522c68a1ad4e4bc96fc8dd568..f03f63d2a480f71c6605f56e76397fd69919eadc 100644 (file)
@@ -1,7 +1,7 @@
 depth = ..
 
 STEPMAKE_TEMPLATES=metafont install install-out
-LOCAL_STEPMAKE_TEMPLATES=lilypond
+LOCALSTEPMAKE_TEMPLATES=lilypond
 
 include $(depth)/make/stepmake.make