\inputregister {Local_key_register}
\inputregister { Staff_sym_register }
\inputregister { Collision_register }
+ \inputregister { Rest_collision_register }
\inputregister {
Voice_group_registers
\inputregister { Dynamic_register }
\inputregister { Text_register }
\inputregister { Script_register }
\inputregister { Note_column_register }
+ \inputregister { Slur_register }
\inputregister { Voice_registers
\inputregister { Notehead_register }
- \inputregister { Slur_register }
+ \inputregister { Tie_register }
}
}
}
#include "slur-reg.hh"
#include "slur.hh"
#include "debug.hh"
-#include "notehead.hh"
+#include "note-column.hh"
+
+bool
+Slur_register::acceptable_request_b(Request*req_l)
+{
+ return req_l->musical() && req_l->musical()->slur();
+}
bool
Slur_register::try_request(Request *req_l)
void
Slur_register::acknowledge_element(Staff_elem_info info)
{
- if (info.elem_l_->name() == Notehead::static_name()) {
- Notehead *head_p =(Notehead*) info.elem_l_ ;// ugh
+ if (info.elem_l_->name() == Note_column::static_name()) {
+ Note_column *col_l =(Note_column*) info.elem_l_ ;// ugh
for (int i = 0; i < slur_l_stack_.size(); i++)
- slur_l_stack_[i]->add(head_p );
+ slur_l_stack_[i]->add(col_l );
for (int i = 0; i < end_slur_l_arr_.size(); i++)
- end_slur_l_arr_[i]->add(head_p);
+ end_slur_l_arr_[i]->add(col_l);
}
}
/*
+/*
+ slur.cc -- implement Slur
+
+ source file of the LilyPond music typesetter
+
+ (c) 1996, 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
/*
TODO:
#include "scalar.hh"
#include "lookup.hh"
#include "paper-def.hh"
-#include "notehead.hh"
+#include "note-column.hh"
+#include "stem.hh"
#include "p-col.hh"
#include "molecule.hh"
#include "debug.hh"
-Slur::Slur()
-{
- open_right=open_left=false;
-}
-
-Offset
-Slur::center() const
-{
- int pos1 = encompass.top()->position_i_;
- int pos2 = encompass[0]->position_i_;
-
- int dy = pos1-pos2;
-
- Real w = width().length();
-
- return Offset(w/2,dy * paper()->internote());
-}
-
void
-Slur::add(Notehead*n)
+Slur::add(Note_column*n)
{
- encompass.push(n);
+ encompass_arr_.push(n);
add_dependency(n);
}
void
Slur::set_default_dir()
{
- int sumpos=0;
- for (int i=0; i < encompass.size(); i ++) {
- sumpos += encompass[i]->position_i_;
+ dir_i_ = -1;
+ for (int i=0; i < encompass_arr_.size(); i ++) {
+ if (encompass_arr_[i]->dir_i_ < 0) {
+ dir_i_ =1;
+ break;
+ }
}
-
- /* should consult stems */
- Real meanpos = sumpos/Real(encompass.size());
- if (meanpos < 5) // todo
- dir_i_ = -1;
- else
- dir_i_ = 1;
}
void
Slur::do_pre_processing()
{
- right_col_l_ = encompass.top()->pcol_l_;
- left_col_l_ = encompass[0]->pcol_l_;
+ right_col_l_ = encompass_arr_.top()->pcol_l_;
+ left_col_l_ = encompass_arr_[0]->pcol_l_;
}
Spanner*
assert(l->line_l_ == r->line_l_);
Slur*ret = new Slur(*this);
- ret->encompass.set_size(0);
- for (int i =0; i < encompass.size(); i++) {
- if (encompass[i]->pcol_l_->line_l_==l->line_l_)
- ret->encompass.push(encompass[i]);
+ ret->encompass_arr_.set_size(0);
+ for (int i =0; i < encompass_arr_.size(); i++) {
+ if (encompass_arr_[i]->pcol_l_->line_l_==l->line_l_)
+ ret->encompass_arr_.push(encompass_arr_[i]);
}
- if (right_col_l_ != r)
- ret->open_right = true;
- if (left_col_l_ != l)
- ret->open_left = true;
-
return ret;
}
{
if (!dir_i_)
set_default_dir();
+ Real inter_f = paper()->internote();
+ left_pos_i_ = encompass_arr_[0]->stem_l_->height()[dir_i_]/inter_f;
+ right_pos_i_ = encompass_arr_.top()->stem_l_->height()[dir_i_]/inter_f;
}
-
-Molecule*
-Slur::brew_molecule_p() const
-{
- Molecule*output = new Molecule;
-
- int minp=1000, maxp=-1000; // todo
- for (int i=0; i<encompass.size(); i++) {
- minp = encompass[i]->position_i_ <? minp;
- maxp = encompass[i]->position_i_ >? maxp;
- }
- assert(encompass.size()>0); // todo
-
- Notehead *lnote_p =encompass[0];
- Notehead *rnote_p =encompass.top();
- int lpos_i = lnote_p->position_i_;
- int rpos_i = rnote_p->position_i_;
- Offset left_off(lnote_p->x_dir_i_, lpos_i + 2*dir_i_);
- Offset right_off(lnote_p->x_dir_i_, rpos_i + 2*dir_i_);
- if (!lnote_p->extremal_i_)
- left_off += Offset(0.5, -dir_i_);
- if (!rnote_p->extremal_i_)
- right_off+= Offset(-0.5, -dir_i_);
-
- int dy = int(right_off.y - left_off.y);
-
- Real nw_f = paper()->note_width();
- Real nh_f = paper()->internote();
- Real w = width().length();
-
- w+= (right_off.x - left_off.x) * nw_f ;
- Real round_w = w; // slur lookup rounds the slurwidth .
-
- Symbol sl = paper()->lookup_l()->slur(dy , round_w, dir_i_);
-
- Real error = w-round_w;
-
- Atom a(sl);
- a.translate(Offset((left_off.x + 0.5 )*nw_f + error/2,
- left_off.y * nh_f));
- output->add(a);
- return output;
-}
-
IMPLEMENT_STATIC_NAME(Slur);