]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/script-engraver.cc (make_script_from_event): don't trigger callback.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 16 Oct 2005 12:29:40 +0000 (12:29 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 16 Oct 2005 12:29:40 +0000 (12:29 +0000)
* lily/item-scheme.cc: new file.

* lily/bar-line.cc (before_line_breaking): remove function.
remove bar-size-procedure, break-glyph-function

* lily/clef-engraver.cc (set_glyph): use glyph iso. glyph-name

* lily/clef.cc (before_line_breaking): change to calc_glyph_name.

* lily/system-start-delimiter.cc (print): suicide from
here. Remove after_line_breaking_callback.

* lily/script-interface.cc (calc_direction): use callback for direction.

* lily/side-position-interface.cc (aligned_side): don't use
Side_position_interface::get_direction directly. Use callback.

* scm/define-grobs.scm: change print-function to stencil callback everywhere.

* scm/define-grob-properties.scm (all-user-grob-properties): doc
callbacks property.

26 files changed:
ChangeLog
input/regression/span-bar.ly
lily/accidental.cc
lily/bar-line.cc
lily/chord-name.cc
lily/clef-engraver.cc
lily/clef.cc
lily/drum-note-engraver.cc
lily/grob-scheme.cc
lily/include/bar-line.hh
lily/include/clef.hh
lily/include/script-interface.hh
lily/include/span-bar.hh
lily/include/system-start-delimiter.hh
lily/item-scheme.cc [new file with mode: 0644]
lily/script-column.cc
lily/script-engraver.cc
lily/script-interface.cc
lily/side-position-interface.cc
lily/span-bar.cc
lily/staff-spacing.cc
lily/system-start-delimiter.cc
scm/define-grob-properties.scm
scm/define-grobs.scm
scm/output-lib.scm
scm/safe-lily.scm

index 778d637a63664e26e0dbacb7284ee8ad081346fb..76f752a461215a5b58e6077e39ffb7d68d240492 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
 2005-10-16  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * lily/script-engraver.cc (make_script_from_event): don't trigger callback.
+
+       * lily/item-scheme.cc: new file.
+
+       * lily/bar-line.cc (before_line_breaking): remove function.
+       remove bar-size-procedure, break-glyph-function
+
+       * lily/clef-engraver.cc (set_glyph): use glyph iso. glyph-name
+
+       * lily/clef.cc (before_line_breaking): change to calc_glyph_name.
+
+       * lily/system-start-delimiter.cc (print): suicide from
+       here. Remove after_line_breaking_callback.
+
+       * lily/script-interface.cc (calc_direction): use callback for direction.
+
+       * lily/side-position-interface.cc (aligned_side): don't use
+       Side_position_interface::get_direction directly. Use callback. 
+
        * lily/grob.cc (get_stencil): simplify: use callback mechanism to
        calculate stencil.
        (get_print_stencil): rename from get_stencil: create stencil with
index 856ce1c23437587b3b6b00e561fdf10671ce14b0..ed52f420c52edacb14ac385cabf29c69e66fa048 100644 (file)
@@ -18,11 +18,12 @@ between systems.
 
 \relative c' \new StaffGroup <<
   \new Staff {
-    \override Score.BarLine #'transparent = ##t
-    a1 a1
-    \revert Score.BarLine #'transparent
-    \override Score.SpanBar #'transparent = ##t
+    a1
+    \once \override Score.BarLine #'transparent = ##t
+    a1
+    \once \override Score.SpanBar #'transparent = ##t
     a1 a1
+    \bar "|."
   }
   \lyricmode <<
     \new Lyrics { bla1 die bla }
index 2ce795ef0ce2aabb79bd706ee1f70f55ceec9081..3ee074a818c16a6089c822039b6669e77e36cdc3 100644 (file)
@@ -36,6 +36,9 @@ parenthesize (Grob *me, Stencil m)
   return m;
 }
 
+/*
+  Hmm. Need separate callback, or perhaps #'live bool property.
+ */
 MAKE_SCHEME_CALLBACK (Accidental_interface, after_line_breaking, 1);
 SCM
 Accidental_interface::after_line_breaking (SCM smob)
index ab18eb0fcbac2e4e5adec301dc68b65e42f18ef7..4a9047929f212df512ae7c4436334d277738d12e 100644 (file)
@@ -21,13 +21,13 @@ Bar_line::print (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
 
-  SCM s = me->get_property ("glyph");
-  SCM barsiz_proc = me->get_property ("bar-size-procedure");
-  if (scm_is_string (s) && ly_is_procedure (barsiz_proc))
+  SCM s = me->get_property ("glyph-name");
+  SCM barsize = me->get_property ("bar-size");
+  
+  if (scm_is_string (s) && scm_is_number (barsize))
     {
       String str = ly_scm2string (s);
-      SCM siz = scm_call_1 (barsiz_proc, me->self_scm ());
-      Real sz = robust_scm2double (siz, 0);
+      Real sz = robust_scm2double (barsize, 0);
       if (sz <= 0)
        return SCM_EOL;
 
@@ -149,45 +149,14 @@ Bar_line::simple_barline (Grob *me,
                                        Interval (-h / 2, h / 2)), blot);
 }
 
