]> git.donarmstrong.com Git - lilypond.git/commitdiff
''
authorhanwen <hanwen>
Thu, 28 Mar 2002 00:40:24 +0000 (00:40 +0000)
committerhanwen <hanwen>
Thu, 28 Mar 2002 00:40:24 +0000 (00:40 +0000)
13 files changed:
ChangeLog
input/mozart-hrn3-allegro.ly
input/mozart-hrn3-romanze.ly
input/mozart-hrn3-rondo.ly
lily/include/multi-measure-rest.hh
lily/multi-measure-rest.cc
lily/spaceable-grob.cc
lily/spacing-spanner.cc
lily/timing-engraver.cc
lily/timing-translator.cc
mf/feta-macros.mf
scm/grob-description.scm
scm/grob-property-description.scm

index c003526e5f5cf716750214438bd822548d05ac1a..235d20bd143e141e3fd8a5707fb75f37fde62c64 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2002-03-28  Han-Wen  <hanwen@cs.uu.nl>
+
+       * lily/multi-measure-rest.cc (brew_molecule): variable width molecule.
+
+       * scm/grob-property-description.scm (measure-length):
+       measure-length grob property.
+
+       * lily/spacing-spanner.cc (standard_breakable_column_spacing):
+       better spacing for breakable columns when they're juxtaposed: use
+       measure length if applicable
+
+       * lily/timing-engraver.cc (start_translation_timestep): store
+       measure length in breakable column at start of measure.
+
 2002-03-28  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * ROADMAP: Add description for ports dir, to check email upon
@@ -5,6 +19,8 @@
 
 2002-03-27  Han-Wen  <hanwen@cs.uu.nl>
 
+       * VERSION: 1.5.48 released
+       
        * lily/multi-measure-rest.cc (symbol_molecule): split off from
        brew_molecule()
        (set_spacing_rods): Use symbol_molecule() to determine minimum
index c81bb95b5b48c269d9d92042f678425249dcb707..7c4de9cc58fcdd9bad2b5ec41488aeb393957b58 100644 (file)
@@ -19,7 +19,7 @@ allegro =
        r2 r4 g'4^"Solo" |
        e'4. () c8 [f (d c )b ]
        [b()c] g4 r8 [g-. c-. e-.]
-       g2. ( [g16-.( f e ))f]
+       g2.  [g16-.( f e )f]
        dis4 () e4-- r8 [c8-. c-. c-.]
        c4.( [d16 e]  f4 ) e
        a,( d g,) c
@@ -49,8 +49,8 @@ allegro =
        [cis ()d] r4 r2
        g,1 ~ g2 ~ [g8 a16 b] [c()d e c]
        f4-. d-. b-. g-.
-       r1
-       \emptyText
+       R1
+
        c,2\p e4 g c \cresc e g4. e8 |
        d4. [e16 fis] [g () fis e d] [c() b a g]
        \endcresc
@@ -88,7 +88,7 @@ allegro =
        r2 r8 [g,-. g-. g-.]
        e'4.() c8 [f( d c )b]
        [b()c] g4 r8 [g c e] |
-       g2. ( [g16( f e ))f]
+       g2.  [g16( f e )f]
        dis4()e r8 [c-. c-. c-.]
        c4.( [d16 e] f4 )e
        a, ( d g, )c
@@ -112,7 +112,7 @@ allegro =
        [e()d] d4 r [d8 d]
        d4(~ [d16 e d )e] [g8() f e d] |
        c4 r r2
-       r1
+       R1
        c1 ~
        c |
        [c8-. c-.] r c-. [cis()d] r d-. |
@@ -128,7 +128,7 @@ allegro =
          { s2. \grace { [c16 d] } } >
        
        ) c4 r r2
-       r1 |
+       R1 |
        \mark "H"
        \times 2/3 { [ c8 ()b a ] }     \times 2/3 { [ g a b] } \times 2/3 { [ c d e] } \times 2/3 { [ f()e d] } |
        \times 2/3 { [ c () b a ] } \times 2/3 { [ g a b] } \times 2/3 { [ c d e] } \times 2/3 { [ f()e d] }|
