]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/main.cc (LY_DEFINE): add gmane address.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 2 Nov 2005 15:38:11 +0000 (15:38 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 2 Nov 2005 15:38:11 +0000 (15:38 +0000)
* lily/beam.cc: remove calc_positions()

* lily/include/grob.hh (class Grob): move pscore, dim_cache_,
original_ in private scope.
(class Grob): drop pscore_ pointer, change to output_def pointer.
(class Grob): cleanup class definition.

* ly/spanners-init.ly (assertBeamQuant): use make-simple-closure.

22 files changed:
ChangeLog
input/regression/beam-concave.ly
input/regression/beam-default-lengths.ly
input/regression/beam-shortened-lengths.ly
lily/beam.cc
lily/grob-property.cc
lily/grob.cc
lily/include/dimension-cache.hh
lily/include/grob.hh
lily/include/self-alignment-interface.hh
lily/lily-parser.cc
lily/main.cc
lily/paper-score.cc
lily/self-aligment-interface.cc
lily/spanner.cc
lily/system.cc
lily/tweak-registration.cc
ly/music-functions-init.ly
ly/spanners-init.ly
python/convertrules.py
scm/define-grobs.scm
scm/layout-beam.scm

index afef6167b11d7b40bcee90845d2f3b288eac7ece..3c5e3926e7edb70a7c0835bbd8e8144837d4fba6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2005-11-02  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * lily/main.cc (LY_DEFINE): add gmane address.
+
+       * lily/beam.cc: remove calc_positions()
+
        * lily/include/grob.hh (class Grob): move pscore, dim_cache_,
        original_ in private scope.
        (class Grob): drop pscore_ pointer, change to output_def pointer.
index 2cd8fcbd894a5420fcc4d86c4d8ca4adc6d46480..077dd2bcc9cb6252155e287936fe45e4b007f154 100644 (file)
@@ -2,20 +2,20 @@
 \version "2.7.13"
 \header{
 
-texidoc = "Fully concave beams should be horizontal. Informally spoken,
+  texidoc = "Fully concave beams should be horizontal. Informally spoken,
   concave refers to the shape of the notes that are opposite a
   beam. If an up-beam has high notes on its center stems, then we call
   it concave.
 
+  If a beam is fails a test, the desired slope is printed next to it.
 
-  If a beam is fails a test, the desired slope is printed
-next to it."
+" 
 }
 
 
 resetMeasure = \set Score.measurePosition = #(ly:make-moment 0 1)
 
-% examples from 
+%% examples from Ross.
 rossFourBeams =\relative c'' {
   \time 2/4
   c8[ e b c]
@@ -31,7 +31,7 @@ rossFourBeams =\relative c'' {
   f,,[ b a g]
   f[g g e]
   a[ d, b' g]
-  }
+}
 rossThreeBeams = \relative c'' {
   \time 6/8
   e[ a, c] f[ d g]
@@ -47,8 +47,7 @@ rossThreeBeams = \relative c'' {
 rossBeams = \relative c'' {
   \rossFourBeams
   \rossThreeBeams
-  }
-
+}
 
 \layout{
   raggedright = ##t
@@ -59,8 +58,12 @@ rossBeams = \relative c'' {
 
 
 #(define (<> x y) (not (= x  y)))
-   \new Voice {
-     \override Beam #'position-callbacks = #(check-slope-callbacks =)
-     \rossBeams
-     
-   }
+\new Voice {
+  \override Beam #'positions = #(ly:make-simple-closure
+                                (ly:make-simple-closure
+                                 (append
+                                  (list chain-grob-member-functions `(,cons 0 0))
+                                  (check-slope-callbacks =))))
+  \rossBeams
+  
+}
index 4321247b2532695de2dabad8eb681b4c2e16183e..e066c1b60992517a888c49663e8663b7a4736654 100644 (file)
@@ -3,14 +3,20 @@
 \version "2.7.13"
 
 \header{
-    texidoc="Beamed stems have standard lengths if possible. Quantization is switched off in this example."
-    }
+  texidoc="Beamed stems have standard lengths if possible. Quantization is switched off in this example."
+}
 
 \relative c'{
-  \override Beam  #'position-callbacks =
-  #`(,Beam::least_squares
-     ,Beam::check_concave
-     ,Beam::slope_damping)
+  \override Beam #'position =
+  #(ly:make-simple-closure
+    (ly:make-simple-closure
+     (list chain-grob-member-functions
+      `(,cons 0 0)
+      Beam::calc_least_squares_positions
+      Beam::slope_damping
+      Beam::shift_region_to_valid
+      Beam::set_stem_lengths
+    )))
 
   f4  f8[ f]  f16[ f]  f32[ f]  f64[ f]  f128[ f] 
 }
index 775c0feed2401f34f79aada29125283af9bf18e3..9705fbf64335ae533f436371410e8be68db5b41c 100644 (file)
@@ -2,16 +2,23 @@
 \version "2.7.13"
 
 \header{
-    texidoc="Beams in unnatural direction, have shortened stems, but do not look too short."
-    }
+  texidoc="Beams in unnatural direction, have shortened stems, but do not look too short."
+}
 \layout{ raggedright = ##t }
 
 
 \relative c'{
-  \override Beam  #'position-callbacks =
-  #`(,Beam::least_squares
-     ,Beam::check_concave
-     ,Beam::slope_damping)
+  \override Beam  #'positions =
+  #(ly:make-simple-closure
+    (ly:make-simple-closure
+     (list chain-grob-member-functions
+      `(,cons 0 0)
+      Beam::calc_least_squares_positions
+      Beam::slope_damping
+      Beam::shift_region_to_valid
+      Beam::set_stem_lengths
+    )))
+  
   \stemUp
   f'4  f8[ f]  f16[ f]  f32[ f]  f64[ f]  f128[ f] 
 }
index 6ad45126d73be3adae9b114e088edb190fb4f6e1..71a0933a1899959fa00519d5c10f2de3cc8b00fa 100644 (file)
@@ -723,26 +723,6 @@ Beam::set_stem_shorten (Grob *me)
     me->set_property ("shorten", scm_from_double (shorten));
 }
 
-MAKE_SCHEME_CALLBACK (Beam, calc_positions, 1);
-SCM
-Beam::calc_positions (SCM smob)
-{
-  Grob *me = unsmob_grob (smob);
-  if (!me->is_live ())
-    return SCM_EOL;
-
-  (void) me->get_property ("direction");
-  
-  SCM posns = scm_cons (SCM_BOOL_F, SCM_BOOL_F);
-  me->set_property ("positions", posns);
-
-  SCM callbacks = me->get_property ("position-callbacks");
-  for (SCM i = callbacks; scm_is_pair (i); i = scm_cdr (i))
-    scm_call_1 (scm_car (i), me->self_scm ());
-
-  return SCM_UNSPECIFIED;
-}
-
 
 
 void
index 59a3cd68f2a2e79cf6ad3701a84320646c1812e7..168a120f41fa1f84be6ef724c22a7ae4f4ba9140 100644 (file)
@@ -191,3 +191,10 @@ Grob::is_live () const
 {
   return immutable_property_alist_ != SCM_EOL;
 }
+
+
+bool
+Grob::internal_has_interface (SCM k)
+{
+  return scm_c_memq (k, interfaces_) != SCM_BOOL_F;
+}
index abad363e6cd07a7adf07f7b919d9ae58d3db31dd..514eb57b0361e17b0c2c25b0ee390c62fb6af8c7 100644 (file)
 
 
 
-MAKE_SCHEME_CALLBACK(Grob, y_parent_positioning, 1);
-SCM
-Grob::y_parent_positioning (SCM smob)
-{
-  Grob *me = unsmob_grob (smob);
-  Grob *par = me->get_parent (Y_AXIS);
-  if (par)
-    (void) par->get_property ("positioning-done");
-
-  return scm_from_double (0.0);
-}
-
-
-MAKE_SCHEME_CALLBACK(Grob, x_parent_positioning, 1);
-SCM
-Grob::x_parent_positioning (SCM smob)
-{
-  Grob *me = unsmob_grob (smob);
-  
-  Grob *par = me->get_parent (X_AXIS);
-  if (par)
-    (void) par->get_property ("positioning-done");
-
-  return scm_from_double (0.0);
-}
 
 Grob *
 Grob::clone (int count) const
@@ -63,14 +38,6 @@ Grob::clone (int count) const
   return new Grob (*this, count);
 }
 
-/* TODO:
-
-- remove dynamic_cast<Spanner, Item> and put this code into respective
-subclass.  */
-
-#define HASH_SIZE 3
-#define INFINITY_MSG "Infinity or NaN encountered"
-
 Grob::Grob (SCM basicprops,
            Object_key const *key)
 {
@@ -127,46 +94,9 @@ Grob::Grob (Grob const &s, int copy_index)
 Grob::~Grob ()
 {
 }
-
-
-static SCM
-grob_stencil_extent (Grob *me, Axis a)
-{
-  Stencil *m = me->get_stencil ();
-  Interval e;
-  if (m)
-    e = m->extent (a);
-  return ly_interval2scm (e);
-}
-
-
-MAKE_SCHEME_CALLBACK (Grob, stencil_height, 1);
-SCM
-Grob::stencil_height (SCM smob)
-{
-  Grob *me = unsmob_grob (smob);
-  return grob_stencil_extent (me, Y_AXIS);
-}
-
-MAKE_SCHEME_CALLBACK (Grob, stencil_width, 1);
-SCM
-Grob::stencil_width (SCM smob)
-{
-  Grob *me = unsmob_grob (smob);
-  return grob_stencil_extent (me, X_AXIS);
-}
-
-
-Interval
-robust_relative_extent (Grob *me, Grob *refpoint, Axis a)
-{
-  Interval ext = me->extent (refpoint, a);
-  if (ext.is_empty ())
-    ext.add_point (me->relative_coordinate (refpoint, a));
-
-  return ext;
-}
-
+/****************************************************************
+  STENCILS
+****************************************************************/
 
 Stencil *
 Grob::get_stencil () const
@@ -216,14 +146,19 @@ Grob::get_print_stencil () const
   return retval;
 }
 
-/*
+/****************************************************************
   VIRTUAL STUBS
-*/
+****************************************************************/
 void
 Grob::do_break_processing ()
 {
 }
 
+void
+Grob::discretionary_processing ()
+{
+}
+
 System *
 Grob::get_system () const
 {
@@ -300,13 +235,16 @@ Grob::find_broken_piece (System *) const
   return 0;
 }
 
-/* Translate in one direction.  */
+/****************************************************************
+   OFFSETS
+****************************************************************/
+
 void
 Grob::translate_axis (Real y, Axis a)
 {
   if (isinf (y) || isnan (y))
     {
-      programming_error (_ (INFINITY_MSG));
+      programming_error (_ ("Infinity or NaN encountered"));
       return ;
     }
   
@@ -360,6 +298,11 @@ Grob::get_offset (Axis a) const
   return *me->dim_cache_[a].offset_;
 }
 
+
+/****************************************************************
+  extents
+****************************************************************/
+
 void
 Grob::flush_extent_cache (Axis axis)
 {
@@ -416,6 +359,10 @@ Grob::extent (Grob *refp, Axis a) const
   return real_ext;
 }
 
+/****************************************************************
+  REFPOINTS
+****************************************************************/
+
 /* Find the group-element which has both #this# and #s#  */
 Grob *
 Grob::common_refpoint (Grob const *s, Axis a) const
@@ -431,50 +378,18 @@ Grob::common_refpoint (Grob const *s, Axis a) const
   return 0;
 }
 
-Grob *
-common_refpoint_of_list (SCM elist, Grob *common, Axis a)
+void
+Grob::set_parent (Grob *g, Axis a)
 {
-  for (; scm_is_pair (elist); elist = scm_cdr (elist))
-    if (Grob *s = unsmob_grob (scm_car (elist)))
-      {
-       if (common)
-         common = common->common_refpoint (s, a);
-       else
-         common = s;
-      }
-
-  return common;
+  dim_cache_[a].parent_ = g;
 }
 
 Grob *
-common_refpoint_of_array (Link_array<Grob> const &arr, Grob *common, Axis a)
-{
-  for (int i = arr.size (); i--;)
-    if (Grob *s = arr[i])
-      {
-       if (common)
-         common = common->common_refpoint (s, a);
-       else
-         common = s;
-      }
-
-  return common;
-}
-
-String
-Grob::name () const
+Grob::get_parent (Axis a) const
 {
-  SCM meta = get_property ("meta");
-  SCM nm = scm_assq (ly_symbol2scm ("name"), meta);
-  nm = (scm_is_pair (nm)) ? scm_cdr (nm) : SCM_EOL;
-  return scm_is_symbol (nm) ? ly_symbol2string (nm) : this->class_name ();
+  return dim_cache_[a].parent_;
 }
 
-void
-Grob::set_parent (Grob *g, Axis a)
-{
-  dim_cache_[a].parent_ = g;
-}
 
 void
 Grob::fixup_refpoint ()
@@ -510,6 +425,10 @@ Grob::fixup_refpoint ()
     }
 }
 
+
+/****************************************************************
+  MESSAGES
+****************************************************************/
 void
 Grob::warning (String s) const
 {
@@ -523,6 +442,16 @@ Grob::warning (String s) const
     ::warning (s);
 }
 
+
+String
+Grob::name () const
+{
+  SCM meta = get_property ("meta");
+  SCM nm = scm_assq (ly_symbol2scm ("name"), meta);
+  nm = (scm_is_pair (nm)) ? scm_cdr (nm) : SCM_EOL;
+  return scm_is_symbol (nm) ? ly_symbol2string (nm) : this->class_name ();
+}
+
 void
 Grob::programming_error (String s) const
 {
@@ -537,22 +466,6 @@ Grob::programming_error (String s) const
   else
     ::message (s);
 }
-void
-Grob::discretionary_processing ()
-{
-}
-
-bool
-Grob::internal_has_interface (SCM k)
-{
-  return scm_c_memq (k, interfaces_) != SCM_BOOL_F;
-}
-
-Grob *
-Grob::get_parent (Axis a) const
-{
-  return dim_cache_[a].parent_;
-}
 
 
 ADD_INTERFACE (Grob, "grob-interface",
@@ -615,3 +528,107 @@ ADD_INTERFACE (Grob, "grob-interface",
               "transparent "
               );
 
+
+
+
+
+/****************************************************************
+  CALLBACKS
+****************************************************************/
+
+
+static SCM
+grob_stencil_extent (Grob *me, Axis a)
+{
+  Stencil *m = me->get_stencil ();
+  Interval e;
+  if (m)
+    e = m->extent (a);
+  return ly_interval2scm (e);
+}
+
+
+MAKE_SCHEME_CALLBACK (Grob, stencil_height, 1);
+SCM
+Grob::stencil_height (SCM smob)
+{
+  Grob *me = unsmob_grob (smob);
+  return grob_stencil_extent (me, Y_AXIS);
+}
+
+MAKE_SCHEME_CALLBACK(Grob, y_parent_positioning, 1);
+SCM
+Grob::y_parent_positioning (SCM smob)
+{
+  Grob *me = unsmob_grob (smob);
+  Grob *par = me->get_parent (Y_AXIS);
+  if (par)
+    (void) par->get_property ("positioning-done");
+
+  return scm_from_double (0.0);
+}
+
+
+MAKE_SCHEME_CALLBACK(Grob, x_parent_positioning, 1);
+SCM
+Grob::x_parent_positioning (SCM smob)
+{
+  Grob *me = unsmob_grob (smob);
+  
+  Grob *par = me->get_parent (X_AXIS);
+  if (par)
+    (void) par->get_property ("positioning-done");
+
+  return scm_from_double (0.0);
+}
+
+MAKE_SCHEME_CALLBACK (Grob, stencil_width, 1);
+SCM
+Grob::stencil_width (SCM smob)
+{
+  Grob *me = unsmob_grob (smob);
+  return grob_stencil_extent (me, X_AXIS);
+}
+
+
+
+Grob *
+common_refpoint_of_list (SCM elist, Grob *common, Axis a)
+{
+  for (; scm_is_pair (elist); elist = scm_cdr (elist))
+    if (Grob *s = unsmob_grob (scm_car (elist)))
+      {
+       if (common)
+         common = common->common_refpoint (s, a);
+       else
+         common = s;
+      }
+
+  return common;
+}
+
+Grob *
+common_refpoint_of_array (Link_array<Grob> const &arr, Grob *common, Axis a)
+{
+  for (int i = arr.size (); i--;)
+    if (Grob *s = arr[i])
+      {
+       if (common)
+         common = common->common_refpoint (s, a);
+       else
+         common = s;
+      }
+
+  return common;
+}
+
+Interval
+robust_relative_extent (Grob *me, Grob *refpoint, Axis a)
+{
+  Interval ext = me->extent (refpoint, a);
+  if (ext.is_empty ())
+    ext.add_point (me->relative_coordinate (refpoint, a));
+
+  return ext;
+}
+
index 66de466019c225c1ca48c6b5078a13cf7ec919de..07daf856387e9ec5db041264f424c077aacdb7ba 100644 (file)
 #include "dimension-cache-callback.hh"
 #include "lily-guile.hh"
 
-/**
-   Adminstration of offset dimension info.
+/*
+  XY offset/refpoint/extent structure.
 */
 class Dimension_cache
 {
-  /**
-     The offset wrt. to the center of #parent_#
-  */
   Interval *extent_;
   Real *offset_;
-
-  /**
-     What to call to find extent.  Nil means empty.
-  */
   Grob *parent_;
+  
   friend class Grob;
   
   Dimension_cache (Dimension_cache const &);
index 46f1ff473ae972942bc72a779f3110c1b11f22e2..2ba37797c0e509e3443add0777d62f580bf8b5ef 100644 (file)
 #include "grob-interface.hh"
 #include "object-key.hh"
 
-typedef void (Grob:: *Grob_method_pointer) (void);
-
 class Grob
 {
 private:
   DECLARE_SMOBS (Grob, foo);
+  DECLARE_CLASSNAME(Grob);
+  
   void init ();
 
 protected:
+  /* data */
+  Dimension_cache dim_cache_[NO_AXES];
+  Output_def *layout_;
+  Grob *original_;
   Object_key const *key_;
+
+  /* SCM data */
   SCM immutable_property_alist_;
   SCM mutable_property_alist_;
   SCM object_alist_;
@@ -33,22 +39,19 @@ protected:
     lookups.
   */
   SCM interfaces_;
-
-  /* BARF */
-  friend class Spanner;
-  friend SCM ly_grob_properties (SCM);
-  friend SCM ly_grob_basic_properties (SCM);
+  
   void substitute_object_links (SCM, SCM);
-
-  DECLARE_CLASSNAME(Grob);
   Real get_offset (Axis a) const;
-
-  Output_def *layout_;
-  Dimension_cache dim_cache_[NO_AXES];
-  Grob *original_;
-
   SCM try_callback (SCM, SCM);
 public:
+  
+  /* friends */
+  friend class Spanner;
+  friend class System;
+  friend SCM ly_grob_properties (SCM);
+  friend SCM ly_grob_basic_properties (SCM);
+
+  /* standard callbacks */
   DECLARE_SCHEME_CALLBACK(x_parent_positioning, (SCM));
   DECLARE_SCHEME_CALLBACK(y_parent_positioning, (SCM));
   DECLARE_SCHEME_CALLBACK (stencil_height, (SCM smob));
@@ -118,6 +121,7 @@ public:
   void fixup_refpoint ();
 };
 
+/* smob utilities */
 DECLARE_UNSMOB (Grob, grob);
 Spanner *unsmob_spanner (SCM);
 Item *unsmob_item (SCM);
index bd1f1096c46208c8ce385775e3b402996f378703..aa64f590c77160972cbf6ad873baf5c5a6d87e28 100644 (file)
@@ -16,7 +16,7 @@ struct Self_alignment_interface
   static bool has_interface (Grob *);
 
   static SCM aligned_on_self (Grob *me, Axis a);
-  static SCM centered_on_parent (Grob *me, Axis a);
+  static SCM centered_on_object (Grob *me, Axis a);
   static SCM aligned_on_parent (Grob *me, Axis a);
   static void set_center_parent (Grob *me, Axis a);
   static void set_align_self (Grob *me, Axis a);
@@ -26,6 +26,7 @@ struct Self_alignment_interface
 
   DECLARE_SCHEME_CALLBACK (centered_on_x_parent, (SCM element));
   DECLARE_SCHEME_CALLBACK (centered_on_y_parent, (SCM element));
+  DECLARE_SCHEME_CALLBACK (x_centered_on_y_parent, (SCM element));
 
   DECLARE_SCHEME_CALLBACK (aligned_on_x_parent, (SCM element));
   DECLARE_SCHEME_CALLBACK (aligned_on_y_parent, (SCM element));
index 0f35e8aab97fcdc8b0423b3720c5cd889fbf03d4..d527c07afe6f14832e8940263c09c67d699c7cfb 100644 (file)
@@ -23,6 +23,8 @@
 #include "source.hh"
 #include "warn.hh"
 
+#include "ly-smobs.icc"
+
 Lily_parser::Lily_parser (Sources *sources)
 {
   lexer_ = 0;
@@ -55,11 +57,6 @@ Lily_parser::~Lily_parser ()
 {
 }
 
-#include "ly-smobs.icc"
-
-IMPLEMENT_SMOBS (Lily_parser);
-IMPLEMENT_TYPE_P (Lily_parser, "ly:lily-parser?");
-IMPLEMENT_DEFAULT_EQUAL_P (Lily_parser);
 
 SCM
 Lily_parser::mark_smob (SCM s)
@@ -179,10 +176,19 @@ Lily_parser::parser_error (Input const &i, String s)
   error_level_ = 1;
 }
 
-/****************************************************************/
+
+
+IMPLEMENT_SMOBS (Lily_parser);
+IMPLEMENT_TYPE_P (Lily_parser, "ly:lily-parser?");
+IMPLEMENT_DEFAULT_EQUAL_P (Lily_parser);
+
+
+/****************************************************************
+  OUTPUT-DEF 
+ ****************************************************************/
 
 Output_def *
-layout (Lily_parser *parser)
+get_layout (Lily_parser *parser)
 {
   SCM id = parser->lexer_->lookup_identifier ("$defaultlayout");
   Output_def *layout = unsmob_output_def (id);
index f3b8689d9b428badc5bcb598659dcd01e603e0e5..e924777a2212e5e19ea22b2c7041a03124e04a47 100644 (file)
@@ -245,7 +245,10 @@ LY_DEFINE (ly_usage, "ly:usage",
   printf ("\n");
   printf (Long_option_init::table_string (options_static).to_str0 ());
   printf ("\n");
-  printf (_f ("Report bugs to %s.", "bug-lilypond@gnu.org").to_str0 ());
+  printf (_f ("Report bugs to %s or via %s",
+             "bug-lilypond@gnu.org"
+             "http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs"
+             ).to_str0 ());
   printf ("\n");
   printf ("\n");
   return SCM_UNSPECIFIED;
index f9718cbc6759cbcb735f88eb7b1992ab098dab85..80d18104a81e216afa9a3f7c5506454f1104c824 100644 (file)
@@ -25,7 +25,6 @@ Paper_score::Paper_score (Output_def *layout)
 {
   layout_ = layout;
   system_ = 0;
-  pscore_ = 0;
   systems_ = SCM_EOL;
   paper_systems_ = SCM_EOL;
 }
@@ -41,8 +40,6 @@ Paper_score::derived_mark () const
 {
   if (layout_)
     scm_gc_mark (layout_->self_scm ());
-  if (pscore_)
-    scm_gc_mark (pscore_->self_scm ());
   scm_gc_mark (systems_);
   scm_gc_mark (paper_systems_);
 }
@@ -55,7 +52,7 @@ Paper_score::typeset_system (System *system)
 
   systems_ = scm_cons (system->self_scm (), systems_);
   system->pscore_ = this;
-  system->layout_ = pscore_->layout_;
+  system->layout_ = layout_;
   system->unprotect ();
 }
 
index 17ec37b91f9562bbeaed31438f5ac55f7913469d..a9970b393c5585e37a27f2f6229440010d2febdd 100644 (file)
@@ -43,12 +43,18 @@ Self_alignment_interface::aligned_on_self (Grob *me, Axis a)
 
 
 
+SCM
+Self_alignment_interface::centered_on_object (Grob *him, Axis a)
+{
+  return scm_from_double (robust_relative_extent (him, him, a).center ());
+}
+
 
 MAKE_SCHEME_CALLBACK (Self_alignment_interface, centered_on_x_parent, 1);
 SCM
 Self_alignment_interface::centered_on_x_parent (SCM smob)
 {
-  return centered_on_parent (unsmob_grob (smob), X_AXIS);
+  return centered_on_object (unsmob_grob (smob)->get_parent (X_AXIS), X_AXIS);
 }
 
 
@@ -56,16 +62,15 @@ MAKE_SCHEME_CALLBACK (Self_alignment_interface, centered_on_y_parent, 1);
 SCM
 Self_alignment_interface::centered_on_y_parent (SCM smob)
 {
-  return centered_on_parent (unsmob_grob (smob), Y_AXIS);
+  return centered_on_object (unsmob_grob (smob)->get_parent (Y_AXIS), Y_AXIS);
 }
 
+
+MAKE_SCHEME_CALLBACK (Self_alignment_interface, x_centered_on_y_parent, 1);
 SCM
-Self_alignment_interface::centered_on_parent (Grob *me, Axis a)
+Self_alignment_interface::x_centered_on_y_parent (SCM smob)
 {
-  Grob *him = me->get_parent (a);
-  Interval he = him->extent (him, a);
-
-  return scm_from_double (he.is_empty () ? 0.0 : he.center ());
+  return centered_on_object (unsmob_grob (smob)->get_parent (Y_AXIS), X_AXIS);
 }
 
 MAKE_SCHEME_CALLBACK (Self_alignment_interface, aligned_on_x_parent,1);
index 2c49aacad7d836e4ba8520fdf53feab8ef2bbc77..e8d194182b6458c85666cacd3fd82523cf3ea048 100644 (file)
@@ -80,7 +80,8 @@ Spanner::do_break_processing ()
     }
   else
     {
-      Link_array<Item> break_points = pscore_->root_system ()->broken_col_range (left, right);
+      System *root  = get_root_system (this);
+      Link_array<Item> break_points = root->broken_col_range (left, right);
 
       break_points.insert (left, 0);
       break_points.push (right);
index 10a4e9505b30716c62b7e4ff25ef922939e92913..e7291e7337f0add925f6d9589800b6b622b7eafa 100644 (file)
@@ -20,7 +20,6 @@
 #include "all-font-metrics.hh"
 #include "spacing-interface.hh"
 #include "staff-symbol-referencer.hh"
-#include "paper-book.hh"
 #include "paper-system.hh"
 #include "tweak-registration.hh"
 #include "grob-array.hh"
@@ -30,6 +29,7 @@ System::System (System const &src, int count)
   : Spanner (src, count)
 {
   all_elements_ = 0;
+  pscore_ = 0;
   rank_ = 0;
   init_elements ();
 }
@@ -75,11 +75,11 @@ System::spanner_count () const
 void
 System::typeset_grob (Grob *elem)
 {
-  if (elem->pscore_)
+  if (elem->layout_)
     programming_error ("adding element twice");
   else
     {
-      elem->layout_ = pscore_->layout_;
+      elem->layout_ = pscore_->layout ();
       all_elements_->add (elem);
       elem->unprotect ();
     }
@@ -462,8 +462,9 @@ System *
 get_root_system (Grob *me) 
 {
   Grob *system_grob = me;
-  while (system->get_parent (Y_AXIS))
-    system = system->get_parent (Y_AXIS);
+  
+  while (system_grob->get_parent (Y_AXIS))
+    system_grob = system_grob->get_parent (Y_AXIS);
 
   return dynamic_cast<System*> (system_grob); 
 }
@@ -471,4 +472,9 @@ get_root_system (Grob *me)
 ADD_INTERFACE (System, "system-interface",
               "This is the toplevel object: each object in a score "
               "ultimately has a System object as its X and Y parent. ",
-              "all-elements spaceable-staves columns")
+
+              /* properties */
+              "all-elements "
+              "spaceable-staves "
+              "columns"
+              )
index 4b5f2448326a389f075ad366a09ddfd3963c7def..3de59650ce357b2af7b0cd6d1b4af58a586deaa1 100644 (file)
@@ -54,7 +54,7 @@ Tweak_registry::insert_tweak_from_file (SCM tweak)
 void
 Tweak_registry::insert_grob_tweak (Grob *g, SCM tweak)
 {
-  Object_key const *key = g->get_key ();
+  Object_key const *key = g->key ();
   if (tweaks_.find (key) == tweaks_.end ())
     tweaks_[key] = SCM_EOL;
 
@@ -64,14 +64,14 @@ Tweak_registry::insert_grob_tweak (Grob *g, SCM tweak)
 void
 Tweak_registry::replace_grob_tweak (Grob *g, SCM tweak)
 {
-  Object_key const *key = g->get_key ();
+  Object_key const *key = g->key ();
   tweaks_[key] = scm_cons (tweak, SCM_EOL);
 }
 
 SCM
 Tweak_registry::get_tweaks (Grob *g)
 {
-  Object_key const *key = g->get_key ();
+  Object_key const *key = g->key ();
   if (tweaks_.find (key) == tweaks_.end ())
     return SCM_EOL;
   return tweaks_[key];
index 61c033c6bb4640ccc605fd105cb5be3ec167bc9f..798f46641da9721f74bd8c66f69d2884591826f5 100644 (file)
@@ -250,6 +250,30 @@ barNumberCheck =
                                         cbn n))))))
 
 
+
+% for regression testing purposes.
+assertBeamQuant =
+#(def-music-function (parser location l r) (pair? pair?)
+  (make-grob-property-override 'Beam 'positions
+   (ly:make-simple-closure
+    (ly:make-simple-closure
+     (append
+      (list chain-grob-member-functions `(,cons 0 0))
+      (check-quant-callbacks l r))))))
+    
+% for regression testing purposes.
+assertBeamSlope =
+#(def-music-function (parser location comp) (procedure?)
+  (make-grob-property-override 'Beam 'positions
+   (ly:make-simple-closure
+    (ly:make-simple-closure
+     (append
+      (list chain-grob-member-functions `(,cons 0 0))
+      (check-slope-callbacks comp))))))
+    
+
+
+
 %{
 
 TODO:
index 59765d075e7cdd40589e1da782c1fec006889ca2..d8a3390c771fb2dba0010c36db339f020d0783f2 100644 (file)
@@ -91,26 +91,3 @@ sostenutoUp = #(make-span-event 'SostenutoEvent STOP)
 %crescpoco = \set crescendoText = "cresc. poco a poco"
 %decresc = \set crescendoText = "decr."
 %dim = \set crescendoText = "dim."
-
-
-% for regression testing purposes.
-assertBeamQuant =
-#(def-music-function (parser location l r) (pair? pair?)
-  (make-grob-property-override 'Beam 'positions
-   (ly:make-simple-closure
-    (ly:make-simple-closure
-     (append
-      (list chain-grob-member-functions `(,cons 0 0))
-      (check-quant-callbacks l r))))))
-    
-% for regression testing purposes.
-assertBeamSlope =
-#(def-music-function (parser location comp) (procedure?)
-  (make-grob-property-override 'Beam 'positions
-   (ly:make-simple-closure
-    (ly:make-simple-closure
-     (append
-      (list chain-grob-member-functions `(,cons 0 0))
-      (check-slope-callbacks comp))))))
-    
-
index fb80ba1b335af9e9b7f55cc59b8ae9ef396c9b19..7453a495b39428927cf95d6b78a8e9cf1afde785 100644 (file)
@@ -2641,6 +2641,8 @@ conversions.append (((2, 7, 14), conv,
 def conv (str):
        if re.search ('[XY]-offset-callbacks', str):
                error_file.write (NOT_SMART % "[XY]-offset-callbacks")
+       if re.search ('position-callbacks', str):
+               error_file.write (NOT_SMART % "position-callbacks")
        return str
 
 conversions.append (((2, 7, 15), conv,
index 0c5e765c6f6ef8a1c9fde21e0ef8d211b377ed62..afbd73bf7e5091583e03a46ffc8560e8eb4f800b 100644 (file)
        (stencil . ,Grid_line_interface::print)
 
        (self-alignment-X . ,CENTER)
-       (X-offset . (ly:make-simple-closure `(,+  ,(ly:make-simple-closure (list Self_alignment_interface::centered_on_x_parent))
-                                                 ,(ly:make-simple-closure (list Self_alignment_interface::x_aligned_on_self)))))
+       (X-offset . ,(ly:make-simple-closure
+                     `(,+  ,(ly:make-simple-closure (list Self_alignment_interface::centered_on_x_parent))
+                           ,(ly:make-simple-closure (list Self_alignment_interface::x_aligned_on_self)))))
        (layer . 0)
        (meta . ((class . Item)
                 (interfaces . (self-alignment-interface
      . (
        (springs-and-rods . ,Multi_measure_rest::set_spacing_rods)
        (stencil . ,Text_interface::print)
-       (self-X-offset . ,(ly:make-simple-closure `(,+ ,(ly:make-simple-closure (list Self_alignment_interface::y_aligned_on_self))
-                                                      ,(ly:make-simple-closure (list Self_alignment_interface::centered_on_y_parent)))))
+       (X-offset . ,(ly:make-simple-closure
+                     `(,+ ,(ly:make-simple-closure (list Self_alignment_interface::x_aligned_on_self))
+                          ,(ly:make-simple-closure (list Self_alignment_interface::x_centered_on_y_parent)))))
        (Y-offset . ,Side_position_interface::y_aligned_side)
        (self-alignment-X . 0)
        (direction . 1)
                                text-interface))))
              ))
 
-
     (MultiMeasureRestText
      . (
        (stencil . ,Text_interface::print)
-       (X-offset . ,(ly:make-simple-closure `(,+ ,(ly:make-simple-closure (list Self_alignment_interface::centered_on_y_parent))
-                                                 ,(ly:make-simple-closure (list Self_alignment_interface::x_aligned_on_self)))))
+       (X-offset . ,(ly:make-simple-closure
+                     `(,+ ,(ly:make-simple-closure (list Self_alignment_interface::x_centered_on_y_parent))
+                          ,(ly:make-simple-closure (list Self_alignment_interface::x_aligned_on_self)))))
        
        (Y-offset . ,Side_position_interface::y_aligned_side)
        (self-alignment-X . 0)
     (PercentRepeatCounter
      . (
        (stencil . ,Text_interface::print)
-       (X-offset . `(ly:make-simple-closure `(,+ ,(ly:make-simple-closure (list Self_alignment_interface::centered_on_y_parent))
+       (X-offset . ,(ly:make-simple-closure `(,+ ,(ly:make-simple-closure (list Self_alignment_interface::centered_on_y_parent))
                                                  ,(ly:make-simple-closure (list Self_alignment_interface::x_aligned_on_self)))))
        (Y-offset . ,Side_position_interface::y_aligned_side)
        (self-alignment-X . 0)
index 051cc5f2af25c60fb40445664ff3971e77de3332..9c55dbd9e37787fcc25b5b3217ab5d1ea2a08831 100644 (file)
@@ -35,6 +35,7 @@
     posns
     ))
 
+
 (define ((check-beam-slope-sign comparison) beam posns)
   "Check whether the slope of BEAM is correct wrt. COMPARISON."
   (let* ((slope-sign (- (cdr posns) (car posns)))
@@ -61,7 +62,6 @@
        ))
                        
 
-
 (define-public (check-slope-callbacks comparison)
   (list Beam::calc_least_squares_positions
        Beam::slope_damping