]> git.donarmstrong.com Git - lilypond.git/commitdiff
Merge branch 'master' of ssh+git://hanwen@git.sv.gnu.org/srv/git/lilypond
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 28 Jul 2008 05:21:47 +0000 (02:21 -0300)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 28 Jul 2008 05:21:47 +0000 (02:21 -0300)
input/regression/script-stack-horizontal.ly
input/regression/tie-chord-broken-extremal.ly [new file with mode: 0644]
lily/gregorian-ligature-engraver.cc
lily/include/tie-formatting-problem.hh
lily/misc.cc
lily/piano-pedal-engraver.cc
lily/tie-formatting-problem.cc
scm/define-grob-interfaces.scm
scm/define-grobs.scm

index 9cfcd9eb513712dbdc37abe53b5724e2f8a63547..de71c33ec77de3a1936644e64f0a04405984fabe 100644 (file)
@@ -2,7 +2,10 @@
 \header
 {
   texidoc = "horizontal scripts are ordered, so they do not overlap.
-The order may be set with script-priority."
+The order may be set with script-priority.
+
+The scripts should not be folded under the time signature.
+"
   
 }
 \version "2.11.51"
diff --git a/input/regression/tie-chord-broken-extremal.ly b/input/regression/tie-chord-broken-extremal.ly
new file mode 100644 (file)
index 0000000..a969815
--- /dev/null
@@ -0,0 +1,22 @@
+\version "2.11.53"
+
+\header { texidoc = "
+
+Tie detail property multi-tie-region-size controls how many variations
+are tried for the extremal ties in a chord.
+
+
+" }
+
+\relative c'' {
+  \time 4/4 <bis bis>1 ~ \break
+
+  \override Tie #'details #'multi-tie-region-size = #1
+  \time 3/4 <bis bis>2.~ \break
+  \time 4/4 <bis bis>1 
+}
+
+\paper {
+  ragged-right = ##t
+  debug-tie-scoring = ##t
+}
index 91232d5b31c8e02b6f90c73bffff5039806f303b..36cf898af86257bc4dd0c85d94ac1ba089c8b61d 100644 (file)
@@ -208,20 +208,22 @@ provide_context_info (vector<Grob_info> primitives)
       int prefix_set = scm_to_int (primitive->get_property ("prefix-set"));
 
       if (prefix_set & PES_OR_FLEXA)
-       if (!i) // ligature may not start with 2nd head of pes or flexa
-         primitive->warning (_ ("cannot apply `\\~' on first head of ligature"));
-       else if (pitch > prev_pitch) // pes
-         {
-           prev_context_info |= PES_LOWER;
-           context_info |= PES_UPPER;
-         }
-       else if (pitch < prev_pitch) // flexa
-         {
-           prev_context_info |= FLEXA_LEFT;
-           context_info |= FLEXA_RIGHT;
-         }
-       else // (pitch == prev_pitch)
-         primitive->warning (_ ("cannot apply `\\~' on heads with identical pitch"));
+       {
+         if (!i) // ligature may not start with 2nd head of pes or flexa
+           primitive->warning (_ ("cannot apply `\\~' on first head of ligature"));
+         else if (pitch > prev_pitch) // pes
+           {
+             prev_context_info |= PES_LOWER;
+             context_info |= PES_UPPER;
+           }
+         else if (pitch < prev_pitch) // flexa
+           {
+             prev_context_info |= FLEXA_LEFT;
+             context_info |= FLEXA_RIGHT;
+           }
+         else // (pitch == prev_pitch)
+           primitive->warning (_ ("cannot apply `\\~' on heads with identical pitch"));
+       }
       if (prev_prefix_set & DEMINUTUM)
        context_info |= AFTER_DEMINUTUM;
 
index 69b49322b01c9073525b067cfd2bece76d5e02a1..46018a0034aec6778496a8c926adb5be350d15b9 100644 (file)
 #include <set>
 
 typedef map< Tuple<int,4>, Tie_configuration *> Tie_configuration_map;
+
 struct Tie_configuration_variation
 {
-  int index_;
-  Tie_configuration *suggestion_;
-  Tie_configuration_variation ();
+  vector<pair<int, Tie_configuration *> > index_suggestion_pairs_;
+  void add_suggestion(int index, Tie_configuration* suggestion)
+  {
+    index_suggestion_pairs_.push_back (make_pair (index, suggestion));
+  }
 };
 
 typedef map < Tuple<int, 2>, Skyline> Chord_outline_map;
index 3b9d87da162859c339b6a5a66548bd6a17e4d572..85db2468cd3f51116640e95bc62c3433fb31c1b9 100644 (file)
@@ -53,7 +53,7 @@ peak_around (Real epsilon,  Real threshold, Real x)
 {
   if (x < 0)
     return 1.0;
-  return max (- epsilon * (x - threshold) / ((x + epsilon)  * threshold), 0.0);
+  return max (- epsilon * (x - threshold) / ((x + epsilon) * threshold), 0.0);
 }
 
 /*
index faa078fdf24c2063ac87a1a3940d21ce83334921..b3021cbcb78b73bb9181d9ca1470b6418878326c 100644 (file)
@@ -41,7 +41,7 @@
 */
 
 /* Ugh: This declaration is duplicated in piano-pedal-performer */
-typedef enum Pedal_type {
+enum Pedal_type {
   SOSTENUTO,
   SUSTAIN,
   UNA_CORDA,
index 6aa5feb3b1b04e139db3829810472c3590e58581..b346fc88491ca88f9a012bb96a8986024cf78ced 100644 (file)
@@ -676,8 +676,6 @@ Tie_formatting_problem::score_aptitude (Tie_configuration *conf,
       if (!tie_position_dir_ok)
        ties_conf->add_score (details_.same_dir_as_stem_penalty_, "tie/pos dir");
     }
-  while (flip (&d) != LEFT);
-
            
   return penalty;
 }
@@ -709,9 +707,10 @@ Tie_formatting_problem::score_configuration (Tie_configuration *conf) const
   
   Real length = conf->attachment_x_.length ();
 
+  Real length_penalty
+    = peak_around (0.33 * details_.min_length_, details_.min_length_, length);
   conf->add_score (details_.min_length_penalty_factor_
-                  * peak_around (0.33 * details_.min_length_, details_.min_length_, length),
-                  "minlength");
+                  * length_penalty, "minlength");
   
   Real tip_pos = conf->position_ + conf->delta_y_ / 0.5 * details_.staff_space_;
   Real tip_y = tip_pos * details_.staff_space_ * 0.5;
@@ -854,6 +853,7 @@ Tie_formatting_problem::score_ties_configuration (Ties_configuration *ties) cons
                       "pos symmetry");
     }
 }
