From 72fcbbabea8cc95e35110a5d2cde8bd8bf7b31a3 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:32:01 +0000 Subject: [PATCH] lilypond-0.0.32 --- src/inputscore.cc | 57 +++++++++++++++++++++++++++------------------- src/inputstaff.cc | 58 +++++++++++++++++------------------------------ 2 files changed, 55 insertions(+), 60 deletions(-) diff --git a/src/inputscore.cc b/src/inputscore.cc index 764c8e8509..a8a653982c 100644 --- a/src/inputscore.cc +++ b/src/inputscore.cc @@ -1,18 +1,19 @@ +/* + inputscore.cc -- implement Input_score + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + #include "debug.hh" -#include "inputcommand.hh" #include "inputscore.hh" #include "inputstaff.hh" +#include "inputmusic.hh" #include "score.hh" #include "paperdef.hh" #include "staff.hh" -void -Input_score::add(Array &s) -{ - commands_.bottom().add(get_reset_command()); - for (int i=0; i < s.size(); i++) - commands_.bottom().add(s[i]); -} void Input_score::add(Input_staff*s) @@ -23,51 +24,61 @@ Input_score::add(Input_staff*s) void Input_score::set(Paperdef*p) { - delete paper_; - paper_ = p; + delete paper_p_; + paper_p_ = p; } -Input_score::Input_score(Input_score const&) +Input_score::Input_score(Input_score const&s) { - assert(false); + paper_p_ = (s.paper_p_)? new Paperdef(*s.paper_p_) :0; + defined_ch_c_l_ = s.defined_ch_c_l_; + errorlevel_i_ = s.errorlevel_i_; + score_wide_music_p_ = (s.score_wide_music_p_) ? + s.score_wide_music_p_->clone():0; } Score* Input_score::parse() { - Paperdef* paper_p=new Paperdef(*paper_); + Paperdef* paper_p=new Paperdef(*paper_p_); Score *s_p = new Score(paper_p); s_p->defined_ch_c_l_= defined_ch_c_l_; s_p->errorlevel_i_ = errorlevel_i_; - Array parsed_staffs; + for (iter_top(staffs_,i); i.ok(); i++) { - Staff* staf_p=i->parse(s_p); - parsed_staffs.push(staf_p); + Staff* staf_p=i->parse(s_p, score_wide_music_p_); s_p->add(staf_p); } - int j = 0; - for (iter_top(staffs_,i); i.ok(); i++,j++) { - parsed_staffs[j]->do_commands(commands_, i->commands_); - } + return s_p; } +void +Input_score::set(Input_music *m_p) +{ + delete score_wide_music_p_; + score_wide_music_p_ =m_p; +} + + Input_score::~Input_score() { - delete paper_; + delete paper_p_; + delete score_wide_music_p_; } Input_score::Input_score() { + score_wide_music_p_ =0; defined_ch_c_l_=0; - paper_= 0; + paper_p_= 0; errorlevel_i_ = 0; } void Input_score::print()const { - #ifndef NPRINT +#ifndef NPRINT mtor << "Input_score {\n"; for (iter_top(staffs_,i); i.ok(); i++) { i->print(); diff --git a/src/inputstaff.cc b/src/inputstaff.cc index d79aac1021..116624574c 100644 --- a/src/inputstaff.cc +++ b/src/inputstaff.cc @@ -1,26 +1,16 @@ -#include "getcommand.hh" #include "debug.hh" #include "score.hh" #include "inputmusic.hh" #include "inputstaff.hh" -#include "inputcommand.hh" -#include "staffcommands.hh" #include "staff.hh" #include "complexstaff.hh" #include "lexer.hh" #include "lyricstaff.hh" -void -Input_staff::add(Array &s) -{ - commands_.bottom().add(get_reset_command()); - for (int i=0; i < s.size(); i++) - commands_.bottom().add(s[i]); - s.set_size(0); -} Input_staff::Input_staff(String s) { + score_wide_music_p_ =0; type= s; defined_ch_c_l_ = 0; } @@ -32,51 +22,36 @@ Input_staff::add(Input_music*m) } Staff* -Input_staff::parse(Score*score_l) +Input_staff::parse(Score*score_l, Input_music *default_score_wide) { Staff *p=0; -#if 0 - if (type == "simple") - p = new Melodic_staff; - else if (type == "rhythmic") - p = new Rhythmic_staff; - else -#endif - - if (type == "melodic") + if (type == "melodic") p = new Complex_staff; else if (type == "lyric") p = new Lyric_staff; else - error( "Unknown staff-type `" + type +"\'", 0 ); + error( "Unknown staff-type `" + type +"\'", defined_ch_c_l_); p->score_l_ = score_l; - p->define_spot_str_ = ""; // todo for (iter_top(music_,i); i.ok(); i++) { Voice_list vl = i->convert(); p->add(vl); } - - { - Array mark_arr; - Array moment_arr; - p->get_marks(mark_arr, moment_arr); - score_l->add_marks(mark_arr, moment_arr); - } - + Voice_list vl = (score_wide_music_p_) ? score_wide_music_p_->convert() + : default_score_wide->convert(); + p->add(vl); return p; } Input_staff::Input_staff(Input_staff const&s) -{ - - for (iter_top(s.commands_,i); i.ok(); i++) - commands_.bottom().add(new Input_command(**i)); +{ for (iter_top(s.music_,i); i.ok(); i++) add(i->clone()); defined_ch_c_l_ = s.defined_ch_c_l_; type = s.type; + score_wide_music_p_ = (s.score_wide_music_p_) ? + s.score_wide_music_p_->clone() : 0; } void @@ -84,10 +59,19 @@ Input_staff::print() const { #ifndef NPRINT mtor << "Input_staff {\n"; - for (iter_top(commands_,i); i.ok(); i++) - i->print(); for (iter_top(music_,i); i.ok(); i++) i->print(); mtor << "}\n"; #endif } +void +Input_staff::set_score_wide(Input_music *m_p) +{ + delete score_wide_music_p_; + score_wide_music_p_ = m_p; +} + +Input_staff::~Input_staff() +{ + delete score_wide_music_p_; +} -- 2.39.5