2 extender-spanner.cc -- implement Extender_spanner
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2000 Jan Nieuwenhuizen <janneke@gnu.org>
10 TODO: too complicated implementation. Why the dx_drul?.
14 #include "dimension-cache.hh"
18 #include "molecule.hh"
19 #include "paper-column.hh"
20 #include "paper-def.hh"
21 #include "extender-spanner.hh"
23 Extender_spanner::Extender_spanner (SCM s
)
27 dx_f_drul_
[LEFT
] = dx_f_drul_
[RIGHT
] = 0.0;
28 set_extent_callback (Score_element::point_dimension_callback
, Y_AXIS
);
35 Extender_spanner::do_brew_molecule () const
39 Real w
= spanner_length ();
41 w
+= (dx_f_drul_
[RIGHT
] - dx_f_drul_
[LEFT
]);
42 Real h
= paper_l ()->get_var ("extender_height");
43 Molecule a
= lookup_l ()->filledbox ( Box (Interval (0,w
), Interval (0,h
)));
44 a
.translate (Offset (dx_f_drul_
[LEFT
], 0));
54 Extender_spanner::after_line_breaking ()
57 Real gap
= paper_l ()->get_var ("interline");
62 Item
* t
= get_bound (d
)
63 ? get_bound (d
) : get_bound ((Direction
)-d
);
65 dx_f_drul_
[d
] += t
->extent (X_AXIS
).length ();
67 dx_f_drul_
[d
] -= d
* gap
/ 2;
69 while (flip(&d
) != LEFT
);
74 Extender_spanner::set_textitem (Direction d
, Item
* textitem_l
)
76 set_bound (d
, textitem_l
);
77 add_dependency (textitem_l
);