index 020d1a9226b0dd6ecc47af52f6eb2622113af4f7..4a5fa8e85ec66a09ea1279897189f9eb618b1ff4 100644 (file)
@@ -23,7 +23,7 @@ romanze = \notes \relative c' {
        R1*2
        g'4.() f8 [e( d c) bes]
        [bes (a d ) c] c4 r
-       r1
+       R1
        % 25
        [c16\mf ( d c )d] [e ( f e )f] [g()e c-. c-.] [f()d b-. b-.]
        [c16\p () d c )d] [e ( f e )f] [g()e c-. c-.] [f()d b-. b-.]
@@ -68,7 +68,7 @@ romanze = \notes \relative c' {
        [c8( e g )bes] [a( c f ) d]
        c r e r f4 r4                   % -. ? 
 
-       r1
+       R1
        c8-.   r e-. r f4 r4
 
        % Finish with F if played separately 
index aab198ee6cbc288e0459945f8116dee7eae14a76..8f2c1754734d6fd339e40e2e300152fd89999e35 100644 (file)
@@ -37,7 +37,7 @@ rondo = \notes        \relative c'
        \rondotheme
        
        R2.*13 |
-       r8 r-\fermata d [d e f]
+       r8 r^\fermata d [d e f]
        [g ()e c-.] [d()e d-.]
        c4 c8 [d e f]
        [g()e c-.] [d()e d-.]
index 0d46900ec7264eedacc564a33f31b749e5dcfe25..3ba796c515131eba49b518ccfbadc2075f7b0de8 100644 (file)
@@ -25,8 +25,8 @@ public:
   DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM ));
 
   static Molecule big_rest (Grob*,Real);
-  static Molecule symbol_molecule (Grob*);  
-  static Molecule church_rest (Font_metric*, int,Real, Real);
+  static Molecule symbol_molecule (Grob*,Real);  
+  static Molecule church_rest (Grob*, Font_metric*, int,Real);
 };
 
 #endif /* MULTI_MEASURE_REST_HH */
index 8353e19812d10d45215075ca2bb6f2b3bb65407d..d3f9e812210e60220acc86fc2efd421420820703 100644 (file)
@@ -85,31 +85,30 @@ Multi_measure_rest::brew_molecule (SCM smob)
 
   Interval sp_iv;
   Direction d = LEFT;
+
+  Grob *common = sp->get_bound (LEFT)->common_refpoint (sp->get_bound (RIGHT), X_AXIS);
   do
     {
       Item * col = sp->get_bound (d)->column_l ();
 
-      Interval coldim = col->extent (0, X_AXIS);
+      Interval coldim = col->extent (common, X_AXIS);
 
       sp_iv[d] = coldim[-d]  ;
     }
   while ((flip (&d)) != LEFT);
-  Molecule mol;
-  Real x_off = 0.0;
+
+  Real space = sp_iv.length();
 
   Real rx  = sp->get_bound (LEFT)->relative_coordinate (0, X_AXIS);
   /*
     we gotta stay clear of sp_iv, so move a bit to the right if
     needed.
    */
-  x_off += (sp_iv[LEFT] -  rx) >? 0;
+  Real x_off = (sp_iv[LEFT] -  rx) >? 0;
 
-  /*
-    center between stuff.
-   */
-  x_off += sp_iv.length ()/ 2;
 
-  mol.add_molecule (symbol_molecule (me));
+  Molecule mol;
+  mol.add_molecule (symbol_molecule (me, space));
 
   int measures = 0;
   SCM m (me->get_grob_property ("measure-count"));
@@ -123,8 +122,12 @@ Multi_measure_rest::brew_molecule (SCM smob)
       Molecule s = Text_item::text2molecule (me,
                                             ly_str02scm (to_str (measures).ch_C ()),
                                             alist_chain);
