]> git.donarmstrong.com Git - lilypond.git/blob - lily/command-request.cc
partial: 1.3.107.jcn
[lilypond.git] / lily / command-request.cc
1 /*
2   command-request.cc -- implement non-musical reqs
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "command-request.hh"
10 #include "debug.hh"
11 #include "musical-request.hh"
12
13
14 Bar_req::Bar_req (String s)
15 {
16   set_mus_property ("type", ly_str02scm (s.ch_C()));
17 }
18
19 bool
20 Barcheck_req::do_equal_b (Request const *r) const
21 {
22   Barcheck_req  const*b = dynamic_cast<Barcheck_req const*> (r);
23   return b;
24 }
25
26
27 Clef_change_req::Clef_change_req ()
28 {
29
30 }
31
32
33 bool
34 Time_signature_change_req::do_equal_b (Request const *r) const
35 {
36   Time_signature_change_req  const* m
37     = dynamic_cast <Time_signature_change_req  const*> (r);
38
39 #if 0
40   return m && m->beats_i_ == beats_i_
41     && one_beat_i_ == m->one_beat_i_;
42 #endif
43   return m;
44 }
45
46 Time_signature_change_req::Time_signature_change_req ()
47 {
48 }
49
50
51 Tempo_req::Tempo_req ()
52 {
53   dur_. durlog_i_ = 2;
54 }
55
56
57
58 bool
59 Tempo_req::do_equal_b (Request const *r) const
60 {
61   Tempo_req const *t = dynamic_cast <Tempo_req const*> (r);
62
63   return t&& t->dur_.length_mom ()== dur_.length_mom ();
64   // && metronome_i_ == t->metronome_i_;
65 }
66
67
68
69
70 bool
71 Key_change_req::do_equal_b (Request const * req) const
72 {
73   Key_change_req const * k = dynamic_cast<Key_change_req const*> (req);
74   return k && scm_equal_p (get_mus_property ("pitch-alist"), k->get_mus_property ("pitch-alist"));
75 }
76
77
78 void
79 Key_change_req::transpose (Musical_pitch p)
80 {
81   SCM newlist = SCM_EOL;
82   SCM pa = get_mus_property ("pitch-alist");
83   for (SCM s = pa; gh_pair_p (s); s = gh_cdr (s))
84     {
85       SCM k = gh_caar (s);
86
87       if (gh_pair_p (k))
88         {
89           Musical_pitch orig (gh_list (gh_car (k), gh_cdr (k), gh_cdr (s), SCM_UNDEFINED));
90
91           orig.transpose (p);
92
93           SCM key = gh_cons (gh_int2scm (orig.octave_i_),
94                              gh_int2scm (orig.notename_i_));
95
96           newlist = gh_cons (gh_cons (key, gh_int2scm (orig.accidental_i_)),
97                              newlist);
98         }
99       else if (gh_number_p (k))
100         {
101           Musical_pitch orig (gh_list (gh_int2scm (0), k, gh_cdar (s), SCM_UNDEFINED));
102           orig.transpose (p);
103
104           SCM key =gh_int2scm (orig.notename_i_);
105           newlist = gh_cons (gh_cons (key, gh_int2scm (orig.accidental_i_)),
106                              newlist);
107         }
108     }
109
110   set_mus_property ("pitch-alist", newlist);
111 }
112
113 Break_req::Break_req ()
114 {
115 }
116
117
118 bool
119 Mark_req::do_equal_b (Request const * r) const
120 {
121   Mark_req const * other = dynamic_cast<Mark_req const*> (r);
122   return other && scm_equal_p (other->get_mus_property ("mark-label"),
123                                get_mus_property ("mark-label"));
124 }