]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/dynamic-engraver.cc
release: 1.3.0
[lilypond.git] / lily / dynamic-engraver.cc
index b0670d523631731b106123a0a309bcd77a9b1227..2933131c8d26b62339cb48bd4a07469e56230ef7 100644 (file)
@@ -7,15 +7,14 @@
 */
 #include "debug.hh"
 #include "crescendo.hh"
-#include "dynamic-engraver.hh"
 #include "musical-request.hh"
 #include "lookup.hh"
 #include "paper-def.hh"
 #include "score-column.hh"
 #include "staff-symbol.hh"
 #include "note-column.hh"
-#include "g-text-item.hh"
-#include "g-staff-side.hh"
+#include "text-item.hh"
+#include "staff-side.hh"
 #include "engraver.hh"
 #include "stem.hh"
 #include "note-head.hh"
  */
 class Dynamic_engraver : public Engraver
 {
-  G_text_item * text_p_;
-  G_staff_side_item * staff_side_p_;
-  G_staff_side_spanner * ss_span_p_;
-  G_staff_side_spanner * to_end_ss_span_p_;
+  Text_item * text_p_;
+  Staff_side_item * staff_side_p_;
+  Staff_side_spanner * ss_span_p_;
+  Staff_side_spanner * to_end_ss_span_p_;
   
   
   Crescendo * to_end_cresc_p_;
@@ -99,7 +98,7 @@ void
 Dynamic_engraver::do_process_requests()
 {
   Crescendo*  new_cresc_p=0;
-  G_staff_side_spanner * new_sss_p =0;
+  Staff_side_spanner * new_sss_p =0;
   for (int i=0; i < dynamic_req_l_arr_.size(); i++)
     {
       if (Text_script_req *absd =
@@ -107,44 +106,56 @@ Dynamic_engraver::do_process_requests()
        {
          if (text_p_)
            {
-             dynamic_req_l_arr_[i]->warning (_("Got a dynamic already.  Continuing dazed and confused"));
+             dynamic_req_l_arr_[i]->warning (_("Got a dynamic already.  Continuing dazed and confused."));
              continue;
            }
          
          String loud = absd->text_str_;
 
-         text_p_ = new G_text_item;
+         text_p_ = new Text_item;
          text_p_->text_str_ =  loud; // ugh
-         Scalar prop = get_property ("dynamicStyle", 0);
 
-         text_p_->style_str_ = prop.length_i () ? prop :  "dynamic";
-
-         staff_side_p_ = new G_staff_side_item;
+         staff_side_p_ = new Staff_side_item;
          staff_side_p_->set_elt_property (script_priority_scm_sym,
                                           gh_int2scm (100));
                                           
          staff_side_p_->set_victim (text_p_);
          staff_side_p_->axis_ = Y_AXIS;
-         
+         staff_side_p_->dir_ = DOWN;
 
-         prop = get_property ("dynamicDir", 0);
-         if (prop.isnum_b ())
+         
+         SCM prop = get_property ("verticalDirection", 0);
+         if (isdir_b (prop))
            {
-             staff_side_p_->dir_ = (Direction) (int) prop;
+             staff_side_p_->dir_ = to_dir (prop);
            }
 
+         prop = get_property ("dynamicDirection", 0);
+         if (SCM_NUMBERP(prop))
+           {
+             staff_side_p_->dir_ = to_dir (prop);
+           }
+         if (absd->dir_)
+           {
+             staff_side_p_->dir_ = absd->dir_;
+           }
 
+         prop = get_property ("dynamicPadding", 0);
+         if (SCM_NUMBERP(prop))
+           {
+             staff_side_p_->set_elt_property (padding_scm_sym, prop);
+           }
          announce_element (Score_element_info (text_p_, absd));
          announce_element (Score_element_info (staff_side_p_, absd));
        }
       else if (Span_req *span_l
-                      = dynamic_cast <Span_req *> (dynamic_req_l_arr_[i]))
+              = dynamic_cast <Span_req *> (dynamic_req_l_arr_[i]))
        {
          if (span_l->span_dir_ == STOP)
            {
              if (!cresc_p_)
                {
-                 span_l->warning (_ ("can't find (de)crescendo to end"));
+                 span_l->warning (_ ("Can't find (de)crescendo to end"));
                }
              else
                {
@@ -154,12 +165,25 @@ Dynamic_engraver::do_process_requests()
                  
                  cresc_p_ = 0;
                  ss_span_p_ =0;
-                 Scalar prop = get_property ("dynamicDir", 0);
-                 if (prop.isnum_b ())
+
+
+
+                 
+                 SCM prop = get_property ("verticalDirection", 0);
+                 if (isdir_b (prop))
                    {
-                     to_end_ss_span_p_->dir_ = (Direction) (int) prop;
+                     to_end_ss_span_p_->dir_ = to_dir (prop);
+                   }
+                 prop = get_property ("dynamicDirection", 0);
+                 if (isdir_b (prop))
+                   {
+                     to_end_ss_span_p_->dir_ = to_dir (prop);
+                   }
+                 prop = get_property ("dynamicPadding", 0);
+                 if (SCM_NUMBERP(prop))
+                   {
+                     to_end_ss_span_p_->set_elt_property (padding_scm_sym,prop);
                    }
-                 
                }
            }
          else if (span_l->span_dir_ == START)
@@ -170,9 +194,11 @@ Dynamic_engraver::do_process_requests()
              new_cresc_p->grow_dir_ = (span_l->span_type_str_ == "crescendo")  ? BIGGER : SMALLER;
              announce_element (Score_element_info (new_cresc_p, span_l));
 
-             new_sss_p = new G_staff_side_spanner;
+             new_sss_p = new Staff_side_spanner;
              new_sss_p->set_victim (new_cresc_p);
              new_sss_p->axis_ = Y_AXIS;
+             // UGH.!
+             // new_sss_p->set_elt_property (dangling_scm_sym, SCM_BOOL_T);
              announce_element (Score_element_info (new_sss_p, span_l));
            }
        }