]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.133
authorfred <fred>
Wed, 27 Mar 2002 00:56:40 +0000 (00:56 +0000)
committerfred <fred>
Wed, 27 Mar 2002 00:56:40 +0000 (00:56 +0000)
input/trip.ly
lily/local-key-engraver.cc
lily/local-key-item.cc
scm/ps.scm

index f69c193fea19ee550c5f7219c1fc5f918cfe1907..53b5cb9cded928c3cb5c7224c7c3f1b3a2fac9b3 100644 (file)
@@ -196,11 +196,16 @@ fugaIIPedal =  \notes \relative c {
 
   %13
   r4 fis,4-\ltoe e4.-\lheel e'8-\rheel | 
-  fis4.-\rtoe fis8-\rtoe fis4-\rtoe [e8-\ltoe a-\rtoe] | 
+% tie accs: 2nd should get no acc
+f4-\rtoe~ f8
+fis8-\rtoe fis4-\rtoe [e8-\ltoe a-\rtoe] | 
   dis,4-\ltoe gis-\rtoe [cis,8-\ltoe
     (
-     b!-\lheel ais-\rtoe gis-\ltoe ~ ] |
-      gis8  r4.
+     b!-\lheel ais-\rtoe g-\ltoe ~ ] |
+
+% tie should generate acc.
+\break
+      g  r4.
     )
       c2^^^-^\f 
  \time 3/4;
index 0337c55b6f2cbf000e43994ade3016dd7342f76e..fe1ee8b0d704ae04f7b7a38f6791631180c573b6 100644 (file)
@@ -51,7 +51,7 @@ public:
   Link_array<Note_req> mel_l_arr_;
   Link_array<Grob> support_l_arr_;
   Link_array<Item> forced_l_arr_;
-  Link_array<Grob> tied_l_arr_;
+  Link_array<Grob> tie_l_arr_;
   Local_key_engraver();
 
   Item * grace_align_l_;
@@ -98,9 +98,30 @@ Local_key_engraver::create_grobs ()
          bool different = !gh_equal_p(prev_acc , gh_int2scm(a));
          int p = gh_number_p(prev_acc) ? gh_scm2int(prev_acc) : 0;
 
-         bool tie_changes = tied_l_arr_.find_l (support_l) && different;
-         if ((to_boolean (note_l->get_mus_property ("force-accidental"))
-             || different) && !tie_changes)
+         Grob *tie_break_cautionary = 0;
+         bool tie_changes = false;
+         for (int i=0; i < tie_l_arr_.size (); i++)
+           if (support_l == Tie::head (tie_l_arr_[i], RIGHT))
+             {
+               tie_changes = different;
+#if 1
+               /* Enable accidentals for broken tie */
+               tie_break_cautionary = tie_l_arr_[i];
+#endif
+               break;
+             }
+
+         /* When do we want accidentals:
+
+            1. when property force-accidental is set, and not
+            tie_changes
+            2. when different and not tie-changes
+            3. maybe when at end of a tie: we must later see if
+            we're after a line break */
+         if (((to_boolean (note_l->get_mus_property ("force-accidental"))
+               || different)
+              && !tie_changes)
+             || tie_break_cautionary)
            {
              if (!key_item_p_) 
                {
@@ -120,7 +141,8 @@ Local_key_engraver::create_grobs ()
 
              Local_key_item::add_pitch (key_item_p_, *unsmob_pitch (note_l->get_mus_property ("pitch")),
                                         to_boolean (note_l->get_mus_property ("cautionary")),
-                                        extra_natural);
+                                        extra_natural,
+                                        tie_break_cautionary);
              Side_position::add_support (key_item_p_,support_l);
            }
          
@@ -138,6 +160,7 @@ Local_key_engraver::create_grobs ()
              /*
                Remember an alteration that is different both from
                that of the tied note and of the key signature.
+
               */
              localsig = scm_assoc_set_x (localsig, gh_cons (gh_int2scm (o),
                                                             gh_int2scm (n)),
@@ -206,7 +229,7 @@ Local_key_engraver::stop_translation_timestep()
   grace_align_l_ = 0;
   mel_l_arr_.clear();
   arpeggios_.clear ();
-  tied_l_arr_.clear();
+  tie_l_arr_.clear ();
   support_l_arr_.clear();
   forced_l_arr_.clear();       
 }
