lilypond-1.1.67
[lilypond.git] / lily / staff-margin-engraver.cc
blob6d083e01ee074b0fe5b24816b9b82814f9bad96c
1 /*
2 staff-margin-engraver.cc -- implement Staff_margin_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--1999 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
9 #include "staff-margin-engraver.hh"
10 #include "bar.hh"
11 #include "time-description.hh"
12 #include "text-item.hh"
13 #include "staff-side.hh"
15 ADD_THIS_TRANSLATOR (Staff_margin_engraver);
17 Staff_margin_engraver::Staff_margin_engraver ()
19 axis_ = X_AXIS;
20 type_ = "margin";
21 visibility_lambda_
22 = gh_eval_str ("postbreak_only_visibility");
27 TODO
29 should be able to set whole paragraph (multiple lines, center) to
30 left (right?) of staff, e.g.:
31 ______
32 |_______
33 2 Clarinetti |________
34 (Bb) |___________
35 |______________
37 void
38 Staff_margin_engraver::acknowledge_element (Score_element_info inf)
40 Item *i = cast_to_interesting_item (inf.elem_l_);
41 if (!i || inf.origin_trans_l_arr_.size() != 1)
42 return;
45 String long_str = get_property ("instrument", 0);
46 String str = get_property ("instr", 0);
47 if (now_mom () > Moment (0) && str.length_i ())
48 long_str = str;
50 if (long_str.empty_b ())
51 return;
53 create_items (0);
54 text_p_->text_str_ = long_str;
55 staff_side_p_->dir_ = LEFT;
56 Bar_script_engraver::do_acknowledge_element (i);
59 UGH. ignores font size settings.
61 Interval iv(text_p_->extent (Y_AXIS));
62 text_p_->translate_axis (- iv.center (), Y_AXIS);