+
+      
       s.align_to (X_AXIS, CENTER);
       s.translate_axis (3.0, Y_AXIS);
+
+      s.translate_axis (mol.extent (X_AXIS).center (),  X_AXIS);
       mol.add_molecule (s);
     }
   mol.translate_axis (x_off, X_AXIS);
@@ -133,19 +136,8 @@ Multi_measure_rest::brew_molecule (SCM smob)
 
 
 Molecule
-Multi_measure_rest::symbol_molecule (Grob *me)
+Multi_measure_rest::symbol_molecule (Grob *me, Real space)
 {
-  SCM alist_chain = Font_interface::font_alist_chain (me);
-
-  SCM style_chain =
-    Font_interface::add_style (me, ly_symbol2scm ("mmrest-symbol"),
-                              alist_chain);
-
-  Real staff_space = Staff_symbol_referencer::staff_space (me);
-  Font_metric *musfont
-    = Font_interface::get_font (me,style_chain);
-  Molecule s;
-
   int measures = 0;
   SCM m (me->get_grob_property ("measure-count"));
   if (gh_number_p (m))
@@ -156,30 +148,48 @@ Multi_measure_rest::symbol_molecule (Grob *me)
 
   SCM limit = me->get_grob_property ("expand-limit");
   if (measures <= 0)
-    return s;
+    return Molecule();
+
+  if (measures > gh_scm2int (limit))
+    {
+      Real padding = 0.15;  
+      Molecule s =  big_rest (me, (1.0 - 2*padding) * space);
+      s.translate_axis (padding * space,  X_AXIS); 
+      return s;
+    }
+
+  SCM alist_chain = Font_interface::font_alist_chain (me);
+
+  SCM style_chain =
+    Font_interface::add_style (me, ly_symbol2scm ("mmrest-symbol"),
+                              alist_chain);
+
+  Real staff_space = Staff_symbol_referencer::staff_space (me);
+  Font_metric *musfont
+    = Font_interface::get_font (me,style_chain);
+
   if (measures == 1)
     {
-      s = musfont->find_by_name (Rest::glyph_name (me, 0, ""));
+      Molecule s = musfont->find_by_name (Rest::glyph_name (me, 0, ""));
 
       /*
        ugh.
        */
       if (Staff_symbol_referencer::position_f (me) == 0.0)
        s.translate_axis (staff_space, Y_AXIS);
+
+      s.translate_axis ((space - s.extent (X_AXIS).length ())/2, X_AXIS);
+      
+      return s ;
     }
-  else if (measures <= gh_scm2int (limit))
-    {
-      Real pad = gh_scm2double (me->get_grob_property ("padding")) * staff_space;
-      s = church_rest (musfont, measures, staff_space, pad);
-    }
-  else 
+  else
     {
-      Real w = gh_scm2double (me->get_grob_property ("width"));
-      s = big_rest (me, w);
+      return  church_rest (me, musfont, measures, space);
     }
-  return s;
 }
 
+
+
 Molecule
 Multi_measure_rest::big_rest (Grob *me, Real width)
 {
@@ -197,25 +207,26 @@ Multi_measure_rest::big_rest (Grob *me, Real width)
   m.add_at_edge (X_AXIS, RIGHT, yb, -ythick);
   m.add_at_edge (X_AXIS, LEFT, yb, -ythick);
 
-  m.align_to (X_AXIS, CENTER);
+  m.align_to (X_AXIS, LEFT);
   
   return m;
 }
 
 /*
   Kirchenpause (?)
-  
  */
 Molecule
