]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/spanner.hh
91153b79b8e43b5ed959fc379003ad869f638add
[lilypond.git] / lily / include / spanner.hh
1 /*
2   spanner.hh -- part of GNU LilyPond
3
4   (c) 1996--2006 Han-Wen Nienhuys
5 */
6
7 #ifndef SPANNER_HH
8 #define SPANNER_HH
9
10 #include "grob.hh"
11 #include "rod.hh"
12
13 /** A symbol which is attached between two columns. A spanner is a
14     symbol which spans across several columns, so its final appearance
15     can only be calculated after the breaking problem is solved.
16
17     Examples
18
19     * (de)crescendo
20     * slur
21     * beam
22     * bracket
23
24     Spanner should know about the items which it should consider:
25     e.g. slurs should be steep enough to "enclose" all those items. This
26     is absolutely necessary for beams, since they have to adjust the
27     length of stems of notes they encompass.
28 */
29 class Spanner : public Grob
30 {
31   Drul_array<Item *> spanned_drul_;
32   vsize break_index_;
33
34   DECLARE_CLASSNAME(Spanner);
35
36 public:
37   DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM));
38
39   vector<Spanner*> broken_intos_;
40
41   vsize get_break_index () const;
42
43   // todo: move to somewhere else.
44   Real get_broken_left_end_align () const;
45   void substitute_one_mutable_property (SCM sym, SCM val);
46   bool fast_substitute_grob_array (SCM sym, Grob_array *);
47
48   virtual Interval_t<int> spanned_rank_iv ();
49   void set_bound (Direction d, Grob *);
50   Item *get_bound (Direction d) const;
51
52   Spanner (SCM, Object_key const *);
53   Spanner (Spanner const &, int copy_count);
54   bool is_broken () const;
55   void do_break ();
56   Real spanner_length () const;
57
58   static int compare (Spanner *const &, Spanner *const &);
59   static bool less (Spanner *const &, Spanner *const &);
60   virtual Grob *find_broken_piece (System *) const;
61   virtual void derived_mark () const;
62   static bool has_interface (Grob *);
63   virtual System *get_system () const;
64
65 protected:
66   void set_my_columns ();
67   virtual Grob *clone (int count) const;
68   virtual void do_break_processing ();
69 };
70
71 void add_bound_item (Spanner *, Grob *);
72
73 bool spanner_less (Spanner *s1, Spanner *s2);
74 int broken_spanner_index (Spanner *sp);
75 #endif