]> git.donarmstrong.com Git - lilypond.git/commitdiff
fix hairpinToBarline
authorJoe Neeman <joeneeman@gmail.com>
Thu, 5 Jul 2007 08:20:25 +0000 (18:20 +1000)
committerJoe Neeman <joeneeman@gmail.com>
Thu, 5 Jul 2007 08:20:25 +0000 (18:20 +1000)
input/regression/spacing-stem-direction.ly
input/regression/spacing-stem-same-direction.ly
lily/bar-engraver.cc
lily/dynamic-engraver.cc
lily/spanner.cc
scm/define-grob-properties.scm

index 5b36a754c1591af0e09c5f8db7d097078e65773d..b36cc2c8ea75f27dee8cab8f468b966103a9701e 100644 (file)
@@ -17,6 +17,9 @@ much to correct."
 
 
 \context Voice \relative c {
+  \override Score.PaperColumn #'layer = #1
+  \override Score.PaperColumn #'stencil = #ly:paper-column::print
+
   %% make sure neutral is down.
   \override Stem  #'neutral-direction = #down
   \time 16/4  c''4 c c,  c' d, c' e, c' f, c' g c a c b c
index 835f53feb32c480260510bf83cdf3fd7a8bd1c53..fd98cac213780c6cd13c6c0532724c877e489bb2 100644 (file)
@@ -9,6 +9,9 @@ two chords have no common head-positions range."
 \layout { ragged-right = ##t}
 
 \relative c'' {
+  \override Score.PaperColumn #'layer = #1
+  \override Score.PaperColumn #'stencil = #ly:paper-column::print
+
   \stemDown
   \time 12/4
   f8[
index f480d2624d3c10b709a8902566c36c9d10557f9a..2357c087b5dc425a3faa839c629cd6c4f9d9aee5 100644 (file)
@@ -12,6 +12,7 @@
 #include "score-engraver.hh"
 #include "warn.hh"
 #include "item.hh"
+#include "spanner.hh"
 
 #include "translator.icc"
 
@@ -28,10 +29,13 @@ protected:
   void stop_translation_timestep ();
   void process_acknowledged ();
 
+  DECLARE_END_ACKNOWLEDGER (spanner);
+
 private:
   void create_bar ();
 
   Item *bar_;
+  vector<Spanner*> spanners_;
 };
 
 Bar_engraver::Bar_engraver ()
@@ -67,6 +71,10 @@ Bar_engraver::process_acknowledged ()
 {
   if (!bar_ && scm_is_string (get_property ("whichBar")))
     create_bar ();
+
+  if (bar_)
+    for (vsize i = 0; i < spanners_.size (); i++)
+      spanners_[i]->set_bound (RIGHT, bar_);
 }
 
 /*
@@ -79,8 +87,20 @@ Bar_engraver::stop_translation_timestep ()
     context ()->get_score_context ()->set_property ("forbidBreak", SCM_BOOL_T);
 
   bar_ = 0;
+  spanners_.clear ();
+}
+
+void
+Bar_engraver::acknowledge_end_spanner (Grob_info gi)
+{
+  Grob *g = gi.grob ();
+
+  if (to_boolean (g->get_property ("to-barline")))
+    spanners_.push_back (dynamic_cast<Spanner*> (g));
 }
 
+ADD_END_ACKNOWLEDGER (Bar_engraver, spanner);
+
 ADD_TRANSLATOR (Bar_engraver,
                /* doc */ "Create barlines. This engraver is controlled through the "
                "@code{whichBar} property. If it has no bar line to create, it will forbid a linebreak at this point",
index 5de751602481e8e732951b1ceabbc8f6b1b5320c..63536d1193de56c051a78cac2250aaf4f8f0fc52 100644 (file)
@@ -176,6 +176,15 @@ Dynamic_engraver::process_music ()
            }
 
          finished_cresc_ = cresc_;
+
+         /* backwards compatibility with hairpinToBarline */
+         bool use_bar = to_boolean (get_property ("hairpinToBarline"))
+           && scm_is_string (get_property ("whichBar"))
+           && !script_ev_;
+
+         finished_cresc_->set_property ("to-barline", scm_from_bool (use_bar));
+
+         announce_end_grob (finished_cresc_, SCM_EOL);
          cresc_ = 0;
          current_cresc_ev_ = 0;
        }
@@ -335,18 +344,10 @@ Dynamic_engraver::typeset_all ()
 {
   if (finished_cresc_)
     {
-      bool use_bar = to_boolean (get_property ("hairpinToBarline"))
-       && scm_is_string (get_property ("whichBar"))
-       && !script_ev_;
-                         
-      
-      if (!finished_cresc_->get_bound (RIGHT)
-         || use_bar)
+      if (!finished_cresc_->get_bound (RIGHT))
        {
                  
-         Grob *column_bound = unsmob_grob (use_bar
-                                           ? get_property ("currentCommandColumn")
-                                           : get_property ("currentMusicalColumn"));
+         Grob *column_bound = unsmob_grob (get_property ("currentMusicalColumn"));
          
          finished_cresc_->set_bound (RIGHT, script_
                                      ? script_
@@ -390,7 +391,6 @@ Dynamic_engraver::typeset_all ()
          finished_line_spanner_->set_bound (RIGHT, ci);
          finished_line_spanner_->set_bound (LEFT, ci);
        }
-
       finished_line_spanner_ = 0;
     }
 }
index 77ee01074e5e1517f1bb8d056ad644a3f7888c9a..53d669365450b6aaf5e550c0643854aa7a26f82c 100644 (file)
@@ -428,5 +428,6 @@ ADD_INTERFACE (Spanner,
               "also the X-reference point of the spanner.\n",
 
               "minimum-length "
+              "to-barline "
               );
 
index 0cdcf8f825739bc423b3ca00501d6364a6a44573..e8ea8998ad0a727a605c892f611e00cbee9c07a7 100644 (file)
@@ -521,6 +521,8 @@ should use @code{LEFT}.")
      (thin-kern ,number? "The space after a hair-line in a bar line.")
      (threshold ,number-pair? "@code{(@var{min} . @var{max})}, where
 @var{min} and @var{max} are dimensions in staff space.")
+     (to-barline ,boolean? "If true, the spanner will stop at that barline
+just before it would otherwise stop.")
      (tie-configuration ,list? "List of @code{(@var{position} .
 @var{dir})} pairs, indicating the desired tie configuration, where
 @var{position} is the offset from the center of the staff in staff