From ab59bdcaae876c1eb520d8bca00c74be709c47b1 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:42:07 +0000 Subject: [PATCH] lilypond-0.0.59 --- Documentation/MANIFESTO.pod | 5 ++ init/register.ini | 4 +- lily/include/note-column.hh | 5 +- lily/include/slur.hh | 17 ++---- lily/p-score.cc | 4 +- lily/slur-reg.cc | 16 +++-- lily/slur.cc | 113 +++++++++--------------------------- 7 files changed, 57 insertions(+), 107 deletions(-) diff --git a/Documentation/MANIFESTO.pod b/Documentation/MANIFESTO.pod index 7808c4bb19..2ceaf525c1 100644 --- a/Documentation/MANIFESTO.pod +++ b/Documentation/MANIFESTO.pod @@ -29,6 +29,11 @@ Generate high-quality output. Ideally it should be of a professional quality. We'd like to render Herbert Chlapiks words, "Fine music setting is not possible without a knowledgeable printer," untrue. +=item * + +Make a which system which fully tweakable. It should be possible to +typeset a book on how not to typeset music. + =back =head1 LILYPOND diff --git a/init/register.ini b/init/register.ini index 4168de973d..154800fdc7 100644 --- a/init/register.ini +++ b/init/register.ini @@ -9,6 +9,7 @@ melodicregs = \inputregister { \inputregister {Local_key_register} \inputregister { Staff_sym_register } \inputregister { Collision_register } + \inputregister { Rest_collision_register } \inputregister { Voice_group_registers \inputregister { Dynamic_register } @@ -16,9 +17,10 @@ melodicregs = \inputregister { \inputregister { Text_register } \inputregister { Script_register } \inputregister { Note_column_register } + \inputregister { Slur_register } \inputregister { Voice_registers \inputregister { Notehead_register } - \inputregister { Slur_register } + \inputregister { Tie_register } } } } diff --git a/lily/include/note-column.hh b/lily/include/note-column.hh index ba118fcbde..b5af018528 100644 --- a/lily/include/note-column.hh +++ b/lily/include/note-column.hh @@ -15,10 +15,11 @@ /** a struct for treating a group of noteheads (noteheads, stem (chord) and scripts ) as a single entity. */ class Note_column : public Script_column { - /// link to the stem. For setting default direction - Stem * stem_l_; void do_pre_processing(); public: + /// link to the stem. For setting default direction + Stem * stem_l_; + bool h_shift_b_; Array head_l_arr_; diff --git a/lily/include/slur.hh b/lily/include/slur.hh index c8363075c4..68f073e10f 100644 --- a/lily/include/slur.hh +++ b/lily/include/slur.hh @@ -8,26 +8,21 @@ #define SLUR_HH #include "directional-spanner.hh" -#include "fproto.hh" +#include "lily-proto.hh" #include "varray.hh" +#include "bow.hh" -struct Slur : Directional_spanner { +class Slur : public Bow { +public: + Array encompass_arr_; - Array encompass; - - bool open_left, open_right; - - /* *************** */ - Offset center() const; - Slur(); void do_post_processing(); void do_pre_processing(); - void add(Notehead*); + void add(Note_column*); void set_default_dir(); Spanner* do_break_at( PCol*, PCol*) const; private: - Molecule*brew_molecule_p()const; NAME_MEMBERS(Slur); }; diff --git a/lily/p-score.cc b/lily/p-score.cc index 6f1b362765..37090b77db 100644 --- a/lily/p-score.cc +++ b/lily/p-score.cc @@ -253,10 +253,10 @@ PScore::process() { clean_cols(); print(); - *mlog << "Preprocessing ... " <musical() && req_l->musical()->slur(); +} bool Slur_register::try_request(Request *req_l) @@ -26,12 +32,12 @@ Slur_register::try_request(Request *req_l) void Slur_register::acknowledge_element(Staff_elem_info info) { - if (info.elem_l_->name() == Notehead::static_name()) { - Notehead *head_p =(Notehead*) info.elem_l_ ;// ugh + if (info.elem_l_->name() == Note_column::static_name()) { + Note_column *col_l =(Note_column*) info.elem_l_ ;// ugh for (int i = 0; i < slur_l_stack_.size(); i++) - slur_l_stack_[i]->add(head_p ); + slur_l_stack_[i]->add(col_l ); for (int i = 0; i < end_slur_l_arr_.size(); i++) - end_slur_l_arr_[i]->add(head_p); + end_slur_l_arr_[i]->add(col_l); } } /* diff --git a/lily/slur.cc b/lily/slur.cc index 6bc5c1b24b..a47679a3f4 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -1,3 +1,11 @@ +/* + slur.cc -- implement Slur + + source file of the LilyPond music typesetter + + (c) 1996, 1997 Han-Wen Nienhuys +*/ + /* TODO: @@ -10,7 +18,8 @@ #include "scalar.hh" #include "lookup.hh" #include "paper-def.hh" -#include "notehead.hh" +#include "note-column.hh" +#include "stem.hh" #include "p-col.hh" #include "molecule.hh" #include "debug.hh" @@ -18,52 +27,30 @@ -Slur::Slur() -{ - open_right=open_left=false; -} - -Offset -Slur::center() const -{ - int pos1 = encompass.top()->position_i_; - int pos2 = encompass[0]->position_i_; - - int dy = pos1-pos2; - - Real w = width().length(); - - return Offset(w/2,dy * paper()->internote()); -} - void -Slur::add(Notehead*n) +Slur::add(Note_column*n) { - encompass.push(n); + encompass_arr_.push(n); add_dependency(n); } void Slur::set_default_dir() { - int sumpos=0; - for (int i=0; i < encompass.size(); i ++) { - sumpos += encompass[i]->position_i_; + dir_i_ = -1; + for (int i=0; i < encompass_arr_.size(); i ++) { + if (encompass_arr_[i]->dir_i_ < 0) { + dir_i_ =1; + break; + } } - - /* should consult stems */ - Real meanpos = sumpos/Real(encompass.size()); - if (meanpos < 5) // todo - dir_i_ = -1; - else - dir_i_ = 1; } void Slur::do_pre_processing() { - right_col_l_ = encompass.top()->pcol_l_; - left_col_l_ = encompass[0]->pcol_l_; + right_col_l_ = encompass_arr_.top()->pcol_l_; + left_col_l_ = encompass_arr_[0]->pcol_l_; } Spanner* @@ -72,16 +59,11 @@ Slur::do_break_at(PCol*l, PCol*r) const assert(l->line_l_ == r->line_l_); Slur*ret = new Slur(*this); - ret->encompass.set_size(0); - for (int i =0; i < encompass.size(); i++) { - if (encompass[i]->pcol_l_->line_l_==l->line_l_) - ret->encompass.push(encompass[i]); + 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]); } - if (right_col_l_ != r) - ret->open_right = true; - if (left_col_l_ != l) - ret->open_left = true; - return ret; } @@ -91,49 +73,8 @@ Slur::do_post_processing() { if (!dir_i_) set_default_dir(); + Real inter_f = paper()->internote(); + left_pos_i_ = encompass_arr_[0]->stem_l_->height()[dir_i_]/inter_f; + right_pos_i_ = encompass_arr_.top()->stem_l_->height()[dir_i_]/inter_f; } - -Molecule* -Slur::brew_molecule_p() const -{ - Molecule*output = new Molecule; - - int minp=1000, maxp=-1000; // todo - for (int i=0; iposition_i_ position_i_ >? maxp; - } - assert(encompass.size()>0); // todo - - Notehead *lnote_p =encompass[0]; - Notehead *rnote_p =encompass.top(); - int lpos_i = lnote_p->position_i_; - int rpos_i = rnote_p->position_i_; - Offset left_off(lnote_p->x_dir_i_, lpos_i + 2*dir_i_); - Offset right_off(lnote_p->x_dir_i_, rpos_i + 2*dir_i_); - if (!lnote_p->extremal_i_) - left_off += Offset(0.5, -dir_i_); - if (!rnote_p->extremal_i_) - right_off+= Offset(-0.5, -dir_i_); - - int dy = int(right_off.y - left_off.y); - - Real nw_f = paper()->note_width(); - Real nh_f = paper()->internote(); - Real w = width().length(); - - w+= (right_off.x - left_off.x) * nw_f ; - Real round_w = w; // slur lookup rounds the slurwidth . - - Symbol sl = paper()->lookup_l()->slur(dy , round_w, dir_i_); - - Real error = w-round_w; - - Atom a(sl); - a.translate(Offset((left_off.x + 0.5 )*nw_f + error/2, - left_off.y * nh_f)); - output->add(a); - return output; -} - IMPLEMENT_STATIC_NAME(Slur); -- 2.39.5