5 think about crossing stems.
6 Begin and end should be treated as a Script.
12 #include "paper-def.hh"
13 #include "notehead.hh"
15 #include "molecule.hh"
23 open_right=open_left=false;
29 int pos1 = encompass.top()->position_i_;
30 int pos2 = encompass[0]->position_i_;
34 Real w = width().length();
36 return Offset(w/2,dy * paper()->internote());
47 Slur::set_default_dir()
50 for (int i=0; i < encompass.size(); i ++) {
51 sumpos += encompass[i]->position_i_;
54 /* should consult stems */
55 Real meanpos = sumpos/Real(encompass.size());
56 if (meanpos < 5) // todo
63 Slur::do_pre_processing()
65 right_col_l_ = encompass.top()->pcol_l_;
66 left_col_l_ = encompass[0]->pcol_l_;
70 Slur::do_break_at(PCol*l, PCol*r) const
72 assert(l->line_l_ == r->line_l_);
73 Slur*ret = new Slur(*this);
75 ret->encompass.set_size(0);
76 for (int i =0; i < encompass.size(); i++) {
77 if (encompass[i]->pcol_l_->line_l_==l->line_l_)
78 ret->encompass.push(encompass[i]);
80 if (right_col_l_ != r)
81 ret->open_right = true;
83 ret->open_left = true;
90 Slur::do_post_processing()
97 Slur::brew_molecule_p() const
99 Molecule*output = new Molecule;
101 int minp=1000, maxp=-1000; // todo
102 for (int i=0; i<encompass.size(); i++) {
103 minp = encompass[i]->position_i_ <? minp;
104 maxp = encompass[i]->position_i_ >? maxp;
106 assert(encompass.size()>0); // todo
108 Notehead *lnote_p =encompass[0];
109 Notehead *rnote_p =encompass.top();
110 int lpos_i = lnote_p->position_i_;
111 int rpos_i = rnote_p->position_i_;
112 Offset left_off(lnote_p->x_dir_i_, lpos_i + 2*dir_i_);
113 Offset right_off(lnote_p->x_dir_i_, rpos_i + 2*dir_i_);
114 if (!lnote_p->extremal_i_)
115 left_off += Offset(0.5, -dir_i_);
116 if (!rnote_p->extremal_i_)
117 right_off+= Offset(-0.5, -dir_i_);
119 int dy = int(right_off.y - left_off.y);
121 Real nw_f = paper()->note_width();
122 Real nh_f = paper()->internote();
123 Real w = width().length();
125 w+= (right_off.x - left_off.x) * nw_f ;
126 Real round_w = w; // slur lookup rounds the slurwidth .
128 Symbol sl = paper()->lookup_l()->slur(dy , round_w, dir_i_);
130 Real error = w-round_w;
133 a.translate(Offset((left_off.x + 0.5 )*nw_f + error/2,
139 IMPLEMENT_STATIC_NAME(Slur);