2 tie.cc -- implement Tie
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
9 #include "paper-def.hh"
11 #include "note-head.hh"
15 IMPLEMENT_IS_TYPE_B1(Tie,Bow);
18 Tie::set_head (Direction d, Note_head * head_l)
20 assert (!head_l_drul_[d]);
21 head_l_drul_[d] = head_l;
22 set_bounds (d, head_l);
24 add_dependency (head_l);
29 head_l_drul_[RIGHT] =0;
30 head_l_drul_[LEFT] =0;
36 ugh: direction of the Tie is more complicated. See [Ross] p136 and further
39 Tie::set_default_dir()
41 int m= (head_l_drul_[LEFT]->position_i_
42 + head_l_drul_[RIGHT]->position_i_) /2;
43 dir_ = (m < 0)? DOWN : UP;
47 Tie::do_add_processing()
49 if (!(head_l_drul_[LEFT] && head_l_drul_[RIGHT]))
50 warning (_("Lonely tie.. "));
53 Drul_array<Note_head *> new_head_drul = head_l_drul_;
56 new_head_drul[d] = head_l_drul_[(Direction)-d];
57 } while (flip(&d) != LEFT);
58 head_l_drul_ = new_head_drul;
62 Tie::do_post_processing()
64 Real nw_f = paper ()->note_width ();
65 Real interline_f = paper ()->interline_f ();
66 assert (head_l_drul_[LEFT] || head_l_drul_[RIGHT]);
69 [OSU]: slur and tie placement
72 * x = inner raakpunt - d * gap
74 * y = length < 5ss : horizontal raakpunt
75 y = length >= 5ss : y next interline - d * 0.25 ss
76 --> height <= 5 length ?? we use <= 3 length, now...
78 * suggested gap = ss / 5;
80 // jcn: 1/5 seems so small?
81 Real gap_f = interline_f / 2; // 5;
86 dy_f_drul_[d] = .5 * interline_f * (head_l_drul_[d]
87 ? head_l_drul_[d]->position_i_
88 : head_l_drul_[(Direction)-d]->position_i_);
90 while (flip(&d) != LEFT);
94 if (head_l_drul_[d] && head_l_drul_[d]->extremal_i_)
96 /* normal tie between noteheads, with gap of space */
98 dx_f_drul_[d] += nw_f;
99 dx_f_drul_[d] += -d * gap_f;
100 /* attach to outer 3/4 end of head */
101 dy_f_drul_[d] += dir_ * 0.25 * interline_f;
103 else if (head_l_drul_[d])
105 dx_f_drul_[d] += d*0.5 * nw_f;
109 dy_f_drul_[d] = dy_f_drul_[(Direction) -d];
110 dx_f_drul_[d] = -d * (spanned_drul_[d]->width ().length ()
114 while (flip(&d) != LEFT);
118 Tie::do_substitute_dependency (Score_elem*o, Score_elem*n)
120 Note_head *new_l =n?(Note_head*)n->item():0;
121 if (o->item() == head_l_drul_[LEFT])
122 head_l_drul_[LEFT] = new_l;
123 else if (o->item() == head_l_drul_[RIGHT])
124 head_l_drul_[RIGHT] = new_l;