summaryrefslogtreecommitdiff
path: root/lily/staff-sym-reg.cc
blob: 34a53a552ba96d582e5cceb239e508595d59a786 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
  staff-sym-reg.cc -- implement Staff_sym_register

  source file of the LilyPond music typesetter

  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/

#include "staff-sym-reg.hh"
#include "staff-sym.hh"
#include "score.hh"
#include "p-col.hh"

const NO_LINES = 5;

Staff_sym_register::Staff_sym_register()
{
   span_p_ = 0;
   last_mom_ =0;
}

void
Staff_sym_register::post_move_processing()
{
    if (!span_p_ && !last_mom_) {
	span_p_= new Staff_symbol(NO_LINES);
	span_p_->left_col_l_ =
	    get_staff_info().command_pcol_l()->postbreak_p_; // GUH
    }
    if (!last_mom_) {
	last_mom_ = get_staff_info().score_l()->last();
    }
}


void
Staff_sym_register::pre_move_processing()
{
    Staff_info i=get_staff_info();
    if ( span_p_ && i.when() == last_mom_) {
	span_p_->right_col_l_ = i.command_pcol_l()->prebreak_p_;
	typeset_element(span_p_);
	span_p_ =0;
    }
}

IMPLEMENT_STATIC_NAME(Staff_sym_register);
ADD_THIS_REGISTER(Staff_sym_register);
Staff_sym_register::~Staff_sym_register()
{
    assert(!span_p_);
    delete span_p_;
}