-MAKE_SCHEME_CALLBACK (Bar_line, before_line_breaking, 1);
+MAKE_SCHEME_CALLBACK (Bar_line, calc_bar_size, 1);
 SCM
-Bar_line::before_line_breaking (SCM smob)
-{
-  Grob *me = unsmob_grob (smob);
-  Item *item = dynamic_cast<Item *> (me);
-
-  SCM g = me->get_property ("glyph");
-  SCM orig = g;
-  Direction bsd = item->break_status_dir ();
-  if (scm_is_string (g) && bsd)
-    {
-      SCM proc = me->get_property ("break-glyph-function");
-      g = scm_call_2 (proc, g, scm_from_int (bsd));
-    }
-
-  if (!scm_is_string (g))
-    {
-      me->set_property ("print-function", SCM_EOL);
-      me->set_extent (SCM_EOL, X_AXIS);
-      // leave y_extent for spanbar? 
-    }
-
-  if (!ly_is_equal (g, orig))
-    me->set_property ("glyph", g);
-
-  return SCM_UNSPECIFIED;
-}
-
-MAKE_SCHEME_CALLBACK (Bar_line, get_staff_bar_size, 1);
-SCM
-Bar_line::get_staff_bar_size (SCM smob)
+Bar_line::calc_bar_size (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
   Real ss = Staff_symbol_referencer::staff_space (me);
-  SCM size = me->get_property ("bar-size");
-  if (scm_is_number (size))
-    return scm_from_double (scm_to_double (size) * ss);
-  else if (Staff_symbol_referencer::get_staff_symbol (me))
+
+  if (Staff_symbol_referencer::get_staff_symbol (me))
     {
       /*
        If there is no staff-symbol, we get -1 from the next
@@ -201,6 +170,7 @@ Bar_line::get_staff_bar_size (SCM smob)
   return scm_from_int (0);
 }
 
+
 ADD_INTERFACE (Bar_line,
               "bar-line-interface",
 
@@ -221,11 +191,10 @@ ADD_INTERFACE (Bar_line,
 
 
               /* properties */ 
-              "bar-size-procedure "
               "kern "
               "thin-kern "
               "hair-thickness "
               "thick-thickness "
               "glyph "
               "bar-size "
-              "break-glyph-function");
+              );
index ffcfbd71e1e8d1206603ad1c9824bd8ee68ea68f..ded20d4d2e9590942cff26d2bec392d78aa9119d 100644 (file)
@@ -34,4 +34,6 @@ Chord_name::after_line_breaking (SCM smob)
 
 ADD_INTERFACE (Chord_name, "chord-name-interface",
               "A chord name.",
+
+              
               "begin-of-line-visible");
index c0fb2fe4b1463fe1751ac02e408939ec26322619..f72a38bcd1bb4d2c549db4e1bdd3daae3ab493cb 100644 (file)
@@ -68,7 +68,7 @@ Clef_engraver::Clef_engraver ()
 void
 Clef_engraver::set_glyph ()
 {
-  SCM glyph_sym = ly_symbol2scm ("glyph-name");
+  SCM glyph_sym = ly_symbol2scm ("glyph");
   SCM glyph = get_property ("clefGlyph");
 
   SCM basic = ly_symbol2scm ("Clef");
index 4007d93e9feb6be47b506bbb86db446ca2b72c78..6743bd4e3beb665b4ecad922b6c6ddf9ffcc7721 100644 (file)
 #include "item.hh"
 #include "font-interface.hh"
 
-/*
-  FIXME: should use symbol for #'style.
-*/
-MAKE_SCHEME_CALLBACK (Clef, before_line_breaking, 1);
+MAKE_SCHEME_CALLBACK (Clef, calc_glyph_name, 1);
 SCM
-Clef::before_line_breaking (SCM smob)
+Clef::calc_glyph_name (SCM smob)
 {
   Item *s = unsmob_item (smob);
-  SCM glyph = s->get_property ("glyph-name");
+  SCM glyph = s->get_property ("glyph");
 
-  if (!scm_is_string (glyph))
-    s->suicide ();
-  else
+  if (scm_is_string (glyph))
     {
       String str = ly_scm2string (glyph);
 
@@ -34,10 +29,12 @@ Clef::before_line_breaking (SCM smob)
          && !to_boolean (s->get_property ("full-size-change")))
        {
          str += "_change";
-         s->set_property ("glyph-name", scm_makfrom0str (str.to_str0 ()));
        }
+
+      return scm_makfrom0str (str.to_str0 ());
     }
 
+  s->suicide ();
   return SCM_UNSPECIFIED;
 }
 
