From 8f8b3fb62d5d0776335de899b32aada69457810a Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 2 Nov 2005 14:12:25 +0000 Subject: [PATCH] (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. --- ChangeLog | 5 ++ lily/accidental.cc | 4 +- lily/ambitus.cc | 4 +- lily/arpeggio.cc | 2 +- lily/balloon.cc | 2 +- lily/bar-line.cc | 4 +- lily/beam-quanting.cc | 4 +- lily/beam.cc | 8 +-- lily/break-substitution.cc | 6 ++ lily/breathing-sign.cc | 8 +-- lily/cluster.cc | 4 +- lily/context.cc | 9 +-- lily/dynamic-text-spanner.cc | 2 +- lily/easy-notation.cc | 2 +- lily/figured-bass-continuation.cc | 2 +- lily/font-interface.cc | 6 +- lily/gourlay-breaking.cc | 2 +- lily/grid-line-interface.cc | 4 +- lily/grob-interface.cc | 2 +- lily/grob-property.cc | 13 ----- lily/grob-scheme.cc | 10 ++-- lily/grob-smob.cc | 4 +- lily/grob.cc | 71 ++++++------------------ lily/hara-kiri-group-spanner.cc | 2 +- lily/include/context.hh | 2 +- lily/include/grob.hh | 89 ++++++++++++++---------------- lily/include/system.hh | 3 + lily/item.cc | 8 +-- lily/lily-parser.cc | 2 +- lily/line-spanner.cc | 4 +- lily/lyric-extender.cc | 2 +- lily/lyric-hyphen.cc | 2 +- lily/mensural-ligature-engraver.cc | 2 +- lily/mensural-ligature.cc | 2 +- lily/multi-measure-rest.cc | 4 +- lily/note-spacing.cc | 2 +- lily/ottava-bracket.cc | 2 +- lily/paper-column.cc | 4 +- lily/paper-score.cc | 5 +- lily/piano-pedal-bracket.cc | 2 +- lily/slur-scoring.cc | 10 ++-- lily/slur.cc | 4 +- lily/spacing-spanner.cc | 5 +- lily/spanner.cc | 4 +- lily/staff-symbol-referencer.cc | 2 +- lily/staff-symbol.cc | 4 +- lily/stem-tremolo.cc | 2 +- lily/stem.cc | 4 +- lily/system-start-delimiter.cc | 4 +- lily/system.cc | 14 ++++- lily/text-interface.cc | 2 +- lily/text-spanner.cc | 2 +- lily/time-signature.cc | 4 +- lily/tuplet-bracket.cc | 4 +- lily/vaticana-ligature-engraver.cc | 2 +- lily/vaticana-ligature.cc | 4 +- lily/volta-bracket.cc | 6 +- 57 files changed, 180 insertions(+), 212 deletions(-) diff --git a/ChangeLog b/ChangeLog index dca5cf32e4..afef6167b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2005-11-02 Han-Wen Nienhuys + * 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 diff --git a/lily/accidental.cc b/lily/accidental.cc index 3ee074a818..c9d9c9ebc2 100644 --- a/lily/accidental.cc +++ b/lily/accidental.cc @@ -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); diff --git a/lily/ambitus.cc b/lily/ambitus.cc index 472df25037..87ea977478 100644 --- a/lily/ambitus.cc +++ b/lily/ambitus.cc @@ -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); diff --git a/lily/arpeggio.cc b/lily/arpeggio.cc index 326ef89a92..3c2663939a 100644 --- a/lily/arpeggio.cc +++ b/lily/arpeggio.cc @@ -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; diff --git a/lily/balloon.cc b/lily/balloon.cc index fb7ac913d6..18bd989812 100644 --- a/lily/balloon.cc +++ b/lily/balloon.cc @@ -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); diff --git a/lily/bar-line.cc b/lily/bar-line.cc index 49e435fe3f..da02119b62 100644 --- a/lily/bar-line.cc +++ b/lily/bar-line.cc @@ -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), diff --git a/lily/beam-quanting.cc b/lily/beam-quanting.cc index 75e00fb93c..5f44ef840c 100644 --- a/lily/beam-quanting.cc +++ b/lily/beam-quanting.cc @@ -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 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); diff --git a/lily/beam.cc b/lily/beam.cc index 0bc258a485..6ad45126d7 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -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); diff --git a/lily/break-substitution.cc b/lily/break-substitution.cc index bed8b97c86..f735033885 100644 --- a/lily/break-substitution.cc +++ b/lily/break-substitution.cc @@ -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_); +} diff --git a/lily/breathing-sign.cc b/lily/breathing-sign.cc index fc873d567d..b52752d6b3 100644 --- a/lily/breathing-sign.cc +++ b/lily/breathing-sign.cc @@ -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); diff --git a/lily/cluster.cc b/lily/cluster.cc index 6eacdf82f7..3073e03c0d 100644 --- a/lily/cluster.cc +++ b/lily/cluster.cc @@ -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->original_); + Spanner *orig = dynamic_cast (spanner->original ()); if (spanner->get_break_index () < orig->broken_intos_.size () - 1) { diff --git a/lily/context.cc b/lily/context.cc index 7a5eda0b74..1f086390d6 100644 --- a/lily/context.cc +++ b/lily/context.cc @@ -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); diff --git a/lily/dynamic-text-spanner.cc b/lily/dynamic-text-spanner.cc index e330e62c12..b9e8945e5f 100644 --- a/lily/dynamic-text-spanner.cc +++ b/lily/dynamic-text-spanner.cc @@ -52,7 +52,7 @@ Dynamic_text_spanner::print (SCM smob) Spanner *spanner = dynamic_cast (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 broken; diff --git a/lily/easy-notation.cc b/lily/easy-notation.cc index 879ded5483..93124765e2 100644 --- a/lily/easy-notation.cc +++ b/lily/easy-notation.cc @@ -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); diff --git a/lily/figured-bass-continuation.cc b/lily/figured-bass-continuation.cc index c7018f6228..55124bf095 100644 --- a/lily/figured-bass-continuation.cc +++ b/lily/figured-bass-continuation.cc @@ -51,7 +51,7 @@ Figured_bass_continuation::print (SCM grob) Spanner *me = dynamic_cast (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; diff --git a/lily/font-interface.cc b/lily/font-interface.cc index fe258a86dc..67eb3b2af8 100644 --- a/lily/font-interface.cc +++ b/lily/font-interface.cc @@ -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); diff --git a/lily/gourlay-breaking.cc b/lily/gourlay-breaking.cc index f5d78b9f51..9f0f225213 100644 --- a/lily/gourlay-breaking.cc +++ b/lily/gourlay-breaking.cc @@ -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) diff --git a/lily/grid-line-interface.cc b/lily/grid-line-interface.cc index 5661e1dfbe..7451ae68c4 100644 --- a/lily/grid-line-interface.cc +++ b/lily/grid-line-interface.cc @@ -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; diff --git a/lily/grob-interface.cc b/lily/grob-interface.cc index baefab264f..9e433818e9 100644 --- a/lily/grob-interface.cc +++ b/lily/grob-interface.cc @@ -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; diff --git a/lily/grob-property.cc b/lily/grob-property.cc index c9d0ea8aae..59a3cd68f2 100644 --- a/lily/grob-property.cc +++ b/lily/grob-property.cc @@ -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 { diff --git a/lily/grob-scheme.cc b/lily/grob-scheme.cc index e806689a42..93f5e5b950 100644 --- a/lily/grob-scheme.cc +++ b/lily/grob-scheme.cc @@ -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", diff --git a/lily/grob-smob.cc b/lily/grob-smob.cc index aa0956e567..3702f2017f 100644 --- a/lily/grob-smob.cc +++ b/lily/grob-smob.cc @@ -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_); diff --git a/lily/grob.cc b/lily/grob.cc index e2899e8627..abad363e6c 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -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 (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 (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 -ly_scm2grobs (SCM lst) -{ - Link_array 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 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" diff --git a/lily/hara-kiri-group-spanner.cc b/lily/hara-kiri-group-spanner.cc index 9a205ffd8e..c4fa088d33 100644 --- a/lily/hara-kiri-group-spanner.cc +++ b/lily/hara-kiri-group-spanner.cc @@ -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; diff --git a/lily/include/context.hh b/lily/include/context.hh index ce954e6640..49469d27bf 100644 --- a/lily/include/context.hh +++ b/lily/include/context.hh @@ -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); diff --git a/lily/include/grob.hh b/lily/include/grob.hh index 4dc2b196c4..46f1ff473a 100644 --- a/lily/include/grob.hh +++ b/lily/include/grob.hh @@ -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 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 ly_scm2grobs (SCM ell); -SCM ly_grobs2scm (Link_array 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 */ diff --git a/lily/include/system.hh b/lily/include/system.hh index 23b6ec3c04..686dfb33eb 100644 --- a/lily/include/system.hh +++ b/lily/include/system.hh @@ -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 (); diff --git a/lily/item.cc b/lily/item.cc index b12a801571..33066086c3 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -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 (me)) @@ -73,7 +73,7 @@ Item::copy_breakable_items () { Grob *dolly = clone (count++); Item *item = dynamic_cast (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 (original_); + Item *i = dynamic_cast (original ()); return (i->broken_to_drul_[LEFT] == this) ? LEFT : RIGHT; } diff --git a/lily/lily-parser.cc b/lily/lily-parser.cc index b0949fb664..0f35e8aab9 100644 --- a/lily/lily-parser.cc +++ b/lily/lily-parser.cc @@ -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); diff --git a/lily/line-spanner.cc b/lily/line-spanner.cc index 5013e406df..85370bd4b5 100644 --- a/lily/line-spanner.cc +++ b/lily/line-spanner.cc @@ -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 (me->original_); + Spanner *parent_sp = dynamic_cast (me->original ()); Spanner *next_sp = parent_sp->broken_intos_ [k + 1]; Item *next_bound = next_sp->get_bound (RIGHT); diff --git a/lily/lyric-extender.cc b/lily/lyric-extender.cc index f9c1f0b47d..5a98e0bc84 100644 --- a/lily/lyric-extender.cc +++ b/lily/lyric-extender.cc @@ -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); diff --git a/lily/lyric-hyphen.cc b/lily/lyric-hyphen.cc index 17fefa0923..f06bf9d8ba 100644 --- a/lily/lyric-hyphen.cc +++ b/lily/lyric-hyphen.cc @@ -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); diff --git a/lily/mensural-ligature-engraver.cc b/lily/mensural-ligature-engraver.cc index 837a3748a4..5818c73c7d 100644 --- a/lily/mensural-ligature-engraver.cc +++ b/lily/mensural-ligature-engraver.cc @@ -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)-> diff --git a/lily/mensural-ligature.cc b/lily/mensural-ligature.cc index de4e0dc181..497eaffdf3 100644 --- a/lily/mensural-ligature.cc +++ b/lily/mensural-ligature.cc @@ -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) { diff --git a/lily/multi-measure-rest.cc b/lily/multi-measure-rest.cc index 42d0193ad1..c8adec86b5 100644 --- a/lily/multi-measure-rest.cc +++ b/lily/multi-measure-rest.cc @@ -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)); diff --git a/lily/note-spacing.cc b/lily/note-spacing.cc index 81ed7de0bc..7413bc5fe7 100644 --- a/lily/note-spacing.cc +++ b/lily/note-spacing.cc @@ -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 diff --git a/lily/ottava-bracket.cc b/lily/ottava-bracket.cc index f025a6f0c7..53e87118f3 100644 --- a/lily/ottava-bracket.cc +++ b/lily/ottava-bracket.cc @@ -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 broken; Direction d = LEFT; diff --git a/lily/paper-column.cc b/lily/paper-column.cc index 13407f61e0..2f1052b192 100644 --- a/lily/paper-column.cc +++ b/lily/paper-column.cc @@ -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); diff --git a/lily/paper-score.cc b/lily/paper-score.cc index f84ac9218a..f9718cbc67 100644 --- a/lily/paper-score.cc +++ b/lily/paper-score.cc @@ -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 (); } diff --git a/lily/piano-pedal-bracket.cc b/lily/piano-pedal-bracket.cc index d11e670e78..627b631d15 100644 --- a/lily/piano-pedal-bracket.cc +++ b/lily/piano-pedal-bracket.cc @@ -22,7 +22,7 @@ SCM Piano_pedal_bracket::print (SCM smob) { Spanner *me = dynamic_cast (unsmob_grob (smob)); - Spanner *orig = dynamic_cast (me->original_); + Spanner *orig = dynamic_cast (me->original ()); Drul_array broken (false, false); Drul_array height = robust_scm2drul diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc index dfabf0e84e..9701fe094c 100644 --- a/lily/slur-scoring.cc +++ b/lily/slur-scoring.cc @@ -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 (state.slur_->original_)) + if (Spanner *mother = dynamic_cast (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 (state.common_[Y_AXIS]->original_); + = dynamic_cast (state.common_[Y_AXIS]->original ()); int common_k = broken_spanner_index (dynamic_cast (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 (slur_->original_)) + if (Spanner *mother = dynamic_cast (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)) { diff --git a/lily/slur.cc b/lily/slur.cc index 2c8165ac72..fa6e9e242b 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -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); } diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index fd3e8e386d..3549ad641e 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -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 all (me->pscore_->root_system ()->columns ()); + Link_array 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; /* diff --git a/lily/spanner.cc b/lily/spanner.cc index 182a2a818c..2c49aacad7 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -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 (sp->original_); + Spanner *parent = dynamic_cast (sp->original ()); return parent->broken_intos_.find_index (sp); } diff --git a/lily/staff-symbol-referencer.cc b/lily/staff-symbol-referencer.cc index 22fb460ed1..d4780bedb6 100644 --- a/lily/staff-symbol-referencer.cc +++ b/lily/staff-symbol-referencer.cc @@ -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 diff --git a/lily/staff-symbol.cc b/lily/staff-symbol.cc index b57d1191d4..4d186e87bf 100644 --- a/lily/staff-symbol.cc +++ b/lily/staff-symbol.cc @@ -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; } diff --git a/lily/stem-tremolo.cc b/lily/stem-tremolo.cc index 54b5a2243f..80df9b606e 100644 --- a/lily/stem-tremolo.cc +++ b/lily/stem-tremolo.cc @@ -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; diff --git a/lily/stem.cc b/lily/stem.cc index 2b771164ce..6e9f932883 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -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); diff --git a/lily/system-start-delimiter.cc b/lily/system-start-delimiter.cc index 8662b45b5b..5e4bb58e18 100644 --- a/lily/system-start-delimiter.cc +++ b/lily/system-start-delimiter.cc @@ -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); diff --git a/lily/system.cc b/lily/system.cc index 60bdfeed59..10a4e9505b 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -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_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. ", diff --git a/lily/text-interface.cc b/lily/text-interface.cc index a940c4e452..5797f12e08 100644 --- a/lily/text-interface.cc +++ b/lily/text-interface.cc @@ -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. */ diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc index 52cd57f8d8..be24e02e05 100644 --- a/lily/text-spanner.cc +++ b/lily/text-spanner.cc @@ -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"); diff --git a/lily/time-signature.cc b/lily/time-signature.cc index 544debf16a..ae420107cb 100644 --- a/lily/time-signature.cc +++ b/lily/time-signature.cc @@ -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); diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc index 3e05c75a8a..297e6a4bea 100644 --- a/lily/tuplet-bracket.cc +++ b/lily/tuplet-bracket.cc @@ -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 (me->original_); + Spanner *orig_spanner = dynamic_cast (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) { diff --git a/lily/vaticana-ligature-engraver.cc b/lily/vaticana-ligature-engraver.cc index 7819fb380d..8bb63c6ccd 100644 --- a/lily/vaticana-ligature-engraver.cc +++ b/lily/vaticana-ligature-engraver.cc @@ -159,7 +159,7 @@ Vaticana_ligature_engraver::align_heads (Array primitives, = dynamic_cast (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 diff --git a/lily/vaticana-ligature.cc b/lily/vaticana-ligature.cc index e65e89518e..ed65133ec5 100644 --- a/lily/vaticana-ligature.cc +++ b/lily/vaticana-ligature.cc @@ -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); diff --git a/lily/volta-bracket.cc b/lily/volta-bracket.cc index e97c7b0994..03c9dd2d1b 100644 --- a/lily/volta-bracket.cc +++ b/lily/volta-bracket.cc @@ -36,11 +36,11 @@ SCM Volta_bracket_interface::print (SCM smob) { Spanner *me = unsmob_spanner (smob); - Spanner *orig_span = dynamic_cast (me->original_); + Spanner *orig_span = dynamic_cast (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 (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 (me->original_); + Spanner *orig_span = dynamic_cast (me->original ()); bool broken_first_bracket = orig_span && (orig_span->broken_intos_[0] == (Spanner *)me); -- 2.39.2