From: fred Date: Sun, 24 Mar 2002 19:40:40 +0000 (+0000) Subject: lilypond-0.0.64 X-Git-Tag: release/1.5.59~4876 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=2117c91861ceebdde1c29e40e75d9af4170dc350;p=lilypond.git lilypond-0.0.64 --- diff --git a/lily/include/local-key-item.hh b/lily/include/local-key-item.hh index dd4ae4b736..2371277bb0 100644 --- a/lily/include/local-key-item.hh +++ b/lily/include/local-key-item.hh @@ -10,7 +10,9 @@ #include "varray.hh" struct Local_acc { - int name , acc, octave; + int name_i_; + int accidental_i_; + int octave_i_; static int compare(Local_acc&, Local_acc&); }; diff --git a/lily/local-key-item.cc b/lily/local-key-item.cc index 6a658b64c2..f6d8b9ba7f 100644 --- a/lily/local-key-item.cc +++ b/lily/local-key-item.cc @@ -1,3 +1,11 @@ +/* + local-key-item.cc -- implement Local_key_item, Local_acc + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + #include "local-key-item.hh" #include "molecule.hh" #include "scalar.hh" @@ -26,13 +34,18 @@ Local_key_item::add(Melodic_req*m_l) { add(m_l->octave_i_, m_l->notename_i_, m_l->accidental_i_); } + void Local_key_item::add (int o, int p , int a) { Local_acc l; - l.octave = o; - l.name = p; - l.acc = a; + l.octave_i_ = o; + l.name_i_ = p; + l.accidental_i_ = a; + for (int i=0; i< accs.size(); i++) + if (!Local_acc::compare(l, accs[i])) + return; + accs.push(l); } @@ -50,7 +63,7 @@ Local_key_item::brew_molecule_p()const int lastoct = -100; for (int i = 0; i < accs.size(); i++) { // do one octave - if (accs[i].octave != lastoct) { + if (accs[i].octave_i_ != lastoct) { if (octmol){ Real dy =lastoct*7*paper()->internote(); octmol->translate(Offset(0, dy)); @@ -59,10 +72,10 @@ Local_key_item::brew_molecule_p()const } octmol= new Molecule; } - lastoct = accs[i].octave; - Symbol s =paper()->lookup_l()->accidental(accs[i].acc); + lastoct = accs[i].octave_i_; + Symbol s =paper()->lookup_l()->accidental(accs[i].accidental_i_); Atom a(s); - Real dy = (accs[i].name + c0_position) * paper()->internote(); + Real dy = (accs[i].name_i_ + c0_position) * paper()->internote(); a.translate(Offset(0,dy)); octmol->add_right(a); @@ -84,11 +97,11 @@ Local_key_item::brew_molecule_p()const int Local_acc::compare(Local_acc&a, Local_acc&b) { - if (a.octave - b.octave) - return a.octave - b.octave; - if (a.name - b.name) - return a.name - b.name; + if (a.octave_i_ - b.octave_i_) + return a.octave_i_ - b.octave_i_; + if (a.name_i_ - b.name_i_) + return a.name_i_ - b.name_i_; - assert(false); + return a.accidental_i_ - b.accidental_i_; }; IMPLEMENT_STATIC_NAME(Local_key_item);