2 complexcolumn.cc -- implement Complex_column
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
10 #include "complexcolumn.hh"
15 #include "complexstaff.hh"
19 Complex_column::typeset_musical_item(Item
*i
)
22 Score_column
* sccol_l
= musical_column_l_
;
23 staff_l_
->pscore_l_
->typeset_item(i
, sccol_l
->pcol_l_
,
27 Complex_column::Complex_column(Complex_staff
*staff_l
)
33 Complex_column::setup_one_request(Request
* j
)
35 if (j
->nonmus()) // ugh
37 else if (j
->musical())
38 second_l_arr_
.push(j
);
42 align items in #item_l_arr#, return the width.
45 align_items(Array
<Item
*> item_l_arr
)
48 for (int i
=0; i
< item_l_arr
.size(); i
++) {
49 Interval item_width
= item_l_arr
[i
]->width();
50 item_l_arr
[i
]->translate(Offset( wid
.right
- item_width
.left
,0));
51 wid
.unite(item_width
);
57 translate_items(Real x
, Array
<Item
*> item_l_arr
)
59 for (int i
=0; i
< item_l_arr
.size(); i
++)
60 item_l_arr
[i
]->translate(Offset(x
, 0));
67 Complex_column::typeset_breakable_items(Array
<Item
*> &pre_p_arr
,
68 Array
<Item
*> &nobreak_p_arr
,
69 Array
<Item
*> &post_p_arr
)
71 PCol
* c
= command_column_l_
->pcol_l_
;
72 PScore
*ps_l
=staff_l_
->pscore_l_
;
73 if (!c
->breakable_b()) {
74 for (int i
=0; i
< pre_p_arr
.size(); i
++)
76 pre_p_arr
.set_size(0);
77 for (int i
=0; i
< post_p_arr
.size(); i
++)
79 post_p_arr
.set_size(0);
83 for (int i
=0; i
< pre_p_arr
.size(); i
++) {
84 ps_l
->typeset_item(pre_p_arr
[i
], c
, staff_l_
->pstaff_l_
,0);
86 for (int i
=0; i
< nobreak_p_arr
.size(); i
++) {
87 ps_l
->typeset_item(nobreak_p_arr
[i
], c
, staff_l_
->pstaff_l_
,1);
89 for (int i
=0; i
< post_p_arr
.size(); i
++) {
90 ps_l
->typeset_item(post_p_arr
[i
], c
, staff_l_
->pstaff_l_
,2);
93 Interval pre_wid
= align_items(pre_p_arr
);
94 translate_items( -pre_wid
.right
, pre_p_arr
);
95 align_items(nobreak_p_arr
);
96 Interval post_wid
=align_items(post_p_arr
);
97 translate_items (-post_wid
.left
, post_p_arr
);
99 pre_p_arr
.set_size(0);
100 post_p_arr
.set_size(0);
101 nobreak_p_arr
.set_size(0);