2 slur.cc -- implement Slur
4 source file of the GNU LilyPond music typesetter
6 (c) 1996, 1997 Han-Wen Nienhuys <hanwen@stack.nl>
12 think about crossing stems.
13 Begin and end should be treated as a Script.
18 #include "paper-def.hh"
19 #include "note-column.hh"
22 #include "molecule.hh"
29 Slur::add (Note_column*n)
31 encompass_arr_.push (n);
36 Slur::set_default_dir()
39 for (int i=0; i < encompass_arr_.size(); i ++)
41 if (encompass_arr_[i]->dir_ < 0)
50 Slur::do_add_processing()
52 set_bounds(LEFT, encompass_arr_[0]);
53 if (encompass_arr_.size () > 1)
54 set_bounds(RIGHT, encompass_arr_.top());
58 Slur::do_pre_processing ()
60 // don't set directions
64 Slur::do_substitute_dependency (Score_elem*o, Score_elem*n)
67 while ((i = encompass_arr_.find_i ((Note_column*)o->item())) >=0)
70 encompass_arr_[i] = (Note_column*)n->item();
72 encompass_arr_.del (i);
78 Note_column_compare (Note_column *const&n1 , Note_column* const&n2)
80 return Item::left_right_compare(n1, n2);
84 Slur::do_post_processing()
86 encompass_arr_.sort (Note_column_compare);
89 Real inter_f = paper()->internote_f ();
91 Drul_array<Note_column*> extrema;
92 extrema[LEFT] = encompass_arr_[0];
93 extrema[RIGHT] = encompass_arr_.top();
96 Real nw_f = paper()->note_width ();
100 if (extrema[d] != spanned_drul_[d])
103 *(spanned_drul_[d]->width ().length ()/nw_f -0.5);
105 else if (extrema[d]->stem_l_ && !extrema[d]->stem_l_->transparent_b_)
106 pos_i_drul_[d] = (int)rint (extrema[d]->stem_l_->height()[dir_]/inter_f);
108 pos_i_drul_[d] = (int)rint (extrema[d]->head_positions_interval()[dir_]);
109 pos_i_drul_[d] += dir_;
111 while ((d *= -1) != LEFT);
114 IMPLEMENT_IS_TYPE_B1(Slur,Spanner);