From: fred Date: Wed, 27 Mar 2002 02:03:13 +0000 (+0000) Subject: lilypond-1.5.14 X-Git-Tag: release/1.5.59~452 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=e2536e11a0b8230bc3b4eafd3cab0f917ed80ccd;p=lilypond.git lilypond-1.5.14 --- diff --git a/input/regression/hara-kiri-pianostaff.ly b/input/regression/hara-kiri-pianostaff.ly new file mode 100644 index 0000000000..786e49f9d8 --- /dev/null +++ b/input/regression/hara-kiri-pianostaff.ly @@ -0,0 +1,18 @@ +\header { +texidoc = "Hara kiri should not upset fixed distance alignment like in pianostaff. In this example the middle staff is harakiried." +} + + +\score { \notes \transpose c''' + \context PianoStaff < + \context Staff = up { c c c c \break } + \context Staff = mid { s1 \break } + \context Staff = down { c4 c c c \break } + > + \paper { + \translator { + \HaraKiriStaffContext + } + } +} + diff --git a/lily/align-interface.cc b/lily/align-interface.cc index 8211c349af..42d7846cb4 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -11,6 +11,7 @@ #include "grob.hh" #include "group-interface.hh" #include "axis-group-interface.hh" +#include "hara-kiri-group-spanner.hh" #include "paper-def.hh" MAKE_SCHEME_CALLBACK (Align_interface,alignment_callback,2); @@ -50,13 +51,11 @@ Align_interface::align_to_fixed_distance (Grob *me , Axis a) me->set_grob_property ("alignment-done", SCM_BOOL_T); SCM d = me->get_grob_property ("stacking-dir"); - Direction stacking_dir = gh_number_p (d) ? to_dir (d) : CENTER; if (!stacking_dir) stacking_dir = DOWN; - SCM force = me->get_grob_property ("forced-distance"); Real dy = 0.0; @@ -74,7 +73,26 @@ Align_interface::align_to_fixed_distance (Grob *me , Axis a) v.set_empty (); Array translates; - for (int j=0 ; j < elems.size (); j++) + for (int j= elems.size (); j--; ) + { + /* + This is not very elegant, in that we need special support for + hara kiri. Unfortunately, the generic wiring of + force_hara_kiri_callback () (extent and offset callback) is + such that we might get into a loop if we call extent() or + offset() the elements. + + + */ + if (a == Y_AXIS + && Hara_kiri_group_spanner::has_interface (elems[j])) + Hara_kiri_group_spanner::consider_suicide (elems[j]); + + if (!ly_pair_p (elems[j]-> immutable_property_alist_)) + elems.del(j); + } + + for (int j =0; j < elems.size (); j++) { where_f += stacking_dir * dy; translates.push (where_f); diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index 4d2da95856..a04db27dac 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -83,16 +83,6 @@ Clef_engraver::acknowledge_grob (Grob_info info) && gh_string_p (get_property ("clefGlyph"))) create_clef (); - if (Key_item::has_interface (item)) - { - /* - Key_item adapts its formatting to make sure that the - accidentals stay in the upper half of the staff. It needs - to know c0-pos for this. (?) - */ - - item->set_grob_property ("c0-position", get_property ("centralCPosition")); - } } } @@ -204,6 +194,6 @@ Clef_engraver::start_translation_timestep () ENTER_DESCRIPTION(Clef_engraver, /* descr */ "Determine and set reference point for pitches", /* creats*/ "Clef OctavateEight", -/* acks */ "bar-line-interface key-interface", +/* acks */ "bar-line-interface", /* reads */ "clefPosition clefGlyph centralCPosition clefOctavation explicitClefVisibility", /* write */ ""); diff --git a/lily/include/hara-kiri-group-spanner.hh b/lily/include/hara-kiri-group-spanner.hh index 9f1fc528db..1b2f1b30cd 100644 --- a/lily/include/hara-kiri-group-spanner.hh +++ b/lily/include/hara-kiri-group-spanner.hh @@ -13,7 +13,6 @@ #include "lily-guile.hh" #include "lily-proto.hh" - class Hara_kiri_group_spanner { public: diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index 17ffce3237..445d197265 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -26,14 +26,12 @@ class Key_engraver : public Engraver { void create_key (bool); void read_req (Key_change_req const * r); + Key_change_req * keyreq_l_; + Item * item_p_; public: TRANSLATOR_DECLARATIONS(Key_engraver); - Key_change_req * keyreq_l_; - Item * item_p_; - Protected_scm old_accs_; // ugh. -> property - protected: virtual void initialize (); virtual void finalize (); @@ -48,15 +46,16 @@ protected: void Key_engraver::finalize () { - old_accs_ = SCM_EOL; // unprotect can not be called from dtor. } + Key_engraver::Key_engraver () { keyreq_l_ = 0; item_p_ = 0; } + void Key_engraver::create_key (bool def) { @@ -64,20 +63,18 @@ Key_engraver::create_key (bool def) { item_p_ = new Item (get_property ("KeySignature")); - item_p_->set_grob_property ("c0-position", gh_int2scm (0)); - + item_p_->set_grob_property ("c0-position", + get_property ("centralCPosition")); + // todo: put this in basic props. - item_p_->set_grob_property ("old-accidentals", old_accs_); + item_p_->set_grob_property ("old-accidentals", get_property ("lastKeySignature")); item_p_->set_grob_property ("new-accidentals", get_property ("keySignature")); Staff_symbol_referencer::set_interface (item_p_); Key_item::set_interface (item_p_); - - announce_grob (item_p_,keyreq_l_); } - if (!def) { SCM vis = get_property ("explicitKeySignatureVisibility"); @@ -106,6 +103,7 @@ Key_engraver::try_music (Music * req_l) return false; } + void Key_engraver::acknowledge_grob (Grob_info info) { @@ -122,21 +120,21 @@ Key_engraver::acknowledge_grob (Grob_info info) { create_key (true); } - } + void Key_engraver::create_grobs () { - if (keyreq_l_ || old_accs_ != get_property ("keySignature")) - { - create_key (false); - } + if (keyreq_l_ || + get_property ("lastKeySignature") != get_property ("keySignature")) + create_key (false); } + void Key_engraver::stop_translation_timestep () -{ +{ if (item_p_) { typeset_grob (item_p_); @@ -144,6 +142,7 @@ Key_engraver::stop_translation_timestep () } } + void Key_engraver::read_req (Key_change_req const * r) { @@ -162,34 +161,36 @@ Key_engraver::read_req (Key_change_req const * r) n = scm_delete_x (ly_car (s), n); } } + for (SCM s = n ; gh_pair_p (s); s = ly_cdr (s)) if (gh_scm2int (ly_cdar (s))) accs = gh_cons (ly_car (s), accs); - old_accs_ = get_property ("keySignature"); + daddy_trans_l_->set_property ("lastKeySignature", + get_property ("keySignature")); daddy_trans_l_->set_property ("keySignature", accs); } + void Key_engraver::start_translation_timestep () { keyreq_l_ = 0; - old_accs_ = get_property ("keySignature"); + daddy_trans_l_->set_property ("lastKeySignature", get_property ("keySignature")); } + void Key_engraver::initialize () { daddy_trans_l_->set_property ("keySignature", SCM_EOL); - old_accs_ = SCM_EOL; + daddy_trans_l_->set_property ("lastKeySignature", SCM_EOL); } - - ENTER_DESCRIPTION(Key_engraver, /* descr */ "", /* creats*/ "KeySignature", /* acks */ "bar-line-interface clef-interface", -/* reads */ "keySignature explicitKeySignatureVisibility createKeyOnClefChange keyAccidentalOrder keySignature", -/* write */ ""); +/* reads */ "keySignature lastKeySignature explicitKeySignatureVisibility createKeyOnClefChange keyAccidentalOrder keySignature", +/* write */ "lastKeySignature"); diff --git a/lily/key-item.cc b/lily/key-item.cc index 563910435f..47526b042d 100644 --- a/lily/key-item.cc +++ b/lily/key-item.cc @@ -95,11 +95,16 @@ Key_item::brew_molecule (SCM smob) SCM newas = me->get_grob_property ("new-accidentals"); Molecule mol; + + SCM c0s = me->get_grob_property ("c0-position"); + int c0p=0; + if (gh_number_p (c0s)) + c0p = gh_scm2int (c0s); + /* SCM lists are stacks, so we work from right to left, ending with the cancellation signature. */ - int c0p = gh_scm2int (me->get_grob_property ("c0-position")); for (SCM s = newas; gh_pair_p (s); s = ly_cdr (s)) { @@ -154,10 +159,6 @@ Key_item::brew_molecule (SCM smob) return mol.smobbed_copy (); } - - - - bool Key_item::has_interface (Grob*m) { diff --git a/lily/rhythmic-column-engraver.cc b/lily/rhythmic-column-engraver.cc index 8c6faa3d70..ac1515162a 100644 --- a/lily/rhythmic-column-engraver.cc +++ b/lily/rhythmic-column-engraver.cc @@ -122,6 +122,6 @@ Rhythmic_column_engraver::start_translation_timestep () ENTER_DESCRIPTION(Rhythmic_column_engraver, /* descr */ "Generates NoteColumn, an objects that groups stems, noteheads and rests.", /* creats*/ "NoteColumn", -/* acks */ "stem-interface note-head-interface dot-column-interface", +/* acks */ "stem-interface rhythmicb-head-interface dot-column-interface", /* reads */ "", /* write */ ""); diff --git a/lily/separating-group-spanner.cc b/lily/separating-group-spanner.cc index 89bceab5d4..f989389674 100644 --- a/lily/separating-group-spanner.cc +++ b/lily/separating-group-spanner.cc @@ -95,7 +95,6 @@ Separating_group_spanner::set_spacing_rods (SCM smob) if (rb) find_rods (rb, ly_cdr (s)); } - find_musical_sequences (me); #if 0 /* diff --git a/ly/grace-init.ly b/ly/grace-init.ly index 691498d1bd..b33942fde1 100644 --- a/ly/grace-init.ly +++ b/ly/grace-init.ly @@ -26,6 +26,7 @@ startGraceMusic = { } stopGraceMusic = { + \property Staff.Accidentals \revert #'font-relative-size \property Voice.Beam \revert #'space-function \property Voice.Beam \revert #'thickness @@ -41,5 +42,4 @@ stopGraceMusic = { % be smaller as well. \property Voice.fontSize \unset - \property Staff.LocalKeyItem \revert #'font-relative-size } diff --git a/scm/translator-property-description.scm b/scm/translator-property-description.scm index fe6c8252fd..ed548ddeee 100644 --- a/scm/translator-property-description.scm +++ b/scm/translator-property-description.scm @@ -210,6 +210,9 @@ The format is (NAME . ALTER), where NAME is from 0 .. 6 and ALTER from -1, 1. ") (translator-property-description 'keySignature list? "The current key signature. This is an alist containing (NAME . ALTER) or ((OCTAVE . NAME) . ALTER) pairs, where NAME is from 0.. 6 and ALTER from -2,-1,0,1,2 ") +(translator-property-description 'lastKeySignature list? "Last key +signature before a key signature change.") + (translator-property-description 'localKeySignature list? "the key signature at this point in the measure. The format is the same as for keySignature. " )