From: fred Date: Sun, 24 Mar 2002 19:44:15 +0000 (+0000) Subject: lilypond-0.0.65 X-Git-Tag: release/1.5.59~4675 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=32d1d03ec2184d6c24b29c8f57e415d95d0ab55e;p=lilypond.git lilypond-0.0.65 --- diff --git a/lily/complex-walker.cc b/lily/complex-walker.cc index 1e1ac452d7..d32d9db2eb 100644 --- a/lily/complex-walker.cc +++ b/lily/complex-walker.cc @@ -1,18 +1,20 @@ /* complex-walker.cc -- implement Complex_walker - source file of the LilyPond music typesetter + source file of the GNU LilyPond music typesetter (c) 1997 Han-Wen Nienhuys */ - +#include "score.hh" #include "staff-column.hh" #include "voice.hh" #include "p-score.hh" -#include "complex-staff.hh" #include "debug.hh" #include "complex-walker.hh" #include "walk-regs.hh" +#include "score-elem.hh" +#include "staff.hh" +#include "staffline.hh" void Complex_walker::do_post_move() @@ -72,14 +74,15 @@ Complex_walker::typeset_element(Score_elem *elem_p) { if (!elem_p) return; + staff_l_->staff_line_l_->add_element(elem_p); if (elem_p->spanner()) - pscore_l_->typeset_spanner(elem_p->spanner(), staff()->pstaff_l_); + pscore_l_->typeset_unbroken_spanner(elem_p->spanner()); else ptr()->typeset_musical_item(elem_p->item()); } -Complex_walker::Complex_walker(Complex_staff*s) - : Staff_walker(s, s->pstaff_l_->pscore_l_) +Complex_walker::Complex_walker(Staff*s) + : Staff_walker(s, s->score_l_->pscore_p_) { walk_regs_p_ = new Walker_registers(this); do_post_move(); @@ -88,12 +91,7 @@ Complex_walker::Complex_walker(Complex_staff*s) Complex_walker::~Complex_walker() { -} - -Complex_staff* -Complex_walker::staff() -{ - return (Complex_staff*) staff_l_; + delete walk_regs_p_; } diff --git a/lily/include/p-score.hh b/lily/include/p-score.hh index 1e283faf9e..5490345729 100644 --- a/lily/include/p-score.hh +++ b/lily/include/p-score.hh @@ -1,7 +1,7 @@ /* p-score.hh -- declare PScore - source file of the LilyPond music typesetter + source file of the GNU LilyPond music typesetter (c) 1996,1997 Han-Wen Nienhuys */ @@ -11,42 +11,33 @@ #define P_SCORE_HH #include "colhpos.hh" -#include "varray.hh" +#include "parray.hh" #include "lily-proto.hh" -#include "p-col.hh" -#include "p-staff.hh" +#include "plist.hh" +/** all stuff which goes onto paper. notes, signs, symbols in a score + #PScore# contains the items, the columns. + + */ -/** all stuff which goes onto paper. notes, signs, symbols in a score can be grouped in two ways: - horizontally (staffwise), and vertically (columns). #PScore# - contains the items, the columns and the staffs. - */ - -struct PScore { +class PScore { +public: Paper_def *paper_l_; - + /// the columns, ordered left to right Pointer_list cols; /// the idealspacings, no particular order Pointer_list suz; - /// the staffs ordered top to bottom - Pointer_list staffs; - - /// all symbols in score. No particular order. - Pointer_list its; - - /// if broken, the different lines - Pointer_list lines; - /// crescs etc; no particular order Pointer_list spanners; - /// broken spanners - Pointer_list broken_spans; + /// other elements + Pointer_list elem_p_list_; + + Super_elem *super_elem_l_; - Pointer_list vspan_p_list_; /* *************** */ /* CONSTRUCTION */ @@ -54,30 +45,22 @@ struct PScore { /// add a line to the broken stuff. Positions given in #config# void set_breaking(Array const &); - void add(PStaff *); - - /** add an item. add the item in specified containers. If breakstatus is set properly, add it to the {pre,post}break of the pcol. */ - void typeset_item(Item *item_p, PCol *pcol_l,PStaff*pstaf_l,int breakstatus=1); + void typeset_item(Item *item_p, PCol *pcol_l,int breakstatus=1); - /// add a Spanner - void typeset_spanner(Spanner*, PStaff*); - /// add to bottom of pcols void add(PCol*); - void add_broken(Spanner*); - /* INSPECTION */ - Array select_items(PStaff*, PCol*); - - /** - @return argument as a cursor of the list - */ + /** + @return argument as a cursor of the list + */ PCursor find_col(PCol const *)const; + Link_array col_range(PCol *left_l, PCol *right_l) const; + /* MAIN ROUTINES */ void process(); @@ -98,6 +81,13 @@ struct PScore { /* STANDARD ROUTINES */ void OK()const; void print() const; + ~PScore(); + void typeset_element(Score_elem*); + void typeset_broken_spanner(Spanner*); + /// add a Spanner + void typeset_unbroken_spanner(Spanner*); + + private: /// before calc_breaking void preprocess(); diff --git a/lily/include/staff-side.hh b/lily/include/staff-side.hh index c81353f0cb..d25d109d22 100644 --- a/lily/include/staff-side.hh +++ b/lily/include/staff-side.hh @@ -1,7 +1,7 @@ /* staff-side.hh -- declare Staff_side - source file of the LilyPond music typesetter + source file of the GNU LilyPond music typesetter (c) 1997 Han-Wen Nienhuys */ @@ -10,18 +10,18 @@ #ifndef STAFF_SIDE_HH #define STAFF_SIDE_HH -#include "staff-elem.hh" +#include "score-elem.hh" /// A symbol which sits along the staff -class Staff_side { - Array support_l_arr_; +class Staff_side : virtual Score_elem { + Link_array support_l_arr_; int staff_size_i_; - Score_elem * elem_l_; Interval support_height()const; Staff_symbol* staff_sym_l_; + void read_staff_sym(); public: - Real inter_f_; + /** Vertical dir of symbol relative to staff. -1 = below staff? */ @@ -30,12 +30,13 @@ public: /// follow the support inside the staff? bool inside_staff_b_; - void set_staffsym(Staff_symbol*); + void set_staffsym(Staff_symbol * ); - Staff_side(Score_elem*); + Staff_side(); void add_support(Score_elem*); protected: + virtual void do_substitute_dependency(Score_elem *, Score_elem*); int get_position_i()const; int get_position_i(Interval)const; }; diff --git a/lily/slur.cc b/lily/slur.cc index 1fa1ad2885..9b6d75caf1 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -1,7 +1,7 @@ /* slur.cc -- implement Slur - source file of the LilyPond music typesetter + source file of the GNU LilyPond music typesetter (c) 1996, 1997 Han-Wen Nienhuys */ @@ -53,27 +53,38 @@ Slur::do_pre_processing() left_col_l_ = encompass_arr_[0]->pcol_l_; } -Spanner* -Slur::do_break_at(PCol*l, PCol*r) const +void +Slur::do_break_at(PCol*l, PCol*r) { assert(l->line_l_ == r->line_l_); - Slur*ret = new Slur(*this); - ret->encompass_arr_.set_size(0); - for (int i =0; i < encompass_arr_.size(); i++) { - if (encompass_arr_[i]->pcol_l_->line_l_==l->line_l_) - ret->encompass_arr_.push(encompass_arr_[i]); + Array old_encompass_arr = encompass_arr_; + encompass_arr_.set_size(0); + for (int i =0; i < old_encompass_arr.size(); i++) { + if (old_encompass_arr[i]->pcol_l_->line_l_==l->line_l_) + encompass_arr_.push(old_encompass_arr[i]); } +} - return ret; +void +Slur::do_substitute_dependency(Score_elem*o, Score_elem*n) +{ + int i; + while((i = encompass_arr_.find_i((Note_column*)o->item())) >=0) { + if (n) + encompass_arr_[i] = (Note_column*)n->item(); + else + encompass_arr_.del(i); + } } + void Slur::do_post_processing() { if (!dir_i_) set_default_dir(); - Real inter_f = paper()->internote(); + Real inter_f = paper()->internote_f(); if (encompass_arr_[0]->stem_l_) left_pos_i_ = rint(encompass_arr_[0]->stem_l_->height()[dir_i_]/inter_f); else diff --git a/lily/spanner-elem-group.cc b/lily/spanner-elem-group.cc new file mode 100644 index 0000000000..1baf0a61b1 --- /dev/null +++ b/lily/spanner-elem-group.cc @@ -0,0 +1,38 @@ +/* + spanner-elem-group.cc -- implement + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "p-col.hh" +#include "spanner-elem-group.hh" + +void +Spanner_elem_group::do_break_at(PCol*c1, PCol*c2 ) +{ + Line_of_score * line_C = c1->line_l_; + Array old_elems=elem_l_arr_; + elem_l_arr_.set_size(0); + for (int i=0; i < old_elems.size(); i++) { + if (old_elems[i]->line_l() == line_C) { + add_element(old_elems[i]); + } + } +} + +IMPLEMENT_STATIC_NAME(Spanner_elem_group); + +Interval +Spanner_elem_group::do_width() const +{ + return Spanner::do_width(); +} + +void +Spanner_elem_group::do_print() const +{ + Element_group::do_print(); +} + diff --git a/lily/staff.cc b/lily/staff.cc index c601837147..76e6d995ca 100644 --- a/lily/staff.cc +++ b/lily/staff.cc @@ -1,12 +1,14 @@ /* staff.cc -- implement Staff - source file of the LilyPond music typesetter + source file of the GNU LilyPond music typesetter (c) 1997 Han-Wen Nienhuys */ -#include "input-register.hh" + #include "proto.hh" +#include "plist.hh" +#include "input-register.hh" #include "staff.hh" #include "score.hh" #include "voice.hh" @@ -16,7 +18,11 @@ #include "debug.hh" #include "musical-request.hh" #include "command-request.hh" // todo - +#include "staffline.hh" +#include "complex-walker.hh" +#include "super-elem.hh" +#include "p-score.hh" +#include "scoreline.hh" void Staff::add(Link_list const &l) @@ -57,9 +63,6 @@ Staff::OK() const #ifndef NDEBUG cols_.OK(); voice_list_.OK(); - iter_top(cols_, i); - iter_top(cols_, j); - i++; assert(score_l_); #endif } @@ -88,12 +91,16 @@ Staff::print() const #endif } +Staff::~Staff() +{ + delete ireg_p_; +} + Staff::Staff() { ireg_p_ =0; score_l_ =0; pscore_l_ =0; - pstaff_l_ =0; } void @@ -102,3 +109,19 @@ Staff::add_col(Staff_column*c_l) cols_.bottom().add(c_l); c_l->staff_l_ = this; } + +void +Staff::set_output(PScore* pscore_l ) +{ + pscore_l_ = pscore_l; + staff_line_l_ = new Line_of_staff; + pscore_l_->typeset_unbroken_spanner(staff_line_l_); + pscore_l_->super_elem_l_->line_of_score_l_->add_line(staff_line_l_); +} + + +Staff_walker * +Staff::get_walker_p() +{ + return new Complex_walker(this); +}