]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/instrument-name-engraver.cc (stop_translation_timestep):
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 5 Feb 2006 00:23:21 +0000 (00:23 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 5 Feb 2006 00:23:21 +0000 (00:23 +0000)
hack: add to axis group if not added yet. This fixes hara kiri'd
piano staves.

* lily/hara-kiri-group-spanner.cc
(force_hara_kiri_in_y_parent_callback): fix signatures.

* lily/hairpin.cc (print): check next hairpin to see whether or
not to be continuing.

ChangeLog
lily/align-interface.cc
lily/hairpin.cc
lily/hara-kiri-engraver.cc
lily/hara-kiri-group-spanner.cc
lily/include/hairpin.hh
lily/include/hara-kiri-group-spanner.hh
lily/instrument-name-engraver.cc
lily/vertical-align-engraver.cc
scm/define-grobs.scm

index fd68c9f1ba52f4e4b5d7cdeec29fadbe5079c125..5cce661c16a8701c4af037e096098411045f967e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2006-02-05  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * lily/instrument-name-engraver.cc (stop_translation_timestep):
+       hack: add to axis group if not added yet. This fixes hara kiri'd
+       piano staves.
+
+       * lily/hara-kiri-group-spanner.cc
+       (force_hara_kiri_in_y_parent_callback): fix signatures.
+
+       * lily/hairpin.cc (print): check next hairpin to see whether or
+       not to be continuing.
+
 2006-02-04  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * Remove trailing whitespace from makefiles.
index 26d8d811438a8903a6945a1bd99e472afe762465..6faaa013c075f5f0345f1f6889e00eddfd2baca7 100644 (file)
@@ -49,6 +49,7 @@ Align_interface::stretch_after_break (SCM grob)
 
   Spanner *me_spanner = dynamic_cast<Spanner *> (me);
   extract_grob_set (me, "elements", elems);
+
   if (me_spanner && elems.size ())
     {
       Grob *common = common_refpoint_of_array (elems, me, Y_AXIS);
index f3911339af2cd3f4d2ae514fef47550ebff2f473..addd26b1c25e7aa568da8f180f836e4e67805086 100644 (file)
@@ -26,7 +26,14 @@ SCM
 Hairpin::after_line_breaking (SCM smob)
 {
   Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob));
+  consider_suicide (me);
 
+  return SCM_UNSPECIFIED;
+}
+
+void
+Hairpin::consider_suicide (Spanner*me)
+{
   Drul_array<bool> broken;
   Drul_array<Item *> bounds;
   Direction d = LEFT;
@@ -41,7 +48,7 @@ Hairpin::after_line_breaking (SCM smob)
       && ly_is_equal (bounds[RIGHT]->get_column ()->get_property ("when"),
                      bounds[LEFT]->get_property ("when")))
     me->suicide ();
-  return SCM_UNSPECIFIED;
+  
 }
 
 MAKE_SCHEME_CALLBACK (Hairpin, print, 1);
@@ -51,6 +58,7 @@ Hairpin::print (SCM smob)
 {
   Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob));
 
+  consider_suicide (me);
   SCM s = me->get_property ("grow-direction");
   if (!is_direction (s))
     {
@@ -70,6 +78,18 @@ Hairpin::print (SCM smob)
       broken[d] = bounds[d]->break_status_dir () != CENTER;
     }
   while (flip (&d) != LEFT);
+  if (broken[RIGHT])
+    {
+      Spanner *orig = dynamic_cast<Spanner*> (me->original ());
+      if (me->get_break_index ()
+         < orig->broken_intos_.size () - 1)
+       {
+         Spanner *next = orig->broken_intos_[me->get_break_index () + 1];
+         Stencil *s = next->get_stencil ();
+         if (!s || s->is_empty ())
+           broken[RIGHT] = false;
+       }
+    }
 
   Grob *common = bounds[LEFT]->common_refpoint (bounds[RIGHT], X_AXIS);
   Drul_array<Real> x_points;
index 48139aeb94d04e5404a80b097884601951056c22..39cc48a90bcbbd62d8144aac7833d4e64b5ee722 100644 (file)
@@ -30,6 +30,12 @@ public:
   TRANSLATOR_DECLARATIONS (Hara_kiri_engraver);
 };
 
