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