X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Flocal-key-item.cc;h=a8823c59c930f63d1d88f3b0856f8cb5d4e8ff13;hb=refs%2Ftags%2Frelease%2F1.3.9;hp=479fc4ba1d821d55abf586a9d2012298e9a4e080;hpb=82731e802565546441c401a84a13b486e54eb760;p=lilypond.git diff --git a/lily/local-key-item.cc b/lily/local-key-item.cc index 479fc4ba1d..a8823c59c9 100644 --- a/lily/local-key-item.cc +++ b/lily/local-key-item.cc @@ -20,15 +20,17 @@ Local_key_item::Local_key_item () } void -Local_key_item::add_pitch (Musical_pitch p, bool cautionary) +Local_key_item::add_pitch (Musical_pitch p, bool cautionary, bool natural) { for (int i=0; i< accidental_arr_.size(); i++) if (!Musical_pitch::compare (p, accidental_arr_[i].pitch_)) return; + /* maybe natural (and cautionary) should be modif. nonetheless? */ Local_key_cautionary_tuple t; t.pitch_ = p; t.cautionary_b_ = cautionary; + t.natural_b_ = natural; accidental_arr_.push (t); } @@ -42,9 +44,14 @@ Local_key_item::do_pre_processing() } Molecule -Local_key_item::accidental (int j, bool cautionary) const +Local_key_item::accidental (int j, bool cautionary, bool natural) const { Molecule m (lookup_l ()->afm_find (String ("accidentals-") + to_str (j))); + if (natural) + { + Molecule prefix = lookup_l ()->afm_find (String ("accidentals-0")); + m.add_at_edge(X_AXIS, LEFT, Molecule(prefix), 0); + } if (cautionary) { Molecule open = lookup_l ()->afm_find (String ("accidentals-(")); @@ -85,7 +92,9 @@ Local_key_item::do_brew_molecule_p() const (c0_position_i_ + p.notename_i_) * note_distance; - Molecule m (accidental (p.accidental_i_, accidental_arr_[i].cautionary_b_)); + Molecule m (accidental (p.accidental_i_, + accidental_arr_[i].cautionary_b_, + accidental_arr_[i].natural_b_)); m.translate_axis (dy, Y_AXIS); octave_mol_p->add_at_edge (X_AXIS, RIGHT, m, 0); @@ -101,18 +110,26 @@ Local_key_item::do_brew_molecule_p() const if (accidental_arr_.size()) { - Box b(Interval (0, 0.6 * note_distance), Interval (0,0)); - Molecule m (lookup_l ()->fill (b)); - output->add_at_edge (X_AXIS, RIGHT, m, 0); + Drul_array pads; + + /* + Use a cons? + */ + pads[RIGHT] = get_elt_property ("right-padding"); + pads[LEFT] = get_elt_property ("left-padding"); + + Direction d = LEFT; + do { + if (!gh_number_p (pads[d])) + continue; + + Box b(Interval (0, gh_scm2double (pads[d]) * note_distance), + Interval (0,0)); + Molecule m (lookup_l ()->fill (b)); + output->add_at_edge (X_AXIS, d, m, 0); + } while ( flip (&d)!= LEFT); } return output; } -void -Local_key_item::do_substitute_element_pointer (Score_element *o, Score_element*n) -{ - Note_head_side::do_substitute_element_pointer (o,n); - Staff_symbol_referencer::do_substitute_element_pointer (o,n); - -}