@@ -60,5 +57,11 @@ Clef::print (SCM smob)
 
 ADD_INTERFACE (Clef, "clef-interface",
               "A clef sign",
-              "non-default full-size-change glyph-name");
+
+              /* properties */
+              "full-size-change "
+              "glyph "
+              "glyph-name "
+              "non-default "
+              );
 
index 059c72190da397682ffc98bc0a9fd3b3564cefa0..4e785658b7afe87f81e2dd143a0ed678ac7caf51 100644 (file)
@@ -134,6 +134,7 @@ Drum_notes_engraver::acknowledge_stem (Grob_info inf)
       Side_position_interface::add_support (e, inf.grob ());
     }
 }
+
 void
 Drum_notes_engraver::acknowledge_note_column (Grob_info inf)
 {
index 972fd0bfc70b086557751ac8aef227467e9f58ca..bc561caf9657017510f322af8b38baa99df78ded 100644 (file)
@@ -220,25 +220,6 @@ LY_DEFINE (ly_spanner_p, "ly:spanner?",
   return ly_bool2scm (b);
 }
 
-LY_DEFINE (ly_item_p, "ly:item?",
-          1, 0, 0, (SCM g),
-          "Is @var{g} an @code{Item} object?")
-{
-  Grob *me = unsmob_grob (g);
-  bool b = dynamic_cast<Item *> (me);
-  return ly_bool2scm (b);
-}
-
-LY_DEFINE (ly_item_break_dir, "ly:item-break-dir",
-          1, 0, 0, (SCM it),
-          "The break status dir of item @var{it}. @code{-1} is end of "
-          "line, @code{0} unbroken, and @code{1} begin of line.")
-{
-  Item *me = dynamic_cast<Item *> (unsmob_grob (it));
-  SCM_ASSERT_TYPE (me, it, SCM_ARG1, __FUNCTION__, "Item");
-  return scm_from_int (me->break_status_dir ());
-}
-
 LY_DEFINE (ly_grob_key, "ly:grob-key",
           1, 0, 0,
           (SCM grob),
index fc613da48b1584a3a0a51ee9edd73652ef8e453e..fdd7c17e0db7bc484308647b5ba0db6c3e5aa6fa 100644 (file)
@@ -20,9 +20,8 @@ public:
 
   static Stencil compound_barline (Grob *, String, Real height, bool rounded);
   static Stencil simple_barline (Grob *, Real wid, Real height, bool rounded);
-  DECLARE_SCHEME_CALLBACK (get_staff_bar_size, (SCM));
+  DECLARE_SCHEME_CALLBACK (calc_bar_size, (SCM));
   DECLARE_SCHEME_CALLBACK (print, (SCM));
-  DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM));
 };
 #endif // BAR_HH
 
index 1f3146aea9e147068566b4c63197384fa9dedc59..8194194b12e238f2ad8b6c748abb92b754ffe9d3 100644 (file)
@@ -14,7 +14,7 @@
 
 struct Clef
 {
-  DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM));
+  DECLARE_SCHEME_CALLBACK (calc_glyph_name, (SCM));
   DECLARE_SCHEME_CALLBACK (print, (SCM));
   static bool has_interface (Grob *);
 };
index 74efaaf06c998f484755b7ef898f41375adfaeed..8591ce0b475f257ab073182865dde2318dfc48ab 100644 (file)
@@ -23,7 +23,7 @@ public:
   static Stencil get_stencil (Grob *, Direction d);
   static bool has_interface (Grob *);
   DECLARE_SCHEME_CALLBACK (print, (SCM));
-  DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM));
+  DECLARE_SCHEME_CALLBACK (calc_direction, (SCM));
 };
 
 void make_script_from_event (Grob *p, bool *follow, Context *tg,
index 7154f303656463eb18641af730857d2e9003f24b..6995a2da4d3ee278eb2846761a52e22c0e2da87a 100644 (file)
@@ -25,10 +25,10 @@ public:
   static Interval get_spanned_interval (Grob *);
   static void add_bar (Grob *, Grob *);
   static void evaluate_glyph (Grob *);
-  static void evaluate_empty (Grob *);
   DECLARE_SCHEME_CALLBACK (width_callback, (SCM smob, SCM axis));
-  DECLARE_SCHEME_CALLBACK (get_bar_size, (SCM));
+  DECLARE_SCHEME_CALLBACK (calc_bar_size, (SCM));
   DECLARE_SCHEME_CALLBACK (print, (SCM));
+  DECLARE_SCHEME_CALLBACK (calc_glyph_name, (SCM));
   DECLARE_SCHEME_CALLBACK (before_line_breaking, (SCM));
   DECLARE_SCHEME_CALLBACK (center_on_spanned_callback, (SCM element, SCM axis));
 };
