]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 1.3.54 release/1.3.54
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 24 May 2000 22:20:46 +0000 (00:20 +0200)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 24 May 2000 22:20:46 +0000 (00:20 +0200)
==========

* Bugfix: don't crash on tuplet spanners that don't contain any notes.

* Small cleanup of Dimension_cache: removed a few redundant
fields. Slightly lower memory usage. Dimension_cache is now a `dumb'
struct again.

* Add array index to priority field of text scripts to ensure that
order is unique, and sensible.

* Added an element count statistic.

1.3

56 files changed:
AUTHORS.txt
CHANGES
Documentation/regression-test.tely
Documentation/topdocs/AUTHORS.texi
VERSION
lily/align-interface.cc
lily/align-note-column-engraver.cc
lily/axis-group-engraver.cc
lily/axis-group-interface.cc
lily/bar-engraver.cc
lily/bezier-bow.cc
lily/bezier.cc
lily/break-align-engraver.cc
lily/dimension-cache.cc
lily/dot-column-engraver.cc
lily/dot-column.cc
lily/dynamic-engraver.cc
lily/extender-spanner.cc
lily/grace-position-engraver.cc
lily/hyphen-spanner.cc
lily/include/align-interface.hh
lily/include/axis-group-interface.hh
lily/include/dimension-cache-callback.hh
lily/include/dimension-cache.hh
lily/include/item.hh
lily/include/line-of-score.hh
lily/include/score-element-callback.hh
lily/include/score-element.hh
lily/include/side-position-interface.hh
lily/include/span-bar.hh
lily/include/staff-symbol-referencer.hh
lily/include/stem-tremolo.hh
lily/include/stem.hh
lily/item.cc
lily/lily-guile.cc
lily/line-of-score.cc
lily/local-key-engraver.cc
lily/paper-outputter.cc
lily/paper-score.cc
lily/piano-pedal-engraver.cc
lily/score-element.cc
lily/script-column-engraver.cc
lily/script-engraver.cc
lily/side-position-interface.cc
lily/span-bar.cc
lily/staff-symbol-referencer.cc
lily/stem-tremolo.cc
lily/stem.cc
lily/system-start-delimiter.cc
lily/text-engraver.cc
lily/timing-engraver.cc
lily/transposed-music.cc
lily/tuplet-spanner.cc
lily/volta-spanner.cc
make/out/lilypond.lsm
make/out/lilypond.spec

index 83bef5a61192e542a2f1c125016c0f48d6381f21..b0453ea529d8c4e001da65c52829bfa42f4de33c 100644 (file)
@@ -58,7 +58,7 @@ list is alphabetically ordered.
      `http://www.iro.umontreal.ca/~pinard/'     parts of
      Documentation/Vocab*, started internationalization stuff
 
-   * Stephen Peters <portnoy@ai.mit.edu>, pdfTeX support
+   * Stephen Peters <portnoy@ai.mit.edu>,     pdfTeX support
 
    * Glen Prideaux <glenprideaux@iname.com>,     minor bug fix to
      script used to generate doc++ documentation
@@ -70,6 +70,5 @@ list is alphabetically ordered.
 
    * Shay Rojanski     Some mudela source.
 
-   Your name could be here! If you want to fix something, do it, and
-send us a patch!
+   * August S.Sigov <august@infran.ru>     Russian translation
 
