]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.3.132.jcn3
authorJan Nieuwenhuizen <janneke@gnu.org>
Tue, 27 Feb 2001 16:02:18 +0000 (17:02 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Tue, 27 Feb 2001 16:02:18 +0000 (17:02 +0100)
1.3.132.jcn3
============

* Another attempt af fixing accidentals, still no luck.

CHANGES
VERSION
lily/include/local-key-item.hh
lily/local-key-engraver.cc
lily/local-key-item.cc
scm/grob-description.scm

diff --git a/CHANGES b/CHANGES
index 6e0a021df94f6a095056fb33c63d99b040e85019..8a8a97caae517f9e06d5639bd77ab9ba18fb2e1b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+1.3.132.jcn3
+============
+
+* Another attempt af fixing accidentals, still no luck.
+
 1.3.132.jcn2
 ============
 
diff --git a/VERSION b/VERSION
index eafe9e8a39a2fb98b92b02574bd60afca5bc659f..f3ad2741c8ca661dd33607218c1c32361ccd6891 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
 PATCH_LEVEL=132
-MY_PATCH_LEVEL=jcn2
+MY_PATCH_LEVEL=jcn3
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
index e0f781c881f4fb28d72dbcdb3385ca4f9498c63f..e1372cf175cf97c2c8e9df4dcc635bebcdbb7010 100644 (file)
@@ -15,8 +15,9 @@ class Local_key_item
 {
   static Molecule parenthesize (Grob*me, Molecule) ;
 public:
-  DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
-  static void add_pitch (Grob*me, Pitch, bool cautionary, bool natural);
+  DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
+  DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
+  static void add_pitch (Grob*me, Pitch, bool cautionary, bool natural, Grob *tie_break_cautionary);
   static bool has_interface (Grob*);
   static void set_interface (Grob*);  
 };
index e473c5a5abb7b463ab66adac05cbe6a373ea5544..7a80d7a6c2af05b9cf9610546266db5dadce46e6 100644 (file)
@@ -98,40 +98,31 @@ 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;
 
-         /*
-           Find if we're
-           a. at right end of a tie -> tie_changes := different
-           b. at right end of broken tie -> tie_broken
-
-           Ugh: we're never case b., even when tie should be broken,
-           are we maybe called *before* line breaking?
-          */
-         bool tie_broken = false;
+         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;
-               Spanner *sp = dynamic_cast<Spanner*> (tie_l_arr_[i]);
-               if (!Tie::head (tie_l_arr_[i], LEFT)
-                   || (sp && sp->broken_into_l_arr_.size ()
-                       && !Tie::head (sp->broken_into_l_arr_[0], LEFT)))
-                 tie_broken = true;
+#if 0
+               // don't do this, yet.  the accidentals can't be
+               // deleted, yet.
+               tie_break_cautionary = tie_l_arr_[i];
+#endif
                break;
              }
 
-         /*
-           Some comment here.
-           When do we want ties:
+         /* When do we want accidentals:
 
-             1. when property force-accidental is set, and not tie_changes
-             2. when different and not tie-changes
-             3. always after a line break -> why doesn't this work?
-           */
+            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_broken)
+             || tie_break_cautionary)
            {
              if (!key_item_p_) 
                {
@@ -151,7 +142,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);
            }
          
index e815098effcb3929302390a99c006e6fa0e7715a..e2a9ead6cb8010637dc83f96d9cc203019af177b 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,41 @@ 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->broken_into_l_arr_.size ())
+           {
+             /* there should be a better way to delete me */
+             scm_set_car_x (s, gh_list (gh_caar (s),
+                                        ly_symbol2scm ("deleted"),
+                                        SCM_UNDEFINED));
+           }
+       }
+    }
+  
+  return SCM_UNSPECIFIED;
+}
+
 /*
   UGH. clean me, revise placement routine (See Ross & Wanske;
   accidental placement is more complicated than this.
@@ -85,6 +129,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 5c9e37c15137921e50e9d8cff8b91def71f59d0f..f9bbfab167689e876fa294f2f46887cef67f4173 100644 (file)
        (Accidentals . (
                (molecule-callback . ,Local_key_item::brew_molecule)
                (X-offset-callbacks . (,Side_position::aligned_side))
+               (after-line-breaking-callback . ,Local_key_item::after_line_breaking)
                (direction . -1)
                (left-padding . 0.2)
                (right-padding . 0.4)