]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 1.3.22 release/1.3.22
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 2 Feb 2000 16:32:01 +0000 (17:32 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 2 Feb 2000 16:32:01 +0000 (17:32 +0100)
==========
* Getopt bugfix: don't assert on certain errors.

* ly2dvi: Remove unnecessary space for the page headers.

* Bugfix convert-mudela

1.3.21.h

41 files changed:
CHANGES
Documentation/user/properties.itely
TODO
VERSION
flower/getopt-long.cc
input/test/staff-size.ly
input/test/tuplet-spanner-duration.ly [new file with mode: 0644]
lily/align-element.cc
lily/align-note-column-engraver.cc
lily/atom.cc
lily/beam-engraver.cc
lily/beam.cc
lily/break-align-item.cc
lily/crescendo.cc
lily/font-metric.cc
lily/include/atom.hh
lily/include/ly-smobs.icc
lily/include/molecule.hh
lily/include/multi-measure-rest-engraver.hh
lily/include/simple-spacer.hh
lily/include/tuplet-engraver.hh
lily/lookup.cc
lily/molecule.cc
lily/multi-measure-rest-engraver.cc
lily/multi-measure-rest.cc
lily/note-column.cc
lily/paper-outputter.cc
lily/score-element.cc
lily/simple-spacer.cc
lily/spanner.cc
lily/timing-translator.cc
lily/tuplet-engraver.cc
lily/tuplet-spanner.cc
lilypond-mode.el
ly/auto-beam-settings.ly
ly/property.ly
make/out/lilypond.lsm
make/out/lilypond.spec
scm/generic-property.scm
scripts/convert-mudela.py
scripts/ly2dvi.py

diff --git a/CHANGES b/CHANGES
index b1c73c72761c664523beb2aa52ef4859aafce4ae..7fd2dfd03fb6e676817742aae17a2c97f2ef4fd3 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,34 @@
+1.3.21.mb1
+==========
+* Getopt bugfix: don't assert on certain errors.
+
+* ly2dvi: Remove unnecessary space for the page headers.
+
+* Bugfix convert-mudela
+
+1.3.21.hwn1
+===========
+
+* Bugfix in lilypond-mode.el: eval-buffering now uses file name and
+not buffer name.
+
+* Scrapped tupletVisibility property. Now use tupletNumberVisibility,
+tupletBracketVisibility, with Scheme value #t, #f or 'if-no-beam.
+\property tupletInvisible will stop all tuplet spanner creation.
+
+* Don't go berserk if tuplet spanner is on only one column.
+
+* Use SCMs & Smobs for Molecules & atoms.  This uses less
+scm_(un)protect_object () calls, so the output stage should be faster.
+
+* Added \property tupletSpannerDuration, to make multiple tuplet signs
+with one \times.
+
+* Some programming Errors in spacing are now caught. Lily does not
+hang when encountering degenerate springs.
+
+* Allow beams to start and end over rests
+
 1.3.19.hwn2
 ===========
 * Fix disappearing clefs when clefs are not printed with a barline.
index e4f98b1284185da44867d626071911d0a68b09dd..41db30bb4837bb07aee91333ecea2eff41333adc 100644 (file)
@@ -330,14 +330,35 @@ c4^"foo"  \emptyText c4^"foo" c4
     @code{\down} to force them below the staff, @code{\up} to force
     them above, or @code{\free} to let LilyPond decide.
 
-  @item @code{tupletVisibility}@indexcode{tupletVisibility} @propertytype{number}
-    [deprecate this, FIXME]
-    Determines whether tuplets of notes are labeled.  Setting
-    to 0 shows nothing; setting to 1 shows a number;
-    setting to 2 shows a number and a bracket if there is no
-    beam; setting to 3 shows a number, and if there is no beam
-    it adds a bracket; setting to 4 shows both a number and a
-    bracket unconditionally.
+  @item  @code{tupletBracketVisibility}@indexcode{tupletBracketVisibility} @propertytype{boolean} or @propertytype{symbol}
+  @item @code{tupletNumberVisibility}@indexcode{tupletNumberVisibility} @propertytype{boolean} or @propertytype{symbol}
+
+       These properties the visibility of the tuplet bracket and its
+number respectively. Setting it to false will prevent printing of the
+associated element. Setting the property to 'if-no-beam will make it
+print only if there is no beam associated with this tuplet bracket.
+
+[fixme examples]
+
+  @item @code{tupletInvisible}@indexcode{tupletInvisible} @propertytype{boolean}
+
+    If set to true, tuplet bracket creation is switched off
+entirely. This has the same effect as setting both
+@code{tupletNumberVisibility} and @code{tupletBracketVisibility} to
+@code{#f}, but as this does not even create elements, this setting
+uses less memory and time.
+
+
+@item @code{tupletSpannerDuration} @indexcode{tupletSpannerDuration}
+@propertytype{moment}
+
+Normally a tuplet bracket is as wide as the
+@code{\times} expression that gave rise to it. By setting this
+property, you can make brackets last shorter. Example
+
+@mudela[verbatim,fragment]
+\context Voice \times 2/3 { \property  Voice.tupletSpannerDuration = #(make-moment 1 4) [c8 c c] [c c c] }
+@end mudela
 
 @end table
 
diff --git a/TODO b/TODO
index 421ec74ddc7e8f84f5242fbcac9175da86000bab..57b88fb58da0bb3e7c72178db199e71a6696504c 100644 (file)
--- a/TODO
+++ b/TODO
@@ -12,7 +12,12 @@ Grep -i for TODO, FIXME and ugh/ugr/urg.
 . * use hash tabs iso. alist_ for elt property?
 . * fix tremolos.
 . * internationalize GUILE msgs.
+gg 
 . * unbroken marks.
+. * write smobifying howto.
+. * tuplet spanner dir
+. * \property autoBeamOverRest (boolean). Don't stop for rests when autobeaming.
+?
 . * put property test files in refman.
 . * fix slurdotted!
 . * alignment within @itemize
diff --git a/VERSION b/VERSION
index 5c90fcb688c1bc6fd7bb9d879143721a96b37242..c12766d66b228d9998639fa201345656924e82ba 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,7 +1,7 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
-PATCH_LEVEL=21
+PATCH_LEVEL=22
 MY_PATCH_LEVEL=
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
index f78e18a8c783c08f871f3191808ea4348641fc00..3f34b5b455232568c0db44b710509e5044b5fe59 100644 (file)
@@ -157,6 +157,7 @@ Getopt_long::report (Errorcod c)
     case E_ILLEGALARG:
       str += _f ("invalid argument `%s' to option `%s'",
         optional_argument_ch_C_, found_option_l_->str ());
+      break;
     default:
       assert (false);
     }
index 37046fc5f0147580e4a4489f78b0bd1cae932c53..43a7e1909546402471af9dbd70fb04f233b7f471 100644 (file)
@@ -1,6 +1,6 @@
 \score {
   \notes \relative c' < \context Voice {
-       \property Staff.staffLineLeading = 4
+       \property Staff.staffSpace = #10
        \property Staff.fontSize = #-1
        \property Voice.fontSize = #-1
        
diff --git a/input/test/tuplet-spanner-duration.ly b/input/test/tuplet-spanner-duration.ly
new file mode 100644 (file)
index 0000000..92f58c1
--- /dev/null
@@ -0,0 +1,12 @@
+
+\score
+{
+\context Voice \notes \relative c'' {
+\time 2/4;
+\times 2/3 { c8 c c c c c  }
+\property Voice . tupletSpannerDuration = #(make-moment 1 4)
+\times 2/3 { c8 c c c c c  }
+
+}
+
+}
index 3ca96844617270250295fc9af6d9d73b3e5837ae..db954498bf1314d76ef8dd049790f6907d25bdc1 100644 (file)
@@ -34,7 +34,7 @@ Align_element::do_side_processing ()
 
   Link_array<Score_element> elems;
   Link_array<Score_element> all_elts (elem_l_arr ());
-  for (int i=0; i < elem_l_arr ().size(); i++) 
+  for (int i=0; i < all_elts.size(); i++) 
     {
       Interval y = all_elts[i]->extent(axis ()) + all_elts[i]->relative_coordinate (this, axis ());
       if (!y.empty_b())
index f83c2747ac15d7600afeb5b6b1b08774424b9bba..a5e3c57bb8b3d19148998f3595512dc98f5fa462 100644 (file)
@@ -15,7 +15,7 @@
 #include "directional-element-interface.hh"
 
 /**
-   catch notes, and put them in a row.
+   Catch notes, and put them in a row. Used for aligning grace notes.
  */
 class Align_note_column_engraver: public Engraver
 {
index eccf3b984351df7181b9ef13405cff5127a504e7..f6eda93aa512b05572e1eda93e4f975227e172cb 100644 (file)
@@ -6,6 +6,9 @@
   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
+#include <math.h>
+#include "ly-smobs.icc"
+
 #include "atom.hh"
 #include "interval.hh"
 #include "string.hh"
 
 Atom::Atom(SCM s)
 {
-  func_ = s;
+  SCM onstack = s;             // protection.
+  func_ = scm_protect_object (s);
+  self_scm_ = SCM_EOL;
+  smobify_self ();
+}
+
+SCM
+Atom::mark_smob (SCM s)
+{
+  Atom*  a = SMOB_TO_TYPE(Atom, s);
+  assert (s == a->self_scm_);
+  return a->func_;
 }
 
 void
@@ -34,5 +48,33 @@ Atom::fontify (Font_metric * met)
   func_ = gh_list (ly_symbol2scm ("string-append"),
                   font_switch , f,
                   SCM_UNDEFINED);
+}
+
+void
+Atom::do_smobify_self ()
+{
+}
 
+Atom::Atom (Atom const &s)
+{
+  off_ = s.off_;
+  func_ = s.func_;
+  self_scm_= SCM_EOL;
+  smobify_self ();
 }
+int
+Atom::print_smob (SCM s, SCM p, scm_print_state*)
+{
+  Atom * a = unsmob_atom (s);
+
+  scm_puts ("#<Atom off ",p);
+  String str(a->off_.str ());
+  scm_puts ((char *)str.ch_C(), p);
+  scm_display (a->func_, p);
+  scm_puts ("> ",p);  
+  return 1;
+}
+  
+IMPLEMENT_UNSMOB(Atom, atom)
+IMPLEMENT_SMOBS(Atom)
+
index ac12b47e5b1c9e3766c0d6a623358644047b9a8c..63037e1a7fe5626a101dceb6669364d93fc7e512 100644 (file)
@@ -180,13 +180,18 @@ Beam_engraver::acknowledge_element (Score_element_info info)
        {
          rhythmic_req->warning (_ ("Stem doesn't fit in beam"));
          prev_start_req_->warning (_ ("Beam was started here"));
-         return;
+         /*
+           don't return, since
+
+           [r4 c8] can just as well be modern notation.
+          */
        }
 
       stem_l->set_elt_property ("duration-log",
                                gh_int2scm (rhythmic_req->duration_.durlog_i_));
       Moment stem_location = now_mom () - beam_start_mom_ + beam_start_location_;
-      beam_info_p_->add_stem (stem_location, rhythmic_req->duration_.durlog_i_ - 2);
+      beam_info_p_->add_stem (stem_location,
+                             (rhythmic_req->duration_.durlog_i_ - 2) >? 1);
       beam_p_->add_stem (stem_l);
     }
 }
index e3d816526dc31cd1ee4f699e661446ad210410bf..6dc4bb25c41600f31b916f7e8cdb00116ab36e45 100644 (file)
@@ -85,7 +85,7 @@ Beam::do_pre_processing ()
   if (visible_stem_count () < 2)
     {
       warning (_ ("beam has less than two stems"));
-      set_elt_property ("transparent", SCM_BOOL_T);
+      //      set_elt_property ("transparent", SCM_BOOL_T);
     }
 
   if (!directional_element (this).get ())
@@ -269,15 +269,17 @@ Beam::do_post_processing ()
   /* first, calculate y, dy */
   Real y, dy;
   calc_position_and_height (&y, &dy);
-  if (suspect_slope_b (y, dy))
-    dy = 0;
+  if (visible_stem_count ())
+    {
+      if (suspect_slope_b (y, dy))
+       dy = 0;
 
-  Real damped_dy = calc_slope_damping_f (dy);
-  Real quantised_dy = quantise_dy_f (damped_dy);
+      Real damped_dy = calc_slope_damping_f (dy);
+      Real quantised_dy = quantise_dy_f (damped_dy);
 
-  y += (dy - quantised_dy) / 2;
-  dy = quantised_dy;
-  
+      y += (dy - quantised_dy) / 2;
+      dy = quantised_dy;
+    }
   /*
     until here, we used only stem_info, which acts as if dir=up
    */
@@ -368,6 +370,7 @@ Beam::calc_position_and_height (Real* y, Real* dy) const
 bool
 Beam::suspect_slope_b (Real y, Real dy) const
 {
+  /* first, calculate y, dy */
   /*
     steep slope running against lengthened stem is suspect
   */
@@ -602,7 +605,9 @@ Beam::stem_beams (Stem *here, Stem *next, Stem *prev) const
   Real bdy = interbeam_f;
   Real stemdx = staffline_f;
 
-  Real dx = last_visible_stem ()->hpos_f () - first_visible_stem ()->hpos_f ();
+  Real dx = visible_stem_count () ?
+    last_visible_stem ()->hpos_f () - first_visible_stem ()->hpos_f ()
+    : 0.0;
   Real dy = get_real ("height");
   Real dydx = dy && dx ? dy/dx : 0;
 
@@ -710,9 +715,19 @@ Beam::do_brew_molecule_p () const
   Molecule *mol_p = new Molecule;
   if (!stem_count ())
     return mol_p;
+  Real x0,dx;
+  if (visible_stem_count ())
+    {
+      x0 = first_visible_stem ()->hpos_f ();
+      dx = last_visible_stem ()->hpos_f () - x0;
+    }
+  else
+    {
+      x0 = stem (0)->hpos_f ();
+      dx = stem_top ()->hpos_f () - x0;
+    }
+  
   
-  Real x0 = first_visible_stem ()->hpos_f ();
-  Real dx = last_visible_stem ()->hpos_f () - x0;
   Real dy = get_real ("height");
   Real dydx = dy && dx ? dy/dx : 0;
   Real y = get_real ("y-position");
@@ -802,9 +817,6 @@ Beam::first_visible_stem () const
       if (!s->invisible_b ())
         return s;
     }
-
-  assert (0);
-
   return 0;
 }
 
@@ -817,8 +829,5 @@ Beam::last_visible_stem () const
       if (!s->invisible_b ())
         return s;
     }
