2 localkeyreg.cc -- implement Local_key_register
4 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
6 #include "musicalrequest.hh"
7 #include "commandrequest.hh"
8 #include "localkeyreg.hh"
9 #include "localkeyitem.hh"
10 #include "complexwalker.hh"
14 Local_key_register::Local_key_register(Complex_walker
*w
)
22 Local_key_register::do_pre_move_process()
25 walk_l_
->typeset_element(key_item_p_
);
30 Local_key_register::acknowledge_element(Staff_elem_info info
)
32 if (info
.req_l_
->melodic()) {
33 Melodic_req
* melodic_l_
= info
.req_l_
->melodic();
35 if( melodic_l_
->forceacc_b_
||
36 local_key_
.oct(melodic_l_
->octave_i_
).acc(melodic_l_
->notename_i_
)
37 != melodic_l_
->accidental_i_
) {
38 Item
* support_l_
= info
.elem_p_
->item();
42 key_item_p_
= new Local_key_item(walk_l_
->c0_position_i());
45 key_item_p_
->add(melodic_l_
);
46 key_item_p_
->add(support_l_
);
47 local_key_
.oct(melodic_l_
->octave_i_
)
48 .set(melodic_l_
->notename_i_
, melodic_l_
->accidental_i_
);
50 } else if (info
.req_l_
->command() &&
51 info
.req_l_
->command()->keychange()) {
52 Key_register
* key_reg_l
= (Key_register
*)info
.origin_reg_l_
;
53 key_c_l_
= &key_reg_l
->key_
;
54 local_key_
.reset(*key_c_l_
);
59 Local_key_register::process_request()
61 if (!walk_l_
->time_
.whole_in_measure_
) {
63 local_key_
.reset(*key_c_l_
);
64 else if( walk_l_
->when() >0)
65 warning ("Help me! can't figure current key", 0);