]> git.donarmstrong.com Git - lilypond.git/commitdiff
(class Grob): move pscore, dim_cache_,
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 2 Nov 2005 14:12:25 +0000 (14:12 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 2 Nov 2005 14:12:25 +0000 (14:12 +0000)
original_ in private scope.
(class Grob): drop pscore_ pointer, change to output_def pointer.
(class Grob): cleanup class definition.

57 files changed:
ChangeLog
lily/accidental.cc
lily/ambitus.cc
lily/arpeggio.cc
lily/balloon.cc
lily/bar-line.cc
lily/beam-quanting.cc
lily/beam.cc
lily/break-substitution.cc
lily/breathing-sign.cc
lily/cluster.cc
lily/context.cc
lily/dynamic-text-spanner.cc
lily/easy-notation.cc
lily/figured-bass-continuation.cc
lily/font-interface.cc
lily/gourlay-breaking.cc
lily/grid-line-interface.cc
lily/grob-interface.cc
lily/grob-property.cc
lily/grob-scheme.cc
lily/grob-smob.cc
lily/grob.cc
lily/hara-kiri-group-spanner.cc
lily/include/context.hh
lily/include/grob.hh
lily/include/system.hh
lily/item.cc
lily/lily-parser.cc
lily/line-spanner.cc
lily/lyric-extender.cc
lily/lyric-hyphen.cc
lily/mensural-ligature-engraver.cc
lily/mensural-ligature.cc
lily/multi-measure-rest.cc
lily/note-spacing.cc
lily/ottava-bracket.cc
lily/paper-column.cc
lily/paper-score.cc
lily/piano-pedal-bracket.cc
lily/slur-scoring.cc
lily/slur.cc
lily/spacing-spanner.cc
lily/spanner.cc
lily/staff-symbol-referencer.cc
lily/staff-symbol.cc
lily/stem-tremolo.cc
lily/stem.cc
lily/system-start-delimiter.cc
lily/system.cc
lily/text-interface.cc
lily/text-spanner.cc
lily/time-signature.cc
lily/tuplet-bracket.cc
lily/vaticana-ligature-engraver.cc
lily/vaticana-ligature.cc
lily/volta-bracket.cc

index dca5cf32e4257a37707968cb40fa908ad609702b..afef6167b11d7b40bcee90845d2f3b288eac7ece 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2005-11-02  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * lily/include/grob.hh (class Grob): move pscore, dim_cache_,
+       original_ in private scope.
+       (class Grob): drop pscore_ pointer, change to output_def pointer.
+       (class Grob): cleanup class definition.
+
        * ly/spanners-init.ly (assertBeamQuant): use make-simple-closure.
 
 2005-11-02  Jan Nieuwenhuizen  <janneke@gnu.org>
index 3ee074a818c16a6089c822039b6669e77e36cdc3..c9d9c9ebc2a3bead85895c18904d1e02df3ffe63 100644 (file)
@@ -46,7 +46,7 @@ Accidental_interface::after_line_breaking (SCM smob)
   Grob *me = unsmob_grob (smob);
   Grob *tie = unsmob_grob (me->get_object ("tie"));
 
-  if (tie && !tie->original_)
+  if (tie && !tie->original ())
     me->suicide ();
   return SCM_UNSPECIFIED;
 }
@@ -221,7 +221,7 @@ Accidental_interface::print (SCM smob)
                                 (ly_symbol2scm ("font-size"),
                                  scm_from_int (-2))),
                     ac);
-      fm = select_font (me->get_layout (), ac);
+      fm = select_font (me->layout (), ac);
     }
   else
     fm = Font_interface::get_default_font (me);
index 472df25037b0ffec19543273a52092dceabe86e2..87ea977478ccdaba25e8f6ca6e40fc8bad0abcd4 100644 (file)
@@ -49,9 +49,9 @@ Ambitus::print (SCM smob)
 
       if (pmin < pmax)
        {
-         Real linethickness = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"))
+         Real linethickness = me->layout ()->get_dimension (ly_symbol2scm ("linethickness"))
            * robust_scm2double (me->get_property ("thickness"), 1.0);
-         Real blotdiameter = me->get_layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
+         Real blotdiameter = me->layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
          Interval x_extent = 0.5 * linethickness * Interval (-1, 1);
          Interval y_extent = Interval (pmin, pmax);
          Box line_box (x_extent, y_extent);
index 326ef89a923b6e4cef442a5dbe86ee9cd3414b6b..3c2663939a56b712802fe96331d307764cbe09f3 100644 (file)
@@ -119,7 +119,7 @@ Arpeggio::brew_chord_bracket (SCM smob)
       heads.unite (iv + ss->relative_coordinate (common, Y_AXIS) - my_y);
     }
 
-  Real lt = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
+  Real lt = me->layout ()->get_dimension (ly_symbol2scm ("linethickness"));
   Real sp = 1.5 * Staff_symbol_referencer::staff_space (me);
   Real dy = heads.length () + sp;
   Real x = 0.7;
index fb7ac913d68a698872de90ebdf35003fba3cc354..18bd9898127a120f15545c86d17751e8b4baa124 100644 (file)
@@ -54,7 +54,7 @@ Balloon_interface::print (SCM smob)
   SCM chain = Font_interface::text_font_alist_chain (me);
   chain = scm_cons (me->get_property ("balloon-text-props"), chain);
 
