]> git.donarmstrong.com Git - lilypond.git/blob - lily/grace-engraver-group.cc
patch::: 1.3.108.jcn5
[lilypond.git] / lily / grace-engraver-group.cc
1 /*   
2   grace-engraver-group.cc -- implement Grace_engraver_group
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #include "grace-engraver-group.hh"
11 #include "lily-guile.hh"
12 #include "score-element.hh"
13 #include "musical-request.hh"
14 #include "warn.hh"
15
16 void
17 Grace_engraver_group::start ()
18 {
19 }
20 /*
21   We're really finished with this context. Get rid of everything.
22  */
23 void
24 Grace_engraver_group::finish ()
25 {
26   calling_self_b_ = true;
27   removal_processing ();        // ugr. We'd want to have this done by our parents.
28   for (int i=0; i < announce_to_top_.size (); i++)
29     {
30       Engraver::announce_element (announce_to_top_[i]);
31     }
32
33   for (int i=0; i < typeset_us_.size (); i++)
34     {
35       Engraver::typeset_element (typeset_us_[i]);
36     }
37   typeset_us_.clear ();
38   calling_self_b_ = false;
39 }
40
41 void
42 Grace_engraver_group::do_removal_processing ()
43 {
44   Engraver_group_engraver::do_removal_processing ();
45 }
46
47 void
48 Grace_engraver_group::announce_element (Score_element_info inf)
49 {
50   announce_info_arr_.push (inf);
51   // do not propagate to top
52   announce_to_top_.push (inf);
53
54   inf.elem_l_->set_elt_property ("grace", SCM_BOOL_T);
55 }
56
57 void
58 Grace_engraver_group::typeset_element (Score_element*e)
59 {
60   if (!e)
61     programming_error ("Grace_engraver_group: empty elt\n");
62   else
63
64   typeset_us_.push (e);
65 }
66
67
68 Grace_engraver_group::Grace_engraver_group()
69 {
70   calling_self_b_ = false;
71 }
72
73 void
74 Grace_engraver_group::process ()
75 {
76   calling_self_b_  = true;
77   
78   //process_music (); -- used to do implicit creation processing ()
79   // possibly post_move_processing ()?
80   do_creation_processing ();
81   post_move_processing ();
82
83   
84   announces();
85   pre_move_processing();
86   check_removal();
87   calling_self_b_ = false;
88 }
89
90
91 void
92 Grace_engraver_group::each (Method_pointer method)
93 {
94   if (calling_self_b_)
95     Engraver_group_engraver::each (method);
96 }
97
98
99 ADD_THIS_TRANSLATOR(Grace_engraver_group);
100
101
102 /*
103   don't let the commands trickle up.
104  */
105 bool
106 Grace_engraver_group::do_try_music (Music *m)
107 {
108   bool hebbes_b = try_music_on_nongroup_children (m);
109
110   if (!hebbes_b && pass_to_top_b (m))
111     {
112       hebbes_b = daddy_trans_l_->try_music (m);
113     }
114
115   return hebbes_b;
116 }
117
118 bool
119 Grace_engraver_group::pass_to_top_b (Music *m) const
120 {
121   if (Span_req * sp = dynamic_cast<Span_req*> (m))
122     {
123       if (scm_equal_p (sp->get_mus_property ("span-type"), ly_str02scm ("slur"))
124           == SCM_BOOL_T)
125         //      return true;
126         return false;
127     }
128   return false;
129 }
130