2 duration-convert.cc -- implement Duration_convert
4 source file of the LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "duration-convert.hh"
12 #include "duration-iter.hh"
14 Duration_iterator::Duration_iterator ()
16 cursor_dur_.durlog_i_ = 7;
17 if (Duration_convert::no_smaller_than_i_s)
18 cursor_dur_.durlog_i_ = Duration_convert::no_smaller_than_i_s;
22 Duration_iterator::operator ++(int)
24 return forward_dur ();
28 Duration_iterator::dur ()
34 Duration_iterator::forward_dur ()
36 /* should do smart table? guessing:
50 Duration dur = this->dur ();
52 if (!cursor_dur_.dots_i_ && !cursor_dur_.plet_b ())
54 cursor_dur_.durlog_i_ += 1;
55 cursor_dur_.dots_i_ = 2;
57 else if (cursor_dur_.dots_i_ == 2)
59 assert (!cursor_dur_.plet_b ());
60 cursor_dur_.dots_i_ = 0;
61 cursor_dur_.durlog_i_ -=2;
62 cursor_dur_.set_plet (2, 3);
64 else if (cursor_dur_.plet_b ()
65 && (cursor_dur_.plet_.iso_i_ == 2)
66 && (cursor_dur_.plet_.type_i_ == 3))
68 assert (!cursor_dur_.dots_i_);
69 cursor_dur_.set_plet (1, 1);
70 cursor_dur_.durlog_i_ += 1;
71 cursor_dur_.dots_i_ = 1;
73 else if (cursor_dur_.dots_i_ == 1)
75 assert (!cursor_dur_.plet_b ());
76 cursor_dur_.dots_i_ = 0;
77 cursor_dur_.durlog_i_ -= 1;
80 if (Duration_convert::no_tuplets_b_s
81 && cursor_dur_.plet_b () && ok ())
83 if (Duration_convert::no_double_dots_b_s
84 && (cursor_dur_.dots_i_ == 2) && ok ())
86 if (Duration_convert::no_smaller_than_i_s
87 && (cursor_dur_.durlog_i_ > Duration_convert::no_smaller_than_i_s) && ok ())
89 if (Duration_convert::no_smaller_than_i_s
90 && cursor_dur_.dots_i_
91 && (cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s)
94 if (Duration_convert::no_smaller_than_i_s
95 && (cursor_dur_.dots_i_ == 2)
96 && (cursor_dur_.durlog_i_ >= Duration_convert::no_smaller_than_i_s / 2)
104 Duration_iterator::ok ()
106 return cursor_dur_.length_mom () <= Rational (4);