-
-  assert (0);
-  // sigh
   return 0;
 }
index c2c190fcac39aea06df12518049d91343812d7c0..376a71dd25498005e01b69a1d8b8bd5af06759d8 100644 (file)
@@ -5,7 +5,9 @@
 
   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
+#include <math.h>
 
+#include "warn.hh"
 #include "dimension-cache.hh"
 #include "lily-guile.hh"
 #include "break-align-item.hh"
@@ -106,10 +108,20 @@ Break_align_item::do_pre_processing()
   Axis_align_item::do_pre_processing();
 
 
-  Real pre_space = elems[0]->extent (X_AXIS)[LEFT]
-    + elems[0]->relative_coordinate (column_l (), X_AXIS);
-  Real spring_len = elems.top ()->extent (X_AXIS)[RIGHT]
-    + elems.top ()->relative_coordinate (column_l (), X_AXIS);
+  Real pre_space = elems[0]->relative_coordinate (column_l (), X_AXIS);
+
+  Real xl = elems[0]->extent (X_AXIS)[LEFT];
+  if (!isinf (xl))
+    pre_space += xl;
+  else
+    programming_error ("Infinity reached. ");
+
+  Real xr = elems.top ()->extent (X_AXIS)[RIGHT];
+  Real spring_len = elems.top ()->relative_coordinate (column_l (), X_AXIS);
+  if (!isinf (xr))
+    spring_len += xr;
+  else
+    programming_error ("Infinity reached.");
   
   Real stretch_distance =0.;
   
index ef32c1e7c964918cbc3454aceb2b8076ee4417ef..02b31c40c4eb6fd8d66d4dd12a1653adb48bff7f 100644 (file)
@@ -78,19 +78,19 @@ Crescendo * me = (Crescendo*)this;
   Real thick = paper_l ()->get_var ("crescendo_thickness");
 
   const char* hairpin = (gd < 0)? "decrescendo" :  "crescendo";
