]> git.donarmstrong.com Git - lilypond.git/blob - lily/staff-sym-reg.cc
release: 0.0.63
[lilypond.git] / lily / staff-sym-reg.cc
1 /*
2   staff-sym-reg.cc -- implement Staff_sym_register
3
4   source file of the LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "staff-sym-reg.hh"
10 #include "staff-sym.hh"
11 #include "score.hh"
12 #include "p-col.hh"
13
14 const NO_LINES = 5;
15
16 Staff_sym_register::Staff_sym_register()
17 {
18    span_p_ = 0;
19    last_mom_ =0;
20 }
21
22 void
23 Staff_sym_register::post_move_processing()
24 {
25     if (!span_p_ && !last_mom_) {
26         span_p_= new Staff_symbol(NO_LINES);
27         span_p_->left_col_l_ =
28             get_staff_info().command_pcol_l()->postbreak_p_; // ugh
29     }
30     if (!last_mom_) {
31         last_mom_ = get_staff_info().score_l()->last();
32     }
33 }
34
35 void
36 Staff_sym_register::process_requests()
37 {
38     announce_element(Staff_elem_info(span_p_, 0));
39 }
40
41 void
42 Staff_sym_register::pre_move_processing()
43 {
44     Staff_info i=get_staff_info();
45     if ( span_p_ && i.when() == last_mom_) {
46         span_p_->right_col_l_ = i.command_pcol_l()->prebreak_p_;
47         typeset_element(span_p_);
48         span_p_ =0;
49     }
50 }
51
52 IMPLEMENT_STATIC_NAME(Staff_sym_register);
53 ADD_THIS_REGISTER(Staff_sym_register);
54 Staff_sym_register::~Staff_sym_register()
55 {
56     assert(!span_p_);
57     delete span_p_;
58 }