]> git.donarmstrong.com Git - lilypond.git/blob - lily/input-staff.cc
release: 0.0.42.pre3
[lilypond.git] / lily / input-staff.cc
1 /*
2   input-staff.cc -- implement Input_staff
3
4   source file of the LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "debug.hh"
10 #include "score.hh"
11 #include "input-music.hh"
12 #include "input-staff.hh"
13 #include "staff.hh"
14 #include "complex-staff.hh"
15 #include "lyric-staff.hh"
16
17 #include "lexer.hh"
18
19
20 Input_staff::Input_staff(String s)
21 {
22     type= s;
23     defined_ch_c_l_ = 0;
24 }
25
26 void
27 Input_staff::add(Input_music*m)
28 {
29     music_.bottom().add(m);
30 }
31
32 Staff*
33 Input_staff::parse(Score*score_l)
34 {
35     Staff *p=0;
36     if (type == "melodic")
37         p = new Complex_staff;
38     else if (type == "lyric")
39         p = new Lyric_staff;
40     else {
41         error( "Unknown staff-type `" + type +"\'", defined_ch_c_l_ );
42         exit( 1 );
43     }
44
45     p->score_l_ = score_l;
46     
47     for (iter_top(music_,i); i.ok(); i++) {
48         Voice_list vl = i->convert();
49         p->add(vl);
50     }
51     return p;
52 }
53
54 Input_staff::Input_staff(Input_staff const&s)
55 {    
56     for (iter_top(s.music_,i); i.ok(); i++)
57         add(i->clone());
58     defined_ch_c_l_ = s.defined_ch_c_l_;
59     type = s.type;
60 }
61
62 void
63 Input_staff::print() const
64 {
65 #ifndef NPRINT
66     mtor << "Input_staff {\n";
67     for (iter_top(music_,i); i.ok(); i++)
68         i->print();
69     mtor << "}\n";
70 #endif
71 }
72 Input_staff::~Input_staff()
73 {
74 }