]> git.donarmstrong.com Git - lilypond.git/blob - lily/staff-margin-engraver.cc
release: 1.1.30
[lilypond.git] / lily / staff-margin-engraver.cc
1 /*
2   staff-margin-engraver.cc -- implement Staff_margin_engraver
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1998--1999 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
8
9 #include "staff-margin-engraver.hh"
10 #include "bar.hh"
11 #include "time-description.hh"
12 #include "g-text-item.hh"
13 #include "g-staff-side.hh"
14
15 ADD_THIS_TRANSLATOR (Staff_margin_engraver);
16
17 Staff_margin_engraver::Staff_margin_engraver ()
18 {
19   axis_ = X_AXIS;
20   type_ = "margin";
21   visibility_lambda_
22     = gh_eval_str ("postbreak_only_visibility");
23 }
24
25
26 /*
27     TODO
28
29     should be able to set whole paragraph (multiple lines, centre) to
30     left (right?) of staff, e.g.:
31                     ______
32                    |_______
33       2 Clarinetti |________
34          (Bb)      |___________
35                    |______________
36 */
37 void
38 Staff_margin_engraver::acknowledge_element (Score_element_info inf)
39 {
40   Item *i = cast_to_interesting_item (inf.elem_l_);
41   if (!i || inf.origin_grav_l_arr_.size() != 1)
42     return;
43
44
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;
49
50   if (long_str.empty_b ())
51     return;
52
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);
57 }
58
59