-  Atom at  (gh_list (ly_symbol2scm (hairpin),
+  Molecule * m
+    = new Molecule;
+  m->dim_.x () = Interval (0, width);
+  m->dim_.y () = Interval (-2*height, 2*height);
+
+  Atom *a = new Atom(gh_list (ly_symbol2scm (hairpin),
                     gh_double2scm (thick),
                     gh_double2scm (width),
                     gh_double2scm (height),
                     gh_double2scm (continued ? height/2 : 0.0),
                     SCM_UNDEFINED));
-  Molecule * m
-    = new Molecule;
-  
-  m->dim_.x () = Interval (0, width);
-  m->dim_.y () = Interval (-2*height, 2*height);
-  m->add_atom (&at);
-  
+
+  m->add_atom (a->self_scm_);
   m->translate_axis (extra_left, X_AXIS);
   return m;
 }
index b420332d14e1778342ece9cd8cdc32d714778e22..c872d5b8d9e90292152b624964860b3f56cdb991 100644 (file)
@@ -10,6 +10,7 @@
 #include <math.h>
 #include <ctype.h>
 
+#include "ly-smobs.icc"
 #include "font-metric.hh"
 
 Box
@@ -124,11 +125,4 @@ Font_metric::print_smob (SCM s, SCM port, scm_print_state * )
   return 1;
 }
 
-Font_metric *
-unsmob_metrics( SCM s)
-{
-  if (SMOB_IS_TYPE_B(Font_metric, s))
-    return SMOB_TO_TYPE(Font_metric, s);
-  else
-    return 0;
-}
+IMPLEMENT_UNSMOB(Font_metric, metrics);
index 931d43f64bf518f00d0a96d3510f64430ee1e8e4..877cdd999ec19dd6bef3e5e90af5d63282a36e76 100644 (file)
 #include "box.hh"
 #include "lily-proto.hh"
 #include "lily-guile.hh"
+#include "smobs.hh"
 
+/**
+   Atoms should only be created on the heap, ie. with
+   "new Atom"
+ */
 class Atom {
   Offset off_;
+
   friend class Molecule;
   friend class Paper_outputter;
 public:
   Atom (SCM s);
+  Atom (Atom const&);
+  
+  DECLARE_SMOBS;
 
   /*
     SCM expression that (when evaluated) gives a TeX string
 representing a musical notation symbol.  */
-  Protected_scm func_;
+  SCM func_;
   void fontify (Font_metric*);
 };
 
+Atom* unsmob_atom (SCM);
 
 #endif
index 3ee8d6db515e231b4d67a963257dbb18213909fe..97da61e6d00c8637b7b095d7355d8e03ce0feee4 100644 (file)
 #ifndef LY_SMOBS_ICC
 #define LY_SMOBS_ICC
 
+#define IMPLEMENT_UNSMOB(CL, name)             \
+CL *                                           \
+unsmob_ ## name ( SCM s)                       \
+{                                              \
+  if (SMOB_IS_TYPE_B(CL, s))                   \
+    return SMOB_TO_TYPE(CL, s);                        \
+  else                                         \
+    return 0;                                  \
+}
+
+
 #define IMPLEMENT_SMOBS(CL)\
 long CL::smob_tag_;\
 static scm_smobfuns CL ## _funs = {                                    \
index d33a100cdf770b30a6132cc53c5ef7dd4fc54c14..f5e94ef60aadf6aa94e532af47043e573ea76389 100644 (file)
@@ -13,6 +13,7 @@
 #include "axes.hh"
 #include "direction.hh"
 #include "cons.hh"
+#include "protected-scm.hh"
 
 //#define ATOM_SMOB
 
 
 */
 class Molecule {
-#ifdef ATOM_SMOB
-  SCM atom_list_;
-#else
-  //  Protected_scm atom_list_;        // change to List<Atom>?
-  Cons<Atom> *atom_list_;
-#endif
+  Protected_scm atom_list_;
+
   friend class Paper_outputter;
 
 public:
@@ -44,9 +41,12 @@ public:
   /**
      Set dimensions to empty, or to (Interval(0,0),Interval(0,0) */
   void set_empty (bool);
-  
   void add_at_edge (Axis a, Direction d, const Molecule &m, Real padding);
-  void add_atom (Atom const *a);    
+
+  /**
+     Add an atom.  The molecule assumes responsibility for cleaning.
+   */
+  void add_atom (SCM as);    
   void add_molecule (Molecule const &m);
   void translate (Offset);
   
@@ -67,8 +67,9 @@ public:
   Interval extent (Axis) const;
 
   Molecule (const Molecule&s);
-  void print() const;
+
   void operator=(const Molecule&);  
   bool empty_b() const;
+  void print ()const;
 };
 #endif
index c976d681f88e9d19cd74ae03510bce6d465038e9..951112c3ef85c199bbd082ee50d11b2e59f4aadd 100644 (file)
@@ -6,34 +6,3 @@
   (c) 1998--2000 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
-#ifndef MULTI_MEASURE_REST_ENGRAVER_HH
-#define MULTI_MEASURE_REST_ENGRAVER_HH
-
-#include "engraver.hh"
-#include "moment.hh"
-
-/**
- */
-class Multi_measure_rest_engraver : public Engraver
-{
-public:
-  VIRTUAL_COPY_CONS(Translator);
-  
-  Multi_measure_rest_engraver ();
-
-protected:
-  virtual void acknowledge_element (Score_element_info i);
-  virtual void do_process_requests ();
-  virtual bool do_try_music (Music*);
-  virtual void do_pre_move_processing ();
-  virtual void do_post_move_processing ();
-
-private:
-  Drul_array<Moment> rest_moments_;
-  
-  int start_measure_i_;
-  Rhythmic_req* multi_measure_req_l_;
-  Multi_measure_rest* mmrest_p_;
-  Multi_measure_rest* lastrest_p_;
-};
-#endif // MULTI_MEASURE_REST_ENGRAVER_HH
index 712349d878af07fcd6b619a09990ec34039ff05b..e0c9840924f8f3d01d88a2ec12252829a8ce4778 100644 (file)
@@ -25,6 +25,7 @@ struct Spring_description
   Real length (Real force) const;
   Spring_description ();
   Real energy_f (Real) const;
+  bool sane_b () const;
 };
 
 /**
index 7b50fb86ec2dabce8c26891bbe8b4f166c5bb5b1..64539a0f784e6095c99c09aba8d29247316c9990 100644 (file)
 #ifndef AUTO_PLET_ENGRAVER_HH
 #define AUTO_PLET_ENGRAVER_HH
 
-#include "engraver.hh"
-
-class Tuplet_engraver : public Engraver
-{
-  void typeset_all ();
-public:
-  VIRTUAL_COPY_CONS(Translator);
-
-
-protected:
-  Link_array<Time_scaled_music> time_scaled_music_arr_;
-  Array<Moment> stop_moments_;
-  Link_array<Tuplet_spanner> started_span_p_arr_;
-
-
-  virtual void do_removal_processing ();
-  virtual void acknowledge_element (Score_element_info);
-  virtual bool do_try_music (Music*r);
-  virtual void do_process_requests ();
-  virtual void do_post_move_processing ();
-};
-
-
-
-#endif /* AUTO_PLET_ENGRAVER_HH */
index 6f97d92b6d3bc8be2bb3108d5972d436d530251f..afcd03b804afa2586c375f48b7c306048aed559a 100644 (file)
@@ -98,13 +98,13 @@ Lookup::afm_find (String s, bool warn) const
       return m;
     }
   
-  Atom at (gh_list (ly_symbol2scm ("char"),
+  Atom* at = new Atom (gh_list (ly_symbol2scm ("char"),
                    gh_int2scm (cm->code),
                    SCM_UNDEFINED));
 
-  at.fontify (afm_l_);
+  at->fontify (afm_l_);
   m.dim_ = afm_bbox_to_box (cm->charBBox);
-  m.add_atom (&at);
+  m.add_atom (at->self_scm_);
   return m;
 }
 
@@ -210,16 +210,18 @@ Lookup::beam (Real slope, Real width, Real thick) const
 
   
   Molecule m;
-  Atom at
+  m.dim_[X_AXIS] = Interval (0, width);
+  m.dim_[Y_AXIS] = Interval (min_y, max_y);
+
+  
+  Atom *at = new Atom
     (gh_list (ly_symbol2scm ("beam"),
              gh_double2scm (width),
              gh_double2scm (slope),
              gh_double2scm (thick),
              SCM_UNDEFINED));
 
-  m.dim_[X_AXIS] = Interval (0, width);
-  m.dim_[Y_AXIS] = Interval (min_y, max_y);
-  m.add_atom (&at);
+  m.add_atom (at->self_scm_);
   return m;
 }
 