index 44906c9a1e8268ced51306a63c6bbf4c16f947e0..096bfa76730f59e998039029cced6969f9e377d2 100644 (file)
@@ -21,7 +21,6 @@ public:
   DECLARE_SCHEME_CALLBACK (print, (SCM));
 
   static bool has_interface (Grob *);
-  DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
   static void try_collapse (Grob *);
   static Stencil staff_bracket (Grob *, Real);
   static Stencil old_staff_bracket (Grob *, Real);
diff --git a/lily/item-scheme.cc b/lily/item-scheme.cc
new file mode 100644 (file)
index 0000000..46a5633
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+  item-scheme.cc -- implement Item bindings.
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#include "item.hh"
+
+
+LY_DEFINE (ly_item_p, "ly:item?",
+          1, 0, 0, (SCM g),
+          "Is @var{g} an @code{Item} object?")
+{
+  Grob *me = unsmob_grob (g);
+  bool b = dynamic_cast<Item *> (me);
+  return ly_bool2scm (b);
+}
+
+LY_DEFINE (ly_item_break_dir, "ly:item-break-dir",
+          1, 0, 0, (SCM it),
+          "The break status dir of item @var{it}. @code{-1} is end of "
+          "line, @code{0} unbroken, and @code{1} begin of line.")
+{
+  Item *me = dynamic_cast<Item *> (unsmob_grob (it));
+  SCM_ASSERT_TYPE (me, it, SCM_ARG1, __FUNCTION__, "Item");
+  return scm_from_int (me->break_status_dir ());
+}
index 2fc7f2f158bc2eb185a483c4874ffc612db03783..7d72ffc5bb1e72d53487c8a58534b0c5449a9e38 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "script-column.hh"
 
+#include "directional-element-interface.hh"
 #include "side-position-interface.hh"
 #include "warn.hh"
 #include "pointer-group-interface.hh"
@@ -59,13 +60,7 @@ Script_column::before_line_breaking (SCM smob)
   for (int i = 0; i < staff_sided.size (); i++)
     {
       Grob *g = staff_sided[i];
-      Direction d = Side_position_interface::get_direction (g);
-      if (!d)
-       {
-         programming_error ("no direction for script");
-         d = DOWN;
-         g->set_property ("direction", scm_from_int (d));
-       }
+      Direction d = get_grob_direction (g);
 
       scripts_drul[d] = scm_cons (g->self_scm (), scripts_drul[d]);
     }
index 09eef7460c8cd993779d48b3dd2d4aeb0f481ce8..fdacff1079619d1b318e92e4d2108ed9805eb131 100644 (file)
@@ -135,7 +135,7 @@ void make_script_from_event (Grob *p, bool *follow, Context *tg,
 
          val = scm_from_int (prio);
        }
-      if (p->internal_get_property (sym) == SCM_EOL)
+      if (p->get_property_data (sym) == SCM_EOL)
        p->internal_set_property (sym, val);
     }
 
@@ -153,17 +153,17 @@ Script_engraver::process_music ()
 {
   for (int i = 0; i < scripts_.size (); i++)
     {
-      Music *m = scripts_[i].event_;
+      Music *music = scripts_[i].event_;
 
-      Grob *p = make_item ("Script", m->self_scm ());
+      Grob *p = make_item ("Script", music->self_scm ());
 
       make_script_from_event (p, &scripts_[i].follow_into_staff_, context (),
-                             m->get_property ("articulation-type"),
+                             music->get_property ("articulation-type"),
                              i);
 
       scripts_[i].script_ = p;
 
-      SCM force_dir = m->get_property ("direction");
+      SCM force_dir = music->get_property("direction");
       if (is_direction (force_dir) && to_dir (force_dir))
        p->set_property ("direction", force_dir);
     }
index 6aa4c538840aaa3838d067bc06cf22db4cb4a46d..015598b317a47abfacf6f90e89f43b90c2359703 100644 (file)
@@ -41,15 +41,11 @@ Script_interface::get_stencil (Grob *me, Direction d)
   return Stencil ();
 }
 
-/*
-todo: use proper callbacks.
-*/
-MAKE_SCHEME_CALLBACK (Script_interface, before_line_breaking, 1);
+MAKE_SCHEME_CALLBACK (Script_interface, calc_direction, 1);
 SCM
-Script_interface::before_line_breaking (SCM smob)
+Script_interface::calc_direction (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
-
   Direction d = Side_position_interface::get_direction (me);
 
   if (!d)
@@ -58,15 +54,14 @@ Script_interface::before_line_breaking (SCM smob)
       d = DOWN;
     }
 
