From 10c572782a3ee5dfdf1594be4a8836b856e641fc Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 11 Feb 1997 19:27:23 +0000 Subject: [PATCH] lilypond-0.0.30 --- hdr/staffsym.hh | 30 ++++++++++++++++++++++++++++ src/clef.cc | 55 +++++++++++++++++++++++++++++---------------------- src/localkeyreg.cc | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/spanner.cc | 1 + 4 files changed, 121 insertions(+), 23 deletions(-) create mode 100644 hdr/staffsym.hh rewrite src/clef.cc (85%) create mode 100644 src/localkeyreg.cc 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 dissimilarity index 85% index d0fcbe09d9..bf7b924159 100644 --- a/src/clef.cc +++ b/src/clef.cc @@ -1,23 +1,32 @@ -#include "clef.hh" - -Clef::Clef() -{ - clef_type= "violin"; - c0_pos = -2; -} - -void -Clef::read(Arrayargs) -{ - 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; - } else - assert(false); -} +/* + 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() +{ + set_type("violin"); +} + +void +Clef::set_type(String type_str) +{ + 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 + error("unknown clef type `"+clef_type_str_+"\'"); +} 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 { -- 2.11.4.GIT