2 note-column-reg.cc -- implement Note_column_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
9 #include "note-column-grav.hh"
10 #include "note-head.hh"
12 #include "note-column.hh"
14 #include "rest-column.hh"
17 Note_column_engraver::acceptable_elem_b (Score_elem
const*elem_C
) const
19 char const*nC
= elem_C
->name();
20 return (nC
== Script::static_name() || nC
== Note_head::static_name ()
21 || nC
== Stem::static_name());
24 Note_column_engraver::note_col_l()
28 ncol_p_
= new Note_column
;
29 announce_element (Score_elem_info (ncol_p_
, 0));
35 Note_column_engraver::rest_col_l()
39 restcol_p_
= new Rest_column
;
40 announce_element (Score_elem_info (restcol_p_
,0));
46 Note_column_engraver::acknowledge_element (Score_elem_info i
)
48 if (!acceptable_elem_b (i
.elem_l_
))
52 char const*nC
= i
.elem_l_
->name();
54 if (nC
== Script::static_name() && i
.req_l_
&& i
.req_l_
->musical ())
56 script_l_arr_
.push ((Script
*)i
.elem_l_
->item());
58 else if (nC
== Note_head::static_name())
60 Note_head
* h_l
= (Note_head
*)i
.elem_l_
->item();
62 rest_col_l()->add (h_l
);
64 note_col_l()->add (h_l
);
67 else if (nC
== Stem::static_name())
69 stem_l_
= (Stem
*)i
.elem_l_
->item();
72 if (ncol_p_
|| restcol_p_
)
76 if (restcol_p_
&& !restcol_p_
->stem_l_
)
77 restcol_p_
->set (stem_l_
);
78 if (ncol_p_
&& !ncol_p_
->stem_l_
)
79 ncol_p_
->set (stem_l_
);
83 for (int i
=0; i
< script_l_arr_
.size(); i
++)
86 restcol_p_
->add (script_l_arr_
[i
]);
88 ncol_p_
->add (script_l_arr_
[i
]);
91 script_l_arr_
.clear();
97 Note_column_engraver::do_pre_move_processing()
101 if (! ncol_p_
->h_shift_b_
)
102 ncol_p_
->h_shift_b_
= h_shift_b_
;
104 ncol_p_
->dir_
= dir_
;
106 typeset_element (ncol_p_
);
111 if (! restcol_p_
->dir_
)
112 restcol_p_
->dir_
= dir_
;
114 typeset_element (restcol_p_
);
120 Note_column_engraver::do_post_move_processing()
122 script_l_arr_
.clear();
127 Note_column_engraver::set_feature (Feature i
)
129 if (i
.type_
== "vdir")
130 dir_
= (Direction
) int(i
.value_
);
131 if (i
.type_
== "hshift")
132 h_shift_b_
= (bool)(int)i
.value_
;
135 Note_column_engraver::Note_column_engraver()
142 do_post_move_processing();
146 IMPLEMENT_IS_TYPE_B1(Note_column_engraver
,Engraver
);
147 ADD_THIS_ENGRAVER(Note_column_engraver
);