-  set_grob_direction (me, d);
-
   if (Grob *par = me->get_parent (X_AXIS))
     {
       Grob *stem = Note_column::get_stem (par);
       if (stem && Stem::first_head (stem))
        me->set_parent (Stem::first_head (stem), X_AXIS);
     }
-  return SCM_UNSPECIFIED;
+
+  return scm_from_int (d);
 }
 
 MAKE_SCHEME_CALLBACK (Script_interface, print, 1);
@@ -76,12 +71,8 @@ Script_interface::print (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
 
-  Direction dir = Side_position_interface::get_direction (me);
-  if (!dir)
-    {
-      programming_error ("script direction unknown, but stencil wanted");
-      dir = DOWN;
-    }
+  Direction dir = get_grob_direction (me);
+
   return get_stencil (me, dir).smobbed_copy ();
 }
 
index 05539cd1e3cc2af3783606c230a2937c5b46d364..3546bc2b763222bc1de7a159a0fd25406a66806b 100644 (file)
@@ -31,10 +31,6 @@ Side_position_interface::add_support (Grob *me, Grob *e)
 Direction
 Side_position_interface::get_direction (Grob *me)
 {
-  SCM d = me->get_property ("direction");
-  if (is_direction (d) && to_dir (d))
-    return to_dir (d);
-
   Direction relative_dir = Direction (1);
   SCM reldir = me->get_property ("side-relative-direction");   // should use a lambda.
   if (is_direction (reldir))
@@ -96,7 +92,7 @@ Side_position_interface::general_side_position (Grob *me, Axis a, bool use_exten
   if (dim.is_empty ())
     dim = Interval (0, 0);
 
-  Direction dir = Side_position_interface::get_direction (me);
+  Direction dir = get_grob_direction (me);
 
   Real off = me->get_parent (a)->relative_coordinate (common, a);
   Real minimum_space = ss * robust_scm2double (me->get_property ("minimum-space"), -1);
@@ -156,7 +152,7 @@ Side_position_interface::quantised_position (SCM element_smob, SCM)
 {
   Grob *me = unsmob_grob (element_smob);
 
-  Direction d = Side_position_interface::get_direction (me);
+  Direction d = get_grob_direction (me);
 
   Grob *stsym = Staff_symbol_referencer::get_staff_symbol (me);
   if (stsym)
@@ -193,8 +189,7 @@ Side_position_interface::aligned_side (SCM element_smob, SCM axis)
   Grob *me = unsmob_grob (element_smob);
   Axis a = (Axis) scm_to_int (axis);
 
-  Direction d = Side_position_interface::get_direction (me);
-
+  Direction d = get_grob_direction (me);
   Real o = scm_to_double (aligned_on_support_extents (element_smob, axis));
 
   Interval iv = me->extent (me, a);
@@ -255,6 +250,8 @@ ADD_INTERFACE (Side_position_interface, "side-position-interface",
               "victim object relative to the support (left or right, up or down?)\n\n "
               "The routine also takes the size the staff into account if "
               "@code{staff-padding} is set. If undefined, the staff symbol is ignored.",
+
+              /* properties */
               "direction "
               "direction-source "
               "minimum-space "
index 0b018dbce6cee5ccbe6b0dfb876c2aad72fd3b04..4c2fcaba64f35045d3e6fd4223c6580e986aca59 100644 (file)
@@ -46,8 +46,7 @@ Span_bar::print (SCM smobbed_me)
   extract_grob_set (me, "elements", elements);
   Grob *refp = common_refpoint_of_array (elements, me, Y_AXIS);
 
-  Span_bar::evaluate_glyph (me);
-  SCM glyph = me->get_property ("glyph");
+  SCM glyph = me->get_property ("glyph-name");
 
   /* glyph may not be a string, when ME is killed by Hara Kiri in
      between. */
@@ -116,7 +115,7 @@ Span_bar::width_callback (SCM element_smob, SCM scm_axis)
   (void) scm_axis;
 
   assert ((Axis) scm_to_int (scm_axis) == X_AXIS);
-  String gl = ly_scm2string (se->get_property ("glyph"));
+  String gl = ly_scm2string (se->get_property ("glyph-name"));
 
   /*
     urg.
@@ -130,13 +129,11 @@ MAKE_SCHEME_CALLBACK (Span_bar, before_line_breaking, 1);
 SCM
 Span_bar::before_line_breaking (SCM smob)
 {
-  Grob *g = unsmob_grob (smob);
-  evaluate_empty (g);
-  evaluate_glyph (g);
+  Grob *me = unsmob_grob (smob);
+  extract_grob_set (me, "elements", elements);
+  if (elements.is_empty ())
+    me->suicide ();
 
-  /* No need to call Bar_line::before_line_breaking (), because the info
-     in ELEMENTS already has been procced by
-     Bar_line::before_line_breaking (). */
   return SCM_UNSPECIFIED;
 }
 
@@ -162,27 +159,15 @@ Span_bar::center_on_spanned_callback (SCM element_smob, SCM axis)
   return scm_from_double (i.center ());
 }
 
-void
-Span_bar::evaluate_empty (Grob *me)
-{
-  /* TODO: filter all hara-kiried out of ELEMENS list, and then
-     optionally do suicide. Call this cleanage function from
-     center_on_spanned_callback () as well. */
 
-  extract_grob_set (me, "elements", elements);
-  if (elements.is_empty ())
-    me->suicide ();
-}
 
-void
-Span_bar::evaluate_glyph (Grob *me)
+MAKE_SCHEME_CALLBACK(Span_bar, calc_glyph_name, 1);
+SCM
+Span_bar::calc_glyph_name (SCM smob)
 {
-  SCM gl = me->get_property ("glyph");
-
-  if (scm_is_string (gl))
-    return;
-
+  Grob *me = unsmob_grob (smob);
   extract_grob_set (me, "elements", elements);
+  SCM gl = SCM_EOL;
   for (int i = elements.size ();
        i-- && !scm_is_string (gl);)
     gl = elements[i]->get_property ("glyph");
@@ -190,7 +175,7 @@ Span_bar::evaluate_glyph (Grob *me)
   if (!scm_is_string (gl))
     {
       me->suicide ();
-      return;
+      return SCM_UNSPECIFIED;
     }
 
   String type = ly_scm2string (gl);
@@ -201,10 +186,7 @@ Span_bar::evaluate_glyph (Grob *me)
   else if (type == ":|:")
     type = ".|.";
 
-  gl = scm_makfrom0str (type.to_str0 ());
-  if (scm_equal_p (me->get_property ("glyph"), gl)
-      != SCM_BOOL_T)
-    me->set_property ("glyph", gl);
+  return scm_makfrom0str (type.to_str0 ());
 }
 
 Interval
@@ -214,9 +196,9 @@ Span_bar::get_spanned_interval (Grob *me)
                          (me->self_scm (), scm_from_int (Y_AXIS)));
 }
 