+
+Hara_kiri_engraver::Hara_kiri_engraver ()
+{
+  interesting_ = SCM_EOL;
+}
+
 void
 Hara_kiri_engraver::derived_mark () const
 {
@@ -70,10 +76,6 @@ Hara_kiri_engraver::acknowledge_grob (Grob_info i)
     }
 }
 
-Hara_kiri_engraver::Hara_kiri_engraver ()
-{
-  interesting_ = SCM_EOL;
-}
 
 ADD_ACKNOWLEDGER (Hara_kiri_engraver, grob);
 ADD_TRANSLATOR (Hara_kiri_engraver,
index 1c5b92c05431c5382e63db092a23057e75e5f200..04fe1714280cbc337e5ecc618700ec4722b95462 100644 (file)
@@ -58,26 +58,30 @@ Hara_kiri_group_spanner::consider_suicide (Grob *me)
   We can't rely on offsets and dimensions of elements in a hara-kiri
   group. Use a callback to make sure that hara-kiri has been done
   before asking for offsets.  */
-MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, force_hara_kiri_callback, 2);
+MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, after_line_breaking, 1);
 SCM
-Hara_kiri_group_spanner::force_hara_kiri_callback (SCM smob, SCM axis)
+Hara_kiri_group_spanner::after_line_breaking (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
-  (void) axis;
+  consider_suicide (me);
+  return SCM_UNSPECIFIED;
+}
 
-  assert (scm_to_int (axis) == Y_AXIS);
+MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, force_hara_kiri_callback, 1);
+SCM
+Hara_kiri_group_spanner::force_hara_kiri_callback (SCM smob)
+{
+  Grob *me = unsmob_grob (smob);
   consider_suicide (me);
   return scm_from_double (0.0);
 }
 
-MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, force_hara_kiri_in_parent_callback, 2);
+MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, force_hara_kiri_in_y_parent_callback, 1);
 SCM
-Hara_kiri_group_spanner::force_hara_kiri_in_parent_callback (SCM smob, SCM axis)
+Hara_kiri_group_spanner::force_hara_kiri_in_y_parent_callback (SCM smob)
 {
   Grob *daughter = unsmob_grob (smob);
-  Axis a = (Axis) scm_to_int (axis);
-  assert (a == Y_AXIS);
-  force_hara_kiri_callback (daughter->get_parent (a)->self_scm (), axis);
+  force_hara_kiri_callback (daughter->get_parent (Y_AXIS)->self_scm ());
   return scm_from_double (0.0);
 }
 
index 73570c73704d6fd5facccce6cf079f908944e8a5..521fad1e4cdb84ee3ee6463a09ddbe755e57c50d 100644 (file)
@@ -19,6 +19,7 @@ struct Hairpin
 public:
   DECLARE_SCHEME_CALLBACK (print, (SCM));
   DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
+  static void consider_suicide (Spanner*);
   static bool has_interface (Grob *);
 };
 
