`http://www.iro.umontreal.ca/~pinard/' parts of
Documentation/Vocab*, started internationalization stuff
- * Stephen Peters <portnoy@ai.mit.edu>, pdfTeX support
+ * Stephen Peters <portnoy@ai.mit.edu>, pdfTeX support
* Glen Prideaux <glenprideaux@iname.com>, minor bug fix to
script used to generate doc++ documentation
* Shay Rojanski Some mudela source.
- Your name could be here! If you want to fix something, do it, and
-send us a patch!
+ * August S.Sigov <august@infran.ru> Russian translation
+1.3.53.uu1
+==========
+
+* Bugfix: don't crash on tuplet spanners that don't contain any notes.
+
+* Small cleanup of Dimension_cache: removed a few redundant
+fields. Slightly lower memory usage. Dimension_cache is now a `dumb'
+struct again.
+
+* Add array index to priority field of text scripts to ensure that
+order is unique, and sensible.
+
+* Added an element count statistic.
+
1.3.53
======
+
+* russian.po (thank you, August.)
+
* Small cleanups in Molecule interface
* Spacing related elements perform suicide after calculating
@mudelafile{repeat-fold.ly}
-Across linebreaks, first and second bracket should be equal
+Across linebreaks, the left edge of a first and second alternative
+bracket should be equal
@mudelafile{repeat-line-break.ly}
@section Hacks and Features
-As a last resort, the placement of items can be adjusted manually.
+As a last resort, the placement of items can be adjusted manually, by
+setting the @code{extra-offset} of an output object.
@mudelafile{generic-output-property.ly}
@uref{http://www.iro.umontreal.ca/~pinard/}
parts of Documentation/Vocab*, started internationalization stuff
@c urg: @c,{} in @email{} barfs.
-@item @email{portnoy@@ai.mit.edu,Stephen Peters}, pdfTeX support
+@item @email{portnoy@@ai.mit.edu,Stephen Peters},
+ pdfTeX support
@item @email{glenprideaux@@iname.com, Glen Prideaux},
minor bug fix to script used to generate doc++ documentation
@item @email{Roy.Rankin@@alcatel.com.au, Roy R. Rankin},
major extension, fixes to abc2ly, lilypond bug fixes
@item @email{daboys@@austin.rr.com, Jeffrey B. Reed},
Windows-NT support.
+
@item Shay Rojanski
Some mudela source.
+@item @email{august@@infran.ru, August S.Sigov}
+ Russian translation
@end itemize
-Your name could be here! If you want to fix something, do it, and send
-us a patch!
-
-
@bye
PACKAGE_NAME=LilyPond
MAJOR_VERSION=1
MINOR_VERSION=3
-PATCH_LEVEL=53
+PATCH_LEVEL=54
MY_PATCH_LEVEL=
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
not compute anything, but a side effect of a->do_side_processing ()
is that the elements are placed correctly. */
Real
-Align_interface::alignment_callback (Dimension_cache const *c)
+Align_interface::alignment_callback (Score_element const *sc, Axis ax)
{
- Axis ax = c->axis ();
- Score_element * sc = c->element_l ()->parent_l (ax);
-
- if (sc && sc->get_elt_property ("alignment-done") == SCM_UNDEFINED)
+ Score_element * par = sc->parent_l (ax);
+ if (par && par->get_elt_property ("alignment-done") == SCM_UNDEFINED)
{
- Align_interface (sc).do_side_processing (ax);
+ Align_interface (par).do_side_processing (ax);
}
return 0.0;
}
Real
-Align_interface::center_on_element (Dimension_cache const *c)
+Align_interface::center_on_element (Score_element const *me, Axis a)
{
- Score_element *me = c->element_l ();
Score_element *cent = unsmob_element (me->get_elt_property ("group-center-element"));
if (cent)
{
- Real r = cent->relative_coordinate (me, c->axis ());
+ Real r = cent->relative_coordinate (me, a);
return -r;
}
return 0;
{
s->add_offset_callback (alignment_callback, axis ());
Axis_group_interface (elt_l_).add_element (s);
-
}
Align_interface::Align_interface (Score_element const*s)
Align_note_column_engraver::do_creation_processing ()
{
align_item_p_ = new Grace_align_item;
- side_position (align_item_p_).set_axis (X_AXIS);
- side_position (align_item_p_).set_direction (LEFT);
+ Side_position_interface (align_item_p_).set_axis (X_AXIS);
+ Side_position_interface (align_item_p_).set_direction (LEFT);
// needed for setting font size.
announce_element (Score_element_info (align_item_p_, 0));
}
if (gh_pair_p (dims) && gh_number_p (gh_car (dims))
&& gh_number_p (gh_cdr (dims)))
{
- staffline_p_->dim_cache_[Y_AXIS]->set_extent_callback (&Score_element::preset_extent);
+ staffline_p_->set_extent_callback (&Score_element::preset_extent, Y_AXIS);
staffline_p_->set_elt_property ("extent-Y", dims);
}
bool
Axis_group_interface::axis_b (Axis a )const
{
- return elt_l_->dim_cache_[a]->extent_callback_l_ == group_extent_callback;
+ return elt_l_->has_extent_callback_b (group_extent_callback, a);
}
Interval
}
Interval
-Axis_group_interface::group_extent_callback (Dimension_cache const *c)
+Axis_group_interface::group_extent_callback (Score_element const*me, Axis a)
{
- Axis a = c->axis ();
- Score_element * me = c->element_l ();
- Score_element * common = me;
+ Score_element * common =(Score_element*) me;
for (SCM s = me->get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
{
if (a1 != Y_AXIS && a2 != Y_AXIS)
elt_l_->set_extent_callback (0, Y_AXIS);
- elt_l_->dim_cache_[a1]->set_extent_callback (Axis_group_interface::group_extent_callback);
- elt_l_->dim_cache_[a2]->set_extent_callback (Axis_group_interface::group_extent_callback);
+ elt_l_->set_extent_callback (Axis_group_interface::group_extent_callback,a1);
+ elt_l_->set_extent_callback (Axis_group_interface::group_extent_callback,a2);
}
Link_array<Score_element>
bar_p_->set_elt_property ("break-align-symbol", ly_symbol2scm ("Staff_bar"));
// urg: "" != empty...
+ /*
+ TODO: use symbol.
+ */
SCM default_type = get_property ("defaultBarType");
if (gh_string_p (default_type))
{
bar_p_->set_elt_property ("glyph", default_type); // ugh
}
-#if 0
- /*
- urg. Why did I implement this? And did I implement this so
- clumsily?
-
- input/test/just-friends.ly
- Maybe a staffgroup of just one staff would be a better solution.
- */
- SCM prop = get_property ("barAtLineStart");
- if (to_boolean (prop))
- {
- bar_p_->set_elt_property ("at-line-start", SCM_BOOL_T);
- }
-#endif
announce_element (Score_element_info (bar_p_, 0));
}
}
Real
Bezier_bow::get_default_height (Real h_inf, Real r_0, Real b) const
{
-#if 0
- Real pi = M_PI;
- Real alpha = 2.0 * h_inf / pi;
- Real beta = pi * r_0 / (2.0 * h_inf);
-
- return alpha * atan (beta * b);
-#else
SCM h = scm_eval (scm_listify (ly_symbol2scm ("slur-default-height"),
gh_double2scm (h_inf),
gh_double2scm (r_0),
gh_double2scm (b),
SCM_UNDEFINED));
return gh_scm2double (h);
-#endif
}
#include <math.h>
#include "config.h"
-
+#include "libc-extension.hh"
#include "bezier.hh"
#include "polynomial.hh"
TODO: switch off ignoring empty stuff?
*/
- edge->dim_cache_[X_AXIS]->set_extent_callback (Dimension_cache::point_dimension_callback);
+ edge->set_extent_callback (Score_element::point_dimension_callback,X_AXIS);
align_l_->set_elt_property ("group-center-element", edge->self_scm_);
*/
#include <math.h>
#include "warn.hh"
-
#include "dimension-cache.hh"
#include "parray.hh"
#include "score-element.hh"
{
init();
extent_callback_l_ = d.extent_callback_l_;
- basic_offset_ = d.basic_offset_;
- extra_offset_ = d.extra_offset_;
- off_valid_b_ = d.off_valid_b_;
+ offset_ = d.offset_;
off_callbacks_ = d.off_callbacks_;
parent_l_ = d.parent_l_;
}
Dimension_cache::init()
{
extent_callback_l_ =0;
- basic_offset_ =0.0;
- extra_offset_ =0.0;
+ offset_ =0.0;
+ offset_ =0.0;
- elt_l_ = 0;
dim_.set_empty ();
parent_l_ =0;
valid_b_ = false;
- off_valid_b_ = false;
-}
-
-
-void
-Dimension_cache::translate (Real x)
-{
- extra_offset_ += x;
-}
-
-Real
-Dimension_cache::relative_coordinate (Dimension_cache *refp) const
-{
- if (refp == this)
- return 0.0;
-
- /*
- We catch PARENT_L_ == nil case with this, but we crash if we did
- not ask for the absolute coordinate (ie. REFP == nil.)
-
- */
- if (refp == parent_l_)
- return get_offset ();
- else
- return get_offset () + parent_l_->relative_coordinate (refp);
-}
-
-Axis
-Dimension_cache::axis () const
-{
- if (elt_l_-> dim_cache_[X_AXIS] == this)
- return X_AXIS;
- else
- return Y_AXIS;
}
-Real
-Dimension_cache::get_offset () const
-{
- Dimension_cache *me = (Dimension_cache*) this;
- while (off_callbacks_.size ())
- {
- Offset_cache_callback c = me->off_callbacks_[0];
- me->off_callbacks_.del (0);
- Real r = (*c) (me);
- if (isinf (r) || isnan (r))
- {
- r = 0.0;
- programming_error ("Infinity or NaN encountered");
- }
- me->basic_offset_ +=r;
- }
- return basic_offset_ + extra_offset_;
-}
-Dimension_cache *
-Dimension_cache::common_refpoint (Dimension_cache const* s) const
-{
- /*
- I don't like the quadratic aspect of this code. Maybe this should
- be rewritten some time, but the largest chain of parents might be
- 10 high or so, so it shouldn't be a real issue. */
- for (Dimension_cache const *c = this; c; c = c->parent_l_)
- for (Dimension_cache const * d = s; d; d = d->parent_l_)
- if (d == c)
- return (Dimension_cache*)d;
- return 0;
-}
-Interval
-Dimension_cache::point_dimension_callback (Dimension_cache const* )
-{
- return Interval (0,0);
-}
-Interval
-Dimension_cache::get_dim () const
-{
- Interval r;
- Dimension_cache *nc = ((Dimension_cache*)this);
- if (!extent_callback_l_)
- {
- nc->dim_.set_empty ();
- }
- else if (!valid_b_)
- {
- nc->dim_= (*extent_callback_l_ ) (nc);
- nc->valid_b_ = true;
- }
-
- r=dim_;
- return r;
-}
-
-void
-Dimension_cache::set_extent_callback (Dim_cache_callback c)
-{
- extent_callback_l_ =c;
-}
if (!dotcol_p_)
{
dotcol_p_ = new Dot_column;
- side_position (dotcol_p_).set_axis (X_AXIS);
- side_position (dotcol_p_).set_direction (RIGHT);
+ Side_position_interface (dotcol_p_).set_axis (X_AXIS);
+ Side_position_interface (dotcol_p_).set_direction (RIGHT);
announce_element (Score_element_info (dotcol_p_, 0));
}
if (!r->dots_l ())
return ;
- side_position (this).add_support (r);
+ Side_position_interface (this).add_support (r);
add_dots (r->dots_l ());
}
Dynamic_line_spanner::Dynamic_line_spanner ()
{
set_elt_property ("transparent", SCM_BOOL_T);
- side_position (this).set_axis (Y_AXIS);
+ Side_position_interface (this).set_axis (Y_AXIS);
Axis_group_interface (this).set_interface ();
Axis_group_interface (this).set_axes (X_AXIS, Y_AXIS);
}
for (int i = 0; i < pending_element_arr_.size (); i++)
{
Score_element* e = pending_element_arr_[i];
- side_position (e).set_axis (Y_AXIS);
- side_position (e).add_staff_support ();
+ Side_position_interface (e).set_axis (Y_AXIS);
+ Side_position_interface (e).add_staff_support ();
/*
UGH UGH
typeset_all ();
if (line_spanner_)
{
- side_position (line_spanner_).add_staff_support ();
+ Side_position_interface (line_spanner_).add_staff_support ();
typeset_element (line_spanner_);
line_spanner_ = 0;
}
}
if (finished_line_spanner_)
{
- side_position (finished_line_spanner_).add_staff_support ();
+ Side_position_interface (finished_line_spanner_).add_staff_support ();
typeset_element (finished_line_spanner_);
finished_line_spanner_ = 0;
}
{
if (line_spanner_)
{
- side_position (line_spanner_).add_support (n);
+ Side_position_interface (line_spanner_).add_support (n);
line_spanner_->add_column (n);
}
else
: Spanner ()
{
dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0;
- dim_cache_[Y_AXIS]->set_extent_callback (Dimension_cache::point_dimension_callback);
+ set_extent_callback (Score_element::point_dimension_callback, Y_AXIS);
}
if (align_l_)
{
for (int i=0; i < support_.size (); i++)
- side_position (align_l_).add_support (support_[i]);
+ Side_position_interface (align_l_).add_support (support_[i]);
support_.clear ();
}
}
void
Grace_position_engraver::do_pre_move_processing ()
{
- if (align_l_ && !side_position (align_l_).supported_b ())
+ if (align_l_ && !Side_position_interface (align_l_).supported_b ())
{
/*
We don't have support. Either some moron tried attaching us to a rest,
{
dx_f_drul_[LEFT] = dx_f_drul_[RIGHT] = 0.0;
- dim_cache_[Y_AXIS]->set_extent_callback (Dimension_cache::point_dimension_callback);
+ set_extent_callback (Score_element::point_dimension_callback,Y_AXIS);
}
Molecule
Score_element * elt_l_;
Align_interface (Score_element const*);
- static Real alignment_callback (Dimension_cache const *);
+ static Real alignment_callback (Score_element const*,Axis);
void do_side_processing (Axis a);
void set_axis (Axis);
Axis axis () const;
int get_count (Score_element*)const;
void set_interface ();
bool has_interface_b ();
- static Real center_on_element (Dimension_cache const *c);
+ static Real center_on_element (Score_element const *c, Axis);
};
#endif /* ALIGN_INTERFACE_HH */
Score_element *elt_l_;
Axis_group_interface (Score_element*);
- static Interval group_extent_callback (Dimension_cache const*);
+ static Interval group_extent_callback (Score_element const*,Axis);
static Interval relative_group_extent (Axis, Score_element * common, SCM list);
void add_element (Score_element*);
#ifndef DIMENSION_CACHE_CALLBACK_HH
#define DIMENSION_CACHE_CALLBACK_HH
-class Dimension_cache;
-typedef Interval (*Dim_cache_callback)(Dimension_cache const *);
-typedef Real (*Offset_cache_callback)(Dimension_cache const *);
+
+typedef Interval (*Dim_cache_callback)(Score_element const *,Axis);
+typedef Real (*Offset_callback)(Score_element const *,Axis);
#endif /* DIMENSION_CACHE_CALLBACK_HH */
/**
Adminstration of offset dimension info.
*/
-class Dimension_cache
+struct Dimension_cache
{
bool valid_b_;
Interval dim_;
The offset wrt. to the center of #parent_l_#
*/
- Real extra_offset_;
- Real basic_offset_;
- bool off_valid_b_;
+ Real offset_;
- Score_element *elt_l_;
- friend class Score_element;
- void init ();
- Array<Offset_cache_callback> off_callbacks_;
+
+ Array<Offset_callback> off_callbacks_;
+
/**
What to call to find extent. Nil means empty.
*/
-public:
Dim_cache_callback extent_callback_l_;
- static Interval point_dimension_callback (Dimension_cache const* );
- Axis axis () const;
- Real get_offset () const;
- void set_extent_callback (Dim_cache_callback);
- Dimension_cache * parent_l_;
-
- Score_element *element_l () const { return elt_l_; }
+ Score_element * parent_l_;
Dimension_cache(Dimension_cache const&);
Dimension_cache ();
-
-
- /**
- Find the offset relative to D. If D equals THIS, then it is 0.
- Otherwise, it recursively defd as
-
- OFFSET_ + PARENT_L_->relative_coordinate (D)
- */
- Real relative_coordinate (Dimension_cache *d) const;
- Dimension_cache*common_refpoint (Dimension_cache const* s) const;
-
- void set_empty (bool);
- void translate (Real);
-
- bool valid_b () const { return valid_b_; }
- bool empty_b() const;
- Interval get_dim () const;
+ void init ();
};
virtual Paper_column * column_l () const;
virtual void handle_prebroken_dependencies ();
protected:
- virtual void do_breakable_col_processing();
+ virtual void discretionary_processing ();
void copy_breakable_items();
};
/// is #c# contained in #*this#?
bool contains_b (Paper_column const *c) const;
-
+ int element_count () const;
void break_into_pieces (Array<Column_x_positions> const&);
void output_lines ();
/*
- score-element-callback.hh -- declare Score_element callbacks
+ score-element-callback.hh -- declare Score_element callbacks
source file of the GNU LilyPond music typesetter
#include "lily-guile.hh"
#include "lily-proto.hh"
#include "smobs.hh"
-#include "dimension-cache-callback.hh"
-
-
+#include "dimension-cache.hh"
+typedef Interval (*Extent_callback)(Score_element const *,Axis);
+typedef Real (*Offset_callback)(Score_element const *,Axis);
/**
bool used_b_;
char const * name () const;
-
+
+ /*
+ IDEA: make this a global variable. This is the same for all
+ elements, I think it is safe to assume that we will not have
+ scores being formatted multithreadedly.
+ */
Paper_score *pscore_l_;
Score_element ();
Score_element (Score_element const&);
- virtual void print () const;
/*
properties
*/
SCM remove_elt_property (String nm);
- void Score_element::set_real (String, Real);
- Real Score_element::get_real (String s) const;
-
/*
related classes.
*/
static SCM handle_broken_smobs (SCM, SCM criterion);
- void recurse_into_smobs (SCM s, void (Score_element::*meth_ptr)());
virtual void do_break_processing ();
virtual Score_element *find_broken_piece (Line_of_score*) const;
/// generate rods & springs
virtual void do_space_processing ();
- virtual void do_breakable_col_processing ();
+ virtual void discretionary_processing ();
/// do calculations before determining horizontal spacing
virtual void before_line_breaking ();
Molecule get_molecule () const;
void suicide ();
-
- static Interval preset_extent (Dimension_cache const*);
- static Interval molecule_extent (Dimension_cache const*);
+
+ static Interval preset_extent (Score_element const*,Axis);
+ static Interval point_dimension_callback (Score_element const*,Axis );
+ static Interval molecule_extent (Score_element const*,Axis);
protected:
be handled by GUILE gc. */
virtual ~Score_element ();
- /// do printing of derived info.
- virtual void do_print () const;
/// generate the molecule
virtual Molecule do_brew_molecule () const;
///executed directly after the item is added to the Paper_score
virtual void do_add_processing ();
-
static Interval dim_cache_callback (Dimension_cache const*);
void init ();
-public:
- Dimension_cache *dim_cache_[NO_AXES];
+ Dimension_cache dim_cache_[NO_AXES];
+public:
bool empty_b (Axis a) const;
Interval extent (Axis) const;
void translate_axis (Real, Axis);
+ /**
+ Find the offset relative to D. If D equals THIS, then it is 0.
+ Otherwise, it recursively defd as
+
+ OFFSET_ + PARENT_L_->relative_coordinate (D)
+ */
Real relative_coordinate (Score_element const* refp, Axis) const;
/**
Find the group-element which has both #this# and #s#
Score_element*common_refpoint (Score_element const* s, Axis a) const;
Score_element*common_refpoint (SCM elt_list, Axis a) const;
- bool has_offset_callback_b (Offset_cache_callback, Axis)const;
- void add_offset_callback (Offset_cache_callback, Axis);
- void set_extent_callback (Dim_cache_callback , Axis);
-
+ bool has_offset_callback_b (Offset_callback, Axis)const;
+ void add_offset_callback (Offset_callback, Axis);
+ bool has_extent_callback_b (Extent_callback, Axis)const;
+ void set_extent_callback (Extent_callback , Axis);
+
+ /**
+ Invoke callbacks to get offset relative to parent.
+ */
+ Real get_offset (Axis a) const;
/**
Set the parent refpoint of THIS to E
*/
Score_element * elt_l_;
public:
Side_position_interface (Score_element const*);
- static Real side_position (Dimension_cache const *);
- static Real aligned_on_self (Dimension_cache const *);
- static Real aligned_side (Dimension_cache const *);
- static Real quantised_position (Dimension_cache const*);
- static Real centered_on_parent (Dimension_cache const*);
+ static Real side_position (Score_element const *, Axis);
+ static Real aligned_on_self (Score_element const *, Axis);
+ static Real aligned_side (Score_element const *, Axis);
+ static Real quantised_position (Score_element const*, Axis);
+ static Real centered_on_parent (Score_element const*, Axis);
void set_axis (Axis);
void set_minimum_space (Real);
void set_padding (Real);
void set_direction (Direction);
};
-Side_position_interface side_position (Score_element*);
#endif /* SIDE_POSITION_INTERFACE_HH */
protected:
void evaluate_empty ();
- static Interval width_callback(Dimension_cache const*) ;
+ static Interval width_callback(Score_element const*, Axis) ;
virtual Real get_bar_size () const;
virtual void before_line_breaking ();
void set_interface ();
bool has_interface_b ();
void set_position (Real);
- static Real callback (Dimension_cache const*);
+ static Real callback (Score_element const*, Axis a);
/**
Leading are the lead strips between the sticks (lines) of
Stem * stem_l () const;
virtual Molecule do_brew_molecule () const;
- static Interval dim_callback (Dimension_cache const*);
+ static Interval dim_callback (Score_element*, Axis);
public:
Stem_tremolo ();
void set_stem (Stem *);
protected:
friend class Stem_tremolo; // ugh.
- Real get_default_stem_end_position () const;
+ Real get_default_stem_end_position () const;
void position_noteheads();
Real stem_end_position () const;
- static Real off_callback (Dimension_cache const*);
+ static Real off_callback (Score_element const*, Axis);
protected:
Molecule flag () const;
virtual void before_line_breaking();
- static Interval dim_callback (Dimension_cache const*);
+ static Interval dim_callback (Score_element const*,Axis);
virtual Molecule do_brew_molecule() const;
void set_spacing_hints () ;
return broken_to_drul_[LEFT] || broken_to_drul_[RIGHT];
}
+
+/*
+ Generate items for begin and end-of line.
+ */
void
-Item::do_breakable_col_processing()
+Item::discretionary_processing()
{
if (broken_b ())
return;
}
-#if 0
-/*
- this all really sucks, LilyPond should not communicate with GUILE using strings.
- */
-SCM
-ly_eval_str (String s);
-#endif
-
/*
Pass string to scm parser, evaluate one expression.
Return result value and #chars read.
Axis_group_interface (this).set_axes (Y_AXIS,X_AXIS);
}
+int
+Line_of_score::element_count () const
+{
+ return scm_ilength ( get_elt_property ("all-elements"));
+}
+
+
/*
Ugh. this is grossly hairy.
*/
{
unsmob_element (gh_car (s))->do_break_processing ();
}
-
/*
fixups must be done in broken line_of_scores, because new elements
are put over there. */
+ int count = 0;
for (int i=0; i < broken_into_l_arr_.size (); i++)
{
Score_element *se = broken_into_l_arr_[i];
-
- for (SCM s = se->get_elt_property ("all-elements");
- gh_pair_p (s); s = gh_cdr (s))
+ SCM all = se->get_elt_property ("all-elements");
+ for (SCM s = all; gh_pair_p (s); s = gh_cdr (s))
{
unsmob_element (gh_car (s))->fixup_refpoint ();
}
+ count += scm_ilength (all);
}
+
/*
needed for doing items.
unsmob_element (gh_car (s))->handle_broken_dependencies ();
}
handle_broken_dependencies ();
+ progress_indication ( _f("Element count %d.", count + element_count()));
+
for (int i=0; i < broken_into_l_arr_.size (); i++)
{
Line_of_score::pre_processing ()
{
for (SCM s = get_elt_property ("all-elements"); gh_pair_p (s); s = gh_cdr (s))
- unsmob_element (gh_car (s))->do_breakable_col_processing ();
+ unsmob_element (gh_car (s))->discretionary_processing ();
+
+ progress_indication ( _f("Element count %d ", element_count ()));
+
+
for (SCM s = get_elt_property ("all-elements"); gh_pair_p (s); s = gh_cdr (s))
unsmob_element (gh_car (s))->handle_prebroken_dependencies ();
if (!key_item_p_)
{
key_item_p_ = new Local_key_item;
- side_position (key_item_p_).set_axis (X_AXIS);
- side_position (key_item_p_).set_direction (LEFT);
+ Side_position_interface (key_item_p_).set_axis (X_AXIS);
+ Side_position_interface (key_item_p_).set_direction (LEFT);
staff_symbol_referencer(key_item_p_).set_interface ();
announce_element (Score_element_info (key_item_p_, 0));
key_item_p_->add_pitch (note_l->pitch_,
note_l->cautionary_b_,
local_key_.double_to_single_acc(note_l->pitch_));
- side_position (key_item_p_).add_support (support_l);
+ Side_position_interface (key_item_p_).add_support (support_l);
}
if (!forget)
}
if (key_item_p_ && grace_align_l_)
{
- side_position (grace_align_l_).add_support (key_item_p_);
+ Side_position_interface (grace_align_l_).add_support (key_item_p_);
grace_align_l_ =0;
}
if (key_item_p_)
{
for (int i=0; i < support_l_arr_.size(); i++)
- side_position (key_item_p_).add_support (support_l_arr_[i]);
+ Side_position_interface (key_item_p_).add_support (support_l_arr_[i]);
typeset_element (key_item_p_);
key_item_p_ =0;
Paper_outputter::Paper_outputter (Paper_stream * ps )
{
-#if 0
- molecules_ = gh_cons (SCM_EOL, SCM_EOL);
- last_cons_ = molecules_;
-#endif
-
/*
lilypond -f scm x.ly
guile -s x.scm
void
Paper_outputter::output_scheme (SCM scm)
{
-#if 0
- SCM c = gh_cons (scm,gh_cdr (last_cons_));
- gh_set_cdr_x(last_cons_, c);
- last_cons_ = c;
-#endif
-
+ /*
+ we don't rename dump_scheme, because we might in the future want
+ to remember Scheme. We don't now, because it sucks up a lot of memory.
+ */
dump_scheme (scm);
}
-#if 0
-void
-Paper_outputter::dump ()
-{
-
- for (SCM s = gh_cdr (molecules_); gh_pair_p (s); s = gh_cdr (s))
- {
- dump_scheme (gh_car (s));
- }
-}
-#endif
-
void
Paper_outputter::dump_scheme (SCM s)
{
/*
- p-score.cc -- implement Paper_score
+ paper-score.cc -- implement Paper_score
source file of the GNU LilyPond music typesetter
void
Paper_score::process ()
{
+ progress_indication ( _f("Element count %d ", line_l_->element_count ()));
+
progress_indication (_ ("Preprocessing elements...") + " ");
/*
Array<Column_x_positions> breaking = calc_breaking ();
line_l_->break_into_pieces (breaking);
-
outputter_l_ = new Paper_outputter (paper_l_->paper_stream_p ());
;
scm = gh_list (ly_symbol2scm ("end-output"), SCM_UNDEFINED);
outputter_l_->output_scheme (scm);
-
// huh?
delete outputter_l_;
outputter_l_ = 0;
{
if (p->item_p_)
{
- side_position (p->item_p_).add_staff_support ();
+ Side_position_interface (p->item_p_).add_staff_support ();
/*
Hmm.
*/
#include <string.h>
+#include <math.h>
+#include "libc-extension.hh"
#include "group-interface.hh"
#include "misc.hh"
#include "paper-score.hh"
Score_element::Score_element()
{
- dim_cache_[X_AXIS] = new Dimension_cache;
- dim_cache_[Y_AXIS] = new Dimension_cache;
- dim_cache_[X_AXIS]->elt_l_ = dim_cache_[Y_AXIS]->elt_l_ = this;
-
// junkme.
used_b_ = false;
+ set_extent_callback (molecule_extent, X_AXIS);
+ set_extent_callback (molecule_extent, Y_AXIS);
- dim_cache_[X_AXIS]->set_extent_callback (molecule_extent);
- dim_cache_[Y_AXIS]->set_extent_callback (molecule_extent);
used_b_ = false;
pscore_l_=0;
lookup_l_ =0;
element_property_alist_ = SCM_EOL;
smobify_self ();
-
-
set_elt_property ("dependencies", SCM_EOL);
set_elt_property ("interfaces", SCM_EOL);
}
Score_element::Score_element (Score_element const&s)
+ : dim_cache_ (s.dim_cache_)
{
- dim_cache_[X_AXIS] = new Dimension_cache (*s.dim_cache_[X_AXIS]);
- dim_cache_[Y_AXIS] = new Dimension_cache (*s.dim_cache_[Y_AXIS]);
- dim_cache_[X_AXIS]->elt_l_ = dim_cache_[Y_AXIS]->elt_l_ = this;
-
self_scm_ = SCM_EOL;
used_b_ = true;
original_l_ =(Score_element*) &s;
Score_element::~Score_element()
{
- delete dim_cache_[X_AXIS];
- delete dim_cache_[Y_AXIS];
}
// should also have one that takes SCM arg.
}
Interval
-Score_element::molecule_extent (Dimension_cache const *c)
+Score_element::molecule_extent (Score_element const *s, Axis a )
{
- Score_element *s = dynamic_cast<Score_element*>(c->element_l());
Molecule m = s->do_brew_molecule();
- return m.extent(c->axis ());
+ return m.extent(a);
}
Interval
-Score_element::preset_extent (Dimension_cache const *c)
+Score_element::preset_extent (Score_element const *s , Axis a )
{
- Score_element *s = dynamic_cast<Score_element*>(c->element_l());
- SCM ext = s->get_elt_property ((c->axis () == X_AXIS)
+ SCM ext = s->get_elt_property ((a == X_AXIS)
? "extent-X"
: "extent-Y");
}
-void
-Score_element::print() const
-{
-#ifndef NPRINT
- DEBUG_OUT << classname(this) << "{\n";
-
- if (flower_dstream && !flower_dstream->silent_b ("Score_element"))
- ly_display_scm (element_property_alist_);
-
- if (original_l_)
- DEBUG_OUT << "Copy ";
- do_print();
-
- DEBUG_OUT << "}\n";
-#endif
-}
Paper_def*
Score_element::paper_l () const
return used_b_;
}
-void
-Score_element::do_print () const
-{
-}
-
Score_element*
Score_element::find_broken_piece (Line_of_score*) const
{
void
Score_element::translate_axis (Real y, Axis a)
{
- dim_cache_[a]->translate (y);
+ dim_cache_[a].offset_ += y;
}
Real
-Score_element::relative_coordinate (Score_element const*e, Axis a) const
+Score_element::relative_coordinate (Score_element const*refp, Axis a) const
+{
+ if (refp == this)
+ return 0.0;
+
+ /*
+ We catch PARENT_L_ == nil case with this, but we crash if we did
+ not ask for the absolute coordinate (ie. REFP == nil.)
+
+ */
+ if (refp == dim_cache_[a].parent_l_)
+ return get_offset (a);
+ else
+ return get_offset (a) + dim_cache_[a].parent_l_->relative_coordinate (refp, a);
+}
+
+Real
+Score_element::get_offset (Axis a) const
{
- return dim_cache_[a]->relative_coordinate (e ? e->dim_cache_[a] : 0);
+ Score_element *me = (Score_element*) this;
+ while (dim_cache_[a].off_callbacks_.size ())
+ {
+ Offset_callback c = dim_cache_[a].off_callbacks_[0];
+ me->dim_cache_[a].off_callbacks_.del (0);
+ Real r = (*c) (me,a );
+ if (isinf (r) || isnan (r))
+ {
+ r = 0.0;
+ programming_error ("Infinity or NaN encountered");
+ }
+ me->dim_cache_[a].offset_ +=r;
+ }
+ return dim_cache_[a].offset_;
+}
+
+
+Interval
+Score_element::point_dimension_callback (Score_element const* , Axis)
+{
+ return Interval (0,0);
}
bool
Score_element::empty_b (Axis a)const
{
- return !dim_cache_[a]->extent_callback_l_;
+ return !dim_cache_[a].extent_callback_l_;
}
Interval
Score_element::extent (Axis a) const
{
- Dimension_cache const * d = dim_cache_[a];
- Interval ext = d->get_dim ();
+ Dimension_cache * d = (Dimension_cache *)&dim_cache_[a];
+ if (!d->extent_callback_l_)
+ {
+ d->dim_.set_empty ();
+ }
+ else if (!d->valid_b_)
+ {
+ d->dim_= (*d->extent_callback_l_ ) (this, a);
+ d->valid_b_ = true;
+ }
+ Interval ext = d->dim_;
+
if (empty_b (a))
return ext;
- SCM extra = get_elt_property (a == X_AXIS ? "extra-extent-X"
+ SCM extra = get_elt_property (a == X_AXIS
+ ? "extra-extent-X"
: "extra-extent-Y");
/*
Score_element*
Score_element::parent_l (Axis a) const
{
- Dimension_cache*d= dim_cache_[a]->parent_l_;
- return d ? d->elt_l_ : 0;
+ return dim_cache_[a].parent_l_;
}
Score_element *
Score_element::common_refpoint (Score_element const* s, Axis a) const
{
- Dimension_cache *dim = dim_cache_[a]->common_refpoint (s->dim_cache_[a]);
- return dim ? dim->element_l () : 0;
+ /*
+ I don't like the quadratic aspect of this code. Maybe this should
+ be rewritten some time, but the largest chain of parents might be
+ 10 high or so, so it shouldn't be a real issue. */
+ for (Score_element const *c = this; c; c = c->dim_cache_[a].parent_l_)
+ for (Score_element const * d = s; d; d = d->dim_cache_[a].parent_l_)
+ if (d == c)
+ return (Score_element*)d;
+
+ return 0;
}
}
void
-Score_element::add_offset_callback (Offset_cache_callback cb, Axis a)
+Score_element::add_offset_callback (Offset_callback cb, Axis a)
+{
+ dim_cache_[a].off_callbacks_.push (cb);
+}
+
+bool
+Score_element::has_extent_callback_b (Extent_callback cb, Axis a)const
{
- dim_cache_[a]->off_callbacks_.push (cb);
+ return cb == dim_cache_[a].extent_callback_l_;
}
bool
-Score_element::has_offset_callback_b (Offset_cache_callback cb, Axis a)const
+Score_element::has_offset_callback_b (Offset_callback cb, Axis a)const
{
- for (int i= dim_cache_[a]->off_callbacks_.size (); i--;)
+ for (int i= dim_cache_[a].off_callbacks_.size (); i--;)
{
- if (dim_cache_[a]->off_callbacks_[i] == cb)
+ if (dim_cache_[a].off_callbacks_[i] == cb)
return true;
}
return false;
void
Score_element::set_extent_callback (Dim_cache_callback dc, Axis a)
{
- dim_cache_[a]->extent_callback_l_ = dc ;
+ dim_cache_[a].extent_callback_l_ = dc ;
}
void
Score_element::set_parent (Score_element *g, Axis a)
{
- dim_cache_[a]->parent_l_ = g ? g->dim_cache_[a]: 0;
+ dim_cache_[a].parent_l_ = g;
}
void
ADD_SCM_INIT_FUNC(scoreelt, init_functions);
void
-Score_element::do_breakable_col_processing ()
+Score_element::discretionary_processing()
{
}
void
Script_column_engraver::acknowledge_element( Score_element_info inf)
{
- if (side_position (inf.elem_l_).has_interface_b ())
+ if (Side_position_interface (inf.elem_l_).has_interface_b ())
{
Item *thing = dynamic_cast<Item*> (inf.elem_l_);
if (thing
&& !thing->breakable_b ()
- && side_position (inf.elem_l_).get_axis () == Y_AXIS)
+ && Side_position_interface (inf.elem_l_).get_axis () == Y_AXIS)
{
script_l_arr_.push (thing);
}
{
for (int i=0; i < script_p_arr_.size(); i++)
{
- if (to_boolean (script_p_arr_[i]->remove_elt_property ("staff-support")))
- side_position (script_p_arr_[i]).add_staff_support ();
- typeset_element (script_p_arr_[i]);
+ Script * sc = script_p_arr_[i];
+ if (to_boolean (sc->remove_elt_property ("staff-support")))
+ {
+ Side_position_interface (sc).add_staff_support ();
+ }
+ typeset_element (sc);
}
script_p_arr_.clear();
}
elt_l_ = (Score_element*)e;
}
-
void
Side_position_interface::add_support (Score_element*e)
{
*/
Real
-Side_position_interface::side_position (Dimension_cache const * c)
+Side_position_interface::side_position (Score_element const *cme, Axis axis)
{
- Score_element * me = (c->element_l ());
-
- Interval dim;
- Axis axis = c->axis ();
+ Score_element* me = (Score_element*)cme;
Score_element *common = me->parent_l (axis);
SCM support = me->get_elt_property ("side-support");
for (SCM s = support; s != SCM_EOL; s = gh_cdr (s))
common = common->common_refpoint (e, axis);
}
+ Interval dim;
for (SCM s = support; s != SCM_EOL; s = gh_cdr (s))
{
callback that centers the element on itself
*/
Real
-Side_position_interface::aligned_on_self (Dimension_cache const *c)
+Side_position_interface::aligned_on_self (Score_element const*elm, Axis ax)
{
String s ("self-alignment-");
- Axis ax = c->axis ();
+
s += (ax == X_AXIS) ? "X" : "Y";
- Score_element *elm = c->element_l ();
+
SCM align (elm->get_elt_property (s));
if (isdir_b (align))
{
Callback that quantises in staff-spaces, rounding in the direction
of the elements "direction" elt property. */
Real
-Side_position_interface::quantised_position (Dimension_cache const *c)
+Side_position_interface::quantised_position (Score_element const *me, Axis a)
{
- Score_element * me = (c->element_l ());
Side_position_interface s(me);
Direction d = s.get_direction ();
Staff_symbol_referencer_interface si (me);
Position next to support, taking into account my own dimensions and padding.
*/
Real
-Side_position_interface::aligned_side (Dimension_cache const *c)
+Side_position_interface::aligned_side (Score_element const*me, Axis ax)
{
- Score_element * me = (c->element_l ());
Side_position_interface s(me);
Direction d = s.get_direction ();
- Axis ax = c->axis ();
- Real o = side_position (c);
+ Real o = side_position (me,ax);
Interval iv = me->extent (ax);
Position centered on parent.
*/
Real
-Side_position_interface::centered_on_parent (Dimension_cache const *c)
+Side_position_interface::centered_on_parent (Score_element const* me, Axis a)
{
-
- Score_element *me = c->element_l ();
- Axis a = c->axis ();
Score_element *him = me->parent_l (a);
return him->extent (a).center ();
}
-Side_position_interface
-side_position (Score_element* e)
-{
- Side_position_interface si (e);
- return si;
-}
Interval
-Span_bar::width_callback (Dimension_cache const * c)
+Span_bar::width_callback (Score_element const *se, Axis a)
{
- Span_bar* s= dynamic_cast<Span_bar*> (c->element_l ());
+ Span_bar* s= dynamic_cast<Span_bar*> ((Score_element*)se);
String gl = ly_scm2string (s->get_elt_property ("glyph"));
/*
Interval
Span_bar::get_spanned_interval () const
{
- return Axis_group_interface::group_extent_callback (dim_cache_[Y_AXIS]);
+ return Axis_group_interface::group_extent_callback (this, Y_AXIS);
}
Span_bar::Span_bar ()
{
group (this).set_interface ();
- dim_cache_[X_AXIS]->set_extent_callback (width_callback);
+ set_extent_callback (width_callback, X_AXIS);
// dim_cache_[Y_AXIS]->set_extent_callback (Axis_group_interface::group_extent_callback);
- dim_cache_[Y_AXIS]->set_extent_callback (0);
+ set_extent_callback (0, Y_AXIS);
}
{
elt_l_->set_elt_property ("staff-position", gh_double2scm (0.0));
elt_l_->add_offset_callback (callback, Y_AXIS);
-
}
-
bool
Staff_symbol_referencer_interface::has_interface_b ()
{
should use offset callback!
*/
Real
-Staff_symbol_referencer_interface::callback (Dimension_cache const * c)
+Staff_symbol_referencer_interface::callback (Score_element const* sc,Axis )
{
- Score_element * sc = dynamic_cast<Score_element*> (c->element_l ());
-
-
SCM pos = sc->get_elt_property ("staff-position");
Real off =0.0;
if (gh_number_p (pos))
}
Interval
-Stem_tremolo::dim_callback (Dimension_cache const *c)
+Stem_tremolo::dim_callback (Score_element * se, Axis a)
{
- Stem_tremolo * s = dynamic_cast<Stem_tremolo*> (c->element_l ());
+ Stem_tremolo * s = dynamic_cast<Stem_tremolo*> (se);
Real space = Staff_symbol_referencer_interface (s->stem_l ())
.staff_space ();
return Interval (-space, space);
}
Interval
-Stem::dim_callback (Dimension_cache const* c)
+Stem::dim_callback (Score_element const *se, Axis )
{
- Stem * s = dynamic_cast<Stem*> (c->element_l ());
+ Stem * s = dynamic_cast<Stem*> ((Score_element*)se);
Interval r (0, 0);
if (unsmob_element (s->get_elt_property ("beam")) || abs (s->flag_i ()) <= 2)
}
Real
-Stem::off_callback (Dimension_cache const * c)
+Stem::off_callback (Score_element const* se, Axis)
{
- Stem * st = dynamic_cast<Stem*> (c->element_l ());
+ Stem *st = dynamic_cast<Stem*> ((Score_element*)se);
Real r=0;
if (Note_head * f = st->first_head ())
Molecule
System_start_delimiter::do_brew_molecule ()const
{
- Interval ext = Axis_group_interface::group_extent_callback (dim_cache_[Y_AXIS]);
+ Interval ext = Axis_group_interface::group_extent_callback (this, Y_AXIS);
Real l = ext.length ();
Molecule m;
}
else
stafy.set_axis (Y_AXIS);
-
+
+ /*
+ make sure they're in order by adding i to the priority field.
+ */
text->set_elt_property ("script-priority",
- gh_int2scm (200));
+ gh_int2scm (200 + i));
if (r->get_direction ())
stafy.set_direction (r->get_direction ());
{
for (int i=0; i < texts_.size (); i++)
{
- side_position (texts_[i]).add_staff_support ();
- typeset_element (texts_[i]);
+ Text_item *ti = texts_[i];
+ Side_position_interface (ti).add_staff_support ();
+ typeset_element (ti);
}
texts_.clear ();
}
return Timing_translator::do_try_music (m);
}
-#if 0
-String
-Timing_engraver::do_process_music ()
-{
- if (gh_string_p (get_property ("barType")))
- ;
- else if (!now_mom ())
- {
- daddy_trans_l_->set_property ("barType", ly_str02scm ("|"));
- }
- else
-
- {
- }
-}
-#endif
-
-
/*
TODO make properties of this.
*/
Musical_pitch
Transposed_music::to_relative_octave (Musical_pitch p)
{
-#if 0 // Mats?
- warning (_ ("Will ignore \\relative for transposed music"));
-#endif
+
return p;
}
*offset = - d * infinity_f;
+
+ if (!column_arr.size ())
+ return;
Real x0 = column_arr[0]->relative_coordinate (0, X_AXIS);
Real x1 = column_arr.top ()->relative_coordinate (0, X_AXIS);
Volta_spanner::Volta_spanner ()
{
set_elt_property ("bars", SCM_EOL);
- side_position (this).set_axis (Y_AXIS);
+ Side_position_interface (this).set_axis (Y_AXIS);
directional_element (this).set (UP);
}
void
Volta_spanner::after_line_breaking ()
{
- side_position (this).add_staff_support ();
+ Side_position_interface (this).add_staff_support ();
}
void
Group_interface gi(this, "bars");
gi.add_element (b);
- side_position (this).add_support (b);
+ Side_position_interface (this).add_support (b);
add_dependency (b);
}
void
Volta_spanner::add_column (Note_column* c)
{
- side_position (this).add_support (c);
+ Side_position_interface (this).add_support (c);
add_dependency (c);
}
Begin3
Title: LilyPond
-Version: 1.3.53
-Entered-date: 22MAY00
+Version: 1.3.54
+Entered-date: 25MAY00
Description:
Keywords: music notation typesetting midi fonts engraving
Author: hanwen@cs.uu.nl (Han-Wen Nienhuys)
janneke@gnu.org (Jan Nieuwenhuizen)
Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys)
Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert
- 1000k lilypond-1.3.53.tar.gz
+ 1000k lilypond-1.3.54.tar.gz
Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/
- 1000k lilypond-1.3.53.tar.gz
+ 1000k lilypond-1.3.54.tar.gz
Copying-policy: GPL
End
Name: lilypond
-Version: 1.3.53
+Version: 1.3.54
Release: 1
Copyright: GPL
Group: Applications/Publishing
-Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.53.tar.gz
+Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.54.tar.gz
Summary: A program for printing sheet music.
URL: http://www.cs.uu.nl/~hanwen/lilypond
# Icon: lilypond-icon.gif