-MAKE_SCHEME_CALLBACK (Span_bar, get_bar_size, 1);
+MAKE_SCHEME_CALLBACK (Span_bar, calc_bar_size, 1);
 SCM
-Span_bar::get_bar_size (SCM smob)
+Span_bar::calc_bar_size (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
   Interval iv (get_spanned_interval (me));
@@ -232,5 +214,8 @@ Span_bar::get_bar_size (SCM smob)
 ADD_INTERFACE (Span_bar, "span-bar-interface",
               "A bar line that spanned between other barlines. This interface is "
               " used for  bar lines that connect different staves.",
+
+              /* properties */
+              "glyph-name "
               "elements");
 
index 48e0c09f6b246569b63dd086e9deb4e643b65f9a..a862a16f116c79b0c62cf3eb10f4f2eb72b51bff 100644 (file)
@@ -98,15 +98,15 @@ Staff_spacing::bar_y_positions (Grob *bar_grob)
   bar_size.set_empty ();
   if (Bar_line::has_interface (bar_grob))
     {
-      SCM glyph = bar_grob->get_property ("glyph");
+      SCM glyph = bar_grob->get_property ("glyph-name");
+      Grob *staff_sym = Staff_symbol_referencer::get_staff_symbol (bar_grob);
 
       String glyph_string = scm_is_string (glyph) ? ly_scm2string (glyph) : "";
       if (glyph_string.left_string (1) == "|" || glyph_string.left_string (1) == ".")
        {
-         SCM sz = Bar_line::get_staff_bar_size (bar_grob->self_scm ());
-         bar_size = Interval (-1, 1);
-         bar_size *= robust_scm2double (sz, 1)
-           / Staff_symbol_referencer::staff_space (bar_grob);
+         Grob *common = bar_grob->common_refpoint (staff_sym, Y_AXIS);
+         Interval bar_size = bar_grob->extent (common, Y_AXIS);
+         bar_size *= 1.0 / Staff_symbol_referencer::staff_space (bar_grob);
        }
     }
   return bar_size;
index c4aee8a7e158c87c6e9a633acf645eb6cce0ebb9..8662b45b5b1944a0e52daf74f67c9a367a2fe5a3 100644 (file)
@@ -53,44 +53,6 @@ System_start_delimiter::simple_bar (Grob *me, Real h)
                                   lt);
 }
 