@@ -237,13 +239,13 @@ Lookup::dashed_slur (Bezier b, Real thick, Real dash) const
       l = gh_cons (ly_offset2scm (b.control_[i]), l);
     }
 
-  Atom at (gh_list (ly_symbol2scm ("dashed-slur"),
+  Atom *at = new Atom(gh_list (ly_symbol2scm ("dashed-slur"),
                    gh_double2scm (thick), 
                    gh_double2scm (dash),
                    ly_quote_scm (l),
                    SCM_UNDEFINED));
   Molecule m;
-  m.add_atom (&at);
+  m.add_atom (at->self_scm_);
   return m;
 }
 
@@ -284,7 +286,7 @@ Lookup::filledbox (Box b ) const
 {
   Molecule m;
   
-  Atom at  (gh_list (ly_symbol2scm ("filledbox"),
+  Atom* at  = new Atom(gh_list (ly_symbol2scm ("filledbox"),
                     gh_double2scm (-b[X_AXIS][LEFT]),
                     gh_double2scm (b[X_AXIS][RIGHT]),                 
                     gh_double2scm (-b[Y_AXIS][DOWN]),
@@ -292,7 +294,7 @@ Lookup::filledbox (Box b ) const
                     SCM_UNDEFINED));
 
   m.dim_ = b;
-  m.add_atom (&at);
+  m.add_atom (at->self_scm_);
   return m;
 }
 
@@ -390,12 +392,12 @@ Lookup::text (String style, String text, Paper_def *paper_l) const
     
   m.dim_ = metric_l->text_dimension (text);
   
-  Atom at  (gh_list (ly_symbol2scm ("text"),
+  Atom *at = new Atom (gh_list (ly_symbol2scm ("text"),
                     ly_str02scm (text.ch_C()),
                     SCM_UNDEFINED));
-  at.fontify (metric_l);
+  at->fontify (metric_l);
   
-  m.add_atom (&at);
+  m.add_atom (at->self_scm_);
   return m;
 }
   
@@ -438,13 +440,13 @@ Lookup::staff_brace (Real y, int staff_size) const
 
   String nm = String ("feta-braces" + to_str (staff_size));
   SCM e =gh_list (ly_symbol2scm ("char"), gh_int2scm (idx), SCM_UNDEFINED);
-  Atom at  (e);
+  Atom *at = new Atom (e);
 
-  at.fontify (all_fonts_global_p->find_font (nm));
+  at->fontify (all_fonts_global_p->find_font (nm));
   
   m.dim_[Y_AXIS] = Interval (-y/2,y/2);
   m.dim_[X_AXIS] = Interval (0,0);
-  m.add_atom (&at);
+  m.add_atom (at->self_scm_);
   return m;
 }
 
@@ -456,7 +458,7 @@ Lookup::tuplet_bracket (Real dy , Real dx, Real thick, Real gap,
 {
   Molecule m;
 
-  Atom at  (gh_list(ly_symbol2scm ("tuplet"),
+  Atom *at = new Atom (gh_list(ly_symbol2scm ("tuplet"),
                    gh_double2scm (height),
                    gh_double2scm (gap),
                    gh_double2scm (dx),
@@ -464,7 +466,7 @@ Lookup::tuplet_bracket (Real dy , Real dx, Real thick, Real gap,
                    gh_double2scm (thick),
                    gh_int2scm (dir),
                    SCM_UNDEFINED));
-  m.add_atom (&at);
+  m.add_atom (at->self_scm_);
 
   return m;
 }
@@ -499,7 +501,7 @@ Lookup::slur (Bezier curve, Real curvethick, Real linethick) const
     }
   
   
-  Atom at  (gh_list (ly_symbol2scm ("bezier-sandwich"),
+  Atom *at = new Atom (gh_list (ly_symbol2scm ("bezier-sandwich"),
                     ly_quote_scm (list),
                     gh_double2scm (linethick),
                     SCM_UNDEFINED));
@@ -507,7 +509,7 @@ Lookup::slur (Bezier curve, Real curvethick, Real linethick) const
   Molecule m; 
   m.dim_[X_AXIS] = curve.extent (X_AXIS);
   m.dim_[Y_AXIS] = curve.extent (Y_AXIS);
-  m.add_atom (&at);
+  m.add_atom (at->self_scm_);
   return m;
 }
 
@@ -515,7 +517,7 @@ Molecule
 Lookup::staff_bracket (Real height, Paper_def* paper_l) const
 {
   Molecule m;
-  Atom at  ( gh_list (ly_symbol2scm ("bracket"),
+  Atom *at = new Atom  ( gh_list (ly_symbol2scm ("bracket"),
                      gh_double2scm (paper_l->get_var("bracket_arch_angle")),
                      gh_double2scm (paper_l->get_var("bracket_arch_width")),
                      gh_double2scm (paper_l->get_var("bracket_arch_height")),
@@ -525,7 +527,7 @@ Lookup::staff_bracket (Real height, Paper_def* paper_l) const
                      gh_double2scm (paper_l->get_var("bracket_thick")),
                      SCM_UNDEFINED));
   
-  m.add_atom (&at);                             
+  m.add_atom (at->self_scm_);                           
   m.dim_[Y_AXIS] = Interval (-height/2,height/2);
   m.dim_[X_AXIS] = Interval (0,4 PT);
 
@@ -538,7 +540,7 @@ Lookup::volta (Real h, Real w, Real thick, bool vert_start, bool vert_end) const
 {
   Molecule m; 
 
-  Atom at  (gh_list (ly_symbol2scm ("volta"),
+  Atom *at = new Atom(gh_list (ly_symbol2scm ("volta"),
                     gh_double2scm (h),
                     gh_double2scm (w),
                     gh_double2scm (thick),
@@ -549,7 +551,7 @@ Lookup::volta (Real h, Real w, Real thick, bool vert_start, bool vert_end) const
   m.dim_[Y_AXIS] = Interval (- h/2, h/2);
   m.dim_[X_AXIS] = Interval (0, w);
 
-  m.add_atom (&at);
+  m.add_atom (at->self_scm_);
   return m;
 }
 
index 2243f8517e8258b9eec3be53afe9d0539400e588..45fa78b7ec5a5a019fd9a87d263e799beaf12ecc 100644 (file)
@@ -5,32 +5,15 @@
 
   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
+#include <math.h>
 
 #include "interval.hh"
 #include "string.hh"
 #include "molecule.hh"
 #include "atom.hh"
 #include "debug.hh"
-
 #include "killing-cons.tcc"
 
-#ifdef ATOM_SMOB
-#define MOL_EOL SCM_EOL
-#define NEXT_CELL(a) gh_cdr(a)
-#define CELLTYPE SCM
-#define UNBOX_ATOM(a) Atom::atom_l (a)
-#define BOX_ATOM(a) a->make_smob ()
-#define NEWCELL(a,b) gh_cons (a,b)
-#define UNBOX_PTR(a) gh_car (a)
-#else
-#define MOL_EOL 0
-#define NEXT_CELL(a) ptr->next_
-#define CELLTYPE Cons<Atom>*
-#define UNBOX_ATOM(a) a
-#define UNBOX_PTR(a) a->car_
-#define BOX_ATOM(a) a
-#define NEWCELL(a,b) new Killing_cons<Atom>(a,b)
-#endif
 
 Box
 Molecule::extent() const
@@ -47,9 +30,15 @@ Molecule::extent(Axis a) const
 void
 Molecule::translate (Offset o)
 {
-  for (CELLTYPE ptr = atom_list_; ptr != MOL_EOL; ptr = NEXT_CELL(ptr))
+  if (isinf (o.length ()))
+    {
+      programming_error ("Translating infinitely. Ignore.");
+      return;
+    }
+    
+  for (SCM ptr = gh_cdr (atom_list_);  ptr != SCM_EOL; ptr = gh_cdr(ptr))
     {
-      UNBOX_ATOM(UNBOX_PTR(ptr))->off_ += o;
+      unsmob_atom (gh_car (ptr))->off_ += o;
     }
   if (!empty_b ())
     dim_.translate (o);
@@ -58,8 +47,15 @@ Molecule::translate (Offset o)
 void
 Molecule::translate_axis (Real x,Axis a)
 {
-  for (CELLTYPE  ptr = atom_list_; ptr != MOL_EOL; ptr = NEXT_CELL(ptr))
-    UNBOX_ATOM (UNBOX_PTR(ptr))->off_[a] += x;
+  if (isinf (x))
+    {
+      programming_error ("Translating infinitely. Ignore.");
+      return;
+    }
+  for (SCM ptr = gh_cdr (atom_list_);  ptr != SCM_EOL; ptr = gh_cdr(ptr))
+    {
+      unsmob_atom (gh_car (ptr))->off_[a] += x;
+    }
 
   if (!dim_[a].empty_b ())
     dim_[a] += x;
@@ -68,30 +64,30 @@ Molecule::translate_axis (Real x,Axis a)
 void
 Molecule::add_molecule (Molecule const &m)
 {
-  for (CELLTYPE  ptr = m.atom_list_; ptr != MOL_EOL; ptr = NEXT_CELL(ptr))
-    add_atom(UNBOX_ATOM (UNBOX_PTR(ptr)));
-  
+  for (SCM ptr = gh_cdr (m.atom_list_);  ptr != SCM_EOL; ptr = gh_cdr(ptr))
+    {
+      Atom *a = new Atom (*unsmob_atom (gh_car (ptr)));
+      add_atom (a->self_scm_);
+    }
   dim_.unite (m.dim_);
 }
 
 void
-Molecule::add_atom (Atom const *al)
+Molecule::add_atom (SCM atomsmob)
 {
-  Atom *a = new Atom(*al);
+  gh_set_cdr_x (atom_list_,
+               gh_cons  (atomsmob, gh_cdr (atom_list_)));
 
-  atom_list_ = NEWCELL(BOX_ATOM(a), atom_list_);
+  scm_unprotect_object (atomsmob);
 }
 
 void
 Molecule::operator=(Molecule const & src)
 {
-  if (&src == this) return;
-
-#ifndef ATOM_SMOB
-  delete atom_list_;
-#endif
+  if (&src == this)
+    return;
 
-  atom_list_ = MOL_EOL;
+  atom_list_ = gh_cons (SCM_EOL,SCM_EOL);
   dim_= src.dim_;
   add_molecule (src);
 }
@@ -111,31 +107,26 @@ Molecule::set_empty (bool e)
     }
 }
 
+void
+Molecule::print () const
+{
+#ifndef NPRINT
+  for (SCM ptr = gh_cdr (atom_list_);  ptr != SCM_EOL; ptr = gh_cdr(ptr))
+    gh_display (gh_car (ptr));
+#endif
+}
+
 Molecule::Molecule (Molecule const &s)
 {
-  atom_list_ = MOL_EOL;
+  atom_list_ = gh_cons (SCM_EOL, SCM_EOL);
   set_empty (true);
   add_molecule (s);
 }
 
 Molecule::~Molecule ()
 {
-#ifndef ATOM_SMOB
-  delete atom_list_;
-#endif
 }
 
-void
-Molecule::print() const
-{
-#ifndef NPRINT
-  if (! flower_dstream)
-    return;
-  DEBUG_OUT << "dim:";
-  for (Axis i=X_AXIS; i < NO_AXES; incr (i))
-    DEBUG_OUT << axis_name_str (i) << " = " << dim_[i].str ();
-#endif
-}
 
 void
 Molecule::align_to (Axis a, Direction d)
@@ -155,7 +146,7 @@ Molecule::Molecule ()
 {
   dim_[X_AXIS].set_empty ();
   dim_[Y_AXIS].set_empty ();
-  atom_list_ = MOL_EOL;
+  atom_list_ = gh_cons (SCM_EOL, SCM_EOL);
 }
 
 
@@ -177,5 +168,5 @@ Molecule::add_at_edge (Axis a, Direction d, Molecule const &m, Real padding)
 bool
 Molecule::empty_b () const
 {
-  return atom_list_ == MOL_EOL;
+  return gh_cdr (atom_list_) == SCM_EOL;
 }
index 6bb488a547095c46f77ec6d07acee011dccbb140..7ac5c3791f9949023f7f40e08fa6b927658fae63 100644 (file)
@@ -8,13 +8,38 @@
 #include "proto.hh"
 #include "musical-request.hh"
 #include "multi-measure-rest.hh"
-#include "multi-measure-rest-engraver.hh"
 #include "paper-column.hh"
 #include "engraver-group-engraver.hh"
 #include "timing-translator.hh"
 #include "bar.hh"
 #include "staff-symbol-referencer.hh"
+#include "engraver.hh"
+#include "moment.hh"
 
+/**
+ */
+class Multi_measure_rest_engraver : public Engraver
+{
+public:
+  VIRTUAL_COPY_CONS(Translator);
+  
+  Multi_measure_rest_engraver ();
+
+protected:
+  virtual void acknowledge_element (Score_element_info i);
+  virtual void do_process_requests ();
+  virtual bool do_try_music (Music*);
+  virtual void do_pre_move_processing ();
+  virtual void do_post_move_processing ();
+
+private:
+  Drul_array<Moment> rest_moments_;
+  
+  int start_measure_i_;
+  Rhythmic_req* multi_measure_req_l_;
+  Multi_measure_rest* mmrest_p_;
+  Multi_measure_rest* lastrest_p_;
+};
 
 ADD_THIS_TRANSLATOR (Multi_measure_rest_engraver);
 
@@ -81,7 +106,10 @@ Multi_measure_rest_engraver::do_process_requests ()
       Staff_symbol_referencer_interface si (mmrest_p_);
       si.set_interface ();
 
-      
+
+      /*
+       UGH. JUNKME
+       */
       if(dynamic_cast<Repetitions_req *> (multi_measure_req_l_))
        mmrest_p_->set_elt_property ("alt-symbol", 
                                     ly_str02scm ("scripts-repeatsign"));
index e25dffbbc6d9d9788762ab4ec52be1af4f0fd146..ea462cee20b90a34ad06fcf30df884337f303a4b 100644 (file)
@@ -27,9 +27,6 @@ Multi_measure_rest::Multi_measure_rest ()
 }
 
 
-
-
-
 /*
    [TODO]                                          17
  * variable-sized multi-measure rest symbol: |====| ??
index 00fb47af383604cde151285034cb6de99b791c18..8dca8fc0610632b10737a4d088423cf70256438c 100644 (file)
@@ -153,7 +153,7 @@ Note_column::do_post_processing ()
     return;
 
   Beam * b = stem_l ()->beam_l ();
-  if (!b || !b->stem_count ())
+  if (!b || !b->visible_stem_count ())
     return;
   
   /* ugh. Should be done by beam.
@@ -171,6 +171,7 @@ Note_column::do_post_processing ()
   if (gh_number_p (s))
     beam_y = gh_scm2double (s);
 
+  
   Real x0 = b->first_visible_stem ()->hpos_f ();
   Real dx = b->last_visible_stem ()->hpos_f () - x0;
   Real dydx = beam_dy && dx ? beam_dy/dx : 0;
index f1df4c15fef0aad5921ad457f983c8482981b3bd..7c14708d7f28634f834ea68d72f26f70c963f002 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <time.h>
 #include <fstream.h>
+#include <math.h>
 
 #include "dimensions.hh"
 #include "dictionary-iter.hh"
@@ -78,9 +79,9 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm)
       output_comment (nm);
     }
       
-  for (Cons<Atom> *ptr = m->atom_list_; ptr; ptr = ptr->next_)
+  for (SCM ptr = gh_cdr (m->atom_list_); ptr != SCM_EOL; ptr = gh_cdr (ptr))
     {
-      Atom * i = ptr->car_;
+      Atom * i = unsmob_atom (gh_car (ptr));
 
       Offset a_off = i->off_;
       a_off += o;
@@ -88,18 +89,19 @@ Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm)
       if (!i->func_)
        continue; 
 
-      if (a_off.length () > 100 CM)
+      Axis a = X_AXIS;
+      while (a < NO_AXES)
        {
-         programming_error ("improbable offset for object");
-         Axis a  =X_AXIS;
-         while (a < NO_AXES)
+         if (abs(a_off[a]) > 30 CM
+             || isinf (a_off[a]) || isnan (a_off[a]))
            {
-             if (abs(a_off[a]) > 30 CM)
-               a_off[a] = 30 CM;
-             incr (a);
+             programming_error ("Improbable offset for object: setting to zero");
+             a_off[a] =  0.0;
            }
+         incr (a);
        }
-       
+
+       
       SCM box_scm
        = gh_list (ly_symbol2scm ("placebox"),
                   gh_double2scm (a_off[X_AXIS]),
index 6569b790a1424ce3f4dd73e56e20c9769e7e39de..7bbf22594dcc22889d9bfe2a1cb727698277beab 100644 (file)
@@ -491,48 +491,7 @@ Score_element::find_broken_piece (Line_of_score*) const
   return 0;
 }
 
-SCM
-Score_element::mark_smob (SCM ses)
-{
-  void * mp = (void*) gh_cdr(ses);
-  Score_element * s = (Score_element*) mp;
-
-  if (s->self_scm_ != ses)
-    {
-      programming_error ("SMOB marking gone awry");
-      return SCM_EOL;
-    }
-  return s->element_property_alist_;
-}
-
-
-int
-Score_element::print_smob (SCM s, SCM port, scm_print_state *)
-{
-  Score_element *sc = (Score_element *) gh_cdr (s);
-     
-  scm_puts ("#<Score_element ", port);
-  scm_puts ((char *)sc->name (), port);
-
-  // scm_puts (" properties = ", port);
-  // scm_display (sc->element_property_alist_, port);
-  scm_puts (" >", port);
-  return 1;
-}
-
-void
-Score_element::do_smobify_self ()
-{
-  scm_unprotect_object (element_property_alist_); // ugh
-}
-#include "ly-smobs.icc"
-IMPLEMENT_SMOBS(Score_element);
 
-SCM
-Score_element::equal_p (SCM a, SCM b)
-{
-  return gh_cdr(a) == gh_cdr(b) ? SCM_BOOL_T : SCM_BOOL_F;
-}
 
 void
 Score_element::translate_axis (Real y, Axis a)
@@ -573,15 +532,6 @@ Score_element::extent (Axis a) const
   return d->get_dim ();
 }
 
-Score_element*
-unsmob_element (SCM s)
-{
-  if (SMOB_IS_TYPE_B (Score_element, s))
-    return SMOB_TO_TYPE(Score_element,s);
-  else
-    return 0;
-}
-
 
 Score_element*
 Score_element::parent_l (Axis a) const
@@ -648,3 +598,52 @@ Score_element::fixup_refpoint ()
        }
     }
 }
+
+
+
+/****************************************************
+  SMOB funcs
+ ****************************************************/
+
+
+#include "ly-smobs.icc"
+
+IMPLEMENT_SMOBS(Score_element);
+IMPLEMENT_UNSMOB(Score_element, element);
+SCM
+Score_element::mark_smob (SCM ses)
+{
+  Score_element * s = SMOB_TO_TYPE (Score_element, ses);
+  if (s->self_scm_ != ses)
+    {
+      programming_error ("SMOB marking gone awry");
+      return SCM_EOL;
+    }
+  return s->element_property_alist_;
+}
+
+int
+Score_element::print_smob (SCM s, SCM port, scm_print_state *)
+{
+  Score_element *sc = (Score_element *) gh_cdr (s);
+     
+  scm_puts ("#<Score_element ", port);
+  scm_puts ((char *)sc->name (), port);
+
+  // scm_puts (" properties = ", port);
+  // scm_display (sc->element_property_alist_, port);
+  scm_puts (" >", port);
+  return 1;
+}
+
+void
+Score_element::do_smobify_self ()
+{
+  scm_unprotect_object (element_property_alist_); // ugh
+}
+
+SCM
+Score_element::equal_p (SCM a, SCM b)
+{
+  return gh_cdr(a) == gh_cdr(b) ? SCM_BOOL_T : SCM_BOOL_F;
+}
index a053d9f6f873b47d0fb3495e8c0957efed11b9c3..4910fd27de868d60814da505a9dc28a9c47e1c3a 100644 (file)
@@ -12,6 +12,7 @@
   
 */
 
+#include <math.h>
 
 #include "simple-spacer.hh"
 #include "paper-column.hh"
@@ -32,13 +33,20 @@ Simple_spacer::Simple_spacer ()
 void
 Simple_spacer::add_rod (int l, int r, Real dist)
 {
+  if (isinf (dist) || isnan (dist))
+    {
+      programming_error ("Weird minimum distance. Ignoring");
+      return;
+    }
+  
+  
   Real c = range_stiffness (l,r);
   Real d = range_ideal_len (l,r);
   Real block_stretch = dist - d;
   
   Real block_force = c * block_stretch;
   force_f_ = force_f_ >? block_force;
-  
+
   for (int i=l; i < r; i++)
     springs_[i].block_force_f_ = block_force >?
       springs_[i].block_force_f_ ;
@@ -184,6 +192,13 @@ Simple_spacer::add_columns (Link_array<Paper_column> cols)
          desc.hooke_f_ = 1.0;
          desc.ideal_f_ = default_space_f_;
        }
+
+      if (!desc.sane_b ())
+       {
+         programming_error ("Insane spring.");
+         continue;
+       }
+      
       desc.block_force_f_ = - desc.hooke_f_ * desc.ideal_f_; // block at distance 0
       springs_.push  (desc);
     }
@@ -240,6 +255,13 @@ Spring_description::energy_f (Real force) const
   return e;
 }
 
+bool
+Spring_description::sane_b () const
+{
+  return (hooke_f_ > 0) &&  ! isinf (ideal_f_) && !isnan (ideal_f_);
+}
+
+
 Real
 Simple_spacer::energy_f () const
 {
index 77d35356b6f9d939355d35e000470939e32e4274..7d0ca15fdd2635b27c47641b2c2231f1c5c6ddf6 100644 (file)
@@ -5,6 +5,7 @@
 
   (c) 1996, 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
+#include <math.h>
 
 #include "dimension-cache.hh"
 #include "debug.hh"
@@ -187,7 +188,10 @@ Spanner::do_space_processing ()
   Array<Spring> ss (get_springs ());
   for (int i=0; i < ss.size (); i++)
     {
-      ss[i].add_to_cols ();
+      if (isinf (ss[i].distance_f_))
+       programming_error ("weird spring");
+      else
+       ss[i].add_to_cols ();
     }
 }
 
index 479ed456d43a25e83d7d27bebf756588fed2a1f1..8f93df70e19e50fac21a0e691e03806f22eb9d00 100644 (file)
@@ -93,7 +93,7 @@ Timing_translator::do_pre_move_processing()
 
   /* allbars == ! skipbars */
   SCM sb = get_property ("skipBars", 0);
-  bool allbars = !(gh_boolean_p (sb)&&gh_scm2bool (sb));
+  bool allbars = !to_boolean (sb);
 
   // urg: multi bar rests: should always process whole of first bar?
   SCM tim = get_property ("timing", 0);
index 478ad40abd99345b213c8a74459423020e671490..39dbc7b12b8289530fce9b6ae0825d3a1ecf8363 100644 (file)
@@ -1,5 +1,5 @@
 /*   
-  auto-plet-engraver.cc --  implement Auto_plet_engraver
+  plet-engraver.cc --  implement Tuplet_engraver
   
   source file of the GNU LilyPond music typesetter
   
@@ -7,13 +7,36 @@
   
  */
 
-#include "tuplet-engraver.hh"
+
 #include "command-request.hh"
 #include "tuplet-spanner.hh"
 #include "note-column.hh"
 #include "time-scaled-music.hh"
 #include "beam.hh"
 #include "music-list.hh"
+#include "engraver.hh"
+
+class Tuplet_engraver : public Engraver
+{
+public:
+  VIRTUAL_COPY_CONS(Translator);
+
+protected:
+  Link_array<Time_scaled_music> time_scaled_music_arr_;
+  /// when does the scaled music stop? Array order is synced with time_scaled_music_arr_
+  Array<Moment> stop_moments_;
+  /// when does the current spanner stop? Array order is synced with time_scaled_music_arr_
+  Array<Moment> span_stop_moments_;
+  
+  /// The spanners. Array order is synced with time_scaled_music_arr_
+  Link_array<Tuplet_spanner> started_span_p_arr_;
+
+  virtual void do_removal_processing ();
+  virtual void acknowledge_element (Score_element_info);
+  virtual bool do_try_music (Music*r);
+  virtual void do_process_requests ();
+  virtual void do_post_move_processing ();
+};
 
 bool
 Tuplet_engraver::do_try_music (Music *r)
@@ -24,7 +47,14 @@ Tuplet_engraver::do_try_music (Music *r)
       if (!dynamic_cast<Request_chord*> (el))
        {
          time_scaled_music_arr_.push (c);
-         stop_moments_.push (now_mom () + c->length_mom ());
+         Moment m = now_mom () + c->length_mom ();
+         stop_moments_.push (m);
+
+         SCM s = get_property ("tupletSpannerDuration",0);
+         if (SMOB_IS_TYPE_B(Moment, s))
+           m = m <? (now_mom () + *SMOB_TO_TYPE(Moment,s));
+         
+         span_stop_moments_.push (m);
        }
       return true;
     }
@@ -34,27 +64,24 @@ Tuplet_engraver::do_try_music (Music *r)
 void
 Tuplet_engraver::do_process_requests ()
 {
-  int dir = 0;
-  SCM prop = get_property ("tupletDirection", 0);
-  if (isdir_b (prop))
-    dir = to_dir (prop);
-  int visibility = 3;
-  prop = get_property ("tupletVisibility", 0);
-  if (gh_number_p(prop))
-    visibility = gh_scm2int (prop);    // bool ?
-
-  for (int i= started_span_p_arr_.size ();
-       i < time_scaled_music_arr_.size (); i++)
+  SCM v = get_property ("tupletInvisible", 0);
+  if (to_boolean (v))
+    return;
+
+  for (int i= 0; i < time_scaled_music_arr_.size (); i++)
     {
+      if (i < started_span_p_arr_.size () && started_span_p_arr_[i])
+       continue;
+
       Tuplet_spanner* glep = new Tuplet_spanner;
-      started_span_p_arr_.push (glep);
+      if (i >= started_span_p_arr_.size ())
+       started_span_p_arr_.push (glep);
+      else
+       started_span_p_arr_[i] = glep;
+      
       glep->set_elt_property ("text",
                              ly_str02scm (to_str (time_scaled_music_arr_[i]->den_i_).ch_C()));
       
-      glep->set_elt_property("tuplet-visibility",
-                             gh_int2scm (visibility));
-      if (dir != 0)
-       glep->set_elt_property("dir-forced", gh_int2scm (dir));
       announce_element (Score_element_info (glep, time_scaled_music_arr_ [i]));
     }
 }
@@ -71,12 +98,14 @@ Tuplet_engraver::acknowledge_element (Score_element_info i)
   if (Note_column *nc = dynamic_cast<Note_column *> (i.elem_l_))
     {
       for (int j =0; j  <started_span_p_arr_.size (); j++)
-       started_span_p_arr_[j]->add_column (nc);
+       if (started_span_p_arr_[j]) 
+         started_span_p_arr_[j]->add_column (nc);
     }
   else if (Beam *b = dynamic_cast<Beam *> (i.elem_l_))
     {
       for (int j = 0; j < started_span_p_arr_.size (); j++)
-       started_span_p_arr_[j]->add_beam (b);
+       if (started_span_p_arr_[j]) 
+         started_span_p_arr_[j]->add_beam (b);
     }
 }
 
@@ -84,13 +113,31 @@ void
 Tuplet_engraver::do_post_move_processing ()
 {
   Moment now = now_mom ();
+
+  Moment tsd;
+  SCM s = get_property ("tupletSpannerDuration",0);
+  if (SMOB_IS_TYPE_B(Moment, s))
+    tsd = *SMOB_TO_TYPE(Moment,s);
+
   for (int i= started_span_p_arr_.size (); i--; )
     {
+      if (now >= span_stop_moments_[i])
+       {
+         if (started_span_p_arr_[i])
+           {
+             typeset_element (started_span_p_arr_[i]);
+             started_span_p_arr_[i] =0;
+           }
+         
+         if (tsd)
+           span_stop_moments_[i] += tsd;
+       }
+
       if (now >= stop_moments_[i])
        {
-         typeset_element (started_span_p_arr_[i]);
          started_span_p_arr_.del (i);
          stop_moments_.del(i);
+         span_stop_moments_.del (i);
          time_scaled_music_arr_.del(i);
        }
     }
@@ -101,7 +148,8 @@ Tuplet_engraver::do_removal_processing ()
 {
   for (int i=0; i < started_span_p_arr_.size (); i++)
     {
-      typeset_element (started_span_p_arr_[i]);
+      if (started_span_p_arr_[i])
+       typeset_element (started_span_p_arr_[i]);
     }  
 }
 
index 348db3f89051e4a0d4bf5bf9bcb66c3907fc1c6d..8e5e8d376d5fdee88e14d50c12fb3617ad2e895d 100644 (file)
@@ -40,25 +40,22 @@ Tuplet_spanner::do_brew_molecule_p () const
   bool par_beam = to_boolean (get_elt_property ("parallel-beam"));
   bool bracket_visibility = !par_beam;
   bool number_visibility = true;
-  SCM visibility_sym =get_elt_property ("tuplet-visibility");
-  if (gh_number_p (visibility_sym))
+
+  SCM bracket = get_elt_property ("tuplet-bracket-visibility");
+  if (gh_boolean_p (bracket))
     {
-      /*
-       ARG. Fixme.
-       */
-      
-      /* Property values:
-        0       show nothing
-        1       show number
-        2       show (number and bracket)-if-no-beam
-        3       show number, and bracket-if-no-beam
-        4       show number, and bracket
-      */
-      int value = gh_scm2int ((visibility_sym));
-      bracket_visibility = (value == 4 || (value > 1 && !par_beam));
-      number_visibility = (value > 2 || value == 1 || 
-                          (value == 2 && !par_beam));
+      bracket_visibility = gh_scm2bool (bracket);
+    }
+  else if (bracket == ly_symbol2scm ("if-no-beam"))
+    bracket_visibility = !par_beam;
+
+  SCM numb = get_elt_property ("tuplet-number-visibility");  
+  if (gh_boolean_p (numb))
+    {
+      number_visibility = gh_scm2bool (numb);
     }
+  else if (bracket == ly_symbol2scm ("if-no-beam"))
+    number_visibility = !par_beam;
   
   if (gh_pair_p (get_elt_property ("columns")))
     {
@@ -73,9 +70,8 @@ Tuplet_spanner::do_brew_molecule_p () const
       Direction dir = directional_element (this).get ();
       Real dy = gh_scm2double (get_elt_property ("delta-y"));
       SCM number = get_elt_property ("text");
-      if (gh_string_p (number))
+      if (gh_string_p (number) && number_visibility)
        {
-
          Molecule
            num (lookup_l ()->text ("italic",
                                    ly_scm2string (number), paper_l ()));
@@ -124,7 +120,7 @@ Tuplet_spanner::calc_position_and_height (Real *offset, Real * dy) const
   Link_array<Note_column> column_arr=
     Group_interface__extract_elements (this, (Note_column*)0, "columns");
 
-  
   Direction d = directional_element (this).get ();
   *dy = column_arr.top ()->extent (Y_AXIS) [d]
     - column_arr[0]->extent (Y_AXIS) [d];
@@ -133,11 +129,14 @@ Tuplet_spanner::calc_position_and_height (Real *offset, Real * dy) const
   
   Real x0 = column_arr[0]->hpos_f ();
   Real x1 = column_arr.top ()->hpos_f ();
+  
+  Real factor = column_arr.size () > 1 ? 1/(x1 - x0) : 1.0;
+  
   for (int i = 0; i < column_arr.size ();  i++)
     {
       Real notey = column_arr[i]->extent (Y_AXIS)[d];
       Real x = column_arr[i]->hpos_f () - x0;
-      Real tuplety =  *dy * x / (x1 -x0);
+      Real tuplety =  *dy * x * factor;
 
       if (notey * d > (*offset + tuplety) * d)
        *offset = notey - tuplety; 
@@ -188,6 +187,8 @@ Tuplet_spanner::do_post_processing ()
 Direction
 Tuplet_spanner::get_default_dir () const
 {
+  assert (false);
+  
   Direction d = UP;
   SCM dir_sym =get_elt_property ("dir-forced");
   if (gh_number_p (dir_sym))
index a6c7d67787b83e4d08462cc402511cfbd889a8d5..8a4c7ccf6fa0c5419c6403b68fd8e3e67ff073ad 100644 (file)
   "Run LilyPond on buffer."
   (interactive)
   (let ((buffer (buffer-name)))
-    (if buffer-file-name
+    (if (buffer-file-name)
        (progn
          (lily-save-buffer)
-         (lily-compile-file lily-command lily-parameters buffer))
+         (lily-compile-file lily-command lily-parameters (buffer-file-name)))
       (progn
        (error "Buffer %s is not associated with a file" buffer)
        (lily-eval-region (min-point) (max-point))))))
index 50044c786e9e1306a98d94c574147f254b509e74..1f6c21307f0d80b14c1d54d21c971529660a610a 100644 (file)
@@ -35,57 +35,54 @@ autoBeamSettings = (list
 
 %}
 
-
-
-
-
-
-
-
-
-
 time3_2beamAutoEnd = #(make-moment 1 2)
 %time3_2beamAutoEnd_16 = #(make-moment 1 4)
 time3_2beamAutoEnd_16 = #(make-moment 1 4)
-time3_2beamAutoEnd_32 = #(begin (make-moment 1 8))
+time3_2beamAutoEnd_32 = #(make-moment 1 8)
 
-time3_4beamAutoBegin_8 = #(begin (make-moment 1 4))
-time3_4beamAutoEnd = #(begin (make-moment 3 4))
-time3_4beamAutoBegin_16 = #(begin (make-moment 1 16))
-time3_4beamAutoEnd_16 = #(begin (make-moment 1 4))
-%time3_4beamAutoBegin_32 = #(begin (make-moment 1 8))
-time3_4beamAutoEnd_32 = #(begin (make-moment 1 8))
+time3_4beamAutoBegin_8 = #(make-moment 1 4)
+time3_4beamAutoEnd = #(make-moment 3 4)
+time3_4beamAutoBegin_16 = #(make-moment 1 16)
+time3_4beamAutoEnd_16 = #(make-moment 1 4)
+%time3_4beamAutoBegin_32 = #(make-moment 1 8)
+time3_4beamAutoEnd_32 = #(make-moment 1 8)
 
-time3_8beamAutoBegin = #(begin (make-moment 1 8))
-time3_8beamAutoEnd = #(begin (make-moment 3 8))
+time3_8beamAutoBegin = #(make-moment 1 8)
+time3_8beamAutoEnd = #(make-moment 3 8)
 
 % in common time:
 %   end beams each 1/2 note
 %   end beams with 32th notes each 1/8 note
 %   end beams with 1/8 triplets each 1/4 note
 
-time4_4beamAutoEnd = #(begin (make-moment 1 2))
-time4_4beamAutoEnd_12 = #(begin (make-moment 1 4))
-time4_4beamAutoEnd_16 = #(begin (make-moment 1 4))
-time4_4beamAutoEnd_32 = #(begin (make-moment 1 8))
+time4_4beamAutoEnd = #(make-moment 1 2)
+time4_4beamAutoEnd_12 = #(make-moment 1 4)
+time4_4beamAutoEnd_16 = #(make-moment 1 4)
+time4_4beamAutoEnd_32 = #(make-moment 1 8)
+
+time2_4beamAutoEnd = #(make-moment 1 4)
+time2_4beamAutoEnd_12 = #(make-moment 1 4)
+time2_4beamAutoEnd_16 = #(make-moment 1 4)
+time2_4beamAutoEnd_32 = #(make-moment 1 8)
+
 
-time4_8beamAutoEnd = #(begin (make-moment 1 4))
-time4_8beamAutoEnd_16 = #(begin (make-moment 1 4))
-time4_8beamAutoEnd_32 = #(begin (make-moment 1 8))
+time4_8beamAutoEnd = #(make-moment 1 4)
+time4_8beamAutoEnd_16 = #(make-moment 1 4)
+time4_8beamAutoEnd_32 = #(make-moment 1 8)
 
-time4_16beamAutoEnd = #(begin (make-moment 1 8))
+time4_16beamAutoEnd = #(make-moment 1 8)
 
-time6_8beamAutoEnd = #(begin (make-moment 3 8))
-time6_8beamAutoEnd_16 = #(begin (make-moment 3 8))
-time6_8beamAutoEnd_32 = #(begin (make-moment 1 8))
+time6_8beamAutoEnd = #(make-moment 3 8)
+time6_8beamAutoEnd_16 = #(make-moment 3 8)
+time6_8beamAutoEnd_32 = #(make-moment 1 8)
 
-time9_8beamAutoEnd = #(begin (make-moment 3 8))
-time9_8beamAutoEnd_16 = #(begin (make-moment 3 8))
-time9_8beamAutoEnd_32 = #(begin (make-moment 1 8))
+time9_8beamAutoEnd = #(make-moment 3 8)
+time9_8beamAutoEnd_16 = #(make-moment 3 8)
+time9_8beamAutoEnd_32 = #(make-moment 1 8)
 
-time12_8beamAutoEnd = #(begin (make-moment 3 8))
-time12_8beamAutoEnd_16 = #(begin (make-moment 3 8))
-time12_8beamAutoEnd_32 = #(begin (make-moment 1 8))
+time12_8beamAutoEnd = #(make-moment 3 8)
+time12_8beamAutoEnd_16 = #(make-moment 3 8)
+time12_8beamAutoEnd_32 = #(make-moment 1 8)
 
 
 
index 4a28d27368e886ad9b71e034ceecc3879af4165c..d416d2edd9db4a044320ba9d2018e7596fb714b8 100644 (file)
@@ -117,7 +117,7 @@ endincipit = \notes{
     \nobreak \bar "";
 }
 
-autoBeamOff = \property Voice.noAutoBeaming = #t
+autoBeamOff = \property Voice.noAutoBeaming = ##t
 autoBeamOn = \property Voice.noAutoBeaming = ##f
 
 
index fad40f07db6ececfab4dbf48db60299fa96ea0c7..e71c5d7eb56c7f6a5a9340fc201c3b553579d53a 100644 (file)
@@ -1,15 +1,15 @@
 Begin3
 Title: LilyPond
-Version: 1.3.21
-Entered-date: 21JAN00
+Version: 1.3.22
+Entered-date: 02FEB00
 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.21.tar.gz 
+       1000k lilypond-1.3.22.tar.gz 
 Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/
-       1000k lilypond-1.3.21.tar.gz 
+       1000k lilypond-1.3.22.tar.gz 
 Copying-policy: GPL
 End
index 46e30bc200de4bd38ef769ca63ce7abb83c5f805..c0a9a76337a24684dca0e1e77395f9e9d066c32a 100644 (file)
@@ -1,9 +1,9 @@
 Name: lilypond
-Version: 1.3.21
+Version: 1.3.22
 Release: 1
 Copyright: GPL
 Group: Applications/Publishing
-Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.21.tar.gz
+Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.22.tar.gz
 Summary: A program for printing sheet music.
 URL: http://www.cs.uu.nl/~hanwen/lilypond
 # get Packager from (undocumented?) ~/.rpmmacros!
index fcf6fcbfb69669eb57bbcf1ddb069183c458a2ac..6be444394494430d18421f59508f4a27508bd9a7 100644 (file)
        (list
         (list 'timeSignatureStyle string? 'style))))
 
+(define (symbol-or-boolean? s)
+  (or (boolean? s) (symbol? s)))
+
+(define generic-tuplet-spanner-properties
+  (cons "Tuplet_spanner"
+       (list
+        (list 'tupletNumberVisibility symbol-or-boolean? 'tuplet-number-visibility)
+        (list 'tupletBracketVisibility symbol-or-boolean? 'tuplet-bracket-visibility)
+       ))
+)
 (define generic-voice-properties
   (list
    generic-stem-properties
    generic-breathing-sign-properties
    generic-tie-properties
+   generic-tuplet-spanner-properties
    generic-rest-properties
    generic-slur-properties
    generic-beam-properties
index 5d91080465d3cd9182e81b2e4bdef4452deee704..ede540b40bbe600abeb43234b535990b7580187a 100644 (file)
@@ -407,10 +407,12 @@ if 1:
 
 if 1:
        def conv (str):
-               return re.sub ('staffLineLeading'
-                              'staffSpace',
-                              str)
-       conversions.append ((1,3,18), conv, "staffLineLeading -> staffSpace")
+               str = re.sub ('staffLineLeading',
+                             'staffSpace',
+                             str)
+               return str
+
+       conversions.append ((1,3,18), conv, 'staffLineLeading -> staffSpace')
 
 ############################
        
index b309317ff177e2efe538f24162da14a65bc57d08..e8d5a36e699df6483dc08c57038f543459849dc1 100644 (file)
@@ -257,7 +257,7 @@ class TeXOutput:
 %%\\addtolength{\\topmargin}{-1cm} 
 %%\\setlength{\\textwidth}{%s} 
 %%\\setlength{\\textheight}{%s} 
-\\geometry{width=%spt, left=%spt, height=%spt, top=%spt} 
+\\geometry{width=%spt, left=%spt, height=%spt, top=%spt, nohead
 \\input lilyponddefs 
 \\input titledefs 
 %s