-Multi_measure_rest::church_rest (Font_metric *musfont, int measures,
-                                Real staff_space, Real padding)
+Multi_measure_rest::church_rest (Grob*me, Font_metric *musfont, int measures,
+                                Real space)
 {
-  Molecule s;
- /*
-       Build a rest from smaller parts. Distances inbetween are
-       really variable, see Wanske pp. 125 */
-   
+  SCM mols = SCM_EOL; 
+
+  /*
+   see Wanske pp. 125
+  */
   int l = measures;
+  int count = 0;
+  Real symbols_width = 0.0;
   while (l)
     {
       int k;
@@ -235,22 +246,32 @@ Multi_measure_rest::church_rest (Font_metric *musfont, int measures,
          l --;
        }
 
-      Real pad = s.empty_b () ? 0.0 : padding;
-
       Molecule r (musfont->find_by_name ("rests-" + to_str (k)));
       if (k == 0)
-       r.translate_axis (staff_space, Y_AXIS);
-         
-      s.add_at_edge (X_AXIS, RIGHT, r, pad);
+       {
+         Real staff_space = Staff_symbol_referencer::staff_space (me);
+         r.translate_axis (staff_space, Y_AXIS);
+       }
+      symbols_width += r.extent (X_AXIS).length ();
+      mols = gh_cons (r.smobbed_copy (), mols);
+      count ++;
+    }
+
+
+  Real outer_padding_factor = 1.5; //     make outer padding this much bigger.
+  Real inner_padding = (space - symbols_width) / (2 * outer_padding_factor + (count-1)); 
+
+  Molecule mol; 
+  for (SCM  s = mols; gh_pair_p (s); s = gh_cdr(s))
+    {
+      mol.add_at_edge (X_AXIS, LEFT, *unsmob_molecule (gh_car (s)), inner_padding);
     }
+  mol.align_to (X_AXIS, LEFT);
+  mol.translate_axis (outer_padding_factor *  inner_padding, X_AXIS);
 
-  s.align_to (X_AXIS, CENTER);
-  return s;
+  return mol;
 }
 
