2
rest-grav.cc -- implement Rest_engraver
2
rest-engraver.cc -- implement Rest_engraver
4
4
source file of the GNU LilyPond music typesetter
6
(c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
6
(c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
11
#include "duration.hh"
9
13
#include "staff-symbol-referencer.hh"
12
15
#include "rhythmic-head.hh"
13
#include "engraver.hh"
16
18
class Rest_engraver : public Engraver
22
24
virtual bool try_music (Music *);
23
virtual void stop_translation_timestep ();
24
virtual void start_translation_timestep ();
25
virtual void process_music ();
25
void start_translation_timestep ();
26
void process_music ();
28
29
TRANSLATOR_DECLARATIONS (Rest_engraver);
33
33
Should merge with Note_head_engraver
35
35
Rest_engraver::Rest_engraver ()
43
43
Rest_engraver::start_translation_timestep ()
49
Rest_engraver::stop_translation_timestep ()
64
51
Rest_engraver::process_music ()
66
if (rest_req_ && !rest_)
53
if (rest_event_ && !rest_)
68
rest_ = make_item ("Rest");
70
int durlog = unsmob_duration (rest_req_->get_property ("duration"))-> duration_log ();
55
rest_ = make_item ("Rest", rest_event_->self_scm ());
57
int durlog = unsmob_duration (rest_event_->get_property ("duration"))->duration_log ();
72
59
rest_->set_property ("duration-log",
75
int dots =unsmob_duration (rest_req_->get_property ("duration"))->dot_count ();
60
scm_from_int (durlog));
62
int dots = unsmob_duration (rest_event_->get_property ("duration"))->dot_count ();
79
dot_ = make_item ("Dots");
66
dot_ = make_item ("Dots", SCM_EOL);
81
68
Rhythmic_head::set_dots (rest_, dot_);
82
69
dot_->set_parent (rest_, Y_AXIS);
83
dot_->set_property ("dot-count", gh_int2scm (dots));
84
announce_grob (dot_, SCM_EOL);
70
dot_->set_property ("dot-count", scm_from_int (dots));
87
Pitch *p = unsmob_pitch (rest_req_->get_property ("pitch"));
73
Pitch *p = unsmob_pitch (rest_event_->get_property ("pitch"));
90
76
This is ridiculous -- rests don't have pitch, but we act as if
91
77
our nose is bleeding.
81
int pos = p->steps ();
96
82
SCM c0 = get_property ("middleCPosition");
98
pos += gh_scm2int (c0);
100
rest_->set_property ("staff-position", gh_int2scm (pos));
83
if (scm_is_number (c0))
84
pos += scm_to_int (c0);
86
rest_->set_property ("staff-position", scm_from_int (pos));
103
announce_grob (rest_, rest_req_->self_scm ());
110
94
if (m->is_mus_type ("rest-event"))
118
ENTER_DESCRIPTION (Rest_engraver,
120
/* creats*/ "Rest Dots",
121
/* accepts */ "rest-event",
123
/* reads */ "middleCPosition",
102
#include "translator.icc"
104
ADD_TRANSLATOR (Rest_engraver,
106
/* create */ "Rest Dots",
107
/* accept */ "rest-event",
108
/* read */ "middleCPosition",