lilypond-0.1.16
[lilypond.git] / lily / staff-walker.cc
blobb83c527168a9ed0b511204fb5d71e4274ca18b2f
1 /*
2 staff-walker.cc -- implement Staff_walker
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
9 #include "proto.hh"
10 #include "plist.hh"
11 #include "grouping.hh"
12 #include "staff.hh"
13 #include "musical-request.hh"
14 #include "staff-walker.hh"
15 #include "staff-column.hh"
16 #include "score-column.hh"
17 #include "debug.hh"
18 #include "time-description.hh"
19 #include "command-request.hh"
20 #include "grouping.hh"
21 #include "score-walker.hh"
23 Staff_walker::~Staff_walker()
25 do_pre_move();
28 Staff_walker::Staff_walker(Staff_walker const &s)
29 :PCursor<Staff_column*> (s)
31 assert(false);
34 Staff_walker::Staff_walker(Staff * s, PScore*ps )
35 : PCursor<Staff_column*> (s->cols_)
37 staff_l_ = s;
38 pscore_l_ = ps;
40 // should be in tdes. TODO
41 default_grouping = new Rhythmic_grouping(MInterval(0, 1), 4);
42 score_walk_l_ = 0;
45 Moment
46 Staff_walker::when() const
48 return ptr()->when();
51 void
52 Staff_walker::process_timing_reqs()
54 ptr()->update_time(time_, default_grouping);
57 void
58 Staff_walker::operator++(int i)
60 Moment last = when();
62 do_pre_move();
63 PCursor<Staff_column*>::operator++(i);
64 if (ok() ) {
65 Moment delta_t = when() - last;
66 assert(delta_t >Moment(0));
67 time_.add( delta_t );
69 do_post_move();
72 void
73 Staff_walker::process()
75 process_timing_reqs();
76 process_requests();
79 void
80 Staff_walker::allow_break()
82 score_walk_l_->allow_break(this);