From 3b31e8dab31b9820153be69d027f763b4def41fb Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 11 Feb 1997 23:34:18 +0000 Subject: [PATCH] lilypond-0.0.30 --- hdr/complexstaff.hh | 29 ++++------------------------- hdr/lyricstaff.hh | 7 ++----- hdr/score.hh | 16 ++++++++-------- hdr/stcol.hh | 14 +++++++------- src/complexprint.cc | 22 +++++++++++----------- src/lyriccolumn.cc | 25 ++++--------------------- src/lyricstaff.cc | 15 ++++++--------- src/score.cc | 18 +++++++++++------- src/staffwalker.cc | 8 +++++++- src/stcol.cc | 7 ++++--- 10 files changed, 64 insertions(+), 97 deletions(-) diff --git a/hdr/complexstaff.hh b/hdr/complexstaff.hh index 17d489be96..6c7dbdb18d 100644 --- a/hdr/complexstaff.hh +++ b/hdr/complexstaff.hh @@ -1,5 +1,5 @@ /* - complexstaff.hh -- part of LilyPond + complexstaff.hh -- declare Complex_staff (c) 1996,1997 Han-Wen Nienhuys */ @@ -12,36 +12,15 @@ #include "stcol.hh" #include "staff.hh" #include "staffwalker.hh" - -/// column of Complex_staff: store one request -struct Complex_column : Staff_column { - - Array first_l_arr_; - Array second_l_arr_; - - Complex_staff* staff_l_; - - /****************/ - - Slur_req *find_slur(Voice *); - - void typeset_item(Item *, int=1); - void typeset_item_directional(Item *, int dir, int=1); - Molecule *create_command_mol(Command *com); - - void take_request(Request *rq); - virtual void setup_requests(); - - Complex_column(Score_column*s,Complex_staff*rs); -}; +#include "complexcolumn.hh" /// Complex staff: one voicegroup at a time struct Complex_staff : Staff { /// indirection to the PStaff. - PStaff *theline_l_; + PStaff *pstaff_l_; - /****************/ + /* *************** */ Staff_column*create_col(Score_column*); virtual Item *get_TYPESET_item(Command*); virtual void set_output(PScore *); diff --git a/hdr/lyricstaff.hh b/hdr/lyricstaff.hh index 6959636c60..22fb8958b6 100644 --- a/hdr/lyricstaff.hh +++ b/hdr/lyricstaff.hh @@ -10,14 +10,11 @@ /// (lstaff) struct Lyric_staff : Staff { - PStaff* line_pstaff_p_; + PStaff* pstaff_l_; Staff_column* create_col(Score_column*); - -// virtual Item *get_TYPESET_item(Command*); - virtual void set_output(PScore *); -// virtual Local_key_item* get_local_key_item(); + virtual void set_output(PScore *); void process_commands(PCursor &where); virtual void walk(); diff --git a/hdr/score.hh b/hdr/score.hh index 64e2828614..cd5a56c5e7 100644 --- a/hdr/score.hh +++ b/hdr/score.hh @@ -5,6 +5,7 @@ #include "plist.hh" #include "moment.hh" #include "assoc.hh" +#include "string.hh" /// the total music def of one movement struct Score { @@ -20,7 +21,8 @@ struct Score { int errorlevel_i_; Assoc markers_assoc_; - /****************************************************************/ + + /* *************************************************************** */ /// construction Score(Paperdef*); @@ -40,28 +42,26 @@ struct Score { // utils: PCursor create_cols(Moment); + + /// find a column. The cursor is given to try a little efficiency. PCursor find_col(Moment,bool); + /// when does the last *musical* element finish? Moment last() const; private: Score(Score const&){} - /// - void do_cols(); + /** make the pcol_l_ fields of each Score_column point to the correct PCol, remove any unnecessary Score_column's */ + void do_cols(); /// remove unused cols void clean_cols(); /// add #Idealspacings# to #pscore_# void calc_idealspacing(); - /** add the score wide commands (bars, breaks) to each staff so - they can process (typeset) them if needed */ }; -/** - - */ #endif diff --git a/hdr/stcol.hh b/hdr/stcol.hh index 0984f88022..0ae5244d8a 100644 --- a/hdr/stcol.hh +++ b/hdr/stcol.hh @@ -1,5 +1,5 @@ /* - stcol.hh -- part of LilyPond + stcol.hh -- declare Staff_column (c) 1996,97 Han-Wen Nienhuys */ @@ -23,22 +23,22 @@ struct Staff_column { Time_description *tdescription_; - /****************/ + /* *************** */ - Staff_column(Score_column*s); - bool mus() const; + Staff_column(Score_column*); + bool musical_b() const; Moment when() const; void add(Voice_element*ve); void OK() const; - /**************************************************************** + /* VIRTUAL - ****************************************************************/ + */ virtual void setup_requests()=0; virtual ~Staff_column(); private: - Staff_column(Staff_column const&){} + Staff_column(Staff_column const&); }; diff --git a/src/complexprint.cc b/src/complexprint.cc index 372d86db10..ec38b575e1 100644 --- a/src/complexprint.cc +++ b/src/complexprint.cc @@ -6,7 +6,7 @@ #include "complexstaff.hh" #include "sccol.hh" #include "debug.hh" -#include "linepstaff.hh" + #include "clefitem.hh" #include "bar.hh" #include "meter.hh" @@ -38,7 +38,7 @@ Complex_staff::get_TYPESET_item(Command *com) Interval -citemlist_width(const Array &its) +itemlist_width(const Array &its) { Interval iv ; iv.set_empty(); @@ -56,14 +56,14 @@ Complex_column::typeset_item(Item *i, int breakst) assert(i); staff_l_->pscore_l_->typeset_item(i, score_column_l_->pcol_l_, - staff_l_->theline_l_,breakst); + staff_l_->pstaff_l_,breakst); if (breakst == BREAK_PRE - BREAK_PRE) { Array to_move( - staff_l_->pscore_l_->select_items(staff_l_->theline_l_, + staff_l_->pscore_l_->select_items(staff_l_->pstaff_l_, score_column_l_->pcol_l_->prebreak_p_)); - Interval column_wid = citemlist_width(to_move); + Interval column_wid = itemlist_width(to_move); assert(!column_wid.empty()); for (int j=0; j < to_move.size(); j++) { @@ -84,22 +84,22 @@ Complex_column::typeset_item_directional(Item *i, int dir, int breakst) // UGH! else if (breakst == 2) c = c->postbreak_p_; - Array to_move(staff_l_->pscore_l_->select_items(staff_l_->theline_l_, + Array to_move(staff_l_->pscore_l_->select_items(staff_l_->pstaff_l_, c)); typeset_item(i, breakst); - Interval column_wid = citemlist_width(to_move); + Interval column_wid = itemlist_width(to_move); if (column_wid.empty()) column_wid = Interval(0,0); i->translate(Offset(column_wid[dir] - i->width()[-dir], 0)); } void -Complex_staff::set_output(PScore* ps ) +Complex_staff::set_output(PScore* pscore_l ) { - theline_l_ = new Linestaff(NO_LINES,ps); // theline_l_ is added to pscore later. - pscore_l_ = ps; - pscore_l_->add(theline_l_); + pstaff_l_ = new PStaff(pscore_l); // pstaff_l_ is added to pscore later. + pscore_l_ = pscore_l; + pscore_l_->add(pstaff_l_); } diff --git a/src/lyriccolumn.cc b/src/lyriccolumn.cc index c016957eb6..c54ebc2b39 100644 --- a/src/lyriccolumn.cc +++ b/src/lyriccolumn.cc @@ -9,7 +9,7 @@ #include "pscore.hh" #include "main.hh" -Lyric_column::Lyric_column(Score_column*s, Lyric_staff* lstaff_l) +Lyric_column::Lyric_column(Score_column* s, Lyric_staff* lstaff_l) : Staff_column(s) { lstaff_l_ = lstaff_l; @@ -33,28 +33,11 @@ Lyric_column::setup_requests() } } -Interval itemlist_width(const Array &its); - void -Lyric_column::typeset_item(Item *i, int breakst) -{ - assert(i); - +Lyric_column::typeset_item(Item *i) +{ lstaff_l_->pscore_l_->typeset_item(i, score_column_l_->pcol_l_, - lstaff_l_->line_pstaff_p_,breakst); - - if (breakst == BREAK_PRE - BREAK_PRE) { - - Array to_move( - lstaff_l_->pscore_l_->select_items(lstaff_l_->line_pstaff_p_, - score_column_l_->pcol_l_->prebreak_p_)); - Interval column_wid = itemlist_width(to_move); - assert(!column_wid.empty()); - - for (int j=0; j < to_move.size(); j++) { - to_move[j]->translate(Offset(-column_wid.right, 0)); - } - } + lstaff_l_->pstaff_l_); } Word_info::Word_info() diff --git a/src/lyricstaff.cc b/src/lyricstaff.cc index 3afea78a8f..279db7ff87 100644 --- a/src/lyricstaff.cc +++ b/src/lyricstaff.cc @@ -6,16 +6,13 @@ #include "command.hh" #include "lyricstaff.hh" #include "lyriccolumn.hh" -#include "linepstaff.hh" #include "sccol.hh" #include "lyricwalker.hh" #include "pscore.hh" - - Lyric_staff::Lyric_staff() { - line_pstaff_p_ = 0; + pstaff_l_=0; } Staff_column* @@ -25,18 +22,18 @@ Lyric_staff::create_col(Score_column*s) } void -Lyric_staff::set_output(PScore*ps) +Lyric_staff::set_output(PScore*pscore_l) { - line_pstaff_p_ = new Linestaff(0,ps); - pscore_l_ = ps; - pscore_l_->add(line_pstaff_p_); + pstaff_l_ = new PStaff(pscore_l); + pscore_l_ = pscore_l; + pscore_l_->add(pstaff_l_); } void Lyric_staff::walk() { for (Lyric_walker lcols(this); lcols.ok(); lcols++) { - lcols.lcol_l()->setup_requests();// TODO + lcols.lcol_l()->setup_requests(); lcols.process(); } } diff --git a/src/score.cc b/src/score.cc index 0f697655b2..ab9a9d9a93 100644 --- a/src/score.cc +++ b/src/score.cc @@ -12,17 +12,18 @@ void Score::process() { - *mlog << "\nProcessing music" << endl; + *mlog << "\nProcessing music ..." << flush; assert (paper_p_); if (last() == Moment(0)) { warning("Need to have music in a score.", defined_ch_c_l_); } + // distribute commands to disciples pscore_p_ = new PScore(paper_p_); for (iter_top(staffs_,i); i.ok(); i++) { - i->truncate_cols(last()); i->set_output(pscore_p_); + i->truncate_cols(last()); i->process(); } @@ -34,6 +35,7 @@ Score::process() // debugging OK(); + *mlog << endl; pscore_p_->process(); } @@ -88,9 +90,10 @@ Score::create_cols(Moment w) } PCursor -Score::find_col(Moment w,bool mus) -{ - iter_top(cols_,i); +Score::find_col(Moment w, bool mus) +{ iter_top( cols_,i); + + for (; i.ok(); i++) { if (i->when() == w && i->musical_ == mus) return i; @@ -112,6 +115,7 @@ Score::do_cols() } clean_cols(); // can't move clean_cols() farther up. } + Moment Score::last() const { @@ -157,10 +161,10 @@ Score::print() const #endif } -Score::Score(Paperdef*p) +Score::Score(Paperdef*paper_p) { pscore_p_=0; - paper_p_ = p; // ?? safe? + paper_p_ = paper_p; errorlevel_i_ = 0; defined_ch_c_l_ = 0; } diff --git a/src/staffwalker.cc b/src/staffwalker.cc index 3bf94ceaba..eac45b5b13 100644 --- a/src/staffwalker.cc +++ b/src/staffwalker.cc @@ -2,6 +2,7 @@ #include "staffwalker.hh" #include "stcol.hh" #include "sccol.hh" +#include "debug.hh" Staff_walker::~Staff_walker() {} Staff_walker::Staff_walker(Staff_walker const &s) @@ -29,7 +30,7 @@ Staff_walker::process() { break_status = BREAK_END - BREAK_PRE; - if (ptr()->mus()) { + if (ptr()->musical_b()) { process_requests(); } else if (ptr()->staff_commands_p_) for (iter_top(*ptr()->staff_commands_p_,i); i.ok(); i++) { @@ -66,6 +67,11 @@ void Staff_walker::operator++(int i) { do_pre_move(); + if (ptr()->musical_b() && ptr()->tdescription_ + && !ptr()->tdescription_->whole_in_measure) { + *mlog << "[" << ptr()->tdescription_->bars<<"]"<< flush; + } PCursor::operator++(i); + do_post_move(); } diff --git a/src/stcol.cc b/src/stcol.cc index 89a572408a..0712409662 100644 --- a/src/stcol.cc +++ b/src/stcol.cc @@ -16,7 +16,7 @@ Staff_column::OK() const } bool -Staff_column::mus() const +Staff_column::musical_b() const { return score_column_l_->musical_; } @@ -38,10 +38,11 @@ Staff_column::add(Voice_element*ve) v_elts.push(ve); } -Staff_column::Staff_column(Score_column *s_l) +Staff_column::Staff_column(Score_column * cur) + { tdescription_ =0; - score_column_l_ = s_l; + score_column_l_=cur; staff_commands_p_ = 0; } -- 2.11.4.GIT