]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/spanner.hh
release: 1.3.38
[lilypond.git] / lily / include / spanner.hh
index 3bb547b528e1898401a8049128fa1b05e684cc6d..2a50a826b2d986719502650e0ae2382c30888d7c 100644 (file)
@@ -1,54 +1,62 @@
 /*
-  spanner.hh -- part of LilyPond
+  spanner.hh -- part of GNU LilyPond
 
-  (c) 1996,97 Han-Wen Nienhuys
+  (c) 1996--2000 Han-Wen Nienhuys
 */
 
 #ifndef SPANNER_HH
 #define SPANNER_HH
 
-#include "proto.hh"
-#include "staff-elem.hh"
+#include "lily-proto.hh"
+#include "score-element.hh"
+#include "drul-array.hh"
+#include "rod.hh"
 
-
-/** a symbol which is attached between two columns. A spanner is a symbol which spans across several columns, so its
-  final appearance can only be calculated after the breaking problem
-  is solved.
+/** A symbol which is attached between two columns. A spanner is a
+  symbol which spans across several columns, so its final appearance
+  can only be calculated after the breaking problem is solved.
 
   Examples
 
-  - (de)crescendo
-  - slur
-  - beam
-  - bracket
-  
+  * (de)crescendo
+  * slur
+  * beam
+  * bracket
 
   Spanner should know about the items which it should consider:
-    e.g. slurs should be steep enough to "enclose" all those items. This
-    is absolutely necessary for beams, since they have to adjust the
-    length of stems of notes they encompass.
-
-    */
-struct Spanner:Staff_elem {
-    PCol *left_col_l_, *right_col_l_;
-
-    
-    /* *************** */
-    
-    Spanner();
-    virtual Interval width()const;
-    void do_print()const;
-
-    Spanner *broken_at(PCol *c1,  PCol *c2) const;
-    virtual Spanner* spanner() { return this; }
-protected:
+  e.g. slurs should be steep enough to "enclose" all those items. This
+  is absolutely necessary for beams, since they have to adjust the
+  length of stems of notes they encompass.
+
+  */
+class Spanner : public  Score_element {
+  Drul_array<Item*> spanned_drul_;
 
-    /**
-  clone a piece of  this spanner.
-    PRE
-    c1 >= start, c2  <= stop
-    */
-    virtual Spanner *do_break_at( PCol *c1,  PCol *c2) const=0;
-    NAME_MEMBERS(Spanner);
+public:
+  Link_array<Spanner> broken_into_l_arr_;
+
+  // TODO: make virtual and do this for Items as well.
+  Interval_t<int> spanned_rank_iv ();
+  void set_bound (Direction d, Item*);
+  Item *get_bound (Direction d) const;
+  
+  Spanner ();
+  Spanner (Spanner const &);
+  bool broken_b () const;
+  void do_break ();
+
+  static int compare (Spanner * const &,Spanner * const &);
+  virtual Array<Rod> get_rods () const;
+  virtual Array<Spring> get_springs () const;  
+  virtual Score_element* find_broken_piece (Line_of_score*) const;
+protected:
+  void set_my_columns ();
+  VIRTUAL_COPY_CONS(Score_element);
+  Real get_broken_left_end_align () const;
+
+  virtual void do_space_processing ();
+  virtual void do_break_processing ();
+  Real spanner_length () const;
+  virtual Line_of_score*line_l () const;
 };
 #endif