lilypond-1.3.67
[lilypond.git] / lily / auto-plet-engraver.cc
blobc97be06723cb3731d13be58362a517f20f549b92
1 /*
2 auto-plet-engraver.cc -- implement Auto_plet_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
8 */
10 #include "auto-plet-engraver.hh"
11 #include "command-request.hh"
12 #include "plet-spanner.hh"
13 #include "note-column.hh"
15 bool
16 Tuplet_engraver::do_try_request (Request *r)
18 if (Bracket_req * b = dynamic_cast <Bracket_req *> (r))
20 bracket_req_arr_.push (b);
21 return true;
23 return false;
26 void
27 Tuplet_engraver::do_process_requests ()
29 int stopcount =0;
30 Link_array<Plet_spanner> start_arr;
32 for (int i=0; i < bracket_req_arr_.size (); i++)
34 if (bracket_req_arr_[i]->spantype == Span_req::STOP)
35 stopcount++;
36 if (bracket_req_arr_[i]->spantype == Span_req::START)
38 Plet_spanner* glep = new Plet_spanner ();
39 start_arr.push (glep);
40 // lots of stuff does info->elem_l_->is_type ()
41 // announce_element (Score_element_info (glep, bracket_req_arr_[i]));
45 for (; stopcount--; )
47 Plet_spanner* glep = started_span_p_arr_.pop ();
48 stop_now_span_p_arr_.push (glep);
51 for (int i=0; i < start_arr.size (); i++)
52 started_span_p_arr_.push (start_arr.pop ());
55 void
56 Tuplet_engraver::acknowledge_element (Score_element_info i)
58 if (Note_column *nc = dynamic_cast<Note_column *> (i.elem_l_))
61 for (int j =0; j <started_span_p_arr_.size (); j++)
62 // started_span_p_arr_[j]->add_column (nc);
67 void
68 Tuplet_engraver::do_pre_move_processing ()
70 typeset_all ();
73 void
74 Tuplet_engraver::typeset_all ()
76 for (int i=0; i < stop_now_span_p_arr_.size (); i++)
78 typeset_element (stop_now_span_p_arr_[i]);
81 stop_now_span_p_arr_.clear ();
84 void
85 Tuplet_engraver::do_removal_processing ()
87 typeset_all ();
88 for (int i=0; i < started_span_p_arr_.size (); i++)
90 typeset_element (started_span_p_arr_[i]);
94 ADD_THIS_TRANSLATOR(Tuplet_engraver);
95 IMPLEMENT_IS_TYPE_B1(Tuplet_engraver, Engraver);
97 Tuplet_engraver::Tuplet_engraver()
102 void
103 Tuplet_engraver::do_post_move_processing ()
105 bracket_req_arr_.clear ();