]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/bar-script-engraver.cc
release: 1.3.8
[lilypond.git] / lily / bar-script-engraver.cc
index c8becdc046d6dc40415561bd89a91525a5f8bb9b..243efae34e02f2db046ab116d8f984bde06f83b0 100644 (file)
 Bar_script_engraver::Bar_script_engraver ()
 {
   axis_ = Y_AXIS;
-  staff_side_p_ = 0;
   text_p_ =0;
   hang_on_clef_b_ = false;
   visibility_lambda_ 
-    = ly_ch_C_eval_scm ("non-postbreak-visibility");
+    = ly_eval_str ("non-postbreak-visibility");
 }
 
 void
@@ -48,21 +47,22 @@ void
 Bar_script_engraver::attach_script_to_item (Item *i)
 {
   Axis other_axis = Axis((axis_ + 1)%2);
-  if (staff_side_p_ && !staff_side_p_->parent_l(other_axis)) 
+  if (text_p_ && !text_p_->parent_l(other_axis)) 
     {
-      staff_side_p_->set_parent (i,other_axis);
-      staff_side_p_->set_parent (i,axis_);
+      text_p_->set_parent (i,other_axis);
+      text_p_->set_parent (i,axis_);
 
       if (!text_p_->parent_l(other_axis))
        text_p_->set_parent (i,other_axis);
-      staff_side_p_->add_support (i);
+
+      Staff_sidify (text_p_).add_support (i);
 
       /*
-       How do we make sure that staff_side_p_ has a dependency from
+       How do we make sure that text_p_ has a dependency from
        someone else? We can't use I for that,  so we use some other element.
        */
-      // staff_side_p_->set_elt_property ("dangling", SCM_BOOL_T)
-      get_staff_info ().command_pcol_l ()->add_dependency (staff_side_p_);
+      // text_p_->set_elt_property ("dangling", SCM_BOOL_T)
+      get_staff_info ().command_pcol_l ()->add_dependency (text_p_);
     }
 }
 
@@ -118,59 +118,42 @@ Bar_script_engraver::do_pre_move_processing ()
       typeset_element (text_p_);
       text_p_ =0;
     }
-  
-  if (staff_side_p_) 
-    {
-      typeset_element (staff_side_p_);
-      staff_side_p_ = 0;
-    }
 }
 
 
 void
 Bar_script_engraver::create_items (Request *rq)
 {
-  if (staff_side_p_ || text_p_)
+  if (text_p_)
     return;
   
-  staff_side_p_ = new Staff_side_item;
-  staff_side_p_->axis_ = axis_;
-  staff_side_p_->set_elt_property ("breakable", SCM_BOOL_T); // ugh
-
-  
   text_p_ = new Text_item;
   text_p_->set_elt_property ("breakable", SCM_BOOL_T); // ugh
+  Staff_sidify staffside(text_p_);
+  staffside.set_axis (axis_);
 
   SCM prop = get_property (type_ + "Direction", 0);
-  if (isdir_b (prop))
+  if (!isdir_b (prop))
     {
-      staff_side_p_->set_direction ( to_dir (prop));
-    }
-  else 
-    {
-      staff_side_p_->set_direction ( UP);
+      prop = gh_int2scm (UP);
     }
+  text_p_->set_elt_property ("direction", prop);
 
-  staff_side_p_->set_victim(text_p_);
-  
   SCM padding = get_property (type_ + "ScriptPadding", 0);
   if (gh_number_p(padding))
     {
-      staff_side_p_->set_elt_property ("padding", padding);
+      text_p_->set_elt_property ("padding", padding);
     }
   else
     {
-      staff_side_p_
+      text_p_
        ->set_elt_property ("padding",
                            gh_double2scm(paper_l ()->get_var ("interline")));
     }
   
-  staff_side_p_->set_elt_property ("visibility-lambda",
-                                  visibility_lambda_);
   text_p_->set_elt_property ("visibility-lambda",
                             visibility_lambda_);
   
   announce_element (Score_element_info (text_p_, rq));
-  announce_element (Score_element_info (staff_side_p_, rq));
 }