From: fred Date: Sun, 24 Mar 2002 19:31:07 +0000 (+0000) Subject: lilypond-0.0.30 X-Git-Tag: release/1.5.59~5427 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=72cd9a0388b849d9277fc51f05358ffb52f21b24;p=lilypond.git lilypond-0.0.30 --- diff --git a/hdr/staffsym.hh b/hdr/staffsym.hh new file mode 100644 index 0000000000..294a0218a0 --- /dev/null +++ b/hdr/staffsym.hh @@ -0,0 +1,30 @@ +/* + staffsym.hh -- declare Staff_symbol + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef STAFFSYM_HH +#define STAFFSYM_HH +#include "spanner.hh" +/** + This spanner draws the lines of a pstaff. + The bottom line is position 0. + */ +class Staff_symbol : public Spanner +{ +public: + /// this many lines. + int no_lines_i_; + + const char *name()const; + Staff_symbol(int lines); + virtual Molecule* brew_molecule_p() const; + void set_extent(PCol* p1, PCol* p2); + virtual void do_print()const; + virtual Spanner *do_break_at( PCol *c1, PCol *c2) const; +}; +#endif // STAFFSYM_HH diff --git a/src/clef.cc b/src/clef.cc index d0fcbe09d9..bf7b924159 100644 --- a/src/clef.cc +++ b/src/clef.cc @@ -1,23 +1,32 @@ +/* + clef.cc -- implement Clef + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys , + Mats Bengtsson +*/ + #include "clef.hh" +#include "debug.hh" Clef::Clef() { - clef_type= "violin"; - c0_pos = -2; + set_type("violin"); } -void -Clef::read(Arrayargs) +void +Clef::set_type(String type_str) { - clef_type = args[0]; - if (clef_type == "violin") { - c0_pos=-2; - } else if (clef_type == "alto") { - c0_pos = 4; - } else if (clef_type == "tenor") { - c0_pos = 6; - } else if (clef_type == "bass") { - c0_pos = 10; + clef_type_str_ = type_str; + if (clef_type_str_ == "violin") { + c0_position_i_= -2; + } else if (clef_type_str_ == "alto") { + c0_position_i_= 4; + } else if (clef_type_str_ == "tenor") { + c0_position_i_= 6; + } else if (clef_type_str_ == "bass") { + c0_position_i_= 10; } else - assert(false); + error("unknown clef type `"+clef_type_str_+"\'"); } diff --git a/src/clefitem.cc b/src/clefitem.cc index 2b451a804d..0e0054acd3 100644 --- a/src/clefitem.cc +++ b/src/clefitem.cc @@ -29,7 +29,7 @@ Clef_item::read(String t) void Clef_item::read(Clef k) { - read(k.clef_type); + read(k.clef_type_str_); } Molecule* @@ -40,7 +40,7 @@ Clef_item::brew_molecule_p()const t += "_change"; Symbol s = paper()->lookup_p_->clef(t); Molecule*output = new Molecule(Atom(s)); - output->translate(Offset(0, paper()->interline()/2 * y_off)); + output->translate(Offset(0, paper()->internote() * y_off)); return output; } diff --git a/src/headreg.cc b/src/headreg.cc new file mode 100644 index 0000000000..ecb24074fd --- /dev/null +++ b/src/headreg.cc @@ -0,0 +1,70 @@ +/* + headreg.cc -- part of LilyPond + + (c) 1997 Han-Wen Nienhuys +*/ +#include "rest.hh" +#include "notehead.hh" +#include "headreg.hh" +#include "paper.hh" +#include "complexwalker.hh" + + +Notehead_register::Notehead_register(Complex_walker*w_l) + :Request_register(w_l) +{ + note_p_ = 0; + set_dir(0); +} + +bool +Notehead_register::try_request(Request *req_l) +{ + if (req_l->note() || req_l->rest()) + accepted_req_arr_.push(req_l); + else + return false; + + return true; +} +void +Notehead_register::set_dir(int d) +{ + dir_i_ = d; +} + +void +Notehead_register::process_request() +{ + if (!accepted_req_arr_.size()) + return; + + Request* req_l = accepted_req_arr_.top(); + if (req_l->note()) { + Notehead*n_p = new Notehead(8); // ugh + note_p_ = n_p; + n_p->set_rhythmic(req_l->rhythmic()); + n_p->position = req_l->note()->height() + + walk_l_->clef_.c0_position_i_; + } else { + note_p_ = new Rest ( req_l->rhythmic()->balltype, + req_l->rhythmic()->dots); + if (req_l->rhythmic()->balltype <= 2) + note_p_->translate( + Offset(0, + 6 * paper()->internote())); + } + Staff_elem_info itinf(note_p_,req_l,this); + announce_element(itinf); +} + +void +Notehead_register::do_pre_move_process() +{ + if (note_p_) { + if (dir_i_ && note_p_->name() == String("Rest")) + note_p_->translate(Offset(0, 4*dir_i_ * paper()->internote())); + typeset_element(note_p_); + note_p_ = 0; + } +} diff --git a/src/localkeyitem.cc b/src/localkeyitem.cc index c61f1b91af..6fa9b1dfe3 100644 --- a/src/localkeyitem.cc +++ b/src/localkeyitem.cc @@ -45,9 +45,10 @@ Local_key_item::brew_molecule_p()const Molecule*octmol = 0; int lastoct = -100; for (int i = 0; i < accs.size(); i++) { + // do one octave if (accs[i].octave != lastoct) { if (octmol){ - Real dy =lastoct*7*paper()->interline()/2; + Real dy =lastoct*7*paper()->internote(); octmol->translate(Offset(0, dy)); output->add(*octmol); delete octmol; @@ -57,14 +58,14 @@ Local_key_item::brew_molecule_p()const lastoct = accs[i].octave; Symbol s =paper()->lookup_p_->accidental(accs[i].acc); Atom a(s); - Real dy = (accs[i].name + c0_position) * paper()->interline()/2; + Real dy = (accs[i].name + c0_position) * paper()->internote(); a.translate(Offset(0,dy)); octmol->add_right(a); } if (octmol){ - Real dy =lastoct*7*paper()->interline()/2; + Real dy =lastoct*7*paper()->internote(); octmol->translate(Offset(0, dy)); output->add(*octmol); delete octmol; diff --git a/src/localkeyreg.cc b/src/localkeyreg.cc new file mode 100644 index 0000000000..bbd4993022 --- /dev/null +++ b/src/localkeyreg.cc @@ -0,0 +1,58 @@ +/* + localkeyreg.cc -- implement Local_key_register + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "localkeyreg.hh" +#include "localkeyitem.hh" +#include "complexwalker.hh" + +Local_key_register::Local_key_register(Complex_walker*w) + : Request_register(w) +{ + key_item_p_ = 0; +} +bool +Local_key_register::try_request(Request*) + +{ + return false; +} + +void +Local_key_register::process_request() +{ +} +void +Local_key_register::do_pre_move_process() +{ + if (key_item_p_) { + walk_l_->typeset_element(key_item_p_); + key_item_p_ = 0; + } +} +void +Local_key_register::acknowledge_element(Staff_elem_info info) +{ + if (info.req_l_->melodic()) { + Melodic_req * melodic_l_ = info.req_l_->melodic(); + + if( melodic_l_->forceacc || + walk_l_->local_key_.oct(melodic_l_->octave).acc(melodic_l_->notename) + != melodic_l_->accidental) { + Item * support_l_ = info.elem_p_->item(); + + + if (!key_item_p_) { + key_item_p_ = new Local_key_item(walk_l_->clef_.c0_position_i_); + key_item_p_->c0_position = walk_l_->clef_.c0_position_i_; + } + + key_item_p_->add(melodic_l_); + key_item_p_->add(support_l_); + walk_l_->local_key_.oct(melodic_l_->octave) + .set(melodic_l_->notename, melodic_l_->accidental); + } + } +} diff --git a/src/spanner.cc b/src/spanner.cc index ad5b2e2552..15efb59071 100644 --- a/src/spanner.cc +++ b/src/spanner.cc @@ -3,6 +3,7 @@ #include "pcol.hh" NAME_METHOD(Spanner); + void Spanner::do_print()const {