@@ -236,7 +259,7 @@ Local_key_engraver::acknowledge_grob (Grob_info info)
     }
   else if (Tie::has_interface (info.elem_l_))
     {
-      tied_l_arr_.push (Tie::head (info.elem_l_, RIGHT));
+      tie_l_arr_.push (info.elem_l_);
     }
   else if (Arpeggio::has_interface (info.elem_l_))
     {
index e815098effcb3929302390a99c006e6fa0e7715a..700535e0156ba9d7cdf38af5175ff8785a47e20d 100644 (file)
@@ -13,6 +13,8 @@
 #include "musical-request.hh"
 #include "rhythmic-head.hh"
 #include "misc.hh"
+#include "spanner.hh"
+#include "tie.hh"
 #include "lookup.hh"
 
 static SCM
@@ -33,7 +35,8 @@ ADD_SCM_INIT_FUNC(lkpitch,init_pitch_funcs);
 
 
 void
-Local_key_item::add_pitch (Grob*me, Pitch p, bool cautionary, bool natural)
+Local_key_item::add_pitch (Grob*me, Pitch p, bool cautionary, bool natural,
+                          Grob* tie_break_cautionary)
 {
   SCM acs = me->get_grob_property ("accidentals");
   SCM pitch = p.smobbed_copy ();
@@ -42,6 +45,12 @@ Local_key_item::add_pitch (Grob*me, Pitch p, bool cautionary, bool natural)
     opts = gh_cons (ly_symbol2scm ("cautionary"), opts);
   if (natural)
     opts = gh_cons (ly_symbol2scm ("natural"), opts);
+  if (tie_break_cautionary)
+    {
+      /* Ugh, these 'options' can't have a value, faking... */
+      opts = gh_cons (tie_break_cautionary->self_scm (), opts);
+      opts = gh_cons (ly_symbol2scm ("tie-break-cautionary"), opts);
+    }
 
   pitch = gh_cons (pitch, opts);
   acs = scm_merge_x (acs, gh_cons (pitch, SCM_EOL), pitch_less_proc);
@@ -60,6 +69,42 @@ Local_key_item::parenthesize (Grob*me, Molecule m)
   return m;
 }
 
+/*
+  HW says: move to tie.cc
+
+  Ugh: this doesn't work: brew_molecule is called before line-breaking
+ */ 
+MAKE_SCHEME_CALLBACK (Local_key_item, after_line_breaking, 1);
+SCM
+Local_key_item::after_line_breaking (SCM smob)
+{
+  Grob *me = unsmob_grob (smob);
+
+  SCM accs = me->get_grob_property ("accidentals");
+  for  (SCM s = accs;
+       gh_pair_p (s); s = gh_cdr (s))
+    {
+      SCM opts = gh_cdar (s);
+
+      SCM t = scm_memq (ly_symbol2scm ("tie-break-cautionary"), opts);
+      if (t != SCM_BOOL_F)
+       {
+         Grob *tie = unsmob_grob (gh_cadr (t));
+         Spanner *sp = dynamic_cast<Spanner*> (tie);
+         if (!sp->original_l_)
+           {
+             /* there should be a better way to delete me */
+             scm_set_car_x (s, gh_list (gh_caar (s),
+                                        ly_symbol2scm ("deleted"),
+                                        SCM_UNDEFINED));
+             me->set_grob_property ("molecule", SCM_EOL);
+           }
+       }
+    }
+  
+  return SCM_UNSPECIFIED;
+}
+
 /*
   UGH. clean me, revise placement routine (See Ross & Wanske;
   accidental placement is more complicated than this.
@@ -85,6 +130,9 @@ Local_key_item::brew_molecule (SCM smob)
       Pitch p (*unsmob_pitch (gh_caar (s)));
       SCM opts = gh_cdar (s);
       
+      if (scm_memq (ly_symbol2scm ("deleted"), opts) != SCM_BOOL_F)
+       continue;
+      
       // do one octave
       if (p.octave_i ()  != lastoct) 
        {
index b80308eb625f31e9be904b70bc19a2511a5a03e2..d4442ecb39176ef2320d77399a105af4c018b4d8 100644 (file)
@@ -191,6 +191,26 @@ lilypondpaperoutputscale lilypondpaperoutputscale scale
   (define (unknown) 
     "\n unknown\n")
 
+;; note heads with letters.
+  (define (ez-ball ch letter-col ball-col)
+    (string-append "
+/Helvetica-Bold findfont
+0.7 scalefont 
+setfont 
+0.1 setlinewidth  
+ 0 0 moveto
+0 setgray
+0.5 0 0.5 0 360  arc
+closepath "
+                  (if (equal? ball-col 0) " fill " " stroke ")
+                  (number->string letter-col)
+                  "
+setgray
+% 0.25 is empiric centering. Change to taste
+0.25 -0.25 moveto
+ (" ch ") show
+showpage ")
+    )
 
   (define (define-origin a b c ) "")
   (define (no-origin) "")
@@ -228,6 +248,7 @@ lilypondpaperoutputscale lilypondpaperoutputscale scale
            (define text ,text)
            (define no-origin ,no-origin)
            (define define-origin ,define-origin)
+           (define ez-ball ,ez-ball)
            ))
        ((eq? action-name 'tuplet) tuplet)
        ((eq? action-name 'beam) beam)
@@ -240,6 +261,7 @@ lilypondpaperoutputscale lilypondpaperoutputscale scale
        ((eq? action-name 'decrescendo) decrescendo)
        ((eq? action-name 'experimental-on) experimental-on)
        ((eq? action-name 'filledbox) filledbox)
+       ((eq? action-name 'ez-ball) ez-ball)    
        ((eq? action-name 'select-font) select-font)
        ((eq? action-name 'volta) volta)
        (else (error "unknown tag -- PS-SCM " action-name))