2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 1996--2015 Han-Wen Nienhuys
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
26 /** A symbol which is attached between two columns. A spanner is a
27 symbol which spans across several columns, so its final appearance
28 can only be calculated after the breaking problem is solved.
37 Spanner should know about the items which it should consider:
38 e.g. slurs should be steep enough to "enclose" all those items. This
39 is absolutely necessary for beams, since they have to adjust the
40 length of stems of notes they encompass.
43 struct Preinit_Spanner
45 Drul_array<Item *> spanned_drul_;
46 SCM pure_property_cache_;
50 class Spanner : Preinit_Spanner, public Grob
54 DECLARE_CLASSNAME (Spanner);
57 DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM));
58 DECLARE_SCHEME_CALLBACK (calc_normalized_endpoints, (SCM));
59 DECLARE_SCHEME_CALLBACK (bounds_width, (SCM));
60 DECLARE_SCHEME_CALLBACK (kill_zero_spanned_time, (SCM));
62 vector<Spanner *> broken_intos_;
64 vsize get_break_index () const;
65 Spanner *broken_neighbor (Direction d) const;
67 // todo: move to somewhere else.
68 Real get_broken_left_end_align () const;
69 void substitute_one_mutable_property (SCM sym, SCM val);
71 Interval_t<Moment> spanned_time () const;
72 virtual Interval_t<int> spanned_rank_interval () const;
73 void set_bound (Direction d, Grob *);
74 Item *get_bound (Direction d) const;
77 Spanner (Spanner const &);
78 bool is_broken () const;
80 Real spanner_length () const;
82 static int compare (Spanner *const &, Spanner *const &);
83 static bool less (Spanner *const &, Spanner *const &);
84 virtual Grob *find_broken_piece (System *) const;
85 virtual void derived_mark () const;
86 virtual System *get_system () const;
88 SCM get_cached_pure_property (SCM sym, int start, int end);
89 void cache_pure_property (SCM sym, int start, int end, SCM value);
92 void set_my_columns ();
93 virtual Grob *clone () const;
94 virtual void do_break_processing ();
95 bool fast_substitute_grob_array (SCM sym, Grob_array *);
98 void add_bound_item (Spanner *, Grob *);
100 bool spanner_less (Spanner *s1, Spanner *s2);