-  SCM text = Text_interface::interpret_markup (me->get_layout ()->self_scm (),
+  SCM text = Text_interface::interpret_markup (me->layout ()->self_scm (),
                                               chain, bt);
 
   Stencil *text_stil = unsmob_stencil (text);
index 49e435fe3fb4911976afee2ffaa5002a27e821de..da02119b6225a533af410f3ea969c17e7633df78 100644 (file)
@@ -45,7 +45,7 @@ Bar_line::compound_barline (Grob *me, String str, Real h,
   Real hair = robust_scm2double (me->get_property ("hair-thickness"), 1);
   Real fatline = robust_scm2double (me->get_property ("thick-thickness"), 1);
 
-  Real staffline = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
+  Real staffline = me->layout ()->get_dimension (ly_symbol2scm ("linethickness"));
   Real staff_space = Staff_symbol_referencer::staff_space (me);
 
   kern *= staffline;
@@ -142,7 +142,7 @@ Bar_line::simple_barline (Grob *me,
 {
   Real blot
     = rounded
-    ? me->get_layout ()->get_dimension (ly_symbol2scm ("blotdiameter"))
+    ? me->layout ()->get_dimension (ly_symbol2scm ("blotdiameter"))
     : 0.0;
 
   return Lookup::round_filled_box (Box (Interval (0, w),
index 75e00fb93c01330adca02a4ef5ad66da713a5254..5f44ef840cf2fa4b8892d4cf0622c20f6fa44fcc 100644 (file)
@@ -278,7 +278,7 @@ Beam::quanting (SCM smob, SCM posns)
 
 #if DEBUG_QUANTING
   SCM inspect_quants = me->get_property ("inspect-quants");
-  if (to_boolean (me->get_layout ()->lookup_variable (ly_symbol2scm ("debug-beam-quanting")))
+  if (to_boolean (me->layout ()->lookup_variable (ly_symbol2scm ("debug-beam-quanting")))
       && scm_is_pair (inspect_quants))
     {
       Drul_array<Real> ins = ly_scm2interval (inspect_quants);
@@ -314,7 +314,7 @@ Beam::quanting (SCM smob, SCM posns)
   
 #if DEBUG_QUANTING
   if (best_idx >= 0
-      && to_boolean (me->get_layout ()->lookup_variable (ly_symbol2scm ("debug-beam-quanting"))))
+      && to_boolean (me->layout ()->lookup_variable (ly_symbol2scm ("debug-beam-quanting"))))
     {
       qscores[best_idx].score_card_ += to_string ("i%d", best_idx);
 
index 0bc258a4855a0aeade5954e65ae70296fd05a64b..6ad45126d73be3adae9b114e088edb190fb4f6e1 100644 (file)
@@ -328,7 +328,7 @@ Beam::print (SCM grob)
   Real gap_length = robust_scm2double (me->get_property ("gap"), 0.0);
 
   Stencil the_beam;
-  Real lt = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
+  Real lt = me->layout ()->get_dimension (ly_symbol2scm ("linethickness"));
 
   for (int i = 0; i <= stems.size (); i++)
     {
@@ -385,7 +385,7 @@ Beam::print (SCM grob)
       if (stem)
        w += stem_width / 2;
 
-      Real blot = me->get_layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
+      Real blot = me->layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
       Stencil whole = Lookup::beam (slope, w, thick, blot);
       Stencil gapped;
 
@@ -491,7 +491,7 @@ Beam::print (SCM grob)
 
 #if (DEBUG_QUANTING)
   SCM quant_score = me->get_property ("quant-score");
-  SCM debug = me->get_layout ()->lookup_variable (ly_symbol2scm ("debug-beam-quanting"));
+  SCM debug = me->layout ()->lookup_variable (ly_symbol2scm ("debug-beam-quanting"));
   if (to_boolean (debug) && scm_is_string (quant_score))
     {
 
@@ -506,7 +506,7 @@ Beam::print (SCM grob)
       Direction stem_dir = stems.size () ? to_dir (stems[0]->get_property ("direction")) : UP;
 
       Stencil score = *unsmob_stencil (Text_interface::interpret_markup
-                                   (me->get_layout ()->self_scm (), properties, quant_score));
+                                   (me->layout ()->self_scm (), properties, quant_score));
 
       if (!score.is_empty ())
        the_beam.add_at_edge (Y_AXIS, stem_dir, score, 1.0, 0);
index bed8b97c8613938f17a2dbe156db4b5bf928de61..f7350338850c7104a49f081afbaf506e63c2d08e 100644 (file)
@@ -512,3 +512,9 @@ Spanner::substitute_one_mutable_property (SCM sym,
       }
 }
 
+void
+Grob::substitute_object_links (SCM crit, SCM orig)
+{
+  set_break_subsititution (crit);
+  object_alist_ = substitute_object_alist (orig, object_alist_);
+}
index fc873d567dcafec3b08e1fb7c57c68c68f9511ab..b52752d6b35df6189dbb20aec8832b7676d72cad 100644 (file)
@@ -49,7 +49,7 @@ Breathing_sign::divisio_minima (SCM smob)
   else
     staff_size = 0.0;
 
-  Real blotdiameter = me->get_layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
+  Real blotdiameter = me->layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
 
   /*
    * Draw a small vertical line through the uppermost (or, depending
@@ -80,7 +80,7 @@ Breathing_sign::divisio_maior (SCM smob)
   else
     staff_size = 0.0;
 
-  Real blotdiameter = me->get_layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
+  Real blotdiameter = me->layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
 
   /*
    * Draw a vertical line that is vertically centered in the staff
@@ -118,7 +118,7 @@ Breathing_sign::divisio_maxima (SCM smob)
   else
     staff_size = 0.0;
 
-  Real blotdiameter = me->get_layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
+  Real blotdiameter = me->layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
 
   // like a "|" type bar
   Interval xdim (0, thickness);
@@ -146,7 +146,7 @@ Breathing_sign::finalis (SCM smob)
   else
     staff_size = 0.0;
 
-  Real blotdiameter = me->get_layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
+  Real blotdiameter = me->layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
 
   // like a "||" type bar
   Interval xdim (0, thickness);
index 6eacdf82f7b406f73100b8356ca43d1c9abfa853..3073e03c0d2f49273562b13e11ac4d90a846e5d8 100644 (file)
@@ -167,9 +167,9 @@ Cluster::print (SCM smob)
   /*
     Across a line break we anticipate on the next pitches.
   */
-  if (spanner->original_)
+  if (spanner->original ())
     {
-      Spanner *orig = dynamic_cast<Spanner *> (spanner->original_);
+      Spanner *orig = dynamic_cast<Spanner *> (spanner->original ());
 
       if (spanner->get_break_index () < orig->broken_intos_.size () - 1)
        {
index 7a5eda0b749809f18aaacc7adad6e6b3d4b01837..1f086390d6c98716c14035be5432055ec4a2b420 100644 (file)
@@ -82,11 +82,6 @@ Context::add_context (Context *t)
     }
 }
 
-Object_key const *
-Context::get_key () const
-{
-  return key_;
-}
 
 Context::Context (Object_key const *key)
 {
@@ -257,7 +252,7 @@ Context::get_context_key (String type, String id)
 
   context_counts_[now_key] = disambiguation_count + 1;
 
-  return new Lilypond_context_key (get_key (),
+  return new Lilypond_context_key (key (),
                                   now_mom (),
                                   type, id,
                                   disambiguation_count);
@@ -274,7 +269,7 @@ Context::get_grob_key (String name)
     disambiguation_count = grob_counts_[name];
   grob_counts_[name] = disambiguation_count + 1;
 
-  Object_key *k = new Lilypond_grob_key (get_key (),
+  Object_key *k = new Lilypond_grob_key (key (),
                                         now_mom (),
                                         name,
                                         disambiguation_count);
index e330e62c12ab5b1fd94513bab19280cd0638bd05..b9e8945e5fd95789a946024ebb25c8ad5a03cdaf 100644 (file)
@@ -52,7 +52,7 @@ Dynamic_text_spanner::print (SCM smob)
   Spanner *spanner = dynamic_cast<Spanner *> (me);
 
   Grob *common = spanner->get_bound (LEFT)->common_refpoint (spanner->get_bound (RIGHT), X_AXIS);
-  Output_def *layout = me->get_layout ();
+  Output_def *layout = me->layout ();
 
   Interval span_points;
   Drul_array<bool> broken;
index 879ded5483b3ffa5c1b8db5a9e4368759fcc5082..93124765e2f808c6706eb85dc82786c3a8532a1c 100644 (file)
@@ -45,7 +45,7 @@ Note_head::brew_ez_stencil (SCM smob)
     }
 
   SCM letter
-    = Text_interface::interpret_string (me->get_layout ()->self_scm (),
+    = Text_interface::interpret_string (me->layout ()->self_scm (),
                                        Font_interface::text_font_alist_chain (me),
                                        charstr);
 
index c7018f622871807533fdd7cc2286da3b726f7fbc..55124bf0954fb3ffda11ce01ca95e90fae273013 100644 (file)
@@ -51,7 +51,7 @@ Figured_bass_continuation::print (SCM grob)
   Spanner *me = dynamic_cast<Spanner*> (unsmob_grob (grob));
 
   Real thick =
-    me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"))
+    me->layout ()->get_dimension (ly_symbol2scm ("linethickness"))
     * robust_scm2double (me->get_property ("thickness"), 1);
   
   Interval spanned;
index fe258a86dc4cdf522b4679a86b96bb1de565440d..67eb3b2af82b91fd40b92acfeaded7147fc693dc 100644 (file)
@@ -22,7 +22,7 @@ Font_interface::get_default_font (Grob *me)
     {
       SCM chain = music_font_alist_chain (me);
 
-      fm = select_font (me->get_layout (), chain);
+      fm = select_font (me->layout (), chain);
       me->set_property ("font", fm->self_scm ());
     }
 
@@ -33,7 +33,7 @@ SCM
 Font_interface::music_font_alist_chain (Grob *g)
 {
   SCM defaults
-    = g->get_layout ()->lookup_variable (ly_symbol2scm ("font-defaults"));
+    = g->layout ()->lookup_variable (ly_symbol2scm ("font-defaults"));
   if (defaults == SCM_UNDEFINED)
     defaults = SCM_EOL;
   return g->get_property_alist_chain (defaults);
@@ -43,7 +43,7 @@ SCM
 Font_interface::text_font_alist_chain (Grob *g)
 {
   SCM defaults
-    = g->get_layout ()->lookup_variable (ly_symbol2scm ("text-font-defaults"));
+    = g->layout ()->lookup_variable (ly_symbol2scm ("text-font-defaults"));
   if (defaults == SCM_UNDEFINED)
     defaults = SCM_EOL;
   return g->get_property_alist_chain (defaults);
index f5d78b9f51d3e15345ddff6aa3e01b715cef67cf..9f0f2252134c0ecb6b9d507c6e8c5e6dc0b75a36 100644 (file)
@@ -232,7 +232,7 @@ Gourlay_breaking::combine_demerits (Column_x_positions const &prev,
 {
   Real break_penalties = 0.0;
   Grob *pc = this_one.cols_.top ();
-  if (pc->original_)
+  if (pc->original ())
     {
       SCM pen = pc->get_property ("penalty");
       if (scm_is_number (pen) && fabs (scm_to_double (pen)) < 10000)
index 5661e1dfbe2cffa4bbfa4df853861821f3ae4c3a..7451ae68c4a3d67f9c3eddeebaf474fdfdbdfbbe 100644 (file)
@@ -38,7 +38,7 @@ Grid_line_interface::print (SCM smobbed_me)
       return SCM_EOL;
     }
 
-  Real staffline = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
+  Real staffline = me->layout ()->get_dimension (ly_symbol2scm ("linethickness"));
   Real thick = robust_scm2double (me->get_property ("thickness"), 1.0)
     * staffline;
 
@@ -55,7 +55,7 @@ Grid_line_interface::width (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
 
-  Real staffline = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
+  Real staffline = me->layout ()->get_dimension (ly_symbol2scm ("linethickness"));
   Real thick = robust_scm2double (me->get_property ("thickness"), 1.0)
     * staffline;
 
index baefab264fa460be10e9b4a21f8a11d09fe392c2..9e433818e9f73075889fe8ca337c528593a7651b 100644 (file)
@@ -34,7 +34,7 @@ check_interfaces_for_property (Grob const *me, SCM sym)
       return;
     }
 
-  SCM ifs = me->interfaces_;
+  SCM ifs = me->interfaces ();
 
   SCM all_ifaces = ly_all_grob_interfaces ();
   bool found = false;
index c9d0ea8aaeb87801ef0315586b9d6b2f741fc1f8..59a3cd68f2a2e79cf6ad3701a84320646c1812e7 100644 (file)
@@ -27,12 +27,6 @@ Grob::get_property_alist_chain (SCM def) const
                     SCM_UNDEFINED);
 }
 
-SCM
-Grob::get_interfaces () const
-{
-  return interfaces_;
-}
-
 
 extern void check_interfaces_for_property (Grob const *me, SCM sym);
 
@@ -192,13 +186,6 @@ Grob::internal_get_object (SCM sym) const
   return (s == SCM_BOOL_F) ? SCM_EOL : scm_cdr (s);
 }
 
-void
-Grob::substitute_object_links (SCM crit, SCM orig)
-{
-  set_break_subsititution (crit);
-  object_alist_ = substitute_object_alist (orig, object_alist_);
-}
-
 bool
 Grob::is_live () const
 {
index e806689a42a08622d75fdf2a134f3571ac21d7b6..93f5e5b950c1673c0ef674c0a70ccf9d3c5c95f4 100644 (file)
@@ -68,7 +68,7 @@ LY_DEFINE (ly_grob_interfaces, "ly:grob-interfaces",
   Grob *sc = unsmob_grob (grob);
   SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob");
 
-  return sc->get_interfaces ();
+  return sc->interfaces ();
 }
 
 LY_DEFINE (ly_grob_object, "ly:grob-object",
@@ -105,7 +105,7 @@ LY_DEFINE (ly_grob_layout, "ly:grob-layout",
   Grob *sc = unsmob_grob (g);
   SCM_ASSERT_TYPE (sc, g, SCM_ARG1, __FUNCTION__, "grob");
 
-  return sc->get_layout ()->self_scm ();
+  return sc->layout ()->self_scm ();
 }
 
 LY_DEFINE (ly_grob_alist_chain, "ly:grob-alist-chain",
@@ -119,7 +119,7 @@ LY_DEFINE (ly_grob_alist_chain, "ly:grob-alist-chain",
 
   if (global == SCM_UNDEFINED)
     {
-      global = sc->get_layout ()->lookup_variable (ly_symbol2scm ("font-defaults"));
+      global = sc->layout ()->lookup_variable (ly_symbol2scm ("font-defaults"));
       if (global == SCM_UNDEFINED)
        global = SCM_EOL;
     }
@@ -195,7 +195,7 @@ LY_DEFINE (ly_grob_original, "ly:grob-original",
 {
   Grob *me = unsmob_grob (grob);
   SCM_ASSERT_TYPE (me, grob, SCM_ARG1, __FUNCTION__, "grob");
-  return me->original_ ? me->original_->self_scm () : me->self_scm ();
+  return me->original () ? me->original ()->self_scm () : me->self_scm ();
 }
 
 /* TODO: maybe we should return a vector -- random access is more
@@ -254,7 +254,7 @@ LY_DEFINE (ly_grob_key, "ly:grob-key",
 {
   Grob *me = unsmob_grob (grob);
   SCM_ASSERT_TYPE (me, grob, SCM_ARG1, __FUNCTION__, "Grob");
-  return me->get_key ()->self_scm ();
+  return me->key ()->self_scm ();
 }
 
 LY_DEFINE (ly_grob_default_font, "ly:grob-default-font",
index aa0956e567bf278ea988fe065bf37c8d13d2cdae..3702f2017fcea486c99c264840d058afb711073d 100644 (file)
@@ -32,8 +32,8 @@ Grob::mark_smob (SCM ses)
      between X and Y in an erratic manner, leading to much more
      recursion depth (and core dumps if we link to pthreads).  */
 
-  if (s->original_)
-    scm_gc_mark (s->original_->self_scm ());
+  if (s->original ())
+    scm_gc_mark (s->original ()->self_scm ());
 
   s->derived_mark ();
   scm_gc_mark (s->object_alist_);
index e2899e8627d3fccb4b2f09f75a2c718c82338071..abad363e6cd07a7adf07f7b919d9ae58d3db31dd 100644 (file)
@@ -77,7 +77,7 @@ Grob::Grob (SCM basicprops,
   key_ = key;
   /* FIXME: default should be no callback.  */
   self_scm_ = SCM_EOL;
-  pscore_ = 0;
+  layout_ = 0;
   original_ = 0;
   interfaces_ = SCM_EOL;
   immutable_property_alist_ = basicprops;
@@ -117,7 +117,7 @@ Grob::Grob (Grob const &s, int copy_index)
   interfaces_ = s.interfaces_;
   object_alist_ = SCM_EOL;
 
-  pscore_ = 0;
+  layout_ = 0;
 
   smobify_self ();
   if (key_)
@@ -129,12 +129,23 @@ Grob::~Grob ()
 }
 
 
+static SCM
+grob_stencil_extent (Grob *me, Axis a)
+{
+  Stencil *m = me->get_stencil ();
+  Interval e;
+  if (m)
+    e = m->extent (a);
+  return ly_interval2scm (e);
+}
+
+
 MAKE_SCHEME_CALLBACK (Grob, stencil_height, 1);
 SCM
 Grob::stencil_height (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
-  return stencil_extent (me, Y_AXIS);
+  return grob_stencil_extent (me, Y_AXIS);
 }
 
 MAKE_SCHEME_CALLBACK (Grob, stencil_width, 1);
@@ -142,18 +153,9 @@ SCM
 Grob::stencil_width (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
-  return stencil_extent (me, X_AXIS);
+  return grob_stencil_extent (me, X_AXIS);
 }
 
-SCM
-Grob::stencil_extent (Grob *me, Axis a)
-{
-  Stencil *m = me->get_stencil ();
-  Interval e;
-  if (m)
-    e = m->extent (a);
-  return ly_interval2scm (e);
-}
 
 Interval
 robust_relative_extent (Grob *me, Grob *refpoint, Axis a)
@@ -165,11 +167,6 @@ robust_relative_extent (Grob *me, Grob *refpoint, Axis a)
   return ext;
 }
 
-Output_def *
-Grob::get_layout () const
-{
-  return pscore_ ? pscore_->layout () : 0;
-}
 
 Stencil *
 Grob::get_stencil () const
@@ -238,7 +235,7 @@ void
 Grob::handle_broken_dependencies ()
 {
   Spanner *sp = dynamic_cast<Spanner *> (this);
-  if (original_ && sp)
+  if (original () && sp)
     return;
 
   if (sp)
@@ -289,11 +286,11 @@ Grob::handle_prebroken_dependencies ()
 {
   /* Don't do this in the derived method, since we want to keep access to
      object_alist_ centralized.  */
-  if (original_)
+  if (original ())
     {
       Item *it = dynamic_cast<Item *> (this);
       substitute_object_links (scm_from_int (it->break_status_dir ()),
-                              original_->object_alist_);
+                              original ()->object_alist_);
     }
 }
 
@@ -557,38 +554,6 @@ Grob::get_parent (Axis a) const
   return dim_cache_[a].parent_;
 }
 
-/** Return Array of Grobs in SCM list LST */
-Link_array<Grob>
-ly_scm2grobs (SCM lst)
-{
-  Link_array<Grob> arr;
-
-  for (SCM s = lst; scm_is_pair (s); s = scm_cdr (s))
-    {
-      SCM e = scm_car (s);
-      arr.push (unsmob_grob (e));
-    }
-
-  arr.reverse ();
-  return arr;
-}
-
-Object_key const *
-Grob::get_key () const
-{
-  return key_;
-}
-
-/** Return SCM list of Grob array A */
-SCM
-ly_grobs2scm (Link_array<Grob> a)
-{
-  SCM s = SCM_EOL;
-  for (int i = a.size (); i; i--)
-    s = scm_cons (a[i - 1]->self_scm (), s);
-
-  return s;
-}
 
 ADD_INTERFACE (Grob, "grob-interface",
               "A grob represents a piece of music notation\n"
index 9a205ffd8e2fcbf460d039eb1d6a9fe599d64a02..c4fa088d3388b5aa6fdb70ba353a7cc82636af00 100644 (file)
@@ -38,7 +38,7 @@ Hara_kiri_group_spanner::consider_suicide (Grob *me)
 
   bool remove_first = to_boolean (me->get_property ("remove-first"));
   if (!remove_first
-       && ((sp->original_ && broken_spanner_index (sp) == 0)
+       && ((sp->original () && broken_spanner_index (sp) == 0)
           || Paper_column::get_rank (sp->get_bound (LEFT)->get_column ())
           == 0)) 
     return;
index ce954e664008f90bc845f48927d4e45aea720c79..49469d27bf985b02427de6904250677e3be28944 100644 (file)
@@ -49,7 +49,7 @@ protected:
   void clear_key_disambiguations ();
 
 public:
-  Object_key const *get_key () const;
+  Object_key const *key () const { return key_; }
   Object_key const *get_grob_key (String);
   Object_key const *get_context_key (String, String);
 
index 4dc2b196c44191ebf501df953cc21845d4b5ac72..46f1ff473ae972942bc72a779f3110c1b11f22e2 100644 (file)
@@ -38,85 +38,82 @@ protected:
   friend class Spanner;
   friend SCM ly_grob_properties (SCM);
   friend SCM ly_grob_basic_properties (SCM);
-  friend void check_interfaces_for_property (Grob const *, SCM);
   void substitute_object_links (SCM, SCM);
 
   DECLARE_CLASSNAME(Grob);
   Real get_offset (Axis a) const;
-public:
-  DECLARE_SCHEME_CALLBACK(x_parent_positioning, (SCM));
-  DECLARE_SCHEME_CALLBACK(y_parent_positioning, (SCM));
-
-  Object_key const *get_key () const;
 
+  Output_def *layout_;
+  Dimension_cache dim_cache_[NO_AXES];
   Grob *original_;
 
-  /* TODO: junk this member. */
-  Paper_score *pscore_;
+  SCM try_callback (SCM, SCM);
+public:
+  DECLARE_SCHEME_CALLBACK(x_parent_positioning, (SCM));
+  DECLARE_SCHEME_CALLBACK(y_parent_positioning, (SCM));
+  DECLARE_SCHEME_CALLBACK (stencil_height, (SCM smob));
+  DECLARE_SCHEME_CALLBACK (stencil_width, (SCM smob));
 
-  Dimension_cache dim_cache_[NO_AXES];
+  /* R/O access */
+  Output_def *layout () const { return layout_; }
+  Grob *original () const { return original_; }
+  SCM interfaces () const { return interfaces_; }
+  Object_key const *key () const { return key_; }
 
+  /* life & death */ 
   Grob (SCM basic_props, Object_key const *);
   Grob (Grob const &, int copy_count);
-
   virtual Grob *clone (int count) const;
-  static SCM stencil_extent (Grob*, Axis);
-  DECLARE_SCHEME_CALLBACK (stencil_height, (SCM smob));
-  DECLARE_SCHEME_CALLBACK (stencil_width, (SCM smob));
-    
-  
+
+  /* forced death */
+  void suicide ();
+  bool is_live () const;
+
+  /* naming. */
   String name () const;
-  /*
-    Properties
-  */
+
+  /* Properties */
+  SCM get_property_alist_chain (SCM) const;
   SCM internal_get_property (SCM symbol) const;
   SCM get_property_data (SCM symbol) const;
   SCM internal_get_object (SCM symbol) const;
-
   void del_property (SCM symbol); 
   void internal_set_property (SCM sym, SCM val);
   void internal_set_object (SCM sym, SCM val);
 
-  SCM try_callback (SCM, SCM);
-
-  SCM get_property_alist_chain (SCM) const;
-  static SCM ly_grob_set_property (SCM, SCM, SCM);
-  static SCM ly_grob_property (SCM, SCM);
-
+  /* messages */  
   void warning (String) const;
   void programming_error (String) const;
 
-  Output_def *get_layout () const;
+
+  /* class hierarchy */
   virtual System *get_system () const;
   virtual void do_break_processing ();
   virtual Grob *find_broken_piece (System *) const;
   virtual void discretionary_processing ();
   virtual void derived_mark () const;
+  virtual void handle_broken_dependencies ();
+  virtual void handle_prebroken_dependencies ();
 
+  /* printing */
   Stencil *get_stencil () const;
   Stencil get_print_stencil () const;
 
-  void suicide ();
-  bool is_live () const;
-
+  /* interfaces */
   bool internal_has_interface (SCM intf);
   static bool has_interface (Grob *me);
-  SCM get_interfaces () const;
-  
-  virtual void handle_broken_dependencies ();
-  virtual void handle_prebroken_dependencies ();
-
-  Interval extent (Grob *refpoint, Axis) const;
 
+  /* offsets */
   void translate_axis (Real, Axis);
   Real relative_coordinate (Grob const *refp, Axis) const;
-  Grob *common_refpoint (Grob const *s, Axis a) const;
 
+  /* extents */
+  Interval extent (Grob *refpoint, Axis) const;
   void flush_extent_cache (Axis);
 
+  /* refpoints */
+  Grob *common_refpoint (Grob const *s, Axis a) const;
   void set_parent (Grob *e, Axis);
-
-  // URG
   Grob *get_parent (Axis a) const;
   void fixup_refpoint ();
 };
@@ -125,23 +122,19 @@ DECLARE_UNSMOB (Grob, grob);
 Spanner *unsmob_spanner (SCM);
 Item *unsmob_item (SCM);
 
+/* refpoints */
 Grob *common_refpoint_of_list (SCM elt_list, Grob *, Axis a);
 Grob *common_refpoint_of_array (Link_array<Grob> const &, Grob *, Axis a);
+System *get_root_system (Grob *me);
 
-void set_break_subsititution (SCM criterion);
-SCM substitute_object_alist (SCM alist, SCM dest);
-
-Link_array<Grob> ly_scm2grobs (SCM ell);
-SCM ly_grobs2scm (Link_array<Grob> a);
-
+/* extents */ 
 Interval robust_relative_extent (Grob *, Grob *, Axis);
 
-
-SCM axis_offset_symbol (Axis a);
-SCM axis_self_offset_symbol (Axis a);
-SCM axis_parent_positioning (Axis a);
+/* offset/extent callbacks. */
 void add_offset_callback (Grob *g, SCM proc, Axis a);
 void chain_offset_callback (Grob *g, SCM proc, Axis a);
+SCM axis_offset_symbol (Axis a);
+SCM axis_parent_positioning (Axis a);
 
 
 #endif /* GROB_HH */
index 23b6ec3c04fd43f5543c5c73e3e317b5f2aa7bf9..686dfb33ebe869747edd868402ea26753fb4e99a 100644 (file)
@@ -22,6 +22,9 @@ class System : public Spanner
   int rank_;
   Grob_array *all_elements_;
   void init_elements ();
+  friend class Paper_score;    // ugh.
+  Paper_score *pscore_;        // ugh.
+  
 public:
   int get_rank () const;
   void post_processing ();
index b12a801571d3d13680e8736f41eb3d595441a5ef..33066086c3f4d02a4983d505ed6a2d406ed2a86d 100644 (file)
@@ -39,7 +39,7 @@ Item::Item (Item const &s, int copy_count)
 bool
 Item::is_breakable (Grob *me)
 {
-  if (me->original_)
+  if (me->original ())
     return false;
 
   if (!dynamic_cast<Item *> (me))
@@ -73,7 +73,7 @@ Item::copy_breakable_items ()
     {
       Grob *dolly = clone (count++);
       Item *item = dynamic_cast<Item *> (dolly);
-      pscore_->root_system ()->typeset_grob (item);
+      get_root_system (this)->typeset_grob (item);
       new_copies[i] = item;
     }
   while (flip (&i) != LEFT);
@@ -130,9 +130,9 @@ Item::find_prebroken_piece (Direction d) const
 Direction
 Item::break_status_dir () const
 {
-  if (original_)
+  if (original ())
     {
-      Item *i = dynamic_cast<Item *> (original_);
+      Item *i = dynamic_cast<Item *> (original ());
 
       return (i->broken_to_drul_[LEFT] == this) ? LEFT : RIGHT;
     }
index b0949fb664d33b4ce5f49db3aaeb092fff421020..0f35e8aab97fcdc8b0423b3720c5cd889fbf03d4 100644 (file)
@@ -182,7 +182,7 @@ Lily_parser::parser_error (Input const &i, String s)
 /****************************************************************/
 
 Output_def *
-get_layout (Lily_parser *parser)
+layout (Lily_parser *parser)
 {
   SCM id = parser->lexer_->lookup_identifier ("$defaultlayout");
   Output_def *layout = unsmob_output_def (id);
index 5013e406dfa04e48475febd3b5518243a21f4e11..85370bd4b551e598c08fd66d39c973adc57927f7 100644 (file)
@@ -129,7 +129,7 @@ Line_spanner::line_stencil (Grob *me,
                                              ly_symbol2scm ("fetaMusic")),
                                    SCM_UNDEFINED);
 
-      Font_metric *fm = select_font (me->get_layout (),
+      Font_metric *fm = select_font (me->layout (),
                                     scm_cons (style_alist,
                                               alist_chain));
       Stencil m = fm->find_by_name ("scripts.trill_element");
@@ -223,7 +223,7 @@ Line_spanner::print (SCM smob)
       */
 
       int k = broken_spanner_index (me);
-      Spanner *parent_sp = dynamic_cast<Spanner *> (me->original_);
+      Spanner *parent_sp = dynamic_cast<Spanner *> (me->original ());
       Spanner *next_sp = parent_sp->broken_intos_ [k + 1];
       Item *next_bound = next_sp->get_bound (RIGHT);
 
index f9c1f0b47d2f1b14660bc9ec500c4255700176e7..5a98e0bc84bf4e7d9920d507ac1d1e676ba12d77 100644 (file)
@@ -30,7 +30,7 @@ Lyric_extender::print (SCM smob)
     common = common->common_refpoint (right_text, X_AXIS);
 
   common = common->common_refpoint (me->get_bound (RIGHT), X_AXIS);
-  Real sl = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
+  Real sl = me->layout ()->get_dimension (ly_symbol2scm ("linethickness"));
 
   extract_grob_set (me, "heads", heads);
 
index 17fefa0923e3c10697e90b0824714fa6d8290807..f06bf9d8baa074b13fa22287c0e1b63b5f9f2a90 100644 (file)
@@ -45,7 +45,7 @@ Hyphen_spanner::print (SCM smob)
     }
   while (flip (&d) != LEFT);
 
-  Real lt = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
+  Real lt = me->layout ()->get_dimension (ly_symbol2scm ("linethickness"));
   Real th = robust_scm2double (me->get_property ("thickness"), 1) * lt;
   Real h = robust_scm2double (me->get_property ("height"), 0.5);
 
index 837a3748a4f52e8cf753910e7cbb038762584c2e..5818c73c7d111d440ce4d93a82b3f1c2b06ebce0 100644 (file)
@@ -298,7 +298,7 @@ Mensural_ligature_engraver::propagate_properties (Spanner *ligature,
   Real thickness
     = robust_scm2double (ligature->get_property ("thickness"), 1.4);
   thickness
-    *= ligature->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
+    *= ligature->layout ()->get_dimension (ly_symbol2scm ("linethickness"));
 
   Real head_width
     = Font_interface::get_default_font (ligature)->
index de4e0dc181c1d51c06502f5e56479d4bf96cf863..497eaffdf333326a197b51fa9064c3003029cc40 100644 (file)
@@ -143,7 +143,7 @@ internal_brew_primitive (Grob *me)
     }
 
   Real blotdiameter
-    = (me->get_layout ()->get_dimension (ly_symbol2scm ("blotdiameter")));
+    = (me->layout ()->get_dimension (ly_symbol2scm ("blotdiameter")));
 
   if (primitive & MLP_STEM)
     {
index 42d0193ad1f18844e2d44b88ef8656d68dda9073..c8adec86b5e0f7a1d48332d0ef091572e30c35d6 100644 (file)
@@ -129,7 +129,7 @@ Multi_measure_rest::symbol_stencil (Grob *me, Real space)
 
   Real staff_space = Staff_symbol_referencer::staff_space (me);
   Font_metric *musfont
-    = select_font (me->get_layout (), alist_chain);
+    = select_font (me->layout (), alist_chain);
 
   SCM sml = me->get_property ("use-breve-rest");
   if (measures == 1)
@@ -171,7 +171,7 @@ Multi_measure_rest::big_rest (Grob *me, Real width)
   Real hair_thick = robust_scm2double (me->get_property ("hair-thickness"), .1);
 
   Real ss = Staff_symbol_referencer::staff_space (me);
-  Real slt = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
+  Real slt = me->layout ()->get_dimension (ly_symbol2scm ("linethickness"));
   Real y = slt * thick_thick / 2 * ss;
   Real ythick = hair_thick * slt * ss;
   Box b (Interval (0.0, max (0.0, (width - 2 * ythick))), Interval (-y, y));
index 81ed7de0bc1ca4ae2eeb822712893b7c5b9ec7ee..7413bc5fe7ea63d2b6ac3f65f1a318b02c4ff292 100644 (file)
@@ -153,7 +153,7 @@ Note_spacing::get_spacing (Grob *me, Item *right_col,
    */
   if (!extents[RIGHT].is_empty ()
       && (Item::is_breakable (right_col)
-         || right_col->original_))
+         || right_col->original ()))
     {
       /*
        This is for the situation
index f025a6f0c7b5b54b9aa700de291a487b85a5c01f..53e87118f3cd4c4bb2793e3a5ffd01e37381d9c8 100644 (file)
@@ -42,7 +42,7 @@ Ottava_bracket::print (SCM smob)
   Interval span_points;
 
   Grob *common = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS);
-  Output_def *layout = me->get_layout ();
+  Output_def *layout = me->layout ();
 
   Drul_array<bool> broken;
   Direction d = LEFT;
index 13407f61e0051938b5b7fa0698f1a66620281ef5..2f1052b192019935160da8b87b77ee9a19f1f8b2 100644 (file)
@@ -120,10 +120,10 @@ Paper_column::print (SCM p)
 
   SCM properties = Font_interface::text_font_alist_chain (me);
 
-  SCM scm_mol = Text_interface::interpret_markup (me->get_layout ()->self_scm (),
+  SCM scm_mol = Text_interface::interpret_markup (me->layout ()->self_scm (),
                                                  properties,
                                                  scm_makfrom0str (r.to_str0 ()));
-  SCM when_mol = Text_interface::interpret_markup (me->get_layout ()->self_scm (),
+  SCM when_mol = Text_interface::interpret_markup (me->layout ()->self_scm (),
                                                   properties,
                                                   scm_makfrom0str (when.to_str0 ()));
   Stencil t = *unsmob_stencil (scm_mol);
index f84ac9218a0c51de6aa4b16a8de6926037e92851..f9718cbc6759cbcb735f88eb7b1992ab098dab85 100644 (file)
@@ -25,6 +25,7 @@ Paper_score::Paper_score (Output_def *layout)
 {
   layout_ = layout;
   system_ = 0;
+  pscore_ = 0;
   systems_ = SCM_EOL;
   paper_systems_ = SCM_EOL;
 }
@@ -40,6 +41,8 @@ Paper_score::derived_mark () const
 {
   if (layout_)
     scm_gc_mark (layout_->self_scm ());
+  if (pscore_)
+    scm_gc_mark (pscore_->self_scm ());
   scm_gc_mark (systems_);
   scm_gc_mark (paper_systems_);
 }
@@ -52,7 +55,7 @@ Paper_score::typeset_system (System *system)
 
   systems_ = scm_cons (system->self_scm (), systems_);
   system->pscore_ = this;
-
+  system->layout_ = pscore_->layout_;
   system->unprotect ();
 }
 
index d11e670e78fbdd8e19ba743fc6fa89b9fa7a5b83..627b631d15a883c3d0f5649c58e50bb41c6b965f 100644 (file)
@@ -22,7 +22,7 @@ SCM
 Piano_pedal_bracket::print (SCM smob)
 {
   Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob));
-  Spanner *orig = dynamic_cast<Spanner *> (me->original_);
+  Spanner *orig = dynamic_cast<Spanner *> (me->original ());
 
   Drul_array<bool> broken (false, false);
   Drul_array<Real> height = robust_scm2drul
index dfabf0e84ee962b18aed4ff6768af17a25e2af3a..9701fe094c08945e65208b356ac9bb6d72b28dbb 100644 (file)
@@ -125,7 +125,7 @@ broken_trend_y (Slur_score_state const &state, Direction hdir)
   /* A broken slur should maintain the same vertical trend
      the unbroken slur would have had.  */
   Real by = 0.0;
-  if (Spanner *mother = dynamic_cast<Spanner *> (state.slur_->original_))
+  if (Spanner *mother = dynamic_cast<Spanner *> (state.slur_->original ()))
     {
       int k = broken_spanner_index (state.slur_);
       int j = k + hdir;
@@ -134,7 +134,7 @@ broken_trend_y (Slur_score_state const &state, Direction hdir)
 
       Grob *neighbor = mother->broken_intos_[j];
       Spanner *common_mother
-       = dynamic_cast<Spanner *> (state.common_[Y_AXIS]->original_);
+       = dynamic_cast<Spanner *> (state.common_[Y_AXIS]->original ());
       int common_k
        = broken_spanner_index (dynamic_cast<Spanner *> (state.common_[Y_AXIS]));
       int common_j = common_k + hdir;
@@ -161,7 +161,7 @@ Slur_score_state::set_next_direction ()
   if (extremes_[RIGHT].note_column_)
     return;
 
-  if (Spanner *mother = dynamic_cast<Spanner *> (slur_->original_))
+  if (Spanner *mother = dynamic_cast<Spanner *> (slur_->original ()))
     {
       int k = broken_spanner_index (slur_);
       int j = k + 1;
@@ -289,7 +289,7 @@ Slur_score_state::fill (Grob *me)
     }
 
   staff_space_ = Staff_symbol_referencer::staff_space (me);
-  Real lt = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
+  Real lt = me->layout ()->get_dimension (ly_symbol2scm ("linethickness"));
   thickness_ = robust_scm2double (me->get_property ("thickness"), 1.0) * lt;
 
   dir_ = get_grob_direction (me);
@@ -402,7 +402,7 @@ Slur_score_state::get_best_curve ()
 
 #if DEBUG_SLUR_SCORING
   SCM inspect_quants = slur_->get_property ("inspect-quants");
-  if (to_boolean (slur_->get_layout ()
+  if (to_boolean (slur_->layout ()
                  ->lookup_variable (ly_symbol2scm ("debug-slur-scoring")))
       && scm_is_pair (inspect_quants))
     {
index 2c8165ac72d60204b502f31b4dce81f5b152164d..fa6e9e242b48397c84fdd1a23ccbf518f4173ed4 100644 (file)
@@ -104,7 +104,7 @@ Slur::print (SCM smob)
 #if DEBUG_SLUR_SCORING
   SCM quant_score = me->get_property ("quant-score");
 
-  if (to_boolean (me->get_layout ()
+  if (to_boolean (me->layout ()
                  ->lookup_variable (ly_symbol2scm ("debug-slur-scoring")))
       && scm_is_string (quant_score))
     {
@@ -112,7 +112,7 @@ Slur::print (SCM smob)
       SCM properties = Font_interface::text_font_alist_chain (me);
 
       Stencil tm = *unsmob_stencil (Text_interface::interpret_markup
-                                   (me->get_layout ()->self_scm (), properties,
+                                   (me->layout ()->self_scm (), properties,
                                     quant_score));
       a.add_at_edge (Y_AXIS, get_grob_direction (me), tm, 1.0, 0);
     }
index fd3e8e386df5be993c85245aa76bb5d2ad30ecf0..3549ad641ed8c974104dbf29800f81d0844e08b6 100644 (file)
@@ -43,6 +43,7 @@ Spacing_spanner::effective_shortest_duration (Grob *me,
   return global_shortest;
 }
 
+
 MAKE_SCHEME_CALLBACK (Spacing_spanner, set_springs, 1);
 SCM
 Spacing_spanner::set_springs (SCM smob)
@@ -52,7 +53,7 @@ Spacing_spanner::set_springs (SCM smob)
   /*
     can't use get_system() ? --hwn.
   */
-  Link_array<Grob> all (me->pscore_->root_system ()->columns ());
+  Link_array<Grob> all (get_root_system (me)->columns ());
 
   set_explicit_neighbor_columns (all);
 
@@ -267,7 +268,7 @@ Spacing_spanner::musical_column_spacing (Grob *me,
 
          Item *wish_rcol = Note_spacing::right_column (wish);
          if (Note_spacing::left_column (wish) != left_col
-             || (wish_rcol != right_col && wish_rcol != right_col->original_))
+             || (wish_rcol != right_col && wish_rcol != right_col->original ()))
            continue;
 
          /*
index 182a2a818c27b15d11c537313e3dc0832fa3abd6..2c49aacad7d836e4ba8520fdf53feab8ef2bbc77 100644 (file)
@@ -330,12 +330,12 @@ Spanner::set_spacing_rods (SCM smob)
 }
 
 /*
-  Return I such that SP == SP->ORIGINAL_->BROKEN_INTOS_[I].
+  Return I such that SP == SP->ORIGINAL ()->BROKEN_INTOS_[I].
 */
 int
 broken_spanner_index (Spanner *sp)
 {
-  Spanner *parent = dynamic_cast<Spanner *> (sp->original_);
+  Spanner *parent = dynamic_cast<Spanner *> (sp->original ());
   return parent->broken_intos_.find_index (sp);
 }
 
index 22fb460ed181c4ce0b695a8b3bcea09ac1753c23..d4780bedb608264a7cc51c92a6324e389ce10302 100644 (file)
@@ -62,7 +62,7 @@ Staff_symbol_referencer::line_thickness (Grob *me)
   Grob *st = get_staff_symbol (me);
   if (st)
     return Staff_symbol::get_line_thickness (st);
-  return me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
+  return me->layout ()->get_dimension (ly_symbol2scm ("linethickness"));
 }
 
 Real
index b57d1191d43a910df22f033ce4248e1a7dae9022..4d186e87bfc4e03f5936ce50a5387de5776c11f2 100644 (file)
@@ -35,7 +35,7 @@ Staff_symbol::print (SCM smob)
 
     --hwn.
   */
-  Real t = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
+  Real t = me->layout ()->get_dimension (ly_symbol2scm ("linethickness"));
   t *= robust_scm2double (me->get_property ("thickness"), 1.0);
 
   Direction d = LEFT;
@@ -108,7 +108,7 @@ Staff_symbol::staff_space (Grob *me)
 Real
 Staff_symbol::get_line_thickness (Grob *me)
 {
-  Real lt = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
+  Real lt = me->layout ()->get_dimension (ly_symbol2scm ("linethickness"));
 
   return robust_scm2double (me->get_property ("thickness"), 1.0) * lt;
 }
index 54b5a2243f8819d75aca21c45942c770bdaeb192..80df9b606e9e94a31f7307915d3a5cc369339c6f 100644 (file)
@@ -73,7 +73,7 @@ Stem_tremolo::raw_stencil (Grob *me)
   Real ss = Staff_symbol_referencer::staff_space (me);
   Real thick = robust_scm2double (me->get_property ("beam-thickness"), 1);
   Real width = robust_scm2double (me->get_property ("beam-width"), 1);
-  Real blot = me->get_layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
+  Real blot = me->layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
 
   width *= ss;
   thick *= ss;
index 2b771164ceeee468a67184cf621fee5dc98e4c20..6e9f9328837febb40da77e85fb1a6e96046da5df 100644 (file)
@@ -694,7 +694,7 @@ Stem::print (SCM smob)
   // URG
   Real stem_width = thickness (me);
   Real blot
-    = me->get_layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
+    = me->layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
 
   Box b = Box (Interval (-stem_width / 2, stem_width / 2),
               Interval (stem_y[DOWN] * half_space, stem_y[UP] * half_space));
@@ -715,7 +715,7 @@ Stem::get_translated_flag (Grob *me)
     {
       Direction d = get_grob_direction (me);
       Real blot
-       = me->get_layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
+       = me->layout ()->get_dimension (ly_symbol2scm ("blotdiameter"));
       Real stem_width = thickness (me);
       Real half_space = Staff_symbol_referencer::staff_space (me) * 0.5;
       Real y2 = robust_scm2double (me->get_property ("stem-end-position"), 0.0);
index 8662b45b5b1944a0e52daf74f67c9a367a2fe5a3..5e4bb58e189e21031e9f071e68c3f8fab00070d6 100644 (file)
@@ -47,7 +47,7 @@ System_start_delimiter::staff_bracket (Grob *me, Real height)
 Stencil
 System_start_delimiter::simple_bar (Grob *me, Real h)
 {
-  Real lt = me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
+  Real lt = me->layout ()->get_dimension (ly_symbol2scm ("linethickness"));
   Real w = lt * robust_scm2double (me->get_property ("thickness"), 1);
   return Lookup::round_filled_box (Box (Interval (0, w), Interval (-h / 2, h / 2)),
                                   lt);
@@ -133,7 +133,7 @@ System_start_delimiter::staff_brace (Grob *me, Real y)
                      ly_symbol2scm ("fetaBraces"));
 
   SCM alist = scm_list_n (fam, SCM_UNDEFINED);
-  fm = select_font (me->get_layout (), scm_list_n (alist, SCM_UNDEFINED));
+  fm = select_font (me->layout (), scm_list_n (alist, SCM_UNDEFINED));
 
   int lo = 0;
   int hi = max (fm->count () - 1, 2);
index 60bdfeed59b017bb9d74e84b46c4dd20bcdc36d7..10a4e9505b30716c62b7e4ff25ef922939e92913 100644 (file)
@@ -79,7 +79,7 @@ System::typeset_grob (Grob *elem)
     programming_error ("adding element twice");
   else
     {
-      elem->pscore_ = pscore_;
+      elem->layout_ = pscore_->layout_;
       all_elements_->add (elem);
       elem->unprotect ();
     }
@@ -245,7 +245,7 @@ System::add_column (Paper_column *p)
 void
 apply_tweaks (Grob *g, bool broken)
 {
-  if (bool (g->original_) == broken)
+  if (bool (g->original ()) == broken)
     {
       SCM tweaks = global_registry_->get_tweaks (g);
       for (SCM s = tweaks; scm_is_pair (s); s = scm_cdr (s))
@@ -458,6 +458,16 @@ System::get_rank () const
   return rank_;
 }
 
+System *
+get_root_system (Grob *me) 
+{
+  Grob *system_grob = me;
+  while (system->get_parent (Y_AXIS))
+    system = system->get_parent (Y_AXIS);
+
+  return dynamic_cast<System*> (system_grob); 
+}
+
 ADD_INTERFACE (System, "system-interface",
               "This is the toplevel object: each object in a score "
               "ultimately has a System object as its X and Y parent. ",
index a940c4e452b5f1b48f33af4826e92d3a6786868c..5797f12e08167a15c9f6e6f0436a32cec8eb0564 100644 (file)
@@ -77,7 +77,7 @@ Text_interface::print (SCM grob)
 
   SCM t = me->get_property ("text");
   SCM chain = Font_interface::text_font_alist_chain (me);
-  return interpret_markup (me->get_layout ()->self_scm (), chain, t);
+  return interpret_markup (me->layout ()->self_scm (), chain, t);
 }
 
 /* Ugh. Duplicated from Scheme.  */
index 52cd57f8d8c517d700745413b200e7c239e9b6e3..be24e02e05a9d25935e564557ca80cad6ae9af6b 100644 (file)
@@ -42,7 +42,7 @@ Text_spanner::print (SCM smob)
   /* Ugh, must be same as Hairpin::print.  */
 
   Grob *common = spanner->get_bound (LEFT)->common_refpoint (spanner->get_bound (RIGHT), X_AXIS);
-  Output_def *layout = me->get_layout ();
+  Output_def *layout = me->layout ();
 
   SCM flare = me->get_property ("bracket-flare");
   SCM shorten = me->get_property ("shorten-pair");
index 544debf16ac7b10edd751d37a4868407027dd561..ae420107cbee10a99095a5bb7641917da8e54b94 100644 (file)
@@ -91,9 +91,9 @@ Time_signature::numbered_time_signature (Grob *me, int num, int den)
                                          ly_symbol2scm ("fetaNumber"))),
                    chain);
 
-  SCM sn = Text_interface::interpret_markup (me->get_layout ()->self_scm (), chain,
+  SCM sn = Text_interface::interpret_markup (me->layout ()->self_scm (), chain,
                                             scm_makfrom0str (to_string (num).to_str0 ()));
-  SCM sd = Text_interface::interpret_markup (me->get_layout ()->self_scm (), chain,
+  SCM sd = Text_interface::interpret_markup (me->layout ()->self_scm (), chain,
                                             scm_makfrom0str (to_string (den).to_str0 ()));
 
   Stencil n = *unsmob_stencil (sn);
index 3e05c75a8a5d436280578c14e8b83fff1b3e9440..297e6a4bea12687f7f041636bd671b77817dfe11 100644 (file)
@@ -151,7 +151,7 @@ Tuplet_bracket::print (SCM smob)
     {
       x_span[d] = robust_relative_extent (bounds[d], commonx, X_AXIS)[d];
       Direction break_dir = bounds[d]->break_status_dir ();
-      Spanner *orig_spanner = dynamic_cast<Spanner *> (me->original_);
+      Spanner *orig_spanner = dynamic_cast<Spanner *> (me->original ());
 
       int neighbor_idx = me->get_break_index () - break_dir;
 
@@ -204,7 +204,7 @@ Tuplet_bracket::print (SCM smob)
   Real w = x_span.length ();
   SCM number = me->get_property ("text");
 
-  Output_def *pap = me->get_layout ();
+  Output_def *pap = me->layout ();
   Stencil num;
   if (scm_is_string (number) && number_visibility)
     {
index 7819fb380dd1187e484b54ab17dd07a5714ca8b5..8bb63c6ccd08b71b3a33f0092dca94e9b9d19dcf 100644 (file)
@@ -159,7 +159,7 @@ Vaticana_ligature_engraver::align_heads (Array<Grob_info> primitives,
     = dynamic_cast<Item *> (primitives[0].grob ())->get_column ();
 
   Real join_thickness
-    = thickness * column->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
+    = thickness * column->layout ()->get_dimension (ly_symbol2scm ("linethickness"));
 
   /*
    * Amount of extra space two put between some particular
index e65e89518e69188d48208b2f243355f9f07659c5..ed65133ec5edd19b16feea74b509a8653daa8782 100644 (file)
@@ -203,10 +203,10 @@ vaticana_brew_primitive (Grob *me)
   Real thickness = robust_scm2double (me->get_property ("thickness"), 1);
 
   Real line_thickness
-    = thickness * me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness"));
+    = thickness * me->layout ()->get_dimension (ly_symbol2scm ("linethickness"));
 
   Real blotdiameter
-    = (me->get_layout ()->get_dimension (ly_symbol2scm ("blotdiameter")));
+    = (me->layout ()->get_dimension (ly_symbol2scm ("blotdiameter")));
 
   int pos = Staff_symbol_referencer::get_rounded_position (me);
 
index e97c7b0994e88aec74bf1ede332958d9c2ca1fb5..03c9dd2d1bc8ecd4fdec521af2d8e41f78b82266 100644 (file)
@@ -36,11 +36,11 @@ SCM
 Volta_bracket_interface::print (SCM smob)
 {
   Spanner *me = unsmob_spanner (smob);
-  Spanner *orig_span = dynamic_cast<Spanner *> (me->original_);
+  Spanner *orig_span = dynamic_cast<Spanner *> (me->original ());
   bool broken_first_bracket = orig_span && (orig_span->broken_intos_[0]
                                            == (Spanner *)me);
   
-  Output_def *layout = me->get_layout ();
+  Output_def *layout = me->layout ();
   Real half_space = 0.5;
 
   Item *bound = dynamic_cast<Spanner *> (me)->get_bound (LEFT);
@@ -106,7 +106,7 @@ SCM
 Volta_bracket_interface::after_line_breaking (SCM smob)
 {
   Spanner *me = unsmob_spanner (smob);
-  Spanner *orig_span = dynamic_cast<Spanner *> (me->original_);
+  Spanner *orig_span = dynamic_cast<Spanner *> (me->original ());
  
   bool broken_first_bracket = orig_span && (orig_span->broken_intos_[0] == (Spanner *)me);