From: fred Date: Sun, 24 Mar 2002 19:52:08 +0000 (+0000) Subject: lilypond-0.0.68pre X-Git-Tag: release/1.5.59~4212 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=21148d34f33cd581edc6eaa5dabffc8ff5d05abe;p=lilypond.git lilypond-0.0.68pre --- diff --git a/lily/complex-walker.cc b/lily/complex-walker.cc deleted file mode 100644 index d32d9db2eb..0000000000 --- a/lily/complex-walker.cc +++ /dev/null @@ -1,98 +0,0 @@ -/* - complex-walker.cc -- implement Complex_walker - - 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 "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() -{ - walk_regs_p_->post_move_processing(); -} - -void -Complex_walker::do_pre_move() -{ - walk_regs_p_->pre_move_processing(); -} - -void -Complex_walker::do_announces() -{ - walk_regs_p_->do_announces(); -} - - -void -Complex_walker::try_request(Request*req) -{ - bool b =walk_regs_p_->try_request(req); - if (!b) - req->warning("junking request: " + String(req->name())); -} - -void -Complex_walker::process_requests() -{ - Staff_column*c =ptr(); - - for (int i=0; i < c->creationreq_l_arr_.size(); i++) { - try_request(c->creationreq_l_arr_[i]); - } - for (int i=0; i < c->commandreq_l_arr_.size(); i++) { - try_request(c->commandreq_l_arr_[i]); - } - - for (int i=0; i < c->musicalreq_l_arr_.size(); i++) { - try_request(c->musicalreq_l_arr_[i]); - } - - regs_process_requests(); - do_announces(); -} - -void -Complex_walker::regs_process_requests() -{ - walk_regs_p_->process_requests(); -} - -void -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_unbroken_spanner(elem_p->spanner()); - else - ptr()->typeset_musical_item(elem_p->item()); -} - -Complex_walker::Complex_walker(Staff*s) - : Staff_walker(s, s->score_l_->pscore_p_) -{ - walk_regs_p_ = new Walker_registers(this); - do_post_move(); -} - - -Complex_walker::~Complex_walker() -{ - delete walk_regs_p_; -} - - - diff --git a/lily/include/atom.hh b/lily/include/atom.hh deleted file mode 100644 index 5e9f2601ff..0000000000 --- a/lily/include/atom.hh +++ /dev/null @@ -1,17 +0,0 @@ -/* - atom.hh -- declare - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef ATOM_HH -#define ATOM_HH - -#include "symbol.hh" -#error - - -#endif // ATOM_HH diff --git a/lily/include/complex-walker.hh b/lily/include/complex-walker.hh deleted file mode 100644 index cc16eef1b3..0000000000 --- a/lily/include/complex-walker.hh +++ /dev/null @@ -1,45 +0,0 @@ -/* - complex-walker.hh -- declare Complex_walker - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef COMPLEXWALKER_HH -#define COMPLEXWALKER_HH - -#include "lily-proto.hh" -#include "staff-walker.hh" -#include "score-elem-info.hh" - -/** - A staff walker which uses registers to decide what to print - */ -class Complex_walker: public Staff_walker { - bool try_command_request(Command_req *req_l); - void do_announces(); - void try_request(Request*req); - - - -public: - Walker_registers *walk_regs_p_; - - /* *************** */ - - void regs_process_requests(); - void typeset_element(Score_elem *elem_p); - void announce_element(Score_elem_info); - virtual void process_requests(); - virtual void do_post_move(); - virtual void do_pre_move(); - - Complex_walker(Staff*); - ~Complex_walker(); - -private: -}; - - -#endif // COMPLEXWALKER_HH - - diff --git a/lily/include/input-music.hh b/lily/include/input-music.hh deleted file mode 100644 index 31c60c2fc8..0000000000 --- a/lily/include/input-music.hh +++ /dev/null @@ -1,134 +0,0 @@ -/* - input-music.hh -- part of GNU LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef INPUTMUSIC_HH -#define INPUTMUSIC_HH - -#include "plist.hh" -#include "lily-proto.hh" -#include "voice.hh" -#include "moment.hh" - -struct Voice_list : public Link_list { - void translate_time(Moment dt); -}; - -/** - - A set voices. - Input_music is anything that can simply be regarded as/converted to - a set of voices "cooperating" or independant. It has some basic - characteristics that real music has too: - - - it is rhythmic (it has a length, and can be translated horizontally) - - a pitch (it can be transposed) - - */ -struct Input_music { - virtual Voice_list convert()const=0; - virtual Moment length()const=0; - virtual void translate_time(Moment dt)=0; - virtual ~Input_music(){} - virtual void print() const =0; - virtual void set_default_group(String)=0; - virtual void transpose(Melodic_req const&) const =0; - - - virtual Input_music *clone() const = 0; - virtual Simple_music *simple() { return 0; } -}; - -/// Simple music consists of one voice -struct Simple_music : Input_music { - Voice voice_; - - /* *** */ - virtual void transpose(Melodic_req const&) const ; - - virtual Simple_music*simple() { return this; } - void add(Voice_element*); - virtual void set_default_group(String g) { voice_.set_default_group(g); } - virtual Moment length()const; - virtual Voice_list convert()const; - virtual void translate_time(Moment dt); - virtual void print() const; - virtual Input_music *clone() const { - return new Simple_music(*this); - } -}; - -/// Complex_music consists of multiple voices -struct Complex_music : Input_music { - Pointer_list elts; - /* *************** */ - virtual void transpose(Melodic_req const&) const ; - virtual void set_default_group(String g); - void add(Input_music*inmusic_p); - Complex_music(); - Complex_music(Complex_music const &); - virtual void print() const ; - void concatenate(Complex_music*); -}; - - -/** - A voice like list of music. - - different music forms which start after each other ( concatenated, - stacked "horizontally ) - - */ - -struct Music_voice : Complex_music { - - - /* *************** */ - Moment length()const; - virtual void translate_time(Moment dt); - virtual Voice_list convert()const; - void add_elt(Voice_element*); - virtual Input_music *clone() const { - return new Music_voice(*this); - } - virtual void print() const ; -}; - -/** - Multiple musicstuff stacked on top of each other - chord like : - - - different music forms which start at the same time ( stacked "vertically" ) - - */ -struct Music_general_chord : Complex_music { - - - /* *************** */ - - virtual Moment length()const; - virtual Voice_list convert()const; - virtual void translate_time(Moment dt); - void add_elt(Voice_element*); - virtual Input_music *clone() const { - return new Music_general_chord(*this); - } - - virtual void print() const ; -}; - -struct Multi_voice_chord : Music_general_chord { - void set_default_group(String); - virtual Input_music *clone() const { - return new Multi_voice_chord(*this); - } -}; -struct Voice_group_chord : Music_general_chord { - - virtual Input_music *clone() const { - return new Voice_group_chord(*this); - } -}; -#endif // INPUTMUSIC_HH diff --git a/lily/include/input-score.hh b/lily/include/input-score.hh deleted file mode 100644 index 436e5e0947..0000000000 --- a/lily/include/input-score.hh +++ /dev/null @@ -1,43 +0,0 @@ -/* - input-score.hh -- declare Input_score - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef INPUTSCORE_HH -#define INPUTSCORE_HH - -#include "varray.hh" -#include "lily-proto.hh" -#include "plist.hh" -#include "string.hh" -#include "input.hh" - -/// the total music def of one movement -class Input_score : public Input { -public: - int errorlevel_i_; - - /// paper_, staffs_ and commands_ form the problem definition. - Paper_def *paper_p_; - Midi_def* midi_p_; - Pointer_list staffs_; - - - /* *************************************************************** */ - Input_score(); - Input_score(Input_score const&); - - void add(Input_staff*); - ~Input_score(); - /// construction - void set(Paper_def* paper_p); - void set(Midi_def* midi_p); - void print() const; - Score*parse(); -}; - -#endif diff --git a/lily/include/input-staff.hh b/lily/include/input-staff.hh deleted file mode 100644 index 4cf819876f..0000000000 --- a/lily/include/input-staff.hh +++ /dev/null @@ -1,33 +0,0 @@ -/* - input-staff.hh -- declare Input_staff - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef INPUTSTAFF_HH -#define INPUTSTAFF_HH - -#include "string.hh" -#include "plist.hh" -#include "varray.hh" -#include "lily-proto.hh" -#include "input.hh" - -class Input_staff:public Input { -public: - - Pointer_list music_; - Input_register * ireg_p_; - - /* *************** */ - ~Input_staff(); - void add(Input_music*m); - Input_staff(Input_staff const&); - Input_staff(); - Staff* parse(Score*); - void print() const; -}; - - -#endif // INPUTSTAFF_HH - diff --git a/lily/include/pulk-voice.hh b/lily/include/pulk-voice.hh deleted file mode 100644 index 085a0a3ff6..0000000000 --- a/lily/include/pulk-voice.hh +++ /dev/null @@ -1,46 +0,0 @@ -/* - pulk-voice.hh -- declare Pulk_voice - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef PULK_VOICE_HH -#define PULK_VOICE_HH - -#include "lily-proto.hh" -#include "lily-proto.hh" -#include "moment.hh" -#include "priorities.hh" -#include "pcursor.hh" - -/** - Align requests with starting time. - - To our foreign readers "pulk"ing is what you do with the stuff in - your nose to get it out. (and I don't mean blowing) */ -class Pulk_voice -{ - PCursor cur_; - Moment elt_mom_; - Priorities subtle_moment_priorities_; - int subtle_idx_; - void set_subtle(); - void next(); -public: - int staff_idx_; - - Moment when()const; - bool ok()const { return cur_.ok() ; } - - Pulk_voice(Voice*, int staff_idx); - - /** - Get the requests at when(), and advance. - */ - Array get_req_l_arr(); -}; - -#endif // PULK_VOICE_HH diff --git a/lily/include/pulk-voices.hh b/lily/include/pulk-voices.hh deleted file mode 100644 index fd388d143e..0000000000 --- a/lily/include/pulk-voices.hh +++ /dev/null @@ -1,53 +0,0 @@ -/* - pulk-voices.hh -- declare Pulk_voices - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys - - TODO - integrate Meter handling, to guarantee proper creation of staff_columns. -*/ - - -#ifndef PULK_VOICES_HH -#define PULK_VOICES_HH - -#include "pqueue.hh" -#include "plist.hh" -#include "moment.hh" -#include "lily-proto.hh" -#include "lily-proto.hh" -#include "voice.hh" -#include "time-description.hh" - - -struct Voice_l { - Voice *l_; - int staff_idx_; - Voice_l(Voice*v, int i){ l_ = v; - staff_idx_ = i; - } - Voice_l() { l_ = 0; staff_idx_ =0; } -}; -int compare(Voice_l const &p1, Voice_l const &p2); - -class Pulk_voices -{ -PQueue< Voice_l > voice_pq_; - Pointer_list< Pulk_voice * > pulk_p_list_; - Link_list staff_l_list_; - Array < Time_description > time_arr_; - Moment next_mom_; - -public: - Moment last_; - bool time_checks_failed_b() const; - bool ok() const; - Moment next_mom() const; - Pulk_voices(Link_list const&); - void get_aligned_request(Request_column *col_l ); -}; - - -#endif // PULK_VOICES_HH diff --git a/lily/include/request-column.hh b/lily/include/request-column.hh deleted file mode 100644 index 82377cf3df..0000000000 --- a/lily/include/request-column.hh +++ /dev/null @@ -1,35 +0,0 @@ -/* - request-column.hh -- declare Request_column - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef REQUEST_COLUMN_HH -#define REQUEST_COLUMN_HH -#include "plist.hh" -#include "lily-proto.hh" -#include "moment.hh" -#include "varray.hh" -/** - Like staff_column, but Score wide. One per when(). - */ -class Request_column -{ - Pointer_list staff_cols_; - Array staff_col_l_arr_; - Moment when_; - -public: - Score_column *musical_column_l_, *command_column_l_; - Request_column(Link_list const& ); - bool used_b()const; - Moment when(); - void add_reqs(int staff_idx, Array const&); - void update_time(int staff_idx, Time_description &); - void set_score_cols(Score_column*, Score_column*); -}; - -#endif // REQUEST_COLUMN_HH diff --git a/lily/include/score-walker.hh b/lily/include/score-walker.hh deleted file mode 100644 index ca19c0f942..0000000000 --- a/lily/include/score-walker.hh +++ /dev/null @@ -1,44 +0,0 @@ -/* - score-walker.hh -- declare Score_walker - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys - - -*/ - - -#ifndef SCOREWALKER_HH -#define SCOREWALKER_HH -#include "pcursor.hh" -#include "lily-proto.hh" -#include "varray.hh" - - -/** - walk through the score_columns, and while doing so, walk all staffs in a score. - - TODO - support for vertical spanners. - */ -class Score_walker : public PCursor -{ - Score* score_l_; - /// walkers for the individual staves. - Array walker_p_arr_; - Array disallow_break_walk_l_arr; - int disallow_break_count_; - int breaks_i_; - void reinit(); -public: - bool break_allowed_b(); - void allow_break(Staff_walker*w); - Score_walker(Score*); - ~Score_walker(); - Moment when(); - void operator++(int); - /// process staff walkers. - void process(); -}; -#endif // SCOREWALKER_HH diff --git a/lily/include/staff-column.hh b/lily/include/staff-column.hh deleted file mode 100644 index 7550ae27fa..0000000000 --- a/lily/include/staff-column.hh +++ /dev/null @@ -1,50 +0,0 @@ -/* - staff-column.hh -- declare Staff_column - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef STAFFCOLUMN_HH -#define STAFFCOLUMN_HH - -#include "lily-proto.hh" -#include "varray.hh" -#include "moment.hh" - -/// store simultaneous requests -class Staff_column { - - Staff_column(Staff_column const&); - -public: - Array creationreq_l_arr_; - Array musicalreq_l_arr_; - Array commandreq_l_arr_; - Staff * staff_l_; - Request_column * req_col_l_; - /// fields to collect timing data vertically. - Array timing_req_l_arr_; - - /* *************** */ - - Staff_column(); - Score_column* command_column_l(); - Score_column* musical_column_l(); - Moment when() const; - void set_req_col(Request_column *c1); - void add_reqs (Array req_l_arr); - void OK() const; - ~Staff_column(); - void update_time(Time_description&, Rhythmic_grouping*); - void typeset_breakable_items(Array &pre_p_arr, - Array &nobreak_p_arr, - Array &post_p_arr); - void typeset_musical_item(Item *i); - void setup_one_request(Request*); -protected: -}; - - - -#endif // STAFFCOLUMN_HH - diff --git a/lily/include/staff-walker.hh b/lily/include/staff-walker.hh deleted file mode 100644 index e46f0a8fb0..0000000000 --- a/lily/include/staff-walker.hh +++ /dev/null @@ -1,47 +0,0 @@ -/* - staff-walker.hh -- declare Staff_walker - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef STAFFWALKER_HH -#define STAFFWALKER_HH - -#include "lily-proto.hh" -#include "time-description.hh" -#include "pcursor.hh" - -/** - manage run-time info when walking staffcolumns such as: key, - meter, pending beams & slurs - */ -struct Staff_walker : public PCursor { - Staff * staff_l_; - PScore * pscore_l_; - Score_walker *score_walk_l_; - Time_description time_; - Rhythmic_grouping *default_grouping; - - /* *************** */ - - Moment when() const; - virtual ~Staff_walker(); - Staff_walker(Staff*, PScore*); - void process() ; - - void operator++(int); - void allow_break(); - -protected: - /// every time before ++ is called - virtual void do_pre_move(){} - /// every time after ++ is called - virtual void do_post_move(){} - virtual void process_requests()=0; -private: - void process_timing_reqs(); - Staff_walker(Staff_walker const&); -}; - -#endif // STAFFWALKER_HH - diff --git a/lily/include/staff.hh b/lily/include/staff.hh deleted file mode 100644 index f9f24d8150..0000000000 --- a/lily/include/staff.hh +++ /dev/null @@ -1,55 +0,0 @@ -/* - staff.hh -- declare Staff - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#ifndef STAFF_HH -#define STAFF_HH - -#include "plist.hh" -#include "lily-proto.hh" -#include "moment.hh" - -/// A collection of voices. -class Staff { - Staff(const Staff&src); - -public: - Input_register * ireg_p_; - - Link_list voice_list_; - /// runtime field - Link_list cols_; - Line_of_staff * staff_line_l_; - - Score *score_l_; - PScore *pscore_l_; - - /* *************************************************************** */ - - void add(Link_list const&s); - - void add_voice(Voice *v_p); - Paper_def*paper()const; - - void OK() const; - void print() const; - - /// when does the last *musical* element finish? - Moment last() const; - - /// remove unused cols - void clean_cols() ; - Staff(); - - virtual void set_output(PScore * destination); - Staff_walker *get_walker_p(); - virtual ~Staff(); - void add_col(Staff_column*); -protected: - -}; -#endif diff --git a/lily/include/staffeleminfo.hh b/lily/include/staffeleminfo.hh deleted file mode 100644 index 8eb28bc235..0000000000 --- a/lily/include/staffeleminfo.hh +++ /dev/null @@ -1,28 +0,0 @@ -/* - staffeleminfo.hh -- declare Score_elem_info - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef STAFFELEMINFO_HH -#define STAFFELEMINFO_HH - -#include "lily-proto.hh" - -/// data container. -struct Score_elem_info { - Score_elem * elem_p_; - Request*req_l_; - Voice const * voice_l_; - Voice_group_registers * group_regs_l_; - Request_register * origin_reg_l_; - - /* *** */ - Score_elem_info(Score_elem*, Request*, Request_register*); - Score_elem_info(); -}; - -#endif // STAFFELEMINFO_HH diff --git a/lily/include/voice-element.hh b/lily/include/voice-element.hh deleted file mode 100644 index 6bc85597af..0000000000 --- a/lily/include/voice-element.hh +++ /dev/null @@ -1,40 +0,0 @@ -/* - voice-element.hh -- declare Voice_element - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef VOICE_ELEMENT_HH -#define VOICE_ELEMENT_HH - -#include "lily-proto.hh" -#include "plist.hh" -#include "moment.hh" -#include "input.hh" - -/** one horizontal bit. Voice_element is nothing but a container for - *the requests, */ -class Voice_element : public Input{ -public: - /** the duration of the element. This can be 0; The duration is - determined from rhythmical requests contained in this - Voice_element */ - Moment duration_; - Voice const *voice_C_; - Pointer_list req_p_list_; - Request * principal_req_l_; - - /* *************** */ - void transpose(Melodic_req const &)const; - Voice_element(); - Voice_element(Voice_element const & src ); - - void add(Request*); - void print ()const; - void set_default_group(String id); -}; - -#endif // VOICE-ELEMENT_HH diff --git a/lily/include/voice.hh b/lily/include/voice.hh deleted file mode 100644 index a40142d56f..0000000000 --- a/lily/include/voice.hh +++ /dev/null @@ -1,44 +0,0 @@ -/* - voice.hh -- declare Voice - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#ifndef VOICE_HH -#define VOICE_HH - -#include "lily-proto.hh" -#include "plist.hh" -#include "moment.hh" - -/** class for horizontal stuff. - - Voice is a ordered row of Voice_elements. It is strictly - horizontal: you cannot have two rhythmic elements running parallel - in a Voice. For proper processing, each Voice should have - Group_change_req as a first element. - - */ - -struct Voice { - /** the elements, earliest first. - Please use the member #add()# to add a new element - */ - Pointer_list elts_; - Moment start_; - - /* *************** */ - Voice(); - Voice(Voice const&); - - Moment when(Voice_element const *)const; - Moment last() const; - void transpose(Melodic_req const &)const; - void add(Voice_element*); - void print() const; - void set_default_group(String id); -}; - -#endif diff --git a/lily/include/walk-regs.hh b/lily/include/walk-regs.hh deleted file mode 100644 index e339baa983..0000000000 --- a/lily/include/walk-regs.hh +++ /dev/null @@ -1,51 +0,0 @@ -/* - walkregs.hh -- declare Walker_registers - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef WALKREGS_HH -#define WALKREGS_HH - - -#include "register-group.hh" -#include "parray.hh" -/** - Top level registers: the interface to Complex_walker. - - [sigh. Sometimes I wish C++ could do better late binding.] - - Basically, this distributes and collects elements and elementinfo to - children - */ -class Walker_registers : public Register_group_register { - - Array prebreak_item_p_arr_; - Array nobreak_item_p_arr_; - Array postbreak_item_p_arr_; - Link_array musical_item_p_arr_; - - Array announce_info_arr_; - - Complex_walker * walk_l_; -protected: - virtual Staff_info get_staff_info(); - - virtual void announce_element(Score_elem_info); - virtual void acknowledge_element(Score_elem_info); - virtual void typeset_breakable_item(Item * pre_p , Item * nobreak_p, Item * post_p); - virtual void typeset_element(Score_elem*elem_p); - virtual Paper_def * paper() const; -public: - virtual void pre_move_processing(); - virtual void post_move_processing(); - - - void do_announces(); - Walker_registers(Complex_walker*); -}; - -#endif // WALKREGS_HH diff --git a/lily/input-music.cc b/lily/input-music.cc deleted file mode 100644 index 2d4527c44a..0000000000 --- a/lily/input-music.cc +++ /dev/null @@ -1,230 +0,0 @@ -#include "debug.hh" -#include "input-music.hh" -#include "voice.hh" -#include "musical-request.hh" -#include "command-request.hh" -#include "voice-element.hh" - -void -Simple_music::transpose(Melodic_req const &d)const -{ - voice_.transpose(d); -} - -void -Simple_music::add(Voice_element*v) -{ - voice_.add(v); -} - -Moment -Simple_music::length()const -{ - return voice_.last(); -} -void -Simple_music::translate_time(Moment t) -{ - voice_.start_ += t; -} - -Voice_list -Simple_music::convert()const -{ - Voice_list l; - Voice * v_p = new Voice(voice_); - PCursor i= v_p->elts_.bottom(); - - if (!i.ok() || i->duration_) { - v_p->add ( new Voice_element); - i=v_p->elts_.bottom(); - } - - // need-to-have, otherwise memory will be filled up with regs. - i->add(new Terminate_voice_req); - l.bottom().add(v_p); - return l; -} - - -void -Simple_music::print() const -{ -#ifndef NPRINT - mtor << "Simple_music {"; - voice_.print(); - mtor << "}\n"; -#endif -} - -/* *************** */ - -void -Complex_music::transpose(Melodic_req const& d) const -{ - for (iter_top(elts,i); i.ok(); i++) - i->transpose(d); -} -void -Complex_music::add(Input_music*v) -{ - elts.bottom().add(v); -} - -void -Complex_music::print() const -{ - for (iter_top(elts,i); i.ok(); i++) - i->print(); -} - -void -Complex_music::concatenate(Complex_music*h) -{ - for (iter_top(h->elts,i); i.ok(); i++) - add(i->clone()); -} - -Complex_music::Complex_music() -{ -} - -Complex_music::Complex_music(Complex_music const&s) -{ - for (iter_top(s.elts,i); i.ok(); i++) - add(i->clone()); -} -void -Complex_music::set_default_group(String g) -{ - for (iter_top(elts,i); i.ok(); i++) - i->set_default_group(g); -} -/* *************************************************************** */ - -void -Music_voice::print() const -{ - mtor << "Music_voice {"; - Complex_music::print(); - mtor << "}\n"; -} - -void -Music_voice::add_elt(Voice_element*v) -{ - PCursor c(elts.bottom()); - if (!c.ok() || !c->simple()) { - Simple_music*vs = new Simple_music; - - c.add(vs); - } - - c = elts.bottom(); - Simple_music *s = c->simple(); - s->add(v); -} - -Moment -Music_voice::length()const -{ - Moment l = 0; - - for (iter_top(elts,i); i.ok(); i++) - l += i->length(); - return l; -} - - -Voice_list -Music_voice::convert()const -{ - Voice_list l; - Moment here = 0; - - for (iter_top(elts,i); i.ok(); i++) { - Moment len = i->length(); - Voice_list k(i->convert()); - k.translate_time(here); - l.concatenate(k); - here +=len; - } - return l; -} - -void -Music_voice::translate_time(Moment t) -{ - elts.bottom()->translate_time(t); -} - - - -/* *************** */ - -void -Music_general_chord::add_elt(Voice_element*v) -{ - Simple_music*vs = new Simple_music; - vs->add(v); - elts.bottom().add(vs); -} - -void -Music_general_chord::print() const -{ - mtor << "Music_general_chord {"; - Complex_music::print(); - mtor << "}\n"; -} - -void -Music_general_chord::translate_time(Moment t) -{ - for (iter_top(elts,i); i.ok(); i++) - i->translate_time(t); -} - -Moment -Music_general_chord::length()const -{ - Moment l =0; - - for (iter_top(elts,i); i.ok(); i++) - l = l >? i->length(); - return l; -} - -Voice_list -Music_general_chord::convert()const -{ - Voice_list l; - for (iter_top(elts,i); i.ok(); i++) { - Voice_list k(i->convert()); - l.concatenate(k); - } - return l; -} - -/* *************** */ - -void -Multi_voice_chord::set_default_group(String g) -{ - int j=0; - for (iter_top(elts, i); i.ok(); i++) { - i->set_default_group(g + String(j)); - j++; - } -} - - -/* *************** */ - -void -Voice_list::translate_time(Moment x) -{ - for (iter_top(*this,i); i.ok(); i++) - i->start_ += x; -} - diff --git a/lily/input-score.cc b/lily/input-score.cc deleted file mode 100644 index 5ba571aefc..0000000000 --- a/lily/input-score.cc +++ /dev/null @@ -1,90 +0,0 @@ -/* - input-score.cc -- implement Input_score - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#include "debug.hh" -#include "input-score.hh" -#include "input-staff.hh" -#include "input-music.hh" -#include "score.hh" -#include "paper-def.hh" -#include "midi-def.hh" - - - -void -Input_score::add(Input_staff*s) -{ - staffs_.bottom().add(s); -} - -void -Input_score::set(Paper_def*p) -{ - delete paper_p_; - paper_p_ = p; -} - -void -Input_score::set(Midi_def* midi_p) -{ - delete midi_p_; - midi_p_ = midi_p; -} - -Input_score::Input_score(Input_score const&s) - : Input(s) -{ - paper_p_ = (s.paper_p_)? new Paper_def(*s.paper_p_) :0; - midi_p_ = (s.midi_p_)? new Midi_def(*s.midi_p_) : 0; - errorlevel_i_ = s.errorlevel_i_; -} - -Score* -Input_score::parse() -{ - Score *s_p = new Score; - - s_p->errorlevel_i_ = errorlevel_i_; - if (midi_p_) - s_p->set(new Midi_def(*midi_p_)); - if (paper_p_) - s_p->set(new Paper_def(*paper_p_)); - - for (iter_top(staffs_,i); i.ok(); i++) { - Staff* staf_p=i->parse(s_p); - s_p->add(staf_p); - } - - return s_p; -} - - -Input_score::~Input_score() -{ - delete paper_p_; - delete midi_p_; -} - -Input_score::Input_score() -{ - paper_p_= 0; - midi_p_ = 0; - errorlevel_i_ = 0; -} - -void -Input_score::print()const -{ -#ifndef NPRINT - mtor << "Input_score {\n"; - for (iter_top(staffs_,i); i.ok(); i++) { - i->print(); - } - mtor << "}\n"; -#endif -} diff --git a/lily/input-staff.cc b/lily/input-staff.cc deleted file mode 100644 index 0b127baacb..0000000000 --- a/lily/input-staff.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - input-staff.cc -- implement Input_staff - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#include "debug.hh" -#include "score.hh" -#include "input-music.hh" -#include "input-staff.hh" -#include "staff.hh" -#include "my-lily-lexer.hh" -#include "input-register.hh" - -Input_staff::Input_staff() -{ - ireg_p_ =0; -} - -void -Input_staff::add(Input_music*m) -{ - music_.bottom().add(m); -} - -Staff* -Input_staff::parse(Score*score_l) -{ - Staff *p=new Staff; - - p->score_l_ = score_l; - p->ireg_p_ = (ireg_p_)? new Input_register(*ireg_p_):0; - for (iter_top(music_,i); i.ok(); i++) { - Voice_list vl = i->convert(); - p->add(vl); - } - return p; -} - -Input_staff::Input_staff(Input_staff const&s) - : Input(s) -{ - for (iter_top(s.music_,i); i.ok(); i++) - add(i->clone()); - - ireg_p_ = (s.ireg_p_)? new Input_register(*s.ireg_p_):0; -} - -void -Input_staff::print() const -{ -#ifndef NPRINT - mtor << "Input_staff {\n"; - for (iter_top(music_,i); i.ok(); i++) - i->print(); - ireg_p_->print(); - mtor << "}\n"; -#endif -} -Input_staff::~Input_staff() -{ - delete ireg_p_; -} diff --git a/lily/pulk-voice.cc b/lily/pulk-voice.cc deleted file mode 100644 index e54c429f42..0000000000 --- a/lily/pulk-voice.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* - pulk-voices.cc -- implement Pulk_voice - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ -#include "pulk-voice.hh" -#include "voice.hh" -#include "musical-request.hh" -#include "voice-element.hh" - -Pulk_voice::Pulk_voice(Voice*voice_l, int idx) - : cur_(voice_l->elts_) -{ - elt_mom_ = voice_l->start_; - staff_idx_= idx; - set_subtle(); -} - -Array -Pulk_voice::get_req_l_arr() -{ - Array req_l_arr; - Moment w = when(); - do { - Moment sub = subtle_moment_priorities_[subtle_idx_]; - for (PCursor i(cur_->req_p_list_); i.ok(); i++) { - Musical_req* m_l = i->musical(); - if (!sub) { - if (!(m_l && m_l->subtle() && m_l->subtle()->subtime_ )) - req_l_arr.push(i); - } else { - if (m_l && m_l->subtle() && m_l->subtle()->subtime_ == sub) - req_l_arr.push(i); - } - } - next(); - } while ( ok() && when () == w); - return req_l_arr; -} - -void -Pulk_voice::set_subtle() -{ - subtle_idx_ =0; - - subtle_moment_priorities_.set_size(0); - if (!cur_.ok()) - return; - for (PCursor i(cur_->req_p_list_); i.ok(); i++) { - Musical_req* m_l = i->musical(); - if (m_l&&m_l->subtle()){ - Moment sub = m_l->subtle()->subtime_; - subtle_moment_priorities_.insert(sub); - } else { - subtle_moment_priorities_.insert(0); - } - } -} - -void -Pulk_voice::next() -{ - assert(ok()); - subtle_idx_++; - if (subtle_idx_ == subtle_moment_priorities_.size()) { - elt_mom_ += cur_->duration_; - cur_ ++; - set_subtle(); - } -} - -Moment -Pulk_voice::when()const -{ - return elt_mom_ + subtle_moment_priorities_[subtle_idx_]; -} diff --git a/lily/pulk-voices.cc b/lily/pulk-voices.cc deleted file mode 100644 index 6a480fab6a..0000000000 --- a/lily/pulk-voices.cc +++ /dev/null @@ -1,121 +0,0 @@ -/* - pulk-voices.cc -- implement Pulk_voices - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#include "pulk-voice.hh" -#include "pulk-voices.hh" -#include "staff.hh" -#include "voice.hh" -#include "request-column.hh" -#include "debug.hh" - -Pulk_voices::Pulk_voices(Link_list const& l) - : staff_l_list_(l) -{ - int staff_i = 0; - last_= 0; - Moment min_staff_last_mom=1e8; // ugh - for (iter_top(l, i); i.ok(); i++, staff_i++) { - Moment staff_last=0; - for (iter_top(i->voice_list_,j); j.ok(); j++) { - if (j->elts_.size()) { - staff_last = staff_last >? j->last(); - voice_pq_.insert(Voice_l(j, staff_i)); - } - } - min_staff_last_mom = min_staff_last_mom ? staff_last; - } - next_mom_ = voice_pq_.front().l_->start_; - time_arr_.set_size(staff_i); - - if (last_ != min_staff_last_mom) - warning("Not all staffs end simultaneously"); - -} - -void -Pulk_voices::get_aligned_request(Request_column* col_l) -{ - while (voice_pq_.size() && voice_pq_.front().l_->start_ == next_mom_) { - Voice_l v = voice_pq_.get(); - pulk_p_list_.bottom().add( new Pulk_voice ( v.l_, v.staff_idx_ )); - } - - /* hairy. #i# is a cursor which points to Pulk_voice (which a - cursor, essentially) - - - At the same time bookkeeping of measures is done. - */ - - Moment new_next_mom = last_; - iter(pulk_p_list_.top() , i); - while ( i.ok() ) { - mtor << "considering staff"<< i->staff_idx_ << "at " << i->when() << "\n"; - assert (i->when() >= next_mom_); - if (i->when() == next_mom_) { - col_l->add_reqs(i->staff_idx_, i->get_req_l_arr() ); - Time_description &t_r = time_arr_[i->staff_idx_]; - col_l->update_time(i->staff_idx_, t_r); - - if (! t_r.cadenza_b_ && t_r.next_bar_moment() > next_mom_) { - mtor << "next bar at: " << t_r.next_bar_moment(); - new_next_mom = new_next_mom ok()) { - i.del(); - continue; - } - } - assert( i->when() > next_mom_); - /* no need to call i->next(), since this is done automatically */ - new_next_mom = new_next_mom when(); - - i++; - - } - - if (voice_pq_.size() ) - new_next_mom = new_next_mom start_; - - for (int j=0; j < time_arr_.size(); j++) - time_arr_[j].add( new_next_mom - next_mom_ ); - - if (pulk_p_list_.size()) - assert( new_next_mom > next_mom_); - next_mom_ = new_next_mom; -} - - -bool -Pulk_voices::ok() const -{ - return pulk_p_list_.size() || voice_pq_.size(); -} - -int -compare(Voice_l const& v1, Voice_l const& v2) -{ - return sign(v1.l_->start_ - v2.l_->start_); -} - -Moment -Pulk_voices::next_mom()const -{ - return next_mom_; -} - -bool -Pulk_voices::time_checks_failed_b()const -{ - bool b = false; - for (int i=0; !b && i < time_arr_.size(); i++) - b|=time_arr_[i].error_b_; - return b; -} diff --git a/lily/request-column.cc b/lily/request-column.cc deleted file mode 100644 index 24ec7decec..0000000000 --- a/lily/request-column.cc +++ /dev/null @@ -1,63 +0,0 @@ -/* - request-column.cc -- implement Request_column - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ -#include "score-column.hh" -#include "request-column.hh" -#include "staff-column.hh" -#include "staff.hh" - -Moment -Request_column::when() -{ - if (command_column_l_ || musical_column_l_) - when_ = (command_column_l_)? command_column_l_->when() - : musical_column_l_->when(); - - return when_; -} - -void -Request_column::add_reqs(int idx , Array const & req_l_arr) -{ - staff_col_l_arr_[idx]->add_reqs(req_l_arr); -} - -Request_column::Request_column(Link_list const& list ) -{ - musical_column_l_ = command_column_l_ =0; - iter(list.top(), j); - for (int i=0; i < list.size(); i++,j++) { - Staff_column * col_p = new Staff_column; - col_p->set_req_col(this); - staff_col_l_arr_.push(col_p); - staff_cols_.bottom().add(col_p); - j->add_col(col_p); - } - when_ = 0; -} - -void -Request_column::set_score_cols(Score_column* c1, Score_column *c2) -{ - command_column_l_ = c1; - musical_column_l_ = c2; -} -bool -Request_column::used_b() const -{ - bool b = false; - if (command_column_l_) - b |= command_column_l_->used_b(); - if (musical_column_l_) - b |= command_column_l_->used_b(); - return b; -} -void -Request_column::update_time(int idx, Time_description&t) -{ - staff_col_l_arr_[idx]->update_time(t, 0); -} diff --git a/lily/score-walker.cc b/lily/score-walker.cc deleted file mode 100644 index 78041613f0..0000000000 --- a/lily/score-walker.cc +++ /dev/null @@ -1,116 +0,0 @@ -/* - score-walker.cc -- implement Score_walker - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ -#include "proto.hh" -#include "plist.hh" -#include "debug.hh" -#include "score-walker.hh" -#include "score.hh" -#include "staff-walker.hh" -#include "staff.hh" -#include "score-column.hh" - -Score_walker::Score_walker(Score *s) - :PCursor (s->cols_) -{ - score_l_ = s; - for (iter_top(s->staffs_,i); i.ok(); i++) { - Staff_walker* w_p=i->get_walker_p(); - w_p->score_walk_l_ =this; - walker_p_arr_.push(w_p); - } - - reinit(); - breaks_i_=0; -} - - -void -Score_walker::reinit() -{ - disallow_break_walk_l_arr = walker_p_arr_; - disallow_break_count_ = disallow_break_walk_l_arr.size(); -} - - -/** Advance the cursor, and all Staff_walkers contained in this. Reset - runtime fields */ -void -Score_walker::operator ++(int ) -{ - Moment last = ptr()->when(); - - PCursor::operator++(0); - if (ok() && ptr()->when() == last) - PCursor::operator++(0); - reinit(); - bool last_b = (!ok()); // ughh - for (int i=0; i< walker_p_arr_.size(); i++) { - if (walker_p_arr_[i]->ok() && - (last_b || walker_p_arr_[i]->when() < when())) { - - walker_p_arr_[i]->operator++(0); - } - } -} - -/** Allow the command_column to be breakable for one staff. If all - staffs allow, then allow a break here. */ -void -Score_walker::allow_break(Staff_walker*w) -{ - for (int i=0; i < disallow_break_walk_l_arr.size(); i++) { - if (w == disallow_break_walk_l_arr[i]) { - disallow_break_count_ --; - disallow_break_walk_l_arr[i] =0; - - if (!disallow_break_count_) { - PCursor col_cursor = *this; - if (ptr()->musical_b()) - col_cursor --; - col_cursor->set_breakable(); - } - } - } -} - -bool -Score_walker::break_allowed_b() -{ - return !disallow_break_count_; -} - -Moment -Score_walker::when() -{ - return ptr()->when(); -} - -void -Score_walker::process() -{ - for (int i=0; i < walker_p_arr_.size(); i++) { - Staff_walker *w = walker_p_arr_[i]; - if ( w->ok() && w->when() == when() ) { - walker_p_arr_[i]->process(); - } - } - if (break_allowed_b()){ - breaks_i_ ++; - if (! (breaks_i_ % 8)) - *mlog << "[" < -*/ -#include "proto.hh" -#include "plist.hh" -#include "staff.hh" -#include "voice.hh" -#include "time-description.hh" -#include "score-column.hh" -#include "staff-column.hh" -#include "command-request.hh" -#include "musical-request.hh" -#include "interval.hh" -#include "p-score.hh" -#include "item.hh" -#include "p-col.hh" -#include "request-column.hh" -#include "grouping.hh" - -void -Staff_column::OK() const -{ -#ifndef NDEBUG - -#endif -} - -Moment -Staff_column::when() const -{ - return req_col_l_->when(); -} - -void -Staff_column::add_reqs(Array req_l_arr) -{ - for (int i=0; i < req_l_arr.size(); i++) { - Request * j = req_l_arr[i]; - if (j->command()) { - Command_req * c_l = j->command(); - if (c_l->timing()) { - timing_req_l_arr_.push(j->command()->timing()); - } - if (c_l->groupchange()) - creationreq_l_arr_.push(c_l); - else if (!c_l->barcheck() && !c_l->partial() && - !c_l->measuregrouping()) - setup_one_request(j); - } else { - if (j->musical()) { - - Musical_req*m = j->musical(); - if (m->rhythmic()) { - req_col_l_->musical_column_l_->add_duration(m->rhythmic()->duration()); - } - if(m->skip()) - continue; - } - setup_one_request(j); - } - } -} - -Staff_column::Staff_column() -{ - staff_l_ = 0; -} - - - - -Staff_column::~Staff_column() -{ -} - -void -Staff_column::set_req_col(Request_column *col_l) -{ - req_col_l_ = col_l; -} - -void -Staff_column::setup_one_request(Request * j) -{ - if (j->command()) // ugh - commandreq_l_arr_.push(j); - else if (j->musical()) - musicalreq_l_arr_.push(j); -} - -void -Staff_column::typeset_musical_item(Item*i) -{ - assert(i); - Score_column * scorecolumn_l = req_col_l_->musical_column_l_; - scorecolumn_l->pcol_l_->pscore_l_->typeset_item(i, scorecolumn_l->pcol_l_); -} - -/** - align items in #item_l_arr#, - - @return the width of the items after aligning. - */ -Interval -align_items(Array item_l_arr) -{ - Interval wid(0,0); - for (int i =0; i < item_l_arr.size(); i++) { - Interval item_width= item_l_arr[i]->width(); - if (item_width.empty_b()) { - item_width = Interval(0,0); - } - Real dx =wid.right - item_width.left; - item_width += dx; - item_l_arr[i]->translate(Offset(dx ,0)); - wid.unite(item_width); - } - return wid; -} - -void -translate_items(Real x, Array item_l_arr) -{ - for (int i =0; i < item_l_arr.size(); i++) - item_l_arr[i]->translate(Offset(x, 0)); -} -/** - TODO: - Write a "horizontal align" item, which aligns the pres, nobreaks, posts, etc. - - */ -void -Staff_column::typeset_breakable_items(Array &pre_p_arr, - Array &nobreak_p_arr, - Array &post_p_arr) -{ - Score_column * scol_l= req_col_l_->command_column_l_; - PCol * c= scol_l->pcol_l_; - PScore *ps_l=scol_l->pcol_l_->pscore_l_; - - if (!c->breakable_b()) { - for (int i =0; i < pre_p_arr.size(); i++) { - pre_p_arr[i]->unlink(); - delete pre_p_arr[i]; - } - pre_p_arr.set_size(0); - for (int i =0; i < post_p_arr.size(); i++) { - post_p_arr[i]->unlink(); - delete post_p_arr[i]; - } - post_p_arr.set_size(0); - } - - - for (int i =0; i < pre_p_arr.size(); i++) { - ps_l->typeset_item(pre_p_arr[i], c,0); - } - for (int i =0; i < nobreak_p_arr.size(); i++) { - ps_l->typeset_item(nobreak_p_arr[i], c, 1); - } - for (int i =0; i < post_p_arr.size(); i++) { - ps_l->typeset_item(post_p_arr[i], c, 2); - } - - Interval pre_wid= align_items(pre_p_arr); - translate_items( -pre_wid.right, pre_p_arr); - align_items(nobreak_p_arr); - Interval post_wid =align_items(post_p_arr); - translate_items (-post_wid.left , post_p_arr); - - pre_p_arr.set_size(0); - post_p_arr.set_size(0); - nobreak_p_arr.set_size(0); -} - -Score_column* -Staff_column::command_column_l() -{ - return req_col_l_->command_column_l_; -} - -Score_column* -Staff_column::musical_column_l() -{ - return req_col_l_->musical_column_l_; -} - -void -Staff_column::update_time(Time_description &time_, - Rhythmic_grouping *default_grouping) -{ - // first all meter changes - for (int i=0; i < timing_req_l_arr_.size(); i++) { - Timing_req * tr_l = timing_req_l_arr_[i]; - if (tr_l->meterchange()) { - int b_i=tr_l->meterchange()->beats_i_; - int o_i = tr_l->meterchange()->one_beat_i_; - if (! time_.allow_meter_change_b() ) - tr_l->warning("Meter change not allowed here"); - else{ - time_.set_meter(b_i, o_i); - if (default_grouping) - *default_grouping = - Rhythmic_grouping(MInterval(0,Moment(b_i, o_i)), b_i); - } - } - } - - // then do the rest - for (int i=0; i < timing_req_l_arr_.size(); i++) { - Timing_req * tr_l = timing_req_l_arr_[i]; - if (tr_l->partial()) { - Moment m = tr_l->partial()->duration_; - String error = time_.try_set_partial_str(m); - if (error != "") { - tr_l->warning(error); - } else - time_.setpartial(m); - } else if (tr_l->barcheck() && time_.whole_in_measure_) { - tr_l ->warning( "Barcheck failed"); - - time_.whole_in_measure_ = 0; // resync - time_.error_b_ = true; - } else if (tr_l->cadenza()) { - time_.set_cadenza(tr_l->cadenza()->on_b_); - } else if (tr_l->measuregrouping()) { - if (default_grouping) - *default_grouping = parse_grouping( - tr_l->measuregrouping()->beat_i_arr_, - tr_l->measuregrouping()->elt_length_arr_); - } - } - time_.OK(); -} - diff --git a/lily/staff-walker.cc b/lily/staff-walker.cc deleted file mode 100644 index b83c527168..0000000000 --- a/lily/staff-walker.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* - staff-walker.cc -- implement Staff_walker - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#include "proto.hh" -#include "plist.hh" -#include "grouping.hh" -#include "staff.hh" -#include "musical-request.hh" -#include "staff-walker.hh" -#include "staff-column.hh" -#include "score-column.hh" -#include "debug.hh" -#include "time-description.hh" -#include "command-request.hh" -#include "grouping.hh" -#include "score-walker.hh" - -Staff_walker::~Staff_walker() -{ - do_pre_move(); -} - -Staff_walker::Staff_walker(Staff_walker const &s) - :PCursor (s) -{ - assert(false); -} - -Staff_walker::Staff_walker(Staff * s, PScore*ps ) - : PCursor (s->cols_) -{ - staff_l_ = s; - pscore_l_ = ps; - - // should be in tdes. TODO - default_grouping = new Rhythmic_grouping(MInterval(0, 1), 4); - score_walk_l_ = 0; -} - -Moment -Staff_walker::when() const -{ - return ptr()->when(); -} - -void -Staff_walker::process_timing_reqs() -{ - ptr()->update_time(time_, default_grouping); -} - -void -Staff_walker::operator++(int i) -{ - Moment last = when(); - - do_pre_move(); - PCursor::operator++(i); - if (ok() ) { - Moment delta_t = when() - last; - assert(delta_t >Moment(0)); - time_.add( delta_t ); - } - do_post_move(); -} - -void -Staff_walker::process() -{ - process_timing_reqs(); - process_requests(); -} - -void -Staff_walker::allow_break() -{ - score_walk_l_->allow_break(this); -} - diff --git a/lily/staff.cc b/lily/staff.cc deleted file mode 100644 index 76e6d995ca..0000000000 --- a/lily/staff.cc +++ /dev/null @@ -1,127 +0,0 @@ -/* - staff.cc -- implement Staff - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#include "proto.hh" -#include "plist.hh" -#include "input-register.hh" -#include "staff.hh" -#include "score.hh" -#include "voice.hh" -#include "staff-column.hh" -#include "score-column.hh" -#include "voice-element.hh" -#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) -{ - for (iter_top(l,i); i.ok(); i++) - voice_list_.bottom().add(i); -} - -Paper_def * -Staff::paper() const -{ - return score_l_->paper_p_; -} - -void -Staff::clean_cols() -{ -#if 0 // TODO - iter_top(cols_,i); - for(; i.ok(); ){ - if (!i->musical_column_l_->used_b()) - i->musical_column_l_ = 0; - if (!i->command_column_l_->used_b()) - i->command_column_l_ =0; - - if (!i->command_column_l_&& !i->musical_column_l_) - delete i.remove_p(); - else - i++; - } -#endif -} - - -void -Staff::OK() const -{ -#ifndef NDEBUG - cols_.OK(); - voice_list_.OK(); - assert(score_l_); -#endif -} - - -Moment -Staff::last() const -{ - Moment l = 0; - for (iter_top(voice_list_,i); i.ok(); i++) { - l = l >? i->last(); - } - return l; -} - -void -Staff::print() const -{ -#ifndef NPRINT - mtor << "Staff {\n"; - for (iter_top(voice_list_,i); i.ok(); i++) { - i->print(); - } - ireg_p_->print(); - mtor <<"}\n"; -#endif -} - -Staff::~Staff() -{ - delete ireg_p_; -} - -Staff::Staff() -{ - ireg_p_ =0; - score_l_ =0; - pscore_l_ =0; -} - -void -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); -} diff --git a/lily/voice-element.cc b/lily/voice-element.cc deleted file mode 100644 index f08aa773ef..0000000000 --- a/lily/voice-element.cc +++ /dev/null @@ -1,83 +0,0 @@ -/* - voice-elt.cc -- implement Voice_element - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#include "proto.hh" -#include "plist.hh" -#include "debug.hh" -#include "voice.hh" -#include "voice-element.hh" -#include "musical-request.hh" -#include "command-request.hh" - - -void -Voice_element::transpose(Melodic_req const&d)const -{ - for (iter_top(req_p_list_,i); i.ok(); i++) { - i->transpose(d); - } -} - -void -Voice_element::print() const -{ -#ifndef NPRINT - mtor << "voice_element { dur :"<< duration_ <<"\n"; - mtor << "principal: " << principal_req_l_->name() << "\n"; - for (iter_top(req_p_list_,rc); rc.ok(); rc++) { - rc->print(); - } - - mtor << "}\n"; -#endif -} - -void -Voice_element::add(Request*r) -{ - if (! principal_req_l_ ) - principal_req_l_ = r; - - if (r->duration()) { - assert (!duration_ || duration_ == r->duration()); - duration_ = r->duration(); - } - - r->elt_l_ = this; - req_p_list_.bottom().add(r); -} - - -Voice_element::Voice_element() -{ - principal_req_l_ = 0; - voice_C_ = 0; - duration_ = 0; -} - -Voice_element::Voice_element(Voice_element const&src) - : Input(src) -{ - principal_req_l_ = 0; - voice_C_=0; - for (iter_top(src.req_p_list_, i); i.ok(); i++) - add(i->clone()); - -} - -void -Voice_element::set_default_group(String s) -{ - for (iter_top(req_p_list_, i); i.ok(); i++) - if (i->command() &&i->command()->groupchange()) - return ; - Group_change_req *greq = new Group_change_req; - greq->newgroup_str_ = s; - add(greq); -} - diff --git a/lily/voice.cc b/lily/voice.cc deleted file mode 100644 index f248f3aa0e..0000000000 --- a/lily/voice.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* - voice.cc -- implement Voice - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#include "proto.hh" -#include "plist.hh" -#include "debug.hh" -#include "voice.hh" -#include "musical-request.hh" -#include "command-request.hh" -#include "midi-item.hh" -#include "midi-stream.hh" -#include "voice-element.hh" - -void -Voice::transpose(Melodic_req const & d)const -{ - for (iter_bot(elts_, i); i.ok(); i--) - i->transpose(d); -} - -void -Voice::set_default_group(String s) -{ - elts_.top()->set_default_group(s); -} - -Voice::Voice(Voice const&src) -{ - for (iter_top(src.elts_, i); i.ok(); i++) - add(new Voice_element(**i)); - - start_ = src.start_; -} - -Voice::Voice() -{ - start_ = 0; -} - -void -Voice::add(Voice_element*v) -{ - v->voice_C_ = this; - elts_.bottom().add(v); -} - -void -Voice::print() const -{ -#ifndef NPRINT - mtor << "Voice { start_: "<< start_<print(); - mtor << "}\n"; -#endif -} - -/** - @return The moment at which last element stops. - */ -Moment -Voice::last() const -{ - Moment l =0; - if (elts_.size()) - l = start_; - - for (iter_top(elts_,i); i.ok(); i++) - l += i->duration_; - return l; -} - diff --git a/lily/walk-regs.cc b/lily/walk-regs.cc deleted file mode 100644 index 328fa177cd..0000000000 --- a/lily/walk-regs.cc +++ /dev/null @@ -1,120 +0,0 @@ -/* - walkregs.cc -- implement Walker_registers - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ -#include "debug.hh" -#include "walk-regs.hh" -#include "staff-regs.hh" -#include "score-elem.hh" -#include "staff.hh" -#include "complex-walker.hh" -#include "staff-column.hh" -#include "score-walker.hh" -#include "bar.hh" // needed for Bar::static_name -#include "input-register.hh" -#include "staffline.hh" - -Walker_registers::Walker_registers(Complex_walker *w) -{ - walk_l_ = w; - Input_register * ireg_l = w->staff_l_->ireg_p_; - if (ireg_l->name_str_ == "Staff_registers") - add(new Staff_registers(ireg_l)); - else { - add(ireg_l->get_nongroup_p_arr()); - } -} - -void -Walker_registers::announce_element(Score_elem_info info) -{ - if (info.elem_l_->name() == Bar::static_name()) { - walk_l_->allow_break(); - } - announce_info_arr_.push(info); -} - -void -Walker_registers::acknowledge_element(Score_elem_info ) -{ - assert(false); -} - -void -Walker_registers::do_announces() -{ - Request dummy_req; - for (int i = 0; i < announce_info_arr_.size(); i++){ - Score_elem_info info = announce_info_arr_[i]; - mtor << "Announcing " << info.elem_l_->name()<<"\n"; - - if (!info.req_l_) - info.req_l_ = &dummy_req; - Register_group_register::acknowledge_element(info); - } - announce_info_arr_.set_size(0); -} - -void -Walker_registers::typeset_element(Score_elem *elem_p) -{ - musical_item_p_arr_.push(elem_p); -} - -void -Walker_registers::typeset_breakable_item(Item * pre_p , Item * nobreak_p, - Item * post_p) -{ - if (pre_p) { - prebreak_item_p_arr_.push(pre_p); - walk_l_->staff_l_->staff_line_l_->add_element(pre_p); - } - if (nobreak_p) { - nobreak_item_p_arr_.push(nobreak_p); - walk_l_->staff_l_->staff_line_l_->add_element(nobreak_p); - } - if (post_p) { - postbreak_item_p_arr_.push(post_p); - walk_l_->staff_l_->staff_line_l_->add_element(post_p); - } -} - -void -Walker_registers::pre_move_processing() -{ - // this generates all items. - Register_group_register::pre_move_processing(); - walk_l_->ptr()->typeset_breakable_items(prebreak_item_p_arr_, - nobreak_item_p_arr_, - postbreak_item_p_arr_); - for (int i=0; i < musical_item_p_arr_.size(); i++) - walk_l_->typeset_element(musical_item_p_arr_[i]); - musical_item_p_arr_.set_size(0); -} -void -Walker_registers::post_move_processing() -{ - Register_group_register::post_move_processing(); -} - - -Staff_info -Walker_registers::get_staff_info() -{ - Staff_info inf; - if (walk_l_->score_walk_l_) // we get called ctors - inf.break_allowed_b_ = walk_l_->score_walk_l_->break_allowed_b(); - inf.walk_l_ = walk_l_; - inf.time_C_ = &walk_l_->time_; - inf.rhythmic_C_ = walk_l_->default_grouping; - return inf; -} - -Paper_def* -Walker_registers::paper()const -{ - return walk_l_->staff_l_->paper(); -}