]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/script-column.cc
Issue 5167/6: Changes: show \markup xxx = ... \etc assignments
[lilypond.git] / lily / script-column.cc
index 149e666c38b2c8ff1a9a4f0cb4711dbf2e3c2a18..a12560bf8e19426eaec8f254b782a8e6108ccefb 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1999--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1999--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -39,36 +39,15 @@ Script_column::add_side_positioned (Grob *me, Grob *script)
     return;
 
   Pointer_group_interface::add_grob (me, ly_symbol2scm ("scripts"), script);
-}
-
-int
-pushed_by_slur (Grob *g)
-{
-  return g->get_property ("avoid-slur") == ly_symbol2scm ("outside")
-         || g->get_property ("avoid-slur") == ly_symbol2scm ("around");
+  script->set_object ("script-column", me->self_scm ());
 }
 
 LY_DEFINE (ly_grob_script_priority_less, "ly:grob-script-priority-less",
            2, 0, 0, (SCM a, SCM b),
            "Compare two grobs by script priority.  For internal use.")
 {
-  Grob *i1 = unsmob_grob (a);
-  Grob *i2 = unsmob_grob (b);
-
-  /*
-   * avoid-staff of slur trumps script priority. If one grob is
-   * supposed to be printed outside a slur and another grob inside,
-   * we place the inside grob below the outside even if the inside
-   * grob has a higher script-priority.
-   */
-  if (unsmob_grob (i1->get_object ("slur"))
-      && unsmob_grob (i2->get_object ("slur")))
-    {
-      int push1 = pushed_by_slur (i1);
-      int push2 = pushed_by_slur (i2);
-      if (push1 != push2)
-        return push1 < push2 ? SCM_BOOL_T : SCM_BOOL_F;
-    }
+  Grob *i1 = unsmob<Grob> (a);
+  Grob *i2 = unsmob<Grob> (b);
 
   SCM p1 = i1->get_property ("script-priority");
   SCM p2 = i2->get_property ("script-priority");
@@ -80,7 +59,7 @@ MAKE_SCHEME_CALLBACK (Script_column, row_before_line_breaking, 1);
 SCM
 Script_column::row_before_line_breaking (SCM smob)
 {
-  Grob *me = unsmob_grob (smob);
+  Grob *me = unsmob<Grob> (smob);
   vector<Grob *> horizontal_grobs;
   extract_grob_set (me, "scripts", scripts);
 
@@ -93,13 +72,13 @@ Script_column::row_before_line_breaking (SCM smob)
       /*
         Don't want to consider scripts horizontally next to notes.
       */
-      if (Accidental_placement::has_interface (sc)
-          || Arpeggio::has_interface (sc))
+      if (has_interface<Accidental_placement> (sc)
+          || has_interface<Arpeggio> (sc))
         {
           affect_all_grobs.push_back (sc);
         }
-      else if (sc->get_property_data ("Y-offset")
-               != Side_position_interface::y_aligned_side_proc)
+      else if (!scm_is_eq (sc->get_property_data ("Y-offset"),
+                           Side_position_interface::y_aligned_side_proc))
         {
           head_scripts_map[sc->get_parent (Y_AXIS)].push_back (sc);
         }
@@ -123,7 +102,7 @@ MAKE_SCHEME_CALLBACK (Script_column, before_line_breaking, 1);
 SCM
 Script_column::before_line_breaking (SCM smob)
 {
-  Grob *me = unsmob_grob (smob);
+  Grob *me = unsmob<Grob> (smob);
   vector<Grob *> staff_sided;
 
   extract_grob_set (me, "scripts", scripts);
@@ -133,8 +112,8 @@ Script_column::before_line_breaking (SCM smob)
       /*
         Don't want to consider scripts horizontally next to notes.
       */
-      if (sc->get_property_data ("X-offset")
-          != Side_position_interface::x_aligned_side_proc)
+      if (!scm_is_eq (sc->get_property_data ("X-offset"),
+                      Side_position_interface::x_aligned_side_proc))
         staff_sided.push_back (sc);
     }
 
@@ -168,17 +147,18 @@ Script_column::order_grobs (vector<Grob *> grobs)
       for (SCM s = ss; scm_is_pair (s);
            s = scm_cdr (s), last = g, last_initial_outside_staff = initial_outside_staff)
         {
-          g = unsmob_grob (scm_car (s));
+          g = unsmob<Grob> (scm_car (s));
           initial_outside_staff = g->get_property ("outside-staff-priority");
           if (last)    //not the first grob in the list
             {
               SCM last_outside_staff = last->get_property ("outside-staff-priority");
               /*
-                if outside_staff_priority is missing for previous grob, just
-                use it as a support for the current grob
+                if outside_staff_priority is missing for previous grob,
+                use all the scripts so far as support for the current grob
               */
               if (!scm_is_number (last_outside_staff))
-                Side_position_interface::add_support (g, last);
+                for (SCM t = ss; !scm_is_eq (t, s); t = scm_cdr (t))
+                  Side_position_interface::add_support (g, unsmob<Grob> (scm_car (t)));
               /*
                 if outside_staff_priority is missing or is equal to original
                 outside_staff_priority of previous grob, set new
@@ -200,5 +180,5 @@ ADD_INTERFACE (Script_column,
                " @code{script-priority} and @code{outside-staff-priority}.",
 
                /* properties */
-               ""
+               "scripts "
               );