]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/dynamic-engraver.cc
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / lily / dynamic-engraver.cc
index e6ecc2a972193ade920df537597e5ccb6e754ccd..ab242f653c0c760d1247bcd8eb30739a988fc8a9 100644 (file)
@@ -55,12 +55,13 @@ class Dynamic_engraver : public Engraver
 
   Drul_array<Music *> accepted_spanevents_drul_;
 
-  Link_array<Note_column> pending_columns_;
-  Link_array<Grob> pending_elements_;
+  vector<Note_column*> pending_columns_;
+  vector<Grob*> pending_elements_;
 
   void typeset_all ();
 
   TRANSLATOR_DECLARATIONS (Dynamic_engraver);
+  DECLARE_ACKNOWLEDGER (accidental);
   DECLARE_ACKNOWLEDGER (script);
   DECLARE_ACKNOWLEDGER (stem_tremolo);
   DECLARE_ACKNOWLEDGER (note_column);
@@ -187,7 +188,7 @@ Dynamic_engraver::process_music ()
     {
       if (current_cresc_ev_)
        {
-         std::string msg = _ ("already have a decrescendo");
+         string msg = _ ("already have a decrescendo");
          if (current_cresc_ev_->is_mus_type ("decrescendo-event"))
            msg = _ ("already have a crescendo");
 
@@ -205,17 +206,20 @@ Dynamic_engraver::process_music ()
            TODO: Use symbols.
          */
 
-         std::string start_type
+         string start_type
            = ly_symbol2string (current_cresc_ev_->get_property ("name"));
-
-         /*
-           ugh. Use push/pop?
-         */
+         
          if (start_type == "DecrescendoEvent")
            start_type = "decrescendo";
          else if (start_type == "CrescendoEvent")
            start_type = "crescendo";
+         
+                                      
 
+         /*
+           UGH. TODO: should read from original event, so appearance
+           may be altered with \tweak.
+          */
          SCM s = get_property ((start_type + "Spanner").c_str ());
          if (!scm_is_symbol (s) || s == ly_symbol2scm ("hairpin"))
            {
@@ -323,11 +327,21 @@ Dynamic_engraver::typeset_all ()
 {
   if (finished_cresc_)
     {
-      if (!finished_cresc_->get_bound (RIGHT))
+      bool use_bar = to_boolean (get_property ("hairpinToBarline"))
+       && scm_is_string (get_property ("whichBar"))
+       && !script_ev_;
+                         
+      
+      if (!finished_cresc_->get_bound (RIGHT)
+         || use_bar)
        {
+         Grob *column_bound = unsmob_grob (use_bar
+                                           ? get_property ("currentCommandColumn")
+                                           : get_property ("currentMusicalColumn"));
+           
          finished_cresc_->set_bound (RIGHT, script_
                                      ? script_
-                                     : unsmob_grob (get_property ("currentMusicalColumn")));
+                                     : column_bound);
 
          if (finished_line_spanner_)
            add_bound_item (finished_line_spanner_,
@@ -373,6 +387,14 @@ Dynamic_engraver::typeset_all ()
 }
 
 
+void
+Dynamic_engraver::acknowledge_accidental (Grob_info info)
+{
+  if (line_spanner_)
+    Side_position_interface::add_support (line_spanner_, info.grob ());
+}
+
+
 void
 Dynamic_engraver::acknowledge_stem_tremolo (Grob_info info)
 {
@@ -446,6 +468,7 @@ Dynamic_engraver::acknowledge_script (Grob_info info)
     Side_position_interface::add_support (line_spanner_, info.grob ());
 }
 
+ADD_ACKNOWLEDGER (Dynamic_engraver, accidental);
 ADD_ACKNOWLEDGER (Dynamic_engraver, script);
 ADD_ACKNOWLEDGER (Dynamic_engraver, note_column);
 ADD_ACKNOWLEDGER (Dynamic_engraver, slur);