5 #include "staff-elem.hh"
9 Staff_elem::TeXstring() const
12 m
.translate(offset_
); // ugh?
16 Staff_elem::Staff_elem(Staff_elem
const&s
)
17 : dependants(s
.dependants
),
18 dependencies(s
.dependencies
)
23 pstaff_l_
= s
.pstaff_l_
;
24 offset_
= Offset(0,0);
28 If deleted, then remove dependants depency!
30 Staff_elem::~Staff_elem()
36 Staff_elem::translate(Offset O
)
41 Staff_elem::width() const
46 Molecule
*m
= brew_molecule_p();
50 r
= output
->extent().x
;
52 if (!r
.empty()) // float exception on DEC Alpha
58 Staff_elem::height() const
63 Molecule
*m
= brew_molecule_p();
67 r
= output
->extent().y
;
77 Staff_elem::print()const
80 mtor
<< name() << "{\n";
91 Staff_elem::Staff_elem()
94 offset_
= Offset(0,0);
101 Staff_elem::paper() const
104 return pstaff_l_
->pscore_l_
->paper_l_
;
108 Staff_elem::add_processing()
110 if (status
>= VIRGIN
)
117 Staff_elem::pre_processing()
119 if (status
>= PRECALCED
)
121 assert(status
!= PRECALCING
); // cyclic dependency
124 for (int i
=0; i
< dependencies
.size(); i
++)
126 dependencies
[i
]->pre_processing();
133 Staff_elem::post_processing()
135 if (status
>= POSTCALCED
)
137 assert(status
!= POSTCALCING
);// cyclic dependency
140 for (int i
=0; i
< dependencies
.size(); i
++)
142 dependencies
[i
]->post_processing();
143 do_post_processing();
148 Staff_elem::molecule_processing()
150 if (status
>= OUTPUT
)
152 status
= OUTPUT
; // do it only once.
153 for (int i
=0; i
< dependencies
.size(); i
++)
155 dependencies
[i
]->molecule_processing();
157 output
= brew_molecule_p();
161 Staff_elem::do_post_processing()
166 Staff_elem::do_pre_processing()
171 Staff_elem::do_add_processing()
176 Staff_elem::substitute_dependency(Staff_elem
* old
, Staff_elem
* newdep
)
179 for (int i
=0; i
< dependencies
.size(); i
++) {
180 if (dependencies
[i
] == old
){
181 dependencies
[i
] = newdep
;
183 } else if (dependencies
[i
] == newdep
) {
188 dependencies
.push(newdep
);
192 Staff_elem::add_dependency(Staff_elem
* p
)
194 for (int i
=0; i
< dependencies
.size(); i
++)
195 if (dependencies
[i
] == p
)
198 dependencies
.push(p
);
199 p
->dependants
.push(p
);