1 #include "local-key-item.hh"
5 #include "paper-def.hh"
6 #include "musicalrequest.hh"
12 Local_key_item::Local_key_item(int i
)
18 Local_key_item::add(Item
*head_l
)
20 support_items_
.push(head_l
);
21 add_dependency(head_l
);
25 Local_key_item::add(Melodic_req
*m_l
)
27 add(m_l
->octave_i_
, m_l
->notename_i_
, m_l
->accidental_i_
);
30 Local_key_item::add (int o
, int p
, int a
)
40 Local_key_item::do_pre_processing()
42 accs
.sort(Local_acc::compare
);
46 Local_key_item::brew_molecule_p()const
48 Molecule
* output
= new Molecule
;
51 for (int i
= 0; i
< accs
.size(); i
++) {
53 if (accs
[i
].octave
!= lastoct
) {
55 Real dy
=lastoct
*7*paper()->internote();
56 octmol
->translate(Offset(0, dy
));
62 lastoct
= accs
[i
].octave
;
63 Symbol s
=paper()->lookup_p_
->accidental(accs
[i
].acc
);
65 Real dy
= (accs
[i
].name
+ c0_position
) * paper()->internote();
66 a
.translate(Offset(0,dy
));
72 Real dy
=lastoct
*7*paper()->internote();
73 octmol
->translate(Offset(0, dy
));
78 Interval head_width
=itemlist_width(support_items_
);
79 output
->translate(Offset(-output
->extent().x
.right
+ head_width
.left
,0));
85 Local_acc::compare(Local_acc
&a
, Local_acc
&b
)
87 if (a
.octave
- b
.octave
)
88 return a
.octave
- b
.octave
;
90 return a
.name
- b
.name
;