-MAKE_SCHEME_CALLBACK (System_start_delimiter, after_line_breaking, 1);
-
-SCM
-System_start_delimiter::after_line_breaking (SCM smob)
-{
-  Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob));
-
-  SCM gl = me->get_property ("glyph");
-  if (ly_is_equal (gl, scm_makfrom0str ("bar-line")))
-    {
-      int count = 0;
-      Paper_column *left_column = me->get_bound (LEFT)->get_column ();
-
-      /*
-       Get all coordinates, to trigger Hara kiri.
-      */
-      extract_grob_set (me, "elements", elts);
-      Grob *common = common_refpoint_of_array (elts, me, Y_AXIS);
-
-      for (int i = elts.size (); i--;)
-       {
-         Spanner *staff = dynamic_cast<Spanner *> (elts[i]);
-         if (!staff
-             || staff->get_bound (LEFT)->get_column () != left_column)
-           continue;
-
-         Interval v = staff->extent (common, Y_AXIS);
-
-         if (!v.is_empty ())
-           count++;
-       }
-
-      if (count <= 1)
-       me->suicide ();
-    }
-  return SCM_UNSPECIFIED;
-}
-
 MAKE_SCHEME_CALLBACK (System_start_delimiter, print, 1);
 SCM
 System_start_delimiter::print (SCM smob)
@@ -111,18 +73,30 @@ System_start_delimiter::print (SCM smob)
 
   Interval ext;
 
+  int non_empty_count = 0;
   for (int i = elts.size (); i--;)
     {
       Spanner *sp = dynamic_cast<Spanner *> (elts[i]);
+
       if (sp
          && sp->get_bound (LEFT) == me->get_bound (LEFT))
        {
          Interval dims = sp->extent (common, Y_AXIS);
          if (!dims.is_empty ())
-           ext.unite (dims);
+           {
+             non_empty_count ++;
+             ext.unite (dims);
+           }
        }
     }
 
+  if (gsym == ly_symbol2scm ("bar-line")
+      && non_empty_count <= 1)
+    {
+      me->suicide ();
+      return SCM_EOL;
+    }
+  
   ext -= me->relative_coordinate (common, Y_AXIS);
 
   Real len = ext.length () / staff_space;
index 508e8578b36927b8f5a144da85f36b20c3a6a766..b80e958b390f582c06a23e5f890b5ef4cfc9f752 100644 (file)
@@ -61,7 +61,6 @@ original stencil drawer to draw the balloon around.")
 
 
      (bar-size ,ly:dimension? "size of a bar line.")
-     (bar-size-procedure ,procedure? "Procedure that computes the size of a bar line.")
      (barre-type ,symbol? "Type of barre indication used in a fret diagram.
 Choices include @code{curved} and @code{straight}.")
      (base-shortest-duration ,ly:moment?
@@ -109,9 +108,6 @@ For example, clefs are put after key signatures by setting
          clef
          time-signature))
 @end example")