+
 /*
   Generate with correct X-attachments and beziers, copying delta_y_
   from TIES_CONFIG if necessary.
@@ -927,7 +927,8 @@ Tie_formatting_problem::find_best_variation (Ties_configuration const &base,
   for (vsize i = 0; i < vars.size (); i++)
     {
       Ties_configuration variant (base);
-      variant[vars[i].index_] = *vars[i].suggestion_;
+      for (vsize j = 0; j < vars[i].index_suggestion_pairs_.size(); j++)
+       variant[vars[i].index_suggestion_pairs_[j].first] = *vars[i].index_suggestion_pairs_[j].second;
 
       variant.reset_score ();
       score_ties (&variant);
@@ -1025,33 +1026,38 @@ Tie_formatting_problem::set_ties_config_standard_directions (Ties_configuration
     }
 }
 
-Tie_configuration_variation::Tie_configuration_variation ()
-{
-  index_ = 0;
-  suggestion_ = 0;
-}
-
 vector<Tie_configuration_variation>
 Tie_formatting_problem::generate_extremal_tie_variations (Ties_configuration const &ties) const
 {
   vector<Tie_configuration_variation> vars;
-  Direction d = DOWN;
-  do
+  Direction d = DOWN; 
+  for (int i = 1; i <= details_.multi_tie_region_size_; i++)
     {
-      if (boundary (ties, d, 0).dir_ == d
-         && !boundary (specifications_, d, 0).has_manual_position_)
-       for (int i = 1; i <= details_.multi_tie_region_size_; i++)
-         {
-           Tie_configuration_variation var;
-           var.index_ = (d == DOWN) ? 0 : ties.size () - 1;
-           var.suggestion_ = get_configuration (boundary (ties, d, 0).position_
-                                                + d * i, d,
-                                                boundary (ties, d, 0).column_ranks_,
-                                                true);
-           vars.push_back (var);
-         }
+      Drul_array<Tie_configuration*> configs (0, 0);
+      do
+       {
+         const Tie_configuration &config = boundary (ties, d, 0);
+         if (config.dir_ == d
+             && !boundary (specifications_, d, 0).has_manual_position_)
+           {
+             Tie_configuration_variation var;
+             configs[d] =  get_configuration (config.position_ + d * i, d,
+                                              config.column_ranks_,
+                                              true);
+             var.add_suggestion((d == DOWN) ? 0 : ties.size () - 1,
+                                configs[d]);
+             vars.push_back (var);
+           }
+       }
+      while (flip (&d) !=  DOWN);
+      if (configs[LEFT] && configs[RIGHT])
+       {
+         Tie_configuration_variation var;
+         var.add_suggestion(0, configs[DOWN]);
+         var.add_suggestion(ties.size() - 1, configs[UP]);
+         vars.push_back (var);
+       }
     }
-  while (flip (&d) !=  DOWN);
 
   return vars;
 }
@@ -1079,10 +1085,10 @@ Tie_formatting_problem::generate_single_tie_variations (Ties_configuration const
              || d == specifications_[0].manual_dir_)
            {
              Tie_configuration_variation var;
-             var.index_ = 0;
-             var.suggestion_ = get_configuration (p,
-                                                  d, specifications_[0].column_ranks_,
-                                                  !specifications_[0].has_manual_delta_y_);
+             var.add_suggestion(0,
+                                get_configuration (p,
+                                                   d, specifications_[0].column_ranks_,
+                                                   !specifications_[0].has_manual_delta_y_));
              vars.push_back (var);
            }
        }
@@ -1112,14 +1118,14 @@ Tie_formatting_problem::generate_collision_variations (Ties_configuration const
              if (!specifications_[i].has_manual_dir_)
                {
                  Tie_configuration_variation var;
-                 var.index_ = i;
-                 var.suggestion_ = get_configuration (specifications_[i].position_
+                 var.add_suggestion(i,
+                                    get_configuration (specifications_[i].position_
                                                       - ties[i].dir_,
                                                       - ties[i].dir_,
 
                                                       ties[i].column_ranks_,
                                                       !specifications_[i].has_manual_delta_y_
-                                                      );
+                                                       ));
 
                  vars.push_back (var);
                }
@@ -1127,13 +1133,12 @@ Tie_formatting_problem::generate_collision_variations (Ties_configuration const
              if (!specifications_[i-1].has_manual_dir_)
                {
                  Tie_configuration_variation var;
-                 var.index_ = i-1;
-                 var.suggestion_ = get_configuration (specifications_[i-1].position_
-                                                      - ties[i-1].dir_,
-                                                      - ties[i-1].dir_,
-                                                      specifications_[i-1].column_ranks_,
-                                                      !specifications_[i-1].has_manual_delta_y_
-                                                      );
+                 var.add_suggestion(i-1,
+                                    get_configuration (specifications_[i-1].position_
+                                                       - ties[i-1].dir_,
+                                                       - ties[i-1].dir_,
+                                                       specifications_[i-1].column_ranks_,
+                                                       !specifications_[i-1].has_manual_delta_y_));
 
                  vars.push_back (var);
                }
@@ -1142,24 +1147,23 @@ Tie_formatting_problem::generate_collision_variations (Ties_configuration const
                  && ties[i-1].dir_ == DOWN)
                {
                  Tie_configuration_variation var;
-                 var.index_ = i-1;
-                 var.suggestion_ = get_configuration (specifications_[i-1].position_ - 1, DOWN,
-                                                      specifications_[i-1].column_ranks_,
-                                                      !specifications_[i-1].has_manual_delta_y_
-
-                                                      );
+                 var.add_suggestion(i-1,
+                                    get_configuration (specifications_[i-1].position_ - 1, DOWN,
+                                                       specifications_[i-1].column_ranks_,
+                                                       !specifications_[i-1].has_manual_delta_y_
+                                                       ));
                  vars.push_back (var);
                }
              if (i == ties.size () && !specifications_[i].has_manual_position_
                  && ties[i].dir_ == UP)
                {
                  Tie_configuration_variation var;
-                 var.index_ = i;
-                 var.suggestion_ = get_configuration (specifications_[i].position_
-                                                      + 1, UP,
-                                                      specifications_[i].column_ranks_,
-                                                      !specifications_[i].has_manual_delta_y_
-                                                      );
+                 var.add_suggestion(i,
+                                    get_configuration (specifications_[i].position_
+                                                       + 1, UP,
+                                                       specifications_[i].column_ranks_,
+                                                       !specifications_[i].has_manual_delta_y_
+                                                       ));
                  vars.push_back (var);
                }
            }
@@ -1167,12 +1171,12 @@ Tie_formatting_problem::generate_collision_variations (Ties_configuration const
                   && !specifications_[i].has_manual_position_)
            {
              Tie_configuration_variation var;
-             var.index_ = i;
-             var.suggestion_ = get_configuration (ties[i].position_  + ties[i].dir_,
-                                                  ties[i].dir_,
-                                                  ties[i].column_ranks_,
-                                                  !specifications_[i].has_manual_delta_y_
-                                                  );
+             var.add_suggestion(i,
+                                get_configuration (ties[i].position_  + ties[i].dir_,
+                                                   ties[i].dir_,
+                                                   ties[i].column_ranks_,
+                                                   !specifications_[i].has_manual_delta_y_
+                                                   ));
              vars.push_back (var);
            }
          
index 691a565714e526dc9ccfb61424d75a631cbd077b..d5f5d36fcd822eb24591f0d19b8b9e109380e09b 100644 (file)
@@ -119,7 +119,7 @@ note)."
 (ly:add-interface
  'percent-repeat-interface
  "Beat, Double and single measure repeats."
- '())
+ '(slope thickness))
 
 (ly:add-interface
  'piano-pedal-interface
index 89eecc2e04ce66d002cc448c42e57554eda72a4f..ab6b270f2437edcd8c384f14b0d205e992dcce2a 100644 (file)
                    (outer-tie-length-symmetry-penalty-factor . 10)
                    (vertical-distance-penalty-factor . 7)
                    (outer-tie-vertical-gap . 0.25)
-                   (multi-tie-region-size . 1)
+                   (multi-tie-region-size . 3)
                    (single-tie-region-size . 4)
                    (between-length-limit . 1.0)))