5 #include "paper-def.hh"
7 //#include "clef-reg.hh"
10 const int FLAT_TOP_PITCH=2; /* fes,ges,as and bes typeset in lower octave */
11 const int SHARP_TOP_PITCH=4; /* ais and bis typeset in lower octave */
15 Key_item::Key_item(int c)
21 Key_item::read(Key_register const & key_reg_r)
23 assert(!key_reg_r.key_.multi_octave_b_);
24 const Array<int> &idx_arr =key_reg_r.accidental_idx_arr_;
25 for (int i = 0 ; i< idx_arr.size(); i++) {
26 int note = idx_arr[i];
27 int acc = ((Key &) key_reg_r.key_).oct(0).acc(note);
34 Key_item::set_c_position(int c0)
36 int octaves =(abs(c0) / 7) +1 ;
37 c_position=(c0 + 7*octaves)%7;
42 Key_item::add(int p, int a)
44 if ((a<0 && p>FLAT_TOP_PITCH) ||
45 (a>0 && p>SHARP_TOP_PITCH)) {
46 p -= 7; /* Typeset below c_position */
54 Key_item::brew_molecule_p()const
56 Molecule*output = new Molecule;
57 Real inter = paper()->internote();
59 for (int i =0; i < pitch.size(); i++) {
60 Symbol s= paper()->lookup_l()->accidental(acc[i]);
62 a.translate(Offset(0,(c_position + pitch[i]) * inter));
66 Molecule m(paper()->lookup_l()->fill(Box(
67 Interval(0, paper()->note_width()),
72 IMPLEMENT_STATIC_NAME(Key_item);