-     (break-glyph-function ,procedure? "This function determines the
-appearance of a bar line at the line break.  It takes a glyph and
-break-direction and returns the glyph at a line break.")
      (break-overshoot ,number-pair? "How much does a broken spanner
 stick out of its bounds?")
      (bracket-visibility ,boolean-or-symbol? "This controls the
@@ -260,7 +256,6 @@ stem. The stem will stop at the innermost beams.")
      (glyph ,string? "a string determining what (style) of glyph is
 typeset. Valid choices depend on the function that is reading this
 property.")
-     (glyph-name ,string? "a name of character within font.")
      (glyph-name-procedure ,procedure? "Return the name of a character
 within font, to use for printing a symbol.")
 
@@ -536,6 +531,7 @@ function is to protect objects from being garbage collected.")
 set, which grob to get the direction from .")
      (dot ,ly:grob? "reference to Dots object.")
      (figures ,ly:grob-array? "Figured bass objects for continuation line.")
+     (glyph-name ,string? "a name of character within font.")
      (pedal-text ,ly:grob? "Pointer to the text of a mixed-style piano pedal.")
      (stem ,ly:grob? "pointer to Stem object.")
      (tremolo-flag ,ly:grob? "The tremolo object on a stem.")
index 46c531d868a727d10f4ff8ef126a20219d9c00a2..d16e1c4b9a67eb2e195c0d6127158b39bb2549db 100644 (file)
      . (
        (break-align-symbol . staff-bar)
        (glyph . "|")
-       (break-glyph-function . ,default-break-barline)
        (layer . 0)
-       (bar-size-procedure . ,Bar_line::get_staff_bar_size)
        (break-visibility . ,all-visible)
        (breakable . #t)
        (callbacks . ((stencil . ,Bar_line::print)
-                     (before-line-breaking . ,Bar_line::before_line_breaking)))
+                     (glyph-name . ,bar-line::calc-glyph-name)
+                     (bar-size .  ,Bar_line::calc_bar_size)
+                     ))
        (space-alist . (
                        (time-signature . (extra-space . 0.75))
                        (custos . (minimum-space . 2.0))
     (Clef
      . (
        (callbacks . ((stencil . ,Clef::print)
-                     (before-line-breaking . ,Clef::before_line_breaking)
+                     (glyph-name . ,Clef::calc_glyph_name)
                      ))
        (breakable . #t)
        (font-family . music)
        
        ;; todo.
        (callbacks . ((stencil . ,Text_interface::print)
-                     (before-line-breaking . ,Script_interface::before_line_breaking)))
+                     (direction . ,Script_interface::calc_direction)))
        (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
        (self-alignment-X . 0)
        (Y-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
        (self-alignment-Y . 0)
        (script-priority . 100)
        (callbacks . ((stencil . ,Text_interface::print)
-                     (before-line-breaking . ,Script_interface::before_line_breaking)))
+                     (direction . ,Script_interface::calc_direction)))
        (font-encoding . fetaNumber)
        (font-size . -5)                ; don't overlap when next to heads.
        (meta . ((class . Item)
        ;; (script-priority . 0) priorities for scripts, see script.scm
        (X-offset-callbacks . (,Self_alignment_interface::centered_on_parent))
        (callbacks . ((stencil . ,Script_interface::print)
-                     (before-line-breaking . ,Script_interface::before_line_breaking)))
+                     (direction . ,Script_interface::calc_direction)))
        (font-encoding . fetaMusic)
        (meta . ((class . Item)
                 (interfaces . (script-interface
     (SpanBar
      . (
        (break-align-symbol . staff-bar)
-       (bar-size-procedure . ,Span_bar::get_bar_size)
        (X-extent-callback . ,Span_bar::width_callback)
        (Y-extent-callback . ())
        (layer . 0)
        (breakable . #t)
        (callbacks . ((stencil . ,Span_bar::print)
+                     (bar-size . ,Span_bar::calc_bar_size)
+                     (glyph-name . ,Span_bar::calc_glyph_name)
                      (before-line-breaking . ,Span_bar::before_line_breaking)))
        ;; ugh duplication!
 
        (glyph . "bar-line")
        (thickness . 1.6)
        (callbacks . ((stencil . ,System_start_delimiter::print)
-                     (after-line-breaking . ,System_start_delimiter::after_line_breaking)))
-       
+                     ))
        (meta . ((class . Spanner)
                 (interfaces . (system-start-delimiter-interface))))))
 
        (padding . 0.5)
        (staff-padding . 0.5)
        (callbacks . ((stencil . ,Text_interface::print)
-                     (before-line-breaking . ,Script_interface::before_line_breaking)))
+                     (direction . ,Script_interface::calc_direction)))
        (avoid-slur . around)
        (slur-padding . 0.5)
        (script-priority . 200)
index 96cc55cdd62260915b25a41b9f18713364eab4c6..2546012680d7ace5cf2528abd589acf696e12634 100644 (file)
@@ -194,8 +194,11 @@ centered, X==1 is at the right, X == -1 is at the left."
 ;; How should a  bar line behave at a break? 
 ;;
 ;; Why prepend `default-' to every scm identifier?
-(define-public (default-break-barline glyph dir)
-  (let ((result (assoc glyph 
+(define-public (bar-line::calc-glyph-name grob)
+  (let* (
+        (glyph (ly:grob-property grob 'glyph))
+        (dir (ly:item-break-dir grob))
+        (result (assoc glyph 
                       '((":|:" . (":|" . "|:"))
                         ("||:" . ("||" . "|:"))
                         ("|" . ("|" . ()))
@@ -213,11 +216,18 @@ centered, X==1 is at the right, X == -1 is at the left."
                         (":" . (":" . ""))
                         ("empty" . (() . ()))
                         ("brace" . (() . "brace"))
-                        ("bracket" . (() . "bracket"))  ))))
+                        ("bracket" . (() . "bracket"))  )))
+        (glyph-name (if (= dir CENTER)
+                        glyph
+                        (if (and result (string? (index-cell (cdr result) dir)))
+                            (index-cell (cdr result) dir)
+                            #f)))
+        )
+        
+    (if glyph-name
+       (set! (ly:grob-property grob 'glyph-name) glyph-name)
+       (ly:grob-suicide! grob))))
 
-    (if (equal? result #f)
-       (ly:warning (_ "unknown bar glyph: `~S'" glyph))
-       (index-cell (cdr result) dir))))
 
 (define-public (shift-right-at-line-begin g)
   "Shift an item to the right, but only at the start of the line."
index 3ab99b4988e64feff8b9e369f892fac95ae89632..cfa6cb4031300d93fdb7fff56ba97455cbee4eea 100644 (file)
    Arpeggio::brew_chord_bracket
    Arpeggio::width_callback
    Axis_group_interface::group_extent_callback
-   Bar_line::get_staff_bar_size
    Bar_line::print
    Breathing_sign::offset_callback
    Clef::print
    Slur::height
    Slur::print
    Spacing_spanner::set_springs
-   Span_bar::get_bar_size
    Span_bar::print
    Span_bar::width_callback
    Spanner::set_spacing_rods