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_pre_processing()
52 set_bounds(LEFT
, encompass_arr_
[0]);
53 set_bounds(RIGHT
, encompass_arr_
.top());
58 Slur::do_substitute_dependency (Score_elem
*o
, Score_elem
*n
)
61 while ((i
= encompass_arr_
.find_i ((Note_column
*)o
->item())) >=0)
64 encompass_arr_
[i
] = (Note_column
*)n
->item();
66 encompass_arr_
.del (i
);
72 Note_column_compare (Note_column
*const&n1
, Note_column
* const&n2
)
74 return Item::left_right_compare(n1
, n2
);
78 Slur::do_post_processing()
80 encompass_arr_
.sort (Note_column_compare
);
83 Real inter_f
= paper()->internote_f ();
85 Drul_array
<Note_column
*> extrema
;
86 extrema
[LEFT
] = encompass_arr_
[0];
87 extrema
[RIGHT
] = encompass_arr_
.top();
90 Real nw_f
= paper()->note_width ();
92 while ((d
*= -1) != LEFT
);
95 if (extrema
[d
] != spanned_drul_
[d
])
98 *(spanned_drul_
[d
]->width ().length ()/nw_f
-0.5);
100 else if (extrema
[d
]->stem_l_
&& !extrema
[d
]->stem_l_
->transparent_b_
)
101 pos_i_drul_
[d
] = (int)rint (extrema
[d
]->stem_l_
->height()[dir_
]/inter_f
);
103 pos_i_drul_
[d
] = (int)rint (extrema
[d
]->head_positions_interval()[dir_
]);
104 pos_i_drul_
[d
] += dir_
;
106 while ((d
*= -1) != LEFT
);
109 IMPLEMENT_IS_TYPE_B1(Slur
,Spanner
);