]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.5.14
authorfred <fred>
Wed, 27 Mar 2002 02:03:13 +0000 (02:03 +0000)
committerfred <fred>
Wed, 27 Mar 2002 02:03:13 +0000 (02:03 +0000)
input/regression/hara-kiri-pianostaff.ly [new file with mode: 0644]
lily/align-interface.cc
lily/clef-engraver.cc
lily/include/hara-kiri-group-spanner.hh
lily/key-engraver.cc
lily/key-item.cc
lily/rhythmic-column-engraver.cc
lily/separating-group-spanner.cc
ly/grace-init.ly
scm/translator-property-description.scm

diff --git a/input/regression/hara-kiri-pianostaff.ly b/input/regression/hara-kiri-pianostaff.ly
new file mode 100644 (file)
index 0000000..786e49f
--- /dev/null
@@ -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
+  }
+ }
+}
+
index 8211c349af283717552e9abeba981fac6f614c2b..42d7846cb4a9ac28b355113628c27628c86359f2 100644 (file)
@@ -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<Real> 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);
index 4d2da95856f0c3892bbb8d4ffcf32e4b5d105949..a04db27dac52460bf75c94da01c2c4888161657e 100644 (file)
@@ -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 */       "");
index 9f1fc528db9cae8a0a3ee446973b3c6b3ed8a3e1..1b2f1b30cd6a9608abdc4e8c2063ff642c2cea51 100644 (file)
@@ -13,7 +13,6 @@
 #include "lily-guile.hh"
 #include "lily-proto.hh"
 
-
 class Hara_kiri_group_spanner 
 {
 public:
index 17ffce32374982aa04897e62d2bd7e786f145c93..445d1972656af812639fa4b9f9237191aa22811b 100644 (file)
@@ -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");
index 563910435f8d917071c1f16111c9550272f93b8a..47526b042d17236d99f4de53a4cded2b85ae92ed 100644 (file)
@@ -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)
 {
index 8c6faa3d704334bf08f8752777034d43b0730c58..ac1515162a31870c97060ce27c11392f6b1a3c33 100644 (file)
@@ -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 */       "");
index 89bceab5d4c0dce07302e9112541da72d7eb741e..f989389674047ee63cfbe12071bb4df9f1c40e4a 100644 (file)
@@ -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
   /*
index 691498d1bd00aaa847793c49a961d364684b4c80..b33942fde1ecddf0c6daffd16982b7beb810a487 100644 (file)
@@ -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
 }
index fe6c8252fde329cd6b4a17820ed11635b7ef14ae..ed548ddeeea23a26478547b9e3673588b47669e2 100644 (file)
@@ -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. "
 )