]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/staff-margin-engraver.cc
patch::: 1.3.32.hwn2
[lilypond.git] / lily / staff-margin-engraver.cc
index 7fdba6a601eac1937cdae7df164d565af116769b..8aecb00f3a45c941fa38577ea3b01eac08c05fbb 100644 (file)
@@ -3,14 +3,15 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1998--1999 Jan Nieuwenhuizen <janneke@gnu.org>
+  (c) 1998--2000 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
 #include "staff-margin-engraver.hh"
 #include "bar.hh"
-#include "time-description.hh"
+#include "timing-translator.hh"
 #include "text-item.hh"
-#include "staff-side.hh"
+#include "side-position-interface.hh"
+#include "staff-symbol-referencer.hh"
 
 ADD_THIS_TRANSLATOR (Staff_margin_engraver);
 
@@ -18,7 +19,6 @@ Staff_margin_engraver::Staff_margin_engraver ()
 {
   axis_ = X_AXIS;
   type_ = "margin";
-  visibility_lambda_ = ly_ch_C_eval_scm ("postbreak_only_visibility");
 }
 
 
@@ -37,12 +37,12 @@ void
 Staff_margin_engraver::acknowledge_element (Score_element_info inf)
 {
   Item *i = cast_to_interesting_item (inf.elem_l_);
-  if (!i || inf.origin_trans_l_arr_.size() != 1)
+  if (!i || inf.origin_trans_l_arr (this).size() != 1)
     return;
 
 
-  SCM long_name = get_property ("instrument", 0);
-  SCM short_name = get_property ("instr", 0);
+  SCM long_name = get_property ("instrument");
+  SCM short_name = get_property ("instr");
 
   if (now_mom () > Moment (0))
     long_name = short_name;
@@ -50,8 +50,8 @@ Staff_margin_engraver::acknowledge_element (Score_element_info inf)
   if (gh_string_p (long_name))
     {
       create_items (0);
-      text_p_->text_str_ = ly_scm2string (long_name);
-      staff_side_p_->dir_ = LEFT;
+      text_p_->set_elt_property ("text", long_name);
+      text_p_->set_elt_property ("direction", gh_int2scm (LEFT));
       Bar_script_engraver::attach_script_to_item (i);
 
       /*
@@ -59,6 +59,18 @@ Staff_margin_engraver::acknowledge_element (Score_element_info inf)
    */
       Interval iv(text_p_->extent (Y_AXIS));
       text_p_->translate_axis (- iv.center (),  Y_AXIS);
+
+      Real staff_space = Staff_symbol_referencer_interface (text_p_).staff_space ();
+      SCM s = get_property ("staffMarginHorizontalPadding");
+      if (gh_number_p (s))
+       {
+         text_p_->translate_axis (gh_scm2double (s) * staff_space, X_AXIS);
+       }
+      s = get_property ("staffMarginVerticalPadding");
+      if (gh_number_p (s))
+       {
+         text_p_->translate_axis (gh_scm2double (s) * staff_space, Y_AXIS);
+       }
     }
 }