index df0a66151b7945b01445d82c3742dd0dea18460c..9533216be80da38173bc77c939b46eeb5868b3ac 100644 (file)
 class Hara_kiri_group_spanner
 {
 public:
-  DECLARE_SCHEME_CALLBACK (force_hara_kiri_callback, (SCM, SCM));
+  DECLARE_SCHEME_CALLBACK (force_hara_kiri_callback, (SCM));
   DECLARE_SCHEME_CALLBACK (y_extent, (SCM smob));
-  DECLARE_SCHEME_CALLBACK (force_hara_kiri_in_parent_callback, (SCM, SCM));
+  DECLARE_SCHEME_CALLBACK (force_hara_kiri_in_y_parent_callback, (SCM));
+  DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
   static bool has_interface (Grob *);
   static void consider_suicide (Grob *me);
   static void add_interesting_item (Grob *me, Grob *n);
index 288a68b5a73e88849ac97f11fa6fa399996001c6..0620ae8cfb77016d9549ed481539aca08881bcaf 100644 (file)
@@ -54,8 +54,19 @@ Instrument_name_engraver::stop_translation_timestep ()
 {
   if (text_)
     {
+      SCM support = get_property ("instrumentSupport");
       text_->set_object ("side-support-elements",
-                        grob_list_to_grob_array (get_property ("instrumentSupport")));
+                        grob_list_to_grob_array (support));
+
+      /*
+       Hack to get texts on piano staves to disappear.
+       */
+      if (!text_->get_parent (Y_AXIS)
+         && scm_is_pair (support))
+       {
+         Axis_group_interface::add_element (unsmob_grob (scm_car (support)),
+                                            text_);
+       }
       text_ = 0;
     }
 
@@ -113,13 +124,15 @@ Instrument_name_engraver::acknowledge_axis_group (Grob_info info)
   */
   if (dynamic_cast<Spanner *> (info.grob ())
       && ((Axis_group_interface::has_interface (info.grob ())
-          && Axis_group_interface::has_axis (info.grob (), Y_AXIS)))
-      && !Align_interface::has_interface (info.grob ()))
+          && Axis_group_interface::has_axis (info.grob (), Y_AXIS))))
     {
-      SCM nl = scm_cons (info.grob ()->self_scm (),
-                        get_property ("instrumentSupport"));
+      if (!Align_interface::has_interface (info.grob ()))
+       {
+         SCM nl = scm_cons (info.grob ()->self_scm (),
+                            get_property ("instrumentSupport"));
 
-      context ()->set_property ("instrumentSupport", nl);
+         context ()->set_property ("instrumentSupport", nl);
+       }
     }
 }
 
index 2b2930e9b17dbf2511ff635cdc49af39fc4a127f..d6f9ef5486b5219735df1def26cd89c873784758 100644 (file)
@@ -113,7 +113,7 @@ Vertical_align_engraver::acknowledge_axis_group (Grob_info i)
       Grob *after_grob = unsmob_grob (after);
 
       Align_interface::add_element (valign_, i.grob ());
-
+       
       if (before_grob || after_grob)
        {
          Grob_array *ga = unsmob_grob_array (valign_->get_object ("elements"));
index ea41007c0aee909e9cf0658e16a5f5313378f443..4d491af89e9e949808c8ad1a142db987643bc8ef 100644 (file)
      . (
        (breakable . #t)
        (stacking-dir . 1)
-
        (positioning-done . ,ly:break-align-interface::calc-positioning-done)
        (X-extent . ,ly:axis-group-interface::width)
-                                       
        (break-align-orders . ;; end of line
                            #((instrument-name
                               left-edge
     (BreakAlignGroup
      . (
        (axes . (0))
-
        (X-extent . ,ly:axis-group-interface::width)
-
        (meta . ((class . Item)
                 (interfaces . (break-aligned-interface
                                axis-group-interface))))))
     (InstrumentName
      . (
        (breakable . #t)
-       (Y-offset . ,(ly:make-simple-closure `(,+ ,(ly:make-simple-closure (list ly:self-alignment-interface::y-aligned-on-self))
-                                                 ,(ly:make-simple-closure (list ly:side-position-interface::y-aligned-on-support-refpoints)))))
+       (Y-offset . ,(ly:make-simple-closure
+                     `(,+ ,(ly:make-simple-closure
+                            (list ly:self-alignment-interface::y-aligned-on-self))
+                          ,(ly:make-simple-closure
+                            (list ly:side-position-interface::y-aligned-on-support-refpoints)))))
        
        ;; This direction is for aligned_on_support_refpoints
        ;; (?) --hwn
 
     (MetronomeMark
      . (
-
        (stencil . ,ly:text-interface::print)
-
        (Y-offset . ,ly:side-position-interface::y-aligned-side)
        (direction . ,UP)
        (padding . 0.8)
      . (
        (axes . (1))
        (Y-offset . ,ly:hara-kiri-group-spanner::force-hara-kiri-callback)
+
        (Y-extent . ,ly:hara-kiri-group-spanner::y-extent)
        (X-extent . ,ly:axis-group-interface::width)
        (meta . ((class . Spanner)