-/*
-  UGH. JUNKME elt prop "columns" isn't really needed. 
- */
 void
 Multi_measure_rest::add_column (Grob*me,Item* c)
 {
@@ -263,6 +284,8 @@ MAKE_SCHEME_CALLBACK (Multi_measure_rest, set_spacing_rods,1);
 SCM
 Multi_measure_rest::set_spacing_rods (SCM smob)
 {
+  return SCM_UNSPECIFIED;
+
   Grob*me = unsmob_grob (smob);
 
   Spanner*sp = dynamic_cast<Spanner*> (me);
@@ -290,14 +313,8 @@ Multi_measure_rest::set_spacing_rods (SCM smob)
       Rod rod;
       rod.item_l_drul_[LEFT] = l;
       rod.item_l_drul_[RIGHT] = r;
-
-      /*
-       should do something more advanced.
-      */
-      Molecule m = symbol_molecule(me);
-      
       rod.distance_f_ = l->extent (l, X_AXIS)[BIGGER] - r->extent (r, X_AXIS)[SMALLER]
-       + m.extent (X_AXIS).length () + 2.5*staff_space;
+       + 4.0;                  // magic!
   
       rod.add_to_cols ();
     }
index 30e1b0503e96aa067c6f917f43fdd2c8f769a545..e19252783ed0a87935df56d22b1da1eb82bef565 100644 (file)
@@ -81,8 +81,8 @@ Spaceable_grob::remove_interface (Grob*me)
 
 
 ADD_INTERFACE (Spaceable,"spaceable-grob-interface",
-  "An grob (generally a Paper_column) that takes part in the
+  "An grob (a Paper_column) that takes part in the
 spacing problem. ",
-  "penalty minimum-distances ideal-distances
+  "measure-length penalty minimum-distances ideal-distances
 left-neighbors right-neighbors");
 
index 2fff9c08e6d954c68c197fd5b33f49c6b92ed000..674681f44f00e74fea46748f5f03f98da54a904c 100644 (file)
 class Spacing_spanner
 {
 public:
+  static void standard_breakable_column_spacing (Grob * me, Item*l, Item*r,
+                                                Real * fixed, Real * space, Moment);
+  
+
   static Real default_bar_spacing (Grob*,Grob*,Grob*,Moment);
   static Real note_spacing (Grob*,Grob*,Grob*,Moment, bool*);
   static Real get_duration_space (Grob*,Moment dur, Rational shortest, bool*);
   static Rational find_shortest (Link_array<Grob> const &);  
-  static void breakable_column_spacing (Item* l, Item *r);
+  static void breakable_column_spacing (Grob*, Item* l, Item *r, Moment);
   static void find_loose_columns () {}
   static void prune_loose_colunms (Grob*,Link_array<Grob> *cols, Rational);
   static void find_loose_columns (Link_array<Grob> cols);
@@ -470,7 +474,7 @@ Spacing_spanner::do_measure (Rational shortest, Grob*me, Link_array<Grob> *cols)
 
       if (!Paper_column::musical_b (l))
        {
-         breakable_column_spacing (l, r);
+         breakable_column_spacing (me, l, r, shortest);
 
          /*
            
@@ -483,12 +487,12 @@ Spacing_spanner::do_measure (Rational shortest, Grob*me, Link_array<Grob> *cols)
          Item *rb = r->find_prebroken_piece (LEFT);
          
          if (lb)
-           breakable_column_spacing (lb,r);
+           breakable_column_spacing (me, lb,r, shortest);
 
          if (rb)
-           breakable_column_spacing (l, rb);
+           breakable_column_spacing (me, l, rb, shortest);
          if (lb && rb)
-           breakable_column_spacing (lb, rb);
+           breakable_column_spacing (me, lb, rb, shortest);
          
          continue ; 
        }
@@ -553,15 +557,47 @@ Spacing_spanner::musical_column_spacing (Grob *me, Item * lc, Item *rc, Real inc
   Spaceable_grob::add_spring (lc, rc, max_note_space,  1 / (max_note_space -max_fixed_note_space), expand_only);
 }
 
+void
+Spacing_spanner::standard_breakable_column_spacing (Grob * me, Item*l, Item*r,
+                                  Real * fixed, Real * space,
+                                  Moment shortest)
+{
+  *fixed = l->extent (l, X_AXIS)[RIGHT] - r->extent (r, X_AXIS)[LEFT];
+      
+  if (l->breakable_b (l) && r->breakable_b(r))
+    {
+      Moment *dt = unsmob_moment (l->get_grob_property ("measure-length"));
+      Moment mlen (1);
+      if (dt)
+       mlen = *dt;
+      
+      Real incr = gh_scm2double (me->get_grob_property ("spacing-increment"));
+
+      *space =  *fixed + incr * double (mlen.main_part_ / shortest.main_part_) * 0.8;
+    }
+  else
+    {
+      Moment dt = Paper_column::when_mom (r) - Paper_column::when_mom (l);
+      bool dummy;
+
+      *space = *fixed + get_duration_space (me, dt, shortest.main_part_, &dummy);
+    }
+  
+  
+}
+
 
 /*
   Read hints from L and generate springs.
  */
 void
-Spacing_spanner::breakable_column_spacing (Item* l, Item *r)
+Spacing_spanner::breakable_column_spacing (Grob*me, Item* l, Item *r,Moment shortest)
 {
   Real max_fixed = -infinity_f;
   Real max_space = -infinity_f;
+
+  standard_breakable_column_spacing (me, l, r, &max_fixed, &max_space ,
+                                    shortest);
   
   for (SCM s = l->get_grob_property ("spacing-wishes");
        gh_pair_p (s); s = gh_cdr (s))
@@ -590,6 +626,9 @@ Spacing_spanner::breakable_column_spacing (Item* l, Item *r)
        }
     }
 
+  
+  
+
   if (isinf (max_space))
     {
       programming_error ("No pref spacing found");
index d3aa30bb961843a94001656155f535130fb1b7b7..9a381cede41a4ba24e50fd4183b3d144179ef014 100644 (file)
@@ -11,6 +11,7 @@
 #include "multi-measure-rest.hh"
 #include "timing-translator.hh"
 #include "engraver.hh"
+#include "grob.hh"
 
 /**
   Do time bookkeeping
@@ -54,14 +55,21 @@ Timing_engraver::start_translation_timestep ()
     which
       = (now.main_part_ || now.main_part_ == last_moment_.main_part_)
       ? SCM_EOL : ly_str02scm ("|");
+
+  Moment mp = measure_position ();
+  bool start_of_measure = (last_moment_.main_part_ != now.main_part_&& !mp.main_part_  );
+
+  if (start_of_measure)
+    {
+      Moment mlen = Moment(measure_length ());
+      unsmob_grob (get_property ("currentCommandColumn"))->set_grob_property ("measure-length", mlen.smobbed_copy()); 
+    }
   
   if (!gh_string_p (which) && !to_boolean (nonauto))
     {
       SCM always = get_property ("barAlways");
-      Moment mp = measure_position ();
-      if ( (last_moment_.main_part_ != now.main_part_
-           && !mp.main_part_)
-          || (to_boolean (always)))
+
+      if ( start_of_measure || (to_boolean (always)))
        {
          /* should this work, or be junked?  See input/bugs/no-bars.ly */
          which = get_property ("defaultBarType");
@@ -77,6 +85,7 @@ Timing_engraver::stop_translation_timestep ()
   Timing_translator::stop_translation_timestep ();
   daddy_trans_l_->set_property ("whichBar", SCM_EOL);
   last_moment_ = now_mom ();
+      
 }
 
 
index edd5505bc4bd31c627f02d75dd093d644dee1b0a..f92b598a41e116ef834ed607bfedc96b8b39f088 100644 (file)
@@ -15,7 +15,6 @@
 #include "multi-measure-rest.hh"
 
 
-
 void
 Timing_translator::stop_translation_timestep ()
 {
@@ -50,7 +49,6 @@ Timing_translator::stop_translation_timestep ()
     }
 }
 
-
 void
 Timing_translator::initialize ()
 {
index 61764beba106cf3285b23e9e15b4e69d45818a7e..3b17c95f2e9ea22283fa95502186bf93c97f1c19 100644 (file)
@@ -209,7 +209,7 @@ def flare_path(expr pos,alpha,beta,line,flare, direction) =
        penpos2(flare,180+beta+alpha);
        z2=z3;
        penpos3(flare,0+alpha);
-       z3l=z1r+(1/2+0.43)*flare*dir(alpha+beta);
+       z3l=z1r+(1/2+0.43)*flare*dir(alpha+beta) ;
        save taille;
        taille = 0.0;
        z4=z2r-  line * dir(alpha);
index d35e4ac032e8f6a3a9f40b9a4ee28ff1bb707815..72438a926d3bf9c3e7abfeff0b8b3d238449c634 100644 (file)
     (SpacingSpanner
      . (
        (spacing-procedure .  ,Spacing_spanner::set_springs)
-       (grace-space-factor . 0.8)
+       (grace-space-factor . 0.5)
 
        (shortest-duration-space . 2.0)
        (spacing-increment . 1.2)
index a0015f37443ebc51bae8b7d3e806293acaa5e75a..0f453ffb34c0de4ddb15ae6a2ef4ad41450f33a2 100644 (file)
@@ -221,6 +221,8 @@ and will have no effect.
 (grob-property-description 'magnify number? "the magnification factor.  FIXME: doesn't work for feta fonts.")
 (grob-property-description 'maximum-length number? "don't make Grob longer than this")
 (grob-property-description 'maximum-rest-count integer? "kill off rests so we don't more than this number left.")
+(grob-property-description 'measure-length moment? "Length of a
+measure. Used in some spacing situations.")
 (grob-property-description 'measure-count integer? "number of measures for a multimeasure rest.")
 (grob-property-description 'merge-differently-dotted boolean? " Merge noteheads in collisions, even if they have a different number of dots. This normal notation for some types of polyphonic music. The value of this setting is used by @ref{note-collision-interface} .")
 (grob-property-description 'minimum-distance number? "minimum distance between notes and rests.")