original_ in private scope.
(class Grob): drop pscore_ pointer, change to output_def pointer.
(class Grob): cleanup class definition.
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>
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;
}
(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);
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);
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;
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);
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;
{
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),
#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);
#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);
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++)
{
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;
#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))
{
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);
}
}
+void
+Grob::substitute_object_links (SCM crit, SCM orig)
+{
+ set_break_subsititution (crit);
+ object_alist_ = substitute_object_alist (orig, object_alist_);
+}
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
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
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);
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);
/*
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)
{
}
}
-Object_key const *
-Context::get_key () const
-{
- return key_;
-}
Context::Context (Object_key const *key)
{
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);
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);
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;
}
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);
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;
{
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 ());
}
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);
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);
{
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)
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;
{
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;
return;
}
- SCM ifs = me->interfaces_;
+ SCM ifs = me->interfaces ();
SCM all_ifaces = ly_all_grob_interfaces ();
bool found = false;
SCM_UNDEFINED);
}
-SCM
-Grob::get_interfaces () const
-{
- return interfaces_;
-}
-
extern void check_interfaces_for_property (Grob const *me, SCM sym);
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
{
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",
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",
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;
}
{
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
{
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",
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_);
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;
interfaces_ = s.interfaces_;
object_alist_ = SCM_EOL;
- pscore_ = 0;
+ layout_ = 0;
smobify_self ();
if (key_)
}
+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);
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)
return ext;
}
-Output_def *
-Grob::get_layout () const
-{
- return pscore_ ? pscore_->layout () : 0;
-}
Stencil *
Grob::get_stencil () const
Grob::handle_broken_dependencies ()
{
Spanner *sp = dynamic_cast<Spanner *> (this);
- if (original_ && sp)
+ if (original () && sp)
return;
if (sp)
{
/* 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_);
}
}
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"
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;
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);
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 ();
};
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 */
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 ();
bool
Item::is_breakable (Grob *me)
{
- if (me->original_)
+ if (me->original ())
return false;
if (!dynamic_cast<Item *> (me))
{
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);
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;
}
/****************************************************************/
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);
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");
*/
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);
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);
}
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);
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)->
}
Real blotdiameter
- = (me->get_layout ()->get_dimension (ly_symbol2scm ("blotdiameter")));
+ = (me->layout ()->get_dimension (ly_symbol2scm ("blotdiameter")));
if (primitive & MLP_STEM)
{
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)
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));
*/
if (!extents[RIGHT].is_empty ()
&& (Item::is_breakable (right_col)
- || right_col->original_))
+ || right_col->original ()))
{
/*
This is for the situation
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;
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);
{
layout_ = layout;
system_ = 0;
+ pscore_ = 0;
systems_ = SCM_EOL;
paper_systems_ = SCM_EOL;
}
{
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_);
}
systems_ = scm_cons (system->self_scm (), systems_);
system->pscore_ = this;
-
+ system->layout_ = pscore_->layout_;
system->unprotect ();
}
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
/* 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;
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;
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;
}
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);
#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))
{
#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))
{
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);
}
return global_shortest;
}
+
MAKE_SCHEME_CALLBACK (Spacing_spanner, set_springs, 1);
SCM
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);
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;
/*
}
/*
- 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);
}
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
--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;
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;
}
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;
// 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));
{
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);
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);
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);
programming_error ("adding element twice");
else
{
- elem->pscore_ = pscore_;
+ elem->layout_ = pscore_->layout_;
all_elements_->add (elem);
elem->unprotect ();
}
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))
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. ",
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. */
/* 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");
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);
{
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;
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)
{
= 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
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);
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);
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);