diff --git a/CHANGES b/CHANGES
index 5e4b8ca693b763b2dfcabb6845e39376c715bb37..496aaedfee965bc22744698bcd91b4cb02db1ef7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,22 @@
+1.3.53.uu1
+==========
+
+* Bugfix: don't crash on tuplet spanners that don't contain any notes.
+
+* Small cleanup of Dimension_cache: removed a few redundant
+fields. Slightly lower memory usage. Dimension_cache is now a `dumb'
+struct again.
+
+* Add array index to priority field of text scripts to ensure that
+order is unique, and sensible.
+
+* Added an element count statistic.
+
 1.3.53
 ======
+
+* russian.po (thank you, August.)
+
 * Small cleanups in Molecule interface 
 
 * Spacing related elements perform suicide after calculating
index 0b12f68e14006d1e4bef130f70082a9e99f6a556..83848bfbdf4fa3f8571b0d3ee8f69306023c1484 100644 (file)
@@ -222,7 +222,8 @@ Folded.  This doesn't make sense without alternatives, but it works.
 
 @mudelafile{repeat-fold.ly}
 
-Across linebreaks, first and second bracket should be equal
+Across linebreaks, the left edge of a first and second alternative
+bracket should be equal
 
 @mudelafile{repeat-line-break.ly}
 
@@ -379,7 +380,8 @@ signatures.
 
 @section Hacks and Features
 
-As a last resort, the placement of items can be adjusted manually.
+As a last resort, the placement of items can be adjusted manually, by
+setting the @code{extra-offset} of an output object.
 
 @mudelafile{generic-output-property.ly}
 
index 4a37c46e0fb33f7a85c2314aad15d9a465e250f9..9c0ce77848ef0d8a9d255a20fd5f6b3054d5168d 100644 (file)
@@ -60,19 +60,19 @@ list is alphabetically ordered.
     @uref{http://www.iro.umontreal.ca/~pinard/}
     parts of Documentation/Vocab*, started internationalization stuff
 @c urg: @c,{} in @email{} barfs.
-@item @email{portnoy@@ai.mit.edu,Stephen Peters}, pdfTeX support
+@item @email{portnoy@@ai.mit.edu,Stephen Peters},
+    pdfTeX support
 @item @email{glenprideaux@@iname.com, Glen Prideaux},
     minor bug fix to script used to generate doc++ documentation
 @item @email{Roy.Rankin@@alcatel.com.au, Roy R. Rankin},
     major extension, fixes to abc2ly, lilypond bug fixes
 @item @email{daboys@@austin.rr.com, Jeffrey B. Reed},
     Windows-NT support.
+
 @item Shay Rojanski
     Some mudela source.
+@item @email{august@@infran.ru, August S.Sigov}
+    Russian translation
 @end itemize
 
-Your name could be here! If you want to fix something, do it, and send
-us a patch!
-
-
 @bye
diff --git a/VERSION b/VERSION
index 991333178404ff3a0001a184043fca337f0ed68c..c3ec2ace94040b1b89bebe2f4d4a052925a8a160 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,7 +1,7 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
-PATCH_LEVEL=53
+PATCH_LEVEL=54
 MY_PATCH_LEVEL=
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
index 30e9fda247d358d28d0ba88cc0374151d3c66807..af9089b0eb203e822e356ccd629a17e4933db414 100644 (file)
   not compute anything, but a side effect of a->do_side_processing ()
   is that the elements are placed correctly.  */
 Real
-Align_interface::alignment_callback (Dimension_cache const *c)
+Align_interface::alignment_callback (Score_element const *sc, Axis ax)
 {
-  Axis ax = c->axis ();
-  Score_element * sc = c->element_l ()->parent_l (ax);
-
-  if (sc && sc->get_elt_property ("alignment-done") == SCM_UNDEFINED) 
+  Score_element * par = sc->parent_l (ax);
+  if (par && par->get_elt_property ("alignment-done") == SCM_UNDEFINED) 
     {
-      Align_interface (sc).do_side_processing (ax);
+      Align_interface (par).do_side_processing (ax);
     }
   return 0.0;
 }
 
 
 Real
-Align_interface::center_on_element (Dimension_cache const *c)
+Align_interface::center_on_element (Score_element const *me, Axis a)
 {
-  Score_element *me = c->element_l ();
   Score_element *cent = unsmob_element (me->get_elt_property ("group-center-element"));
 
   if (cent)
     {
-      Real r = cent->relative_coordinate (me,  c->axis ());
+      Real r = cent->relative_coordinate (me,  a);
       return -r;
     }
   return 0;
@@ -154,7 +151,6 @@ Align_interface::add_element (Score_element* s)
 {
   s->add_offset_callback (alignment_callback, axis ());
   Axis_group_interface (elt_l_).add_element (s);
-  
 }
 
 Align_interface::Align_interface (Score_element const*s)
index a184e36131e2fee6ba6cc9b35e3a4450f1b59918..dff753effc34512b72a9f964108f28cf0da6ba4e 100644 (file)
@@ -46,8 +46,8 @@ void
 Align_note_column_engraver::do_creation_processing ()
 {
   align_item_p_ = new Grace_align_item;
-  side_position (align_item_p_).set_axis (X_AXIS);
-  side_position (align_item_p_).set_direction (LEFT);  
+  Side_position_interface (align_item_p_).set_axis (X_AXIS);
+  Side_position_interface (align_item_p_).set_direction (LEFT);  
   // needed  for setting font size.
   announce_element (Score_element_info (align_item_p_, 0));
 }
index a674757cbe542aea56c4035dd3ad80c9e700091b..4639b176a9de01c534c2460af82599cdb2b76e10 100644 (file)
@@ -43,7 +43,7 @@ Axis_group_engraver::do_removal_processing ()
   if (gh_pair_p (dims) && gh_number_p (gh_car (dims))
       && gh_number_p (gh_cdr (dims)))
     {
-      staffline_p_->dim_cache_[Y_AXIS]->set_extent_callback (&Score_element::preset_extent);
+      staffline_p_->set_extent_callback (&Score_element::preset_extent, Y_AXIS);
       staffline_p_->set_elt_property ("extent-Y", dims);
     }
 
index e7dcde019b882596ab22ffc871982726216d6b62..06e7436685841f9f00f3fbc73e8ed534a2b97183 100644 (file)
@@ -46,7 +46,7 @@ Axis_group_interface::add_element (Score_element *e)
 bool
 Axis_group_interface::axis_b (Axis a )const
 {
-  return elt_l_->dim_cache_[a]->extent_callback_l_ == group_extent_callback;
+  return elt_l_->has_extent_callback_b (group_extent_callback, a);
 }
 
 Interval
@@ -64,11 +64,9 @@ Axis_group_interface::relative_group_extent (Axis a, Score_element *common, SCM
 }
 
 Interval
-Axis_group_interface::group_extent_callback (Dimension_cache const *c) 
+Axis_group_interface::group_extent_callback (Score_element const*me, Axis a)
 {
-  Axis a = c->axis ();
-  Score_element * me = c->element_l ();
-  Score_element * common = me;
+  Score_element * common =(Score_element*) me;
 
   for (SCM s = me->get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
     {
@@ -111,8 +109,8 @@ Axis_group_interface::set_axes (Axis a1, Axis a2)
   if (a1 != Y_AXIS && a2 != Y_AXIS)
     elt_l_->set_extent_callback (0, Y_AXIS);
   
-  elt_l_->dim_cache_[a1]->set_extent_callback (Axis_group_interface::group_extent_callback);
-  elt_l_->dim_cache_[a2]->set_extent_callback (Axis_group_interface::group_extent_callback);
+  elt_l_->set_extent_callback (Axis_group_interface::group_extent_callback,a1);
+  elt_l_->set_extent_callback (Axis_group_interface::group_extent_callback,a2);
 }
 
 Link_array<Score_element> 
index c14198a0d25fc49bcb991616b7d0be93273d93c8..2a8c2ae66d306e42f1bca3f29fffed08d01714c7 100644 (file)
@@ -32,26 +32,15 @@ Bar_engraver::create_bar ()
       bar_p_->set_elt_property ("break-align-symbol", ly_symbol2scm ("Staff_bar"));
 
       // urg: "" != empty...
+      /*
+       TODO: use symbol.
+       */
       SCM default_type = get_property ("defaultBarType");
       if (gh_string_p (default_type))
        {
          bar_p_->set_elt_property ("glyph", default_type); // ugh
        }
 
-#if 0
-      /*
-       urg.  Why did I implement this? And did I implement this so
-       clumsily?
-
-       input/test/just-friends.ly
-       Maybe a staffgroup of just one staff would be a better solution.
-      */
-      SCM prop = get_property ("barAtLineStart");
-      if (to_boolean (prop))
-       {
-         bar_p_->set_elt_property ("at-line-start", SCM_BOOL_T);
-       }
-#endif
       announce_element (Score_element_info (bar_p_, 0));
     }
 }
index 0a51f936140fb643ee0d87c1b183d0f07b220ca3..8a92e9ddf4cfedd11f116faf96f2ef01869a07a8 100644 (file)
@@ -102,20 +102,12 @@ Bezier_bow::get_default_bezier (Real h_inf, Real r_0) const
 Real
 Bezier_bow::get_default_height (Real h_inf, Real r_0, Real b) const
 {
-#if 0
-  Real pi = M_PI;
 
-  Real alpha = 2.0 * h_inf / pi;
-  Real beta = pi * r_0 / (2.0 * h_inf);
-
-  return alpha * atan (beta * b);
-#else
   SCM h = scm_eval (scm_listify (ly_symbol2scm ("slur-default-height"),
                                 gh_double2scm (h_inf),
                                 gh_double2scm (r_0),
                                 gh_double2scm (b),
                                 SCM_UNDEFINED));
   return gh_scm2double (h);
-#endif
 }
   
index e7f02063f6a86696162a6c0a7b5aea3b4ae499a1..3e1e875a6de16a3b767a62fa2bdb0e7db5a4c1c6 100644 (file)
@@ -9,7 +9,7 @@
 #include <math.h>
 #include "config.h"
 
-
+#include "libc-extension.hh"
 #include "bezier.hh"
 #include "polynomial.hh"
 
index 9f2047dfdadbd68969439d812eef544cd7c1112e..c358df46c42b33ed300e273fee88991415de00eb 100644 (file)
@@ -110,7 +110,7 @@ Break_align_engraver::acknowledge_element (Score_element_info inf)
 
            TODO: switch off ignoring empty stuff?
          */
-         edge->dim_cache_[X_AXIS]->set_extent_callback (Dimension_cache::point_dimension_callback);
+         edge->set_extent_callback (Score_element::point_dimension_callback,X_AXIS);
          
          align_l_->set_elt_property ("group-center-element", edge->self_scm_);
 
index ad4c630c0a38ad36fa5e10f12bdef3dff3a1d5ad..96a51cde5a8ca395b4a4cfeac0dbeab46dad02f9 100644 (file)
@@ -7,7 +7,6 @@
  */
 #include <math.h>
 #include "warn.hh"
-
 #include "dimension-cache.hh"
 #include "parray.hh"
 #include "score-element.hh"
@@ -17,9 +16,7 @@ Dimension_cache::Dimension_cache (Dimension_cache const &d)
 {
   init();
   extent_callback_l_ = d.extent_callback_l_;
-  basic_offset_ = d.basic_offset_;
-  extra_offset_ = d.extra_offset_;
-  off_valid_b_ = d.off_valid_b_;
+  offset_ = d.offset_;
   off_callbacks_ = d.off_callbacks_;
   parent_l_ = d.parent_l_;  
 }
@@ -33,112 +30,17 @@ void
 Dimension_cache::init()
 {
   extent_callback_l_ =0;
-  basic_offset_ =0.0;
-  extra_offset_ =0.0;
+  offset_ =0.0;
+  offset_ =0.0;
   
-  elt_l_ = 0;
   dim_.set_empty ();
   parent_l_ =0;
   valid_b_ = false;
-  off_valid_b_ = false;
-}
-
-
-void
-Dimension_cache::translate (Real x)
-{
-  extra_offset_ += x;
-}
-
-Real
-Dimension_cache::relative_coordinate (Dimension_cache *refp) const
-{
-  if (refp == this)
-    return 0.0;
-
-  /*
-    We catch PARENT_L_ == nil case with this, but we crash if we did
-    not ask for the absolute coordinate (ie. REFP == nil.)
-    
-   */
-  if (refp == parent_l_)
-    return get_offset ();
-  else
-    return get_offset () + parent_l_->relative_coordinate (refp);
-}
-
-Axis
-Dimension_cache::axis () const
-{
-  if (elt_l_-> dim_cache_[X_AXIS] == this)
-    return X_AXIS;
-  else
-    return Y_AXIS;
 }
 
-Real
-Dimension_cache::get_offset () const
-{
-  Dimension_cache *me = (Dimension_cache*) this;
-  while (off_callbacks_.size ())
-    {
-      Offset_cache_callback c = me->off_callbacks_[0];
-      me->off_callbacks_.del (0);
-      Real r =  (*c) (me);
-      if (isinf (r) || isnan (r))
-       {
-         r = 0.0;
-         programming_error ("Infinity or NaN encountered");
-       }
-      me->basic_offset_ +=r;
-    }
-  return basic_offset_ + extra_offset_;
-}
 
-Dimension_cache *
-Dimension_cache::common_refpoint (Dimension_cache const* s) const
-{
-  /*
-    I don't like the quadratic aspect of this code. Maybe this should
-    be rewritten some time, but the largest chain of parents might be
-    10 high or so, so it shouldn't be a real issue. */
-  for (Dimension_cache const *c = this; c; c = c->parent_l_)
-    for (Dimension_cache const * d = s; d; d = d->parent_l_)
-      if (d == c)
-       return (Dimension_cache*)d;
 
-  return 0;
-}
 
-Interval
-Dimension_cache::point_dimension_callback (Dimension_cache const* )
-{
-  return Interval (0,0);
-}
 
-Interval
-Dimension_cache::get_dim () const
-{
-  Interval r;
-  Dimension_cache *nc = ((Dimension_cache*)this);
-  if (!extent_callback_l_)
-    {
-      nc->dim_.set_empty ();
-    }
-  else if (!valid_b_)
-    {
-      nc->dim_= (*extent_callback_l_ ) (nc);
-      nc->valid_b_ = true;
-    }
-
-  r=dim_;
-  return r;
-}
-
-void
-Dimension_cache::set_extent_callback (Dim_cache_callback c)
-{
-  extent_callback_l_ =c;
-}
 
 
index 675574b034bad51e4c50ca6ce463486983f2e7bf..5c2cfd49c4186f297fa87bde365cdf6c67fb347e 100644 (file)
@@ -41,8 +41,8 @@ Dot_column_engraver::acknowledge_element (Score_element_info info)
   if (!dotcol_p_)
     {
       dotcol_p_ = new Dot_column;
-      side_position (dotcol_p_).set_axis (X_AXIS);
-      side_position (dotcol_p_).set_direction (RIGHT);      
+      Side_position_interface (dotcol_p_).set_axis (X_AXIS);
+      Side_position_interface (dotcol_p_).set_direction (RIGHT);      
       announce_element (Score_element_info (dotcol_p_, 0));
     }
 
index 2dc724e9f60cf22c4dad131de8eadf041361c4b1..75f8391fe934b16092c5dd2b2aa4d2e9da6c8bb6 100644 (file)
@@ -33,7 +33,7 @@ Dot_column::add_head (Rhythmic_head *r)
   if (!r->dots_l ())
     return ;
 
-  side_position (this).add_support (r);
+  Side_position_interface (this).add_support (r);
   add_dots (r->dots_l ());
 }
 
index 019ef105db37ec8af9743e597e07154bab966aca..9a8675caee640890c33a7cca497da23124987e94 100644 (file)
@@ -48,7 +48,7 @@ public:
 Dynamic_line_spanner::Dynamic_line_spanner ()
 {
   set_elt_property ("transparent", SCM_BOOL_T);
-  side_position (this).set_axis (Y_AXIS);
+  Side_position_interface (this).set_axis (Y_AXIS);
   Axis_group_interface (this).set_interface ();
   Axis_group_interface (this).set_axes (X_AXIS, Y_AXIS);
 }
@@ -222,8 +222,8 @@ Dynamic_engraver::do_process_music ()
          for (int i = 0; i < pending_element_arr_.size (); i++)
            {
              Score_element* e = pending_element_arr_[i];
-             side_position (e).set_axis (Y_AXIS);
-             side_position (e).add_staff_support ();
+             Side_position_interface (e).set_axis (Y_AXIS);
+             Side_position_interface (e).add_staff_support ();
 
              /*
                UGH UGH 
@@ -388,7 +388,7 @@ Dynamic_engraver::do_removal_processing ()
   typeset_all ();
   if (line_spanner_)
     {
-      side_position (line_spanner_).add_staff_support ();
+      Side_position_interface (line_spanner_).add_staff_support ();
       typeset_element (line_spanner_);
       line_spanner_ = 0;
     }
@@ -410,7 +410,7 @@ Dynamic_engraver::typeset_all ()
     }
   if (finished_line_spanner_)
     {
-      side_position (finished_line_spanner_).add_staff_support ();
+      Side_position_interface (finished_line_spanner_).add_staff_support ();
       typeset_element (finished_line_spanner_);
       finished_line_spanner_ = 0;
     }
@@ -423,7 +423,7 @@ Dynamic_engraver::acknowledge_element (Score_element_info i)
     {
       if (line_spanner_)
        {
-         side_position (line_spanner_).add_support (n);
+         Side_position_interface (line_spanner_).add_support (n);
          line_spanner_->add_column (n);
        }
       else
index 5f0a9d2dae2a6010831df169ced104a204e0c941..4c1dedbcd6d6d541eb482b5e7af4d57c28400825 100644 (file)
@@ -24,7 +24,7 @@ Extender_spanner::Extender_spanner ()
   : Spanner ()
 {
   dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0;
-  dim_cache_[Y_AXIS]->set_extent_callback (Dimension_cache::point_dimension_callback);
+  set_extent_callback (Score_element::point_dimension_callback, Y_AXIS);
 }
 
 
index 3805612e1cb42f23b438e7e536d88516ee604bcf..170d7b0350fb43eb7af6ff1c4bd72ed7881dc555 100644 (file)
@@ -66,7 +66,7 @@ Grace_position_engraver::process_acknowledged ()
   if (align_l_)
     {
       for (int i=0; i < support_.size (); i++)
-       side_position  (align_l_).add_support (support_[i]);
+       Side_position_interface  (align_l_).add_support (support_[i]);
       support_.clear ();
     }
 }
@@ -74,7 +74,7 @@ Grace_position_engraver::process_acknowledged ()
 void
 Grace_position_engraver::do_pre_move_processing ()
 {
-  if (align_l_ && !side_position (align_l_).supported_b ())
+  if (align_l_ && !Side_position_interface (align_l_).supported_b ())
     {
   /*
      We don't have support. Either some moron tried attaching us to a rest,
index d1429698a349e7490cf061e27f1a1f7fe4c132d8..acc40be05a9eab67910ce5da29622f1d5896cf9b 100644 (file)
@@ -27,7 +27,7 @@ Hyphen_spanner::Hyphen_spanner ()
 {
   dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0;
 
-  dim_cache_[Y_AXIS]->set_extent_callback (Dimension_cache::point_dimension_callback);
+  set_extent_callback (Score_element::point_dimension_callback,Y_AXIS);
 }
 
 Molecule 
index ad9d51f8761de368e5442a93661020b9a1d1f9ee..c9e42d7be1dba7d4cfe71db58a625bec18c7de6e 100644 (file)
@@ -38,7 +38,7 @@ struct Align_interface  {
   Score_element * elt_l_;
   
   Align_interface (Score_element const*);
-  static Real alignment_callback (Dimension_cache const *);
+  static Real alignment_callback (Score_element const*,Axis);
   void do_side_processing (Axis a);
   void set_axis (Axis);
   Axis axis () const;
@@ -46,7 +46,7 @@ struct Align_interface  {
   int get_count (Score_element*)const;
   void set_interface ();
   bool has_interface_b ();
-  static Real center_on_element (Dimension_cache const *c);
+  static Real center_on_element (Score_element const *c, Axis);
 };
 
 #endif /* ALIGN_INTERFACE_HH */
index 7bacbf8ac394150f638dd867fa664f49d5d3e262..3d72a99494eae311437be103feaa96d5103f5862 100644 (file)
@@ -31,7 +31,7 @@ struct Axis_group_interface
   Score_element *elt_l_;
   Axis_group_interface (Score_element*);
 
-  static Interval group_extent_callback (Dimension_cache const*);
+  static Interval group_extent_callback (Score_element const*,Axis);
   static Interval relative_group_extent (Axis, Score_element * common, SCM list);
 
   void add_element (Score_element*);
index b12dc1078dae8cc3b13cba4a4f0651c665b9230b..6c58b1d2e95ee06f4479ce2ec0881e72b86d83cd 100644 (file)
@@ -10,9 +10,9 @@
 #ifndef DIMENSION_CACHE_CALLBACK_HH
 #define DIMENSION_CACHE_CALLBACK_HH
 
-class Dimension_cache;
-typedef Interval (*Dim_cache_callback)(Dimension_cache const *);
-typedef Real (*Offset_cache_callback)(Dimension_cache const *);
+
+typedef Interval (*Dim_cache_callback)(Score_element const *,Axis);
+typedef Real (*Offset_callback)(Score_element const *,Axis);
 
 #endif /* DIMENSION_CACHE_CALLBACK_HH */
 
index a5033b7914a57b621fbbad995107fd2a6ed9dd72..ca4fad3c16c370485ce2a3c6b5b51d0e6f819a39 100644 (file)
@@ -20,7 +20,7 @@
 /**
   Adminstration of offset dimension info. 
  */
-class Dimension_cache
+struct Dimension_cache
 {
   bool valid_b_;
   Interval dim_;
@@ -28,47 +28,21 @@ class Dimension_cache
     The offset wrt. to the center of #parent_l_#
    */
 
-  Real extra_offset_;
-  Real basic_offset_;
-  bool off_valid_b_;
+  Real offset_;
 
-  Score_element *elt_l_;
-  friend class Score_element;
 
-  void init ();
-  Array<Offset_cache_callback> off_callbacks_;
+  
+  Array<Offset_callback> off_callbacks_;
+
   /**
      What to call to find extent.  Nil means empty. 
    */
-public:
   Dim_cache_callback extent_callback_l_;
-  static Interval point_dimension_callback (Dimension_cache const* );
-  Axis axis () const;
-  Real get_offset () const;
-  void set_extent_callback (Dim_cache_callback);
-  Dimension_cache * parent_l_;
-
-  Score_element *element_l () const { return elt_l_; }
+  Score_element * parent_l_;
 
   Dimension_cache(Dimension_cache const&);
   Dimension_cache ();
-
-
-  /**
-     Find the offset relative to D.  If   D equals THIS, then it is 0.
-     Otherwise, it recursively defd as
-
-     OFFSET_ + PARENT_L_->relative_coordinate (D)
-   */
-  Real relative_coordinate (Dimension_cache *d) const;
-  Dimension_cache*common_refpoint (Dimension_cache const* s) const;
-
-  void set_empty (bool);
-  void translate (Real);
-
-  bool valid_b () const { return valid_b_; }
-  bool empty_b() const;
-  Interval get_dim () const;
+  void init ();
 };
 
 
index d92a67fb0458d88facc25ecb132a289c55e46689..7d327628ed8dfe2ac76519333e91706e16fc858e 100644 (file)
@@ -55,7 +55,7 @@ public:
   virtual Paper_column * column_l () const;
   virtual void handle_prebroken_dependencies ();
 protected:
-  virtual void do_breakable_col_processing();
+  virtual void discretionary_processing ();
   void copy_breakable_items();
 };
 
index 2a0af1ab1ffa1a3f9f4e80805e89098f9dda8182..2856aa04c5c574834a74c5f8b5e1594d09ddf519 100644 (file)
@@ -42,7 +42,7 @@ public:
     
   /// is #c# contained in #*this#?
   bool contains_b (Paper_column const *c) const;
-    
+  int element_count () const;
 
   void break_into_pieces (Array<Column_x_positions> const&);
   void output_lines ();
index 949ceec254ae602a0c2ab5dbeab10a5c6bb8099c..fe588510e9edb40d8dfc35c9c02e6e0d36e580a3 100644 (file)
@@ -1,5 +1,5 @@
 /*   
-  score-element-callback.hh -- declare  Score_element callbacks
+  score-element-callback.hh -- declare Score_element callbacks
   
   source file of the GNU LilyPond music typesetter
   
index 8c4b9aa3a02b295c40af0738e08e0c1e412fa079..e803d487fe66a838239921c7b9c2000b6c5c05e2 100644 (file)
 #include "lily-guile.hh"
 #include "lily-proto.hh"
 #include "smobs.hh"
-#include "dimension-cache-callback.hh"
-
-
+#include "dimension-cache.hh"
 
+typedef Interval (*Extent_callback)(Score_element const *,Axis);
+typedef Real (*Offset_callback)(Score_element const *,Axis);
 
 
 /**
@@ -85,12 +85,16 @@ public:
   bool used_b_;
   
   char const * name () const;
-  
+
+  /*
+    IDEA: make this a global variable. This is the same for all
+    elements, I think it is safe to assume that we will not have
+    scores being formatted multithreadedly.
+   */
   Paper_score *pscore_l_;
 
   Score_element ();
   Score_element (Score_element const&);
-  virtual void print () const;
 
   /*
     properties
@@ -115,9 +119,6 @@ public:
    */
   SCM remove_elt_property (String nm);
 
-  void Score_element::set_real (String, Real);
-  Real Score_element::get_real (String s) const;
-
   /*
     related classes.
    */
@@ -148,13 +149,12 @@ public:
 
 
   static SCM handle_broken_smobs (SCM, SCM criterion);
-  void recurse_into_smobs (SCM s, void (Score_element::*meth_ptr)());
 
   virtual void do_break_processing ();
   virtual Score_element *find_broken_piece (Line_of_score*) const;
   /// generate rods & springs
   virtual void do_space_processing ();
-  virtual void do_breakable_col_processing ();
+  virtual void discretionary_processing ();
 
   /// do calculations before determining horizontal spacing
   virtual void before_line_breaking ();
@@ -163,9 +163,10 @@ public:
 
   Molecule get_molecule () const;
   void suicide ();
-
-  static Interval preset_extent (Dimension_cache const*);
-  static Interval molecule_extent (Dimension_cache const*);
+  
+  static Interval preset_extent (Score_element const*,Axis);
+  static Interval point_dimension_callback (Score_element const*,Axis );
+  static Interval molecule_extent (Score_element const*,Axis);
 
 protected:
 
@@ -174,13 +175,10 @@ protected:
     be handled by GUILE gc.  */
   virtual ~Score_element ();
   
-  /// do printing of derived info.
-  virtual void do_print () const;
   /// generate the molecule    
   virtual Molecule do_brew_molecule () const;
   ///executed directly after the item is added to the Paper_score
   virtual void do_add_processing ();
-
     
   static Interval dim_cache_callback (Dimension_cache const*);
   
@@ -196,9 +194,9 @@ public:
 
   void init ();
 
-public:
-  Dimension_cache *dim_cache_[NO_AXES];
+  Dimension_cache dim_cache_[NO_AXES];
 
+public:
   bool empty_b (Axis a) const;
   Interval extent (Axis) const;
  
@@ -208,6 +206,12 @@ public:
     
   void translate_axis (Real, Axis);
 
+  /**
+     Find the offset relative to D.  If   D equals THIS, then it is 0.
+     Otherwise, it recursively defd as
+
+     OFFSET_ + PARENT_L_->relative_coordinate (D)
+   */
   Real relative_coordinate (Score_element const* refp, Axis) const;
   /**
     Find the group-element which has both #this# and #s#
@@ -215,10 +219,15 @@ public:
   Score_element*common_refpoint (Score_element const* s, Axis a) const;
   Score_element*common_refpoint (SCM elt_list, Axis a) const;
 
-  bool has_offset_callback_b (Offset_cache_callback, Axis)const;
-  void add_offset_callback (Offset_cache_callback, Axis);
-  void set_extent_callback (Dim_cache_callback , Axis);
-  
+  bool has_offset_callback_b (Offset_callback, Axis)const;
+  void add_offset_callback (Offset_callback, Axis);
+  bool has_extent_callback_b (Extent_callback, Axis)const;  
+  void set_extent_callback (Extent_callback , Axis);
+
+  /**
+    Invoke callbacks to get offset relative to parent.
+   */
+  Real get_offset (Axis a) const;
   /**
      Set the  parent refpoint of THIS to E
    */
index 839c088c2cf7d00b15ee271449f8a832af3cea54..8ace8fcad84bcedda5a7899cbf85546d75d2ee52 100644 (file)
@@ -39,11 +39,11 @@ struct Side_position_interface
   Score_element * elt_l_;
 public:
   Side_position_interface (Score_element const*);
-  static Real side_position (Dimension_cache const *);
-  static Real aligned_on_self (Dimension_cache const *);
-  static Real aligned_side (Dimension_cache const *);  
-  static Real quantised_position (Dimension_cache const*);
-  static Real centered_on_parent (Dimension_cache const*);
+  static Real side_position (Score_element const *, Axis);
+  static Real aligned_on_self (Score_element const *, Axis);
+  static Real aligned_side (Score_element const *, Axis);  
+  static Real quantised_position (Score_element const*, Axis);
+  static Real centered_on_parent (Score_element const*, Axis);
   void set_axis (Axis);
   void set_minimum_space (Real);
   void set_padding (Real);
@@ -59,7 +59,6 @@ public:
   void set_direction (Direction);
 };
 
-Side_position_interface side_position (Score_element*);
 
 #endif /* SIDE_POSITION_INTERFACE_HH */
 
index 796df94a1c1849056b0ffc863ef1277f46c1e284..ff5c6b0700182606f5b92aeea5112523294f9ad2 100644 (file)
@@ -32,7 +32,7 @@ public:
 protected:
   void evaluate_empty ();
 
-  static Interval width_callback(Dimension_cache const*) ;
+  static Interval width_callback(Score_element const*, Axis) ;
   
   virtual Real get_bar_size () const;
   virtual void before_line_breaking ();
index edd3263978b2610ce1eb83c0702149d8c970d6b9..20311c8abb53fcd4f280b5a360e6d9d845fd7be0 100644 (file)
@@ -26,7 +26,7 @@ public:
   void set_interface ();
   bool has_interface_b ();
   void set_position (Real);
-  static Real callback (Dimension_cache const*); 
+  static Real callback (Score_element const*, Axis a);
 
   /**
      Leading are the lead strips between the sticks (lines) of
index 2e963007e26aa438c542f93720866c4247139f94..59ac84f3e1d3d6d1f4573efe6a9fd7381edde8d3 100644 (file)
@@ -18,7 +18,7 @@ protected:
   Stem * stem_l () const;
   virtual Molecule do_brew_molecule () const;
 
-  static Interval dim_callback (Dimension_cache const*);
+  static Interval dim_callback (Score_element*, Axis);
 public:
   Stem_tremolo ();
   void set_stem (Stem *);
index 8eee7cee7ed13c1176f2c456892abb4a46a7bc1e..d843a9846c85ffe51a19402ffed076d8a13d3bd1 100644 (file)
@@ -80,17 +80,17 @@ public:
 
 protected:
   friend class Stem_tremolo;   // ugh.
-  Real  get_default_stem_end_position () const;
+  Real get_default_stem_end_position () const;
   void position_noteheads();
 
 
   Real stem_end_position () const;
-  static Real off_callback (Dimension_cache const*);
+  static Real off_callback (Score_element const*, Axis);
 protected:
   Molecule flag () const;
 
   virtual void before_line_breaking();
-  static Interval dim_callback (Dimension_cache const*);
+  static Interval dim_callback (Score_element const*,Axis);
   virtual Molecule do_brew_molecule() const;
 
   void set_spacing_hints () ;
index 8547dd9f1a3ae5228bc09193608b6de099846510..ed980734523d879b369b112e630d80f462cc4c7b 100644 (file)
@@ -72,8 +72,12 @@ Item::broken_b () const
   return broken_to_drul_[LEFT] || broken_to_drul_[RIGHT];
 }
 
+
+/*
+  Generate items for begin and end-of line.
+ */
 void
-Item::do_breakable_col_processing()
+Item::discretionary_processing()
 {
   if (broken_b ())
     return;
index ebe2ff5b697436ce5f778e66220690fc432ccb8e..9f5b91fa931ae3ccb105eebdc67e2fc9b61aaff4 100644 (file)
@@ -31,15 +31,7 @@ ly_str02scm (char const*c)
 }
 
 
-#if 0
-/*
-  this all really sucks, LilyPond should not communicate with GUILE using strings.
- */
-SCM
-ly_eval_str (String s);
-#endif
 
-  
 /*
   Pass string to scm parser, evaluate one expression.
   Return result value and #chars read.
index 06b20f4e44d729bac25da45ba194f344355db818..abc8b0a4558c7d0731e7130d1adfebfd7977e06d 100644 (file)
@@ -29,6 +29,13 @@ Line_of_score::Line_of_score()
   Axis_group_interface (this).set_axes (Y_AXIS,X_AXIS);
 }
 
+int
+Line_of_score::element_count () const
+{
+  return scm_ilength ( get_elt_property ("all-elements"));
+}
+
+
 /*
   Ugh.  this is grossly hairy.
  */
@@ -48,20 +55,21 @@ Line_of_score::output_lines ()
     {
       unsmob_element (gh_car (s))->do_break_processing ();
     }
-
   /*
     fixups must be done in broken line_of_scores, because new elements
     are put over there.  */
+  int count = 0;
   for (int i=0; i < broken_into_l_arr_.size (); i++)
     {
       Score_element *se = broken_into_l_arr_[i];
-
-      for (SCM s = se->get_elt_property ("all-elements");
-          gh_pair_p (s); s = gh_cdr (s))
+      SCM all = se->get_elt_property ("all-elements");
+      for (SCM s = all; gh_pair_p (s); s = gh_cdr (s))
        {
          unsmob_element (gh_car (s))->fixup_refpoint ();
        }
+      count += scm_ilength (all);
     }
+
   
   /*
     needed for doing items.
@@ -78,6 +86,8 @@ Line_of_score::output_lines ()
       unsmob_element (gh_car (s))->handle_broken_dependencies ();
     }
   handle_broken_dependencies ();
+  progress_indication ( _f("Element count %d.",  count + element_count()));
+
   
   for (int i=0; i < broken_into_l_arr_.size (); i++)
     {
@@ -214,7 +224,11 @@ void
 Line_of_score::pre_processing ()
 {
   for (SCM s = get_elt_property ("all-elements"); gh_pair_p (s); s = gh_cdr (s))
-    unsmob_element (gh_car (s))->do_breakable_col_processing ();
+    unsmob_element (gh_car (s))->discretionary_processing ();
+
+  progress_indication ( _f("Element count %d ",  element_count ()));
+
+  
   for (SCM s = get_elt_property ("all-elements"); gh_pair_p (s); s = gh_cdr (s))
     unsmob_element (gh_car (s))->handle_prebroken_dependencies ();
   
index 2051672ebeb10d31778b470f7a45a6d4d9ce3d2c..f917dc7e8ae0dacd3bcef95575e1a7f6adcc8679 100644 (file)
@@ -125,8 +125,8 @@ Local_key_engraver::process_acknowledged ()
              if (!key_item_p_) 
                {
                  key_item_p_ = new Local_key_item;
-                 side_position (key_item_p_).set_axis (X_AXIS);
-                 side_position (key_item_p_).set_direction (LEFT);
+                 Side_position_interface (key_item_p_).set_axis (X_AXIS);
+                 Side_position_interface (key_item_p_).set_direction (LEFT);
                  staff_symbol_referencer(key_item_p_).set_interface ();
                         
                  announce_element (Score_element_info (key_item_p_, 0));
@@ -135,7 +135,7 @@ Local_key_engraver::process_acknowledged ()
              key_item_p_->add_pitch (note_l->pitch_,
                                      note_l->cautionary_b_,
                                      local_key_.double_to_single_acc(note_l->pitch_));
-             side_position (key_item_p_).add_support (support_l);
+             Side_position_interface (key_item_p_).add_support (support_l);
            }
          
          if (!forget)
@@ -154,7 +154,7 @@ Local_key_engraver::process_acknowledged ()
     }
   if (key_item_p_ && grace_align_l_)
     {
-      side_position (grace_align_l_).add_support (key_item_p_);
+      Side_position_interface (grace_align_l_).add_support (key_item_p_);
       grace_align_l_ =0;
     }
   
@@ -172,7 +172,7 @@ Local_key_engraver::do_pre_move_processing()
   if (key_item_p_)
     {
       for (int i=0; i < support_l_arr_.size(); i++)
-       side_position (key_item_p_).add_support (support_l_arr_[i]);
+       Side_position_interface (key_item_p_).add_support (support_l_arr_[i]);
 
       typeset_element (key_item_p_);
       key_item_p_ =0;
index 3e2bcaa7d267ac5c515cddab94dc55a96e9e3f60..4999f0800ecd3d00d1ec653df93e7df729022e3b 100644 (file)
 
 Paper_outputter::Paper_outputter (Paper_stream  * ps )
 {
-#if 0 
-  molecules_ = gh_cons (SCM_EOL, SCM_EOL);
-  last_cons_ = molecules_;
-#endif
-
  /*
    lilypond -f scm x.ly
    guile -s x.scm
@@ -124,28 +119,14 @@ Paper_outputter::output_comment (String str)
 void
 Paper_outputter::output_scheme (SCM scm)
 {
-#if 0
-  SCM c = gh_cons (scm,gh_cdr (last_cons_));
-  gh_set_cdr_x(last_cons_, c);
-  last_cons_ = c;
-#endif
-
+  /*
+    we don't rename dump_scheme, because we might in the future want
+    to remember Scheme. We don't now, because it sucks up a lot of memory.
+  */
   dump_scheme (scm);
 }
 
 
-#if 0
-void
-Paper_outputter::dump ()
-{
-
-  for (SCM s = gh_cdr (molecules_); gh_pair_p (s); s = gh_cdr (s))
-    {
-      dump_scheme (gh_car (s));
-    }
-}
-#endif
-
 void
 Paper_outputter::dump_scheme (SCM s)
 {
index a398ccac796bea8699f58ee88cfc25e04594b918..7e3388fedff4fa427b54611369b2c62fd192edf1 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  p-score.cc -- implement Paper_score
+  paper-score.cc -- implement Paper_score
 
   source file of the GNU LilyPond music typesetter
 
@@ -67,6 +67,8 @@ Paper_score::calc_breaking ()
 void
 Paper_score::process ()
 {
+  progress_indication ( _f("Element count %d ",  line_l_->element_count ()));
+  
   progress_indication (_ ("Preprocessing elements...") + " ");
 
   /*
@@ -81,7 +83,6 @@ Paper_score::process ()
  
   Array<Column_x_positions> breaking = calc_breaking ();
   line_l_->break_into_pieces (breaking);
-
   
   outputter_l_ = new Paper_outputter (paper_l_->paper_stream_p ());
 ;
@@ -114,7 +115,6 @@ Paper_score::process ()
   scm = gh_list (ly_symbol2scm ("end-output"), SCM_UNDEFINED);
   outputter_l_->output_scheme (scm);
 
-
   // huh?
   delete outputter_l_;
   outputter_l_ = 0;
index be57de3d8b305ec79ac2c2f8336ff1e4ac46f5bd..216670ca3052192c5c2f5456f2d3411473fd0a0e 100644 (file)
@@ -225,7 +225,7 @@ Piano_pedal_engraver::do_pre_move_processing ()
     {
       if (p->item_p_)
        {
-         side_position (p->item_p_).add_staff_support ();
+         Side_position_interface (p->item_p_).add_staff_support ();
          /*
            Hmm.
          */
index 86ef757802050d2f44d4107aeb9023e38b4fa33e..9aeac9c546040b844e283812424ea553b348be1c 100644 (file)
@@ -8,7 +8,9 @@
 
 
 #include <string.h>
+#include <math.h>
 
+#include "libc-extension.hh"
 #include "group-interface.hh"
 #include "misc.hh"
 #include "paper-score.hh"
@@ -37,15 +39,11 @@ remove dynamic_cast<Spanner,Item> and put this code into respective
 
 Score_element::Score_element()
 {
-  dim_cache_[X_AXIS] = new Dimension_cache;
-  dim_cache_[Y_AXIS] = new Dimension_cache;
-  dim_cache_[X_AXIS]->elt_l_ = dim_cache_[Y_AXIS]->elt_l_ = this;
-
   // junkme.
   used_b_ = false;
+  set_extent_callback (molecule_extent, X_AXIS);
+  set_extent_callback (molecule_extent, Y_AXIS);    
 
-  dim_cache_[X_AXIS]->set_extent_callback (molecule_extent);
-  dim_cache_[Y_AXIS]->set_extent_callback (molecule_extent); 
   used_b_ = false;
   pscore_l_=0;
   lookup_l_ =0;
@@ -55,19 +53,14 @@ Score_element::Score_element()
   element_property_alist_ = SCM_EOL;
 
   smobify_self ();
-
-
   set_elt_property ("dependencies", SCM_EOL);
   set_elt_property ("interfaces", SCM_EOL);
 }
 
 
 Score_element::Score_element (Score_element const&s)
+   : dim_cache_ (s.dim_cache_)
 {
-  dim_cache_[X_AXIS] = new Dimension_cache (*s.dim_cache_[X_AXIS]);
-  dim_cache_[Y_AXIS] = new Dimension_cache (*s.dim_cache_[Y_AXIS]);
-  dim_cache_[X_AXIS]->elt_l_ = dim_cache_[Y_AXIS]->elt_l_ = this;
-  
   self_scm_ = SCM_EOL;
   used_b_ = true;
   original_l_ =(Score_element*) &s;
@@ -82,8 +75,6 @@ Score_element::Score_element (Score_element const&s)
 
 Score_element::~Score_element()
 {
-  delete dim_cache_[X_AXIS];
-  delete dim_cache_[Y_AXIS];  
 }
 
 // should also have one that takes SCM arg. 
@@ -132,18 +123,16 @@ Score_element::set_elt_property (String k, SCM v)
 }
 
 Interval
-Score_element::molecule_extent (Dimension_cache const *c)
+Score_element::molecule_extent (Score_element const *s, Axis a )
 {
-  Score_element *s = dynamic_cast<Score_element*>(c->element_l());
   Molecule m = s->do_brew_molecule();
-  return m.extent(c->axis ());
+  return m.extent(a);
 }
 
 Interval
-Score_element::preset_extent (Dimension_cache const *c)
+Score_element::preset_extent (Score_element const *s , Axis a )
 {
-  Score_element *s = dynamic_cast<Score_element*>(c->element_l());
-  SCM ext = s->get_elt_property ((c->axis () == X_AXIS)
+  SCM ext = s->get_elt_property ((a == X_AXIS)
                                 ? "extent-X"
                                 : "extent-Y");
   
@@ -160,22 +149,6 @@ Score_element::preset_extent (Dimension_cache const *c)
 }
 
 
-void
-Score_element::print() const
-{
-#ifndef NPRINT
-  DEBUG_OUT << classname(this) << "{\n";
-    
-  if (flower_dstream && !flower_dstream->silent_b ("Score_element"))
-    ly_display_scm (element_property_alist_);
-
-  if (original_l_)
-    DEBUG_OUT << "Copy ";
-  do_print();
-  
-  DEBUG_OUT <<  "}\n";
-#endif
-}
 
 Paper_def*
 Score_element::paper_l ()  const
@@ -472,11 +445,6 @@ Score_element::linked_b() const
   return used_b_;
 }
 
-void
-Score_element::do_print () const
-{
-}
-
 Score_element*
 Score_element::find_broken_piece (Line_of_score*) const
 {
@@ -486,31 +454,79 @@ Score_element::find_broken_piece (Line_of_score*) const
 void
 Score_element::translate_axis (Real y, Axis a)
 {
-  dim_cache_[a]->translate (y);
+  dim_cache_[a].offset_ += y;
 }  
 
 Real
-Score_element::relative_coordinate (Score_element const*e, Axis a) const
+Score_element::relative_coordinate (Score_element const*refp, Axis a) const
+{
+  if (refp == this)
+    return 0.0;
+
+  /*
+    We catch PARENT_L_ == nil case with this, but we crash if we did
+    not ask for the absolute coordinate (ie. REFP == nil.)
+    
+   */
+  if (refp == dim_cache_[a].parent_l_)
+    return get_offset (a);
+  else
+    return get_offset (a) + dim_cache_[a].parent_l_->relative_coordinate (refp, a);
+}
+
+Real
+Score_element::get_offset (Axis a) const
 {
-  return dim_cache_[a]->relative_coordinate (e ? e->dim_cache_[a] : 0);
+  Score_element *me = (Score_element*) this;
+  while (dim_cache_[a].off_callbacks_.size ())
+    {
+      Offset_callback c = dim_cache_[a].off_callbacks_[0];
+      me->dim_cache_[a].off_callbacks_.del (0);
+      Real r =  (*c) (me,a );
+      if (isinf (r) || isnan (r))
+       {
+         r = 0.0;
+         programming_error ("Infinity or NaN encountered");
+       }
+      me->dim_cache_[a].offset_ +=r;
+    }
+  return dim_cache_[a].offset_;
+}
+
+
+Interval
+Score_element::point_dimension_callback (Score_element const* , Axis)
+{
+  return Interval (0,0);
 }
 
 bool
 Score_element::empty_b (Axis a)const
 {
-  return !dim_cache_[a]->extent_callback_l_;
+  return !dim_cache_[a].extent_callback_l_;
 }
 
 Interval
 Score_element::extent (Axis a) const
 {
-  Dimension_cache const * d = dim_cache_[a];
-  Interval ext = d->get_dim ();
+  Dimension_cache * d = (Dimension_cache *)&dim_cache_[a];
+  if (!d->extent_callback_l_)
+    {
+      d->dim_.set_empty ();
+    }
+  else if (!d->valid_b_)
+    {
+      d->dim_= (*d->extent_callback_l_ ) (this, a);
+      d->valid_b_ = true;
+    }
 
+  Interval ext = d->dim_;
+  
   if (empty_b (a)) 
     return ext;
 
-  SCM extra = get_elt_property (a == X_AXIS ? "extra-extent-X"
+  SCM extra = get_elt_property (a == X_AXIS
+                               ? "extra-extent-X"
                                : "extra-extent-Y");
 
   /*
@@ -539,15 +555,22 @@ Score_element::extent (Axis a) const
 Score_element*
 Score_element::parent_l (Axis a) const
 {
-  Dimension_cache*d= dim_cache_[a]->parent_l_;
-  return d ? d->elt_l_ : 0;
+  return  dim_cache_[a].parent_l_;
 }
 
 Score_element * 
 Score_element::common_refpoint (Score_element const* s, Axis a) const
 {
-  Dimension_cache *dim = dim_cache_[a]->common_refpoint (s->dim_cache_[a]);
-  return dim ? dim->element_l () : 0;
+  /*
+    I don't like the quadratic aspect of this code. Maybe this should
+    be rewritten some time, but the largest chain of parents might be
+    10 high or so, so it shouldn't be a real issue. */
+  for (Score_element const *c = this; c; c = c->dim_cache_[a].parent_l_)
+    for (Score_element const * d = s; d; d = d->dim_cache_[a].parent_l_)
+      if (d == c)
+       return (Score_element*)d;
+
+  return 0;
 }
 
 
@@ -572,17 +595,23 @@ Score_element::name () const
 }
 
 void
-Score_element::add_offset_callback (Offset_cache_callback cb, Axis a)
+Score_element::add_offset_callback (Offset_callback cb, Axis a)
+{
+  dim_cache_[a].off_callbacks_.push (cb);
+}
+
+bool
+Score_element::has_extent_callback_b (Extent_callback cb, Axis a)const
 {
-  dim_cache_[a]->off_callbacks_.push (cb);
+  return cb == dim_cache_[a].extent_callback_l_;
 }
 
 bool
-Score_element::has_offset_callback_b (Offset_cache_callback cb, Axis a)const
+Score_element::has_offset_callback_b (Offset_callback cb, Axis a)const
 {
-  for (int i= dim_cache_[a]->off_callbacks_.size (); i--;)
+  for (int i= dim_cache_[a].off_callbacks_.size (); i--;)
     {
-      if (dim_cache_[a]->off_callbacks_[i] == cb)
+      if (dim_cache_[a].off_callbacks_[i] == cb)
        return true;
     }
   return false;
@@ -591,14 +620,14 @@ Score_element::has_offset_callback_b (Offset_cache_callback cb, Axis a)const
 void
 Score_element::set_extent_callback (Dim_cache_callback dc, Axis a)
 {
-  dim_cache_[a]->extent_callback_l_ = dc ;
+  dim_cache_[a].extent_callback_l_ = dc ;
 }
 
                                    
 void
 Score_element::set_parent (Score_element *g, Axis a)
 {
-  dim_cache_[a]->parent_l_ = g ? g->dim_cache_[a]: 0;
+  dim_cache_[a].parent_l_ = g;
 }
 
 void
@@ -744,6 +773,6 @@ init_functions ()
 ADD_SCM_INIT_FUNC(scoreelt, init_functions);
 
 void
-Score_element::do_breakable_col_processing ()
+Score_element::discretionary_processing()
 {
 }
index 572fd3f807b9698c24cac35f0be832c15979f00f..131bf4bb637401addc37da0f11ee7b273c67c6bb 100644 (file)
@@ -56,12 +56,12 @@ Script_column_engraver::do_post_move_processing ()
 void
 Script_column_engraver::acknowledge_element( Score_element_info inf) 
 {
-  if (side_position (inf.elem_l_).has_interface_b ())
+  if (Side_position_interface (inf.elem_l_).has_interface_b ())
     {
       Item *thing = dynamic_cast<Item*> (inf.elem_l_);
       if (thing
          && !thing->breakable_b ()
-         && side_position (inf.elem_l_).get_axis () == Y_AXIS)
+         && Side_position_interface (inf.elem_l_).get_axis () == Y_AXIS)
        {
          script_l_arr_.push (thing);
        }
index 846cc192e697f3f908e37a891e7a3bdc7f7e73ce..3ea13a879a8180d362581563f72870c464eb8c28 100644 (file)
@@ -159,9 +159,12 @@ Script_engraver::do_pre_move_processing()
 {
   for (int i=0; i < script_p_arr_.size(); i++) 
     {
-      if (to_boolean (script_p_arr_[i]->remove_elt_property ("staff-support")))
-       side_position (script_p_arr_[i]).add_staff_support ();
-      typeset_element (script_p_arr_[i]);
+      Script * sc = script_p_arr_[i];
+      if (to_boolean (sc->remove_elt_property ("staff-support")))
+       {
+         Side_position_interface (sc).add_staff_support ();
+       }
+      typeset_element (sc);
     }
   script_p_arr_.clear();
 }
index c11f2e8909ab363f96c40b3aacde3e13d6d28142..6e018180fd05a83bc21ce7b4c0e661990476bd61 100644 (file)
@@ -21,7 +21,6 @@ Side_position_interface::Side_position_interface (Score_element const *e)
   elt_l_ = (Score_element*)e;
 }
 
-
 void
 Side_position_interface::add_support (Score_element*e)
 {
@@ -61,12 +60,9 @@ Side_position_interface::get_direction () const
  */
 
 Real
-Side_position_interface::side_position (Dimension_cache const * c)
+Side_position_interface::side_position (Score_element const *cme, Axis axis)
 {
-  Score_element * me =  (c->element_l ());
-
-  Interval dim;
-  Axis  axis = c->axis ();
+  Score_element* me = (Score_element*)cme;
   Score_element *common = me->parent_l (axis);
   SCM support = me->get_elt_property ("side-support");
   for (SCM s = support; s != SCM_EOL; s = gh_cdr (s))
@@ -76,6 +72,7 @@ Side_position_interface::side_position (Dimension_cache const * c)
        common = common->common_refpoint (e, axis);
     }
   
+  Interval dim;
   for (SCM s = support; s != SCM_EOL; s = gh_cdr (s))
     {
 
@@ -118,12 +115,12 @@ Side_position_interface::side_position (Dimension_cache const * c)
   callback that centers the element on itself
  */
 Real
-Side_position_interface::aligned_on_self (Dimension_cache const *c)
+Side_position_interface::aligned_on_self (Score_element const*elm, Axis ax)
 {
   String s ("self-alignment-");
-  Axis ax = c->axis ();
+
   s +=  (ax == X_AXIS) ? "X" : "Y";
-  Score_element *elm = c->element_l ();
+
   SCM align (elm->get_elt_property (s));
   if (isdir_b (align))
     {
@@ -160,9 +157,8 @@ directed_round (Real f, Direction d)
   Callback that quantises in staff-spaces, rounding in the direction
   of the elements "direction" elt property. */
 Real
-Side_position_interface::quantised_position (Dimension_cache const *c)
+Side_position_interface::quantised_position (Score_element const *me, Axis a)
 {
-  Score_element * me =  (c->element_l ());
   Side_position_interface s(me);
   Direction d = s.get_direction ();
   Staff_symbol_referencer_interface si (me);
@@ -188,13 +184,11 @@ Side_position_interface::quantised_position (Dimension_cache const *c)
   Position next to support, taking into account my own dimensions and padding.
  */
 Real
-Side_position_interface::aligned_side (Dimension_cache const *c)
+Side_position_interface::aligned_side (Score_element const*me, Axis ax)
 {
-  Score_element * me =  (c->element_l ());
   Side_position_interface s(me);
   Direction d = s.get_direction ();
-  Axis ax = c->axis ();
-  Real o = side_position (c);
+  Real o = side_position (me,ax);
 
   Interval iv =  me->extent (ax);
 
@@ -213,11 +207,8 @@ Side_position_interface::aligned_side (Dimension_cache const *c)
   Position centered on parent.
  */
 Real
-Side_position_interface::centered_on_parent (Dimension_cache const *c)
+Side_position_interface::centered_on_parent (Score_element const* me, Axis a)
 {
-
-  Score_element *me = c->element_l ();
-  Axis a = c->axis ();
   Score_element *him = me->parent_l (a);
 
   return him->extent (a).center ();  
@@ -295,9 +286,3 @@ Side_position_interface::supported_b () const
 }
 
 
-Side_position_interface
-side_position (Score_element* e)
-{
-  Side_position_interface si (e);
-  return si;
-}
index 84a98332365bf4cf6f0a59f23a5c5f79e7c8bd64..c5f29de20fadfba00b1bb743d57519b6e727085f 100644 (file)
@@ -26,9 +26,9 @@ Span_bar::add_bar (Score_element*b)
 
 
 Interval
-Span_bar::width_callback (Dimension_cache const * c)
+Span_bar::width_callback (Score_element const *se, Axis a)
 {
-  Span_bar*  s= dynamic_cast<Span_bar*> (c->element_l ());  
+  Span_bar*  s= dynamic_cast<Span_bar*> ((Score_element*)se);
   String gl = ly_scm2string (s->get_elt_property ("glyph"));
 
   /*
@@ -94,7 +94,7 @@ Span_bar::evaluate_empty ()
 Interval
 Span_bar::get_spanned_interval () const
 {
-  return Axis_group_interface::group_extent_callback (dim_cache_[Y_AXIS]);  
+  return Axis_group_interface::group_extent_callback (this, Y_AXIS);  
 }
 
 
@@ -113,10 +113,10 @@ Span_bar::get_bar_size () const
 Span_bar::Span_bar ()
 {
   group (this).set_interface ();
-  dim_cache_[X_AXIS]->set_extent_callback (width_callback);
+  set_extent_callback (width_callback, X_AXIS);
   
   // dim_cache_[Y_AXIS]->set_extent_callback (Axis_group_interface::group_extent_callback);
 
-  dim_cache_[Y_AXIS]->set_extent_callback (0);
+  set_extent_callback (0, Y_AXIS);
 }
 
index 8126bbbcf172cb47855cb1f623cce71a513b35e9..ed53435809f48b8407957c1360f8b1b505c83a0e 100644 (file)
@@ -23,10 +23,8 @@ Staff_symbol_referencer_interface::set_interface ()
 {
   elt_l_->set_elt_property ("staff-position", gh_double2scm (0.0));
   elt_l_->add_offset_callback (callback, Y_AXIS);
-  
 }
 
-
 bool
 Staff_symbol_referencer_interface::has_interface_b ()
 {
@@ -91,11 +89,8 @@ Staff_symbol_referencer_interface::position_f () const
   should use offset callback!
  */
 Real
-Staff_symbol_referencer_interface::callback (Dimension_cache const * c)
+Staff_symbol_referencer_interface::callback (Score_element const* sc,Axis )
 {
-  Score_element * sc = dynamic_cast<Score_element*> (c->element_l ());
-
-  
   SCM pos = sc->get_elt_property ("staff-position");
   Real off =0.0;
   if (gh_number_p (pos))
index 1bc5041b296c296706b33cad9002fd05710419b8..3da86edc036b9993f1828e9579d7ffa90ae10bea 100644 (file)
@@ -38,9 +38,9 @@ Stem_tremolo::stem_l ()const
 }
 
 Interval
-Stem_tremolo::dim_callback (Dimension_cache const *c) 
+Stem_tremolo::dim_callback (Score_element * se, Axis a)
 {
-  Stem_tremolo * s = dynamic_cast<Stem_tremolo*> (c->element_l ());
+  Stem_tremolo * s = dynamic_cast<Stem_tremolo*> (se);
   Real space = Staff_symbol_referencer_interface (s->stem_l ())
     .staff_space ();
   return Interval (-space, space);
index ce5103d7df7061f9659ea331d77ad8b52d182765..d883849bc664684c9fa4f941acb9226b82a679ca 100644 (file)
@@ -438,9 +438,9 @@ Stem::flag () const
 }
 
 Interval
-Stem::dim_callback (Dimension_cache const* c
+Stem::dim_callback (Score_element const *se, Axis 
 {
-  Stem * s = dynamic_cast<Stem*> (c->element_l ());
+  Stem * s = dynamic_cast<Stem*> ((Score_element*)se);
   
   Interval r (0, 0);
   if (unsmob_element (s->get_elt_property ("beam")) || abs (s->flag_i ()) <= 2)
@@ -493,9 +493,9 @@ Stem::do_brew_molecule () const
 }
 
 Real
-Stem::off_callback (Dimension_cache const * c)
+Stem::off_callback (Score_element const* se, Axis)
 {
-  Stem * st = dynamic_cast<Stem*> (c->element_l ());
+  Stem *st = dynamic_cast<Stem*> ((Score_element*)se);
 
   Real r=0;
   if (Note_head * f = st->first_head ())
index b8514809619f2649549be53e040fe08246a4a7e2..928a1a99245c4f808b6b6ddb778984979d26d3cb 100644 (file)
@@ -67,7 +67,7 @@ System_start_delimiter::after_line_breaking ()
 Molecule
 System_start_delimiter::do_brew_molecule ()const
 {
-  Interval ext = Axis_group_interface::group_extent_callback (dim_cache_[Y_AXIS]);
+  Interval ext = Axis_group_interface::group_extent_callback (this, Y_AXIS);
   Real l = ext.length (); 
   Molecule m;
 
index c0ab61393794be4c987a2c08876189004c0146f9..7c1e15c829e5de555c6cd414139cdf3870407e5b 100644 (file)
@@ -89,9 +89,12 @@ Text_engraver::do_process_music ()
        }
       else
        stafy.set_axis (Y_AXIS);
-      
+
+      /*
+       make sure they're in order by adding i to the priority field.
+       */
       text->set_elt_property ("script-priority",
-                           gh_int2scm (200));
+                           gh_int2scm (200 + i));
 
       if (r->get_direction ())
        stafy.set_direction (r->get_direction ());
@@ -118,8 +121,9 @@ Text_engraver::do_pre_move_processing ()
 {
   for (int i=0; i < texts_.size (); i++)
     {
-      side_position (texts_[i]).add_staff_support ();
-      typeset_element (texts_[i]);
+      Text_item *ti = texts_[i];
+      Side_position_interface (ti).add_staff_support ();
+      typeset_element (ti);
     }
   texts_.clear ();
 }
index 00965fe5823d8ac2bf759b353d8f0f51f6689d57..68c34aeff62d8ff416a98a32263da37e73c752e6 100644 (file)
@@ -37,24 +37,6 @@ Timing_engraver::do_try_music (Music*m)
   return Timing_translator::do_try_music (m);
 }
 
-#if 0
-String
-Timing_engraver::do_process_music ()
-{
-  if (gh_string_p (get_property  ("barType")))
-    ;
-  else if (!now_mom ())
-    {
-      daddy_trans_l_->set_property ("barType", ly_str02scm ("|"));
-    }
-  else
-
-  {
-  }
-}
-#endif
-
-
 /*
   TODO make properties of this.
  */
index 2547fac08bf8dcfe2429dc0ba57ff084c5de9efe..2bcb37086552f5e4ef1f9216a30770f942b2fc83 100644 (file)
@@ -27,9 +27,7 @@ Transposed_music::do_print () const
 Musical_pitch
 Transposed_music::to_relative_octave (Musical_pitch p)
 {
-#if 0                          // Mats?
-    warning (_ ("Will ignore \\relative for transposed music"));
-#endif
+
   return p;
 }
 
index 6c690bb8e7f0022abc4b07a8940e9d205c93aa34..3bafebeec82dc4bc32b8f4dac2e7407010cc0f45 100644 (file)
@@ -161,6 +161,9 @@ Tuplet_spanner::calc_position_and_height (Real *offset, Real * dy) const
 
 
   *offset = - d * infinity_f;
+
+  if (!column_arr.size ())
+    return;
   
   Real x0 = column_arr[0]->relative_coordinate (0, X_AXIS);
   Real x1 = column_arr.top ()->relative_coordinate (0, X_AXIS);
index ad7f9aa3014c3c7933a9ea8a099c9335d6cfd571..d4604f151a124d47ba85dfb1592da3c2918bd9a3 100644 (file)
@@ -25,7 +25,7 @@
 Volta_spanner::Volta_spanner ()
 {
   set_elt_property ("bars", SCM_EOL);
-  side_position (this).set_axis (Y_AXIS);
+  Side_position_interface (this).set_axis (Y_AXIS);
   directional_element (this).set (UP);
 }
 
@@ -112,7 +112,7 @@ Volta_spanner::do_add_processing ()
 void
 Volta_spanner::after_line_breaking ()
 {
-  side_position (this).add_staff_support ();
+  Side_position_interface (this).add_staff_support ();
 }
   
 void
@@ -121,13 +121,13 @@ Volta_spanner::add_bar  (Bar* b)
   Group_interface gi(this, "bars");
   gi.add_element (b);
 
-  side_position (this).add_support (b);
+  Side_position_interface (this).add_support (b);
   add_dependency (b);
 }
 
 void
 Volta_spanner::add_column (Note_column* c)
 {
-  side_position (this).add_support (c);
+  Side_position_interface (this).add_support (c);
   add_dependency (c);
 }
index eea162f829f5cb1437df2c11c4b9925d0d81117c..067d6f4816e86eb0f121ba175a4ab09abf68fdaa 100644 (file)
@@ -1,15 +1,15 @@
 Begin3
 Title: LilyPond
-Version: 1.3.53
-Entered-date: 22MAY00
+Version: 1.3.54
+Entered-date: 25MAY00
 Description: 
 Keywords: music notation typesetting midi fonts engraving
 Author: hanwen@cs.uu.nl (Han-Wen Nienhuys)
        janneke@gnu.org (Jan Nieuwenhuizen)
 Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys)
 Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert
-       1000k lilypond-1.3.53.tar.gz 
+       1000k lilypond-1.3.54.tar.gz 
 Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/
-       1000k lilypond-1.3.53.tar.gz 
+       1000k lilypond-1.3.54.tar.gz 
 Copying-policy: GPL
 End
index a8c7eb39c799034ebe050d511fe8efd57c1b4910..d33d426034fb9932d4d23641922d62624be70f76 100644 (file)
@@ -1,9 +1,9 @@
 Name: lilypond
-Version: 1.3.53
+Version: 1.3.54
 Release: 1
 Copyright: GPL
 Group: Applications/Publishing
-Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.53.tar.gz
+Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.54.tar.gz
 Summary: A program for printing sheet music.
 URL: http://www.cs.uu.nl/~hanwen/lilypond
 # Icon: lilypond-icon.gif